ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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)
 Abstract: makes changes to the attributes dependent on multiple values.
- Public Member Functions inherited from HTMLPurifier_AttrTransform
 prependCSS (&$attr, $css)
 Prepends CSS properties to the style attribute, creating the attribute if it doesn't exist.
 confiscateAttr (&$attr, $key)
 Retrieves and removes an attribute.

Protected Attributes

 $pixels

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

HTMLPurifier_AttrTransform_Input::__construct ( )

Definition at line 11 of file Input.php.

{
$this->pixels = new HTMLPurifier_AttrDef_HTML_Pixels();
}

Member Function Documentation

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

Abstract: makes changes to the attributes dependent on multiple values.

Parameters
$attrAssoc array of attributes, usually from HTMLPurifier_Token_Tag::$attr
$configMandatory HTMLPurifier_Config object.
$contextMandatory HTMLPurifier_Context object
Returns
Processed attribute array.

Reimplemented from HTMLPurifier_AttrTransform.

Definition at line 15 of file Input.php.

References $config, $result, and $t.

{
if (!isset($attr['type'])) $t = 'text';
else $t = strtolower($attr['type']);
if (isset($attr['checked']) && $t !== 'radio' && $t !== 'checkbox') {
unset($attr['checked']);
}
if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') {
unset($attr['maxlength']);
}
if (isset($attr['size']) && $t !== 'text' && $t !== 'password') {
$result = $this->pixels->validate($attr['size'], $config, $context);
if ($result === false) unset($attr['size']);
else $attr['size'] = $result;
}
if (isset($attr['src']) && $t !== 'image') {
unset($attr['src']);
}
if (!isset($attr['value']) && ($t === 'radio' || $t === 'checkbox')) {
$attr['value'] = '';
}
return $attr;
}

Field Documentation

HTMLPurifier_AttrTransform_Input::$pixels
protected

Definition at line 9 of file Input.php.


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