Properties

$name

$name

Advisory name of injector, this is for friendly error messages.

$needed

$needed

Array of elements and attributes this injector creates and therefore need to be allowed by the definition. Takes form of array('element' => array('attr', 'attr2'), 'element2')

$htmlDefinition

$htmlDefinition

$currentNesting

$currentNesting

Reference to CurrentNesting variable in Context. This is an array list of tokens that we are currently "inside"

$currentToken

$currentToken

Reference to current token.

$inputZipper

$inputZipper

Reference to InputZipper variable in Context.

$rewindOffset

$rewindOffset

Number of elements to rewind backwards (relative).

Methods

rewindOffset()

rewindOffset(bool|int  $offset) : mixed

Rewind to a spot to re-perform processing. This is useful if you deleted a node, and now need to see if this change affected any earlier nodes. Rewinding does not affect other injectors, and can result in infinite loops if not used carefully.

Parameters

bool|int $offset

Returns

mixed —

getRewindOffset()

getRewindOffset() : bool|int

Retrieves rewind offset, and then unsets it.

Returns

bool|int —

prepare()

prepare(\HTMLPurifier_Config  $config, \HTMLPurifier_Context  $context) : bool|string

Prepares the injector by giving it the config and context objects: this allows references to important variables to be made within the injector. This function also checks if the HTML environment will work with the Injector (see checkNeeded()).

Parameters

\HTMLPurifier_Config $config
\HTMLPurifier_Context $context

Returns

bool|string —

Boolean false if success, string of missing needed element/attribute if failure

checkNeeded()

checkNeeded(\HTMLPurifier_Config  $config) : bool|string

This function checks if the HTML environment will work with the Injector: if p tags are not allowed, the Auto-Paragraphing injector should not be enabled.

Parameters

\HTMLPurifier_Config $config

Returns

bool|string —

Boolean false if success, string of missing needed element/attribute if failure

allowsElement()

allowsElement(string  $name) : bool

Tests if the context node allows a certain element

Parameters

string $name

Name of element to test for

Returns

bool —

True if element is allowed, false if it is not

handleText()

handleText(\HTMLPurifier_Token_Text  $token) : mixed

Handler that is called when a text token is processed

Parameters

\HTMLPurifier_Token_Text $token

Returns

mixed —

handleElement()

handleElement(\HTMLPurifier_Token  $token) : mixed

Handler that is called when a start or empty token is processed

Parameters

\HTMLPurifier_Token $token

Returns

mixed —

handleEnd()

handleEnd(mixed  $token) : mixed

Handler that is called when an end token is processed

Parameters

mixed $token

Returns

mixed —

notifyEnd()

notifyEnd(\HTMLPurifier_Token  $token) : mixed

Notifier that is called when an end token is processed

Parameters

\HTMLPurifier_Token $token

Current token variable.

Returns

mixed —

forward()

forward(int  $i, \HTMLPurifier_Token  $current) : bool

Iterator function, which starts with the next token and continues until you reach the end of the input tokens.

Parameters

int $i

Current integer index variable for inputTokens

\HTMLPurifier_Token $current

Current token variable. Do NOT use $token, as that variable is also a reference

Returns

bool —

forwardUntilEndToken()

forwardUntilEndToken(int  $i, \HTMLPurifier_Token  $current, int  $nesting) : bool

Similar to _forward, but accepts a third parameter $nesting (which should be initialized at 0) and stops when we hit the end tag for the node $this->inputIndex starts in.

Parameters

int $i

Current integer index variable for inputTokens

\HTMLPurifier_Token $current

Current token variable. Do NOT use $token, as that variable is also a reference

int $nesting

Returns

bool —

backward()

backward(int  $i, \HTMLPurifier_Token  $current) : bool

Iterator function, starts with the previous token and continues until you reach the beginning of input tokens.

Parameters

int $i

Current integer index variable for inputTokens

\HTMLPurifier_Token $current

Current token variable. Do NOT use $token, as that variable is also a reference

Returns

bool —

_pStart()

_pStart() : \HTMLPurifier_Token_Start

Returns

\HTMLPurifier_Token_Start —

_splitText()

_splitText(string  $data, \HTMLPurifier_Token[]  $result) : mixed

Splits up a text in paragraph tokens and appends them to the result stream that will replace the original

Parameters

string $data

String text data that will be processed into paragraphs

\HTMLPurifier_Token[] $result

Reference to array of tokens that the tags will be appended onto

Returns

mixed —

_isInline()

_isInline(\HTMLPurifier_Token  $token) : bool

Returns true if passed token is inline (and, ergo, allowed in paragraph tags)

Parameters

\HTMLPurifier_Token $token

Returns

bool —

_pLookAhead()

_pLookAhead() : bool

Looks ahead in the token list and determines whether or not we need to insert a <p> tag.

Returns

bool —

_checkNeedsP()

_checkNeedsP(\HTMLPurifier_Token  $current) : bool

Determines if a particular token requires an earlier inline token to get a paragraph. This should be used with _forwardUntilEndToken

Parameters

\HTMLPurifier_Token $current

Returns

bool —