class Escaper

Context-aware escaping.

Constants

Text

JavaScript

Css

ICal

HtmlText

HtmlComment

HtmlBogusTag

HtmlRawText

HtmlTag

HtmlAttribute

private Convertors

Methods

__construct(string $contentType)

No description

string
getContentType()

No description

string
getState()

No description

string
export()

Returns the current escaping state as a string (e.g. "html/attr/js").

void
enterContentType(string $type)

No description

void
enterHtmlText(ElementNode $el)

No description

void
enterHtmlTag(string $name)

No description

void
enterHtmlRaw(string $subType)

No description

void
enterHtmlAttribute(string|null $name = null)

No description

void
enterHtmlBogusTag()

No description

void
enterHtmlComment()

No description

string
escape(string $str)

No description

string
escapeMandatory(string $str, Position|null $position = null)

Applies mandatory escaping that cannot be suppressed (e.g. quotes in attributes).

string
escapeContent(string $str)

Generates code that converts content between content types at runtime using FilterInfo.

static callable|null
getConvertor(string $source, string $dest)

Returns a callable that converts content from $source type to $dest type, or null if unsupported.

Details

at line 78
__construct(string $contentType)

No description

Parameters

string $contentType

at line 87
string getContentType()

No description

Return Value

string

at line 93
string getState()

No description

Return Value

string

at line 102
string export()

Returns the current escaping state as a string (e.g. "html/attr/js").

Return Value

string

at line 108
void enterContentType(string $type)

No description

Parameters

string $type

Return Value

void

at line 114
void enterHtmlText(ElementNode $el)

No description

Parameters

ElementNode $el

Return Value

void

at line 134
void enterHtmlTag(string $name)

No description

Parameters

string $name

Return Value

void

at line 140
void enterHtmlRaw(string $subType)

No description

Parameters

string $subType

Return Value

void

at line 147
void enterHtmlAttribute(string|null $name = null)

No description

Parameters

string|null $name

Return Value

void

at line 163
void enterHtmlBogusTag()

No description

Return Value

void

at line 169
void enterHtmlComment()

No description

Return Value

void

at line 175
string escape(string $str)

No description

Parameters

string $str

Return Value

string

at line 216
string escapeMandatory(string $str, Position|null $position = null)

Applies mandatory escaping that cannot be suppressed (e.g. quotes in attributes).

Parameters

string $str
Position|null $position

Return Value

string

at line 241
string escapeContent(string $str)

Generates code that converts content between content types at runtime using FilterInfo.

Parameters

string $str

Return Value

string

at line 253
static callable|null getConvertor(string $source, string $dest)

Returns a callable that converts content from $source type to $dest type, or null if unsupported.

Parameters

string $source
string $dest

Return Value

callable|null