From 77b6d75e21cbc4c04073792e71bffdd9326ec387 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 18 Nov 2009 21:06:54 +0000 Subject: [PATCH] Make adding sidebar elements easier for extensions (e.g. Extension:GroupsSidebar) --- includes/Skin.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index 17da161abe..2002613715 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -2044,7 +2044,22 @@ END; } $bar = array(); - $lines = explode( "\n", wfMsgForContent( 'sidebar' ) ); + $this->addToSidebar( &$bar, 'sidebar' ); + + wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) ); + if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry ); + wfProfileOut( __METHOD__ ); + return $bar; + } + /** + * Add content from a sidebar system message + * Currently only used for MediaWiki:Sidebar (but may be used by Extensions) + * + * @param &$bar array + * @param $message String + */ + function addToSidebar( &$bar, $message ) { + $lines = explode( "\n", wfMsgForContent( $message ) ); $heading = ''; foreach( $lines as $line ) { if( strpos( $line, '*' ) !== 0 ) @@ -2086,10 +2101,6 @@ END; } else { continue; } } } - wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) ); - if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry ); - wfProfileOut( __METHOD__ ); - return $bar; } /** -- 2.20.1