mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-06 14:16:32 +02:00
Implement EntityLookup and put in the Lexer. Some behavior was migrated, since it looks like it will have to be used in all Lexers, not just DirectLex (which is the only one that uses it).
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@105 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
25
library/HTMLPurifier/EntityLookup.php
Normal file
25
library/HTMLPurifier/EntityLookup.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
class HTMLPurifier_EntityLookup {
|
||||
|
||||
var $table;
|
||||
|
||||
function HTMLPurifier_EntityLookup($file = false) {
|
||||
if (!$file) {
|
||||
$file = dirname(__FILE__) . '/EntityLookup/data.txt';
|
||||
}
|
||||
$this->table = unserialize(file_get_contents($file));
|
||||
}
|
||||
|
||||
function instance() {
|
||||
// no references, since PHP doesn't copy unless modified
|
||||
static $instance = null;
|
||||
if (!$instance) {
|
||||
$instance = new HTMLPurifier_EntityLookup();
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user