Injects tokens into the document while parsing for well-formedness. This
enables "formatter-like" functionality such as auto-paragraphing,
smiley-ification and linkification to take place.
A note on how handlers create changes; this is done by assigning a new value
to the $token reference. These values can take a variety of forms and are best
described HTMLPurifier_Strategy_MakeWellFormed->processToken()
documentation.
Methods summary
public
|
#
rewind( $index )
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.
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.
Warning
HTML Purifier will prevent you from fast-forwarding with this function.
|
public
|
#
getRewind( )
Retrieves rewind, and then unsets it.
Retrieves rewind, and then unsets it.
|
public
Boolean
|
#
prepare( $config $config, $context $context )
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()).
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
- $config
$config Instance of HTMLPurifier_Config
- $context
$context Instance of HTMLPurifier_Context
Returns
Boolean false if success, string of missing needed element/attribute if failure
|
public
Boolean
|
#
checkNeeded( $config $config )
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.
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
- $config
$config Instance of HTMLPurifier_Config
Returns
Boolean false if success, string of missing needed element/attribute if failure
|
public
True
|
#
allowsElement( $name $name )
Tests if the context node allows a certain element
Tests if the context node allows a certain element
Parameters
- $name
$name Name of element to test for
Returns
True if element is allowed, false if it is not
|
protected
|
#
forward( &$i & $i, &$current & $current )
Iterator function, which starts with the next token and continues until you
reach the end of the input tokens.
Iterator function, which starts with the next token and continues until you
reach the end of the input tokens.
Parameters
- $i
&$i Current integer index variable for inputTokens
- $current
&$current Current token variable. Do NOT use $token, as that variable is also a reference
Warning
Please prevent previous references from interfering with this functions by
setting $i = null beforehand!
|
protected
|
#
forwardUntilEndToken( & $i, & $current, & $nesting )
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.
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.
|
protected
|
#
backward( &$i & $i, &$current & $current )
Iterator function, starts with the previous token and continues until you
reach the beginning of input tokens.
Iterator function, starts with the previous token and continues until you
reach the beginning of input tokens.
Parameters
- $i
&$i Current integer index variable for inputTokens
- $current
&$current Current token variable. Do NOT use $token, as that variable is also a reference
Warning
Please prevent previous references from interfering with this functions by
setting $i = null beforehand!
|
protected
|
#
current( &$i & $i, &$current & $current )
Initializes the iterator at the current position. Use in a do {} while; loop
to force the _forward and _backward functions to start at the current
location.
Initializes the iterator at the current position. Use in a do {} while; loop
to force the _forward and _backward functions to start at the current
location.
Parameters
- $i
&$i Current integer index variable for inputTokens
- $current
&$current Current token variable. Do NOT use $token, as that variable is also a reference
Warning
Please prevent previous references from interfering with this functions by
setting $i = null beforehand!
|
public
|
#
handleText( & $token )
Handler that is called when a text token is processed
Handler that is called when a text token is processed
|
public
|
#
handleElement( & $token )
Handler that is called when a start or empty token is processed
Handler that is called when a start or empty token is processed
|
public
|
#
handleEnd( & $token )
Handler that is called when an end token is processed
Handler that is called when an end token is processed
|
Properties summary
public
|
$name
|
|
#
Advisory name of injector, this is for friendly error messages
Advisory name of injector, this is for friendly error messages
|
protected
|
$htmlDefinition
|
|
#
Instance of HTMLPurifier_HTMLDefinition
Instance of HTMLPurifier_HTMLDefinition
|
protected
|
$currentNesting
|
|
#
Reference to CurrentNesting variable in Context. This is an array list of
tokens that we are currently "inside"
Reference to CurrentNesting variable in Context. This is an array list of
tokens that we are currently "inside"
|
protected
|
$inputTokens
|
|
#
Reference to InputTokens variable in Context. This is an array list of the
input tokens that are being processed.
Reference to InputTokens variable in Context. This is an array list of the
input tokens that are being processed.
|
protected
|
$inputIndex
|
|
#
Reference to InputIndex variable in Context. This is an integer array index
for $this->inputTokens that indicates what token is currently being
processed.
Reference to InputIndex variable in Context. This is an integer array index
for $this->inputTokens that indicates what token is currently being
processed.
|
public
array
|
$needed
|
array() |
#
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')
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')
|
protected
boolean
|
$rewind
|
false |
#
Index of inputTokens to rewind to.
Index of inputTokens to rewind to.
|