ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTMLPurifier_URISchemeRegistry Class Reference

Registry for retrieving specific URI scheme validator objects. More...

+ Collaboration diagram for HTMLPurifier_URISchemeRegistry:

Public Member Functions

 getScheme ($scheme, $config, $context)
 Retrieves a scheme validator object.
 register ($scheme, $scheme_obj)
 Registers a custom scheme to the cache, bypassing reflection.

Static Public Member Functions

static instance ($prototype=null)
 Retrieve sole instance of the registry.

Protected Attributes

 $schemes = array()
 Cache of retrieved schemes.

Detailed Description

Registry for retrieving specific URI scheme validator objects.

Definition at line 6 of file URISchemeRegistry.php.

Member Function Documentation

HTMLPurifier_URISchemeRegistry::getScheme (   $scheme,
  $config,
  $context 
)

Retrieves a scheme validator object.

Parameters
$schemeString scheme name like http or mailto
$configHTMLPurifier_Config object
$configHTMLPurifier_Context object

Definition at line 37 of file URISchemeRegistry.php.

References $config, and HTMLPurifier_Config\createDefault().

{
// important, otherwise attacker could include arbitrary file
$allowed_schemes = $config->get('URI.AllowedSchemes');
if (!$config->get('URI.OverrideAllowedSchemes') &&
!isset($allowed_schemes[$scheme])
) {
return;
}
if (isset($this->schemes[$scheme])) return $this->schemes[$scheme];
if (!isset($allowed_schemes[$scheme])) return;
$class = 'HTMLPurifier_URIScheme_' . $scheme;
if (!class_exists($class)) return;
$this->schemes[$scheme] = new $class();
return $this->schemes[$scheme];
}

+ Here is the call graph for this function:

static HTMLPurifier_URISchemeRegistry::instance (   $prototype = null)
static

Retrieve sole instance of the registry.

Parameters
$prototypeOptional 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.

Definition at line 16 of file URISchemeRegistry.php.

References elseif().

Referenced by HTMLPurifier_URI\getSchemeObj().

{
static $instance = null;
if ($prototype !== null) {
$instance = $prototype;
} elseif ($instance === null || $prototype == true) {
$instance = new HTMLPurifier_URISchemeRegistry();
}
return $instance;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_URISchemeRegistry::register (   $scheme,
  $scheme_obj 
)

Registers a custom scheme to the cache, bypassing reflection.

Parameters
$schemeScheme name
$scheme_objHTMLPurifier_URIScheme object

Definition at line 62 of file URISchemeRegistry.php.

{
$this->schemes[$scheme] = $scheme_obj;
}

Field Documentation

HTMLPurifier_URISchemeRegistry::$schemes = array()
protected

Cache of retrieved schemes.

Definition at line 29 of file URISchemeRegistry.php.


The documentation for this class was generated from the following file: