ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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)
 Splits a space separated list of tokens into its constituent parts.
 filter ($tokens, $config, $context)
 Template method for removing certain tokens based on arbitrary criteria.

Additional Inherited Members

- Public Member Functions inherited from HTMLPurifier_AttrDef_HTML_Nmtokens
 validate ($string, $config, $context)
 Validates and cleans passed string according to a definition.
- Data Fields inherited from HTMLPurifier_AttrDef
 $minimized = false
 Tells us whether or not an HTML attribute is minimized.
 $required = false
 Tells us whether or not an HTML attribute is required.

Detailed Description

Implements special behavior for class attribute (normally NMTOKENS)

Definition at line 6 of file Class.php.

Member Function Documentation

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

Template method for removing certain tokens based on arbitrary criteria.

Note
If we wanted to be really functional, we'd do an array_filter with a callback. But... we're not.

Reimplemented from HTMLPurifier_AttrDef_HTML_Nmtokens.

Definition at line 17 of file Class.php.

References $ret.

{
$allowed = $config->get('Attr.AllowedClasses');
$forbidden = $config->get('Attr.ForbiddenClasses');
$ret = array();
foreach ($tokens as $token) {
if (
($allowed === null || isset($allowed[$token])) &&
!isset($forbidden[$token]) &&
// We need this O(n) check because of PHP's array
// implementation that casts -0 to 0.
!in_array($token, $ret, true)
) {
$ret[] = $token;
}
}
return $ret;
}
HTMLPurifier_AttrDef_HTML_Class::split (   $string,
  $config,
  $context 
)
protected

Splits a space separated list of tokens into its constituent parts.

Reimplemented from HTMLPurifier_AttrDef_HTML_Nmtokens.

Definition at line 8 of file Class.php.

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

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