mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-05 21:57:26 +02:00
Further refactoring to remove hacks. Move everything into the ConfigDoc facade object. Add parameters to plain.xsl. Optionally singleton-ize HTML Purifier. Add loadArrayFromForm to Config object.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1105 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -164,6 +164,23 @@ class HTMLPurifier
|
||||
return $array_of_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton for enforcing just one HTML Purifier in your system
|
||||
*/
|
||||
function &getInstance($prototype = null) {
|
||||
static $htmlpurifier;
|
||||
if (!$htmlpurifier || $prototype) {
|
||||
if (is_a($prototype, 'HTMLPurifier')) {
|
||||
$htmlpurifier = $prototype;
|
||||
} elseif ($prototype) {
|
||||
$htmlpurifier = new HTMLPurifier(HTMLPurifier_Config::create($prototype));
|
||||
} else {
|
||||
$htmlpurifier = new HTMLPurifier();
|
||||
}
|
||||
}
|
||||
return $htmlpurifier;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user