ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)
Parameters
HTMLPurifier_Config$config

Definition at line 18 of file Border.php.

References $config, $def, and info().

19  {
20  $def = $config->getCSSDefinition();
21  $this->info['border-width'] = $def->info['border-width'];
22  $this->info['border-style'] = $def->info['border-style'];
23  $this->info['border-top-color'] = $def->info['border-top-color'];
24  }
$config
Definition: bootstrap.php:15
$def
Definition: croninfo.php:21
info()
Definition: info.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ validate()

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

Definition at line 32 of file Border.php.

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

33  {
34  $string = $this->parseCDATA($string);
35  $string = $this->mungeRgb($string);
36  $bits = explode(' ', $string);
37  $done = array(); // segments we've finished
38  $ret = ''; // return value
39  foreach ($bits as $bit) {
40  foreach ($this->info as $propname => $validator) {
41  if (isset($done[$propname])) {
42  continue;
43  }
44  $r = $validator->validate($bit, $config, $context);
45  if ($r !== false) {
46  $ret .= $r . ' ';
47  $done[$propname] = true;
48  break;
49  }
50  }
51  }
52  return rtrim($ret);
53  }
$context
Definition: webdav.php:25
$config
Definition: bootstrap.php:15
$r
Definition: example_031.php:79
parseCDATA($string)
Convenience method that parses a string as if it were CDATA.
Definition: AttrDef.php:60
mungeRgb($string)
Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work properly.
Definition: AttrDef.php:87
$ret
Definition: parser.php:6
info()
Definition: info.php:2
+ 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.

HTMLPurifier_AttrDef[]

Definition at line 13 of file Border.php.


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