Index: trunk/extensions/OnlineStatus/OnlineStatus.php |
— | — | @@ -33,18 +33,16 @@ |
34 | 34 | |
35 | 35 | static function init(){ |
36 | 36 | global $wgExtensionMessagesFiles, $wgExtensionFunctions, $wgHooks, $wgAjaxExportList; |
37 | | - global $wgAllowAnyUserOnlineStatusFunction; |
| 37 | + |
38 | 38 | // Add messages file |
39 | 39 | $wgExtensionMessagesFiles['OnlineStatus'] = dirname( __FILE__ ) . '/OnlineStatus.i18n.php'; |
40 | 40 | |
41 | | - if( $wgAllowAnyUserOnlineStatusFunction ){ |
42 | | - // Hooks for the Parser |
43 | | - // Use ParserFirstCallInit if aviable |
44 | | - if( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) |
45 | | - $wgHooks['ParserFirstCallInit'][] = 'OnlineStatus::ParserFirstCallInit'; |
46 | | - else |
47 | | - $wgExtensionFunctions[] = 'OnlineStatus::Setup'; |
48 | | - } |
| 41 | + // Hooks for the Parser |
| 42 | + // Use ParserFirstCallInit if aviable |
| 43 | + if( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) |
| 44 | + $wgHooks['ParserFirstCallInit'][] = 'OnlineStatus::ParserFirstCallInit'; |
| 45 | + else |
| 46 | + $wgExtensionFunctions[] = 'OnlineStatus::Setup'; |
49 | 47 | |
50 | 48 | // Magic words hooks |
51 | 49 | $wgHooks['MagicWordwgVariableIDs'][] = 'OnlineStatus::MagicWordVariable'; |
— | — | @@ -149,16 +147,17 @@ |
150 | 148 | */ |
151 | 149 | static function Setup() { |
152 | 150 | global $wgParser; |
153 | | - $wgParser->setFunctionHook( 'anyuseronlinestatus', array( __CLASS__, 'ParserHookCallback' ) ); |
154 | | - return true; |
| 151 | + self::ParserFirstCallInit( $wgParser ); |
155 | 152 | } |
156 | 153 | |
157 | 154 | /** |
158 | 155 | * Hook for ParserFirstCallInit |
159 | 156 | * Only called if $wgAllowAnyUserOnlineStatusFunction is true |
160 | 157 | */ |
161 | | - static function ParserFirstCallInit( &$parser ){ |
162 | | - $parser->setFunctionHook( 'anyuseronlinestatus', array( __CLASS__, 'ParserHookCallback' ) ); |
| 158 | + static function ParserFirstCallInit( $parser ){ |
| 159 | + global $wgAllowAnyUserOnlineStatusFunction; |
| 160 | + if( $wgAllowAnyUserOnlineStatusFunction ) |
| 161 | + $parser->setFunctionHook( 'anyuseronlinestatus', array( __CLASS__, 'ParserHookCallback' ) ); |
163 | 162 | return true; |
164 | 163 | } |
165 | 164 | |