Prepended constants with C_ to avoid reserved words as per https://www.php.net/manual...
[htmlpurifier/darkodev.git] / library / HTMLPurifier / DefinitionCache / Decorator / Cleanup.php
blob4991777ce1a79de7e863aac1c5326fe2f36ca966
1 <?php
3 /**
4 * Definition cache decorator class that cleans up the cache
5 * whenever there is a cache miss.
6 */
7 class HTMLPurifier_DefinitionCache_Decorator_Cleanup extends HTMLPurifier_DefinitionCache_Decorator
9 /**
10 * @type string
12 public $name = 'Cleanup';
14 /**
15 * @return HTMLPurifier_DefinitionCache_Decorator_Cleanup
17 public function copy()
19 return new HTMLPurifier_DefinitionCache_Decorator_Cleanup();
22 /**
23 * @param HTMLPurifier_Definition $def
24 * @param HTMLPurifier_Config $config
25 * @return mixed
27 public function add($def, $config)
29 $status = parent::add($def, $config);
30 if (!$status) {
31 parent::cleanup($config);
33 return $status;
36 /**
37 * @param HTMLPurifier_Definition $def
38 * @param HTMLPurifier_Config $config
39 * @return mixed
41 public function set($def, $config)
43 $status = parent::set($def, $config);
44 if (!$status) {
45 parent::cleanup($config);
47 return $status;
50 /**
51 * @param HTMLPurifier_Definition $def
52 * @param HTMLPurifier_Config $config
53 * @return mixed
55 public function replace($def, $config)
57 $status = parent::replace($def, $config);
58 if (!$status) {
59 parent::cleanup($config);
61 return $status;
64 /**
65 * @param HTMLPurifier_Config $config
66 * @return mixed
68 public function get($config)
70 $ret = parent::get($config);
71 if (!$ret) {
72 parent::cleanup($config);
74 return $ret;
78 // vim: et sw=4 sts=4