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

Processes an entire attribute array for corrections needing multiple values. More...

+ Inheritance diagram for HTMLPurifier_AttrTransform:
+ Collaboration diagram for HTMLPurifier_AttrTransform:

Public Member Functions

 transform ($attr, $config, $context)
 Abstract: makes changes to the attributes dependent on multiple values. More...
 
 prependCSS (&$attr, $css)
 Prepends CSS properties to the style attribute, creating the attribute if it doesn't exist. More...
 
 confiscateAttr (&$attr, $key)
 Retrieves and removes an attribute. More...
 

Detailed Description

Processes an entire attribute array for corrections needing multiple values.

Occasionally, a certain attribute will need to be removed and popped onto another value. Instead of creating a complex return syntax for HTMLPurifier_AttrDef, we just pass the whole attribute array to a specialized object and have that do the special work. That is the family of HTMLPurifier_AttrTransform.

An attribute transformation can be assigned to run before or after HTMLPurifier_AttrDef validation. See HTMLPurifier_HTMLDefinition for more details.

Definition at line 17 of file AttrTransform.php.

Member Function Documentation

◆ confiscateAttr()

HTMLPurifier_AttrTransform::confiscateAttr ( $attr,
  $key 
)

Retrieves and removes an attribute.

Parameters
array&$attrAttribute array to process (passed by reference)
mixed$keyKey of attribute to confiscate
Returns
mixed

Definition at line 49 of file AttrTransform.php.

50 {
51 if (!isset($attr[$key])) {
52 return null;
53 }
54 $value = $attr[$key];
55 unset($attr[$key]);
56 return $value;
57 }

Referenced by HTMLPurifier_AttrTransform_Background\transform(), HTMLPurifier_AttrTransform_BgColor\transform(), HTMLPurifier_AttrTransform_Border\transform(), HTMLPurifier_AttrTransform_ImgSpace\transform(), HTMLPurifier_AttrTransform_Length\transform(), and HTMLPurifier_AttrTransform_Name\transform().

+ Here is the caller graph for this function:

◆ prependCSS()

HTMLPurifier_AttrTransform::prependCSS ( $attr,
  $css 
)

Prepends CSS properties to the style attribute, creating the attribute if it doesn't exist.

Parameters
array&$attrAttribute array to process (passed by reference)
string$cssCSS to prepend

Definition at line 37 of file AttrTransform.php.

38 {
39 $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
40 $attr['style'] = $css . $attr['style'];
41 }

Referenced by HTMLPurifier_AttrTransform_Background\transform(), HTMLPurifier_AttrTransform_BgColor\transform(), HTMLPurifier_AttrTransform_BoolToCSS\transform(), HTMLPurifier_AttrTransform_Border\transform(), HTMLPurifier_AttrTransform_EnumToCSS\transform(), HTMLPurifier_AttrTransform_ImgSpace\transform(), and HTMLPurifier_AttrTransform_Length\transform().

+ Here is the caller graph for this function:

◆ transform()


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