HTMLPurifier 4.4.0
/home/ezyang/Dev/htmlpurifier/library/HTMLPurifier/EntityLookup.php
Go to the documentation of this file.
00001 <?php
00002 
00006 class HTMLPurifier_EntityLookup {
00007 
00011     public $table;
00012 
00019     public function setup($file = false) {
00020         if (!$file) {
00021             $file = HTMLPURIFIER_PREFIX . '/HTMLPurifier/EntityLookup/entities.ser';
00022         }
00023         $this->table = unserialize(file_get_contents($file));
00024     }
00025 
00030     public static function instance($prototype = false) {
00031         // no references, since PHP doesn't copy unless modified
00032         static $instance = null;
00033         if ($prototype) {
00034             $instance = $prototype;
00035         } elseif (!$instance) {
00036             $instance = new HTMLPurifier_EntityLookup();
00037             $instance->setup();
00038         }
00039         return $instance;
00040     }
00041 
00042 }
00043 
00044 // vim: et sw=4 sts=4