HTMLPurifier_AttrTransform_ImgRequired
extends HTMLPurifier_AttrTransform
in package
Transform that supplies default values for the src and alt attributes in img tags, as well as prevents the img tag from being removed because of a missing alt tag. This needs to be registered as both a pre and post attribute transform.
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
transform(array<string|int, mixed> $attr, HTMLPurifier_Config $config, HTMLPurifier_Context $context) : array<string|int, mixed>
Parameters
- $attr : array<string|int, mixed>
- $config : HTMLPurifier_Config
- $context : HTMLPurifier_Context