Source for file EntityLookup.php

Documentation is available at EntityLookup.php

  1. <?php
  2.  
  3. /**
  4.  * Object that provides entity lookup table from entity name to character
  5.  */
  6.     
  7.     /**
  8.      * Assoc array of entity name to character represented.
  9.      */
  10.     public $table;
  11.     
  12.     /**
  13.      * Sets up the entity lookup table from the serialized file contents.
  14.      * @note The serialized contents are versioned, but were generated
  15.      *        using the maintenance script generate_entity_file.php
  16.      * @warning This is not in constructor to help enforce the Singleton
  17.      */
  18.     public function setup($file false{
  19.         if (!$file{
  20.             $file HTMLPURIFIER_PREFIX '/HTMLPurifier/EntityLookup/entities.ser';
  21.         }
  22.         $this->table = unserialize(file_get_contents($file));
  23.     }
  24.     
  25.     /**
  26.      * Retrieves sole instance of the object.
  27.      * @param Optional prototype of custom lookup table to overload with.
  28.      */
  29.     public static function instance($prototype false{
  30.         // no references, since PHP doesn't copy unless modified
  31.         static $instance null;
  32.         if ($prototype{
  33.             $instance $prototype;
  34.         elseif (!$instance{
  35.             $instance new HTMLPurifier_EntityLookup();
  36.             $instance->setup();
  37.         }
  38.         return $instance;
  39.     }
  40.     
  41. }

Documentation generated on Thu, 19 Jun 2008 18:49:08 -0400 by phpDocumentor 1.4.2