From adf17b677edeb2387671f6a0f12123e7497b5938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 18 Jan 2015 20:07:46 +0100 Subject: remove 3rd libraries --- .../HTMLPurifier/AttrDef/HTML/Bool.php | 51 ---------- .../HTMLPurifier/AttrDef/HTML/Class.php | 48 ---------- .../HTMLPurifier/AttrDef/HTML/Color.php | 51 ---------- .../HTMLPurifier/AttrDef/HTML/FrameTarget.php | 38 -------- .../htmlpurifier/HTMLPurifier/AttrDef/HTML/ID.php | 105 --------------------- .../HTMLPurifier/AttrDef/HTML/Length.php | 56 ----------- .../HTMLPurifier/AttrDef/HTML/LinkTypes.php | 72 -------------- .../HTMLPurifier/AttrDef/HTML/MultiLength.php | 60 ------------ .../HTMLPurifier/AttrDef/HTML/Nmtokens.php | 70 -------------- .../HTMLPurifier/AttrDef/HTML/Pixels.php | 76 --------------- 10 files changed, 627 deletions(-) delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Bool.php delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Class.php delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Color.php delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/FrameTarget.php delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/ID.php delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Length.php delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/LinkTypes.php delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/MultiLength.php delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Nmtokens.php delete mode 100644 inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Pixels.php (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML') diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Bool.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Bool.php deleted file mode 100644 index 1463c647..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Bool.php +++ /dev/null @@ -1,51 +0,0 @@ -name = $name; - } - - /** - * @param string $string - * @param HTMLPurifier_Config $config - * @param HTMLPurifier_Context $context - * @return bool|string - */ - public function validate($string, $config, $context) - { - if (empty($string)) { - return false; - } - return $this->name; - } - - /** - * @param string $string Name of attribute - * @return HTMLPurifier_AttrDef_HTML_Bool - */ - public function make($string) - { - return new HTMLPurifier_AttrDef_HTML_Bool($string); - } -} - -// vim: et sw=4 sts=4 diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Class.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Class.php deleted file mode 100644 index b874c7e1..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Class.php +++ /dev/null @@ -1,48 +0,0 @@ -getDefinition('HTML')->doctype->name; - if ($name == "XHTML 1.1" || $name == "XHTML 2.0") { - return parent::split($string, $config, $context); - } else { - return preg_split('/\s+/', $string); - } - } - - /** - * @param array $tokens - * @param HTMLPurifier_Config $config - * @param HTMLPurifier_Context $context - * @return array - */ - protected function filter($tokens, $config, $context) - { - $allowed = $config->get('Attr.AllowedClasses'); - $forbidden = $config->get('Attr.ForbiddenClasses'); - $ret = array(); - foreach ($tokens as $token) { - if (($allowed === null || isset($allowed[$token])) && - !isset($forbidden[$token]) && - // We need this O(n) check because of PHP's array - // implementation that casts -0 to 0. - !in_array($token, $ret, true) - ) { - $ret[] = $token; - } - } - return $ret; - } -} diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Color.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Color.php deleted file mode 100644 index 25c93fc6..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Color.php +++ /dev/null @@ -1,51 +0,0 @@ -get('Core.ColorKeywords'); - } - - $string = trim($string); - - if (empty($string)) { - return false; - } - $lower = strtolower($string); - if (isset($colors[$lower])) { - return $colors[$lower]; - } - if ($string[0] === '#') { - $hex = substr($string, 1); - } else { - $hex = $string; - } - - $length = strlen($hex); - if ($length !== 3 && $length !== 6) { - return false; - } - if (!ctype_xdigit($hex)) { - return false; - } - if ($length === 3) { - $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; - } - return "#$hex"; - } -} - -// vim: et sw=4 sts=4 diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/FrameTarget.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/FrameTarget.php deleted file mode 100644 index 7446b6da..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/FrameTarget.php +++ /dev/null @@ -1,38 +0,0 @@ -valid_values === false) { - $this->valid_values = $config->get('Attr.AllowedFrameTargets'); - } - return parent::validate($string, $config, $context); - } -} - -// vim: et sw=4 sts=4 diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/ID.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/ID.php deleted file mode 100644 index ccd4a24a..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/ID.php +++ /dev/null @@ -1,105 +0,0 @@ -selector = $selector; - } - - /** - * @param string $id - * @param HTMLPurifier_Config $config - * @param HTMLPurifier_Context $context - * @return bool|string - */ - public function validate($id, $config, $context) - { - if (!$this->selector && !$config->get('Attr.EnableID')) { - return false; - } - - $id = trim($id); // trim it first - - if ($id === '') { - return false; - } - - $prefix = $config->get('Attr.IDPrefix'); - if ($prefix !== '') { - $prefix .= $config->get('Attr.IDPrefixLocal'); - // prevent re-appending the prefix - if (strpos($id, $prefix) !== 0) { - $id = $prefix . $id; - } - } elseif ($config->get('Attr.IDPrefixLocal') !== '') { - trigger_error( - '%Attr.IDPrefixLocal cannot be used unless ' . - '%Attr.IDPrefix is set', - E_USER_WARNING - ); - } - - if (!$this->selector) { - $id_accumulator =& $context->get('IDAccumulator'); - if (isset($id_accumulator->ids[$id])) { - return false; - } - } - - // we purposely avoid using regex, hopefully this is faster - - if (ctype_alpha($id)) { - $result = true; - } else { - if (!ctype_alpha(@$id[0])) { - return false; - } - // primitive style of regexps, I suppose - $trim = trim( - $id, - 'A..Za..z0..9:-._' - ); - $result = ($trim === ''); - } - - $regexp = $config->get('Attr.IDBlacklistRegexp'); - if ($regexp && preg_match($regexp, $id)) { - return false; - } - - if (!$this->selector && $result) { - $id_accumulator->add($id); - } - - // if no change was made to the ID, return the result - // else, return the new id if stripping whitespace made it - // valid, or return false. - return $result ? $id : false; - } -} - -// vim: et sw=4 sts=4 diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Length.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Length.php deleted file mode 100644 index c8f51886..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Length.php +++ /dev/null @@ -1,56 +0,0 @@ - 100) { - return '100%'; - } - return ((string)$points) . '%'; - } -} - -// vim: et sw=4 sts=4 diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/LinkTypes.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/LinkTypes.php deleted file mode 100644 index 3f56934f..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/LinkTypes.php +++ /dev/null @@ -1,72 +0,0 @@ - 'AllowedRel', - 'rev' => 'AllowedRev' - ); - if (!isset($configLookup[$name])) { - trigger_error( - 'Unrecognized attribute name for link ' . - 'relationship.', - E_USER_ERROR - ); - return; - } - $this->name = $configLookup[$name]; - } - - /** - * @param string $string - * @param HTMLPurifier_Config $config - * @param HTMLPurifier_Context $context - * @return bool|string - */ - public function validate($string, $config, $context) - { - $allowed = $config->get('Attr.' . $this->name); - if (empty($allowed)) { - return false; - } - - $string = $this->parseCDATA($string); - $parts = explode(' ', $string); - - // lookup to prevent duplicates - $ret_lookup = array(); - foreach ($parts as $part) { - $part = strtolower(trim($part)); - if (!isset($allowed[$part])) { - continue; - } - $ret_lookup[$part] = true; - } - - if (empty($ret_lookup)) { - return false; - } - $string = implode(' ', array_keys($ret_lookup)); - return $string; - } -} - -// vim: et sw=4 sts=4 diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/MultiLength.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/MultiLength.php deleted file mode 100644 index eb713e15..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/MultiLength.php +++ /dev/null @@ -1,60 +0,0 @@ -split($string, $config, $context); - $tokens = $this->filter($tokens, $config, $context); - if (empty($tokens)) { - return false; - } - return implode(' ', $tokens); - } - - /** - * Splits a space separated list of tokens into its constituent parts. - * @param string $string - * @param HTMLPurifier_Config $config - * @param HTMLPurifier_Context $context - * @return array - */ - protected function split($string, $config, $context) - { - // OPTIMIZABLE! - // do the preg_match, capture all subpatterns for reformulation - - // we don't support U+00A1 and up codepoints or - // escaping because I don't know how to do that with regexps - // and plus it would complicate optimization efforts (you never - // see that anyway). - $pattern = '/(?:(?<=\s)|\A)' . // look behind for space or string start - '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)' . - '(?:(?=\s)|\z)/'; // look ahead for space or string end - preg_match_all($pattern, $string, $matches); - return $matches[1]; - } - - /** - * Template method for removing certain tokens based on arbitrary criteria. - * @note If we wanted to be really functional, we'd do an array_filter - * with a callback. But... we're not. - * @param array $tokens - * @param HTMLPurifier_Config $config - * @param HTMLPurifier_Context $context - * @return array - */ - protected function filter($tokens, $config, $context) - { - return $tokens; - } -} - -// vim: et sw=4 sts=4 diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Pixels.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Pixels.php deleted file mode 100644 index 1a68f238..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/HTML/Pixels.php +++ /dev/null @@ -1,76 +0,0 @@ -max = $max; - } - - /** - * @param string $string - * @param HTMLPurifier_Config $config - * @param HTMLPurifier_Context $context - * @return bool|string - */ - public function validate($string, $config, $context) - { - $string = trim($string); - if ($string === '0') { - return $string; - } - if ($string === '') { - return false; - } - $length = strlen($string); - if (substr($string, $length - 2) == 'px') { - $string = substr($string, 0, $length - 2); - } - if (!is_numeric($string)) { - return false; - } - $int = (int)$string; - - if ($int < 0) { - return '0'; - } - - // upper-bound value, extremely high values can - // crash operating systems, see - // WARNING, above link WILL crash you if you're using Windows - - if ($this->max !== null && $int > $this->max) { - return (string)$this->max; - } - return (string)$int; - } - - /** - * @param string $string - * @return HTMLPurifier_AttrDef - */ - public function make($string) - { - if ($string === '') { - $max = null; - } else { - $max = (int)$string; - } - $class = get_class($this); - return new $class($max); - } -} - -// vim: et sw=4 sts=4 -- cgit v1.2.3