1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-06 22:26:31 +02:00

Implement %Attr.DefaultImageAlt, allowing overriding default behavior for alt attributes.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2008-10-06 14:51:03 -04:00
parent 70515dd48f
commit f7bc0b0875
6 changed files with 34 additions and 4 deletions

View File

@@ -22,7 +22,12 @@ class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform
if (!isset($attr['alt'])) {
if ($src) {
$attr['alt'] = basename($attr['src']);
$alt = $config->get('Attr', 'DefaultImageAlt');
if ($alt === null) {
$attr['alt'] = basename($attr['src']);
} else {
$attr['alt'] = $alt;
}
} else {
$attr['alt'] = $config->get('Attr', 'DefaultInvalidImageAlt');
}