diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-02-21 15:57:10 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-02-21 15:57:10 +0100 |
commit | 99679d06884120c57f43b44e55e03595f1f87bed (patch) | |
tree | a3f2a1aa1afdaeca1386d0c6e8a75344fd2241fb /inc/3rdparty/htmlpurifier/HTMLPurifier/StringHash.php | |
parent | 655214ab30ee84884dc408488b85586f36263fcb (diff) | |
parent | d3b47e94705e17b3ba3529cbb1dc6efe69c5d2b7 (diff) | |
download | wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.gz wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.zst wallabag-99679d06884120c57f43b44e55e03595f1f87bed.zip |
Merge pull request #481 from wallabag/dev1.5.2
1.5.2
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/StringHash.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/StringHash.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/StringHash.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/StringHash.php new file mode 100644 index 00000000..8d0740cd --- /dev/null +++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/StringHash.php | |||
@@ -0,0 +1,47 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * This is in almost every respect equivalent to an array except | ||
5 | * that it keeps track of which keys were accessed. | ||
6 | * | ||
7 | * @warning For the sake of backwards compatibility with early versions | ||
8 | * of PHP 5, you must not use the $hash[$key] syntax; if you do | ||
9 | * our version of offsetGet is never called. | ||
10 | */ | ||
11 | class HTMLPurifier_StringHash extends ArrayObject | ||
12 | { | ||
13 | /** | ||
14 | * @type array | ||
15 | */ | ||
16 | protected $accessed = array(); | ||
17 | |||
18 | /** | ||
19 | * Retrieves a value, and logs the access. | ||
20 | * @param mixed $index | ||
21 | * @return mixed | ||
22 | */ | ||
23 | public function offsetGet($index) | ||
24 | { | ||
25 | $this->accessed[$index] = true; | ||
26 | return parent::offsetGet($index); | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * Returns a lookup array of all array indexes that have been accessed. | ||
31 | * @return array in form array($index => true). | ||
32 | */ | ||
33 | public function getAccessed() | ||
34 | { | ||
35 | return $this->accessed; | ||
36 | } | ||
37 | |||
38 | /** | ||
39 | * Resets the access array. | ||
40 | */ | ||
41 | public function resetAccessed() | ||
42 | { | ||
43 | $this->accessed = array(); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | // vim: et sw=4 sts=4 | ||