ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
HTMLPurifier_AttrDef_CSS_Composite Class Reference

Allows multiple validators to attempt to validate attribute. More...

+ Inheritance diagram for HTMLPurifier_AttrDef_CSS_Composite:
+ Collaboration diagram for HTMLPurifier_AttrDef_CSS_Composite:

Public Member Functions

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

Data Fields

 $defs
 List of objects that may process strings. More...
 
- 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...
 

Additional Inherited Members

- 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

Allows multiple validators to attempt to validate attribute.

Composite is just what it sounds like: a composite of many validators. This means that multiple HTMLPurifier_AttrDef objects will have a whack at the string. If one of them passes, that's what is returned. This is especially useful for CSS values, which often are a choice between an enumerated set of predefined values or a flexible data type.

Definition at line 12 of file Composite.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_AttrDef_CSS_Composite::__construct (   $defs)
Parameters
HTMLPurifier_AttrDef[]$defsList of HTMLPurifier_AttrDef objects

Definition at line 25 of file Composite.php.

26 {
27 $this->defs = $defs;
28 }
$defs
List of objects that may process strings.
Definition: Composite.php:20

References $defs.

Member Function Documentation

◆ validate()

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

Reimplemented from HTMLPurifier_AttrDef.

Definition at line 36 of file Composite.php.

37 {
38 foreach ($this->defs as $i => $def) {
39 $result = $this->defs[$i]->validate($string, $config, $context);
40 if ($result !== false) {
41 return $result;
42 }
43 }
44 return false;
45 }
$result

References $result.

Field Documentation

◆ $defs

HTMLPurifier_AttrDef_CSS_Composite::$defs

List of objects that may process strings.

@type HTMLPurifier_AttrDef[]

Todo:
Make protected

Definition at line 20 of file Composite.php.

Referenced by __construct().


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