diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-02-21 15:57:10 +0100 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-02-21 15:57:10 +0100 |
commit | 99679d06884120c57f43b44e55e03595f1f87bed (patch) | |
tree | a3f2a1aa1afdaeca1386d0c6e8a75344fd2241fb /inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php | |
parent | 655214ab30ee84884dc408488b85586f36263fcb (diff) | |
parent | d3b47e94705e17b3ba3529cbb1dc6efe69c5d2b7 (diff) | |
download | wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.gz wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.zst wallabag-99679d06884120c57f43b44e55e03595f1f87bed.zip |
Merge pull request #481 from wallabag/dev1.5.2
1.5.2
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php new file mode 100644 index 00000000..0ed7411e --- /dev/null +++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php | |||
@@ -0,0 +1,49 @@ | |||
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 | */ | ||
8 | class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule | ||
9 | { | ||
10 | |||
11 | /** | ||
12 | * @type string | ||
13 | */ | ||
14 | public $name = 'Image'; | ||
15 | |||
16 | /** | ||
17 | * @param HTMLPurifier_Config $config | ||
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 | // According to the spec, it's Length, but percents can | ||
30 | // be abused, so we allow only Pixels. | ||
31 | 'height' => 'Pixels#' . $max, | ||
32 | 'width' => 'Pixels#' . $max, | ||
33 | 'longdesc' => 'URI', | ||
34 | 'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded | ||
35 | ) | ||
36 | ); | ||
37 | if ($max === null || $config->get('HTML.Trusted')) { | ||
38 | $img->attr['height'] = | ||
39 | $img->attr['width'] = 'Length'; | ||
40 | } | ||
41 | |||
42 | // kind of strange, but splitting things up would be inefficient | ||
43 | $img->attr_transform_pre[] = | ||
44 | $img->attr_transform_post[] = | ||
45 | new HTMLPurifier_AttrTransform_ImgRequired(); | ||
46 | } | ||
47 | } | ||
48 | |||
49 | // vim: et sw=4 sts=4 | ||