Localisation updates from http://translatewiki.net.
[T119942Repr.git] / Parser_function.php
blob31311ac5f69802470ce948eb6cc08e4475222857
1 <?php
3 # Guard against direct invocation from the web, print a friendly help message
5 if ( !defined( 'MEDIAWIKI' ) ) {
6 echo <<<EOT
7 <html><body>
8 <p>This is the Parser_function example extension. To enable it, put the
9 following in your LocalSettings.php:</p>
10 <pre>
11 require_once( "\$IP/extensions/examples/Parser_function.php" );
12 </pre></body></html>
13 EOT;
14 exit( 1 );
17 # Define a setup function
18 $wgHooks['ParserFirstCallInit'][] = 'wfExampleParserFunction_Setup';
19 # Add a file to initialise the magic word
20 $dir = dirname(__FILE__) . '/';
21 $wgExtensionMessagesFiles['Parser_functionMagic'] = $dir . 'Parser_function.i18n.magic.php';
23 function wfExampleParserFunction_Setup( $parser ) {
24 # Set a function hook associating the "example" magic word with our function
25 $parser->setFunctionHook( 'example', 'wfExampleParserFunction_Render' );
26 return true;
29 function wfExampleParserFunction_Render( &$parser, $param1 = '', $param2 = '' ) {
30 # The parser function itself
31 # The input parameters are wikitext with templates expanded
32 # The output should be wikitext too
33 return "param1 is $param1 and param2 is $param2";