r52885 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52884‎ | r52885 | r52886 >
Date:04:38, 8 July 2009
Author:simetrical
Status:ok
Tags:
Comment:
Fix weird calling convention for Skin::makeGlobalVariablesScript
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -352,12 +352,15 @@
353353
354354 /**
355355 * Make a <script> tag containing global variables
356 - * @param array $data Associative array containing one element:
357 - * skinname => the skin name
 356+ * @param $skinName string Name of the skin
358357 * The odd calling convention is for backwards compatibility
359358 * @TODO @FIXME Make this not depend on $wgTitle!
360359 */
361 - static function makeGlobalVariablesScript( $data ) {
 360+ static function makeGlobalVariablesScript( $skinName ) {
 361+ if ( is_array( $skinName ) ) {
 362+ # Weird back-compat stuff.
 363+ $skinName = $skinName['skinname'];
 364+ }
362365 global $wgScript, $wgTitle, $wgStylePath, $wgUser;
363366 global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang, $wgVariant;
364367 global $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
@@ -383,7 +386,7 @@
384387 );
385388
386389 $vars = array(
387 - 'skin' => $data['skinname'],
 390+ 'skin' => $skinName,
388391 'stylepath' => $wgStylePath,
389392 'wgArticlePath' => $wgArticlePath,
390393 'wgScriptPath' => $wgScriptPath,
@@ -469,7 +472,7 @@
470473 function getHeadScripts( $allowUserJs, $extraHtml = '' ) {
471474 global $wgStylePath, $wgUser, $wgJsMimeType, $wgStyleVersion;
472475
473 - $vars = self::makeGlobalVariablesScript( array( 'skinname' => $this->getSkinName() ) );
 476+ $vars = self::makeGlobalVariablesScript( $this->getSkinName() );
474477
475478 $r = array( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>\n$extraHtml" );
476479 global $wgUseSiteJs;

Status & tagging log