HumHub Documentation (unofficial)

HTMLPurifier_AttrTransform
in package

AbstractYes

Processes an entire attribute array for corrections needing multiple values.

Occasionally, a certain attribute will need to be removed and popped onto another value. Instead of creating a complex return syntax for HTMLPurifier_AttrDef, we just pass the whole attribute array to a specialized object and have that do the special work. That is the family of HTMLPurifier_AttrTransform.

An attribute transformation can be assigned to run before or after HTMLPurifier_AttrDef validation. See HTMLPurifier_HTMLDefinition for more details.

Table of Contents

Methods

confiscateAttr()  : mixed
Retrieves and removes an attribute
prependCSS()  : mixed
Prepends CSS properties to the style attribute, creating the attribute if it doesn't exist.
transform()  : array<string|int, mixed>
Abstract: makes changes to the attributes dependent on multiple values.

Methods

confiscateAttr()

Retrieves and removes an attribute

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

Attribute array to process (passed by reference)

$key : mixed

Key of attribute to confiscate

prependCSS()

Prepends CSS properties to the style attribute, creating the attribute if it doesn't exist.

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

Attribute array to process (passed by reference)

$css : string

CSS to prepend

transform()

Abstract: makes changes to the attributes dependent on multiple values.

public abstract transform(array<string|int, mixed> $attr, HTMLPurifier_Config $config, HTMLPurifier_Context $context) : array<string|int, mixed>
Parameters
$attr : array<string|int, mixed>

Assoc array of attributes, usually from HTMLPurifier_Token_Tag::$attr

$config : HTMLPurifier_Config

Mandatory HTMLPurifier_Config object.

$context : HTMLPurifier_Context

Mandatory HTMLPurifier_Context object

Return values
array<string|int, mixed>

Processed attribute array.


        
On this page

Search results