Class HTMLPurifier_HTMLModule

InheritanceHTMLPurifier_HTMLModule
SubclassesHTMLPurifier_HTMLModule_Bdo, HTMLPurifier_HTMLModule_CommonAttributes, HTMLPurifier_HTMLModule_Edit, HTMLPurifier_HTMLModule_Forms, HTMLPurifier_HTMLModule_Hypertext, HTMLPurifier_HTMLModule_Iframe, HTMLPurifier_HTMLModule_Image, HTMLPurifier_HTMLModule_Legacy, HTMLPurifier_HTMLModule_List, HTMLPurifier_HTMLModule_Name, HTMLPurifier_HTMLModule_Nofollow, HTMLPurifier_HTMLModule_NonXMLCommonAttributes, HTMLPurifier_HTMLModule_Object, HTMLPurifier_HTMLModule_Presentation, HTMLPurifier_HTMLModule_Proprietary, HTMLPurifier_HTMLModule_Ruby, HTMLPurifier_HTMLModule_SafeEmbed, HTMLPurifier_HTMLModule_SafeObject, HTMLPurifier_HTMLModule_SafeScripting, HTMLPurifier_HTMLModule_Scripting, HTMLPurifier_HTMLModule_StyleAttribute, HTMLPurifier_HTMLModule_Tables, HTMLPurifier_HTMLModule_Target, HTMLPurifier_HTMLModule_TargetBlank, HTMLPurifier_HTMLModule_Text, HTMLPurifier_HTMLModule_Tidy, HTMLPurifier_HTMLModule_Tidy_Name, HTMLPurifier_HTMLModule_Tidy_Proprietary, HTMLPurifier_HTMLModule_Tidy_Strict, HTMLPurifier_HTMLModule_Tidy_Transitional, HTMLPurifier_HTMLModule_Tidy_XHTML, HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4, HTMLPurifier_HTMLModule_XMLCommonAttributes

