Index: trunk/phase3/includes/ResourceLoaderModule.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | */ |
23 | 23 | |
24 | 24 | /** |
25 | | - * Interface for resource loader modules, with name registration and maxage functionality. |
| 25 | + * Abstraction for resource loader modules, with name registration and maxage functionality. |
26 | 26 | */ |
27 | 27 | abstract class ResourceLoaderModule { |
28 | 28 | /* Protected Members */ |
— | — | @@ -674,6 +674,9 @@ |
675 | 675 | } |
676 | 676 | } |
677 | 677 | |
| 678 | +/** |
| 679 | + * Abstraction for resource loader modules which pull from wiki pages |
| 680 | + */ |
678 | 681 | abstract class ResourceLoaderWikiModule extends ResourceLoaderModule { |
679 | 682 | |
680 | 683 | /* Protected Members */ |
— | — | @@ -685,6 +688,23 @@ |
686 | 689 | |
687 | 690 | abstract protected function getPages( ResourceLoaderContext $context ); |
688 | 691 | |
| 692 | + /* Protected Methods */ |
| 693 | + |
| 694 | + protected function getStyleCode( array $styles ) { |
| 695 | + foreach ( $styles as $media => $messages ) { |
| 696 | + foreach ( $messages as $i => $message ) { |
| 697 | + $style = wfMsgExt( $message, 'content' ); |
| 698 | + if ( !wfEmptyMsg( $message, $style ) ) { |
| 699 | + $styles[$media][$i] = $style; |
| 700 | + } |
| 701 | + } |
| 702 | + } |
| 703 | + foreach ( $styles as $media => $messages ) { |
| 704 | + $styles[$media] = implode( "\n", $messages ); |
| 705 | + } |
| 706 | + return $styles; |
| 707 | + } |
| 708 | + |
689 | 709 | /* Methods */ |
690 | 710 | |
691 | 711 | public function getModifiedTime( ResourceLoaderContext $context ) { |
— | — | @@ -713,7 +733,7 @@ |
714 | 734 | } |
715 | 735 | |
716 | 736 | /** |
717 | | - * Custom module for MediaWiki:Common.js and MediaWiki:Skinname.js |
| 737 | + * Custom module for site customizations |
718 | 738 | */ |
719 | 739 | class ResourceLoaderSiteModule extends ResourceLoaderWikiModule { |
720 | 740 | |
— | — | @@ -752,18 +772,7 @@ |
753 | 773 | if ( $wgHandheldStyle ) { |
754 | 774 | $sources['handheld'] = array( 'Handheld.css' ); |
755 | 775 | } |
756 | | - foreach ( $styles as $media => $messages ) { |
757 | | - foreach ( $messages as $i => $message ) { |
758 | | - $style = wfMsgExt( $message, 'content' ); |
759 | | - if ( !wfEmptyMsg( $message, $style ) ) { |
760 | | - $styles[$media][$i] = $style; |
761 | | - } |
762 | | - } |
763 | | - } |
764 | | - foreach ( $styles as $media => $messages ) { |
765 | | - $styles[$media] = implode( "\n", $messages ); |
766 | | - } |
767 | | - return $styles; |
| 776 | + return $this->getStyleCode( $styles ); |
768 | 777 | } |
769 | 778 | } |
770 | 779 | |