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

Injector that converts configuration directive syntax Namespace.Directive to links. More...

+ Inheritance diagram for HTMLPurifier_Injector_PurifierLinkify:
+ Collaboration diagram for HTMLPurifier_Injector_PurifierLinkify:

Public Member Functions

 prepare ($config, $context)
 handleText (&$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.
 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.

Data Fields

 $name = 'PurifierLinkify'
 string
 $docURL
 string
 $needed = array('a' => array('href'))
 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.

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 converts configuration directive syntax Namespace.Directive to links.

Definition at line 7 of file PurifierLinkify.php.

Member Function Documentation

HTMLPurifier_Injector_PurifierLinkify::handleText ( $token)
Parameters
HTMLPurifier_Token$token

Reimplemented from HTMLPurifier_Injector.

Definition at line 38 of file PurifierLinkify.php.

References HTMLPurifier_Injector\allowsElement().

{
if (!$this->allowsElement('a')) {
return;
}
if (strpos($token->data, '%') === false) {
return;
}
$bits = preg_split('#%([a-z0-9]+\.[a-z0-9]+)#Si', $token->data, -1, PREG_SPLIT_DELIM_CAPTURE);
$token = array();
// $i = index
// $c = count
// $l = is link
for ($i = 0, $c = count($bits), $l = false; $i < $c; $i++, $l = !$l) {
if (!$l) {
if ($bits[$i] === '') {
continue;
}
$token[] = new HTMLPurifier_Token_Text($bits[$i]);
} else {
$token[] = new HTMLPurifier_Token_Start(
'a',
array('href' => str_replace('%s', $bits[$i], $this->docURL))
);
$token[] = new HTMLPurifier_Token_Text('%' . $bits[$i]);
$token[] = new HTMLPurifier_Token_End('a');
}
}
}

+ Here is the call graph for this function:

HTMLPurifier_Injector_PurifierLinkify::prepare (   $config,
  $context 
)
Parameters
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
string

Reimplemented from HTMLPurifier_Injector.

Definition at line 29 of file PurifierLinkify.php.

{
$this->docURL = $config->get('AutoFormat.PurifierLinkify.DocURL');
return parent::prepare($config, $context);
}

Field Documentation

HTMLPurifier_Injector_PurifierLinkify::$docURL

string

Definition at line 17 of file PurifierLinkify.php.

HTMLPurifier_Injector_PurifierLinkify::$name = 'PurifierLinkify'

string

Definition at line 12 of file PurifierLinkify.php.

HTMLPurifier_Injector_PurifierLinkify::$needed = array('a' => array('href'))

array

Definition at line 22 of file PurifierLinkify.php.


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