r71169 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71168‎ | r71169 | r71170 >
Date:21:05, 16 August 2010
Author:tparscal
Status:ok
Tags:
Comment:
Fixed a bunch of silly mistakes that were causing things to crash
Modified paths:
  • /branches/resourceloader/phase3/includes/ResourceLoader.php (modified) (history)
  • /branches/resourceloader/phase3/includes/ResourceLoaderModule.php (modified) (history)

Diff [purge]

Index: branches/resourceloader/phase3/includes/ResourceLoader.php
@@ -23,7 +23,7 @@
2424
2525 /*
2626 * Dynamic JavaScript and CSS resource loading system
27 - *
 27+ *
2828 * @example
2929 * // Registers a module with the resource loading system
3030 * ResourceLoader::register( 'foo', array(
@@ -73,7 +73,7 @@
7474
7575 /**
7676 * Runs text through a filter, caching the filtered result for future calls
77 - *
 77+ *
7878 * @param {string} $filter name of filter to run
7979 * @param {string} $data text to filter, such as JavaScript or CSS text
8080 * @param {string} $file path to file being filtered, (optional: only required for CSS to resolve paths)
@@ -113,11 +113,11 @@
114114
115115 /**
116116 * Registers a module with the ResourceLoader system
117 - *
 117+ *
118118 * @param {mixed} $module string of name of module or array of name/options pairs
119119 * @param {array} $options module options (optional when using multiple-registration calling style)
120120 * @return {boolean} false if there were any errors, in which case one or more modules were not registered
121 - *
 121+ *
122122 * $options format:
123123 * array(
124124 * // Required module options
@@ -142,7 +142,7 @@
143143 * 'messages' => array( 'message1', 'message2' ... ),
144144 * 'class' => 'classname', // Optional, defaults to ResourceLoaderModule
145145 * )
146 - *
 146+ *
147147 * @todo We need much more clever error reporting, not just in detailing what happened, but in bringing errors to
148148 * the client in a way that they can easily see them if they want to, such as by using FireBug
149149 */
@@ -168,7 +168,7 @@
169169 }
170170 /**
171171 * Gets a map of all modules and their options
172 - *
 172+ *
173173 * @return {array} array( modulename => ResourceLoaderModule )
174174 */
175175 public static function getModules() {
@@ -186,10 +186,10 @@
187187
188188 /*
189189 * Outputs a response to a resource load-request, including a content-type header
190 - *
 190+ *
191191 * @param {WebRequest} $request web request object to respond to
192192 * @param {string} $server web-accessible path to script server
193 - *
 193+ *
194194 * $options format:
195195 * array(
196196 * 'user' => [boolean: true for logged in, false for anon, optional, state of current user by default],
@@ -306,9 +306,9 @@
307307 );
308308 }
309309 // Messages
310 - $messages = isset( $blobs[$module] ) ? $blobs[$module] : '{}';
 310+ $messages = isset( $blobs[$name] ) ? $blobs[$name] : '{}';
311311 // Output
312 - echo "mediaWiki.loader.implement( '{$module}', function() {\n{$script}\n}, '{$style}', {$messages} );\n";
 312+ echo "mediaWiki.loader.implement( '{$name}', function() {\n{$script}\n}, '{$style}', {$messages} );\n";
313313 }
314314 }
315315 // Set headers -- when we support CSS only mode, this might change!
Index: branches/resourceloader/phase3/includes/ResourceLoaderModule.php
@@ -267,7 +267,7 @@
268268 } else if ( isset( $this->skinStyles['default'] ) ) {
269269 $styles = $this->skinStyles['default'];
270270 }
271 - return self::concatFiles( $this->skinStyles[$skin] );
 271+ return self::concatFiles( $styles );
272272 }
273273
274274 /**
@@ -276,10 +276,10 @@
277277 * @return mixed Loader JS (string) or false if no custom loader set
278278 */
279279 public function getLoaderScript() {
280 - if ( count( $this->loaderScripts ) == 0 ) {
 280+ if ( count( $this->loaders ) == 0 ) {
281281 return false;
282282 }
283 - return self::concatFiles( $this->loaderScripts );
 283+ return self::concatFiles( $this->loaders );
284284 }
285285
286286 /**
@@ -297,7 +297,7 @@
298298 * @return mixed Parameter value or null if not set
299299 */
300300 public function getParameter( $param ) {
301 - return isset( $this->parameters[$param] ? $this->parameters[$param] : null;
 301+ return isset( $this->parameters[$param] ) ? $this->parameters[$param] : null;
302302 }
303303
304304 /**
@@ -313,7 +313,7 @@
314314 }
315315
316316 class ResourceLoaderSiteJSModule extends ResourceLoaderModule {
317 - public function getScript( $skin ) {
 317+ public function getScript() {
318318 return Skin::newFromKey( $this->getParameter( 'skin' ) )->generateUserJs();
319319 }
320320

Status & tagging log