From 1d2f37376acc1123233c8349dff8d61ea8515acd Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 6 Nov 2011 05:51:38 +0000 Subject: [PATCH] * Moved the language variant check inside the "not a special page" check instead of doing it again after * Moved the definition of the $session variable near where it's used --- includes/SkinTemplate.php | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index bccdff5f1e..b0911b2596 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -805,7 +805,6 @@ class SkinTemplate extends Skin { // parameters $action = $request->getVal( 'action', 'view' ); - $section = $request->getVal( 'section' ); $userCanRead = $title->userCanRead(); $skname = $this->skinname; @@ -870,6 +869,7 @@ class SkinTemplate extends Skin { ) { // Builds CSS class for talk page links $isTalkClass = $isTalk ? ' istalk' : ''; + $section = $request->getVal( 'section' ); // Determines if we're in edit mode $selected = ( @@ -996,6 +996,35 @@ class SkinTemplate extends Skin { } wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$content_navigation ) ); + + if ( !$wgDisableLangConversion ) { + $pageLang = $title->getPageLanguage(); + // Gets list of language variants + $variants = $pageLang->getVariants(); + // Checks that language conversion is enabled and variants exist + // And if it is not in the special namespace + if( count( $variants ) > 1 ) { + // Gets preferred variant (note that user preference is + // only possible for wiki content language variant) + $preferred = $pageLang->getPreferredVariant(); + // Loops over each variant + foreach( $variants as $code ) { + // Gets variant name from language code + $varname = $pageLang->getVariantname( $code ); + // Checks if the variant is marked as disabled + if( $varname == 'disable' ) { + // Skips this variant + continue; + } + // Appends variant link + $content_navigation['variants'][] = array( + 'class' => ( $code == $preferred ) ? 'selected' : false, + 'text' => $varname, + 'href' => $title->getLocalURL( '', $code ) + ); + } + } + } } else { // If it's not content, it's got to be a special page $content_navigation['namespaces']['special'] = array( @@ -1009,35 +1038,6 @@ class SkinTemplate extends Skin { array( &$this, &$content_navigation ) ); } - if ( !$wgDisableLangConversion && !$title->isSpecialPage() ) { - $pageLang = $title->getPageLanguage(); - // Gets list of language variants - $variants = $pageLang->getVariants(); - // Checks that language conversion is enabled and variants exist - // And if it is not in the special namespace - if( count( $variants ) > 1 ) { - // Gets preferred variant (note that user preference is - // only possible for wiki content language variant) - $preferred = $pageLang->getPreferredVariant(); - // Loops over each variant - foreach( $variants as $code ) { - // Gets variant name from language code - $varname = $pageLang->getVariantname( $code ); - // Checks if the variant is marked as disabled - if( $varname == 'disable' ) { - // Skips this variant - continue; - } - // Appends variant link - $content_navigation['variants'][] = array( - 'class' => ( $code == $preferred ) ? 'selected' : false, - 'text' => $varname, - 'href' => $title->getLocalURL( '', $code ) - ); - } - } - } - // Equiv to SkinTemplateContentActions wfRunHooks( 'SkinTemplateNavigation::Universal', array( &$this, &$content_navigation ) ); -- 2.20.1