summaryrefslogtreecommitdiffstats
path: root/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-21 22:53:36 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-21 22:53:36 +0200
commitfe030e7339f5fc9ec4e75d9655b2ced0900da5c2 (patch)
treed87fc2bc4504392550c3aea0abb18614d36f8abb /3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef
parent8c2a1b242c1cd2f7bcb179facc524f3454e7a863 (diff)
use composer for autoloading repos
Diffstat (limited to '3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef')
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php106
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php34
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php111
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php157
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php56
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php105
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Composite.php48
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php44
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Filter.php77
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Font.php176
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php219
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Ident.php32
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php56
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Length.php77
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ListStyle.php112
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Multiple.php71
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Number.php84
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Percentage.php54
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php46
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/URI.php74
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/Clone.php44
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/Enum.php73
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php51
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Class.php48
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Color.php51
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php38
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/ID.php105
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Length.php56
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/LinkTypes.php72
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/MultiLength.php60
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Nmtokens.php70
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Pixels.php76
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/Integer.php91
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/Lang.php86
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/Switch.php53
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/Text.php21
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/URI.php111
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email.php20
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php29
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php128
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv4.php45
-rw-r--r--3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv6.php89
42 files changed, 0 insertions, 3156 deletions
diff --git a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php b/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php
deleted file mode 100644
index 02c1641fb..000000000
--- a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-/**
- * Validates the HTML attribute style, otherwise known as CSS.
- * @note We don't implement the whole CSS specification, so it might be
- * difficult to reuse this component in the context of validating
- * actual stylesheet declarations.
- * @note If we were really serious about validating the CSS, we would
- * tokenize the styles and then parse the tokens. Obviously, we
- * are not doing that. Doing that could seriously harm performance,
- * but would make these components a lot more viable for a CSS
- * filtering solution.
- */
-class HTMLPurifier_AttrDef_CSS extends HTMLPurifier_AttrDef
-{
-
- /**
- * @param string $css
- * @param HTMLPurifier_Config $config
- * @param HTMLPurifier_Context $context
- * @return bool|string
- */
- public function validate($css, $config, $context)
- {
- $css = $this->parseCDATA($css);
-
- $definition = $config->getCSSDefinition();
-
- // we're going to break the spec and explode by semicolons.
- // This is because semicolon rarely appears in escaped form
- // Doing this is generally flaky but fast
- // IT MIGHT APPEAR IN URIs, see HTMLPurifier_AttrDef_CSSURI
- // for details
-
- $declarations = explode(';', $css);
- $propvalues = array();
-
- /**
- * Name of the current CSS property being validated.
- */
- $property = false;
- $context->register('CurrentCSSProperty', $property);
-
- foreach ($declarations as $declaration) {
- if (!$declaration) {
- continue;
- }
- if (!strpos($declaration, ':')) {
- continue;
- }
- list($property, $value) = explode(':', $declaration, 2);
- $property = trim($property);
- $value = trim($value);
- $ok = false;
- do {
- if (isset($definition->info[$property])) {
- $ok = true;
- break;
- }
- if (ctype_lower($property)) {
- break;
- }
- $property = strtolower($property);
- if (isset($definition->info[$property])) {
- $ok = true;
- break;
- }
- } while (0);
- if (!$ok) {
- continue;
- }
- // inefficient call, since the validator will do this again
- if (strtolower(trim($value)) !== 'inherit') {
- // inherit works for everything (but only on the base property)
- $result = $definition->info[$property]->validate(
- $value,
- $config,
- $context
- );
- } else {
- $result = 'inherit';
- }
- if ($result === false) {
- continue;
- }
- $propvalues[$property] = $result;
- }
-
- $context->destroy('CurrentCSSProperty');
-
- // procedure does not write the new CSS simultaneously, so it's
- // slightly inefficient, but it's the only way of getting rid of
- // duplicates. Perhaps config to optimize it, but not now.
-
- $new_declarations = '';
- foreach ($propvalues as $prop => $value) {
- $new_declarations .= "$prop:$value;";
- }
-
- return $new_declarations ? $new_declarations : false;
-
- }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php b/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php
deleted file mode 100644
index af2b83dff..000000000
--- a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Number
-{
-
- public function __construct()
- {
- parent::__construct(false); // opacity is non-negative, but we will clamp it
- }
-
- /**
- * @param string $number
- * @param HTMLPurifier_Config $config
- * @param HTMLPurifier_Context $context
- * @return string
- */
- public function validate($number, $config, $context)
- {
- $result = parent::validate($number, $config, $context);
- if ($result === false) {
- return $result;
- }
- $float = (float)$result;
- if ($float < 0.0) {
- $result = '0';
- }
- if ($float > 1.0) {
- $result = '1';
- }
- return $result;
- }
-}
-
-// vim: et sw=4 sts=4
diff --git a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php b/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php
deleted file mode 100644
index 7f1ea3b0f..000000000
--- a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-/**
- * Validates shorthand CSS property background.
- * @warning Does not support url tokens that have internal spaces.
- */
-class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
-{
-
- /**
- * Local copy of component validators.
- * @type HTMLPurifier_AttrDef[]
- * @note See HTMLPurifier_AttrDef_Font::$info for a similar impl.
- */
- protected $info;
-
- /**
- * @param HTMLPurifier_Config $config
- */
- public function __construct($config)
- {
- $def = $config->getCSSDefinition();
- $this->info['background-color'] = $def->info['background-color'];
- $this->info['background-image'] = $def->info['background-image'];
- $this->info['background-repeat'] = $def->info['background-repeat'];
- $this->info['background-attachment'] = $def->info['background-attachment'];
- $this->info['background-position'] = $def->info['background-position'];
- }
-
- /**
- * @param string $string
- * @param HTMLPurifier_Config $config
- * @param HTMLPurifier_Context $context
- * @return bool|string
- */
- public function validate($string, $config, $context)
- {
- // regular pre-processing
- $string = $this->parseCDATA($string);
- if ($string === '') {
- return false;
- }
-
- // munge rgb() decl if necessary
- $string = $this->mungeRgb($string);
-
- // assumes URI doesn't have spaces in it
- $bits = explode(' ', $string); // bits to process
-
- $caught = array();
- $caught['color'] = false;
- $caught['image'] = false;
- $caught['repeat'] = false;
- $caught['attachment'] = false;
- $caught['position'] = false;
-
- $i = 0; // number of catches
-
- foreach ($bits as $bit) {
- if ($bit === '') {
- continue;
- }
- foreach ($caught as $key => $status) {
- if ($key != 'position') {
- if ($status !== false) {
- continue;
- }
- $r = $this->info['background-' . $key]->validate($bit, $config, $context);
- } else {
- $r = $bit;
- }
- if ($r === false) {
- continue;
- }
- if ($key == 'position') {
- if ($caught[$key] === false) {
- $caught[$key] = '';
- }
- $caught[$key] .= $r . ' ';
- } else {
- $caught[$key] = $r;
- }
- $i++;
- break;
- }
- }
-
- if (!$i) {
- return false;
- }
- if ($caught['position'] !== false) {
- $caught['position'] = $this->info['background-position']->
- validate($caught['position'], $config, $context);
- }
-
- $ret = array();
- foreach ($caught as $value) {
- if ($value === false) {
- continue;
- }
- $ret[] = $value;
- }
-
- if (empty($ret)) {
- return false;
- }
- return implode(' ', $ret);
- }
-}
-
-// vim: et sw=4 sts=4
diff --git a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php b/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
deleted file mode 100644
index 4580ef5a9..000000000
--- a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-
-/* W3C says:
- [ // adjective and number must be in correct order, even if
- // you could switch them without introducing ambiguity.
- // some browsers support that syntax
- [
- <percentage> | <length> | left | center | right
- ]
- [
- <percentage> | <length> | top | center | bottom
- ]?
- ] |
- [ // this signifies that the vertical and horizontal adjectives
- // can be arbitrarily ordered, however, there can only be two,
- // one of each, or none at all
- [
- left | center | right
- ] ||
- [
- top | center | bottom
- ]
- ]
- top, left = 0%
- center, (none) = 50%
- bottom, right = 100%
-*/
-
-/* QuirksMode says:
- keyword + length/percentage must be ordered correctly, as per W3C
-
- Internet Explorer and Opera, however, support arbitrary ordering. We
- should fix it up.
-
- Minor issue though, not strictly necessary.
-*/
-
-// control freaks may appreciate the ability to convert these to
-// percentages or something, but it's not necessary
-
-/**
- * Validates the value of background-position.
- */
-class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
-{
-
- /**
- * @type HTMLPurifier_AttrDef_CSS_Length
- */
- protected $length;
-
- /**
- * @type HTMLPurifier_AttrDef_CSS_Percentage
- */
- protected $percentage;
-
- public function __construct()
- {
- $this->length = new HTMLPurifier_AttrDef_CSS_Length();
- $this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
- }
-
- /**
- * @param string $string
- * @param HTMLPurifier_Config $config
- * @param HTMLPurifier_Context $context
- * @return bool|string
- */
- public function validate($string, $config, $context)
- {
- $string = $this->parseCDATA($string);
- $bits = explode(' ', $string);
-
- $keywords = array();
- $keywords['h'] = false; // left, right
- $keywords['v'] = false; // top, bottom
- $keywords['ch'] = false; // center (first word)
- $keywords['cv'] = false; // center (second word)
- $measures = array();
-
- $i = 0;
-
- $lookup = array(
- 'top' => 'v',
- 'bottom' => 'v',
- 'left' => 'h',
- 'right' => 'h',
- 'center' => 'c'
- );
-
- foreach ($bits as $bit) {
- if ($bit === '') {
- continue;
- }
-
- // test for keyword
- $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
- if (isset($lookup[$lbit])) {
- $status = $lookup[$lbit];
- if ($status == 'c') {
- if ($i == 0) {
- $status = 'ch';
- } else {
- $status = 'cv';
- }
- }
- $keywords[$status] = $lbit;
- $i++;
- }
-
- // test for length
- $r = $this->length->validate($bit, $config, $context);
- if ($r !== false) {
- $measures[] = $r;
- $i++;
- }
-
- // test for percentage
- $r = $this->percentage->validate($bit, $config, $context);
- if ($r !== false) {
- $measures[] = $r;
- $i++;
- }
- }
-
- if (!$i) {
- return false;
- } // no valid values were caught
-
- $ret = array();
-
- // first keyword
- if ($keywords['h']) {
- $ret[] = $keywords['h'];
- } elseif ($keywords['ch']) {
- $ret[] = $keywords['ch'];
- $keywords['cv'] = false; // prevent re-use: center = center center
- } elseif (count($measures)) {
- $ret[] = array_shift($measures);
- }
-
- if ($keywords['v']) {
- $ret[] = $keywords['v'];
- } elseif ($keywords['cv']) {
- $ret[] = $keywords['cv'];
- } elseif (count($measures)) {
- $ret[] = array_shift($measures);
- }
-
- if (empty($ret)) {
- return false;
- }
- return implode(' ', $ret);
- }
-}
-
-// vim: et sw=4 sts=4
diff --git a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php b/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php
deleted file mode 100644
index 16243ba1e..000000000
--- a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * Validates the border property as defined by CSS.
- */
-class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
-{
-
- /**
- * Local copy of properties this property is shorthand for.
- * @type HTMLPurifier_AttrDef[]
- */
- protected $info = array();
-
- /**
- * @param HTMLPurifier_Config $config
- */
- public function __construct($config)
- {
- $def = $config->getCSSDefinition();
- $this->info['border-width'] = $def->info['border-width'];
- $this->info['border-style'] = $def->info['border-style'];
- $this->info['border-top-color'] = $def->info['border-top-color'];
- }
-
- /**
- * @param string $string
- * @param HTMLPurifier_Config $config
- * @param HTMLPurifier_Context $context
- * @return bool|string
- */
- public function validate($string, $config, $context)
- {
- $string = $this->parseCDATA($string);
- $string = $this->mungeRgb($string);
- $bits = explode(' ', $string);
- $done = array(); // segments we've finished
- $ret = ''; // return value
- foreach ($bits as $bit) {
- foreach ($this->info as $propname => $validator) {
- if (isset($done[$propname])) {
- continue;
- }
- $r = $validator->validate($bit, $config, $context);
- if ($r !== false) {
- $ret .= $r . ' ';
- $done[$propname] = true;
- break;
- }
- }
- }
- return rtrim($ret);
- }
-}
-
-// vim: et sw=4 sts=4
diff --git a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php b/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php
deleted file mode 100644
index 16d2a6b98..000000000
--- a/3rdparty/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-/**
- * Validates Color as defined by CSS.
- */
-class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
-{
-
- /**
- * @param string $color
- * @param HTMLPurifier_Config $config
- * @param HTMLPurifier_Context $context
- * @return bool|string
- */
- public function validate($color, $config, $context)
- {
- static $colors = null;
- if ($colors === null) {
- $colors = $config->get('Core.ColorKeywords');
- }
-
- $color = trim($color);
- if ($color === '') {
- return false;
- }
-
- $lower = strtolower($color);
- if (isset($colors[$lower])) {
- return $colors[$lower];
- }
-
- if (strpos($color, 'rgb(') !== false) {
- // rgb literal handling
- $length = strlen($color);
- if (strpos($color, ')') !== $length - 1) {
- return false;
- }
- $triad = substr($color, 4, $length - 4 - 1);
- $parts = explode(',', $triad);
- if (count($parts) !== 3) {
- return false;
- }
- $type = false; // to ensure that they're all the same type
- $new_parts = array();
- foreach ($parts as $part) {
- $part = tri