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.

private string[] $unsafeElements

The list of unsafe XML elements.

private string[] $unsafeAttributes

The list of unsafe XML attributes.

private string[] $elementWhitelist

The list of XML elements to not consider as unsafe.

private string[] $attributeWhitelist

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[]
getElementWhitelist()

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

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

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

string[]
getAttributeWhitelist()

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

$this
setAttributeWhitelist(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[] getElementWhitelist()

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

Return Value

string[]

$this setElementWhitelist(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[] getAttributeWhitelist()

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

Return Value

string[]

$this setAttributeWhitelist(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[]