Inherits Parser.
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 | |
#@+ |
Definition at line 6 of file Parser_LinkHooks.php.
Parser_LinkHooks::__construct | ( | $ | conf = array() |
) |
#@-
Constructor
Reimplemented from Parser.
Definition at line 38 of file Parser_LinkHooks.php.
References $conf.
Referenced by firstCallInit().
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.
Definition at line 103 of file Parser_LinkHooks.php.
Parser_LinkHooks::replaceInternalLinks2 | ( | &$ | s | ) |
Process [[ ]] wikilinks.
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 | |||
) |
Definition at line 214 of file Parser_LinkHooks.php.
References $args, $flags, $ns, $title, Parser::areSubpagesAllowed(), Parser::maybeDoSubpageLink(), Title::newFromText(), wfProfileIn(), wfProfileOut(), and wfUrlProtocols().
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)
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 |
Definition at line 88 of file Parser_LinkHooks.php.
Parser_LinkHooks::$mLinkHooks |
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]' |
const Parser_LinkHooks::SLH_PATTERN = 1 |
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.