Merge "don't overwrite $item['single-id'] in makeListItem in SkinTemplate"
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index 54cc5a9..5a32d47 100644 (file)
@@ -423,7 +423,7 @@ class SkinTemplate extends Skin {
                                        if ( strval( $ilLangName ) === '' ) {
                                                $ilLangName = $l;
                                        } else {
-                                               $ilLangName = $this->getLanguage()->ucfirst( $ilLangName );
+                                               $ilLangName = $this->formatLanguageName( $ilLangName );
                                        }
                                        $language_urls[] = array(
                                                'href' => $nt->getFullURL(),
@@ -498,6 +498,18 @@ class SkinTemplate extends Skin {
                wfProfileOut( __METHOD__ );
        }
 
+       /**
+        * Format language name for use in sidebar interlanguage links list.
+        * By default it is capitalized.
+        *
+        * @param $name string Language name, e.g. "English" or "espaƱol"
+        * @return string
+        * @private
+        */
+       function formatLanguageName( $name ) {
+               return $this->getLanguage()->ucfirst( $name );
+       }
+
        /**
         * Output the string, or print error message if it's
         * an error object of the appropriate type.
@@ -554,7 +566,7 @@ class SkinTemplate extends Skin {
                        }
                }
 
-               if ( $wgSecureLogin && $request->detectProtocol() == 'https' ) {
+               if ( $wgSecureLogin && $request->detectProtocol() === 'https' ) {
                        $a['wpStickHTTPS'] = true;
                }
 
@@ -1137,6 +1149,7 @@ class SkinTemplate extends Skin {
 
                $nav_urls['print'] = false;
                $nav_urls['permalink'] = false;
+               $nav_urls['info'] = false;
                $nav_urls['whatlinkshere'] = false;
                $nav_urls['recentchangeslinked'] = false;
                $nav_urls['contributions'] = false;
@@ -1164,6 +1177,11 @@ class SkinTemplate extends Skin {
                                );
                        }
 
+                       $nav_urls['info'] = array(
+                               'text' => $this->msg( 'pageinfo-toolboxlink' )->text(),
+                               'href' => $out->getTitle()->getLocalURL( "action=info" )
+                       );
+
                        // Use the copy of revision ID in case this undocumented, shady hook tries to mess with internals
                        wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink',
                                array( &$this, &$nav_urls, &$revid, &$revid ) );
@@ -1424,6 +1442,11 @@ abstract class BaseTemplate extends QuickTemplate {
                                $toolbox['permalink']['id'] = 't-permalink';
                        }
                }
+               if ( isset( $this->data['nav_urls']['info'] ) && $this->data['nav_urls']['info'] ) {
+                       $toolbox['info'] = $this->data['nav_urls']['info'];
+                       $toolbox['info']['id'] = 't-info';
+               }
+
                wfRunHooks( 'BaseTemplateToolbox', array( &$this, &$toolbox ) );
                wfProfileOut( __METHOD__ );
                return $toolbox;
@@ -1727,7 +1750,7 @@ abstract class BaseTemplate extends QuickTemplate {
                        foreach ( array( 'id', 'class', 'active', 'tag' ) as $k ) {
                                unset( $link[$k] );
                        }
-                       if ( isset( $item['id'] ) ) {
+                       if ( isset( $item['id'] ) && !isset( $item['single-id'] ) ) {
                                // The id goes on the <li> not on the <a> for single links
                                // but makeSidebarLink still needs to know what id to use when
                                // generating tooltips and accesskeys.