From fa214f77d902c558bc3ad4ecebfddac359ca1007 Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Sat, 28 Jan 2006 17:36:08 +0000 Subject: [PATCH] Namespace notice (fix for bug 4469) is back: Namespace-specific notice to be displayed below site-notice. Edit messages like "MediaWiki:Namespacenotice-" plus namespace name, which is blank for main namespace, or like e.g. "User_talk". --- RELEASE-NOTES | 4 +++- includes/GlobalFunctions.php | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index da8050d33d..d1b36842c5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -578,7 +578,9 @@ fully support the editing toolbar, but was found to be too confusing. * Use revision rate for ETA in dump generation; it tends to be more stable than the per-page count for full-history dumps. * Include timestamp in wfDebugLog breakouts - +* (bug 4469) Namespace-specific notice to be displayed below site-notice + Edit messages like "MediaWiki:Namespacenotice-" plus namespace name + which is blank for main namespace, or like e.g. "User_talk" === Caveats === diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index d7901d90c1..fc5dd5c627 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1390,6 +1390,28 @@ function wfGetCachedNotice( $name ) { return $notice; } +function wfGetNamespaceNotice() { + global $wgTitle; + + # Paranoia + if ( !isset( $wgTitle ) || !is_object( $wgTitle ) ) + return ""; + + $fname = 'wfGetNamespaceNotice'; + wfProfileIn( $fname ); + + $key = "namespacenotice-" . $wgTitle->getNsText(); + $namespaceNotice = wfGetCachedNotice( $key ); + if ( $namespaceNotice && substr ( $namespaceNotice , 0 ,7 ) != "

<" ) { + $namespaceNotice = '

' . $namespaceNotice . "
"; + } else { + $namespaceNotice = ""; + } + + wfProfileOut( $fname ); + return $namespaceNotice; +} + function wfGetSiteNotice() { global $wgUser, $wgSiteNotice; $fname = 'wfGetSiteNotice'; @@ -1407,6 +1429,7 @@ function wfGetSiteNotice() { $siteNotice = $anonNotice; } } + $siteNotice .= wfGetNamespaceNotice(); wfProfileOut( $fname ); return( $siteNotice ); -- 2.20.1