https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102158

Revision: 102158
Author:   ialex
Date:     2011-11-06 05:51:38 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
* 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

Modified Paths:
--------------
    trunk/phase3/includes/SkinTemplate.php

Modified: trunk/phase3/includes/SkinTemplate.php
===================================================================
--- trunk/phase3/includes/SkinTemplate.php      2011-11-06 05:43:03 UTC (rev 
102157)
+++ trunk/phase3/includes/SkinTemplate.php      2011-11-06 05:51:38 UTC (rev 
102158)
@@ -805,7 +805,6 @@
 
                // parameters
                $action = $request->getVal( 'action', 'view' );
-               $section = $request->getVal( 'section' );
 
                $userCanRead = $title->userCanRead();
                $skname = $this->skinname;
@@ -870,6 +869,7 @@
                        ) {
                                // 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 @@
                        }
 
                        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 @@
                                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 ) );
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to