r75622 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75621‎ | r75622 | r75623 >
Date:19:40, 28 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Keep support for non-resource modules
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Outputs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Outputs.php
@@ -29,6 +29,9 @@
3030
3131 /// Protected member function for temporarily storing header items.
3232 protected static $mHeadItems = array();
 33+
 34+ /// Protected member function for temporarily storing resource modules.
 35+ protected static $resourceModules = array();
3336
3437 /**
3538 * Adds rousource loader modules or other head items.
@@ -50,13 +53,13 @@
5154
5255 switch ( $id ) {
5356 case SMW_HEADER_TOOLTIP:
54 - self::$mHeadItems['smw_tt'] = 'ext.smw.tooltips';
 57+ self::$resourceModules['smw_tt'] = 'ext.smw.tooltips';
5558 break;
5659 case SMW_HEADER_SORTTABLE:
57 - self::$mHeadItems['smw_st'] = 'ext.smw.sorttable';
 60+ self::$resourceModules['smw_st'] = 'ext.smw.sorttable';
5861 break;
5962 case SMW_HEADER_STYLE:
60 - self::$mHeadItems['smw_css'] = 'ext.smw.style';
 63+ self::$resourceModules['smw_css'] = 'ext.smw.style';
6164 break;
6265 }
6366 }
@@ -166,16 +169,16 @@
167170 * @param ParserOutput $parserOutput
168171 */
169172 static public function commitToParserOutput( ParserOutput $parserOutput ) {
 173+ foreach ( self::$mHeadItems as $key => $item ) {
 174+ $parserOutput->addHeadItem( "\t\t" . $item . "\n", $key );
 175+ }
 176+
170177 // Check if the resource loader can be used or not.
171178 if ( method_exists( 'OutputPage', 'addModules' ) ) {
172 - $parserOutput->addModules( array_values( self::$mHeadItems ) );
 179+ $parserOutput->addModules( self::$resourceModules );
173180 }
174 - else {
175 - foreach ( self::$mHeadItems as $key => $item ) {
176 - $parserOutput->addHeadItem( "\t\t" . $item . "\n", $key );
177 - }
178 - }
179181
 182+ self::$resourceModules = array();
180183 self::$mHeadItems = array();
181184 }
182185

Status & tagging log