}
}
+ /**
+ * 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;
+ }
}
}
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
$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 .= "<a href=\"{$link['href']}\">" .
+ htmlspecialchars( $link['text'] ) . '</a>' . $sep;
+ }
+ }
+
if ( $wgOut->isArticle() ) {
$s .= $this->menuHead( "qbedit" );
$s .= "<strong>" . $this->editThisPage() . "</strong>";
$s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
$sep = "\n<br />";
+
+ # 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 .= "<a href=\"{$link['href']}\">" .
+ htmlspecialchars( $link['text'] ) . '</a>' . $sep;
+ }
+ }
if( $wgUser->isLoggedIn() ) {
$s.= $this->specialLink( 'watchlist' ) ;