ILIAS  release_4-4 Revision
HTMLPurifier_AttrDef_CSS_Border Class Reference

Validates the border property as defined by CSS. More...

+ Inheritance diagram for HTMLPurifier_AttrDef_CSS_Border:
+ Collaboration diagram for HTMLPurifier_AttrDef_CSS_Border:

Public Member Functions

 __construct ($config)
 
 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...
 

Protected Attributes

 $info = array()
 Local copy of properties this property is shorthand for. 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 border property as defined by CSS.

Definition at line 6 of file Border.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_AttrDef_CSS_Border::__construct (   $config)

Definition at line 14 of file Border.php.

14  {
15  $def = $config->getCSSDefinition();
16  $this->info['border-width'] = $def->info['border-width'];
17  $this->info['border-style'] = $def->info['border-style'];
18  $this->info['border-top-color'] = $def->info['border-top-color'];
19  }

Member Function Documentation

◆ validate()

HTMLPurifier_AttrDef_CSS_Border::validate (   $string,
  $config,
  $context 
)

Definition at line 21 of file Border.php.

References $r, $ret, HTMLPurifier_AttrDef\mungeRgb(), and HTMLPurifier_AttrDef\parseCDATA().

21  {
22  $string = $this->parseCDATA($string);
23  $string = $this->mungeRgb($string);
24  $bits = explode(' ', $string);
25  $done = array(); // segments we've finished
26  $ret = ''; // return value
27  foreach ($bits as $bit) {
28  foreach ($this->info as $propname => $validator) {
29  if (isset($done[$propname])) continue;
30  $r = $validator->validate($bit, $config, $context);
31  if ($r !== false) {
32  $ret .= $r . ' ';
33  $done[$propname] = true;
34  break;
35  }
36  }
37  }
38  return rtrim($ret);
39  }
parseCDATA($string)
Convenience method that parses a string as if it were CDATA.
Definition: AttrDef.php:58
mungeRgb($string)
Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work properly.
Definition: AttrDef.php:81
$r
+ Here is the call graph for this function:

Field Documentation

◆ $info

HTMLPurifier_AttrDef_CSS_Border::$info = array()
protected

Local copy of properties this property is shorthand for.

Definition at line 12 of file Border.php.


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