X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=library%2Fezyang%2Fhtmlpurifier%2Flibrary%2FHTMLPurifier%2FHTMLModule%2FImage.php;fp=library%2Fezyang%2Fhtmlpurifier%2Flibrary%2FHTMLPurifier%2FHTMLModule%2FImage.php;h=0f5fdb3baf2054df81a08c0472a33086aff42599;hb=c28109ca947b5c5867ec052058dd2115f82aa0ff;hp=0000000000000000000000000000000000000000;hpb=3c97a6703cd5a743fc9339f52996bcb1eb436ef0;p=friendica.git diff --git a/library/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Image.php b/library/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Image.php new file mode 100644 index 0000000000..0f5fdb3baf --- /dev/null +++ b/library/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Image.php @@ -0,0 +1,49 @@ +get('HTML.MaxImgLength'); + $img = $this->addElement( + 'img', + 'Inline', + 'Empty', + 'Common', + array( + 'alt*' => 'Text', + // According to the spec, it's Length, but percents can + // be abused, so we allow only Pixels. + 'height' => 'Pixels#' . $max, + 'width' => 'Pixels#' . $max, + 'longdesc' => 'URI', + 'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded + ) + ); + if ($max === null || $config->get('HTML.Trusted')) { + $img->attr['height'] = + $img->attr['width'] = 'Length'; + } + + // kind of strange, but splitting things up would be inefficient + $img->attr_transform_pre[] = + $img->attr_transform_post[] = + new HTMLPurifier_AttrTransform_ImgRequired(); + } +} + +// vim: et sw=4 sts=4