Validates the value of background-position.
More...
|
| __construct () |
|
| 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 the value of background-position.
Definition at line 44 of file BackgroundPosition.php.
◆ __construct()
HTMLPurifier_AttrDef_CSS_BackgroundPosition::__construct |
( |
| ) |
|
Definition at line 50 of file BackgroundPosition.php.
Represents a Length as defined by CSS.
Validates a Percentage as defined by the CSS spec.
◆ validate()
HTMLPurifier_AttrDef_CSS_BackgroundPosition::validate |
( |
|
$string, |
|
|
|
$config, |
|
|
|
$context |
|
) |
| |
Definition at line 55 of file BackgroundPosition.php.
References $r, $ret, and HTMLPurifier_AttrDef\parseCDATA().
57 $bits = explode(
' ', $string);
60 $keywords[
'h'] =
false;
61 $keywords[
'v'] =
false;
62 $keywords[
'ch'] =
false;
63 $keywords[
'cv'] =
false;
76 foreach ($bits as $bit) {
77 if ($bit ===
'')
continue;
80 $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
81 if (isset($lookup[$lbit])) {
82 $status = $lookup[$lbit];
90 $keywords[$status] = $lbit;
95 $r = $this->length->validate($bit, $config, $context);
102 $r = $this->percentage->validate($bit, $config, $context);
110 if (!$i)
return false;
115 if ($keywords[
'h'])
$ret[] = $keywords[
'h'];
116 elseif ($keywords[
'ch']) {
117 $ret[] = $keywords[
'ch'];
118 $keywords[
'cv'] =
false;
120 elseif (count($measures))
$ret[] = array_shift($measures);
122 if ($keywords[
'v'])
$ret[] = $keywords[
'v'];
123 elseif ($keywords[
'cv'])
$ret[] = $keywords[
'cv'];
124 elseif (count($measures))
$ret[] = array_shift($measures);
126 if (empty(
$ret))
return false;
127 return implode(
' ',
$ret);
parseCDATA($string)
Convenience method that parses a string as if it were CDATA.
◆ $length
HTMLPurifier_AttrDef_CSS_BackgroundPosition::$length |
|
protected |
◆ $percentage
HTMLPurifier_AttrDef_CSS_BackgroundPosition::$percentage |
|
protected |
The documentation for this class was generated from the following file: