HTMLPurifier 4.4.0
HTMLPurifier_HTMLDefinition Class Reference

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

Inheritance diagram for HTMLPurifier_HTMLDefinition:
HTMLPurifier_Definition HTMLPurifier_Definition

List of all members.

Public Member Functions

 addAttribute ($element_name, $attr_name, $def)
 Adds a custom attribute to a pre-existing element.
 addElement ($element_name, $type, $contents, $attr_collections, $attributes=array())
 Adds a custom element to your HTML definition.
 addBlankElement ($element_name)
 Adds a blank element to your HTML definition, for overriding existing behavior.
 getAnonymousModule ()
 Retrieves a reference to the anonymous module, so you can bust out advanced features without having to make your own module.
 __construct ()
 Performs low-cost, preliminary initialization.
 parseTinyMCEAllowedList ($list)
 Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing.
 addAttribute ($element_name, $attr_name, $def)
 Adds a custom attribute to a pre-existing element.
 addElement ($element_name, $type, $contents, $attr_collections, $attributes=array())
 Adds a custom element to your HTML definition.
 addBlankElement ($element_name)
 Adds a blank element to your HTML definition, for overriding existing behavior.
 getAnonymousModule ()
 Retrieves a reference to the anonymous module, so you can bust out advanced features without having to make your own module.
 __construct ()
 Performs low-cost, preliminary initialization.
 parseTinyMCEAllowedList ($list)
 Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing.

Public Attributes

 $info = array()
 Associative array of element names to HTMLPurifier_ElementDef.
 $info_global_attr = array()
 Associative array of global attribute name to attribute definition.
 $info_parent = 'div'
 String name of parent element HTML will be going into.
 $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 = 'p'
 String name of element used to wrap inline elements in block context.
 $info_tag_transform = array()
 Associative array of deprecated tag name to HTMLPurifier_TagTransform.
 $info_attr_transform_pre = array()
 Indexed list of HTMLPurifier_AttrTransform to be performed before validation.
 $info_attr_transform_post = array()
 Indexed list of HTMLPurifier_AttrTransform to be performed after validation.
 $info_content_sets = array()
 Nested lookup array of content set name (Block, Inline) to element name to whether or not it belongs in that content set.
 $info_injector = array()
 Indexed list of HTMLPurifier_Injector to be used.
 $doctype
 Doctype object.
 $type = 'HTML'
 What type of definition is it?
 $manager
 Instance of HTMLPurifier_HTMLModuleManager.

Protected Member Functions

 doSetup ($config)
 Sets up the definition object into the final form, something not done by the constructor.
 processModules ($config)
 Extract out the information from the manager.
 setupConfigStuff ($config)
 Sets up stuff based on config.
 doSetup ($config)
 Sets up the definition object into the final form, something not done by the constructor.
 processModules ($config)
 Extract out the information from the manager.
 setupConfigStuff ($config)
 Sets up stuff based on config.

Private Attributes

 $_anonModule = null

Detailed Description

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.

Note:
This class is inspected by Printer_HTMLDefinition; please update that class if things here change.
Warning:
Directives that change this object's structure must be in the HTML or Attr namespace!

Definition at line 26 of file HTMLDefinition.php.


Constructor & Destructor Documentation

HTMLPurifier_HTMLDefinition::__construct ( )

Performs low-cost, preliminary initialization.

Definition at line 161 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::__construct ( )

Performs low-cost, preliminary initialization.

Definition at line 4494 of file HTMLPurifier.standalone.php.


Member Function Documentation

HTMLPurifier_HTMLDefinition::addAttribute ( element_name,
attr_name,
def 
)

Adds a custom attribute to a pre-existing element.

Note:
This is strictly convenience, and does not have a corresponding method in HTMLPurifier_HTMLModule
Parameters:
$element_nameString element name to add attribute to
$attr_nameString name of attribute
$defAttribute definition, can be string or object, see HTMLPurifier_AttrTypes for details

Definition at line 102 of file HTMLDefinition.php.

References $def, and getAnonymousModule().

HTMLPurifier_HTMLDefinition::addAttribute ( element_name,
attr_name,
def 
)

Adds a custom attribute to a pre-existing element.

Note:
This is strictly convenience, and does not have a corresponding method in HTMLPurifier_HTMLModule
Parameters:
$element_nameString element name to add attribute to
$attr_nameString name of attribute
$defAttribute definition, can be string or object, see HTMLPurifier_AttrTypes for details

Definition at line 4435 of file HTMLPurifier.standalone.php.

References $def, and getAnonymousModule().

HTMLPurifier_HTMLDefinition::addBlankElement ( element_name)

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

Note:
See HTMLPurifier_HTMLModule::addBlankElement for detailed parameter and return value descriptions.

Definition at line 4464 of file HTMLPurifier.standalone.php.

References getAnonymousModule().

HTMLPurifier_HTMLDefinition::addBlankElement ( element_name)

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

Note:
See HTMLPurifier_HTMLModule::addBlankElement for detailed parameter and return value descriptions.

Definition at line 131 of file HTMLDefinition.php.

References getAnonymousModule().

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

Adds a custom element to your HTML definition.

Note:
See HTMLPurifier_HTMLModule::addElement for detailed parameter and return value descriptions.

Definition at line 117 of file HTMLDefinition.php.

References $type, and getAnonymousModule().

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

Adds a custom element to your HTML definition.

Note:
See HTMLPurifier_HTMLModule::addElement for detailed parameter and return value descriptions.

Definition at line 4450 of file HTMLPurifier.standalone.php.

References $type, and getAnonymousModule().

HTMLPurifier_HTMLDefinition::doSetup ( config) [protected]

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

Parameters:
$configHTMLPurifier_Config instance

Reimplemented from HTMLPurifier_Definition.

Definition at line 165 of file HTMLDefinition.php.

References $config, processModules(), and setupConfigStuff().

HTMLPurifier_HTMLDefinition::doSetup ( config) [protected]

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

Parameters:
$configHTMLPurifier_Config instance

Reimplemented from HTMLPurifier_Definition.

Definition at line 4498 of file HTMLPurifier.standalone.php.

References $config, processModules(), and setupConfigStuff().

HTMLPurifier_HTMLDefinition::getAnonymousModule ( )

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

Definition at line 142 of file HTMLDefinition.php.

Referenced by addAttribute(), addBlankElement(), and addElement().

HTMLPurifier_HTMLDefinition::getAnonymousModule ( )

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

Definition at line 4475 of file HTMLPurifier.standalone.php.

HTMLPurifier_HTMLDefinition::parseTinyMCEAllowedList ( list)

Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing.

Format is element[attr1|attr2],element2...

Warning:
Although it's largely drawn from TinyMCE's implementation, it is different, and you'll probably have to modify your lists
Parameters:
$listString list to parse
array($allowed_elements,$allowed_attributes)
Todo:
Give this its own class, probably static interface

Definition at line 392 of file HTMLDefinition.php.

Referenced by setupConfigStuff().

HTMLPurifier_HTMLDefinition::parseTinyMCEAllowedList ( list)

Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing.

Format is element[attr1|attr2],element2...

Warning:
Although it's largely drawn from TinyMCE's implementation, it is different, and you'll probably have to modify your lists
Parameters:
$listString list to parse
array($allowed_elements,$allowed_attributes)
Todo:
Give this its own class, probably static interface

Definition at line 4725 of file HTMLPurifier.standalone.php.

HTMLPurifier_HTMLDefinition::processModules ( config) [protected]

Extract out the information from the manager.

Definition at line 180 of file HTMLDefinition.php.

References $config.

Referenced by doSetup().

HTMLPurifier_HTMLDefinition::processModules ( config) [protected]

Extract out the information from the manager.

Definition at line 4513 of file HTMLPurifier.standalone.php.

References $config.

HTMLPurifier_HTMLDefinition::setupConfigStuff ( config) [protected]

Sets up stuff based on config.

We need a better way of doing this.

Definition at line 220 of file HTMLDefinition.php.

References $config, $def, $info, and parseTinyMCEAllowedList().

Referenced by doSetup().

HTMLPurifier_HTMLDefinition::setupConfigStuff ( config) [protected]

Sets up stuff based on config.

We need a better way of doing this.

Definition at line 4553 of file HTMLPurifier.standalone.php.

References $config, $def, $info, and parseTinyMCEAllowedList().


Member Data Documentation

HTMLPurifier_HTMLDefinition::$_anonModule = null [private]

Definition at line 150 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$doctype

Doctype object.

Definition at line 87 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$info = array()

Associative array of element names to HTMLPurifier_ElementDef.

Definition at line 34 of file HTMLDefinition.php.

Referenced by setupConfigStuff().

HTMLPurifier_HTMLDefinition::$info_attr_transform_post = array()

Indexed list of HTMLPurifier_AttrTransform to be performed after validation.

Definition at line 71 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$info_attr_transform_pre = array()

Indexed list of HTMLPurifier_AttrTransform to be performed before validation.

Definition at line 66 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$info_block_wrapper = 'p'

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

Note:
This is rarely used except for BLOCKQUOTEs in strict mode

Definition at line 56 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$info_content_sets = array()

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

Definition at line 77 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$info_global_attr = array()

Associative array of global attribute name to attribute definition.

Definition at line 39 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$info_injector = array()

Indexed list of HTMLPurifier_Injector to be used.

Definition at line 82 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$info_parent = 'div'

String name of parent element HTML will be going into.

Definition at line 44 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$info_parent_def

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

Definition at line 50 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$info_tag_transform = array()

Associative array of deprecated tag name to HTMLPurifier_TagTransform.

Definition at line 61 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$manager

Instance of HTMLPurifier_HTMLModuleManager.

Definition at line 156 of file HTMLDefinition.php.

HTMLPurifier_HTMLDefinition::$type = 'HTML'

What type of definition is it?

Reimplemented from HTMLPurifier_Definition.

Definition at line 155 of file HTMLDefinition.php.

Referenced by addElement().


The documentation for this class was generated from the following files: