r57529 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57528‎ | r57529 | r57530 >
Date:19:35, 8 October 2009
Author:raymond
Status:ok
Tags:
Comment:
Consistency tweak: coalesce tool links with pipes instead of a lot () () ()
Modified paths:
  • /trunk/phase3/includes/Preferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Preferences.php
@@ -1002,8 +1002,12 @@
10031003 }
10041004 }
10051005
 1006+ /**
 1007+ * @param object $user The user object
 1008+ * @return array Text/links to display as key; $skinkey as value
 1009+ */
10061010 static function generateSkinOptions( $user ) {
1007 - global $wgDefaultSkin;
 1011+ global $wgDefaultSkin, $wgLang, $wgAllowUserCss, $wgAllowUserJs;
10081012 $ret = array();
10091013
10101014 $mptitle = Title::newMainPage();
@@ -1024,23 +1028,28 @@
10251029 $sk = $user->getSkin();
10261030
10271031 foreach( $validSkinNames as $skinkey => $sn ) {
 1032+ $linkTools = array();
 1033+
 1034+ # Mark the default skin
 1035+ if( $skinkey == $wgDefaultSkin ) {
 1036+ $linkTools[] = wfMsgHtml( 'default' );
 1037+ }
 1038+
 1039+ # Create preview link
10281040 $mplink = htmlspecialchars( $mptitle->getLocalURL( "useskin=$skinkey" ) );
1029 - $previewlink = "(<a target='_blank' href=\"$mplink\">$previewtext</a>)";
1030 - $extraLinks = '';
1031 - global $wgAllowUserCss, $wgAllowUserJs;
 1041+ $linkTools[] = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
 1042+
 1043+ # Create links to user CSS/JS pages
10321044 if( $wgAllowUserCss ) {
10331045 $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.css' );
1034 - $customCSS = $sk->link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) );
1035 - $extraLinks .= " ($customCSS)";
 1046+ $linkTools[] = $sk->link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) );
10361047 }
10371048 if( $wgAllowUserJs ) {
10381049 $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.js' );
1039 - $customJS = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
1040 - $extraLinks .= " ($customJS)";
 1050+ $linkTools[] = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
10411051 }
1042 - if( $skinkey == $wgDefaultSkin )
1043 - $sn .= ' (' . wfMsgHtml( 'default' ) . ')';
1044 - $display = "$sn $previewlink{$extraLinks}";
 1052+
 1053+ $display = $sn . ' ' . wfMsg( 'parentheses', $wgLang->pipeList( $linkTools ) );
10451054 $ret[$display] = $skinkey;
10461055 }
10471056

Status & tagging log