File indexing completed on 2024-12-22 05:36:18
0001 <?php 0002 0003 /** 0004 * Decorator which enables CSS properties to be disabled for specific elements. 0005 */ 0006 class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef 0007 { 0008 /** 0009 * @type HTMLPurifier_AttrDef 0010 */ 0011 public $def; 0012 /** 0013 * @type string 0014 */ 0015 public $element; 0016 0017 /** 0018 * @param HTMLPurifier_AttrDef $def Definition to wrap 0019 * @param string $element Element to deny 0020 */ 0021 public function __construct($def, $element) 0022 { 0023 $this->def = $def; 0024 $this->element = $element; 0025 } 0026 0027 /** 0028 * Checks if CurrentToken is set and equal to $this->element 0029 * @param string $string 0030 * @param HTMLPurifier_Config $config 0031 * @param HTMLPurifier_Context $context 0032 * @return bool|string 0033 */ 0034 public function validate($string, $config, $context) 0035 { 0036 $token = $context->get('CurrentToken', true); 0037 if ($token && $token->name == $this->element) { 0038 return false; 0039 } 0040 return $this->def->validate($string, $config, $context); 0041 } 0042 } 0043 0044 // vim: et sw=4 sts=4