MediaWiki
REL1_19
|
Parser with LinkHooks experiment. More...
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. |
Parser with LinkHooks experiment.
Definition at line 12 of file Parser_LinkHooks.php.
Parser_LinkHooks::__construct | ( | $ | conf = array() | ) |
#@-
Constructor
Reimplemented from Parser.
Definition at line 41 of file Parser_LinkHooks.php.
Referenced by firstCallInit().
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().
Get all registered link hook identifiers.
Definition at line 104 of file Parser_LinkHooks.php.
Process [[ ]] wikilinks.
Reimplemented from Parser.
Definition at line 114 of file Parser_LinkHooks.php.
References Title\legalChars(), wfProfileIn(), and wfProfileOut().
Parser_LinkHooks::replaceInternalLinksCallback | ( | $ | parser, |
$ | holders, | ||
$ | markers, | ||
$ | titleText, | ||
$ | paramText | ||
) |
Definition at line 206 of file Parser_LinkHooks.php.
References $title, Parser\areSubpagesAllowed(), CoreLinkFunctions\defaultLinkHook(), 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)
$ns | Integer or String: the Namespace ID or regex pattern if SLH_PATTERN is set |
$callback | Mixed: the callback function (and object) to use |
$flags | Integer: a combination of the following flags: SLH_PATTERN Use a regex link pattern rather than a namespace |
Definition at line 89 of file Parser_LinkHooks.php.
Parser_LinkHooks::$mLinkHooks |
'/^(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.
const Parser_LinkHooks::SLH_PATTERN = 1 |
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.