abstract |
---|
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 | ||||||
---|---|---|---|---|---|---|
public
|
rewindOffset(bool|int $offset)
Rewind to a spot to re-perform processing. This is useful if you
deleted a node, and now need to see if this change…
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. |
# | ||||
public
|
getRewindOffset(): bool|int
Retrieves rewind offset, and then unsets it.
Retrieves rewind offset, and then unsets it. |
# | ||||
public
|
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…
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()). ReturnsBoolean false if success, string of missing needed element/attribute if failure Overriden by |
# | ||||
public
|
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…
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. ReturnsBoolean false if success, string of missing needed element/attribute if failure |
# | ||||
public
|
allowsElement(string $name): bool
Tests if the context node allows a certain element
Tests if the context node allows a certain element Parameters
ReturnsTrue if element is allowed, false if it is not |
# | ||||
protected
|
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.
Iterator function, which starts with the next token and continues until you reach the end of the input tokens. Parameters
|
# | ||||
protected
|
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…
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
|
# | ||||
protected
|
backward(int &$i, HTMLPurifier_Token &$current): bool
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
|
# | ||||
public
|
handleText(&$token)
Handler that is called when a text token is processed
Handler that is called when a text token is processed Overriden by |
# | ||||
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 Overriden by |
# | ||||
public
|
handleEnd(&$token)
Handler that is called when an end token is processed
Handler that is called when an end token is processed Overriden by |
# | ||||
public
|
notifyEnd(HTMLPurifier_Token $token)
Notifier that is called when an end token is processed
Notifier that is called when an end token is processed Parameters
|
# |
Properties | |||
---|---|---|---|
public
|
|
$name
Advisory name of injector, this is for friendly error messages.
Advisory name of injector, this is for friendly error messages. |
# |
protected
|
|
$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
|
|
$currentToken
Reference to current token.
Reference to current token. |
# |
protected
|
|
$inputZipper
Reference to InputZipper variable in Context.
Reference to InputZipper variable in Context. |
# |
public
|
|
$needed = []
Array of elements and attributes this injector creates and therefore
need to be allowed by the definition. Takes form…
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
|
|
$rewindOffset = false
Number of elements to rewind backwards (relative).
Number of elements to rewind backwards (relative). |
# |