From: Tobias Date: Wed, 18 Nov 2009 21:06:54 +0000 (+0000) Subject: Make adding sidebar elements easier for extensions (e.g. Extension:GroupsSidebar) X-Git-Tag: 1.31.0-rc.0~38762 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=77b6d75e21cbc4c04073792e71bffdd9326ec387;p=lhc%2Fweb%2Fwiklou.git Make adding sidebar elements easier for extensions (e.g. Extension:GroupsSidebar) --- 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; } /**