1: <?php
2:
3: 4: 5: 6: 7:
8: class HTMLPurifier_DefinitionCache_Decorator_Memory extends
9: HTMLPurifier_DefinitionCache_Decorator
10: {
11:
12: protected $definitions;
13: public $name = 'Memory';
14:
15: public function copy() {
16: return new HTMLPurifier_DefinitionCache_Decorator_Memory();
17: }
18:
19: public function add($def, $config) {
20: $status = parent::add($def, $config);
21: if ($status) $this->definitions[$this->generateKey($config)] = $def;
22: return $status;
23: }
24:
25: public function set($def, $config) {
26: $status = parent::set($def, $config);
27: if ($status) $this->definitions[$this->generateKey($config)] = $def;
28: return $status;
29: }
30:
31: public function replace($def, $config) {
32: $status = parent::replace($def, $config);
33: if ($status) $this->definitions[$this->generateKey($config)] = $def;
34: return $status;
35: }
36:
37: public function get($config) {
38: $key = $this->generateKey($config);
39: if (isset($this->definitions[$key])) return $this->definitions[$key];
40: $this->definitions[$key] = parent::get($config);
41: return $this->definitions[$key];
42: }
43:
44: }
45:
46:
47: