Validates shorthand CSS property background.
More...
|
| __construct ($config) |
|
| validate ($string, $config, $context) |
|
| validate ($string, $config, $context) |
| Validates and cleans passed string according to a definition. More...
|
|
| parseCDATA ($string) |
| Convenience method that parses a string as if it were CDATA. More...
|
|
| make ($string) |
| Factory method for creating this class from a string. More...
|
|
|
| $minimized = false |
| Tells us whether or not an HTML attribute is minimized. More...
|
|
| $required = false |
| Tells us whether or not an HTML attribute is required. More...
|
|
| mungeRgb ($string) |
| Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work properly. More...
|
|
| expandCSSEscape ($string) |
| Parses a possibly escaped CSS string and returns the "pure" version of it. More...
|
|
Validates shorthand CSS property background.
- Warning
- Does not support url tokens that have internal spaces.
Definition at line 7 of file Background.php.
◆ __construct()
HTMLPurifier_AttrDef_CSS_Background::__construct |
( |
|
$config | ) |
|
- Parameters
-
Definition at line 20 of file Background.php.
22 $def = $config->getCSSDefinition();
23 $this->info[
'background-color'] = $def->info[
'background-color'];
24 $this->info[
'background-image'] = $def->info[
'background-image'];
25 $this->info[
'background-repeat'] = $def->info[
'background-repeat'];
26 $this->info[
'background-attachment'] = $def->info[
'background-attachment'];
27 $this->info[
'background-position'] = $def->info[
'background-position'];
◆ validate()
HTMLPurifier_AttrDef_CSS_Background::validate |
( |
|
$string, |
|
|
|
$config, |
|
|
|
$context |
|
) |
| |
- Parameters
-
- Returns
- bool|string
Definition at line 36 of file Background.php.
References $r, $ret, HTMLPurifier_AttrDef\mungeRgb(), and HTMLPurifier_AttrDef\parseCDATA().
48 $bits = explode(
' ', $string);
51 $caught[
'color'] =
false;
52 $caught[
'image'] =
false;
53 $caught[
'repeat'] =
false;
54 $caught[
'attachment'] =
false;
55 $caught[
'position'] =
false;
59 foreach ($bits as $bit) {
63 foreach ($caught as $key => $status) {
64 if ($key !=
'position') {
65 if ($status !==
false) {
68 $r = $this->info[
'background-' . $key]->validate($bit, $config, $context);
75 if ($key ==
'position') {
76 if ($caught[$key] ===
false) {
79 $caught[$key] .=
$r .
' ';
91 if ($caught[
'position'] !==
false) {
92 $caught[
'position'] = $this->info[
'background-position']->
93 validate($caught[
'position'], $config, $context);
97 foreach ($caught as $value) {
98 if ($value ===
false) {
107 return implode(
' ',
$ret);
validate($string, $config, $context)
parseCDATA($string)
Convenience method that parses a string as if it were CDATA.
mungeRgb($string)
Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work properly.
◆ $info
HTMLPurifier_AttrDef_CSS_Background::$info |
|
protected |
The documentation for this class was generated from the following file:
- Services/Html/HtmlPurifier/library/HTMLPurifier/AttrDef/CSS/Background.php