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