|
HTMLPurifier 4.4.0
|
Injects tokens into the document while parsing for well-formedness. More...
Public Member Functions | |
| rewind ($index) | |
| Rewind to a spot to re-perform processing. | |
| getRewind () | |
| Retrieves rewind, and then unsets it. | |
| prepare ($config, $context) | |
| Prepares the injector by giving it the config and context objects: this allows references to important variables to be made within the injector. | |
| checkNeeded ($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. | |
| allowsElement ($name) | |
| Tests if the context node allows a certain element. | |
| handleText (&$token) | |
| Handler that is called when a text token is processed. | |
| handleElement (&$token) | |
| Handler that is called when a start or empty token is processed. | |
| handleEnd (&$token) | |
| Handler that is called when an end token is processed. | |
| notifyEnd ($token) | |
| Notifier that is called when an end token is processed. | |
| rewind ($index) | |
| Rewind to a spot to re-perform processing. | |
| getRewind () | |
| Retrieves rewind, and then unsets it. | |
| prepare ($config, $context) | |
| Prepares the injector by giving it the config and context objects: this allows references to important variables to be made within the injector. | |
| checkNeeded ($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. | |
| allowsElement ($name) | |
| Tests if the context node allows a certain element. | |
| handleText (&$token) | |
| Handler that is called when a text token is processed. | |
| handleElement (&$token) | |
| Handler that is called when a start or empty token is processed. | |
| handleEnd (&$token) | |
| Handler that is called when an end token is processed. | |
| notifyEnd ($token) | |
| Notifier that is called when an end token is processed. | |
Public Attributes | |
| $name | |
| Advisory name of injector, this is for friendly error messages. | |
| $needed = array() | |
| Array of elements and attributes this injector creates and therefore need to be allowed by the definition. | |
Protected Member Functions | |
| forward (&$i, &$current) | |
| Iterator function, which starts with the next token and continues until you reach the end of the input tokens. | |
| 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. | |
| backward (&$i, &$current) | |
| Iterator function, starts with the previous token and continues until you reach the beginning of input tokens. | |
| current (&$i, &$current) | |
| Initializes the iterator at the current position. | |
| forward (&$i, &$current) | |
| Iterator function, which starts with the next token and continues until you reach the end of the input tokens. | |
| 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. | |
| backward (&$i, &$current) | |
| Iterator function, starts with the previous token and continues until you reach the beginning of input tokens. | |
| current (&$i, &$current) | |
| Initializes the iterator at the current position. | |
Protected Attributes | |
| $htmlDefinition | |
| Instance of HTMLPurifier_HTMLDefinition. | |
| $currentNesting | |
| Reference to CurrentNesting variable in Context. | |
| $inputTokens | |
| Reference to InputTokens variable in Context. | |
| $inputIndex | |
| Reference to InputIndex variable in Context. | |
| $rewind = false | |
| Index of inputTokens to rewind to. | |
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.
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.
Definition at line 16 of file Injector.php.
| HTMLPurifier_Injector::allowsElement | ( | $ | name | ) |
Tests if the context node allows a certain element.
| $name | Name of element to test for |
Definition at line 129 of file Injector.php.
Referenced by HTMLPurifier_Injector_AutoParagraph::handleElement(), HTMLPurifier_Injector_PurifierLinkify::handleText(), HTMLPurifier_Injector_Linkify::handleText(), and HTMLPurifier_Injector_AutoParagraph::handleText().
| HTMLPurifier_Injector::allowsElement | ( | $ | name | ) |
Tests if the context node allows a certain element.
| $name | Name of element to test for |
Definition at line 5603 of file HTMLPurifier.standalone.php.
| HTMLPurifier_Injector::backward | ( | &$ | i, |
| &$ | current | ||
| ) | [protected] |
Iterator function, starts with the previous token and continues until you reach the beginning of input tokens.
| &$i | Current integer index variable for inputTokens |
| &$current | Current token variable. Do NOT use $token, as that variable is also a reference |
Definition at line 190 of file Injector.php.
Referenced by HTMLPurifier_Injector_AutoParagraph::handleElement().
| HTMLPurifier_Injector::backward | ( | &$ | i, |
| &$ | current | ||
| ) | [protected] |
Iterator function, starts with the previous token and continues until you reach the beginning of input tokens.
| &$i | Current integer index variable for inputTokens |
| &$current | Current token variable. Do NOT use $token, as that variable is also a reference |
Definition at line 5664 of file HTMLPurifier.standalone.php.
| HTMLPurifier_Injector::checkNeeded | ( | $ | 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.
| $config | Instance of HTMLPurifier_Config |
| $context | Instance of HTMLPurifier_Context |
Definition at line 5585 of file HTMLPurifier.standalone.php.
| HTMLPurifier_Injector::checkNeeded | ( | $ | 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.
| $config | Instance of HTMLPurifier_Config |
| $context | Instance of HTMLPurifier_Context |
Definition at line 111 of file Injector.php.
References $config, $def, and $name.
Referenced by prepare().
| HTMLPurifier_Injector::current | ( | &$ | i, |
| &$ | current | ||
| ) | [protected] |
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.
| &$i | Current integer index variable for inputTokens |
| &$current | Current token variable. Do NOT use $token, as that variable is also a reference |
Definition at line 207 of file Injector.php.
Referenced by HTMLPurifier_Injector_AutoParagraph::_pLookAhead().
| HTMLPurifier_Injector::current | ( | &$ | i, |
| &$ | current | ||
| ) | [protected] |
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.
| &$i | Current integer index variable for inputTokens |
| &$current | Current token variable. Do NOT use $token, as that variable is also a reference |
Definition at line 5681 of file HTMLPurifier.standalone.php.
| HTMLPurifier_Injector::forward | ( | &$ | i, |
| &$ | current | ||
| ) | [protected] |
Iterator function, which starts with the next token and continues until you reach the end of the input tokens.
| &$i | Current integer index variable for inputTokens |
| &$current | Current token variable. Do NOT use $token, as that variable is also a reference |
Definition at line 5631 of file HTMLPurifier.standalone.php.
| HTMLPurifier_Injector::forward | ( | &$ | i, |
| &$ | current | ||
| ) | [protected] |
Iterator function, which starts with the next token and continues until you reach the end of the input tokens.
| &$i | Current integer index variable for inputTokens |
| &$current | Current token variable. Do NOT use $token, as that variable is also a reference |
Definition at line 157 of file Injector.php.
Referenced by forwardUntilEndToken().
| HTMLPurifier_Injector::forwardUntilEndToken | ( | &$ | i, |
| &$ | current, | ||
| &$ | nesting | ||
| ) | [protected] |
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.
Definition at line 5644 of file HTMLPurifier.standalone.php.
References forward().
| HTMLPurifier_Injector::forwardUntilEndToken | ( | &$ | i, |
| &$ | current, | ||
| &$ | nesting | ||
| ) | [protected] |
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.
Definition at line 170 of file Injector.php.
References forward().
Referenced by HTMLPurifier_Injector_AutoParagraph::_pLookAhead(), HTMLPurifier_Injector_RemoveSpansWithoutAttributes::handleElement(), and HTMLPurifier_Injector_AutoParagraph::handleText().
| HTMLPurifier_Injector::getRewind | ( | ) |
Retrieves rewind, and then unsets it.
Definition at line 75 of file Injector.php.
References rewind().
| HTMLPurifier_Injector::getRewind | ( | ) |
Retrieves rewind, and then unsets it.
Definition at line 5549 of file HTMLPurifier.standalone.php.
References rewind().
| HTMLPurifier_Injector::handleElement | ( | &$ | token | ) |
Handler that is called when a start or empty token is processed.
Reimplemented in HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_RemoveEmpty, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, HTMLPurifier_Injector_SafeObject, HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_RemoveEmpty, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, and HTMLPurifier_Injector_SafeObject.
Definition at line 220 of file Injector.php.
| HTMLPurifier_Injector::handleElement | ( | &$ | token | ) |
Handler that is called when a start or empty token is processed.
Reimplemented in HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_RemoveEmpty, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, HTMLPurifier_Injector_SafeObject, HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_RemoveEmpty, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, and HTMLPurifier_Injector_SafeObject.
Definition at line 5694 of file HTMLPurifier.standalone.php.
| HTMLPurifier_Injector::handleEnd | ( | &$ | token | ) |
Handler that is called when an end token is processed.
Reimplemented in HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, HTMLPurifier_Injector_SafeObject, HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, and HTMLPurifier_Injector_SafeObject.
Definition at line 5699 of file HTMLPurifier.standalone.php.
References notifyEnd().
| HTMLPurifier_Injector::handleEnd | ( | &$ | token | ) |
Handler that is called when an end token is processed.
Reimplemented in HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, HTMLPurifier_Injector_SafeObject, HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, and HTMLPurifier_Injector_SafeObject.
Definition at line 225 of file Injector.php.
References notifyEnd().
| HTMLPurifier_Injector::handleText | ( | &$ | token | ) |
Handler that is called when a text token is processed.
Reimplemented in HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_Linkify, HTMLPurifier_Injector_PurifierLinkify, HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_Linkify, and HTMLPurifier_Injector_PurifierLinkify.
Definition at line 215 of file Injector.php.
| HTMLPurifier_Injector::handleText | ( | &$ | token | ) |
Handler that is called when a text token is processed.
Reimplemented in HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_Linkify, HTMLPurifier_Injector_PurifierLinkify, HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_Linkify, and HTMLPurifier_Injector_PurifierLinkify.
Definition at line 5689 of file HTMLPurifier.standalone.php.
| HTMLPurifier_Injector::notifyEnd | ( | $ | token | ) |
Notifier that is called when an end token is processed.
Definition at line 5708 of file HTMLPurifier.standalone.php.
| HTMLPurifier_Injector::notifyEnd | ( | $ | token | ) |
Notifier that is called when an end token is processed.
Definition at line 234 of file Injector.php.
Referenced by handleEnd().
| HTMLPurifier_Injector::prepare | ( | $ | config, |
| $ | 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()).
| $config | Instance of HTMLPurifier_Config |
| $context | Instance of HTMLPurifier_Context |
Reimplemented in HTMLPurifier_Injector_PurifierLinkify, HTMLPurifier_Injector_RemoveEmpty, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, HTMLPurifier_Injector_SafeObject, HTMLPurifier_Injector_PurifierLinkify, HTMLPurifier_Injector_RemoveEmpty, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, and HTMLPurifier_Injector_SafeObject.
Definition at line 5564 of file HTMLPurifier.standalone.php.
References $config, and checkNeeded().
| HTMLPurifier_Injector::prepare | ( | $ | config, |
| $ | 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()).
| $config | Instance of HTMLPurifier_Config |
| $context | Instance of HTMLPurifier_Context |
Reimplemented in HTMLPurifier_Injector_PurifierLinkify, HTMLPurifier_Injector_RemoveEmpty, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, HTMLPurifier_Injector_SafeObject, HTMLPurifier_Injector_PurifierLinkify, HTMLPurifier_Injector_RemoveEmpty, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, and HTMLPurifier_Injector_SafeObject.
Definition at line 90 of file Injector.php.
References $config, and checkNeeded().
| HTMLPurifier_Injector::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.
Definition at line 5542 of file HTMLPurifier.standalone.php.
References rewind().
| HTMLPurifier_Injector::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.
Definition at line 68 of file Injector.php.
Referenced by getRewind(), HTMLPurifier_Injector_RemoveEmpty::handleElement(), and rewind().
HTMLPurifier_Injector::$currentNesting [protected] |
Reference to CurrentNesting variable in Context.
This is an array list of tokens that we are currently "inside"
Definition at line 33 of file Injector.php.
HTMLPurifier_Injector::$htmlDefinition [protected] |
Instance of HTMLPurifier_HTMLDefinition.
Definition at line 27 of file Injector.php.
HTMLPurifier_Injector::$inputIndex [protected] |
Reference to InputIndex variable in Context.
This is an integer array index for $this->inputTokens that indicates what token is currently being processed.
Definition at line 46 of file Injector.php.
HTMLPurifier_Injector::$inputTokens [protected] |
Reference to InputTokens variable in Context.
This is an array list of the input tokens that are being processed.
Definition at line 39 of file Injector.php.
| HTMLPurifier_Injector::$name |
Advisory name of injector, this is for friendly error messages.
Reimplemented in HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_Linkify, HTMLPurifier_Injector_PurifierLinkify, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, and HTMLPurifier_Injector_SafeObject.
Definition at line 22 of file Injector.php.
Referenced by allowsElement(), and checkNeeded().
| HTMLPurifier_Injector::$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')
Reimplemented in HTMLPurifier_Injector_AutoParagraph, HTMLPurifier_Injector_DisplayLinkURI, HTMLPurifier_Injector_Linkify, HTMLPurifier_Injector_PurifierLinkify, HTMLPurifier_Injector_RemoveSpansWithoutAttributes, and HTMLPurifier_Injector_SafeObject.
Definition at line 53 of file Injector.php.
HTMLPurifier_Injector::$rewind = false [protected] |
Index of inputTokens to rewind to.
Definition at line 58 of file Injector.php.