Represents an XHTML 1.1 module, with information on elements, tags and attributes.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$attr_collections Associative array of attribute collection names to attribute collection additions. More rarely used for adding attributes to the global collections. Example is the StyleAttribute module adding the style attribute to the Core. Corresponds to HTMLDefinition's attr_collections->info, since the object's data is only info, with extra behavior associated with it. HTMLPurifier_HTMLModule
$content_sets Associative array of content set names to content set additions. HTMLPurifier_HTMLModule
$defines_child_def Boolean flag that indicates whether or not getChildDef is implemented. HTMLPurifier_HTMLModule
$elements Informally, a list of elements this module changes. HTMLPurifier_HTMLModule
$info Associative array of element names to element definitions. HTMLPurifier_HTMLModule
$info_attr_transform_post List of HTMLPurifier_AttrTransform to be performed after validation. HTMLPurifier_HTMLModule
$info_attr_transform_pre List of HTMLPurifier_AttrTransform to be performed before validation. HTMLPurifier_HTMLModule
$info_injector List of HTMLPurifier_Injector to be performed during well-formedness fixing. HTMLPurifier_HTMLModule
$info_tag_transform Associative array of deprecated tag name to HTMLPurifier_TagTransform. HTMLPurifier_HTMLModule
$name Short unique string identifier of the module. HTMLPurifier_HTMLModule
$safe Boolean flag whether or not this module is safe. If it is not safe, all of its members are unsafe. Modules are safe by default (this might be slightly dangerous, but it doesn't make much sense to force HTML Purifier, which is based off of safe HTML, to explicitly say, "This is safe," even though there are modules which are "unsafe") HTMLPurifier_HTMLModule

Public Methods

Hide inherited methods

MethodDescriptionDefined By
addBlankElement() Convenience function that creates a totally blank, non-standalone element. HTMLPurifier_HTMLModule
addElement() Convenience function that sets up a new element HTMLPurifier_HTMLModule
addElementToContentSet() Convenience function that registers an element to a content set HTMLPurifier_HTMLModule
getChildDef() Retrieves a proper HTMLPurifier_ChildDef subclass based on content_model and content_model_type member variables of the HTMLPurifier_ElementDef class. There is a similar function in HTMLPurifier_HTMLDefinition. HTMLPurifier_HTMLModule
makeLookup() Convenience function that generates a lookup table with boolean true as value. HTMLPurifier_HTMLModule
mergeInAttrIncludes() Convenience function that merges a list of attribute includes into an attribute array. HTMLPurifier_HTMLModule
parseContents() Convenience function that transforms single-string contents into separate content model and content model type HTMLPurifier_HTMLModule
setup() Lazy load construction of the module after determining whether or not it's needed, and also when a finalized configuration object is available. HTMLPurifier_HTMLModule

Property Details

$attr_collections public property
public $attr_collections = []
$content_sets public property

This is commonly used to, say, add an A element to the Inline content set. This corresponds to an internal variable $content_sets and NOT info_content_sets member variable of HTMLDefinition.

public $content_sets = []
$defines_child_def public property

For optimization reasons: may save a call to a function. Be sure to set it if you do implement getChildDef(), otherwise it will have no effect!

public $defines_child_def false
$elements public property

Not used in any significant way.

public $elements = []
$info public property

Some definitions may be incomplete, to be merged in later with the full definition.

public $info = []
$info_attr_transform_post public property
$info_attr_transform_pre public property
$info_injector public property

An injector will only be invoked if all of it's pre-requisites are met; if an injector fails setup, there will be no error; it will simply be silently disabled.

public $info_injector = []
$info_tag_transform public property
public $info_tag_transform = []
$name public property
public $name null
$safe public property
public $safe true

Method Details

addBlankElement() public method

Convenience function that creates a totally blank, non-standalone element.

public HTMLPurifier_ElementDef addBlankElement ( $element )
$element string

Name of element to create

return HTMLPurifier_ElementDef

Created element

addElement() public method

Convenience function that sets up a new element

See also HTMLPurifier_ElementDef:: for in-depth descriptions of these parameters.

public HTMLPurifier_ElementDef addElement ( $element, $type, $contents, $attr_includes = [], $attr = [] )
$element string

Name of element to add

$type string|bool

What content set should element be registered to?

         Set as false to skip this step.
$contents string

Allowed children in form of:

         "$content_model_type: $content_model"
$attr_includes array

What attribute collections to register to

         element?
$attr array

What unique attributes does the element define?

return HTMLPurifier_ElementDef

Created element definition object, so you

    can set advanced parameters
addElementToContentSet() public method

Convenience function that registers an element to a content set

public void addElementToContentSet ( $element, $type )
$element string

Element to register

$type string

Name content set (warning: case sensitive, usually upper-case

   first letter)
getChildDef() public method

Retrieves a proper HTMLPurifier_ChildDef subclass based on content_model and content_model_type member variables of the HTMLPurifier_ElementDef class. There is a similar function in HTMLPurifier_HTMLDefinition.

public HTMLPurifier_ChildDef getChildDef ( $def )
$def HTMLPurifier_ElementDef
return HTMLPurifier_ChildDef

Subclass

makeLookup() public method

Convenience function that generates a lookup table with boolean true as value.

public array makeLookup ( $list )
$list string

List of values to turn into a lookup

return array

Array equivalent of list

mergeInAttrIncludes() public method

Convenience function that merges a list of attribute includes into an attribute array.

public void mergeInAttrIncludes ( <b>&</b>$attr, $attr_includes )
$attr array

Reference to attr array to modify

$attr_includes array

Array of includes / string include to merge in

parseContents() public method

Convenience function that transforms single-string contents into separate content model and content model type

public array parseContents ( $contents )
$contents string

Allowed children in form of:

             "$content_model_type: $content_model"
setup() public method

Lazy load construction of the module after determining whether or not it's needed, and also when a finalized configuration object is available.

public void setup ( $config )
$config HTMLPurifier_Config