ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
HTMLPurifier_AttrTransform_Length Class Reference

Class for handling width/height length attribute transformations to CSS. More...

+ Inheritance diagram for HTMLPurifier_AttrTransform_Length:
+ Collaboration diagram for HTMLPurifier_AttrTransform_Length:

Public Member Functions

 __construct ($name, $css_name=null)
 
 transform ($attr, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_AttrTransform
 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...
 

Protected Attributes

 $name
 string More...
 
 $cssName
 string More...
 

Detailed Description

Class for handling width/height length attribute transformations to CSS.

Definition at line 6 of file Length.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_AttrTransform_Length::__construct (   $name,
  $css_name = null 
)

Definition at line 19 of file Length.php.

References $name.

20  {
21  $this->name = $name;
22  $this->cssName = $css_name ? $css_name : $name;
23  }

Member Function Documentation

◆ transform()

HTMLPurifier_AttrTransform_Length::transform (   $attr,
  $config,
  $context 
)
Parameters
array$attr
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
array

Definition at line 31 of file Length.php.

References HTMLPurifier_AttrTransform\confiscateAttr(), and HTMLPurifier_AttrTransform\prependCSS().

32  {
33  if (!isset($attr[$this->name])) {
34  return $attr;
35  }
36  $length = $this->confiscateAttr($attr, $this->name);
37  if (ctype_digit($length)) {
38  $length .= 'px';
39  }
40  $this->prependCSS($attr, $this->cssName . ":$length;");
41  return $attr;
42  }
confiscateAttr(&$attr, $key)
Retrieves and removes an attribute.
prependCSS(&$attr, $css)
Prepends CSS properties to the style attribute, creating the attribute if it doesn't exist...
+ Here is the call graph for this function:

Field Documentation

◆ $cssName

HTMLPurifier_AttrTransform_Length::$cssName
protected

string

Definition at line 17 of file Length.php.

◆ $name

HTMLPurifier_AttrTransform_Length::$name
protected

string

Definition at line 12 of file Length.php.

Referenced by __construct().


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