MediaWiki  REL1_19
Parser_LinkHooks Class Reference

Parser with LinkHooks experiment. More...

Inheritance diagram for Parser_LinkHooks:
Collaboration diagram for Parser_LinkHooks:

List of all members.

Public Member Functions

 __construct ($conf=array())
 #@-
 firstCallInit ()
 Do various kinds of initialisation on the first call of the parser.
 getLinkHooks ()
 Get all registered link hook identifiers.
 replaceInternalLinks2 (&$s)
 Process [[ ]] wikilinks.
 replaceInternalLinksCallback ($parser, $holders, $markers, $titleText, $paramText)
 setLinkHook ($ns, $callback, $flags=0)
 Create a link hook, e.g.

Public Attributes

 $mLinkHooks
 #@+
const EXT_IMAGE_REGEX
const EXT_LINK_URL_CLASS = '[^][<>"\\x00-\\x20\\x7F]'
const SLH_PATTERN = 1
const VERSION = '1.6.4'
 Update this version number when the ParserOutput format changes in an incompatible way, so the parser cache can automatically discard old data.

Detailed Description

Parser with LinkHooks experiment.

Definition at line 12 of file Parser_LinkHooks.php.


Constructor & Destructor Documentation

Parser_LinkHooks::__construct ( conf = array())

#@-

Constructor

Reimplemented from Parser.

Definition at line 41 of file Parser_LinkHooks.php.

Referenced by firstCallInit().

Here is the caller graph for this function:


Member Function Documentation

Do various kinds of initialisation on the first call of the parser.

Reimplemented from Parser.

Definition at line 49 of file Parser_LinkHooks.php.

References __construct(), Parser\initialiseVariables(), CoreParserFunctions\register(), CoreLinkFunctions\register(), Parser\setHook(), wfProfileIn(), wfProfileOut(), and wfRunHooks().

Here is the call graph for this function:

Get all registered link hook identifiers.

Returns:
array

Definition at line 104 of file Parser_LinkHooks.php.

Process [[ ]] wikilinks.

Returns:
LinkHolderArray
Access:
private

Reimplemented from Parser.

Definition at line 114 of file Parser_LinkHooks.php.

References Title\legalChars(), wfProfileIn(), and wfProfileOut().

Here is the call graph for this function:

Parser_LinkHooks::replaceInternalLinksCallback ( parser,
holders,
markers,
titleText,
paramText 
)
Parser_LinkHooks::setLinkHook ( ns,
callback,
flags = 0 
)

Create a link hook, e.g.

[[Namepsace:...|display}} The callback function should have the form: function myLinkCallback( $parser, $holders, $markers, Title $title, $titleText, &$sortText = null, &$leadingColon = false ) { ... }

Or with SLH_PATTERN: function myLinkCallback( $parser, $holders, $markers, ) &$titleText, &$sortText = null, &$leadingColon = false ) { ... }

The callback may either return a number of different possible values: String) Text result of the link True) (Treat as link) Parse the link according to normal link rules False) (Bad link) Just output the raw wikitext (You may modify the text first)

Parameters:
$nsInteger or String: the Namespace ID or regex pattern if SLH_PATTERN is set
$callbackMixed: the callback function (and object) to use
$flagsInteger: a combination of the following flags: SLH_PATTERN Use a regex link pattern rather than a namespace
Returns:
The old callback function for this name, if any

Definition at line 89 of file Parser_LinkHooks.php.


Member Data Documentation

Parser_LinkHooks::$mLinkHooks

#@+

Access:
private

Definition at line 34 of file Parser_LinkHooks.php.

Initial value:
 '/^(http:\/\/|https:\/\/)([^][<>"\\x00-\\x20\\x7F]+)
                \\/([A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]+)\\.((?i)gif|png|jpg|jpeg)$/Sx'

Reimplemented from Parser.

Definition at line 27 of file Parser_LinkHooks.php.

const Parser_LinkHooks::EXT_LINK_URL_CLASS = '[^][<>"\\x00-\\x20\\x7F]'

Reimplemented from Parser.

Definition at line 26 of file Parser_LinkHooks.php.

Definition at line 22 of file Parser_LinkHooks.php.

const Parser_LinkHooks::VERSION = '1.6.4'

Update this version number when the ParserOutput format changes in an incompatible way, so the parser cache can automatically discard old data.

Reimplemented from Parser.

Definition at line 18 of file Parser_LinkHooks.php.


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