File indexing completed on 2025-01-26 05:29:06
0001 <?php 0002 0003 /** 0004 * Definition cache decorator class that cleans up the cache 0005 * whenever there is a cache miss. 0006 */ 0007 class HTMLPurifier_DefinitionCache_Decorator_Cleanup extends HTMLPurifier_DefinitionCache_Decorator 0008 { 0009 /** 0010 * @type string 0011 */ 0012 public $name = 'Cleanup'; 0013 0014 /** 0015 * @return HTMLPurifier_DefinitionCache_Decorator_Cleanup 0016 */ 0017 public function copy() 0018 { 0019 return new HTMLPurifier_DefinitionCache_Decorator_Cleanup(); 0020 } 0021 0022 /** 0023 * @param HTMLPurifier_Definition $def 0024 * @param HTMLPurifier_Config $config 0025 * @return mixed 0026 */ 0027 public function add($def, $config) 0028 { 0029 $status = parent::add($def, $config); 0030 if (!$status) { 0031 parent::cleanup($config); 0032 } 0033 return $status; 0034 } 0035 0036 /** 0037 * @param HTMLPurifier_Definition $def 0038 * @param HTMLPurifier_Config $config 0039 * @return mixed 0040 */ 0041 public function set($def, $config) 0042 { 0043 $status = parent::set($def, $config); 0044 if (!$status) { 0045 parent::cleanup($config); 0046 } 0047 return $status; 0048 } 0049 0050 /** 0051 * @param HTMLPurifier_Definition $def 0052 * @param HTMLPurifier_Config $config 0053 * @return mixed 0054 */ 0055 public function replace($def, $config) 0056 { 0057 $status = parent::replace($def, $config); 0058 if (!$status) { 0059 parent::cleanup($config); 0060 } 0061 return $status; 0062 } 0063 0064 /** 0065 * @param HTMLPurifier_Config $config 0066 * @return mixed 0067 */ 0068 public function get($config) 0069 { 0070 $ret = parent::get($config); 0071 if (!$ret) { 0072 parent::cleanup($config); 0073 } 0074 return $ret; 0075 } 0076 } 0077 0078 // vim: et sw=4 sts=4