ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
HTMLPurifier_AttrDef_CSS_TextDecoration Class Reference

Validates the value for the CSS property text-decoration. More...

+ Inheritance diagram for HTMLPurifier_AttrDef_CSS_TextDecoration:
+ Collaboration diagram for HTMLPurifier_AttrDef_CSS_TextDecoration:

Public Member Functions

 validate ($string, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_AttrDef
 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...
 

Additional Inherited Members

- Data Fields inherited from HTMLPurifier_AttrDef
 $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...
 
- Protected Member Functions inherited from HTMLPurifier_AttrDef
 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...
 

Detailed Description

Validates the value for the CSS property text-decoration.

Note
This class could be generalized into a version that acts sort of like Enum except you can compound the allowed values.

Definition at line 8 of file TextDecoration.php.

Member Function Documentation

◆ validate()

HTMLPurifier_AttrDef_CSS_TextDecoration::validate (   $string,
  $config,
  $context 
)
Parameters
string$string
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool|string

Definition at line 17 of file TextDecoration.php.

References HTMLPurifier_AttrDef\parseCDATA().

18  {
19  static $allowed_values = array(
20  'line-through' => true,
21  'overline' => true,
22  'underline' => true,
23  );
24 
25  $string = strtolower($this->parseCDATA($string));
26 
27  if ($string === 'none') {
28  return $string;
29  }
30 
31  $parts = explode(' ', $string);
32  $final = '';
33  foreach ($parts as $part) {
34  if (isset($allowed_values[$part])) {
35  $final .= $part . ' ';
36  }
37  }
38  $final = rtrim($final);
39  if ($final === '') {
40  return false;
41  }
42  return $final;
43  }
parseCDATA($string)
Convenience method that parses a string as if it were CDATA.
Definition: AttrDef.php:60
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: