ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
HTMLPurifier_AttrDef_CSS_Ident Class Reference

Validates based on {ident} CSS grammar production. More...

+ Inheritance diagram for HTMLPurifier_AttrDef_CSS_Ident:
+ Collaboration diagram for HTMLPurifier_AttrDef_CSS_Ident:

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 based on {ident} CSS grammar production.

Definition at line 6 of file Ident.php.

Member Function Documentation

◆ validate()

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

Definition at line 15 of file Ident.php.

16  {
17  $string = trim($string);
18 
19  // early abort: '' and '0' (strings that convert to false) are invalid
20  if (!$string) {
21  return false;
22  }
23 
24  $pattern = '/^(-?[A-Za-z_][A-Za-z_\-0-9]*)$/';
25  if (!preg_match($pattern, $string)) {
26  return false;
27  }
28  return $string;
29  }

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