r73040 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73039‎ | r73040 | r73041 >
Date:01:46, 15 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
Fixed a bunch of syntax errors and mistakes.
Modified paths:
  • /trunk/extensions/Vector/Vector.hooks.php (modified) (history)
  • /trunk/phase3/includes/ResourceLoader.php (modified) (history)
  • /trunk/phase3/resources/Resources.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ResourceLoader.php
@@ -326,4 +326,4 @@
327327 }
328328
329329 ResourceLoader::register( include( "$IP/resources/Resources.php" ) );
330 -wfRunHook( 'ResourceLoaderRegisterModules' );
\ No newline at end of file
 330+wfRunHooks( 'ResourceLoaderRegisterModules' );
\ No newline at end of file
Index: trunk/phase3/resources/Resources.php
@@ -405,4 +405,4 @@
406406 'mediawiki.legacy.wikiprintable' => new ResourceLoaderFileModule( array(
407407 'styles' => array( 'skins/common/wikiprintable.css' => array( 'media' => 'print' ) ),
408408 ) ),
409 -) );
\ No newline at end of file
 409+);
\ No newline at end of file
Index: trunk/extensions/Vector/Vector.hooks.php
@@ -20,7 +20,7 @@
2121 'vector-collapsiblenav-more',
2222 ),
2323 'dependencies' => array( 'jquery.client' ),
24 - )
 24+ ),
2525 'preferences' => array(
2626 'key' => 'vector-collapsiblenav',
2727 'ui' => array(
@@ -38,7 +38,7 @@
3939 'name' => 'vector.collapsibleTabs',
4040 'resources' => array(
4141 'scripts' => 'extensions/Vector/modules/vector.collapsibleTabs.js',
42 - )
 42+ ),
4343 ),
4444 'editwarning' => array(
4545 'name' => 'vector.editWarning',
@@ -66,7 +66,7 @@
6767 'dependencies' => array( 'jquery.client' ),
6868 ),
6969 'preferences' => array(
70 - 'requirements' = array( 'vector-simplesearch' => true ),
 70+ 'requirements' => array( 'vector-simplesearch' => true ),
7171 ),
7272 ),
7373 'footercleanup' => array(
@@ -86,14 +86,14 @@
8787 ),
8888 ),
8989 'preferences' => array(
90 - 'requirements' = array( 'vector-simplesearch' => true, 'disablesuggest' => false ),
 90+ 'requirements' => array( 'vector-simplesearch' => true, 'disablesuggest' => false ),
9191 ),
9292 ),
9393 );
9494
9595 /* Protected Static Methods */
9696
97 - protected static isEnabled( $module ) {
 97+ protected static function isEnabled( $module ) {
9898 global $wgVectorModules, $wgUser;
9999
100100 $enabled =
@@ -101,15 +101,17 @@
102102 (
103103 $wgVectorModules[$module]['user'] &&
104104 isset( self::$modules[$module]['preferences']['key'] ) &&
105 - $wgUser->getOption( self::$modules[$module]['preferences']['key']
 105+ $wgUser->getOption( self::$modules[$module]['preferences']['key'] )
106106 );
107107 if ( !$enabled ) {
108108 return false;
109109 }
110 - foreach ( self::$modules[$module]['preferences']['requirements'] as $requirement => $value ) {
111 - // Important! We really do want fuzzy evaluation here
112 - if ( $wgUser->getOption( $requirement ) != $value ) {
113 - return false;
 110+ if ( isset( self::$modules[$module]['preferences']['requirements'] ) ) {
 111+ foreach ( self::$modules[$module]['preferences']['requirements'] as $requirement => $value ) {
 112+ // Important! We really do want fuzzy evaluation here
 113+ if ( $wgUser->getOption( $requirement ) != $value ) {
 114+ return false;
 115+ }
114116 }
115117 }
116118 return true;
@@ -139,6 +141,7 @@
140142 $out->addModules( self::$modules[$module]['name'] );
141143 }
142144 }
 145+ return true;
143146 }
144147
145148 /**
@@ -153,7 +156,7 @@
154157 global $wgVectorModules;
155158
156159 foreach ( $wgVectorModules as $module => $enable ) {
157 - if ( $enable['user'] ) && isset( self::$modules['preferences'][$module]['ui'] ) ) {
 160+ if ( $enable['user'] && isset( self::$modules['preferences'][$module]['ui'] ) ) {
158161 $defaultPreferences[self::$modules['preferences'][$module]['key']] =
159162 self::$modules['preferences'][$module]['ui'];
160163 }
@@ -166,6 +169,8 @@
167170 * Adds enabled/disabled switches for Vector modules
168171 */
169172 public static function makeGlobalVariablesScript( &$vars ) {
 173+ global $wgVectorModules;
 174+
170175 $configurations = array();
171176 foreach ( $wgVectorModules as $module => $enable ) {
172177 if (
@@ -191,7 +196,8 @@
192197 */
193198 public static function resourceLoaderRegisterModules() {
194199 foreach ( self::$modules as $module ) {
195 - ResourceLoader::register( $module['name'], $module['resources'] );
 200+ ResourceLoader::register( $module['name'], new ResourceLoaderFileModule( $module['resources'] ) );
196201 }
 202+ return true;
197203 }
198204 }
\ No newline at end of file

Status & tagging log