HumHub Documentation (unofficial)

HTMLPurifier_Injector_Linkify extends HTMLPurifier_Injector
in package

Injector that converts http, https and ftp text URLs to actual links.

Table of Contents

Properties

$name  : mixed
Advisory name of injector, this is for friendly error messages.
$needed  : mixed
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')
$currentNesting  : mixed
Reference to CurrentNesting variable in Context. This is an array list of tokens that we are currently "inside"
$currentToken  : mixed
Reference to current token.
$htmlDefinition  : mixed
$inputZipper  : mixed
Reference to InputZipper variable in Context.
$rewindOffset  : mixed
Number of elements to rewind backwards (relative).

Methods

allowsElement()  : bool
Tests if the context node allows a certain element
checkNeeded()  : bool|string
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.
getRewindOffset()  : bool|int
Retrieves rewind offset, and then unsets it.
handleElement()  : mixed
Handler that is called when a start or empty token is processed
handleEnd()  : mixed
Handler that is called when an end token is processed
handleText()  : mixed
Handler that is called when a text token is processed
notifyEnd()  : mixed
Notifier that is called when an end token is processed
prepare()  : bool|string
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()).
rewindOffset()  : mixed
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.
backward()  : bool
Iterator function, starts with the previous token and continues until you reach the beginning of input tokens.
forward()  : bool
Iterator function, which starts with the next token and continues until you reach the end of the input tokens.
forwardUntilEndToken()  : bool
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.

Properties

$name

Advisory name of injector, this is for friendly error messages.

public mixed $name = 'Linkify'
Tags
type

string

$needed

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')

public mixed $needed = array('a' => array('href'))
Tags
type

array

$currentNesting

Reference to CurrentNesting variable in Context. This is an array list of tokens that we are currently "inside"

protected mixed $currentNesting
Tags
type

array

$currentToken

Reference to current token.

protected mixed $currentToken
Tags
type

HTMLPurifier_Token

$htmlDefinition

protected mixed $htmlDefinition
Tags
type

HTMLPurifier_HTMLDefinition

$inputZipper

Reference to InputZipper variable in Context.

protected mixed $inputZipper
Tags
type

HTMLPurifier_Zipper

$rewindOffset

Number of elements to rewind backwards (relative).

protected mixed $rewindOffset = \false
Tags
type

bool|int

Methods

allowsElement()

Tests if the context node allows a certain element

public allowsElement(string $name) : bool
Parameters
$name : string

Name of element to test for

Return values
bool

True if element is allowed, false if it is not

checkNeeded()

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.

public checkNeeded(HTMLPurifier_Config $config) : bool|string
Parameters
$config : HTMLPurifier_Config
Return values
bool|string

Boolean false if success, string of missing needed element/attribute if failure

getRewindOffset()

Retrieves rewind offset, and then unsets it.

public getRewindOffset() : bool|int
Return values
bool|int

handleElement()

Handler that is called when a start or empty token is processed

public handleElement(mixed &$token) : mixed
Parameters
$token : mixed

handleEnd()

Handler that is called when an end token is processed

public handleEnd(mixed &$token) : mixed
Parameters
$token : mixed

notifyEnd()

Notifier that is called when an end token is processed

public notifyEnd(HTMLPurifier_Token $token) : mixed
Parameters
$token : HTMLPurifier_Token

Current token variable.

Tags
note

This differs from handlers in that the token is read-only

deprecated

prepare()

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()).

public prepare(HTMLPurifier_Config $config, HTMLPurifier_Context $context) : bool|string
Parameters
$config : HTMLPurifier_Config
$context : HTMLPurifier_Context
Return values
bool|string

Boolean false if success, string of missing needed element/attribute if failure

rewindOffset()

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 rewindOffset(bool|int $offset) : mixed
Parameters
$offset : bool|int
Tags
warning

HTML Purifier will prevent you from fast-forwarding with this function.

backward()

Iterator function, starts with the previous token and continues until you reach the beginning of input tokens.

protected backward(int &$i, HTMLPurifier_Token &$current) : bool
Parameters
$i : int

Current integer index variable for inputTokens

$current : HTMLPurifier_Token

Current token variable. Do NOT use $token, as that variable is also a reference

Tags
warning

Please prevent previous references from interfering with this functions by setting $i = null beforehand!

Return values
bool

forward()

Iterator function, which starts with the next token and continues until you reach the end of the input tokens.

protected forward(int &$i, HTMLPurifier_Token &$current) : bool
Parameters
$i : int

Current integer index variable for inputTokens

$current : HTMLPurifier_Token

Current token variable. Do NOT use $token, as that variable is also a reference

Tags
warning

Please prevent previous references from interfering with this functions by setting $i = null beforehand!

Return values
bool

forwardUntilEndToken()

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 forwardUntilEndToken(int &$i, HTMLPurifier_Token &$current, int &$nesting) : bool
Parameters
$i : int

Current integer index variable for inputTokens

$current : HTMLPurifier_Token

Current token variable. Do NOT use $token, as that variable is also a reference

$nesting : int
Return values
bool

        
On this page

Search results