diff --git a/library/vendor/HTMLPurifier/AttrDef/CSS/Multiple.php b/library/vendor/HTMLPurifier/AttrDef/CSS/Multiple.php index 9f266cdd1..e707f871c 100644 --- a/library/vendor/HTMLPurifier/AttrDef/CSS/Multiple.php +++ b/library/vendor/HTMLPurifier/AttrDef/CSS/Multiple.php @@ -44,7 +44,7 @@ class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef */ public function validate($string, $config, $context) { - $string = $this->parseCDATA($string); + $string = $this->mungeRgb($this->parseCDATA($string)); if ($string === '') { return false; } diff --git a/library/vendor/HTMLPurifier/AttrDef/HTML/Bool.php b/library/vendor/HTMLPurifier/AttrDef/HTML/Bool.php index 036a240e1..dea15d2cd 100644 --- a/library/vendor/HTMLPurifier/AttrDef/HTML/Bool.php +++ b/library/vendor/HTMLPurifier/AttrDef/HTML/Bool.php @@ -32,9 +32,6 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef */ public function validate($string, $config, $context) { - if (empty($string)) { - return false; - } return $this->name; } diff --git a/library/vendor/HTMLPurifier/CSSDefinition.php b/library/vendor/HTMLPurifier/CSSDefinition.php index 0acdee2d9..07cc94175 100644 --- a/library/vendor/HTMLPurifier/CSSDefinition.php +++ b/library/vendor/HTMLPurifier/CSSDefinition.php @@ -350,8 +350,7 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition $this->info['scrollbar-highlight-color'] = new HTMLPurifier_AttrDef_CSS_Color(); $this->info['scrollbar-shadow-color'] = new HTMLPurifier_AttrDef_CSS_Color(); - // technically not proprietary, but CSS3, and no one supports it - $this->info['opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue(); + // vendor specific prefixes of opacity $this->info['-moz-opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue(); $this->info['-khtml-opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue(); @@ -404,6 +403,7 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition array('visible', 'hidden', 'collapse') ); $this->info['overflow'] = new HTMLPurifier_AttrDef_Enum(array('visible', 'hidden', 'auto', 'scroll')); + $this->info['opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue(); } /** diff --git a/library/vendor/HTMLPurifier/Config.php b/library/vendor/HTMLPurifier/Config.php index 7ada59b94..2b2db0c26 100644 --- a/library/vendor/HTMLPurifier/Config.php +++ b/library/vendor/HTMLPurifier/Config.php @@ -21,7 +21,7 @@ class HTMLPurifier_Config * HTML Purifier's version * @type string */ - public $version = '4.6.0'; + public $version = '4.7.0'; /** * Whether or not to automatically finalize @@ -646,16 +646,25 @@ class HTMLPurifier_Config return $this->getDefinition($name, true, true); } + /** + * @return HTMLPurifier_HTMLDefinition + */ public function maybeGetRawHTMLDefinition() { return $this->getDefinition('HTML', true, true); } - + + /** + * @return HTMLPurifier_CSSDefinition + */ public function maybeGetRawCSSDefinition() { return $this->getDefinition('CSS', true, true); } - + + /** + * @return HTMLPurifier_URIDefinition + */ public function maybeGetRawURIDefinition() { return $this->getDefinition('URI', true, true); diff --git a/library/vendor/HTMLPurifier/ConfigSchema/schema.ser b/library/vendor/HTMLPurifier/ConfigSchema/schema.ser index 22ea32185..1e6ccd227 100644 Binary files a/library/vendor/HTMLPurifier/ConfigSchema/schema.ser and b/library/vendor/HTMLPurifier/ConfigSchema/schema.ser differ diff --git a/library/vendor/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.Predicate.txt b/library/vendor/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.Predicate.txt new file mode 100644 index 000000000..6367fe23c --- /dev/null +++ b/library/vendor/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.Predicate.txt @@ -0,0 +1,14 @@ +AutoFormat.RemoveEmpty.Predicate +TYPE: hash +VERSION: 4.7.0 +DEFAULT: array('colgroup' => array(), 'th' => array(), 'td' => array(), 'iframe' => array('src')) +--DESCRIPTION-- +

+ Given that an element has no contents, it will be removed by default, unless + this predicate dictates otherwise. The predicate can either be an associative + map from tag name to list of attributes that must be present for the element + to be considered preserved: thus, the default always preserves colgroup, + th and td, and also iframe if it + has a src. +

+--# vim: et sw=4 sts=4 diff --git a/library/vendor/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt b/library/vendor/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt index a64e3d7c3..6ed70b599 100644 --- a/library/vendor/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt +++ b/library/vendor/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt @@ -4,6 +4,6 @@ VERSION: 2.0.1 DEFAULT: NULL --DESCRIPTION-- -A custom doctype for power-users who defined there own document +A custom doctype for power-users who defined their own document type. This directive only applies when %HTML.Doctype is blank. --# vim: et sw=4 sts=4 diff --git a/library/vendor/HTMLPurifier/DefinitionCache/Serializer.php b/library/vendor/HTMLPurifier/DefinitionCache/Serializer.php index ecacb88fe..ce268d91b 100644 --- a/library/vendor/HTMLPurifier/DefinitionCache/Serializer.php +++ b/library/vendor/HTMLPurifier/DefinitionCache/Serializer.php @@ -219,9 +219,15 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac } elseif (!$this->_testPermissions($base, $chmod)) { return false; } - $old = umask(0000); mkdir($directory, $chmod); - umask($old); + if (!$this->_testPermissions($directory, $chmod)) { + trigger_error( + 'Base directory ' . $base . ' does not exist, + please create or change using %Cache.SerializerPath', + E_USER_WARNING + ); + return false; + } } elseif (!$this->_testPermissions($directory, $chmod)) { return false; } diff --git a/library/vendor/HTMLPurifier/Filter/YouTube.php b/library/vendor/HTMLPurifier/Filter/YouTube.php index 411519ad6..276d8362f 100644 --- a/library/vendor/HTMLPurifier/Filter/YouTube.php +++ b/library/vendor/HTMLPurifier/Filter/YouTube.php @@ -17,7 +17,7 @@ class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter public function preFilter($html, $config, $context) { $pre_regex = '#]+>.+?' . - 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s'; + '(?:http:)?//www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s'; $pre_replace = '\1'; return preg_replace($pre_regex, $pre_replace, $html); } @@ -51,10 +51,10 @@ class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter { $url = $this->armorUrl($matches[1]); return '' . - '' . + 'data="//www.youtube.com/' . $url . '">' . + '' . '' . diff --git a/library/vendor/HTMLPurifier/HTMLPurifier.composer.php b/library/vendor/HTMLPurifier/HTMLPurifier.composer.php index 6706f4e39..52acc56b0 100644 --- a/library/vendor/HTMLPurifier/HTMLPurifier.composer.php +++ b/library/vendor/HTMLPurifier/HTMLPurifier.composer.php @@ -1,4 +1,4 @@ parseCDATA($string); + $string = $this->mungeRgb($this->parseCDATA($string)); if ($string === '') { return false; } diff --git a/library/vendor/HTMLPurifier/HTMLPurifier/AttrDef/HTML/Bool.php b/library/vendor/HTMLPurifier/HTMLPurifier/AttrDef/HTML/Bool.php index 036a240e1..dea15d2cd 100644 --- a/library/vendor/HTMLPurifier/HTMLPurifier/AttrDef/HTML/Bool.php +++ b/library/vendor/HTMLPurifier/HTMLPurifier/AttrDef/HTML/Bool.php @@ -32,9 +32,6 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef */ public function validate($string, $config, $context) { - if (empty($string)) { - return false; - } return $this->name; } diff --git a/library/vendor/HTMLPurifier/HTMLPurifier/CSSDefinition.php b/library/vendor/HTMLPurifier/HTMLPurifier/CSSDefinition.php index 0acdee2d9..07cc94175 100644 --- a/library/vendor/HTMLPurifier/HTMLPurifier/CSSDefinition.php +++ b/library/vendor/HTMLPurifier/HTMLPurifier/CSSDefinition.php @@ -350,8 +350,7 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition $this->info['scrollbar-highlight-color'] = new HTMLPurifier_AttrDef_CSS_Color(); $this->info['scrollbar-shadow-color'] = new HTMLPurifier_AttrDef_CSS_Color(); - // technically not proprietary, but CSS3, and no one supports it - $this->info['opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue(); + // vendor specific prefixes of opacity $this->info['-moz-opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue(); $this->info['-khtml-opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue(); @@ -404,6 +403,7 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition array('visible', 'hidden', 'collapse') ); $this->info['overflow'] = new HTMLPurifier_AttrDef_Enum(array('visible', 'hidden', 'auto', 'scroll')); + $this->info['opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue(); } /** diff --git a/library/vendor/HTMLPurifier/HTMLPurifier/Config.php b/library/vendor/HTMLPurifier/HTMLPurifier/Config.php index 7ada59b94..2b2db0c26 100644 --- a/library/vendor/HTMLPurifier/HTMLPurifier/Config.php +++ b/library/vendor/HTMLPurifier/HTMLPurifier/Config.php @@ -21,7 +21,7 @@ class HTMLPurifier_Config * HTML Purifier's version * @type string */ - public $version = '4.6.0'; + public $version = '4.7.0'; /** * Whether or not to automatically finalize @@ -646,16 +646,25 @@ class HTMLPurifier_Config return $this->getDefinition($name, true, true); } + /** + * @return HTMLPurifier_HTMLDefinition + */ public function maybeGetRawHTMLDefinition() { return $this->getDefinition('HTML', true, true); } - + + /** + * @return HTMLPurifier_CSSDefinition + */ public function maybeGetRawCSSDefinition() { return $this->getDefinition('CSS', true, true); } - + + /** + * @return HTMLPurifier_URIDefinition + */ public function maybeGetRawURIDefinition() { return $this->getDefinition('URI', true, true); diff --git a/library/vendor/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer.php b/library/vendor/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer.php index ecacb88fe..ce268d91b 100644 --- a/library/vendor/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer.php +++ b/library/vendor/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer.php @@ -219,9 +219,15 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac } elseif (!$this->_testPermissions($base, $chmod)) { return false; } - $old = umask(0000); mkdir($directory, $chmod); - umask($old); + if (!$this->_testPermissions($directory, $chmod)) { + trigger_error( + 'Base directory ' . $base . ' does not exist, + please create or change using %Cache.SerializerPath', + E_USER_WARNING + ); + return false; + } } elseif (!$this->_testPermissions($directory, $chmod)) { return false; } diff --git a/library/vendor/HTMLPurifier/HTMLPurifier/Filter/YouTube.php b/library/vendor/HTMLPurifier/HTMLPurifier/Filter/YouTube.php index 411519ad6..276d8362f 100644 --- a/library/vendor/HTMLPurifier/HTMLPurifier/Filter/YouTube.php +++ b/library/vendor/HTMLPurifier/HTMLPurifier/Filter/YouTube.php @@ -17,7 +17,7 @@ class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter public function preFilter($html, $config, $context) { $pre_regex = '#]+>.+?' . - 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s'; + '(?:http:)?//www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s'; $pre_replace = '\1'; return preg_replace($pre_regex, $pre_replace, $html); } @@ -51,10 +51,10 @@ class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter { $url = $this->armorUrl($matches[1]); return '' . - '' . + 'data="//www.youtube.com/' . $url . '">' . + '' . '' . diff --git a/library/vendor/HTMLPurifier/HTMLPurifier/Injector/RemoveEmpty.php b/library/vendor/HTMLPurifier/HTMLPurifier/Injector/RemoveEmpty.php index cd885722e..01353ff1d 100644 --- a/library/vendor/HTMLPurifier/HTMLPurifier/Injector/RemoveEmpty.php +++ b/library/vendor/HTMLPurifier/HTMLPurifier/Injector/RemoveEmpty.php @@ -28,10 +28,10 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector private $removeNbspExceptions; /** + * Cached contents of %AutoFormat.RemoveEmpty.Predicate * @type array - * TODO: make me configurable */ - private $_exclude = array('colgroup' => 1, 'th' => 1, 'td' => 1, 'iframe' => 1); + private $exclude; /** * @param HTMLPurifier_Config $config @@ -45,6 +45,7 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector $this->context = $context; $this->removeNbsp = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp'); $this->removeNbspExceptions = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions'); + $this->exclude = $config->get('AutoFormat.RemoveEmpty.Predicate'); $this->attrValidator = new HTMLPurifier_AttrValidator(); } @@ -75,11 +76,15 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector break; } if (!$next || ($next instanceof HTMLPurifier_Token_End && $next->name == $token->name)) { - if (isset($this->_exclude[$token->name])) { - return; - } $this->attrValidator->validateToken($token, $this->config, $this->context); $token->armor['ValidateAttributes'] = true; + if (isset($this->exclude[$token->name])) { + $r = true; + foreach ($this->exclude[$token->name] as $elem) { + if (!isset($token->attr[$elem])) $r = false; + } + if ($r) return; + } if (isset($token->attr['id']) || isset($token->attr['name'])) { return; } diff --git a/library/vendor/HTMLPurifier/HTMLPurifier/Lexer/DOMLex.php b/library/vendor/HTMLPurifier/HTMLPurifier/Lexer/DOMLex.php index 720754454..b81819290 100644 --- a/library/vendor/HTMLPurifier/HTMLPurifier/Lexer/DOMLex.php +++ b/library/vendor/HTMLPurifier/HTMLPurifier/Lexer/DOMLex.php @@ -75,8 +75,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer $tokens = array(); $this->tokenizeDOM( $doc->getElementsByTagName('html')->item(0)-> // - getElementsByTagName('body')->item(0)-> // - getElementsByTagName('div')->item(0), //
+ getElementsByTagName('body')->item(0), // $tokens ); return $tokens; @@ -272,7 +271,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer $ret .= ''; $ret .= ''; // No protection if $html contains a stray
! - $ret .= '
' . $html . '
'; + $ret .= '' . $html . ''; return $ret; } } diff --git a/library/vendor/HTMLPurifier/HTMLPurifier/Lexer/PH5P.php b/library/vendor/HTMLPurifier/HTMLPurifier/Lexer/PH5P.php index a4587e4cd..ff4fa218f 100644 --- a/library/vendor/HTMLPurifier/HTMLPurifier/Lexer/PH5P.php +++ b/library/vendor/HTMLPurifier/HTMLPurifier/Lexer/PH5P.php @@ -34,8 +34,7 @@ class HTMLPurifier_Lexer_PH5P extends HTMLPurifier_Lexer_DOMLex $tokens = array(); $this->tokenizeDOM( $doc->getElementsByTagName('html')->item(0)-> // - getElementsByTagName('body')->item(0)-> // - getElementsByTagName('div')->item(0) //
+ getElementsByTagName('body')->item(0) // , $tokens ); diff --git a/library/vendor/HTMLPurifier/Injector/RemoveEmpty.php b/library/vendor/HTMLPurifier/Injector/RemoveEmpty.php index cd885722e..01353ff1d 100644 --- a/library/vendor/HTMLPurifier/Injector/RemoveEmpty.php +++ b/library/vendor/HTMLPurifier/Injector/RemoveEmpty.php @@ -28,10 +28,10 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector private $removeNbspExceptions; /** + * Cached contents of %AutoFormat.RemoveEmpty.Predicate * @type array - * TODO: make me configurable */ - private $_exclude = array('colgroup' => 1, 'th' => 1, 'td' => 1, 'iframe' => 1); + private $exclude; /** * @param HTMLPurifier_Config $config @@ -45,6 +45,7 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector $this->context = $context; $this->removeNbsp = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp'); $this->removeNbspExceptions = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions'); + $this->exclude = $config->get('AutoFormat.RemoveEmpty.Predicate'); $this->attrValidator = new HTMLPurifier_AttrValidator(); } @@ -75,11 +76,15 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector break; } if (!$next || ($next instanceof HTMLPurifier_Token_End && $next->name == $token->name)) { - if (isset($this->_exclude[$token->name])) { - return; - } $this->attrValidator->validateToken($token, $this->config, $this->context); $token->armor['ValidateAttributes'] = true; + if (isset($this->exclude[$token->name])) { + $r = true; + foreach ($this->exclude[$token->name] as $elem) { + if (!isset($token->attr[$elem])) $r = false; + } + if ($r) return; + } if (isset($token->attr['id']) || isset($token->attr['name'])) { return; } diff --git a/library/vendor/HTMLPurifier/Lexer/DOMLex.php b/library/vendor/HTMLPurifier/Lexer/DOMLex.php index 720754454..b81819290 100644 --- a/library/vendor/HTMLPurifier/Lexer/DOMLex.php +++ b/library/vendor/HTMLPurifier/Lexer/DOMLex.php @@ -75,8 +75,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer $tokens = array(); $this->tokenizeDOM( $doc->getElementsByTagName('html')->item(0)-> // - getElementsByTagName('body')->item(0)-> // - getElementsByTagName('div')->item(0), //
+ getElementsByTagName('body')->item(0), // $tokens ); return $tokens; @@ -272,7 +271,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer $ret .= ''; $ret .= ''; // No protection if $html contains a stray
! - $ret .= '
' . $html . '
'; + $ret .= '' . $html . ''; return $ret; } } diff --git a/library/vendor/HTMLPurifier/Lexer/PH5P.php b/library/vendor/HTMLPurifier/Lexer/PH5P.php index a4587e4cd..ff4fa218f 100644 --- a/library/vendor/HTMLPurifier/Lexer/PH5P.php +++ b/library/vendor/HTMLPurifier/Lexer/PH5P.php @@ -34,8 +34,7 @@ class HTMLPurifier_Lexer_PH5P extends HTMLPurifier_Lexer_DOMLex $tokens = array(); $this->tokenizeDOM( $doc->getElementsByTagName('html')->item(0)-> // - getElementsByTagName('body')->item(0)-> // - getElementsByTagName('div')->item(0) //
+ getElementsByTagName('body')->item(0) // , $tokens ); diff --git a/library/vendor/HTMLPurifier/SOURCE b/library/vendor/HTMLPurifier/SOURCE index 034876b50..1d8335915 100644 --- a/library/vendor/HTMLPurifier/SOURCE +++ b/library/vendor/HTMLPurifier/SOURCE @@ -1,5 +1,5 @@ -curl https://codeload.github.com/ezyang/htmlpurifier/tar.gz/v4.6.0 -o htmlpurifier-4.6.0.tar.gz -tar xzf htmlpurifier-4.6.0.tar.gz --strip-components 1 htmlpurifier-4.6.0/LICENSE -tar xzf htmlpurifier-4.6.0.tar.gz --strip-components 2 htmlpurifier-4.6.0/library/*.php -tar xzf htmlpurifier-4.6.0.tar.gz --strip-components 3 htmlpurifier-4.6.0/library/HTMLPurifier/* -rm htmlpurifier-4.6.0.tar.gz +curl https://codeload.github.com/ezyang/htmlpurifier/tar.gz/v4.7.0 -o htmlpurifier-4.7.0.tar.gz +tar xzf htmlpurifier-4.7.0.tar.gz --strip-components 1 htmlpurifier-4.7.0/LICENSE +tar xzf htmlpurifier-4.7.0.tar.gz --strip-components 2 htmlpurifier-4.7.0/library/*.php +tar xzf htmlpurifier-4.7.0.tar.gz --strip-components 3 htmlpurifier-4.7.0/library/HTMLPurifier/* +rm htmlpurifier-4.7.0.tar.gz