4 * Performs miscellaneous cross attribute validation and filtering for
5 * input elements. This is meant to be a post-transform.
7 class HTMLPurifier_AttrTransform_Input extends HTMLPurifier_AttrTransform
10 * @type HTMLPurifier_AttrDef_HTML_Pixels
14 public function __construct()
16 $this->pixels = new HTMLPurifier_AttrDef_HTML_Pixels();
21 * @param HTMLPurifier_Config $config
22 * @param HTMLPurifier_Context $context
25 public function transform($attr, $config, $context)
27 if (!isset($attr['type'])) {
30 $t = strtolower($attr['type']);
32 if (isset($attr['checked']) && $t !== 'radio' && $t !== 'checkbox') {
33 unset($attr['checked']);
35 if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') {
36 unset($attr['maxlength']);
38 if (isset($attr['size']) && $t !== 'text' && $t !== 'password') {
39 $result = $this->pixels->validate($attr['size'], $config, $context);
40 if ($result === false) {
43 $attr['size'] = $result;
46 if (isset($attr['src']) && $t !== 'image') {
49 if (!isset($attr['value']) && ($t === 'radio' || $t === 'checkbox')) {