1: <?php
2:
3: 4: 5: 6: 7:
8: class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
9: {
10:
11: public $name = 'Image';
12:
13: public function setup($config) {
14: $max = $config->get('HTML.MaxImgLength');
15: $img = $this->addElement(
16: 'img', 'Inline', 'Empty', 'Common',
17: array(
18: 'alt*' => 'Text',
19:
20:
21: 'height' => 'Pixels#' . $max,
22: 'width' => 'Pixels#' . $max,
23: 'longdesc' => 'URI',
24: 'src*' => new HTMLPurifier_AttrDef_URI(true),
25: )
26: );
27: if ($max === null || $config->get('HTML.Trusted')) {
28: $img->attr['height'] =
29: $img->attr['width'] = 'Length';
30: }
31:
32:
33: $img->attr_transform_pre[] =
34: $img->attr_transform_post[] =
35: new HTMLPurifier_AttrTransform_ImgRequired();
36: }
37:
38: }
39:
40:
41: