1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 03:10:09 +02:00

Add lots of documentation.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@293 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-17 20:29:34 +00:00
parent 252c5afae0
commit 66ddc4cc5a
8 changed files with 116 additions and 29 deletions

View File

@@ -22,23 +22,23 @@ HTMLPurifier_ConfigDef::define(
class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform
{
function transform($attributes, $config) {
function transform($attr, $config) {
$src = true;
if (!isset($attributes['src'])) {
$attributes['src'] = $config->get('Attr', 'DefaultInvalidImage');
if (!isset($attr['src'])) {
$attr['src'] = $config->get('Attr', 'DefaultInvalidImage');
$src = false;
}
if (!isset($attributes['alt'])) {
if (!isset($attr['alt'])) {
if ($src) {
$attributes['alt'] = basename($attributes['src']);
$attr['alt'] = basename($attr['src']);
} else {
$attributes['alt'] = $config->get('Attr', 'DefaultInvalidImageAlt');
$attr['alt'] = $config->get('Attr', 'DefaultInvalidImageAlt');
}
}
return $attributes;
return $attr;
}