From 2c0d815fa32aec728c2aa165d9bd75dd3f4e0ee4 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Tue, 22 Jul 2008 21:28:11 +0000 Subject: [PATCH] * (bug 14883) Create hook AlternateSkinPreferences to alternate skin section in user preferences --- RELEASE-NOTES | 1 + docs/hooks.txt | 4 +++ includes/specials/SpecialPreferences.php | 46 ++++++++++++------------ 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e271046b2f..bb7ea66968 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -190,6 +190,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN the database is potentially queried * (bug 9736) Redirects on Special:Fewestrevisions are now marked as such. * New date/time formats in Cs localization according to ČSN and PČP. +* (bug 14883) Create hook AlternateSkinPreferences to alternate skin section in user preferences === Bug fixes in 1.13 === diff --git a/docs/hooks.txt b/docs/hooks.txt index 286ed7e2a4..f724947bb2 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -265,6 +265,10 @@ before showing the edit form ( EditPage::edit() ). This is triggered on &action=edit. $EditPage : the EditPage object +'AlternateSkinPreferences': before creating the content of the 'skin' +tab in preferences +$prefsform : the PreferencesForm object + 'APIEditBeforeSave': before saving a page with api.php?action=edit, after processing request parameters. Return false to let the request fail, returning an error message or an tag diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index b3468a3c6b..0dd2654d73 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -815,30 +815,32 @@ class PreferencesForm { # Skin # $wgOut->addHTML( "
\n\n" . wfMsg('skin') . "\n" ); - $mptitle = Title::newMainPage(); - $previewtext = wfMsg('skinpreview'); - # Only show members of Skin::getSkinNames() rather than - # $skinNames (skins is all skin names from Language.php) - $validSkinNames = Skin::getSkinNames(); - # 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 ) { - if ( isset( $skinNames[$skinkey] ) ) { - $skinname = $skinNames[$skinkey]; - } - } - asort($validSkinNames); - foreach ($validSkinNames as $skinkey => $sn ) { - if ( in_array( $skinkey, $wgSkipSkins ) ) { - continue; + if( wfRunHooks('AlternateSkinPreferences'), array($this) ) { + $mptitle = Title::newMainPage(); + $previewtext = wfMsg('skinpreview'); + # Only show members of Skin::getSkinNames() rather than + # $skinNames (skins is all skin names from Language.php) + $validSkinNames = Skin::getSkinNames(); + # 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 ) { + if ( isset( $skinNames[$skinkey] ) ) { + $skinname = $skinNames[$skinkey]; + } } - $checked = $skinkey == $this->mSkin ? ' checked="checked"' : ''; + 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")); - $previewlink = "$previewtext"; - if( $skinkey == $wgDefaultSkin ) - $sn .= ' (' . wfMsg( 'default' ) . ')'; - $wgOut->addHTML( " $previewlink
\n" ); + $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey")); + $previewlink = "$previewtext"; + if( $skinkey == $wgDefaultSkin ) + $sn .= ' (' . wfMsg( 'default' ) . ')'; + $wgOut->addHTML( " $previewlink
\n" ); + } } $wgOut->addHTML( "
\n\n" ); -- 2.20.1