Index: trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php |
— | — | @@ -29,6 +29,10 @@ |
30 | 30 | |
31 | 31 | /* Protected Members */ |
32 | 32 | |
| 33 | + /** @var {string} Local base path, see __construct() */ |
| 34 | + protected $localBasePath = ''; |
| 35 | + /** @var {string} Remote base path, see __construct() */ |
| 36 | + protected $remoteBasePath = ''; |
33 | 37 | /** |
34 | 38 | * @var {array} List of paths to JavaScript files to always include |
35 | 39 | * @format array( [file-path], [file-path], ... ) |
— | — | @@ -95,7 +99,8 @@ |
96 | 100 | * Constructs a new module from an options array. |
97 | 101 | * |
98 | 102 | * @param {array} $options Options array. If not given or empty, an empty module will be constructed |
99 | | - * @param {string} $basePath base path to prepend to all paths in $options |
| 103 | + * @param {string} $localBasePath base path to prepend to all local paths in $options. Defaults to $IP |
| 104 | + * @param {string} $remoteBasePath base path to prepend to all remote paths in $options. Defaults to $wgScriptPath |
100 | 105 | * |
101 | 106 | * @format $options |
102 | 107 | * array( |
— | — | @@ -127,7 +132,10 @@ |
128 | 133 | * 'group' => [group name string], |
129 | 134 | * ) |
130 | 135 | */ |
131 | | - public function __construct( $options = array(), $basePath = null ) { |
| 136 | + public function __construct( $options = array(), $localBasePath = null, $remoteBasePath = null ) { |
| 137 | + global $IP, $wgScriptPath; |
| 138 | + $this->localBasePath = $localBasePath === null ? $IP : $localBasePath; |
| 139 | + $this->remoteBasePath = $remoteBasePath === null ? $wgScriptPath : $remoteBasePath; |
132 | 140 | foreach ( $options as $member => $option ) { |
133 | 141 | switch ( $member ) { |
134 | 142 | // Lists of file paths |
— | — | @@ -135,7 +143,7 @@ |
136 | 144 | case 'debugScripts': |
137 | 145 | case 'loaderScripts': |
138 | 146 | case 'styles': |
139 | | - $this->{$member} = self::prefixFilePathList( (array) $option, $basePath ); |
| 147 | + $this->{$member} = (array) $option; |
140 | 148 | break; |
141 | 149 | // Collated lists of file paths |
142 | 150 | case 'languageScripts': |
— | — | @@ -152,7 +160,7 @@ |
153 | 161 | "Invalid collated file path list key error. '$key' given, string expected." |
154 | 162 | ); |
155 | 163 | } |
156 | | - $this->{$member}[$key] = self::prefixFilePathList( (array) $value, $basePath ); |
| 164 | + $this->{$member}[$key] = (array) $value; |
157 | 165 | } |
158 | 166 | break; |
159 | 167 | // Lists of strings |
— | — | @@ -191,13 +199,13 @@ |
192 | 200 | if ( $this->debugRaw ) { |
193 | 201 | $script = ''; |
194 | 202 | foreach ( $files as $file ) { |
195 | | - $path = FormatJson::encode( "$wgServer$wgScriptPath/$file" ); |
| 203 | + $path = FormatJson::encode( $wgServer . $this->getRemotePath( $file ) ); |
196 | 204 | $script .= "\n\tmediaWiki.loader.load( $path );"; |
197 | 205 | } |
198 | 206 | return $script; |
199 | 207 | } |
200 | 208 | } |
201 | | - return self::readScriptFiles( $files ); |
| 209 | + return $this->readScriptFiles( $files ); |
202 | 210 | } |
203 | 211 | |
204 | 212 | /** |
— | — | @@ -209,7 +217,7 @@ |
210 | 218 | if ( count( $this->loaderScripts ) == 0 ) { |
211 | 219 | return false; |
212 | 220 | } |
213 | | - return self::readScriptFiles( $this->loaderScripts ); |
| 221 | + return $this->readScriptFiles( $this->loaderScripts ); |
214 | 222 | } |
215 | 223 | |
216 | 224 | /** |
— | — | @@ -311,9 +319,11 @@ |
312 | 320 | $context->getDebug() ? $this->debugScripts : array(), |
313 | 321 | self::tryForKey( $this->languageScripts, $context->getLanguage() ), |
314 | 322 | self::tryForKey( $this->skinScripts, $context->getSkin(), 'default' ), |
315 | | - $this->loaderScripts, |
316 | | - $this->getFileDependencies( $context->getSkin() ) |
| 323 | + $this->loaderScripts |
317 | 324 | ); |
| 325 | + $files = array_map( array( $this, 'getLocalPath' ), $files ); |
| 326 | + // File deps need to be treated separately because they're already prefixed |
| 327 | + $files = array_merge( $files, $this->getFileDependencies( $context->getSkin() ) ); |
318 | 328 | |
319 | 329 | // If a module is nothing but a list of dependencies, we need to avoid giving max() an empty array |
320 | 330 | if ( count( $files ) === 0 ) { |
— | — | @@ -321,7 +331,7 @@ |
322 | 332 | } |
323 | 333 | |
324 | 334 | wfProfileIn( __METHOD__.'-filemtime' ); |
325 | | - $filesMtime = max( array_map( 'filemtime', array_map( array( __CLASS__, 'resolveFilePath' ), $files ) ) ); |
| 335 | + $filesMtime = max( array_map( 'filemtime', $files ) ); |
326 | 336 | wfProfileOut( __METHOD__.'-filemtime' ); |
327 | 337 | $this->modifiedTime[$context->getHash()] = max( $filesMtime, $this->getMsgBlobMtime( $context->getLanguage() ) ); |
328 | 338 | wfProfileOut( __METHOD__ ); |
— | — | @@ -330,28 +340,13 @@ |
331 | 341 | |
332 | 342 | /* Protected Members */ |
333 | 343 | |
334 | | - /** |
335 | | - * Prefixes each file path in a list. |
336 | | - * |
337 | | - * @param {array} $list List of file paths in any combination of index/path or path/options pairs |
338 | | - * @param {string} $prefix String to prepend to each file path in $list |
339 | | - * @return {array} List of prefixed file paths |
340 | | - */ |
341 | | - protected static function prefixFilePathList( array $list, $prefix ) { |
342 | | - $prefixed = array(); |
343 | | - foreach ( $list as $key => $value ) { |
344 | | - if ( is_string( $key ) && is_array( $value ) ) { |
345 | | - // array( [path] => array( [options] ) ) |
346 | | - $prefixed[$prefix . $key] = $value; |
347 | | - } else if ( is_int( $key ) && is_string( $value ) ) { |
348 | | - // array( [path] ) |
349 | | - $prefixed[$key] = $prefix . $value; |
350 | | - } else { |
351 | | - throw new MWException( "Invalid file path list error. '$key' => '$value' given." ); |
352 | | - } |
353 | | - } |
354 | | - return $prefixed; |
| 344 | + protected function getLocalPath( $path ) { |
| 345 | + return "{$this->localBasePath}/$path"; |
355 | 346 | } |
| 347 | + |
| 348 | + protected function getRemotePath( $path ) { |
| 349 | + return "{$this->remoteBasePath}/$path"; |
| 350 | + } |
356 | 351 | |
357 | 352 | /** |
358 | 353 | * Collates file paths by option (where provided). |
— | — | @@ -403,11 +398,11 @@ |
404 | 399 | * @param {array} $scripts List of file paths to scripts to read, remap and concetenate |
405 | 400 | * @return {string} Concatenated and remapped JavaScript data from $scripts |
406 | 401 | */ |
407 | | - protected static function readScriptFiles( array $scripts ) { |
| 402 | + protected function readScriptFiles( array $scripts ) { |
408 | 403 | if ( empty( $scripts ) ) { |
409 | 404 | return ''; |
410 | 405 | } |
411 | | - return implode( "\n", array_map( array( __CLASS__, 'readScriptFile' ), array_unique( $scripts ) ) ); |
| 406 | + return implode( "\n", array_map( 'file_get_contents', array_map( array( $this, 'getLocalPath' ), array_unique( $scripts ) ) ) ); |
412 | 407 | } |
413 | 408 | |
414 | 409 | /** |
— | — | @@ -430,20 +425,6 @@ |
431 | 426 | } |
432 | 427 | |
433 | 428 | /** |
434 | | - * Reads a script file. |
435 | | - * |
436 | | - * This method can be used as a callback for array_map() |
437 | | - * |
438 | | - * @param {string} $path File path of script file to read |
439 | | - * @return {string} JavaScript data in script file |
440 | | - */ |
441 | | - protected static function readScriptFile( $path ) { |
442 | | - global $IP; |
443 | | - |
444 | | - return file_get_contents( "$IP/$path" ); |
445 | | - } |
446 | | - |
447 | | - /** |
448 | 429 | * Reads a style file. |
449 | 430 | * |
450 | 431 | * This method can be used as a callback for array_map() |
— | — | @@ -452,28 +433,15 @@ |
453 | 434 | * @return {string} CSS data in script file |
454 | 435 | */ |
455 | 436 | protected function readStyleFile( $path ) { |
456 | | - global $wgScriptPath, $IP; |
| 437 | + global $wgScriptPath; |
457 | 438 | |
458 | | - $style = file_get_contents( "$IP/$path" ); |
459 | | - $dir = dirname( "$IP/$path" ); |
| 439 | + $style = file_get_contents( $this->getLocalPath( $path ) ); |
| 440 | + $dir = $this->getLocalPath( dirname( $path ) ); |
| 441 | + $remoteDir = $this->getRemotePath( dirname( $path ) ); |
460 | 442 | // Get and register local file references |
461 | 443 | $this->localFileRefs = array_merge( $this->localFileRefs, CSSMin::getLocalFileReferences( $style, $dir ) ); |
462 | 444 | return CSSMin::remap( |
463 | | - $style, $dir, $wgScriptPath . '/' . dirname( $path ), true |
| 445 | + $style, $dir, $remoteDir, true |
464 | 446 | ); |
465 | 447 | } |
466 | | - |
467 | | - /** |
468 | | - * Resolves a file name. |
469 | | - * |
470 | | - * This method can be used as a callback for array_map() |
471 | | - * |
472 | | - * @param {string} $path File path to resolve |
473 | | - * @return {string} Absolute file path |
474 | | - */ |
475 | | - protected static function resolveFilePath( $path ) { |
476 | | - global $IP; |
477 | | - |
478 | | - return "$IP/$path"; |
479 | | - } |
480 | 448 | } |
Index: trunk/extensions/SemanticMediaWiki/SMW.hooks.php |
— | — | @@ -29,17 +29,18 @@ |
30 | 30 | |
31 | 31 | $modules = array( |
32 | 32 | 'ext.smw.style' => array( |
33 | | - 'styles' => ( $wgContLang->isRTL() ? 'SMW_custom_rtl.css' : 'SMW_custom.css' ) |
| 33 | + // FIXME: Won't work right, ResourceLoader does RTL flipping itself |
| 34 | + 'styles' => ( $wgContLang->isRTL() ? 'SMW_custom_rtl.css' : 'SMW_custom.css' ) |
34 | 35 | ), |
35 | 36 | 'ext.smw.tooltips' => array( |
36 | | - 'scripts' => 'SMW_tooltip.js', |
| 37 | + 'scripts' => 'SMW_tooltip.js', |
37 | 38 | 'dependencies' => array( |
38 | 39 | 'mediawiki.legacy.wikibits', |
39 | 40 | 'ext.smw.style' |
40 | 41 | ) |
41 | 42 | ), |
42 | 43 | 'ext.smw.sorttable' => array( |
43 | | - 'scripts' => dirname( __FILE__ ) . 'SMW_sorttable.js', |
| 44 | + 'scripts' => 'SMW_sorttable.js', |
44 | 45 | 'dependencies' => 'ext.smw.style' |
45 | 46 | ) |
46 | 47 | ); |
— | — | @@ -49,7 +50,7 @@ |
50 | 51 | $name, |
51 | 52 | new ResourceLoaderFileModule( |
52 | 53 | array_merge_recursive( $resources, array( 'group' => 'ext.smw' ) ), |
53 | | - 'extensions/SemanticMediaWiki/skins/' |
| 54 | + dirname( __FILE__ ) . '/skins', $smwgScriptPath . '/skins' |
54 | 55 | ) |
55 | 56 | ); |
56 | 57 | } |
Index: trunk/extensions/WikiEditor/WikiEditor.hooks.php |
— | — | @@ -694,9 +694,12 @@ |
695 | 695 | * Adds modules to ResourceLoader |
696 | 696 | */ |
697 | 697 | public static function resourceLoaderRegisterModules( &$resourceLoader ) { |
| 698 | + global $wgExtensionAssetsPath; |
| 699 | + $localpath = dirname( __FILE__ ) . '/modules'; |
| 700 | + $remotepath = "$wgExtensionAssetsPath/WikiEditor/modules"; |
698 | 701 | foreach ( self::$modules as $name => $resources ) { |
699 | 702 | $resourceLoader->register( |
700 | | - $name, new ResourceLoaderFileModule( $resources, 'extensions/WikiEditor/modules/' ) |
| 703 | + $name, new ResourceLoaderFileModule( $resources, $localpath, $remotepath ) |
701 | 704 | ); |
702 | 705 | } |
703 | 706 | return true; |
Index: trunk/extensions/WikiEditor/modules/ext.wikiEditor.toolbar.js |
— | — | @@ -9,6 +9,8 @@ |
10 | 10 | // The old toolbar is still in place and needs to be removed so there aren't two toolbars |
11 | 11 | $( '#toolbar' ).remove(); |
12 | 12 | // Add toolbar module |
| 13 | + // FIXME: Make config object retrievable for reusers |
| 14 | + // TODO: Implement .wikiEditor( 'remove' ) |
13 | 15 | $( '#wpTextbox1' ).wikiEditor( 'addModule', { 'toolbar': { |
14 | 16 | // Main section |
15 | 17 | 'main': { |
Index: trunk/extensions/Maps/Maps.hooks.php |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | * @return true |
71 | 71 | */ |
72 | 72 | public static function registerResourceLoaderModules( ResourceLoader &$resourceLoader ) { |
73 | | - global $smwgScriptPath, $wgContLang; |
| 73 | + global $wgExtensionAssetsPath; |
74 | 74 | |
75 | 75 | $modules = array( |
76 | 76 | ); |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | foreach ( $modules as $name => $resources ) { |
79 | 79 | $resourceLoader->register( $name, new ResourceLoaderFileModule( |
80 | 80 | array_merge_recursive( $resources, array( 'group' => 'ext.maps' ) ) |
81 | | - ) ); |
| 81 | + ), dirname( __FILE__ ), "$wgExtensionAssetsPath/Maps" ); |
82 | 82 | } |
83 | 83 | |
84 | 84 | return true; |
Index: trunk/extensions/Vector/Vector.hooks.php |
— | — | @@ -215,9 +215,12 @@ |
216 | 216 | * Adds modules to ResourceLoader |
217 | 217 | */ |
218 | 218 | public static function resourceLoaderRegisterModules( &$resourceLoader ) { |
| 219 | + global $wgExtensionAssetsPath; |
| 220 | + $localpath = dirname( __FILE__ ) . '/modules'; |
| 221 | + $remotepath = "$wgExtensionAssetsPath/Vector/modules"; |
219 | 222 | foreach ( self::$modules as $name => $resources ) { |
220 | 223 | $resourceLoader->register( |
221 | | - $name, new ResourceLoaderFileModule( $resources, 'extensions/Vector/modules/' ) |
| 224 | + $name, new ResourceLoaderFileModule( $resources, $localpath, $remotepath ) |
222 | 225 | ); |
223 | 226 | } |
224 | 227 | return true; |
Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php |
— | — | @@ -83,11 +83,14 @@ |
84 | 84 | } |
85 | 85 | |
86 | 86 | public static function resourceLoaderRegisterModules( &$resourceLoader ) { |
| 87 | + global $wgExtensionAssetsPath; |
| 88 | + $localpath = dirname( __FILE__ ); |
| 89 | + $remotepath = "$wgExtensionAssetsPath/ProofreadPage"; |
87 | 90 | $resourceLoader->register( |
88 | 91 | 'ext.proofreadpage.page', |
89 | 92 | new ResourceLoaderFileModule( |
90 | 93 | array( |
91 | | - 'scripts' => 'extensions/ProofreadPage/proofread.js', |
| 94 | + 'scripts' => 'proofread.js', |
92 | 95 | 'messages' => array( |
93 | 96 | 'proofreadpage_header', |
94 | 97 | 'proofreadpage_body', |
— | — | @@ -100,7 +103,7 @@ |
101 | 104 | 'proofreadpage_quality3_category', |
102 | 105 | 'proofreadpage_quality4_category', |
103 | 106 | ) |
104 | | - ) |
| 107 | + ), $basepath, $remotepath |
105 | 108 | ) |
106 | 109 | ); |
107 | 110 | |
— | — | @@ -108,14 +111,17 @@ |
109 | 112 | 'ext.proofreadpage.article', |
110 | 113 | new ResourceLoaderFileModule( |
111 | 114 | array( |
112 | | - 'scripts' => 'extensions/ProofreadPage/proofread_article.js' |
113 | | - ) |
| 115 | + 'scripts' => 'proofread_article.js' |
| 116 | + ), $basepath, $remotepath |
114 | 117 | ) |
115 | 118 | ); |
116 | 119 | |
117 | 120 | $resourceLoader->register( |
118 | 121 | 'ext.proofreadpage.index', |
119 | | - new ResourceLoaderFileModule( array( 'scripts' => 'extensions/ProofreadPage/proofread_index.js' ) ) |
| 122 | + new ResourceLoaderFileModule( |
| 123 | + array( 'scripts' => 'proofread_index.js' ), |
| 124 | + $basepath, $remotepath |
| 125 | + ) |
120 | 126 | ); |
121 | 127 | |
122 | 128 | return true; |
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php |
— | — | @@ -106,46 +106,39 @@ |
107 | 107 | * and CSS |
108 | 108 | */ |
109 | 109 | static function registerModules( $resourceLoader ) { |
110 | | - global $sfgPartialPath, $smwgScriptPath; |
| 110 | + global $wgExtensionAssetsPath; |
| 111 | + $localpath = dirname( dirname( __FILE__ ) ); |
| 112 | + $remotepath = "$wgExtensionAssetsPath/SemanticForms"; |
111 | 113 | |
112 | 114 | $resourceLoader->register( |
113 | 115 | array( |
114 | | - 'semanticforms.main' => |
115 | | - new ResourceLoaderFileModule( |
| 116 | + 'semanticforms.main' => new ResourceLoaderFileModule( |
116 | 117 | array( |
117 | | - 'scripts' => |
118 | | - "$sfgPartialPath/libs/SemanticForms.js", |
119 | | - 'styles' => |
120 | | - array( |
121 | | - "$sfgPartialPath/skins/SemanticForms.css", |
122 | | - "$sfgPartialPath/skins/SF_jquery_ui_overrides.css", |
| 118 | + 'scripts' => 'libs/SemanticForms.js', |
| 119 | + 'styles' => array( |
| 120 | + 'skins/SemanticForms.css', |
| 121 | + 'skins/SF_jquery_ui_overrides.css', |
123 | 122 | ), |
124 | | - ) |
| 123 | + ), $localpath, $remotepath |
125 | 124 | ), |
126 | | - 'semanticforms.fancybox' => |
127 | | - new ResourceLoaderFileModule( |
| 125 | + 'semanticforms.fancybox' => new ResourceLoaderFileModule( |
128 | 126 | array( |
129 | | - 'scripts' => |
130 | | - "$sfgPartialPath/libs/jquery.fancybox-1.3.1.js", |
131 | | - 'styles' => |
132 | | - "$sfgPartialPath/skins/jquery.fancybox-1.3.1.css", |
133 | | - ) |
| 127 | + 'scripts' => 'libs/jquery.fancybox-1.3.1.js', |
| 128 | + 'styles' => 'skins/jquery.fancybox-1.3.1.css', |
| 129 | + ), $localpath, $remotepath |
134 | 130 | ), |
135 | | - 'semanticforms.autogrow' => |
136 | | - new ResourceLoaderFileModule( |
| 131 | + 'semanticforms.autogrow' => new ResourceLoaderFileModule( |
137 | 132 | array( |
138 | | - 'scripts' => |
139 | | - "$sfgPartialPath/libs/SF_autogrow.js", |
140 | | - ) |
| 133 | + 'scripts' => 'libs/SF_autogrow.js', |
| 134 | + ), $localpath, $remotepath |
141 | 135 | ), |
142 | | - 'semanticforms.smw_utilities' => |
143 | | - new ResourceLoaderFileModule( |
| 136 | + 'semanticforms.smw_utilities' => new ResourceLoaderFileModule( |
144 | 137 | array( |
145 | | - 'scripts' => |
146 | | - // no $smwgPartialPath variable exists yet |
147 | | - "/extensions/SemanticMediaWiki/skins/SMW_tooltip.js", |
148 | | - "/extension/SemanticMediaWiki/skins/SMW_sorttable.js", |
149 | | - ) |
| 138 | + 'scripts' => array( |
| 139 | + 'skins/SMW_tooltip.js', |
| 140 | + 'skins/SMW_sorttable.js', |
| 141 | + ) |
| 142 | + ), $localpath, $remotepath |
150 | 143 | ), |
151 | 144 | ) |
152 | 145 | ); |
Index: trunk/extensions/ArticleEmblems/ArticleEmblems.hooks.php |
— | — | @@ -89,11 +89,12 @@ |
90 | 90 | * ResourceLoaderRegisterModules hook |
91 | 91 | */ |
92 | 92 | public static function resourceLoaderRegisterModules( &$resourceLoader ) { |
| 93 | + global $wgExtensionAssetsPath; |
93 | 94 | $resourceLoader->register( |
94 | 95 | 'ext.articleEmblems', |
95 | 96 | new ResourceLoaderFileModule( array( |
96 | | - 'styles' => 'extensions/ArticleEmblems/modules/ext.articleEmblems.css', |
97 | | - ) ) |
| 97 | + 'styles' => 'ext.articleEmblems.css', |
| 98 | + ), dirname( __FILE__ ) . '/modules', "$wgExtensionAssetsPath/ArticleEmblems/modules" ) |
98 | 99 | ); |
99 | 100 | return true; |
100 | 101 | } |
Index: trunk/extensions/ClickTracking/ClickTracking.hooks.php |
— | — | @@ -83,21 +83,24 @@ |
84 | 84 | * @return Boolean: always true |
85 | 85 | */ |
86 | 86 | public static function resourceLoaderRegisterModules( &$resourceLoader ) { |
| 87 | + global $wgExtensionAssetsPath; |
| 88 | + $localpath = dirname( __FILE__ ) . '/modules'; |
| 89 | + $remotepath = "$wgExtensionAssetsPath/extensions/ClickTracking/modules"; |
87 | 90 | $resourceLoader->register( array( |
88 | 91 | 'jquery.clickTracking' => new ResourceLoaderFileModule( array( |
89 | | - 'scripts' => 'extensions/ClickTracking/modules/jquery.clickTracking.js', |
| 92 | + 'scripts' => 'jquery.clickTracking.js', |
90 | 93 | 'dependencies' => 'jquery.cookie', |
91 | 94 | ) ), |
92 | 95 | 'ext.clickTracking' => new ResourceLoaderFileModule( array( |
93 | | - 'scripts' => 'extensions/ClickTracking/modules/ext.clickTracking.js', |
| 96 | + 'scripts' => 'ext.clickTracking.js', |
94 | 97 | 'dependencies' => 'jquery.clickTracking', |
95 | 98 | ) ), |
96 | 99 | 'ext.clickTracking.special' => new ResourceLoaderFileModule( array( |
97 | | - 'scripts' => 'extensions/ClickTracking/modules/ext.clickTracking.special.js', |
98 | | - 'styles' => 'extensions/ClickTracking/modules/ext.clickTracking.special.css', |
| 100 | + 'scripts' => 'ext.clickTracking.special.js', |
| 101 | + 'styles' => 'ext.clickTracking.special.css', |
99 | 102 | 'dependencies' => array( 'jquery.ui.datepicker', 'jquery.ui.dialog' ), |
100 | 103 | ) ), |
101 | | - ) ); |
| 104 | + ), $localpath, $remotepath ); |
102 | 105 | return true; |
103 | 106 | } |
104 | 107 | |
Index: trunk/extensions/PrefSwitch/PrefSwitch.hooks.php |
— | — | @@ -12,8 +12,8 @@ |
13 | 13 | |
14 | 14 | protected static $modules = array( |
15 | 15 | 'ext.prefSwitch' => array( |
16 | | - 'scripts' => 'extensions/PrefSwitch/modules/ext.prefSwitch.js', |
17 | | - 'styles' => 'extensions/PrefSwitch/modules/ext.prefSwitch.css', |
| 16 | + 'scripts' => 'ext.prefSwitch.js', |
| 17 | + 'styles' => 'ext.prefSwitch.css', |
18 | 18 | 'dependencies' => 'jquery.client', |
19 | 19 | ), |
20 | 20 | ); |
— | — | @@ -84,8 +84,11 @@ |
85 | 85 | * ResourceLoaderRegisterModules hook |
86 | 86 | */ |
87 | 87 | public static function resourceLoaderRegisterModules( &$resourceLoader ) { |
| 88 | + global $wgExtensionAssetsPath; |
| 89 | + $localpath = dirname( __FILE__ ) . '/modules'; |
| 90 | + $remotepath = "$wgExtensionAssetsPath/PrefSwitch/moduless"; |
88 | 91 | foreach ( self::$modules as $name => $resources ) { |
89 | | - $resourceLoader->register( $name, new ResourceLoaderFileModule( $resources ) ); |
| 92 | + $resourceLoader->register( $name, new ResourceLoaderFileModule( $resources, $localpath, $remotepath ) ); |
90 | 93 | } |
91 | 94 | return true; |
92 | 95 | } |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -420,9 +420,10 @@ |
421 | 421 | |
422 | 422 | # Startup code |
423 | 423 | function efTranslateResources( &$resourceLoader ) { |
| 424 | + global $wgExtensionAssetsPath; |
424 | 425 | $resourceLoader->register( array( 'translate-css' => |
425 | | - new ResourceLoaderFileModule( array( 'styles' => 'extensions/Translate/Translate.css' ) ) |
426 | | - ) ); |
| 426 | + new ResourceLoaderFileModule( array( 'styles' => 'Translate.css' ) ) |
| 427 | + ), dirname( __FILE__ ), "$wgExtensionAssetsPath/Translate" ); |
427 | 428 | return true; |
428 | 429 | } |
429 | 430 | |