From c22b8425c00bdc0b477a52675afdc455a8342723 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 28 Jun 2005 14:18:08 +0000 Subject: [PATCH] unbroke classic and cologne blue skins --- includes/Skin.php | 37 +++++++++++++++++++++++++++++++++++++ includes/SkinTemplate.php | 38 +------------------------------------- skins/CologneBlue.php | 11 +++++++++++ skins/Standard.php | 11 +++++++++++ 4 files changed, 60 insertions(+), 37 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index bdd40ca2c9..5c266af64c 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1286,6 +1286,43 @@ END; } } + /** + * Build an array that represents the sidebar(s), the navigation bar among them + * + * @return array + * @access private + */ + function buildSidebar() { + $fname = 'SkinTemplate::buildSidebar'; + wfProfileIn( $fname ); + + $bar = array(); + $lines = explode( "\n", wfMsgForContent( 'sidebar' ) ); + foreach ($lines as $line) { + if (strpos($line, '*') !== 0) + continue; + if (strpos($line, '**') !== 0) { + $line = trim($line, '* '); + $heading = $line; + } else { + if (strpos($line, '|') !== false) { // sanity check + $line = explode( '|' , trim($line, '* '), 2 ); + $link = wfMsgForContent( $line[0] ); + if( $link == '-' ) { + continue; + } + $bar[$heading][] = array( + 'text' => wfMsg( $line[1] ), + 'href' => $this->makeInternalOrExternalUrl( $link ), + 'id' => 'n-' . $line[1], + ); + } else { continue; } + } + } + + wfProfileOut( $fname ); + return $bar; + } } } diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index e41b2b6b08..9ee175e9a0 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -719,43 +719,7 @@ class SkinTemplate extends Skin { return $content_actions; } - /** - * Build an array that represents the sidebar(s), the navigation bar among them - * - * @return array - * @access private - */ - function buildSidebar() { - $fname = 'SkinTemplate::buildSidebar'; - wfProfileIn( $fname ); - - $bar = array(); - $lines = explode( "\n", wfMsgForContent( 'sidebar' ) ); - foreach ($lines as $line) { - if (strpos($line, '*') !== 0) - continue; - if (strpos($line, '**') !== 0) { - $line = trim($line, '* '); - $heading = $line; - } else { - if (strpos($line, '|') !== false) { // sanity check - $line = explode( '|' , trim($line, '* '), 2 ); - $link = wfMsgForContent( $line[0] ); - if( $link == '-' ) { - continue; - } - $bar[$heading][] = array( - 'text' => wfMsg( $line[1] ), - 'href' => $this->makeInternalOrExternalUrl( $link ), - 'id' => 'n-' . $line[1], - ); - } else { continue; } - } - } - - wfProfileOut( $fname ); - return $bar; - } + /** * build array of common navigation links diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index d1ef0946a0..6cc1d3d815 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -183,6 +183,17 @@ class SkinCologneBlue extends Skin { $s .= $this->menuHead( "qbbrowse" ); + # Use the first heading from the Monobook sidebar as the "browse" section + $bar = $this->buildSidebar(); + $browseLinks = reset( $bar ); + + foreach ( $browseLinks as $link ) { + if ( $link['text'] != '-' ) { + $s .= "" . + htmlspecialchars( $link['text'] ) . '' . $sep; + } + } + if ( $wgOut->isArticle() ) { $s .= $this->menuHead( "qbedit" ); $s .= "" . $this->editThisPage() . ""; diff --git a/skins/Standard.php b/skins/Standard.php index 6ef32d9ed8..257f65de1d 100644 --- a/skins/Standard.php +++ b/skins/Standard.php @@ -145,6 +145,17 @@ class SkinStandard extends Skin { $s .= "\n" . $this->logoText() . "\n
"; $sep = "\n
"; + + # Use the first heading from the Monobook sidebar as the "browse" section + $bar = $this->buildSidebar(); + $browseLinks = reset( $bar ); + + foreach ( $browseLinks as $link ) { + if ( $link['text'] != '-' ) { + $s .= "" . + htmlspecialchars( $link['text'] ) . '' . $sep; + } + } if( $wgUser->isLoggedIn() ) { $s.= $this->specialLink( 'watchlist' ) ; -- 2.20.1