PATH:
home
/
letacommog
/
crmleta
/
libraries
/
htmlpurifier
/
library
/
HTMLPurifier
<?php class HTMLPurifier_DoctypeRegistry { /** * Hash of doctype names to doctype objects */ protected $doctypes; /** * Lookup table of aliases to real doctype names */ protected $aliases; /** * Registers a doctype to the registry * @note Accepts a fully-formed doctype object, or the * parameters for constructing a doctype object * @param $doctype Name of doctype or literal doctype object * @param $modules Modules doctype will load * @param $modules_for_modes Modules doctype will load for certain modes * @param $aliases Alias names for doctype * @return Editable registered doctype */ public function register($doctype, $xml = true, $modules = array(), $tidy_modules = array(), $aliases = array(), $dtd_public = null, $dtd_system = null ) { 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; } /** * Retrieves reference to a doctype of a certain name * @note This function resolves aliases * @note When possible, use the more fully-featured make() * @param $doctype Name of doctype * @return Editable doctype object */ public function get($doctype) { 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]; } /** * 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). */ public function make($config) { return clone $this->get($this->getDoctypeFromConfig($config)); } /** * Retrieves the doctype from the configuration object */ public function getDoctypeFromConfig($config) { // 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; } } // vim: et sw=4 sts=4
[+]
..
[-] PropertyList.php
[edit]
[+]
Injector
[-] ErrorStruct.php
[edit]
[-] Bootstrap.php
[edit]
[-] Printer.php
[edit]
[-] VarParserException.php
[edit]
[+]
Language
[-] ConfigSchema.php
[edit]
[-] Doctype.php
[edit]
[+]
Filter
[-] URIDefinition.php
[edit]
[-] URIScheme.php
[edit]
[+]
Lexer
[-] Context.php
[edit]
[+]
URIFilter
[+]
URIScheme
[-] VarParser.php
[edit]
[-] ElementDef.php
[edit]
[+]
DefinitionCache
[-] URISchemeRegistry.php
[edit]
[-] EntityParser.php
[edit]
[-] AttrValidator.php
[edit]
[-] URIFilter.php
[edit]
[+]
EntityLookup
[-] ContentSets.php
[edit]
[+]
VarParser
[-] UnitConverter.php
[edit]
[-] ErrorCollector.php
[edit]
[-] EntityLookup.php
[edit]
[-] Config.php
[edit]
[-] URI.php
[edit]
[-] DoctypeRegistry.php
[edit]
[+]
Token
[-] Strategy.php
[edit]
[+]
HTMLModule
[+]
AttrTransform
[-] Language.php
[edit]
[+]
TagTransform
[-] HTMLDefinition.php
[edit]
[-] LanguageFactory.php
[edit]
[+]
AttrDef
[+]
Strategy
[-] PropertyListIterator.php
[edit]
[-] Encoder.php
[edit]
[-] ChildDef.php
[edit]
[-] AttrCollections.php
[edit]
[-] Lexer.php
[edit]
[-] Exception.php
[edit]
[+]
Printer
[-] AttrDef.php
[edit]
[-] TokenFactory.php
[edit]
[-] Generator.php
[edit]
[-] DefinitionCache.php
[edit]
[-] TagTransform.php
[edit]
[-] StringHashParser.php
[edit]
[-] AttrTypes.php
[edit]
[-] StringHash.php
[edit]
[+]
ConfigSchema
[-] HTMLModuleManager.php
[edit]
[-] Token.php
[edit]
[-] URIParser.php
[edit]
[-] CSSDefinition.php
[edit]
[+]
ChildDef
[-] Length.php
[edit]
[-] PercentEncoder.php
[edit]
[-] Injector.php
[edit]
[-] AttrTransform.php
[edit]
[-] IDAccumulator.php
[edit]
[-] DefinitionCacheFactory.php
[edit]
[-] Definition.php
[edit]
[-] HTMLModule.php
[edit]
[-] Filter.php
[edit]