MediaWiki REL1_33
Hooks.php
Go to the documentation of this file.
1<?php
2
4
5use Parser;
6
7class Hooks {
8
16 public static function onParserTestGlobals( array &$globals ) {
17 $globals['wgPFEnableStringFunctions'] = true;
18 }
19
27 public static function onParserFirstCallInit( Parser $parser ) {
29
30 // These functions accept DOM-style arguments
31 $class = ParserFunctions::class;
32 $parser->setFunctionHook( 'if', "$class::ifObj", Parser::SFH_OBJECT_ARGS );
33 $parser->setFunctionHook( 'ifeq', "$class::ifeqObj", Parser::SFH_OBJECT_ARGS );
34 $parser->setFunctionHook( 'switch', "$class::switchObj", Parser::SFH_OBJECT_ARGS );
35 $parser->setFunctionHook( 'ifexist', "$class::ifexistObj", Parser::SFH_OBJECT_ARGS );
36 $parser->setFunctionHook( 'ifexpr', "$class::ifexprObj", Parser::SFH_OBJECT_ARGS );
37 $parser->setFunctionHook( 'iferror', "$class::iferrorObj", Parser::SFH_OBJECT_ARGS );
38 $parser->setFunctionHook( 'time', "$class::timeObj", Parser::SFH_OBJECT_ARGS );
39 $parser->setFunctionHook( 'timel', "$class::localTimeObj", Parser::SFH_OBJECT_ARGS );
40
41 $parser->setFunctionHook( 'expr', "$class::expr" );
42 $parser->setFunctionHook( 'rel2abs', "$class::rel2abs" );
43 $parser->setFunctionHook( 'titleparts', "$class::titleparts" );
44
45 // String Functions: enable if configured
46 if ( $wgPFEnableStringFunctions ) {
47 $parser->setFunctionHook( 'len', "$class::runLen" );
48 $parser->setFunctionHook( 'pos', "$class::runPos" );
49 $parser->setFunctionHook( 'rpos', "$class::runRPos" );
50 $parser->setFunctionHook( 'sub', "$class::runSub" );
51 $parser->setFunctionHook( 'count', "$class::runCount" );
52 $parser->setFunctionHook( 'replace', "$class::runReplace" );
53 $parser->setFunctionHook( 'explode', "$class::runExplode" );
54 $parser->setFunctionHook( 'urldecode', "$class::runUrlDecode" );
55 }
56 }
57
66 public static function onScribuntoExternalLibraries( $engine, array &$extraLibraries ) {
67 if ( $engine === 'lua' ) {
68 $extraLibraries['mw.ext.ParserFunctions'] = LuaLibrary::class;
69 }
70 }
71}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
static onScribuntoExternalLibraries( $engine, array &$extraLibraries)
Registers ParserFunctions' lua function with Scribunto.
Definition Hooks.php:66
static onParserTestGlobals(array &$globals)
Enables string functions during parser tests.
Definition Hooks.php:16
static onParserFirstCallInit(Parser $parser)
Registers our parser functions with a fresh parser.
Definition Hooks.php:27
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition Parser.php:69
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
Definition hooks.txt:1834
the value to return A Title object or null for latest all implement SearchIndexField $engine
Definition hooks.txt:2925
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
Definition ExprError.php:19