Defines allowed CSS attributes and what their values are.
More...
|
| setup ($config) |
| Setup function that aborts if already setup. More...
|
|
Defines allowed CSS attributes and what their values are.
- See also
- HTMLPurifier_HTMLDefinition
Definition at line 7 of file CSSDefinition.php.
◆ doSetup()
HTMLPurifier_CSSDefinition::doSetup |
( |
|
$config | ) |
|
|
protected |
Constructs the info array.
The meat of this class.
- Parameters
-
Definition at line 22 of file CSSDefinition.php.
References $border_style, $config, array, doSetupProprietary(), doSetupTricky(), doSetupTrusted(), and setupConfigStuff().
25 array(
'left',
'right',
'center',
'justify'),
30 $this->info[
'border-bottom-style'] =
31 $this->info[
'border-right-style'] =
32 $this->info[
'border-left-style'] =
52 array(
'none',
'left',
'right',
'both'),
56 array(
'none',
'left',
'right'),
60 array(
'normal',
'italic',
'oblique'),
64 array(
'normal',
'small-caps'),
76 array(
'inside',
'outside'),
93 $this->info[
'list-style-image'] = $uri_or_none;
98 array(
'capitalize',
'uppercase',
'lowercase',
'none'),
103 $this->info[
'background-image'] = $uri_or_none;
105 array(
'repeat',
'repeat-x',
'repeat-y',
'no-repeat')
108 array(
'scroll',
'fixed')
113 $this->info[
'border-top-color'] =
114 $this->info[
'border-bottom-color'] =
115 $this->info[
'border-left-color'] =
116 $this->info[
'border-right-color'] =
129 $this->info[
'border-top-width'] =
130 $this->info[
'border-bottom-width'] =
131 $this->info[
'border-left-width'] =
185 $this->info[
'margin-top'] =
186 $this->info[
'margin-bottom'] =
187 $this->info[
'margin-left'] =
200 $this->info[
'padding-top'] =
201 $this->info[
'padding-bottom'] =
202 $this->info[
'padding-left'] =
226 $max =
$config->get(
'CSS.MaxImgLength');
228 $this->info[
'width'] =
229 $this->info[
'height'] =
274 $this->info[
'border'] =
275 $this->info[
'border-bottom'] =
276 $this->info[
'border-top'] =
277 $this->info[
'border-left'] =
281 array(
'collapse',
'separate')
285 array(
'top',
'bottom')
289 array(
'auto',
'fixed')
316 array(
'nowrap',
'normal',
'pre',
'pre-wrap',
'pre-line')
319 if (
$config->get(
'CSS.Proprietary')) {
323 if (
$config->get(
'CSS.AllowTricky')) {
327 if (
$config->get(
'CSS.Trusted')) {
331 $allow_important =
$config->get(
'CSS.AllowImportant');
333 foreach ($this->info as $k => $v) {
Decorator that, depending on a token, switches between two definitions.
Validates the value for the CSS property text-decoration.
Represents a Length as defined by CSS.
Validates shorthand CSS property background.
Validates a number as defined by the CSS spec.
Allows multiple validators to attempt to validate attribute.
Validates a Percentage as defined by the CSS spec.
setupConfigStuff($config)
Performs extra config-based processing.
Validates a font family list according to CSS spec.
Validates Color as defined by CSS.
Validates shorthand CSS property font.
Validates a URI in CSS syntax, which uses url('http://example.com')
Create styles array
The data for the language used.
Validates the border property as defined by CSS.
Validates the value of background-position.
Decorator which enables !important to be used in CSS values.
Validates a keyword against a list of valid values.
Framework class for strings that involve multiple values.
Validates shorthand CSS property list-style.
doSetupProprietary($config)
◆ doSetupProprietary()
HTMLPurifier_CSSDefinition::doSetupProprietary |
( |
|
$config | ) |
|
|
protected |
- Parameters
-
Definition at line 343 of file CSSDefinition.php.
References array.
Referenced by doSetup().
361 $this->info[
'page-break-after'] =
379 $this->info[
'border-top-left-radius'] =
380 $this->info[
'border-top-right-radius'] =
381 $this->info[
'border-bottom-right-radius'] =
Represents a Length as defined by CSS.
Allows multiple validators to attempt to validate attribute.
Validates a Percentage as defined by the CSS spec.
Microsoft's proprietary filter: CSS property.
Validates Color as defined by CSS.
Create styles array
The data for the language used.
Validates a keyword against a list of valid values.
Framework class for strings that involve multiple values.
◆ doSetupTricky()
HTMLPurifier_CSSDefinition::doSetupTricky |
( |
|
$config | ) |
|
|
protected |
- Parameters
-
Definition at line 391 of file CSSDefinition.php.
References array.
Referenced by doSetup().
405 'table-header-group',
406 'table-footer-group',
408 'table-column-group',
416 array(
'visible',
'hidden',
'collapse')
Create styles array
The data for the language used.
Validates a keyword against a list of valid values.
◆ doSetupTrusted()
HTMLPurifier_CSSDefinition::doSetupTrusted |
( |
|
$config | ) |
|
|
protected |
- Parameters
-
Definition at line 425 of file CSSDefinition.php.
References array.
Referenced by doSetup().
428 array(
'static',
'relative',
'absolute',
'fixed')
431 $this->info[
'left'] =
432 $this->info[
'right'] =
Represents a Length as defined by CSS.
Allows multiple validators to attempt to validate attribute.
Validates a Percentage as defined by the CSS spec.
Create styles array
The data for the language used.
Validates a keyword against a list of valid values.
◆ setupConfigStuff()
HTMLPurifier_CSSDefinition::setupConfigStuff |
( |
|
$config | ) |
|
|
protected |
Performs extra config-based processing.
Based off of HTMLPurifier_HTMLDefinition.
- Parameters
-
- Todo:
- Refactor duplicate elements into common class (probably using composition, not inheritance).
Definition at line 455 of file CSSDefinition.php.
References $config, and $d.
Referenced by doSetup().
458 $support =
"(for information on implementing this, see the " .
460 $allowed_properties =
$config->get(
'CSS.AllowedProperties');
461 if ($allowed_properties !== null) {
462 foreach ($this->info as $name =>
$d) {
463 if (!isset($allowed_properties[$name])) {
464 unset($this->info[$name]);
466 unset($allowed_properties[$name]);
469 foreach ($allowed_properties as $name =>
$d) {
471 $name = htmlspecialchars($name);
472 trigger_error(
"Style attribute '$name' is not supported $support", E_USER_WARNING);
476 $forbidden_properties =
$config->get(
'CSS.ForbiddenProperties');
477 if ($forbidden_properties !== null) {
478 foreach ($this->info as $name =>
$d) {
479 if (isset($forbidden_properties[$name])) {
480 unset($this->info[$name]);
for($col=0; $col< 50; $col++) $d
◆ $info
HTMLPurifier_CSSDefinition::$info = array() |
◆ $type
HTMLPurifier_CSSDefinition::$type = 'CSS' |
The documentation for this class was generated from the following file: