http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96013

Revision: 96013
Author:   catrope
Date:     2011-09-01 17:08:00 +0000 (Thu, 01 Sep 2011)
Log Message:
-----------
RL2: Fix bug where the preferences page was messed up when a description was 
empty, and the titles weren't included. Now using "$title: $description"

Modified Paths:
--------------
    branches/RL2/extensions/Gadgets/GadgetHooks.php
    branches/RL2/extensions/Gadgets/Gadgets.i18n.php

Modified: branches/RL2/extensions/Gadgets/GadgetHooks.php
===================================================================
--- branches/RL2/extensions/Gadgets/GadgetHooks.php     2011-09-01 16:55:00 UTC 
(rev 96012)
+++ branches/RL2/extensions/Gadgets/GadgetHooks.php     2011-09-01 17:08:00 UTC 
(rev 96013)
@@ -193,8 +193,15 @@
                        $category = $gadget->getCategory();
                        
                        // Add the Gadget to the right category
-                       $description = $gadget->getDescriptionMessage();
-                       $categories[$category][$description] = $name;
+                       $title = htmlspecialchars( $gadget->getTitleMessage() );
+                       $description = $gadget->getDescriptionMessage(); // Is 
parsed, doesn't need escaping
+                       if ( $description === '' ) {
+                               // Empty description, just use the title
+                               $text = $title;
+                       } else {
+                               $text = wfMessage( 
'gadgets-preference-description' )->rawParams( $title, $description )->parse();
+                       }
+                       $categories[$category][$text] = $name;
                        // Add the Gadget to the default list if enabled
                        if ( $gadget->isEnabledForUser( $user ) ) {
                                $default[] = $name;

Modified: branches/RL2/extensions/Gadgets/Gadgets.i18n.php
===================================================================
--- branches/RL2/extensions/Gadgets/Gadgets.i18n.php    2011-09-01 16:55:00 UTC 
(rev 96012)
+++ branches/RL2/extensions/Gadgets/Gadgets.i18n.php    2011-09-01 17:08:00 UTC 
(rev 96013)
@@ -26,6 +26,7 @@
 
 Also note that these special gadgets are not part of the MediaWiki software, 
and are usually developed and maintained by users on your local wiki.
 Local administrators can edit the [[MediaWiki:Gadgets-definition|definitions]] 
and [[Special:Gadgets|descriptions]] of available gadgets.',
+       'gadgets-preference-description' => '$1: $2',
 
        # For Special:Gadgets
        'gadgets'           => 'Gadgets',
@@ -98,6 +99,7 @@
 
 {{Identical|Gadgets}}',
        'gadgets-prefstext' => 'In Gadgets extension. This is the explanation 
text displayed under the Gadgets tab in [[Special:Preferences]].',
+       'gadgets-preference-description' => 'Used for the description HTML of a 
Gadget in Special:Preferences. $1 is the title of the Gadget, $2 is the 
description of the Gadget.',
        'gadgets' => '{{Identical|Gadgets}}',
        'gadgets-title' => '{{Identical|Gadgets}}',
        'gadgets-uses' => "This is used as a verb in third-person singular. It 
appears in front of a script name. Example: \"''Uses: Gadget-UTCLiveClock.js''\"


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to