HumHub Documentation (unofficial)

HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
in package

XHTML 1.1 Legacy module defines elements that were previously deprecated.

Tags
note

Not all legacy elements have been implemented yet, which is a bit of a reverse problem as compared to browsers! In addition, this legacy module may implement a bit more than mandated by XHTML 1.1.

This module can be used in combination with TransformToStrict in order to transform as many deprecated elements as possible, but retain questionably deprecated elements that do not have good alternatives as well as transform elements that don't have an implementation. See docs/ref-strictness.txt for more details.

Table of Contents

Properties

$attr_collections  : mixed
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.
$content_sets  : mixed
Associative array of content set names to content set additions.
$defines_child_def  : mixed
Boolean flag that indicates whether or not getChildDef is implemented.
$elements  : mixed
Informally, a list of elements this module changes.
$info  : mixed
Associative array of element names to element definitions.
$info_attr_transform_post  : mixed
List of HTMLPurifier_AttrTransform to be performed after validation.
$info_attr_transform_pre  : mixed
List of HTMLPurifier_AttrTransform to be performed before validation.
$info_injector  : mixed
List of HTMLPurifier_Injector to be performed during well-formedness fixing.
$info_tag_transform  : mixed
Associative array of deprecated tag name to HTMLPurifier_TagTransform.
$name  : mixed
Short unique string identifier of the module.
$safe  : mixed
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")

Methods

addBlankElement()  : HTMLPurifier_ElementDef
Convenience function that creates a totally blank, non-standalone element.
addElement()  : HTMLPurifier_ElementDef
Convenience function that sets up a new element
addElementToContentSet()  : mixed
Convenience function that registers an element to a content set
getChildDef()  : HTMLPurifier_ChildDef
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.
makeLookup()  : array<string|int, mixed>
Convenience function that generates a lookup table with boolean true as value.
mergeInAttrIncludes()  : mixed
Convenience function that merges a list of attribute includes into an attribute array.
parseContents()  : array<string|int, mixed>
Convenience function that transforms single-string contents into separate content model and content model type
setup()  : mixed
Lazy load construction of the module after determining whether or not it's needed, and also when a finalized configuration object is available.

Properties

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

public mixed $attr_collections = array()
Tags
type

array

$content_sets

Associative array of content set names to content set additions.

public mixed $content_sets = array()

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.

Tags
type

array

$defines_child_def

Boolean flag that indicates whether or not getChildDef is implemented.

public mixed $defines_child_def = \false

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!

Tags
type

bool

$elements

Informally, a list of elements this module changes.

public mixed $elements = array()

Not used in any significant way.

Tags
type

array

$info

Associative array of element names to element definitions.

public mixed $info = array()

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

Tags
type

array

$info_attr_transform_post

List of HTMLPurifier_AttrTransform to be performed after validation.

public mixed $info_attr_transform_post = array()
Tags
type

array

$info_attr_transform_pre

List of HTMLPurifier_AttrTransform to be performed before validation.

public mixed $info_attr_transform_pre = array()
Tags
type

array

$info_injector

List of HTMLPurifier_Injector to be performed during well-formedness fixing.

public mixed $info_injector = array()

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.

Tags
type

array

$info_tag_transform

Associative array of deprecated tag name to HTMLPurifier_TagTransform.

public mixed $info_tag_transform = array()
Tags
type

array

$name

Short unique string identifier of the module.

public mixed $name = 'Legacy'
Tags
type

string

$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")

public mixed $safe = \true
Tags
type

bool

note

Previously, safety could be applied at an element level granularity. We've removed this ability, so in order to add "unsafe" elements or attributes, a dedicated module with this property set to false must be used.

Methods

addElement()

Convenience function that sets up a new element

public addElement(string $element, string|bool $type, string|HTMLPurifier_ChildDef $contents[, array<string|int, mixed>|string $attr_includes = array() ][, array<string|int, mixed> $attr = array() ]) : HTMLPurifier_ElementDef
Parameters
$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|HTMLPurifier_ChildDef

Allowed children in form of: "$content_model_type: $content_model"

$attr_includes : array<string|int, mixed>|string = array()

What attribute collections to register to element?

$attr : array<string|int, mixed> = array()

What unique attributes does the element define?

Tags
see

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

Return values
HTMLPurifier_ElementDef

Created element definition object, so you can set advanced parameters

addElementToContentSet()

Convenience function that registers an element to a content set

public addElementToContentSet(string $element, string $type) : mixed
Parameters
$element : string

Element to register

$type : string

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

makeLookup()

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

public makeLookup(string $list) : array<string|int, mixed>
Parameters
$list : string

List of values to turn into a lookup

Tags
note

You can also pass an arbitrary number of arguments in place of the regular argument

Return values
array<string|int, mixed>

array equivalent of list

mergeInAttrIncludes()

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

public mergeInAttrIncludes(array<string|int, mixed> &$attr, array<string|int, mixed> $attr_includes) : mixed
Parameters
$attr : array<string|int, mixed>

Reference to attr array to modify

$attr_includes : array<string|int, mixed>

Array of includes / string include to merge in

parseContents()

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

public parseContents(string $contents) : array<string|int, mixed>
Parameters
$contents : string

Allowed children in form of: "$content_model_type: $content_model"

Tags
note

If contents is an object, an array of two nulls will be returned, and the callee needs to take the original $contents and use it directly.

Return values
array<string|int, mixed>

setup()

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

public setup(HTMLPurifier_Config $config) : mixed
Parameters
$config : HTMLPurifier_Config

        
On this page

Search results