Index: trunk/extensions/StringFunctions/StringFunctions.php |
— | — | @@ -112,29 +112,26 @@ |
113 | 113 | $dir = dirname( __FILE__ ) . '/'; |
114 | 114 | $wgExtensionMessagesFiles['StringFunctions'] = $dir . 'StringFunctions.i18n.php'; |
115 | 115 | |
116 | | -$wgExtensionFunctions[] = 'wfStringFunctions'; |
| 116 | +$wgHooks['ParserFirstCallInit'][] = 'wfStringFunctions'; |
117 | 117 | |
118 | 118 | $wgHooks['LanguageGetMagic'][] = 'wfStringFunctionsLanguageGetMagic'; |
119 | 119 | |
120 | | -function wfStringFunctions() { |
121 | | - global $wgParser; |
122 | | - global $wgStringFunctionsLimitSearch; |
123 | | - global $wgStringFunctionsLimitReplace; |
124 | | - global $wgStringFunctionsLimitPad; |
| 120 | +$wgStringFunctionsLimitSearch = 30; |
| 121 | +$wgStringFunctionsLimitReplace = 30; |
| 122 | +$wgStringFunctionsLimitPad = 100; |
125 | 123 | |
126 | | - $wgStringFunctionsLimitSearch = 30; |
127 | | - $wgStringFunctionsLimitReplace = 30; |
128 | | - $wgStringFunctionsLimitPad = 100; |
| 124 | +function wfStringFunctions( &$parser ) { |
| 125 | + $parser->setFunctionHook( 'len', array( 'ExtStringFunctions', 'runLen' ) ); |
| 126 | + $parser->setFunctionHook( 'pos', array( 'ExtStringFunctions', 'runPos' ) ); |
| 127 | + $parser->setFunctionHook( 'rpos', array( 'ExtStringFunctions', 'runRPos' ) ); |
| 128 | + $parser->setFunctionHook( 'sub', array( 'ExtStringFunctions', 'runSub' ) ); |
| 129 | + $parser->setFunctionHook( 'pad', array( 'ExtStringFunctions', 'runPad' ) ); |
| 130 | + $parser->setFunctionHook( 'replace', array( 'ExtStringFunctions', 'runReplace' ) ); |
| 131 | + $parser->setFunctionHook( 'explode', array( 'ExtStringFunctions', 'runExplode' ) ); |
| 132 | + $parser->setFunctionHook( 'urlencode', array( 'ExtStringFunctions', 'runUrlEncode' ) ); |
| 133 | + $parser->setFunctionHook( 'urldecode', array( 'ExtStringFunctions', 'runUrlDecode' ) ); |
129 | 134 | |
130 | | - $wgParser->setFunctionHook( 'len', array( 'ExtStringFunctions', 'runLen' ) ); |
131 | | - $wgParser->setFunctionHook( 'pos', array( 'ExtStringFunctions', 'runPos' ) ); |
132 | | - $wgParser->setFunctionHook( 'rpos', array( 'ExtStringFunctions', 'runRPos' ) ); |
133 | | - $wgParser->setFunctionHook( 'sub', array( 'ExtStringFunctions', 'runSub' ) ); |
134 | | - $wgParser->setFunctionHook( 'pad', array( 'ExtStringFunctions', 'runPad' ) ); |
135 | | - $wgParser->setFunctionHook( 'replace', array( 'ExtStringFunctions', 'runReplace' ) ); |
136 | | - $wgParser->setFunctionHook( 'explode', array( 'ExtStringFunctions', 'runExplode' ) ); |
137 | | - $wgParser->setFunctionHook( 'urlencode', array( 'ExtStringFunctions', 'runUrlEncode' ) ); |
138 | | - $wgParser->setFunctionHook( 'urldecode', array( 'ExtStringFunctions', 'runUrlDecode' ) ); |
| 135 | + return true; |
139 | 136 | } |
140 | 137 | |
141 | 138 | function wfStringFunctionsLanguageGetMagic( &$magicWords, $langCode = 'en' ) { |