2006-07-23 21:07:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_EntityLookup {
|
|
|
|
|
|
|
|
var $table;
|
|
|
|
|
2006-07-24 11:35:46 +00:00
|
|
|
function HTMLPurifier_EntityLookup() {}
|
|
|
|
|
|
|
|
// to enforce Singleton-ness
|
|
|
|
function setup($file = false) {
|
2006-07-23 21:07:30 +00:00
|
|
|
if (!$file) {
|
|
|
|
$file = dirname(__FILE__) . '/EntityLookup/data.txt';
|
|
|
|
}
|
|
|
|
$this->table = unserialize(file_get_contents($file));
|
|
|
|
}
|
|
|
|
|
2006-07-24 11:35:46 +00:00
|
|
|
function instance($prototype = false) {
|
2006-07-23 21:07:30 +00:00
|
|
|
// no references, since PHP doesn't copy unless modified
|
|
|
|
static $instance = null;
|
2006-07-24 11:35:46 +00:00
|
|
|
if ($prototype) {
|
|
|
|
$instance = $prototype;
|
|
|
|
} elseif (!$instance) {
|
2006-07-23 21:07:30 +00:00
|
|
|
$instance = new HTMLPurifier_EntityLookup();
|
2006-07-24 11:35:46 +00:00
|
|
|
$instance->setup();
|
2006-07-23 21:07:30 +00:00
|
|
|
}
|
|
|
|
return $instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|