r70841 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70840‎ | r70841 | r70842 >
Date:19:48, 10 August 2010
Author:maxsem
Status:ok
Tags:
Comment:
Gadgets: prevent section <gadget-section-> from appearing in preferences when there are no sections defined, or there are gadgets defined before the first section.
Modified paths:
  • /trunk/extensions/Gadgets/Gadgets.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Gadgets/Gadgets.php
@@ -126,10 +126,15 @@
127127
128128 $options = array();
129129 foreach( $gadgets as $section => $thisSection ) {
130 - $section = wfMsgExt( "gadget-section-$section", 'parseinline' );
131 - $options[$section] = array();
 130+ if ( $section !== '' ) {
 131+ $section = wfMsgExt( "gadget-section-$section", 'parseinline' );
 132+ $options[$section] = array();
 133+ $destination = &$options[$section];
 134+ } else {
 135+ $destination = &$options;
 136+ }
132137 foreach( $thisSection as $gname => $code ) {
133 - $options[$section][wfMsgExt( "gadget-$gname", 'parseinline' )] = $gname;
 138+ $destination[wfMsgExt( "gadget-$gname", 'parseinline' )] = $gname;
134139 }
135140 }
136141

Status & tagging log