[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/htmlpurifier/library/HTMLPurifier/ -> EntityLookup.php (source)

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


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1