\HTMLPurifier_Strategy_MakeWellFormed

Takes tokens makes them well-formed (balance end tags, etc.)

Specification of the armor attributes this strategy uses:

 - MakeWellFormed_TagClosedError: This armor field is used to
   suppress tag closed errors for certain tokens [TagClosedSuppress],
   in particular, if a tag was generated automatically by HTML
   Purifier, we may rely on our infrastructure to close it for us
   and shouldn't report an error to the user [TagClosedAuto].

Summary

Methods
Properties
Constants
execute()
No public properties found
No constants found
processToken()
$tokens
$token
$zipper
$stack
$injectors
$config
$context
N/A
insertBefore()
remove()
No private properties found
N/A

Properties

$tokens

$tokens : 

Array stream of tokens being processed.

Type

$token

$token : 

Current token.

Type

$zipper

$zipper : 

Zipper managing the true state.

Type

$stack

$stack : 

Current nesting of elements.

Type

$injectors

$injectors : 

Injectors active in this stream processing.

Type

$config

$config : 

Current instance of HTMLPurifier_Config.

Type

$context

$context : 

Current instance of HTMLPurifier_Context.

Type

Methods

execute()

execute(array<mixed,\HTMLPurifier_Token>  $tokens, \HTMLPurifier_Config  $config, \HTMLPurifier_Context  $context) : array<mixed,\HTMLPurifier_Token>

Executes the strategy on the tokens.

Parameters

array<mixed,\HTMLPurifier_Token> $tokens

Array of HTMLPurifier_Token objects to be operated on.

\HTMLPurifier_Config $config
\HTMLPurifier_Context $context

Throws

\HTMLPurifier_Exception

Returns

array<mixed,\HTMLPurifier_Token>

processToken()

processToken(\HTMLPurifier_Token|array|integer|boolean  $token, \HTMLPurifier_Injector|integer  $injector = -1) 

Processes arbitrary token values for complicated substitution patterns.

In general:

If $token is an array, it is a list of tokens to substitute for the current token. These tokens then get individually processed. If there is a leading integer in the list, that integer determines how many tokens from the stream should be removed.

If $token is a regular token, it is swapped with the current token.

If $token is false, the current token is deleted.

If $token is an integer, that number of tokens (with the first token being the current one) will be deleted.

Parameters

\HTMLPurifier_Token|array|integer|boolean $token

Token substitution value

\HTMLPurifier_Injector|integer $injector

Injector that performed the substitution; default is if this is not an injector related operation.

Throws

\HTMLPurifier_Exception

insertBefore()

insertBefore(\HTMLPurifier_Token  $token) 

Inserts a token before the current token. Cursor now points to this token. You must reprocess after this.

Parameters

\HTMLPurifier_Token $token

remove()

remove() 

Removes current token. Cursor now points to new token occupying previously occupied space. You must reprocess after this.