class SanitizerOptions (View source)

Properties

static protected string $defaultUnsafeElements

The default space-separated list of unsafe XML elements.

static protected string $defaultUnsafeAttributes

The default space-separated list of unsafe XML attributes.

static protected string $defaultElementWhiteList

The default space-separated list of XML elements to not consider as unsafe.

static protected string $defaultAttributeWhiteList

The default space-separated list of XML attributes to not consider as unsafe.

private string[] $unsafeElements

The list of unsafe XML elements.

private string[] $unsafeAttributes

The list of unsafe XML attributes.

private string[] $elementAllowlist

The list of XML elements to not consider as unsafe.

private string[] $attributeAllowlist

The list of XML attributes to not consider as unsafe.

Methods

__construct()

Initialize the instance.

string[]
getUnsafeElements()

Get the list of unsafe XML elements.

$this
setUnsafeElements(string|string[] $value)

Set the list of unsafe XML elements.

string[]
getUnsafeAttributes()

Get the list of unsafe XML attributes.

$this
setUnsafeAttributes(string|string[] $value)

Set the list of unsafe XML attributes.

string[]
getElementAllowlist()

Get the list of XML elements to not consider as unsafe.

$this
setElementAllowlist(string|string[] $value)

Set the list of XML elements to not consider as unsafe.

string[]
getAttributeAllowlist()

Get the list of XML attributes to not consider as unsafe.

$this
setAttributeAllowlist(string|string[] $value)

Set the list of XML attributes to not consider as unsafe.

string[]
normalizeStringList(string|array $value)

Takes an array, keeps only strings, makes them lowercase, and returns the unique values.

Details

__construct()

Initialize the instance.

string[] getUnsafeElements()

Get the list of unsafe XML elements.

Return Value

string[]

$this setUnsafeElements(string|string[] $value)

Set the list of unsafe XML elements.

Parameters

string|string[] $value

an array of strings, or a space-separated list of strings

Return Value

$this

string[] getUnsafeAttributes()

Get the list of unsafe XML attributes.

Return Value

string[]

$this setUnsafeAttributes(string|string[] $value)

Set the list of unsafe XML attributes.

Parameters

string|string[] $value

an array of strings, or a space-separated list of strings

Return Value

$this

string[] getElementAllowlist()

Get the list of XML elements to not consider as unsafe.

Return Value

string[]

$this setElementAllowlist(string|string[] $value)

Set the list of XML elements to not consider as unsafe.

Parameters

string|string[] $value

an array of strings, or a space-separated list of strings

Return Value

$this

string[] getAttributeAllowlist()

Get the list of XML attributes to not consider as unsafe.

Return Value

string[]

$this setAttributeAllowlist(string|string[] $value)

Set the list of XML attributes to not consider as unsafe.

Parameters

string|string[] $value

an array of strings, or a space-separated list of strings

Return Value

$this

protected string[] normalizeStringList(string|array $value)

Takes an array, keeps only strings, makes them lowercase, and returns the unique values.

Parameters

string|array $value

Return Value

string[]