ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
HTMLPurifier_AttrTransform_Input Class Reference

Performs miscellaneous cross attribute validation and filtering for input elements. More...

+ Inheritance diagram for HTMLPurifier_AttrTransform_Input:
+ Collaboration diagram for HTMLPurifier_AttrTransform_Input:

Public Member Functions

 __construct ()
 
 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

 $pixels
 HTMLPurifier_AttrDef_HTML_Pixels More...
 

Detailed Description

Performs miscellaneous cross attribute validation and filtering for input elements.

This is meant to be a post-transform.

Definition at line 7 of file Input.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_AttrTransform_Input::__construct ( )

Definition at line 14 of file Input.php.

15  {
16  $this->pixels = new HTMLPurifier_AttrDef_HTML_Pixels();
17  }
Validates an integer representation of pixels according to the HTML spec.
Definition: Pixels.php:6

Member Function Documentation

◆ transform()

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

Definition at line 25 of file Input.php.

References $result, and $t.

26  {
27  if (!isset($attr['type'])) {
28  $t = 'text';
29  } else {
30  $t = strtolower($attr['type']);
31  }
32  if (isset($attr['checked']) && $t !== 'radio' && $t !== 'checkbox') {
33  unset($attr['checked']);
34  }
35  if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') {
36  unset($attr['maxlength']);
37  }
38  if (isset($attr['size']) && $t !== 'text' && $t !== 'password') {
39  $result = $this->pixels->validate($attr['size'], $config, $context);
40  if ($result === false) {
41  unset($attr['size']);
42  } else {
43  $attr['size'] = $result;
44  }
45  }
46  if (isset($attr['src']) && $t !== 'image') {
47  unset($attr['src']);
48  }
49  if (!isset($attr['value']) && ($t === 'radio' || $t === 'checkbox')) {
50  $attr['value'] = '';
51  }
52  return $attr;
53  }
$result

Field Documentation

◆ $pixels

HTMLPurifier_AttrTransform_Input::$pixels
protected

HTMLPurifier_AttrDef_HTML_Pixels

Definition at line 12 of file Input.php.


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