ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTMLPurifier_Injector_RemoveSpansWithoutAttributes Class Reference

Injector that removes spans with no attributes. More...

+ Inheritance diagram for HTMLPurifier_Injector_RemoveSpansWithoutAttributes:
+ Collaboration diagram for HTMLPurifier_Injector_RemoveSpansWithoutAttributes:

Public Member Functions

 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.
 handleElement (&$token)
 handleEnd (&$token)
- Public Member Functions inherited from HTMLPurifier_Injector
 rewindOffset ($offset)
 Rewind to a spot to re-perform processing.
 getRewindOffset ()
 Retrieves rewind offset, and then unsets it.
 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.
 notifyEnd ($token)
 Notifier that is called when an end token is processed.

Data Fields

 $name = 'RemoveSpansWithoutAttributes'
 string
 $needed = array('span')
 array
- Data Fields inherited from HTMLPurifier_Injector
 $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.

Private Attributes

 $attrValidator
 HTMLPurifier_AttrValidator
 $config
 Used by AttrValidator.
 $context
 HTMLPurifier_Context

Additional Inherited Members

- Protected Member Functions inherited from HTMLPurifier_Injector
 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.
- Protected Attributes inherited from HTMLPurifier_Injector
 $htmlDefinition
 HTMLPurifier_HTMLDefinition
 $currentNesting
 Reference to CurrentNesting variable in Context.
 $currentToken
 Reference to current token.
 $inputZipper
 Reference to InputZipper variable in Context.
 $rewindOffset = false
 Number of elements to rewind backwards (relative).

Detailed Description

Injector that removes spans with no attributes.

Definition at line 6 of file RemoveSpansWithoutAttributes.php.

Member Function Documentation

HTMLPurifier_Injector_RemoveSpansWithoutAttributes::handleElement ( $token)
Parameters
HTMLPurifier_Token$token

Reimplemented from HTMLPurifier_Injector.

Definition at line 45 of file RemoveSpansWithoutAttributes.php.

References HTMLPurifier_Injector\forwardUntilEndToken().

{
if ($token->name !== 'span' || !$token instanceof HTMLPurifier_Token_Start) {
return;
}
// We need to validate the attributes now since this doesn't normally
// happen until after MakeWellFormed. If all the attributes are removed
// the span needs to be removed too.
$this->attrValidator->validateToken($token, $this->config, $this->context);
$token->armor['ValidateAttributes'] = true;
if (!empty($token->attr)) {
return;
}
$nesting = 0;
while ($this->forwardUntilEndToken($i, $current, $nesting)) {
}
if ($current instanceof HTMLPurifier_Token_End && $current->name === 'span') {
// Mark closing span tag for deletion
$current->markForDeletion = true;
// Delete open span tag
$token = false;
}
}

+ Here is the call graph for this function:

HTMLPurifier_Injector_RemoveSpansWithoutAttributes::handleEnd ( $token)
Parameters
HTMLPurifier_Token$token

Reimplemented from HTMLPurifier_Injector.

Definition at line 76 of file RemoveSpansWithoutAttributes.php.

{
if ($token->markForDeletion) {
$token = false;
}
}
HTMLPurifier_Injector_RemoveSpansWithoutAttributes::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()).

Parameters
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool|string Boolean false if success, string of missing needed element/attribute if failure

Reimplemented from HTMLPurifier_Injector.

Definition at line 34 of file RemoveSpansWithoutAttributes.php.

References $config, and $context.

{
$this->attrValidator = new HTMLPurifier_AttrValidator();
$this->config = $config;
$this->context = $context;
}

Field Documentation

HTMLPurifier_Injector_RemoveSpansWithoutAttributes::$attrValidator
private
HTMLPurifier_Injector_RemoveSpansWithoutAttributes::$config
private

Used by AttrValidator.

HTMLPurifier_Config

Definition at line 27 of file RemoveSpansWithoutAttributes.php.

Referenced by prepare().

HTMLPurifier_Injector_RemoveSpansWithoutAttributes::$context
private

HTMLPurifier_Context

Definition at line 32 of file RemoveSpansWithoutAttributes.php.

Referenced by prepare().

HTMLPurifier_Injector_RemoveSpansWithoutAttributes::$name = 'RemoveSpansWithoutAttributes'

string

Definition at line 11 of file RemoveSpansWithoutAttributes.php.

HTMLPurifier_Injector_RemoveSpansWithoutAttributes::$needed = array('span')

array

Definition at line 16 of file RemoveSpansWithoutAttributes.php.


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