mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-23 17:01:51 +00:00
7a9d39ddcc
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@121 48356398-32a2-884e-a903-53898d9a118a
31 lines
733 B
PHP
31 lines
733 B
PHP
<?php
|
|
|
|
class HTMLPurifier_EntityLookup {
|
|
|
|
var $table;
|
|
|
|
function HTMLPurifier_EntityLookup() {}
|
|
|
|
// to enforce Singleton-ness
|
|
function setup($file = false) {
|
|
if (!$file) {
|
|
$file = dirname(__FILE__) . '/EntityLookup/data.txt';
|
|
}
|
|
$this->table = unserialize(file_get_contents($file));
|
|
}
|
|
|
|
function instance($prototype = false) {
|
|
// no references, since PHP doesn't copy unless modified
|
|
static $instance = null;
|
|
if ($prototype) {
|
|
$instance = $prototype;
|
|
} elseif (!$instance) {
|
|
$instance = new HTMLPurifier_EntityLookup();
|
|
$instance->setup();
|
|
}
|
|
return $instance;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|