HTMLPurifier 4.4.0
HTMLPurifier_Strategy_MakeWellFormed Class Reference

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

Inheritance diagram for HTMLPurifier_Strategy_MakeWellFormed:
HTMLPurifier_Strategy HTMLPurifier_Strategy

List of all members.

Public Member Functions

 execute ($tokens, $config, $context)
 Executes the strategy on the tokens.
 execute ($tokens, $config, $context)
 Executes the strategy on the tokens.

Protected Member Functions

 processToken ($token, $injector=-1)
 Processes arbitrary token values for complicated substitution patterns.
 processToken ($token, $injector=-1)
 Processes arbitrary token values for complicated substitution patterns.

Protected Attributes

 $tokens
 Array stream of tokens being processed.
 $t
 Current index in $tokens.
 $stack
 Current nesting of elements.
 $injectors
 Injectors active in this stream processing.
 $config
 Current instance of HTMLPurifier_Config.
 $context
 Current instance of HTMLPurifier_Context.

Private Member Functions

 insertBefore ($token)
 Inserts a token before the current token.
 remove ()
 Removes current token.
 swap ($token)
 Swap current token with new token.
 insertBefore ($token)
 Inserts a token before the current token.
 remove ()
 Removes current token.
 swap ($token)
 Swap current token with new token.

Detailed Description

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].

Definition at line 14 of file MakeWellFormed.php.


Member Function Documentation

HTMLPurifier_Strategy_MakeWellFormed::execute ( tokens,
config,
context 
)

Executes the strategy on the tokens.

Parameters:
$tokensArray of HTMLPurifier_Token objects to be operated on.
$configConfiguration options
Returns:
Processed array of token objects.

Reimplemented from HTMLPurifier_Strategy.

Definition at line 47 of file MakeWellFormed.php.

References $config, $context, $injectors, $stack, $t, $tokens, insertBefore(), processToken(), and swap().

HTMLPurifier_Strategy_MakeWellFormed::execute ( tokens,
config,
context 
)

Executes the strategy on the tokens.

Parameters:
$tokensArray of HTMLPurifier_Token objects to be operated on.
$configConfiguration options
Returns:
Processed array of token objects.

Reimplemented from HTMLPurifier_Strategy.

Definition at line 15834 of file HTMLPurifier.standalone.php.

References $config, $context, $injectors, $stack, $t, $tokens, insertBefore(), processToken(), and swap().

HTMLPurifier_Strategy_MakeWellFormed::insertBefore ( token) [private]

Inserts a token before the current token.

Cursor now points to this token. You must reprocess after this.

Definition at line 16297 of file HTMLPurifier.standalone.php.

HTMLPurifier_Strategy_MakeWellFormed::insertBefore ( token) [private]

Inserts a token before the current token.

Cursor now points to this token. You must reprocess after this.

Definition at line 510 of file MakeWellFormed.php.

Referenced by execute().

HTMLPurifier_Strategy_MakeWellFormed::processToken ( token,
injector = -1 
) [protected]

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:
$tokenToken substitution value
$injectorInjector that performed the substitution; default is if this is not an injector related operation.

Definition at line 479 of file MakeWellFormed.php.

Referenced by execute().

HTMLPurifier_Strategy_MakeWellFormed::processToken ( token,
injector = -1 
) [protected]

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:
$tokenToken substitution value
$injectorInjector that performed the substitution; default is if this is not an injector related operation.

Definition at line 16266 of file HTMLPurifier.standalone.php.

HTMLPurifier_Strategy_MakeWellFormed::remove ( ) [private]

Removes current token.

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

Definition at line 518 of file MakeWellFormed.php.

HTMLPurifier_Strategy_MakeWellFormed::remove ( ) [private]

Removes current token.

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

Definition at line 16305 of file HTMLPurifier.standalone.php.

HTMLPurifier_Strategy_MakeWellFormed::swap ( token) [private]

Swap current token with new token.

Cursor points to new token (no change). You must reprocess after this.

Definition at line 16313 of file HTMLPurifier.standalone.php.

HTMLPurifier_Strategy_MakeWellFormed::swap ( token) [private]

Swap current token with new token.

Cursor points to new token (no change). You must reprocess after this.

Definition at line 526 of file MakeWellFormed.php.

Referenced by execute().


Member Data Documentation

HTMLPurifier_Strategy_MakeWellFormed::$config [protected]

Current instance of HTMLPurifier_Config.

Definition at line 40 of file MakeWellFormed.php.

Referenced by execute().

HTMLPurifier_Strategy_MakeWellFormed::$context [protected]

Current instance of HTMLPurifier_Context.

Definition at line 45 of file MakeWellFormed.php.

Referenced by execute().

HTMLPurifier_Strategy_MakeWellFormed::$injectors [protected]

Injectors active in this stream processing.

Definition at line 35 of file MakeWellFormed.php.

Referenced by execute().

HTMLPurifier_Strategy_MakeWellFormed::$stack [protected]

Current nesting of elements.

Definition at line 30 of file MakeWellFormed.php.

Referenced by execute().

HTMLPurifier_Strategy_MakeWellFormed::$t [protected]

Current index in $tokens.

Definition at line 25 of file MakeWellFormed.php.

Referenced by execute().

HTMLPurifier_Strategy_MakeWellFormed::$tokens [protected]

Array stream of tokens being processed.

Definition at line 20 of file MakeWellFormed.php.

Referenced by execute().


The documentation for this class was generated from the following files: