r102158 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102157‎ | r102158 | r102159 >
Date:05:51, 6 November 2011
Author:ialex
Status:ok
Tags:
Comment:
* 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) (history)

Diff [purge]

Index: trunk/phase3/includes/SkinTemplate.php
@@ -805,7 +805,6 @@
806806
807807 // parameters
808808 $action = $request->getVal( 'action', 'view' );
809 - $section = $request->getVal( 'section' );
810809
811810 $userCanRead = $title->userCanRead();
812811 $skname = $this->skinname;
@@ -870,6 +869,7 @@
871870 ) {
872871 // Builds CSS class for talk page links
873872 $isTalkClass = $isTalk ? ' istalk' : '';
 873+ $section = $request->getVal( 'section' );
874874
875875 // Determines if we're in edit mode
876876 $selected = (
@@ -996,6 +996,35 @@
997997 }
998998
999999 wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$content_navigation ) );
 1000+
 1001+ if ( !$wgDisableLangConversion ) {
 1002+ $pageLang = $title->getPageLanguage();
 1003+ // Gets list of language variants
 1004+ $variants = $pageLang->getVariants();
 1005+ // Checks that language conversion is enabled and variants exist
 1006+ // And if it is not in the special namespace
 1007+ if( count( $variants ) > 1 ) {
 1008+ // Gets preferred variant (note that user preference is
 1009+ // only possible for wiki content language variant)
 1010+ $preferred = $pageLang->getPreferredVariant();
 1011+ // Loops over each variant
 1012+ foreach( $variants as $code ) {
 1013+ // Gets variant name from language code
 1014+ $varname = $pageLang->getVariantname( $code );
 1015+ // Checks if the variant is marked as disabled
 1016+ if( $varname == 'disable' ) {
 1017+ // Skips this variant
 1018+ continue;
 1019+ }
 1020+ // Appends variant link
 1021+ $content_navigation['variants'][] = array(
 1022+ 'class' => ( $code == $preferred ) ? 'selected' : false,
 1023+ 'text' => $varname,
 1024+ 'href' => $title->getLocalURL( '', $code )
 1025+ );
 1026+ }
 1027+ }
 1028+ }
10001029 } else {
10011030 // If it's not content, it's got to be a special page
10021031 $content_navigation['namespaces']['special'] = array(
@@ -1009,35 +1038,6 @@
10101039 array( &$this, &$content_navigation ) );
10111040 }
10121041
1013 - if ( !$wgDisableLangConversion && !$title->isSpecialPage() ) {
1014 - $pageLang = $title->getPageLanguage();
1015 - // Gets list of language variants
1016 - $variants = $pageLang->getVariants();
1017 - // Checks that language conversion is enabled and variants exist
1018 - // And if it is not in the special namespace
1019 - if( count( $variants ) > 1 ) {
1020 - // Gets preferred variant (note that user preference is
1021 - // only possible for wiki content language variant)
1022 - $preferred = $pageLang->getPreferredVariant();
1023 - // Loops over each variant
1024 - foreach( $variants as $code ) {
1025 - // Gets variant name from language code
1026 - $varname = $pageLang->getVariantname( $code );
1027 - // Checks if the variant is marked as disabled
1028 - if( $varname == 'disable' ) {
1029 - // Skips this variant
1030 - continue;
1031 - }
1032 - // Appends variant link
1033 - $content_navigation['variants'][] = array(
1034 - 'class' => ( $code == $preferred ) ? 'selected' : false,
1035 - 'text' => $varname,
1036 - 'href' => $title->getLocalURL( '', $code )
1037 - );
1038 - }
1039 - }
1040 - }
1041 -
10421042 // Equiv to SkinTemplateContentActions
10431043 wfRunHooks( 'SkinTemplateNavigation::Universal', array( &$this, &$content_navigation ) );
10441044

Status & tagging log