Index: branches/resourceloader/phase3/includes/ResourceLoader.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | |
25 | 25 | /* |
26 | 26 | * Dynamic JavaScript and CSS resource loading system |
27 | | - * |
| 27 | + * |
28 | 28 | * @example |
29 | 29 | * // Registers a module with the resource loading system |
30 | 30 | * ResourceLoader::register( 'foo', array( |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Runs text through a filter, caching the filtered result for future calls |
77 | | - * |
| 77 | + * |
78 | 78 | * @param {string} $filter name of filter to run |
79 | 79 | * @param {string} $data text to filter, such as JavaScript or CSS text |
80 | 80 | * @param {string} $file path to file being filtered, (optional: only required for CSS to resolve paths) |
— | — | @@ -113,11 +113,11 @@ |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Registers a module with the ResourceLoader system |
117 | | - * |
| 117 | + * |
118 | 118 | * @param {mixed} $module string of name of module or array of name/options pairs |
119 | 119 | * @param {array} $options module options (optional when using multiple-registration calling style) |
120 | 120 | * @return {boolean} false if there were any errors, in which case one or more modules were not registered |
121 | | - * |
| 121 | + * |
122 | 122 | * $options format: |
123 | 123 | * array( |
124 | 124 | * // Required module options |
— | — | @@ -142,7 +142,7 @@ |
143 | 143 | * 'messages' => array( 'message1', 'message2' ... ), |
144 | 144 | * 'class' => 'classname', // Optional, defaults to ResourceLoaderModule |
145 | 145 | * ) |
146 | | - * |
| 146 | + * |
147 | 147 | * @todo We need much more clever error reporting, not just in detailing what happened, but in bringing errors to |
148 | 148 | * the client in a way that they can easily see them if they want to, such as by using FireBug |
149 | 149 | */ |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | } |
170 | 170 | /** |
171 | 171 | * Gets a map of all modules and their options |
172 | | - * |
| 172 | + * |
173 | 173 | * @return {array} array( modulename => ResourceLoaderModule ) |
174 | 174 | */ |
175 | 175 | public static function getModules() { |
— | — | @@ -186,10 +186,10 @@ |
187 | 187 | |
188 | 188 | /* |
189 | 189 | * Outputs a response to a resource load-request, including a content-type header |
190 | | - * |
| 190 | + * |
191 | 191 | * @param {WebRequest} $request web request object to respond to |
192 | 192 | * @param {string} $server web-accessible path to script server |
193 | | - * |
| 193 | + * |
194 | 194 | * $options format: |
195 | 195 | * array( |
196 | 196 | * 'user' => [boolean: true for logged in, false for anon, optional, state of current user by default], |
— | — | @@ -306,9 +306,9 @@ |
307 | 307 | ); |
308 | 308 | } |
309 | 309 | // Messages |
310 | | - $messages = isset( $blobs[$module] ) ? $blobs[$module] : '{}'; |
| 310 | + $messages = isset( $blobs[$name] ) ? $blobs[$name] : '{}'; |
311 | 311 | // 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"; |
313 | 313 | } |
314 | 314 | } |
315 | 315 | // Set headers -- when we support CSS only mode, this might change! |
Index: branches/resourceloader/phase3/includes/ResourceLoaderModule.php |
— | — | @@ -267,7 +267,7 @@ |
268 | 268 | } else if ( isset( $this->skinStyles['default'] ) ) { |
269 | 269 | $styles = $this->skinStyles['default']; |
270 | 270 | } |
271 | | - return self::concatFiles( $this->skinStyles[$skin] ); |
| 271 | + return self::concatFiles( $styles ); |
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
— | — | @@ -276,10 +276,10 @@ |
277 | 277 | * @return mixed Loader JS (string) or false if no custom loader set |
278 | 278 | */ |
279 | 279 | public function getLoaderScript() { |
280 | | - if ( count( $this->loaderScripts ) == 0 ) { |
| 280 | + if ( count( $this->loaders ) == 0 ) { |
281 | 281 | return false; |
282 | 282 | } |
283 | | - return self::concatFiles( $this->loaderScripts ); |
| 283 | + return self::concatFiles( $this->loaders ); |
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
— | — | @@ -297,7 +297,7 @@ |
298 | 298 | * @return mixed Parameter value or null if not set |
299 | 299 | */ |
300 | 300 | public function getParameter( $param ) { |
301 | | - return isset( $this->parameters[$param] ? $this->parameters[$param] : null; |
| 301 | + return isset( $this->parameters[$param] ) ? $this->parameters[$param] : null; |
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
— | — | @@ -313,7 +313,7 @@ |
314 | 314 | } |
315 | 315 | |
316 | 316 | class ResourceLoaderSiteJSModule extends ResourceLoaderModule { |
317 | | - public function getScript( $skin ) { |
| 317 | + public function getScript() { |
318 | 318 | return Skin::newFromKey( $this->getParameter( 'skin' ) )->generateUserJs(); |
319 | 319 | } |
320 | 320 | |