Parser_LinkHooks Class Reference
[Parser]

Parser with LinkHooks experiment. More...

Inherits Parser.

List of all members.

Public Member Functions

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

Public Attributes

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.
const SLH_PATTERN = 1
const EXT_LINK_URL_CLASS = '[^][<>"\\x00-\\x20\\x7F]'
const EXT_IMAGE_REGEX
 $mLinkHooks
 #@+


Detailed Description

Parser with LinkHooks experiment.

Definition at line 6 of file Parser_LinkHooks.php.


Constructor & Destructor Documentation

Parser_LinkHooks::__construct ( conf = array()  ) 

#@-

Constructor

Access:
public

Reimplemented from Parser.

Definition at line 38 of file Parser_LinkHooks.php.

References $conf.

Referenced by firstCallInit().


Member Function Documentation

Parser_LinkHooks::firstCallInit (  ) 

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

Reimplemented from Parser.

Definition at line 46 of file Parser_LinkHooks.php.

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

Parser_LinkHooks::getLinkHooks (  ) 

Get all registered link hook identifiers.

Returns:
array

Definition at line 103 of file Parser_LinkHooks.php.

Parser_LinkHooks::replaceInternalLinks2 ( &$  s  ) 

Process [[ ]] wikilinks.

Returns:
LinkHolderArray
Access:
private

Reimplemented from Parser.

Definition at line 113 of file Parser_LinkHooks.php.

References $offset, $s, $wgContLang, Title::legalChars(), wfProfileIn(), and wfProfileOut().

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)

Access:
public
Parameters:
integer|string $ns The Namespace ID or regex pattern if SLH_PATTERN is set
mixed $callback The callback function (and object) to use
integer $flags 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 88 of file Parser_LinkHooks.php.

References $flags, and $ns.


Member Data Documentation

Parser_LinkHooks::$mLinkHooks

#@+

Access:
private

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

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

Reimplemented from Parser.

Definition at line 21 of file Parser_LinkHooks.php.

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


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

Generated on Sat Sep 5 02:08:44 2009 for MediaWiki by  doxygen 1.5.9