Page MenuHomePhabricator

skinnamespace.diff

Authored By
bzimport
Nov 21 2014, 8:57 PM
Size
2 KB
Referenced Files
None
Subscribers
None

skinnamespace.diff

Index: includes/Skin.php
===================================================================
--- includes/Skin.php (revision 16100)
+++ includes/Skin.php (working copy)
@@ -472,8 +472,13 @@
* URL to the logo
*/
function getLogo() {
- global $wgLogo;
- return $wgLogo;
+ global $wgNamespaceLogos, $wgTitle;
+ if(is_array($wgNamespaceLogos) && isset($wgNamespaceLogos[$wgTitle->getNamespace()])) {
+ return $wgNamespaceLogos[$wgTitle->getNamespace()];
+ } else {
+ global $wgLogo;
+ return $wgLogo;
+ }
}
/**
@@ -1507,14 +1512,20 @@
* @private
*/
function buildSidebar() {
- global $wgDBname, $parserMemc, $wgEnableSidebarCache;
+ global $wgDBname, $parserMemc, $wgEnableSidebarCache, $wgEnableNamespaceSidebars;
global $wgLang, $wgContLang;
$fname = 'SkinTemplate::buildSidebar';
wfProfileIn( $fname );
- $key = "{$wgDBname}:sidebar";
+ $msgName = 'sidebar';
+ if($wgEnableNamespaceSidebars) {
+ global $wgTitle;
+ $msgName .= $wgTitle->getNamespace();
+ }
+
+ $key = "{$wgDBname}:{$msgName}";
$cacheSidebar = $wgEnableSidebarCache &&
($wgLang->getCode() == $wgContLang->getCode());
@@ -1527,7 +1538,11 @@
}
$bar = array();
- $lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
+ $msg = wfMsgForContent( $msgName );
+ if($wgEnableNamespaceSidebars && wfEmptyMsg($msgName, $msg)) { // fallback
+ $msg = wfMsgForContent( 'sidebar' );
+ }
+ $lines = explode( "\n", $msg );
foreach ($lines as $line) {
if (strpos($line, '*') !== 0)
continue;
Index: includes/SkinTemplate.php
===================================================================
--- includes/SkinTemplate.php (revision 16100)
+++ includes/SkinTemplate.php (working copy)
@@ -134,7 +134,7 @@
global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut;
global $wgScript, $wgStylePath, $wgContLanguageCode;
global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
- global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgHideInterlanguageLinks;
+ global $wgDisableCounters, $action, $wgFeedClasses, $wgHideInterlanguageLinks;
global $wgMaxCredits, $wgShowCreditsIfMax;
global $wgPageShowWatchingUsers;
global $wgUseTrackbacks;
@@ -256,7 +256,7 @@
$tpl->setRef( 'articlepath', $wgArticlePath );
$tpl->setRef( 'scriptpath', $wgScriptPath );
$tpl->setRef( 'serverurl', $wgServer );
- $tpl->setRef( 'logopath', $wgLogo );
+ $tpl->setRef( 'logopath', $this->getLogo() );
$tpl->setRef( "lang", $wgContLanguageCode );
$tpl->set( 'dir', $wgContLang->isRTL() ? "rtl" : "ltr" );
$tpl->set( 'rtl', $wgContLang->isRTL() );

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2057
Default Alt Text
skinnamespace.diff (2 KB)

Event Timeline