From cf75bdf4ba7947d1503f53fd32bd4c9c79c89316 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 4 Aug 2009 19:17:31 +0000 Subject: [PATCH] * 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) --- RELEASE-NOTES | 2 ++ includes/Skin.php | 2 ++ 2 files changed, 4 insertions(+) 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'] ); -- 2.20.1