ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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
 
 $cssName
 

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 12 of file Length.php.

References $name.

12  {
13  $this->name = $name;
14  $this->cssName = $css_name ? $css_name : $name;
15  }

Member Function Documentation

◆ transform()

HTMLPurifier_AttrTransform_Length::transform (   $attr,
  $config,
  $context 
)

Definition at line 17 of file Length.php.

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

17  {
18  if (!isset($attr[$this->name])) return $attr;
19  $length = $this->confiscateAttr($attr, $this->name);
20  if(ctype_digit($length)) $length .= 'px';
21  $this->prependCSS($attr, $this->cssName . ":$length;");
22  return $attr;
23  }
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

Definition at line 10 of file Length.php.

◆ $name

HTMLPurifier_AttrTransform_Length::$name
protected

Definition at line 9 of file Length.php.

Referenced by __construct().


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