Index: trunk/phase3/includes/ResourceLoaderModule.php |
— | — | @@ -739,6 +739,9 @@ |
740 | 740 | |
741 | 741 | /** |
742 | 742 | * Abstraction for resource loader modules which pull from wiki pages |
| 743 | + * |
| 744 | + * This can only be used for wiki pages in the MediaWiki and User namespaces, because of it's dependence on the |
| 745 | + * functionality of Title::isValidCssJsSubpage. |
743 | 746 | */ |
744 | 747 | abstract class ResourceLoaderWikiModule extends ResourceLoaderModule { |
745 | 748 | |
— | — | @@ -768,13 +771,11 @@ |
769 | 772 | /* Methods */ |
770 | 773 | |
771 | 774 | public function getScript( ResourceLoaderContext $context ) { |
772 | | - global $wgCanonicalNamespaceNames; |
773 | | - |
774 | 775 | $scripts = ''; |
775 | 776 | foreach ( $this->getPages( $context ) as $page => $options ) { |
776 | 777 | if ( $options['type'] === 'script' ) { |
777 | 778 | if ( $script = $this->getContent( $page, $options['ns'] ) ) { |
778 | | - $ns = $wgCanonicalNamespaceNames[$options['ns']]; |
| 779 | + $ns = MWNamespace::getCanonicalName( $options['ns'] ); |
779 | 780 | $scripts .= "/*$ns:$page */\n$script\n"; |
780 | 781 | } |
781 | 782 | } |
— | — | @@ -783,7 +784,6 @@ |
784 | 785 | } |
785 | 786 | |
786 | 787 | public function getStyles( ResourceLoaderContext $context ) { |
787 | | - global $wgCanonicalNamespaceNames; |
788 | 788 | |
789 | 789 | $styles = array(); |
790 | 790 | foreach ( $this->getPages( $context ) as $page => $options ) { |
— | — | @@ -793,7 +793,7 @@ |
794 | 794 | if ( !isset( $styles[$media] ) ) { |
795 | 795 | $styles[$media] = ''; |
796 | 796 | } |
797 | | - $ns = $wgCanonicalNamespaceNames[$options['ns']]; |
| 797 | + $ns = MWNamespace::getCanonicalName( $options['ns'] ); |
798 | 798 | $styles[$media] .= "/* $ns:$page */\n$style\n"; |
799 | 799 | } |
800 | 800 | } |