Index: trunk/phase3/includes/Preferences.php |
— | — | @@ -1002,8 +1002,12 @@ |
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
| 1006 | + /** |
| 1007 | + * @param object $user The user object |
| 1008 | + * @return array Text/links to display as key; $skinkey as value |
| 1009 | + */ |
1006 | 1010 | static function generateSkinOptions( $user ) { |
1007 | | - global $wgDefaultSkin; |
| 1011 | + global $wgDefaultSkin, $wgLang, $wgAllowUserCss, $wgAllowUserJs; |
1008 | 1012 | $ret = array(); |
1009 | 1013 | |
1010 | 1014 | $mptitle = Title::newMainPage(); |
— | — | @@ -1024,23 +1028,28 @@ |
1025 | 1029 | $sk = $user->getSkin(); |
1026 | 1030 | |
1027 | 1031 | 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 |
1028 | 1040 | $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 |
1032 | 1044 | if( $wgAllowUserCss ) { |
1033 | 1045 | $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' ) ); |
1036 | 1047 | } |
1037 | 1048 | if( $wgAllowUserJs ) { |
1038 | 1049 | $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' ) ); |
1041 | 1051 | } |
1042 | | - if( $skinkey == $wgDefaultSkin ) |
1043 | | - $sn .= ' (' . wfMsgHtml( 'default' ) . ')'; |
1044 | | - $display = "$sn $previewlink{$extraLinks}"; |
| 1052 | + |
| 1053 | + $display = $sn . ' ' . wfMsg( 'parentheses', $wgLang->pipeList( $linkTools ) ); |
1045 | 1054 | $ret[$display] = $skinkey; |
1046 | 1055 | } |
1047 | 1056 | |