56    public $prefixes = array(
'HTMLPurifier_HTMLModule_');
 
   82            'CommonAttributes', 
'Text', 
'Hypertext', 
'List',
 
   83            'Presentation', 
'Edit', 
'Bdo', 
'Tables', 
'Image',
 
   86            'Scripting', 
'Object', 
'Forms',
 
   90        $transitional = array(
'Legacy', 
'Target', 
'Iframe');
 
   91        $xml = array(
'XMLCommonAttributes');
 
   92        $non_xml = array(
'NonXMLCommonAttributes');
 
   95        $this->doctypes->register(
 
   96            'HTML 4.01 Transitional',
 
   98            array_merge($common, $transitional, $non_xml),
 
   99            array(
'Tidy_Transitional', 
'Tidy_Proprietary'),
 
  101            '-//W3C//DTD HTML 4.01 Transitional//EN',
 
  102            'http://www.w3.org/TR/html4/loose.dtd' 
  105        $this->doctypes->register(
 
  108            array_merge($common, $non_xml),
 
  109            array(
'Tidy_Strict', 
'Tidy_Proprietary', 
'Tidy_Name'),
 
  111            '-//W3C//DTD HTML 4.01//EN',
 
  112            'http://www.w3.org/TR/html4/strict.dtd' 
  115        $this->doctypes->register(
 
  116            'XHTML 1.0 Transitional',
 
  118            array_merge($common, $transitional, 
$xml, $non_xml),
 
  119            array(
'Tidy_Transitional', 
'Tidy_XHTML', 
'Tidy_Proprietary', 
'Tidy_Name'),
 
  121            '-//W3C//DTD XHTML 1.0 Transitional//EN',
 
  122            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd' 
  125        $this->doctypes->register(
 
  128            array_merge($common, 
$xml, $non_xml),
 
  129            array(
'Tidy_Strict', 
'Tidy_XHTML', 
'Tidy_Strict', 
'Tidy_Proprietary', 
'Tidy_Name'),
 
  131            '-//W3C//DTD XHTML 1.0 Strict//EN',
 
  132            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd' 
  135        $this->doctypes->register(
 
  140            array_merge($common, 
$xml, array(
'Ruby', 
'Iframe')),
 
  141            array(
'Tidy_Strict', 
'Tidy_XHTML', 
'Tidy_Proprietary', 
'Tidy_Strict', 
'Tidy_Name'), 
 
  143            '-//W3C//DTD XHTML 1.1//EN',
 
  144            'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd' 
  176            foreach ($this->prefixes as $prefix) {
 
  177                $module = $prefix . $original_module;
 
  187                        $original_module . 
' module does not exist',
 
  196            trigger_error(
'Module instance of ' . get_class(
$module) . 
' must have name');
 
  199        if (!$overload && isset($this->registeredModules[
$module->name])) {
 
  200            trigger_error(
'Overloading ' . 
$module->name . 
' without explicit overload parameter', E_USER_WARNING);
 
  215        $this->userModules[] = 
$module;
 
  224        $this->prefixes[] = $prefix;
 
  234        $this->trusted = 
$config->get(
'HTML.Trusted');
 
  237        $this->doctype = $this->doctypes->make(
$config);
 
  241        $lookup = 
$config->get(
'HTML.AllowedModules');
 
  242        $special_cases = 
$config->get(
'HTML.CoreModules');
 
  244        if (is_array($lookup)) {
 
  246                if (isset($special_cases[
$m])) {
 
  249                if (!isset($lookup[
$m])) {
 
  256        if (
$config->get(
'HTML.Proprietary')) {
 
  259        if (
$config->get(
'HTML.SafeObject')) {
 
  262        if (
$config->get(
'HTML.SafeEmbed')) {
 
  265        if (
$config->get(
'HTML.SafeScripting') !== array()) {
 
  268        if (
$config->get(
'HTML.Nofollow')) {
 
  271        if (
$config->get(
'HTML.TargetBlank')) {
 
  276        if (
$config->get(
'HTML.TargetNoreferrer')) {
 
  279        if (
$config->get(
'HTML.TargetNoopener')) {
 
  291        foreach ($this->doctype->tidyModules as 
$module) {
 
  297        foreach ($this->modules as 
$module) {
 
  299            foreach (
$module->info_injector as $injector) {
 
  300                if (!is_object($injector)) {
 
  301                    $class = 
"HTMLPurifier_Injector_$injector";
 
  302                    $injector = 
new $class;
 
  304                $n[$injector->name] = $injector;
 
  310        foreach ($this->modules as 
$module) {
 
  312                if (!isset($this->elementLookup[
$name])) {
 
  313                    $this->elementLookup[
$name] = array();
 
  340        if (!isset($this->registeredModules[
$module]) || is_object(
$module)) {
 
  353        foreach ($this->modules as 
$module) {
 
  354            if (!$this->trusted && !
$module->safe) {
 
  358                if (isset($elements[
$name])) {
 
  367        foreach ($elements as 
$n => $v) {
 
  369                unset($elements[
$n]);
 
  389        if (!isset($this->elementLookup[
$name])) {
 
  401        foreach ($this->elementLookup[
$name] as $module_name) {
 
  402            $module = $this->modules[$module_name];
 
  415            if (!
$def && $new_def->standalone) {
 
  420                $def->mergeIn($new_def);
 
  436            $this->attrCollections->performInclusions(
$def->attr);
 
  437            $this->attrCollections->expandIdentifiers(
$def->attr, $this->attrTypes);
 
  440            if (is_string(
$def->content_model) &&
 
  441                strpos(
$def->content_model, 
'Inline') !== 
false) {
 
  444                    $def->descendants_are_inline = 
true;
 
  448            $this->contentSets->generateChildDef(
$def, 
$module);
 
  458        foreach (
$def->attr as $attr_name => $attr_def) {
 
  459            if ($attr_def->required) {
 
  460                $def->required_attr[] = $attr_name;
 
An exception for terminatinating execution or to throw for unit testing.
Defines common attribute collections that modules reference.
Provides lookup array of attribute types to HTMLPurifier_AttrDef objects.
$modules
Active instances of modules for the specified doctype are indexed, by name, in this array.
setup($config)
Performs processing on modules, after being called you may use getElement() and getElements()
getElement($name, $trusted=null)
Retrieves a single merged element definition.
addModule($module)
Adds a module to the current doctype by first registering it, and then tacking it on to the active do...
getElements()
Retrieves merged element definitions.
processModule($module)
Takes a module and adds it to the active module collection, registering it if necessary.
$attrCollections
@type HTMLPurifier_AttrCollections
$doctypes
@type HTMLPurifier_DoctypeRegistry
$elementLookup
Associative array of element name to list of modules that have definitions for the element; this arra...
$contentSets
@type HTMLPurifier_ContentSets
$doctype
Instance of current doctype.
$trusted
If set to true, unsafe elements and attributes will be allowed.
$registeredModules
Array of recognized HTMLPurifier_HTMLModule instances, indexed by module's class name.
registerModule($module, $overload=false)
Registers a module to the recognized module list, useful for overloading pre-existing modules.
$userModules
List of extra modules that were added by the user using addModule().
$prefixes
List of prefixes we should use for registering small names.
$attrTypes
@type HTMLPurifier_AttrTypes
addPrefix($prefix)
Adds a class prefix that registerModule() will use to resolve a string name to a concrete class.
if($modEnd===false) $module