4 * Object that provides entity lookup table from entity name to character
6 class HTMLPurifier_EntityLookup
{
9 * Assoc array of entity name to character represented.
15 * Sets up the entity lookup table from the serialized file contents.
16 * @note The serialized contents are versioned, but were generated
17 * using the maintenance script generate_entity_file.php
18 * @warning This is not in constructor to help enforce the Singleton
20 function setup($file = false) {
22 $file = HTMLPURIFIER_PREFIX
. '/HTMLPurifier/EntityLookup/entities.ser';
24 $this->table
= unserialize(file_get_contents($file));
28 * Retrieves sole instance of the object.
30 * @param Optional prototype of custom lookup table to overload with.
32 function instance($prototype = false) {
33 // no references, since PHP doesn't copy unless modified
34 static $instance = null;
36 $instance = $prototype;
37 } elseif (!$instance) {
38 $instance = new HTMLPurifier_EntityLookup();