aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/htmlpurifier/HTMLPurifier/EntityLookup.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2014-02-21 15:57:10 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2014-02-21 15:57:10 +0100
commit99679d06884120c57f43b44e55e03595f1f87bed (patch)
treea3f2a1aa1afdaeca1386d0c6e8a75344fd2241fb /inc/3rdparty/htmlpurifier/HTMLPurifier/EntityLookup.php
parent655214ab30ee84884dc408488b85586f36263fcb (diff)
parentd3b47e94705e17b3ba3529cbb1dc6efe69c5d2b7 (diff)
downloadwallabag-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/EntityLookup.php')
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/EntityLookup.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/EntityLookup.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/EntityLookup.php
new file mode 100644
index 00000000..cb3474e3
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/EntityLookup.php
@@ -0,0 +1,48 @@
1<?php
2
3/**
4 * Object that provides entity lookup table from entity name to character
5 */
6class HTMLPurifier_EntityLookup
7{
8 /**
9 * Assoc array of entity name to character represented.
10 * @type array
11 */
12 public $table;
13
14 /**
15 * Sets up the entity lookup table from the serialized file contents.
16 * @param bool $file
17 * @note The serialized contents are versioned, but were generated
18 * using the maintenance script generate_entity_file.php
19 * @warning This is not in constructor to help enforce the Singleton
20 */
21 public function setup($file = false)
22 {
23 if (!$file) {
24 $file = HTMLPURIFIER_PREFIX . '/HTMLPurifier/EntityLookup/entities.ser';
25 }
26 $this->table = unserialize(file_get_contents($file));
27 }
28
29 /**
30 * Retrieves sole instance of the object.
31 * @param bool|HTMLPurifier_EntityLookup $prototype Optional prototype of custom lookup table to overload with.
32 * @return HTMLPurifier_EntityLookup
33 */
34 public static function instance($prototype = false)
35 {
36 // no references, since PHP doesn't copy unless modified
37 static $instance = null;
38 if ($prototype) {
39 $instance = $prototype;
40 } elseif (!$instance) {
41 $instance = new HTMLPurifier_EntityLookup();
42 $instance->setup();
43 }
44 return $instance;
45 }
46}
47
48// vim: et sw=4 sts=4