From: Brion Vibber Date: Tue, 4 Aug 2009 19:17:31 +0000 (+0000) Subject: * wgMainPageTitle variable now available to JavaScript code to identify the main... X-Git-Tag: 1.31.0-rc.0~40506 X-Git-Url: http://git.cyclocoop.org/data/%24oldEdit?a=commitdiff_plain;h=cf75bdf4ba;p=lhc%2Fweb%2Fwiklou.git * wgMainPageTitle variable now available to JavaScript code to identify the main page link, so it doesn't have to be extracted from the link URLs. Can be used to link to the main page, or check if we're currently on the main page, without having to hardcode the local name (which may be customized in the message) --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cfff529a67..ff6fa7fb92 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -185,6 +185,8 @@ this. Was used when mwEmbed was going to be an extension. flags have tooltips. * (bug 15209) New hook BeforeInitialize called after everything has been setup but before Mediawiki::performRequestForTitle() +* wgMainPageTitle variable now available to JavaScript code to identify the main + page link, so it doesn't have to be extracted from the link URLs. === Bug fixes in 1.16 === diff --git a/includes/Skin.php b/includes/Skin.php index 6a614b0d16..0df32f0cab 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -379,6 +379,7 @@ class Skin extends Linker { implode( "\t", $digitTransTable ), ); + $mainPage = Title::newFromText( wfMsgForContent( 'mainpage' ) ); $vars = array( 'skin' => $skinName, 'stylepath' => $wgStylePath, @@ -408,6 +409,7 @@ class Skin extends Linker { 'wgEnableWriteAPI' => $wgEnableWriteAPI, 'wgSeparatorTransformTable' => $compactSeparatorTransTable, 'wgDigitTransformTable' => $compactDigitTransTable, + 'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null, ); if ( !( $wgContLang->hasVariants() ) ) { unset( $vars['wgUserVariant'] );