Logic for $wgSkipSkins should be in Skin.php, where it's usable by things other than preferences. (bug 6795)

This commit is contained in:
Chad Horohoe 2008-08-06 17:41:17 +00:00
parent 61301fbfe2
commit e8d63e8cf7
2 changed files with 17 additions and 5 deletions

View file

@ -60,6 +60,21 @@ class Skin extends Linker {
}
return $wgValidSkinNames;
}
/**
* Fetch the list of usable skins in regards to $wgSkipSkins.
* Useful for Special:Preferences and other places where you
* only want to show skins users _can_ use.
* @return array of strings
*/
public static function getUsableSkins() {
global $wgSkipSkins;
$usableSkins = self::getSkinNames();
foreach ( $wgSkipSkins as $skip ) {
unset( $usableSkins[$skip] );
}
return $usableSkins;
}
/**
* Normalize a skin preference value to a form that can be loaded.

View file

@ -517,7 +517,7 @@ class PreferencesForm {
global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
global $wgContLanguageCode, $wgDefaultSkin, $wgAuth;
global $wgEmailConfirmToEdit, $wgAjaxSearch, $wgEnableMWSuggest;
$wgOut->setPageTitle( wfMsg( 'preferences' ) );
@ -819,7 +819,7 @@ class PreferencesForm {
$previewtext = wfMsg('skin-preview');
# Only show members of Skin::getSkinNames() rather than
# $skinNames (skins is all skin names from Language.php)
$validSkinNames = Skin::getSkinNames();
$validSkinNames = Skin::getUsableSkins();
# Sort by UI skin name. First though need to update validSkinNames as sometimes
# the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
foreach ($validSkinNames as $skinkey => & $skinname ) {
@ -829,9 +829,6 @@ class PreferencesForm {
}
asort($validSkinNames);
foreach ($validSkinNames as $skinkey => $sn ) {
if ( in_array( $skinkey, $wgSkipSkins ) ) {
continue;
}
$checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
$mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));