]> git.wh0rd.org - tt-rss.git/blame - lib/htmlpurifier/library/HTMLPurifier/HTMLModule/Image.php
remove Archived articles from Uncategorized view
[tt-rss.git] / lib / htmlpurifier / library / HTMLPurifier / HTMLModule / Image.php
CommitLineData
f45a286b
AD
1<?php
2
3/**
4 * XHTML 1.1 Image Module provides basic image embedding.
5 * @note There is specialized code for removing empty images in
6 * HTMLPurifier_Strategy_RemoveForeignElements
7 */
8class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
9{
10
11 public $name = 'Image';
12
13 public function setup($config) {
f4f0f80d 14 $max = $config->get('HTML.MaxImgLength');
f45a286b
AD
15 $img = $this->addElement(
16 'img', 'Inline', 'Empty', 'Common',
17 array(
18 'alt*' => 'Text',
19 // According to the spec, it's Length, but percents can
20 // be abused, so we allow only Pixels.
21 'height' => 'Pixels#' . $max,
22 'width' => 'Pixels#' . $max,
23 'longdesc' => 'URI',
24 'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded
25 )
26 );
f4f0f80d 27 if ($max === null || $config->get('HTML.Trusted')) {
f45a286b
AD
28 $img->attr['height'] =
29 $img->attr['width'] = 'Length';
30 }
31
32 // kind of strange, but splitting things up would be inefficient
33 $img->attr_transform_pre[] =
34 $img->attr_transform_post[] =
35 new HTMLPurifier_AttrTransform_ImgRequired();
36 }
37
38}
39
40// vim: et sw=4 sts=4