1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-22 05:32:57 +02:00

Finish documentation for all base classes.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@306 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-20 20:59:13 +00:00
parent 679302b161
commit 2605257723
8 changed files with 264 additions and 28 deletions

View File

@@ -24,12 +24,19 @@ HTMLPurifier_ConfigDef::define(
'in order to add more schemes.'
);
/**
* Registry for retrieving specific URI scheme validator objects.
*/
class HTMLPurifier_URISchemeRegistry
{
// pass a registry object $prototype with a compatible interface and
// the function will copy it and return it all further times.
// pass bool true to reset to the default registry
/**
* Retrieve sole instance of the registry.
* @param $prototype Optional prototype to overload sole instance with,
* or bool true to reset to default registry.
* @note Pass a registry object $prototype with a compatible interface and
* the function will copy it and return it all further times.
*/
function &instance($prototype = null) {
static $instance = null;
if ($prototype !== null) {
@@ -40,9 +47,23 @@ class HTMLPurifier_URISchemeRegistry
return $instance;
}
/**
* Cache of retrieved schemes.
* @protected
*/
var $schemes = array();
/**
* Directory where scheme objects can be found
* @private
*/
var $_scheme_dir = null;
/**
* Retrieves a scheme validator object
* @param $scheme String scheme name like http or mailto
* @param $config HTMLPurifier_Config object
*/
function &getScheme($scheme, $config = null) {
if (!$config) $config = HTMLPurifier_Config::createDefault();
$null = null; // for the sake of passing by reference
@@ -67,6 +88,11 @@ class HTMLPurifier_URISchemeRegistry
return $this->schemes[$scheme];
}
/**
* Registers a custom scheme to the cache.
* @param $scheme Scheme name
* @param $scheme_obj HTMLPurifier_URIScheme object
*/
function register($scheme, &$scheme_obj) {
$this->schemes[$scheme] =& $scheme_obj;
}