\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?

Type

$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

$type : 

What type of definition is it?

Type

$info

$info : 

Associative array of element names to HTMLPurifier_ElementDef.

Type

$info_global_attr

$info_global_attr : 

Associative array of global attribute name to attribute definition.

Type

$info_parent

$info_parent : 

String name of parent element HTML will be going into.

Type

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

Type

$info_block_wrapper

$info_block_wrapper : 

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

Type

$info_tag_transform

$info_tag_transform : 

Associative array of deprecated tag name to HTMLPurifier_TagTransform.

Type

$info_attr_transform_pre

$info_attr_transform_pre : 

Indexed list of HTMLPurifier_AttrTransform to be performed before validation.

Type

$info_attr_transform_post

$info_attr_transform_post : 

Indexed list of HTMLPurifier_AttrTransform to be performed after validation.

Type

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

Type

$info_injector

$info_injector : 

Indexed list of HTMLPurifier_Injector to be used.

Type

$doctype

$doctype : 

Doctype object

Type

$manager

$manager : 

Type

$_anonModule

$_anonModule : 

Type

Methods

setup()

setup(\HTMLPurifier_Config  $config) 

Setup function that aborts if already setup

Parameters

\HTMLPurifier_Config $config

addAttribute()

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

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

addElement()

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

Adds a custom element to your HTML definition

Parameters

$element_name
$type
$contents
$attr_collections
$attributes

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() 

Performs low-cost, preliminary initialization.

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) 

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

Parameters

\HTMLPurifier_Config $config

processModules()

processModules(\HTMLPurifier_Config  $config) 

Extract out the information from the manager

Parameters

\HTMLPurifier_Config $config

setupConfigStuff()

setupConfigStuff(\HTMLPurifier_Config  $config) 

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

Parameters

\HTMLPurifier_Config $config