Index: branches/Gadgets-work/Gadgets_body.php |
— | — | @@ -18,17 +18,17 @@ |
19 | 19 | //update cache if MediaWiki:Gadgets-definition was edited |
20 | 20 | $title = $article->mTitle; |
21 | 21 | if( $title->getNamespace() == NS_MEDIAWIKI && $title->getText() == 'Gadgets-definition' ) { |
22 | | - self::LoadStructured( $text ); |
| 22 | + self::loadStructured( $text ); |
23 | 23 | } |
24 | 24 | return true; |
25 | 25 | } |
26 | 26 | |
27 | | - private static function Load() { |
| 27 | + private static function load() { |
28 | 28 | static $gadgets = null; |
29 | 29 | |
30 | 30 | if ( $gadgets !== null ) return $gadgets; |
31 | 31 | |
32 | | - $struct = self::LoadStructured(); |
| 32 | + $struct = self::loadStructured(); |
33 | 33 | if ( !$struct ) { |
34 | 34 | $gadgets = $struct; |
35 | 35 | return $gadgets; |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | return $gadgets; |
44 | 44 | } |
45 | 45 | |
46 | | - public static function LoadStructured( $forceNewText = null ) { |
| 46 | + public static function loadStructured( $forceNewText = null ) { |
47 | 47 | global $wgMemc; |
48 | 48 | |
49 | 49 | static $gadgets = null; |
— | — | @@ -91,8 +91,8 @@ |
92 | 92 | return $gadgets; |
93 | 93 | } |
94 | 94 | |
95 | | - public static function GetPreferences( $user, &$preferences ) { |
96 | | - $gadgets = self::LoadStructured(); |
| 95 | + public static function getPreferences( $user, &$preferences ) { |
| 96 | + $gadgets = self::loadStructured(); |
97 | 97 | if (!$gadgets) return true; |
98 | 98 | |
99 | 99 | $options = array(); |
— | — | @@ -134,9 +134,9 @@ |
135 | 135 | return true; |
136 | 136 | } |
137 | 137 | |
138 | | - public static function RegisterModules( &$resourceLoader ) { |
139 | | - $gadgets = self::Load(); |
140 | | - if ( !gadgets ) { |
| 138 | + public static function registerModules( &$resourceLoader ) { |
| 139 | + $gadgets = self::load(); |
| 140 | + if ( !$gadgets ) { |
141 | 141 | return true; |
142 | 142 | } |
143 | 143 | foreach ( $gadgets as $g ) { |
— | — | @@ -148,7 +148,7 @@ |
149 | 149 | return true; |
150 | 150 | } |
151 | 151 | |
152 | | - public function BeforePageDisplay( $out ) { |
| 152 | + public static function beforePageDisplay( $out ) { |
153 | 153 | global $wgUser; |
154 | 154 | if ( !$wgUser->isLoggedIn() ) return true; |
155 | 155 | |
— | — | @@ -191,13 +191,13 @@ |
192 | 192 | foreach ( $pages as $page ) { |
193 | 193 | if ( isset( $done[$page] ) ) continue; |
194 | 194 | $done[$page] = true; |
195 | | - self::ApplyGadgetCode( $page, $out ); |
| 195 | + self::applyGadgetCode( $page, $out ); |
196 | 196 | } |
197 | 197 | |
198 | 198 | return true; |
199 | 199 | } |
200 | 200 | |
201 | | - private static function ApplyGadgetCode( $page, $out ) { |
| 201 | + private static function applyGadgetCode( $page, $out ) { |
202 | 202 | global $wgJsMimeType; |
203 | 203 | |
204 | 204 | //FIXME: stuff added via $out->addScript appears below usercss and userjs in the head tag. |
— | — | @@ -221,7 +221,7 @@ |
222 | 222 | $name, |
223 | 223 | $resourceLoaded = false; |
224 | 224 | |
225 | | - public static function newFromDefinition( string $definition ) { |
| 225 | + public static function newFromDefinition( $definition ) { |
226 | 226 | if ( !preg_match( '/^\*+ *([a-zA-Z](?:[-_:.\w\d ]*[a-zA-Z0-9])?)\s*((\|[^|]*)+)\s*$/', $definition, $m ) ) { |
227 | 227 | return false; |
228 | 228 | } |
— | — | @@ -289,7 +289,7 @@ |
290 | 290 | if ( $this->supportsResourceLoader() ) { |
291 | 291 | return array(); |
292 | 292 | } |
293 | | - return $this->scripts(); |
| 293 | + return $this->scripts; |
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
Index: branches/Gadgets-work/Gadgets.php |
— | — | @@ -29,10 +29,10 @@ |
30 | 30 | 'descriptionmsg' => 'gadgets-desc', |
31 | 31 | ); |
32 | 32 | |
33 | | -$wgHooks['ArticleSaveComplete'][] = 'Gadgets::ArticleSaveComplete'; |
34 | | -$wgHooks['BeforePageDisplay'][] = 'Gadgets::BeforePageDisplay'; |
35 | | -$wgHooks['GetPreferences'][] = 'Gadgets::GetPreferences'; |
36 | | -$wgHooks['ResourceLoaderRegisterModules'][] = 'Gadgets::RegisterModules'; |
| 33 | +$wgHooks['ArticleSaveComplete'][] = 'Gadgets::articleSaveComplete'; |
| 34 | +$wgHooks['BeforePageDisplay'][] = 'Gadgets::beforePageDisplay'; |
| 35 | +$wgHooks['GetPreferences'][] = 'Gadgets::getPreferences'; |
| 36 | +$wgHooks['ResourceLoaderRegisterModules'][] = 'Gadgets::registerModules'; |
37 | 37 | |
38 | 38 | $dir = dirname(__FILE__) . '/'; |
39 | 39 | $wgExtensionMessagesFiles['Gadgets'] = $dir . 'Gadgets.i18n.php'; |