ILIAS  release_4-4 Revision
HTMLPurifier_AttrDef_HTML_Class Class Reference

Implements special behavior for class attribute (normally NMTOKENS) More...

+ Inheritance diagram for HTMLPurifier_AttrDef_HTML_Class:
+ Collaboration diagram for HTMLPurifier_AttrDef_HTML_Class:

Protected Member Functions

 split ($string, $config, $context)
 
 filter ($tokens, $config, $context)
 
- Protected Member Functions inherited from HTMLPurifier_AttrDef_HTML_Nmtokens
 split ($string, $config, $context)
 Splits a space separated list of tokens into its constituent parts. More...
 
 filter ($tokens, $config, $context)
 Template method for removing certain tokens based on arbitrary criteria. 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...
 

Additional Inherited Members

- Public Member Functions inherited from HTMLPurifier_AttrDef_HTML_Nmtokens
 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 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...
 

Detailed Description

Implements special behavior for class attribute (normally NMTOKENS)

Definition at line 6 of file Class.php.

Member Function Documentation

◆ filter()

HTMLPurifier_AttrDef_HTML_Class::filter (   $tokens,
  $config,
  $context 
)
protected

Definition at line 17 of file Class.php.

References $ret.

17  {
18  $allowed = $config->get('Attr.AllowedClasses');
19  $forbidden = $config->get('Attr.ForbiddenClasses');
20  $ret = array();
21  foreach ($tokens as $token) {
22  if (
23  ($allowed === null || isset($allowed[$token])) &&
24  !isset($forbidden[$token]) &&
25  // We need this O(n) check because of PHP's array
26  // implementation that casts -0 to 0.
27  !in_array($token, $ret, true)
28  ) {
29  $ret[] = $token;
30  }
31  }
32  return $ret;
33  }

◆ split()

HTMLPurifier_AttrDef_HTML_Class::split (   $string,
  $config,
  $context 
)
protected

Definition at line 8 of file Class.php.

8  {
9  // really, this twiddle should be lazy loaded
10  $name = $config->getDefinition('HTML')->doctype->name;
11  if ($name == "XHTML 1.1" || $name == "XHTML 2.0") {
12  return parent::split($string, $config, $context);
13  } else {
14  return preg_split('/\s+/', $string);
15  }
16  }

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