HTMLPurifier_HTMLDefinition
extends HTMLPurifier_Definition
in package
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.
Tags
Table of Contents
Properties
- $doctype : mixed
- Doctype object
- $info : mixed
- Associative array of element names to HTMLPurifier_ElementDef.
- $info_attr_transform_post : mixed
- Indexed list of HTMLPurifier_AttrTransform to be performed after validation.
- $info_attr_transform_pre : mixed
- Indexed list of HTMLPurifier_AttrTransform to be performed before validation.
- $info_block_wrapper : mixed
- String name of element used to wrap inline elements in block context.
- $info_content_sets : mixed
- Nested lookup array of content set name (Block, Inline) to element name to whether or not it belongs in that content set.
- $info_global_attr : mixed
- Associative array of global attribute name to attribute definition.
- $info_injector : mixed
- Indexed list of HTMLPurifier_Injector to be used.
- $info_parent : mixed
- String name of parent element HTML will be going into.
- $info_parent_def : mixed
- Definition for parent element, allows parent element to be a tag that's not allowed inside the HTML fragment.
- $info_tag_transform : mixed
- Associative array of deprecated tag name to HTMLPurifier_TagTransform.
- $manager : mixed
- $optimized : mixed
- 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.
- $setup : mixed
- Has setup() been called yet?
- $type : mixed
- What type of definition is it?
- $_anonModule : mixed
Methods
- __construct() : mixed
- Performs low-cost, preliminary initialization.
- addAttribute() : mixed
- Adds a custom attribute to a pre-existing element
- addBlankElement() : HTMLPurifier_ElementDef
- Adds a blank element to your HTML definition, for overriding existing behavior
- addElement() : mixed
- Adds a custom element to your HTML definition
- getAnonymousModule() : HTMLPurifier_HTMLModule
- Retrieves a reference to the anonymous module, so you can bust out advanced features without having to make your own module.
- parseTinyMCEAllowedList() : array<string|int, mixed>
- Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing. Format is element[attr1|attr2],element2.
- setup() : mixed
- Setup function that aborts if already setup
- doSetup() : mixed
- Sets up the definition object into the final form, something not done by the constructor
- processModules() : mixed
- Extract out the information from the manager
- setupConfigStuff() : mixed
- Sets up stuff based on config. We need a better way of doing this.
Properties
$doctype
Doctype object
public
mixed
$doctype
Tags
$info
Associative array of element names to HTMLPurifier_ElementDef.
public
mixed
$info
= array()
Tags
$info_attr_transform_post
Indexed list of HTMLPurifier_AttrTransform to be performed after validation.
public
mixed
$info_attr_transform_post
= array()
Tags
$info_attr_transform_pre
Indexed list of HTMLPurifier_AttrTransform to be performed before validation.
public
mixed
$info_attr_transform_pre
= array()
Tags
$info_block_wrapper
String name of element used to wrap inline elements in block context.
public
mixed
$info_block_wrapper
= 'p'
Tags
$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.
public
mixed
$info_content_sets
= array()
Tags
$info_global_attr
Associative array of global attribute name to attribute definition.
public
mixed
$info_global_attr
= array()
Tags
$info_injector
Indexed list of HTMLPurifier_Injector to be used.
public
mixed
$info_injector
= array()
Tags
$info_parent
String name of parent element HTML will be going into.
public
mixed
$info_parent
= 'div'
Tags
$info_parent_def
Definition for parent element, allows parent element to be a tag that's not allowed inside the HTML fragment.
public
mixed
$info_parent_def
Tags
$info_tag_transform
Associative array of deprecated tag name to HTMLPurifier_TagTransform.
public
mixed
$info_tag_transform
= array()
Tags
$manager
public
mixed
$manager
Tags
$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.
public
mixed
$optimized
= \null
Tags
$setup
Has setup() been called yet?
public
mixed
$setup
= \false
Tags
$type
What type of definition is it?
public
mixed
$type
= 'HTML'
Tags
$_anonModule
private
mixed
$_anonModule
= \null
Methods
__construct()
Performs low-cost, preliminary initialization.
public
__construct() : mixed
addAttribute()
Adds a custom attribute to a pre-existing element
public
addAttribute(string $element_name, string $attr_name, mixed $def) : mixed
Parameters
- $element_name : string
-
Element name to add attribute to
- $attr_name : string
-
Name of attribute
- $def : mixed
-
Attribute definition, can be string or object, see HTMLPurifier_AttrTypes for details
Tags
addBlankElement()
Adds a blank element to your HTML definition, for overriding existing behavior
public
addBlankElement(string $element_name) : HTMLPurifier_ElementDef
Parameters
- $element_name : string
Tags
Return values
HTMLPurifier_ElementDefaddElement()
Adds a custom element to your HTML definition
public
addElement(mixed $element_name, mixed $type, mixed $contents, mixed $attr_collections[, mixed $attributes = array() ]) : mixed
Parameters
- $element_name : mixed
- $type : mixed
- $contents : mixed
- $attr_collections : mixed
- $attributes : mixed = array()
Tags
getAnonymousModule()
Retrieves a reference to the anonymous module, so you can bust out advanced features without having to make your own module.
public
getAnonymousModule() : HTMLPurifier_HTMLModule
Return values
HTMLPurifier_HTMLModuleparseTinyMCEAllowedList()
Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing. Format is element[attr1|attr2],element2.
public
parseTinyMCEAllowedList(array<string|int, mixed> $list) : array<string|int, mixed>
..
Parameters
- $list : array<string|int, mixed>
-
String list to parse
Tags
Return values
array<string|int, mixed>setup()
Setup function that aborts if already setup
public
setup(HTMLPurifier_Config $config) : mixed
Parameters
- $config : HTMLPurifier_Config
doSetup()
Sets up the definition object into the final form, something not done by the constructor
protected
doSetup(HTMLPurifier_Config $config) : mixed
Parameters
- $config : HTMLPurifier_Config
processModules()
Extract out the information from the manager
protected
processModules(HTMLPurifier_Config $config) : mixed
Parameters
- $config : HTMLPurifier_Config
setupConfigStuff()
Sets up stuff based on config. We need a better way of doing this.
protected
setupConfigStuff(HTMLPurifier_Config $config) : mixed
Parameters
- $config : HTMLPurifier_Config