r76041 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76040‎ | r76041 | r76042 >
Date:21:23, 4 November 2010
Author:maxsem
Status:deferred
Tags:
Comment:
Code style, fixed a couple of errors
Modified paths:
  • /branches/Gadgets-work/Gadgets.php (modified) (history)
  • /branches/Gadgets-work/Gadgets_body.php (modified) (history)

Diff [purge]

Index: branches/Gadgets-work/Gadgets_body.php
@@ -18,17 +18,17 @@
1919 //update cache if MediaWiki:Gadgets-definition was edited
2020 $title = $article->mTitle;
2121 if( $title->getNamespace() == NS_MEDIAWIKI && $title->getText() == 'Gadgets-definition' ) {
22 - self::LoadStructured( $text );
 22+ self::loadStructured( $text );
2323 }
2424 return true;
2525 }
2626
27 - private static function Load() {
 27+ private static function load() {
2828 static $gadgets = null;
2929
3030 if ( $gadgets !== null ) return $gadgets;
3131
32 - $struct = self::LoadStructured();
 32+ $struct = self::loadStructured();
3333 if ( !$struct ) {
3434 $gadgets = $struct;
3535 return $gadgets;
@@ -42,7 +42,7 @@
4343 return $gadgets;
4444 }
4545
46 - public static function LoadStructured( $forceNewText = null ) {
 46+ public static function loadStructured( $forceNewText = null ) {
4747 global $wgMemc;
4848
4949 static $gadgets = null;
@@ -91,8 +91,8 @@
9292 return $gadgets;
9393 }
9494
95 - public static function GetPreferences( $user, &$preferences ) {
96 - $gadgets = self::LoadStructured();
 95+ public static function getPreferences( $user, &$preferences ) {
 96+ $gadgets = self::loadStructured();
9797 if (!$gadgets) return true;
9898
9999 $options = array();
@@ -134,9 +134,9 @@
135135 return true;
136136 }
137137
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 ) {
141141 return true;
142142 }
143143 foreach ( $gadgets as $g ) {
@@ -148,7 +148,7 @@
149149 return true;
150150 }
151151
152 - public function BeforePageDisplay( $out ) {
 152+ public static function beforePageDisplay( $out ) {
153153 global $wgUser;
154154 if ( !$wgUser->isLoggedIn() ) return true;
155155
@@ -191,13 +191,13 @@
192192 foreach ( $pages as $page ) {
193193 if ( isset( $done[$page] ) ) continue;
194194 $done[$page] = true;
195 - self::ApplyGadgetCode( $page, $out );
 195+ self::applyGadgetCode( $page, $out );
196196 }
197197
198198 return true;
199199 }
200200
201 - private static function ApplyGadgetCode( $page, $out ) {
 201+ private static function applyGadgetCode( $page, $out ) {
202202 global $wgJsMimeType;
203203
204204 //FIXME: stuff added via $out->addScript appears below usercss and userjs in the head tag.
@@ -221,7 +221,7 @@
222222 $name,
223223 $resourceLoaded = false;
224224
225 - public static function newFromDefinition( string $definition ) {
 225+ public static function newFromDefinition( $definition ) {
226226 if ( !preg_match( '/^\*+ *([a-zA-Z](?:[-_:.\w\d ]*[a-zA-Z0-9])?)\s*((\|[^|]*)+)\s*$/', $definition, $m ) ) {
227227 return false;
228228 }
@@ -289,7 +289,7 @@
290290 if ( $this->supportsResourceLoader() ) {
291291 return array();
292292 }
293 - return $this->scripts();
 293+ return $this->scripts;
294294 }
295295 }
296296
Index: branches/Gadgets-work/Gadgets.php
@@ -29,10 +29,10 @@
3030 'descriptionmsg' => 'gadgets-desc',
3131 );
3232
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';
3737
3838 $dir = dirname(__FILE__) . '/';
3939 $wgExtensionMessagesFiles['Gadgets'] = $dir . 'Gadgets.i18n.php';

Status & tagging log