* (bug 14883) Create hook AlternateSkinPreferences to alternate skin section in user...
authorRyan Schmidt <skizzerz@users.mediawiki.org>
Tue, 22 Jul 2008 21:28:11 +0000 (21:28 +0000)
committerRyan Schmidt <skizzerz@users.mediawiki.org>
Tue, 22 Jul 2008 21:28:11 +0000 (21:28 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/specials/SpecialPreferences.php

index e271046..bb7ea66 100644 (file)
@@ -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 ===
 
index 286ed7e..f724947 100644 (file)
@@ -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 <edit result="Failure"> tag
index b3468a3..0dd2654 100644 (file)
@@ -815,30 +815,32 @@ class PreferencesForm {
                # Skin
                #
                $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\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 = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
-                       if( $skinkey == $wgDefaultSkin )
-                               $sn .= ' (' . wfMsg( 'default' ) . ')';
-                       $wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br />\n" );
+                               $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
+                               $previewlink = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
+                               if( $skinkey == $wgDefaultSkin )
+                                       $sn .= ' (' . wfMsg( 'default' ) . ')';
+                               $wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br />\n" );
+                       }
                }
                $wgOut->addHTML( "</fieldset>\n\n" );