1: | <?php
|
2: |
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class HTMLPurifier_DefinitionCache_Decorator_Memory extends HTMLPurifier_DefinitionCache_Decorator
|
9: | {
|
10: | |
11: | |
12: |
|
13: | protected $definitions;
|
14: |
|
15: | |
16: | |
17: |
|
18: | public $name = 'Memory';
|
19: |
|
20: | |
21: | |
22: |
|
23: | public function copy()
|
24: | {
|
25: | return new HTMLPurifier_DefinitionCache_Decorator_Memory();
|
26: | }
|
27: |
|
28: | |
29: | |
30: | |
31: | |
32: |
|
33: | public function add($def, $config)
|
34: | {
|
35: | $status = parent::add($def, $config);
|
36: | if ($status) {
|
37: | $this->definitions[$this->generateKey($config)] = $def;
|
38: | }
|
39: | return $status;
|
40: | }
|
41: |
|
42: | |
43: | |
44: | |
45: | |
46: |
|
47: | public function set($def, $config)
|
48: | {
|
49: | $status = parent::set($def, $config);
|
50: | if ($status) {
|
51: | $this->definitions[$this->generateKey($config)] = $def;
|
52: | }
|
53: | return $status;
|
54: | }
|
55: |
|
56: | |
57: | |
58: | |
59: | |
60: |
|
61: | public function replace($def, $config)
|
62: | {
|
63: | $status = parent::replace($def, $config);
|
64: | if ($status) {
|
65: | $this->definitions[$this->generateKey($config)] = $def;
|
66: | }
|
67: | return $status;
|
68: | }
|
69: |
|
70: | |
71: | |
72: | |
73: |
|
74: | public function get($config)
|
75: | {
|
76: | $key = $this->generateKey($config);
|
77: | if (isset($this->definitions[$key])) {
|
78: | return $this->definitions[$key];
|
79: | }
|
80: | $this->definitions[$key] = parent::get($config);
|
81: | return $this->definitions[$key];
|
82: | }
|
83: | }
|
84: |
|
85: |
|
86: | |