From 7b897be9aebc75c8baf6beab1e2b393dfaadcdac Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Thu, 8 Oct 2009 19:35:24 +0000 Subject: [PATCH] Consistency tweak: coalesce tool links with pipes instead of a lot () () () --- includes/Preferences.php | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/includes/Preferences.php b/includes/Preferences.php index 196b83b54f..072f92d83b 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1002,8 +1002,12 @@ class Preferences { } } + /** + * @param object $user The user object + * @return array Text/links to display as key; $skinkey as value + */ static function generateSkinOptions( $user ) { - global $wgDefaultSkin; + global $wgDefaultSkin, $wgLang, $wgAllowUserCss, $wgAllowUserJs; $ret = array(); $mptitle = Title::newMainPage(); @@ -1024,23 +1028,28 @@ class Preferences { $sk = $user->getSkin(); foreach( $validSkinNames as $skinkey => $sn ) { + $linkTools = array(); + + # Mark the default skin + if( $skinkey == $wgDefaultSkin ) { + $linkTools[] = wfMsgHtml( 'default' ); + } + + # Create preview link $mplink = htmlspecialchars( $mptitle->getLocalURL( "useskin=$skinkey" ) ); - $previewlink = "($previewtext)"; - $extraLinks = ''; - global $wgAllowUserCss, $wgAllowUserJs; + $linkTools[] = "$previewtext"; + + # Create links to user CSS/JS pages if( $wgAllowUserCss ) { $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.css' ); - $customCSS = $sk->link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) ); - $extraLinks .= " ($customCSS)"; + $linkTools[] = $sk->link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) ); } if( $wgAllowUserJs ) { $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.js' ); - $customJS = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) ); - $extraLinks .= " ($customJS)"; + $linkTools[] = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) ); } - if( $skinkey == $wgDefaultSkin ) - $sn .= ' (' . wfMsgHtml( 'default' ) . ')'; - $display = "$sn $previewlink{$extraLinks}"; + + $display = $sn . ' ' . wfMsg( 'parentheses', $wgLang->pipeList( $linkTools ) ); $ret[$display] = $skinkey; } -- 2.20.1