\HTMLPurifier_HTMLDefinition

Definition of the purified HTML that describes allowed children, attributes, and many other things.

Conventions:

All member variables that are prefixed with info (including the main $info array) are used by HTML Purifier internals and should not be directly edited when customizing the HTMLDefinition. They can usually be set via configuration directives or custom modules.

On the other hand, member variables without the info prefix are used internally by the HTMLDefinition and MUST NOT be used by other HTML Purifier internals. Many of them, however, are public, and may be edited by userspace code to tweak the behavior of HTMLDefinition.

Summary

Methods
Properties
Constants
setup()
addAttribute()
addElement()
addBlankElement()
getAnonymousModule()
__construct()
parseTinyMCEAllowedList()
$setup
$optimized
$type
$info
$info_global_attr
$info_parent
$info_parent_def
$info_block_wrapper
$info_tag_transform
$info_attr_transform_pre
$info_attr_transform_post
$info_content_sets
$info_injector
$doctype
$manager
No constants found
doSetup()
processModules()
setupConfigStuff()
No protected properties found
N/A
No private methods found
$_anonModule
N/A

Properties

$setup

$setup

Has setup() been called yet?

$optimized

$optimized

If true, write out the final definition object to the cache after setup. This will be true only if all invocations to get a raw definition object are also optimized. This does not cause file system thrashing because on subsequent calls the cached object is used and any writes to the raw definition object are short circuited. See enduser-customize.html for the high-level picture.

$type

$type

What type of definition is it?

$info

$info

Associative array of element names to HTMLPurifier_ElementDef.

$info_global_attr

$info_global_attr

Associative array of global attribute name to attribute definition.

$info_parent

$info_parent

String name of parent element HTML will be going into.

$info_parent_def

$info_parent_def

Definition for parent element, allows parent element to be a tag that's not allowed inside the HTML fragment.

$info_block_wrapper

$info_block_wrapper

String name of element used to wrap inline elements in block context.

$info_tag_transform

$info_tag_transform

Associative array of deprecated tag name to HTMLPurifier_TagTransform.

$info_attr_transform_pre

$info_attr_transform_pre

Indexed list of HTMLPurifier_AttrTransform to be performed before validation.

$info_attr_transform_post

$info_attr_transform_post

Indexed list of HTMLPurifier_AttrTransform to be performed after validation.

$info_content_sets

$info_content_sets

Nested lookup array of content set name (Block, Inline) to element name to whether or not it belongs in that content set.

$info_injector

$info_injector

Indexed list of HTMLPurifier_Injector to be used.

$doctype

$doctype

Doctype object

$manager

$manager

$_anonModule

$_anonModule

Methods

setup()

setup(\HTMLPurifier_Config  $config) : mixed

Setup function that aborts if already setup

Parameters

\HTMLPurifier_Config $config

Returns

mixed —

addAttribute()

addAttribute(string  $element_name, string  $attr_name, mixed  $def) : mixed

Adds a custom attribute to a pre-existing element

Parameters

string $element_name

Element name to add attribute to

string $attr_name

Name of attribute

mixed $def

Attribute definition, can be string or object, see HTMLPurifier_AttrTypes for details

Returns

mixed —

addElement()

addElement(mixed  $element_name, mixed  $type, mixed  $contents, mixed  $attr_collections, mixed  $attributes = array()) : mixed

Adds a custom element to your HTML definition

Parameters

mixed $element_name
mixed $type
mixed $contents
mixed $attr_collections
mixed $attributes

Returns

mixed —

addBlankElement()

addBlankElement(string  $element_name) : \HTMLPurifier_ElementDef

Adds a blank element to your HTML definition, for overriding existing behavior

Parameters

string $element_name

Returns

\HTMLPurifier_ElementDef —

getAnonymousModule()

getAnonymousModule() : \HTMLPurifier_HTMLModule

Retrieves a reference to the anonymous module, so you can bust out advanced features without having to make your own module.

Returns

\HTMLPurifier_HTMLModule —

__construct()

__construct() : mixed

Performs low-cost, preliminary initialization.

Returns

mixed —

parseTinyMCEAllowedList()

parseTinyMCEAllowedList(array  $list) : array

Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing. Format is element[attr1|attr2],element2.

..

Parameters

array $list

String list to parse

Returns

array —

doSetup()

doSetup(\HTMLPurifier_Config  $config) : mixed

Sets up the definition object into the final form, something not done by the constructor

Parameters

\HTMLPurifier_Config $config

Returns

mixed —

processModules()

processModules(\HTMLPurifier_Config  $config) : mixed

Extract out the information from the manager

Parameters

\HTMLPurifier_Config $config

Returns

mixed —

setupConfigStuff()

setupConfigStuff(\HTMLPurifier_Config  $config) : mixed

Sets up stuff based on config. We need a better way of doing this.

Parameters

\HTMLPurifier_Config $config

Returns

mixed —