00001 <?php 00002 00003 // must be called POST validation 00004 00011 class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform 00012 { 00013 00014 public function transform($attr, $config, $context) { 00015 00016 $src = true; 00017 if (!isset($attr['src'])) { 00018 if ($config->get('Core.RemoveInvalidImg')) return $attr; 00019 $attr['src'] = $config->get('Attr.DefaultInvalidImage'); 00020 $src = false; 00021 } 00022 00023 if (!isset($attr['alt'])) { 00024 if ($src) { 00025 $alt = $config->get('Attr.DefaultImageAlt'); 00026 if ($alt === null) { 00027 $attr['alt'] = basename($attr['src']); 00028 } else { 00029 $attr['alt'] = $alt; 00030 } 00031 } else { 00032 $attr['alt'] = $config->get('Attr.DefaultInvalidImageAlt'); 00033 } 00034 } 00035 00036 return $attr; 00037 00038 } 00039 00040 } 00041 00042 // vim: et sw=4 sts=4
| Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved. MyOOS [Shopsystem] is Free Software released under the GNU/GPL License. Webmaster: info@r23.de (Impressum) |
|
