From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- extensions/ParserFunctions/ParserFunctions.php | 115 +++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 extensions/ParserFunctions/ParserFunctions.php (limited to 'extensions/ParserFunctions/ParserFunctions.php') diff --git a/extensions/ParserFunctions/ParserFunctions.php b/extensions/ParserFunctions/ParserFunctions.php new file mode 100644 index 00000000..da9f3bbe --- /dev/null +++ b/extensions/ParserFunctions/ParserFunctions.php @@ -0,0 +1,115 @@ + 'en-gb' +); + +/** REGISTRATION */ +$wgExtensionCredits['parserhook'][] = array( + 'path' => __FILE__, + 'name' => 'ParserFunctions', + 'version' => '1.4.0', + 'url' => 'http://www.mediawiki.org/wiki/Extension:ParserFunctions', + 'author' => array( 'Tim Starling', 'Robert Rohde', 'Ross McClure', 'Juraj Simlovic' ), + 'descriptionmsg' => 'pfunc_desc', +); + +$wgAutoloadClasses['ExtParserFunctions'] = dirname( __FILE__ ) . '/ParserFunctions_body.php'; +$wgAutoloadClasses['ExprParser'] = dirname( __FILE__ ) . '/Expr.php'; +$wgAutoloadClasses['ConvertParser'] = dirname( __FILE__ ) . '/Convert.php'; + +$wgExtensionMessagesFiles['ParserFunctions'] = dirname( __FILE__ ) . '/ParserFunctions.i18n.php'; +$wgExtensionMessagesFiles['ParserFunctionsMagic'] = dirname( __FILE__ ) . '/ParserFunctions.i18n.magic.php'; + +$wgParserTestFiles[] = dirname( __FILE__ ) . "/funcsParserTests.txt"; +$wgParserTestFiles[] = dirname( __FILE__ ) . "/stringFunctionTests.txt"; +$wgParserTestFiles[] = dirname( __FILE__ ) . "/convertTests.txt"; + +$wgHooks['ParserFirstCallInit'][] = 'wfRegisterParserFunctions'; + +function wfRegisterParserFunctions( $parser ) { + global $wgPFEnableStringFunctions, $wgPFEnableConvert; + + if ( defined( get_class( $parser ) . '::SFH_OBJECT_ARGS' ) ) { + // These functions accept DOM-style arguments + $parser->setFunctionHook( 'if', 'ExtParserFunctions::ifObj', SFH_OBJECT_ARGS ); + $parser->setFunctionHook( 'ifeq', 'ExtParserFunctions::ifeqObj', SFH_OBJECT_ARGS ); + $parser->setFunctionHook( 'switch', 'ExtParserFunctions::switchObj', SFH_OBJECT_ARGS ); + $parser->setFunctionHook( 'ifexist', 'ExtParserFunctions::ifexistObj', SFH_OBJECT_ARGS ); + $parser->setFunctionHook( 'ifexpr', 'ExtParserFunctions::ifexprObj', SFH_OBJECT_ARGS ); + $parser->setFunctionHook( 'iferror', 'ExtParserFunctions::iferrorObj', SFH_OBJECT_ARGS ); + } else { + $parser->setFunctionHook( 'if', 'ExtParserFunctions::ifHook' ); + $parser->setFunctionHook( 'ifeq', 'ExtParserFunctions::ifeq' ); + $parser->setFunctionHook( 'switch', 'ExtParserFunctions::switchHook' ); + $parser->setFunctionHook( 'ifexist', 'ExtParserFunctions::ifexist' ); + $parser->setFunctionHook( 'ifexpr', 'ExtParserFunctions::ifexpr' ); + $parser->setFunctionHook( 'iferror', 'ExtParserFunctions::iferror' ); + } + + $parser->setFunctionHook( 'expr', 'ExtParserFunctions::expr' ); + $parser->setFunctionHook( 'time', 'ExtParserFunctions::time' ); + $parser->setFunctionHook( 'timel', 'ExtParserFunctions::localTime' ); + $parser->setFunctionHook( 'rel2abs', 'ExtParserFunctions::rel2abs' ); + $parser->setFunctionHook( 'titleparts', 'ExtParserFunctions::titleparts' ); + + // String Functions + if ( $wgPFEnableStringFunctions ) { + $parser->setFunctionHook( 'len', 'ExtParserFunctions::runLen' ); + $parser->setFunctionHook( 'pos', 'ExtParserFunctions::runPos' ); + $parser->setFunctionHook( 'rpos', 'ExtParserFunctions::runRPos' ); + $parser->setFunctionHook( 'sub', 'ExtParserFunctions::runSub' ); + $parser->setFunctionHook( 'count', 'ExtParserFunctions::runCount' ); + $parser->setFunctionHook( 'replace', 'ExtParserFunctions::runReplace' ); + $parser->setFunctionHook( 'explode', 'ExtParserFunctions::runExplode' ); + $parser->setFunctionHook( 'urldecode', 'ExtParserFunctions::runUrlDecode' ); + } + + if( $wgPFEnableConvert ) { + $parser->setFunctionHook( 'convert', 'ExtParserFunctions::convert' ); + } + + return true; +} -- cgit v1.2.3-54-g00ecf