MediaWiki  REL1_20
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 28 of file Parser_LinkHooks.php.


Constructor & Destructor Documentation

Parser_LinkHooks::__construct ( conf = array())

#@-

Constructor

Reimplemented from Parser.

Definition at line 57 of file Parser_LinkHooks.php.

Referenced by firstCallInit().


Member Function Documentation

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

Reimplemented from Parser.

Definition at line 65 of file Parser_LinkHooks.php.

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

Get all registered link hook identifiers.

Returns:
array

Definition at line 120 of file Parser_LinkHooks.php.

Process [[ ]] wikilinks.

Returns:
LinkHolderArray
Access:
private

Reimplemented from Parser.

Definition at line 130 of file Parser_LinkHooks.php.

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

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:
callback|null The old callback function for this name, if any

Definition at line 105 of file Parser_LinkHooks.php.


Member Data Documentation

Parser_LinkHooks::$mLinkHooks

#@+

Access:
private

Definition at line 50 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 43 of file Parser_LinkHooks.php.

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

Reimplemented from Parser.

Definition at line 42 of file Parser_LinkHooks.php.

Definition at line 38 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 34 of file Parser_LinkHooks.php.


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