ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTMLPurifier_DoctypeRegistry Class Reference
+ Collaboration diagram for HTMLPurifier_DoctypeRegistry:

Public Member Functions

 register ($doctype, $xml=true, $modules=array(), $tidy_modules=array(), $aliases=array(), $dtd_public=null, $dtd_system=null)
 Registers a doctype to the registry.
 get ($doctype)
 Retrieves reference to a doctype of a certain name.
 make ($config)
 Creates a doctype based on a configuration object, will perform initialization on the doctype.
 getDoctypeFromConfig ($config)
 Retrieves the doctype from the configuration object.

Protected Attributes

 $doctypes
 Hash of doctype names to doctype objects.
 $aliases
 Lookup table of aliases to real doctype names.

Detailed Description

Definition at line 3 of file DoctypeRegistry.php.

Member Function Documentation

HTMLPurifier_DoctypeRegistry::get (   $doctype)

Retrieves reference to a doctype of a certain name.

Note
This function resolves aliases
When possible, use the more fully-featured make()
Parameters
$doctypeName of doctype
Returns
Editable doctype object

Definition at line 56 of file DoctypeRegistry.php.

{
if (isset($this->aliases[$doctype])) $doctype = $this->aliases[$doctype];
if (!isset($this->doctypes[$doctype])) {
trigger_error('Doctype ' . htmlspecialchars($doctype) . ' does not exist', E_USER_ERROR);
$anon = new HTMLPurifier_Doctype($doctype);
return $anon;
}
return $this->doctypes[$doctype];
}
HTMLPurifier_DoctypeRegistry::getDoctypeFromConfig (   $config)

Retrieves the doctype from the configuration object.

Definition at line 81 of file DoctypeRegistry.php.

References $config.

Referenced by make().

{
// recommended test
$doctype = $config->get('HTML.Doctype');
if (!empty($doctype)) return $doctype;
$doctype = $config->get('HTML.CustomDoctype');
if (!empty($doctype)) return $doctype;
// backwards-compatibility
if ($config->get('HTML.XHTML')) {
$doctype = 'XHTML 1.0';
} else {
$doctype = 'HTML 4.01';
}
if ($config->get('HTML.Strict')) {
$doctype .= ' Strict';
} else {
$doctype .= ' Transitional';
}
return $doctype;
}

+ Here is the caller graph for this function:

HTMLPurifier_DoctypeRegistry::make (   $config)

Creates a doctype based on a configuration object, will perform initialization on the doctype.

Note
Use this function to get a copy of doctype that config can hold on to (this is necessary in order to tell Generator whether or not the current document is XML based or not).

Definition at line 74 of file DoctypeRegistry.php.

References $config, and getDoctypeFromConfig().

{
return clone $this->get($this->getDoctypeFromConfig($config));
}

+ Here is the call graph for this function:

HTMLPurifier_DoctypeRegistry::register (   $doctype,
  $xml = true,
  $modules = array(),
  $tidy_modules = array(),
  $aliases = array(),
  $dtd_public = null,
  $dtd_system = null 
)

Registers a doctype to the registry.

Note
Accepts a fully-formed doctype object, or the parameters for constructing a doctype object
Parameters
$doctypeName of doctype or literal doctype object
$modulesModules doctype will load
$modules_for_modesModules doctype will load for certain modes
$aliasesAlias names for doctype
Returns
Editable registered doctype

Definition at line 26 of file DoctypeRegistry.php.

References $aliases, and $name.

{
if (!is_array($modules)) $modules = array($modules);
if (!is_array($tidy_modules)) $tidy_modules = array($tidy_modules);
if (!is_array($aliases)) $aliases = array($aliases);
if (!is_object($doctype)) {
$doctype = new HTMLPurifier_Doctype(
$doctype, $xml, $modules, $tidy_modules, $aliases, $dtd_public, $dtd_system
);
}
$this->doctypes[$doctype->name] = $doctype;
$name = $doctype->name;
// hookup aliases
foreach ($doctype->aliases as $alias) {
if (isset($this->doctypes[$alias])) continue;
$this->aliases[$alias] = $name;
}
// remove old aliases
if (isset($this->aliases[$name])) unset($this->aliases[$name]);
return $doctype;
}

Field Documentation

HTMLPurifier_DoctypeRegistry::$aliases
protected

Lookup table of aliases to real doctype names.

Definition at line 14 of file DoctypeRegistry.php.

Referenced by register().

HTMLPurifier_DoctypeRegistry::$doctypes
protected

Hash of doctype names to doctype objects.

Definition at line 9 of file DoctypeRegistry.php.


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