r65072 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65071‎ | r65072 | r65073 >
Date:18:36, 15 April 2010
Author:siebrand
Status:ok
Tags:
Comment:
Update indentation/formatting and add braces where missing in if() and foreach()
Modified paths:
  • /trunk/phase3/includes/Preferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Preferences.php
@@ -1,5 +1,4 @@
22 <?php
3 -
43 /**
54 * We're now using the HTMLForm object with some customisation to generate the
65 * Preferences form. This object handles generic submission, CSRF protection,
@@ -25,12 +24,12 @@
2625 * Once fields have been retrieved and validated, submission logic is handed
2726 * over to the tryUISubmit static method of this class.
2827 */
 28+
2929 class Preferences {
3030 static $defaultPreferences = null;
31 - static $saveFilters =
32 - array(
 31+ static $saveFilters = array(
3332 'timecorrection' => array( 'Preferences', 'filterTimezoneInput' ),
34 - );
 33+ );
3534
3635 static function getPreferences( $user ) {
3736 if ( self::$defaultPreferences )
@@ -64,13 +63,13 @@
6564
6665 ## Prod in defaults from the user
6766 global $wgDefaultUserOptions;
68 - foreach( $defaultPreferences as $name => &$info ) {
 67+ foreach ( $defaultPreferences as $name => &$info ) {
6968 $prefFromUser = self::getOptionFromUser( $name, $info, $user );
7069 $field = HTMLForm::loadInputFromParameters( $info ); // For validation
7170 $defaultOptions = User::getDefaultOptions();
7271 $globalDefault = isset( $defaultOptions[$name] )
73 - ? $defaultOptions[$name]
74 - : null;
 72+ ? $defaultOptions[$name]
 73+ : null;
7574
7675 // If it validates, set it as the default
7776 if ( isset( $info['default'] ) ) {
@@ -79,7 +78,7 @@
8079 } elseif ( !is_null( $prefFromUser ) && // Make sure we're not just pulling nothing
8180 $field->validate( $prefFromUser, $user->mOptions ) === true ) {
8281 $info['default'] = $prefFromUser;
83 - } elseif( $field->validate( $globalDefault, $user->mOptions ) === true ) {
 82+ } elseif ( $field->validate( $globalDefault, $user->mOptions ) === true ) {
8483 $info['default'] = $globalDefault;
8584 } else {
8685 throw new MWException( "Global default '$globalDefault' is invalid for field $name" );
@@ -98,13 +97,12 @@
9998 // Handling for array-type preferences
10099 if ( ( isset( $info['type'] ) && $info['type'] == 'multiselect' ) ||
101100 ( isset( $info['class'] ) && $info['class'] == 'HTMLMultiSelectField' ) ) {
102 -
103101 $options = HTMLFormField::flattenOptions( $info['options'] );
104102 $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
105103 $val = array();
106104
107 - foreach( $options as $label => $value ) {
108 - if( $user->getOption( "$prefix$value" ) ) {
 105+ foreach ( $options as $label => $value ) {
 106+ if ( $user->getOption( "$prefix$value" ) ) {
109107 $val[] = $value;
110108 }
111109 }
@@ -117,27 +115,25 @@
118116 global $wgLang, $wgUser;
119117 ## User info #####################################
120118 // Information panel
121 - $defaultPreferences['username'] =
122 - array(
123 - 'type' => 'info',
124 - 'label-message' => 'username',
125 - 'default' => $user->getName(),
126 - 'section' => 'personal/info',
127 - );
 119+ $defaultPreferences['username'] = array(
 120+ 'type' => 'info',
 121+ 'label-message' => 'username',
 122+ 'default' => $user->getName(),
 123+ 'section' => 'personal/info',
 124+ );
128125
129 - $defaultPreferences['userid'] =
130 - array(
131 - 'type' => 'info',
132 - 'label-message' => 'uid',
133 - 'default' => $user->getId(),
134 - 'section' => 'personal/info',
135 - );
 126+ $defaultPreferences['userid'] = array(
 127+ 'type' => 'info',
 128+ 'label-message' => 'uid',
 129+ 'default' => $user->getId(),
 130+ 'section' => 'personal/info',
 131+ );
136132
137133 # Get groups to which the user belongs
138134 $userEffectiveGroups = $user->getEffectiveGroups();
139135 $userGroups = $userMembers = array();
140 - foreach( $userEffectiveGroups as $ueg ) {
141 - if( $ueg == '*' ) {
 136+ foreach ( $userEffectiveGroups as $ueg ) {
 137+ if ( $ueg == '*' ) {
142138 // Skip the default * group, seems useless here
143139 continue;
144140 }
@@ -150,147 +146,143 @@
151147 asort( $userGroups );
152148 asort( $userMembers );
153149
154 - $defaultPreferences['usergroups'] =
155 - array(
156 - 'type' => 'info',
157 - 'label' => wfMsgExt( 'prefs-memberingroups', 'parseinline',
158 - $wgLang->formatNum( count($userGroups) ) ),
159 - 'default' => wfMsgExt( 'prefs-memberingroups-type', array(),
160 - $wgLang->commaList( $userGroups ),
161 - $wgLang->commaList( $userMembers )
162 - ),
163 - 'raw' => true,
164 - 'section' => 'personal/info',
165 - );
 150+ $defaultPreferences['usergroups'] = array(
 151+ 'type' => 'info',
 152+ 'label' => wfMsgExt(
 153+ 'prefs-memberingroups', 'parseinline',
 154+ $wgLang->formatNum( count( $userGroups ) )
 155+ ),
 156+ 'default' => wfMsgExt(
 157+ 'prefs-memberingroups-type', array(),
 158+ $wgLang->commaList( $userGroups ),
 159+ $wgLang->commaList( $userMembers )
 160+ ),
 161+ 'raw' => true,
 162+ 'section' => 'personal/info',
 163+ );
166164
167 - $defaultPreferences['editcount'] =
168 - array(
169 - 'type' => 'info',
170 - 'label-message' => 'prefs-edits',
171 - 'default' => $wgLang->formatNum( $user->getEditCount() ),
172 - 'section' => 'personal/info',
173 - );
 165+ $defaultPreferences['editcount'] = array(
 166+ 'type' => 'info',
 167+ 'label-message' => 'prefs-edits',
 168+ 'default' => $wgLang->formatNum( $user->getEditCount() ),
 169+ 'section' => 'personal/info',
 170+ );
174171
175 - if( $user->getRegistration() ) {
176 - $defaultPreferences['registrationdate'] =
177 - array(
178 - 'type' => 'info',
179 - 'label-message' => 'prefs-registration',
180 - 'default' => wfMsgExt( 'prefs-registration-date-time', 'parsemag',
181 - $wgLang->timeanddate( $user->getRegistration(), true ),
182 - $wgLang->date( $user->getRegistration(), true ),
183 - $wgLang->time( $user->getRegistration(), true ) ),
184 - 'section' => 'personal/info',
185 - );
 172+ if ( $user->getRegistration() ) {
 173+ $defaultPreferences['registrationdate'] = array(
 174+ 'type' => 'info',
 175+ 'label-message' => 'prefs-registration',
 176+ 'default' => wfMsgExt(
 177+ 'prefs-registration-date-time', 'parsemag',
 178+ $wgLang->timeanddate( $user->getRegistration(), true ),
 179+ $wgLang->date( $user->getRegistration(), true ),
 180+ $wgLang->time( $user->getRegistration(), true )
 181+ ),
 182+ 'section' => 'personal/info',
 183+ );
186184 }
187185
188186 // Actually changeable stuff
189187 global $wgAuth;
190 - $defaultPreferences['realname'] =
191 - array(
192 - 'type' => $wgAuth->allowPropChange( 'realname' ) ? 'text' : 'info',
193 - 'default' => $user->getRealName(),
194 - 'section' => 'personal/info',
195 - 'label-message' => 'yourrealname',
196 - 'help-message' => 'prefs-help-realname',
197 - );
 188+ $defaultPreferences['realname'] = array(
 189+ 'type' => $wgAuth->allowPropChange( 'realname' ) ? 'text' : 'info',
 190+ 'default' => $user->getRealName(),
 191+ 'section' => 'personal/info',
 192+ 'label-message' => 'yourrealname',
 193+ 'help-message' => 'prefs-help-realname',
 194+ );
198195
199 - $defaultPreferences['gender'] =
200 - array(
201 - 'type' => 'select',
202 - 'section' => 'personal/info',
203 - 'options' => array(
204 - wfMsg( 'gender-male' ) => 'male',
205 - wfMsg( 'gender-female' ) => 'female',
206 - wfMsg( 'gender-unknown' ) => 'unknown',
207 - ),
208 - 'label-message' => 'yourgender',
209 - 'help-message' => 'prefs-help-gender',
210 - );
 196+ $defaultPreferences['gender'] = array(
 197+ 'type' => 'select',
 198+ 'section' => 'personal/info',
 199+ 'options' => array(
 200+ wfMsg( 'gender-male' ) => 'male',
 201+ wfMsg( 'gender-female' ) => 'female',
 202+ wfMsg( 'gender-unknown' ) => 'unknown',
 203+ ),
 204+ 'label-message' => 'yourgender',
 205+ 'help-message' => 'prefs-help-gender',
 206+ );
211207
212 - if( $wgAuth->allowPasswordChange() ) {
 208+ if ( $wgAuth->allowPasswordChange() ) {
213209 $link = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'Resetpass' ),
214210 wfMsgHtml( 'prefs-resetpass' ), array(),
215211 array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' ) ) );
216212
217 - $defaultPreferences['password'] =
218 - array(
219 - 'type' => 'info',
220 - 'raw' => true,
221 - 'default' => $link,
222 - 'label-message' => 'yourpassword',
223 - 'section' => 'personal/info',
224 - );
 213+ $defaultPreferences['password'] = array(
 214+ 'type' => 'info',
 215+ 'raw' => true,
 216+ 'default' => $link,
 217+ 'label-message' => 'yourpassword',
 218+ 'section' => 'personal/info',
 219+ );
225220 }
226221
227 - $defaultPreferences['rememberpassword'] =
228 - array(
229 - 'type' => 'toggle',
230 - 'label-message' => 'tog-rememberpassword',
231 - 'section' => 'personal/info',
232 - );
 222+ $defaultPreferences['rememberpassword'] = array(
 223+ 'type' => 'toggle',
 224+ 'label-message' => 'tog-rememberpassword',
 225+ 'section' => 'personal/info',
 226+ );
233227
234228 // Language
235229 global $wgContLanguageCode;
236230 $languages = array_reverse( Language::getLanguageNames( false ) );
237 - if( !array_key_exists( $wgContLanguageCode, $languages ) ) {
 231+ if ( !array_key_exists( $wgContLanguageCode, $languages ) ) {
238232 $languages[$wgContLanguageCode] = $wgContLanguageCode;
239233 }
240234 ksort( $languages );
241235
242236 $options = array();
243 - foreach( $languages as $code => $name ) {
 237+ foreach ( $languages as $code => $name ) {
244238 $display = wfBCP47( $code ) . ' - ' . $name;
245239 $options[$display] = $code;
246240 }
247 - $defaultPreferences['language'] =
248 - array(
249 - 'type' => 'select',
250 - 'section' => 'personal/i18n',
251 - 'options' => $options,
252 - 'label-message' => 'yourlanguage',
253 - );
 241+ $defaultPreferences['language'] = array(
 242+ 'type' => 'select',
 243+ 'section' => 'personal/i18n',
 244+ 'options' => $options,
 245+ 'label-message' => 'yourlanguage',
 246+ );
254247
255248 global $wgContLang, $wgDisableLangConversion;
256249 global $wgDisableTitleConversion;
257250 /* see if there are multiple language variants to choose from*/
258251 $variantArray = array();
259 - if( !$wgDisableLangConversion ) {
 252+ if ( !$wgDisableLangConversion ) {
260253 $variants = $wgContLang->getVariants();
261254
262255 $languages = Language::getLanguageNames( true );
263 - foreach( $variants as $v ) {
 256+ foreach ( $variants as $v ) {
264257 $v = str_replace( '_', '-', strtolower( $v ) );
265 - if( array_key_exists( $v, $languages ) ) {
 258+ if ( array_key_exists( $v, $languages ) ) {
266259 // If it doesn't have a name, we'll pretend it doesn't exist
267260 $variantArray[$v] = $languages[$v];
268261 }
269262 }
270263
271264 $options = array();
272 - foreach( $variantArray as $code => $name ) {
 265+ foreach ( $variantArray as $code => $name ) {
273266 $display = wfBCP47( $code ) . ' - ' . $name;
274267 $options[$display] = $code;
275268 }
276269
277 - if( count( $variantArray ) > 1 ) {
278 - $defaultPreferences['variant'] =
279 - array(
280 - 'label-message' => 'yourvariant',
281 - 'type' => 'select',
282 - 'options' => $options,
283 - 'section' => 'personal/i18n',
284 - );
 270+ if ( count( $variantArray ) > 1 ) {
 271+ $defaultPreferences['variant'] = array(
 272+ 'label-message' => 'yourvariant',
 273+ 'type' => 'select',
 274+ 'options' => $options,
 275+ 'section' => 'personal/i18n',
 276+ );
285277 }
286278 }
287279
288 - if( count( $variantArray ) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion ) {
 280+ if ( count( $variantArray ) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion ) {
289281 $defaultPreferences['noconvertlink'] =
290282 array(
291 - 'type' => 'toggle',
292 - 'section' => 'personal/i18n',
293 - 'label-message' => 'tog-noconvertlink',
294 - );
 283+ 'type' => 'toggle',
 284+ 'section' => 'personal/i18n',
 285+ 'label-message' => 'tog-noconvertlink',
 286+ );
295287 }
296288
297289 global $wgMaxSigChars, $wgOut, $wgParser;
@@ -298,66 +290,62 @@
299291 // show a preview of the old signature first
300292 $oldsigWikiText = $wgParser->preSaveTransform( "~~~", new Title , $user, new ParserOptions );
301293 $oldsigHTML = $wgOut->parseInline( $oldsigWikiText );
302 - $defaultPreferences['oldsig'] =
303 - array(
304 - 'type' => 'info',
305 - 'raw' => true,
306 - 'label-message' => 'tog-oldsig',
307 - 'default' => $oldsigHTML,
308 - 'section' => 'personal/signature',
309 - );
310 - $defaultPreferences['nickname'] =
311 - array(
312 - 'type' => $wgAuth->allowPropChange( 'nickname' ) ? 'text' : 'info',
313 - 'maxlength' => $wgMaxSigChars,
314 - 'label-message' => 'yournick',
315 - 'validation-callback' =>
316 - array( 'Preferences', 'validateSignature' ),
317 - 'section' => 'personal/signature',
318 - 'filter-callback' => array( 'Preferences', 'cleanSignature' ),
319 - );
320 - $defaultPreferences['fancysig'] =
321 - array(
322 - 'type' => 'toggle',
323 - 'label-message' => 'tog-fancysig',
324 - 'help-message' => 'prefs-help-signature', // show general help about signature at the bottom of the section
325 - 'section' => 'personal/signature'
326 - );
327 -
 294+ $defaultPreferences['oldsig'] = array(
 295+ 'type' => 'info',
 296+ 'raw' => true,
 297+ 'label-message' => 'tog-oldsig',
 298+ 'default' => $oldsigHTML,
 299+ 'section' => 'personal/signature',
 300+ );
 301+ $defaultPreferences['nickname'] = array(
 302+ 'type' => $wgAuth->allowPropChange( 'nickname' ) ? 'text' : 'info',
 303+ 'maxlength' => $wgMaxSigChars,
 304+ 'label-message' => 'yournick',
 305+ 'validation-callback' => array( 'Preferences', 'validateSignature' ),
 306+ 'section' => 'personal/signature',
 307+ 'filter-callback' => array( 'Preferences', 'cleanSignature' ),
 308+ );
 309+ $defaultPreferences['fancysig'] = array(
 310+ 'type' => 'toggle',
 311+ 'label-message' => 'tog-fancysig',
 312+ 'help-message' => 'prefs-help-signature', // show general help about signature at the bottom of the section
 313+ 'section' => 'personal/signature'
 314+ );
 315+
328316 ## Email stuff
329 -
 317+
330318 global $wgEnableEmail;
331 - if ($wgEnableEmail) {
332 -
 319+ if ( $wgEnableEmail ) {
333320 global $wgEmailConfirmToEdit;
334 -
335 - $defaultPreferences['emailaddress'] =
336 - array(
337 - 'type' => $wgAuth->allowPropChange( 'emailaddress' ) ? 'email' : 'info',
338 - 'default' => $user->getEmail(),
339 - 'section' => 'personal/email',
340 - 'label-message' => 'youremail',
341 - 'help-message' => $wgEmailConfirmToEdit
342 - ? 'prefs-help-email-required'
343 - : 'prefs-help-email',
344 - 'validation-callback' => array( 'Preferences', 'validateEmail' ),
345 - );
346 -
 321+
 322+ $defaultPreferences['emailaddress'] = array(
 323+ 'type' => $wgAuth->allowPropChange( 'emailaddress' ) ? 'email' : 'info',
 324+ 'default' => $user->getEmail(),
 325+ 'section' => 'personal/email',
 326+ 'label-message' => 'youremail',
 327+ 'help-message' => $wgEmailConfirmToEdit
 328+ ? 'prefs-help-email-required'
 329+ : 'prefs-help-email',
 330+ 'validation-callback' => array( 'Preferences', 'validateEmail' ),
 331+ );
 332+
347333 global $wgEnableUserEmail, $wgEmailAuthentication;
348 -
 334+
349335 $disableEmailPrefs = false;
350 -
 336+
351337 if ( $wgEmailAuthentication ) {
352338 if ( $user->getEmail() ) {
353 - if( $user->getEmailAuthenticationTimestamp() ) {
 339+ if ( $user->getEmailAuthenticationTimestamp() ) {
354340 // date and time are separate parameters to facilitate localisation.
355341 // $time is kept for backward compat reasons.
356342 // 'emailauthenticated' is also used in SpecialConfirmemail.php
357343 $time = $wgLang->timeAndDate( $user->getEmailAuthenticationTimestamp(), true );
358344 $d = $wgLang->date( $user->getEmailAuthenticationTimestamp(), true );
359345 $t = $wgLang->time( $user->getEmailAuthenticationTimestamp(), true );
360 - $emailauthenticated = wfMsgExt( 'emailauthenticated', 'parseinline',
361 - array($time, $d, $t ) ) . '<br />';
 346+ $emailauthenticated = wfMsgExt(
 347+ 'emailauthenticated', 'parseinline',
 348+ array( $time, $d, $t )
 349+ ) . '<br />';
362350 $disableEmailPrefs = false;
363351 } else {
364352 $disableEmailPrefs = true;
@@ -375,73 +363,67 @@
376364 $disableEmailPrefs = true;
377365 $emailauthenticated = wfMsgHtml( 'noemailprefs' );
378366 }
379 -
380 - $defaultPreferences['emailauthentication'] =
381 - array(
382 - 'type' => 'info',
383 - 'raw' => true,
384 - 'section' => 'personal/email',
385 - 'label-message' => 'prefs-emailconfirm-label',
386 - 'default' => $emailauthenticated,
387 - );
388 -
 367+
 368+ $defaultPreferences['emailauthentication'] = array(
 369+ 'type' => 'info',
 370+ 'raw' => true,
 371+ 'section' => 'personal/email',
 372+ 'label-message' => 'prefs-emailconfirm-label',
 373+ 'default' => $emailauthenticated,
 374+ );
 375+
389376 }
390 -
391 - if( $wgEnableUserEmail && $user->isAllowed( 'sendemail' ) ) {
392 - $defaultPreferences['disablemail'] =
393 - array(
394 - 'type' => 'toggle',
395 - 'invert' => true,
396 - 'section' => 'personal/email',
397 - 'label-message' => 'allowemail',
398 - 'disabled' => $disableEmailPrefs,
399 - );
400 - $defaultPreferences['ccmeonemails'] =
401 - array(
402 - 'type' => 'toggle',
403 - 'section' => 'personal/email',
404 - 'label-message' => 'tog-ccmeonemails',
405 - 'disabled' => $disableEmailPrefs,
406 - );
 377+
 378+ if ( $wgEnableUserEmail && $user->isAllowed( 'sendemail' ) ) {
 379+ $defaultPreferences['disablemail'] = array(
 380+ 'type' => 'toggle',
 381+ 'invert' => true,
 382+ 'section' => 'personal/email',
 383+ 'label-message' => 'allowemail',
 384+ 'disabled' => $disableEmailPrefs,
 385+ );
 386+ $defaultPreferences['ccmeonemails'] = array(
 387+ 'type' => 'toggle',
 388+ 'section' => 'personal/email',
 389+ 'label-message' => 'tog-ccmeonemails',
 390+ 'disabled' => $disableEmailPrefs,
 391+ );
407392 }
408 -
 393+
409394 global $wgEnotifWatchlist;
410395 if ( $wgEnotifWatchlist ) {
411 - $defaultPreferences['enotifwatchlistpages'] =
412 - array(
413 - 'type' => 'toggle',
414 - 'section' => 'personal/email',
415 - 'label-message' => 'tog-enotifwatchlistpages',
416 - 'disabled' => $disableEmailPrefs,
417 - );
 396+ $defaultPreferences['enotifwatchlistpages'] = array(
 397+ 'type' => 'toggle',
 398+ 'section' => 'personal/email',
 399+ 'label-message' => 'tog-enotifwatchlistpages',
 400+ 'disabled' => $disableEmailPrefs,
 401+ );
418402 }
419403 global $wgEnotifUserTalk;
420 - if( $wgEnotifUserTalk ) {
421 - $defaultPreferences['enotifusertalkpages'] =
422 - array(
423 - 'type' => 'toggle',
424 - 'section' => 'personal/email',
425 - 'label-message' => 'tog-enotifusertalkpages',
426 - 'disabled' => $disableEmailPrefs,
427 - );
 404+ if ( $wgEnotifUserTalk ) {
 405+ $defaultPreferences['enotifusertalkpages'] = array(
 406+ 'type' => 'toggle',
 407+ 'section' => 'personal/email',
 408+ 'label-message' => 'tog-enotifusertalkpages',
 409+ 'disabled' => $disableEmailPrefs,
 410+ );
428411 }
429 - if( $wgEnotifUserTalk || $wgEnotifWatchlist ) {
430 - $defaultPreferences['enotifminoredits'] =
431 - array(
432 - 'type' => 'toggle',
433 - 'section' => 'personal/email',
434 - 'label-message' => 'tog-enotifminoredits',
435 - 'disabled' => $disableEmailPrefs,
436 - );
 412+ if ( $wgEnotifUserTalk || $wgEnotifWatchlist ) {
 413+ $defaultPreferences['enotifminoredits'] = array(
 414+ 'type' => 'toggle',
 415+ 'section' => 'personal/email',
 416+ 'label-message' => 'tog-enotifminoredits',
 417+ 'disabled' => $disableEmailPrefs,
 418+ );
 419+
437420 global $wgEnotifRevealEditorAddress;
438421 if ( $wgEnotifRevealEditorAddress ) {
439 - $defaultPreferences['enotifrevealaddr'] =
440 - array(
441 - 'type' => 'toggle',
442 - 'section' => 'personal/email',
443 - 'label-message' => 'tog-enotifrevealaddr',
444 - 'disabled' => $disableEmailPrefs,
445 - );
 422+ $defaultPreferences['enotifrevealaddr'] = array(
 423+ 'type' => 'toggle',
 424+ 'section' => 'personal/email',
 425+ 'label-message' => 'tog-enotifrevealaddr',
 426+ 'disabled' => $disableEmailPrefs,
 427+ );
446428 }
447429 }
448430 }
@@ -451,84 +433,81 @@
452434 ## Skin #####################################
453435 global $wgLang, $wgAllowUserCss, $wgAllowUserJs;
454436
455 - $defaultPreferences['skin'] =
456 - array(
457 - 'type' => 'radio',
458 - 'options' => self::generateSkinOptions( $user ),
459 - 'label' => '&nbsp;',
460 - 'section' => 'rendering/skin',
461 - );
 437+ $defaultPreferences['skin'] = array(
 438+ 'type' => 'radio',
 439+ 'options' => self::generateSkinOptions( $user ),
 440+ 'label' => '&nbsp;',
 441+ 'section' => 'rendering/skin',
 442+ );
462443
463444 # Create links to user CSS/JS pages for all skins
464445 # This code is basically copied from generateSkinOptions(). It'd
465 - # be nice to somehow merge this back in there to avoid redundancy.
466 - if( $wgAllowUserCss || $wgAllowUserJs ) {
 446+ # be nice to somehow merge this back in there to avoid redundancy.
 447+ if ( $wgAllowUserCss || $wgAllowUserJs ) {
467448 $sk = $user->getSkin();
468449 $linkTools = array();
469 - if( $wgAllowUserCss ) {
 450+
 451+ if ( $wgAllowUserCss ) {
470452 $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/common.css' );
471453 $linkTools[] = $sk->link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) );
472454 }
473 - if( $wgAllowUserJs ) {
 455+
 456+ if ( $wgAllowUserJs ) {
474457 $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/common.js' );
475458 $linkTools[] = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
476459 }
477 - $defaultPreferences['commoncssjs'] =
478 - array(
479 - 'type' => 'info',
480 - 'raw' => true,
481 - 'default' => $wgLang->pipeList( $linkTools ),
482 - 'label-message' => 'prefs-common-css-js',
483 - 'section' => 'rendering/skin',
484 - );
 460+
 461+ $defaultPreferences['commoncssjs'] = array(
 462+ 'type' => 'info',
 463+ 'raw' => true,
 464+ 'default' => $wgLang->pipeList( $linkTools ),
 465+ 'label-message' => 'prefs-common-css-js',
 466+ 'section' => 'rendering/skin',
 467+ );
485468 }
486469
487470 $selectedSkin = $user->getOption( 'skin' );
488471 if ( in_array( $selectedSkin, array( 'cologneblue', 'standard' ) ) ) {
489472 global $wgLang;
 473+
490474 $settings = array_flip( $wgLang->getQuickbarSettings() );
491475
492 - $defaultPreferences['quickbar'] =
493 - array(
494 - 'type' => 'radio',
495 - 'options' => $settings,
496 - 'section' => 'rendering/skin',
497 - 'label-message' => 'qbsettings',
498 - );
 476+ $defaultPreferences['quickbar'] = array(
 477+ 'type' => 'radio',
 478+ 'options' => $settings,
 479+ 'section' => 'rendering/skin',
 480+ 'label-message' => 'qbsettings',
 481+ );
499482 }
500483 }
501484
502485 static function mathPreferences( $user, &$defaultPreferences ) {
503486 ## Math #####################################
504487 global $wgUseTeX, $wgLang;
505 - if( $wgUseTeX ) {
506 - $defaultPreferences['math'] =
507 - array(
508 - 'type' => 'radio',
509 - 'options' =>
510 - array_flip( array_map( 'wfMsgHtml', $wgLang->getMathNames() ) ),
511 - 'label' => '&nbsp;',
512 - 'section' => 'rendering/math',
513 - );
 488+ if ( $wgUseTeX ) {
 489+ $defaultPreferences['math'] = array(
 490+ 'type' => 'radio',
 491+ 'options' => array_flip( array_map( 'wfMsgHtml', $wgLang->getMathNames() ) ),
 492+ 'label' => '&nbsp;',
 493+ 'section' => 'rendering/math',
 494+ );
514495 }
515496 }
516497
517498 static function filesPreferences( $user, &$defaultPreferences ) {
518499 ## Files #####################################
519 - $defaultPreferences['imagesize'] =
520 - array(
521 - 'type' => 'select',
522 - 'options' => self::getImageSizes(),
523 - 'label-message' => 'imagemaxsize',
524 - 'section' => 'rendering/files',
525 - );
526 - $defaultPreferences['thumbsize'] =
527 - array(
528 - 'type' => 'select',
529 - 'options' => self::getThumbSizes(),
530 - 'label-message' => 'thumbsize',
531 - 'section' => 'rendering/files',
532 - );
 500+ $defaultPreferences['imagesize'] = array(
 501+ 'type' => 'select',
 502+ 'options' => self::getImageSizes(),
 503+ 'label-message' => 'imagemaxsize',
 504+ 'section' => 'rendering/files',
 505+ );
 506+ $defaultPreferences['thumbsize'] = array(
 507+ 'type' => 'select',
 508+ 'options' => self::getThumbSizes(),
 509+ 'label-message' => 'thumbsize',
 510+ 'section' => 'rendering/files',
 511+ );
533512 }
534513
535514 static function datetimePreferences( $user, &$defaultPreferences ) {
@@ -536,14 +515,13 @@
537516
538517 ## Date and time #####################################
539518 $dateOptions = self::getDateOptions();
540 - if( $dateOptions ) {
541 - $defaultPreferences['date'] =
542 - array(
543 - 'type' => 'radio',
544 - 'options' => $dateOptions,
545 - 'label' => '&nbsp;',
546 - 'section' => 'datetime/dateformat',
547 - );
 519+ if ( $dateOptions ) {
 520+ $defaultPreferences['date'] = array(
 521+ 'type' => 'radio',
 522+ 'options' => $dateOptions,
 523+ 'label' => '&nbsp;',
 524+ 'section' => 'datetime/dateformat',
 525+ );
548526 }
549527
550528 // Info
@@ -552,368 +530,339 @@
553531 $nowserver = $wgLang->time( $now, false ) .
554532 Xml::hidden( 'wpServerTime', substr( $now, 8, 2 ) * 60 + substr( $now, 10, 2 ) );
555533
556 - $defaultPreferences['nowserver'] =
557 - array(
558 - 'type' => 'info',
559 - 'raw' => 1,
560 - 'label-message' => 'servertime',
561 - 'default' => $nowserver,
562 - 'section' => 'datetime/timeoffset',
563 - );
 534+ $defaultPreferences['nowserver'] = array(
 535+ 'type' => 'info',
 536+ 'raw' => 1,
 537+ 'label-message' => 'servertime',
 538+ 'default' => $nowserver,
 539+ 'section' => 'datetime/timeoffset',
 540+ );
564541
565 - $defaultPreferences['nowlocal'] =
566 - array(
567 - 'type' => 'info',
568 - 'raw' => 1,
569 - 'label-message' => 'localtime',
570 - 'default' => $nowlocal,
571 - 'section' => 'datetime/timeoffset',
572 - );
 542+ $defaultPreferences['nowlocal'] = array(
 543+ 'type' => 'info',
 544+ 'raw' => 1,
 545+ 'label-message' => 'localtime',
 546+ 'default' => $nowlocal,
 547+ 'section' => 'datetime/timeoffset',
 548+ );
573549
574550 // Grab existing pref.
575551 $tzOffset = $user->getOption( 'timecorrection' );
576552 $tz = explode( '|', $tzOffset, 2 );
577553
578554 $tzSetting = $tzOffset;
579 - if( count( $tz ) > 1 && $tz[0] == 'Offset' ) {
 555+ if ( count( $tz ) > 1 && $tz[0] == 'Offset' ) {
580556 $minDiff = $tz[1];
581 - $tzSetting = sprintf( '%+03d:%02d', floor( $minDiff/60 ), abs( $minDiff )%60 );
 557+ $tzSetting = sprintf( '%+03d:%02d', floor( $minDiff / 60 ), abs( $minDiff ) % 60 );
582558 }
583559
584 - $defaultPreferences['timecorrection'] =
585 - array(
586 - 'class' => 'HTMLSelectOrOtherField',
587 - 'label-message' => 'timezonelegend',
588 - 'options' => self::getTimezoneOptions(),
589 - 'default' => $tzSetting,
590 - 'size' => 20,
591 - 'section' => 'datetime/timeoffset',
592 - );
 560+ $defaultPreferences['timecorrection'] = array(
 561+ 'class' => 'HTMLSelectOrOtherField',
 562+ 'label-message' => 'timezonelegend',
 563+ 'options' => self::getTimezoneOptions(),
 564+ 'default' => $tzSetting,
 565+ 'size' => 20,
 566+ 'section' => 'datetime/timeoffset',
 567+ );
593568 }
594569
595570 static function renderingPreferences( $user, &$defaultPreferences ) {
596571 ## Page Rendering ##############################
597572 global $wgAllowUserCssPrefs;
598 - if( $wgAllowUserCssPrefs ){
599 - $defaultPreferences['underline'] =
600 - array(
601 - 'type' => 'select',
602 - 'options' => array(
603 - wfMsg( 'underline-never' ) => 0,
604 - wfMsg( 'underline-always' ) => 1,
605 - wfMsg( 'underline-default' ) => 2,
606 - ),
607 - 'label-message' => 'tog-underline',
608 - 'section' => 'rendering/advancedrendering',
609 - );
 573+ if ( $wgAllowUserCssPrefs ) {
 574+ $defaultPreferences['underline'] = array(
 575+ 'type' => 'select',
 576+ 'options' => array(
 577+ wfMsg( 'underline-never' ) => 0,
 578+ wfMsg( 'underline-always' ) => 1,
 579+ wfMsg( 'underline-default' ) => 2,
 580+ ),
 581+ 'label-message' => 'tog-underline',
 582+ 'section' => 'rendering/advancedrendering',
 583+ );
610584 }
611585
612586 $stubThresholdValues = array( 0, 50, 100, 500, 1000, 2000, 5000, 10000 );
613587 $stubThresholdOptions = array();
614 - foreach( $stubThresholdValues as $value ) {
 588+ foreach ( $stubThresholdValues as $value ) {
615589 $stubThresholdOptions[wfMsg( 'size-bytes', $value )] = $value;
616590 }
617591
618 - $defaultPreferences['stubthreshold'] =
619 - array(
620 - 'type' => 'selectorother',
621 - 'section' => 'rendering/advancedrendering',
622 - 'options' => $stubThresholdOptions,
623 - 'size' => 20,
624 - 'label' => wfMsg( 'stub-threshold' ), // Raw HTML message. Yay?
625 - );
626 - if( $wgAllowUserCssPrefs ){
627 - $defaultPreferences['highlightbroken'] =
628 - array(
629 - 'type' => 'toggle',
630 - 'section' => 'rendering/advancedrendering',
631 - 'label' => wfMsg( 'tog-highlightbroken' ), // Raw HTML
632 - );
633 - $defaultPreferences['showtoc'] =
634 - array(
635 - 'type' => 'toggle',
636 - 'section' => 'rendering/advancedrendering',
637 - 'label-message' => 'tog-showtoc',
638 - );
 592+ $defaultPreferences['stubthreshold'] = array(
 593+ 'type' => 'selectorother',
 594+ 'section' => 'rendering/advancedrendering',
 595+ 'options' => $stubThresholdOptions,
 596+ 'size' => 20,
 597+ 'label' => wfMsg( 'stub-threshold' ), // Raw HTML message. Yay?
 598+ );
 599+
 600+ if ( $wgAllowUserCssPrefs ) {
 601+ $defaultPreferences['highlightbroken'] = array(
 602+ 'type' => 'toggle',
 603+ 'section' => 'rendering/advancedrendering',
 604+ 'label' => wfMsg( 'tog-highlightbroken' ), // Raw HTML
 605+ );
 606+ $defaultPreferences['showtoc'] = array(
 607+ 'type' => 'toggle',
 608+ 'section' => 'rendering/advancedrendering',
 609+ 'label-message' => 'tog-showtoc',
 610+ );
639611 }
640 - $defaultPreferences['nocache'] =
641 - array(
642 - 'type' => 'toggle',
643 - 'label-message' => 'tog-nocache',
644 - 'section' => 'rendering/advancedrendering',
645 - );
646 - $defaultPreferences['showhiddencats'] =
647 - array(
648 - 'type' => 'toggle',
649 - 'section' => 'rendering/advancedrendering',
650 - 'label-message' => 'tog-showhiddencats'
651 - );
652 - $defaultPreferences['showjumplinks'] =
653 - array(
654 - 'type' => 'toggle',
655 - 'section' => 'rendering/advancedrendering',
656 - 'label-message' => 'tog-showjumplinks',
657 - );
658 - if( $wgAllowUserCssPrefs ){
659 - $defaultPreferences['justify'] =
660 - array(
661 - 'type' => 'toggle',
662 - 'section' => 'rendering/advancedrendering',
663 - 'label-message' => 'tog-justify',
664 - );
 612+ $defaultPreferences['nocache'] = array(
 613+ 'type' => 'toggle',
 614+ 'label-message' => 'tog-nocache',
 615+ 'section' => 'rendering/advancedrendering',
 616+ );
 617+ $defaultPreferences['showhiddencats'] = array(
 618+ 'type' => 'toggle',
 619+ 'section' => 'rendering/advancedrendering',
 620+ 'label-message' => 'tog-showhiddencats'
 621+ );
 622+ $defaultPreferences['showjumplinks'] = array(
 623+ 'type' => 'toggle',
 624+ 'section' => 'rendering/advancedrendering',
 625+ 'label-message' => 'tog-showjumplinks',
 626+ );
 627+
 628+ if ( $wgAllowUserCssPrefs ) {
 629+ $defaultPreferences['justify'] = array(
 630+ 'type' => 'toggle',
 631+ 'section' => 'rendering/advancedrendering',
 632+ 'label-message' => 'tog-justify',
 633+ );
665634 }
666 - $defaultPreferences['numberheadings'] =
667 - array(
668 - 'type' => 'toggle',
669 - 'section' => 'rendering/advancedrendering',
670 - 'label-message' => 'tog-numberheadings',
671 - );
 635+
 636+ $defaultPreferences['numberheadings'] = array(
 637+ 'type' => 'toggle',
 638+ 'section' => 'rendering/advancedrendering',
 639+ 'label-message' => 'tog-numberheadings',
 640+ );
672641 }
673642
674643 static function editingPreferences( $user, &$defaultPreferences ) {
675644 global $wgUseExternalEditor, $wgLivePreview, $wgAllowUserCssPrefs;
676645
677646 ## Editing #####################################
678 - $defaultPreferences['cols'] =
679 - array(
680 - 'type' => 'int',
681 - 'label-message' => 'columns',
682 - 'section' => 'editing/textboxsize',
683 - 'min' => 4,
684 - 'max' => 1000,
685 - );
686 - $defaultPreferences['rows'] =
687 - array(
688 - 'type' => 'int',
689 - 'label-message' => 'rows',
690 - 'section' => 'editing/textboxsize',
691 - 'min' => 4,
692 - 'max' => 1000,
693 - );
694 - if( $wgAllowUserCssPrefs ){
695 - $defaultPreferences['editfont'] =
696 - array(
697 - 'type' => 'select',
698 - 'section' => 'editing/advancedediting',
699 - 'label-message' => 'editfont-style',
700 - 'options' => array(
701 - wfMsg( 'editfont-default' ) => 'default',
702 - wfMsg( 'editfont-monospace' ) => 'monospace',
703 - wfMsg( 'editfont-sansserif' ) => 'sans-serif',
704 - wfMsg( 'editfont-serif' ) => 'serif',
705 - )
706 - );
 647+ $defaultPreferences['cols'] = array(
 648+ 'type' => 'int',
 649+ 'label-message' => 'columns',
 650+ 'section' => 'editing/textboxsize',
 651+ 'min' => 4,
 652+ 'max' => 1000,
 653+ );
 654+ $defaultPreferences['rows'] = array(
 655+ 'type' => 'int',
 656+ 'label-message' => 'rows',
 657+ 'section' => 'editing/textboxsize',
 658+ 'min' => 4,
 659+ 'max' => 1000,
 660+ );
 661+
 662+ if ( $wgAllowUserCssPrefs ) {
 663+ $defaultPreferences['editfont'] = array(
 664+ 'type' => 'select',
 665+ 'section' => 'editing/advancedediting',
 666+ 'label-message' => 'editfont-style',
 667+ 'options' => array(
 668+ wfMsg( 'editfont-default' ) => 'default',
 669+ wfMsg( 'editfont-monospace' ) => 'monospace',
 670+ wfMsg( 'editfont-sansserif' ) => 'sans-serif',
 671+ wfMsg( 'editfont-serif' ) => 'serif',
 672+ )
 673+ );
707674 }
708 - $defaultPreferences['previewontop'] =
709 - array(
710 - 'type' => 'toggle',
711 - 'section' => 'editing/advancedediting',
712 - 'label-message' => 'tog-previewontop',
713 - );
714 - $defaultPreferences['previewonfirst'] =
715 - array(
716 - 'type' => 'toggle',
717 - 'section' => 'editing/advancedediting',
718 - 'label-message' => 'tog-previewonfirst',
719 - );
720 - if( $wgAllowUserCssPrefs ){
721 - $defaultPreferences['editsection'] =
722 - array(
723 - 'type' => 'toggle',
724 - 'section' => 'editing/advancedediting',
725 - 'label-message' => 'tog-editsection',
726 - );
 675+ $defaultPreferences['previewontop'] = array(
 676+ 'type' => 'toggle',
 677+ 'section' => 'editing/advancedediting',
 678+ 'label-message' => 'tog-previewontop',
 679+ );
 680+ $defaultPreferences['previewonfirst'] = array(
 681+ 'type' => 'toggle',
 682+ 'section' => 'editing/advancedediting',
 683+ 'label-message' => 'tog-previewonfirst',
 684+ );
 685+
 686+ if ( $wgAllowUserCssPrefs ) {
 687+ $defaultPreferences['editsection'] = array(
 688+ 'type' => 'toggle',
 689+ 'section' => 'editing/advancedediting',
 690+ 'label-message' => 'tog-editsection',
 691+ );
727692 }
728 - $defaultPreferences['editsectiononrightclick'] =
729 - array(
730 - 'type' => 'toggle',
731 - 'section' => 'editing/advancedediting',
732 - 'label-message' => 'tog-editsectiononrightclick',
733 - );
734 - $defaultPreferences['editondblclick'] =
735 - array(
736 - 'type' => 'toggle',
737 - 'section' => 'editing/advancedediting',
738 - 'label-message' => 'tog-editondblclick',
739 - );
740 - $defaultPreferences['showtoolbar'] =
741 - array(
742 - 'type' => 'toggle',
743 - 'section' => 'editing/advancedediting',
744 - 'label-message' => 'tog-showtoolbar',
745 - );
746 - $defaultPreferences['minordefault'] =
747 - array(
748 - 'type' => 'toggle',
749 - 'section' => 'editing/advancedediting',
750 - 'label-message' => 'tog-minordefault',
751 - );
 693+ $defaultPreferences['editsectiononrightclick'] = array(
 694+ 'type' => 'toggle',
 695+ 'section' => 'editing/advancedediting',
 696+ 'label-message' => 'tog-editsectiononrightclick',
 697+ );
 698+ $defaultPreferences['editondblclick'] = array(
 699+ 'type' => 'toggle',
 700+ 'section' => 'editing/advancedediting',
 701+ 'label-message' => 'tog-editondblclick',
 702+ );
 703+ $defaultPreferences['showtoolbar'] = array(
 704+ 'type' => 'toggle',
 705+ 'section' => 'editing/advancedediting',
 706+ 'label-message' => 'tog-showtoolbar',
 707+ );
 708+ $defaultPreferences['minordefault'] = array(
 709+ 'type' => 'toggle',
 710+ 'section' => 'editing/advancedediting',
 711+ 'label-message' => 'tog-minordefault',
 712+ );
752713
753714 if ( $wgUseExternalEditor ) {
754 - $defaultPreferences['externaleditor'] =
755 - array(
756 - 'type' => 'toggle',
757 - 'section' => 'editing/advancedediting',
758 - 'label-message' => 'tog-externaleditor',
759 - );
760 - $defaultPreferences['externaldiff'] =
761 - array(
762 - 'type' => 'toggle',
763 - 'section' => 'editing/advancedediting',
764 - 'label-message' => 'tog-externaldiff',
765 - );
 715+ $defaultPreferences['externaleditor'] = array(
 716+ 'type' => 'toggle',
 717+ 'section' => 'editing/advancedediting',
 718+ 'label-message' => 'tog-externaleditor',
 719+ );
 720+ $defaultPreferences['externaldiff'] = array(
 721+ 'type' => 'toggle',
 722+ 'section' => 'editing/advancedediting',
 723+ 'label-message' => 'tog-externaldiff',
 724+ );
766725 }
767726
768 - $defaultPreferences['forceeditsummary'] =
769 - array(
770 - 'type' => 'toggle',
771 - 'section' => 'editing/advancedediting',
772 - 'label-message' => 'tog-forceeditsummary',
773 - );
 727+ $defaultPreferences['forceeditsummary'] = array(
 728+ 'type' => 'toggle',
 729+ 'section' => 'editing/advancedediting',
 730+ 'label-message' => 'tog-forceeditsummary',
 731+ );
 732+
774733 if ( $wgLivePreview ) {
775 - $defaultPreferences['uselivepreview'] =
776 - array(
777 - 'type' => 'toggle',
778 - 'section' => 'editing/advancedediting',
779 - 'label-message' => 'tog-uselivepreview',
780 - );
 734+ $defaultPreferences['uselivepreview'] = array(
 735+ 'type' => 'toggle',
 736+ 'section' => 'editing/advancedediting',
 737+ 'label-message' => 'tog-uselivepreview',
 738+ );
781739 }
782740 }
783741
784742 static function rcPreferences( $user, &$defaultPreferences ) {
785743 global $wgRCMaxAge, $wgUseRCPatrol, $wgLang;
 744+
786745 ## RecentChanges #####################################
787 - $defaultPreferences['rcdays'] =
788 - array(
789 - 'type' => 'float',
790 - 'label-message' => 'recentchangesdays',
791 - 'section' => 'rc/display',
792 - 'min' => 1,
793 - 'max' => ceil( $wgRCMaxAge / ( 3600*24 ) ),
794 - 'help' => wfMsgExt( 'recentchangesdays-max', array( 'parsemag' ), $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600*24 ) ) ) ),
795 - );
796 - $defaultPreferences['rclimit'] =
797 - array(
798 - 'type' => 'int',
799 - 'label-message' => 'recentchangescount',
800 - 'help-message' => 'prefs-help-recentchangescount',
801 - 'section' => 'rc/display',
802 - );
803 - $defaultPreferences['usenewrc'] =
804 - array(
805 - 'type' => 'toggle',
806 - 'label-message' => 'tog-usenewrc',
807 - 'section' => 'rc/advancedrc',
808 - );
809 - $defaultPreferences['hideminor'] =
810 - array(
811 - 'type' => 'toggle',
812 - 'label-message' => 'tog-hideminor',
813 - 'section' => 'rc/advancedrc',
814 - );
 746+ $defaultPreferences['rcdays'] = array(
 747+ 'type' => 'float',
 748+ 'label-message' => 'recentchangesdays',
 749+ 'section' => 'rc/display',
 750+ 'min' => 1,
 751+ 'max' => ceil( $wgRCMaxAge / ( 3600 * 24 ) ),
 752+ 'help' => wfMsgExt(
 753+ 'recentchangesdays-max',
 754+ array( 'parsemag' ),
 755+ $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) )
 756+ )
 757+ );
 758+ $defaultPreferences['rclimit'] = array(
 759+ 'type' => 'int',
 760+ 'label-message' => 'recentchangescount',
 761+ 'help-message' => 'prefs-help-recentchangescount',
 762+ 'section' => 'rc/display',
 763+ );
 764+ $defaultPreferences['usenewrc'] = array(
 765+ 'type' => 'toggle',
 766+ 'label-message' => 'tog-usenewrc',
 767+ 'section' => 'rc/advancedrc',
 768+ );
 769+ $defaultPreferences['hideminor'] = array(
 770+ 'type' => 'toggle',
 771+ 'label-message' => 'tog-hideminor',
 772+ 'section' => 'rc/advancedrc',
 773+ );
815774
816 - if( $wgUseRCPatrol ) {
817 - $defaultPreferences['hidepatrolled'] =
818 - array(
819 - 'type' => 'toggle',
820 - 'section' => 'rc/advancedrc',
821 - 'label-message' => 'tog-hidepatrolled',
822 - );
823 - $defaultPreferences['newpageshidepatrolled'] =
824 - array(
825 - 'type' => 'toggle',
826 - 'section' => 'rc/advancedrc',
827 - 'label-message' => 'tog-newpageshidepatrolled',
828 - );
 775+ if ( $wgUseRCPatrol ) {
 776+ $defaultPreferences['hidepatrolled'] = array(
 777+ 'type' => 'toggle',
 778+ 'section' => 'rc/advancedrc',
 779+ 'label-message' => 'tog-hidepatrolled',
 780+ );
 781+ $defaultPreferences['newpageshidepatrolled'] = array(
 782+ 'type' => 'toggle',
 783+ 'section' => 'rc/advancedrc',
 784+ 'label-message' => 'tog-newpageshidepatrolled',
 785+ );
829786 }
830787
831788 global $wgRCShowWatchingUsers;
832 - if( $wgRCShowWatchingUsers ) {
833 - $defaultPreferences['shownumberswatching'] =
834 - array(
835 - 'type' => 'toggle',
836 - 'section' => 'rc/advancedrc',
837 - 'label-message' => 'tog-shownumberswatching',
838 - );
 789+ if ( $wgRCShowWatchingUsers ) {
 790+ $defaultPreferences['shownumberswatching'] = array(
 791+ 'type' => 'toggle',
 792+ 'section' => 'rc/advancedrc',
 793+ 'label-message' => 'tog-shownumberswatching',
 794+ );
839795 }
840796 }
841797
842798 static function watchlistPreferences( $user, &$defaultPreferences ) {
843799 global $wgUseRCPatrol, $wgEnableAPI;
 800+
844801 ## Watchlist #####################################
845 - $defaultPreferences['watchlistdays'] =
846 - array(
847 - 'type' => 'float',
848 - 'min' => 0,
849 - 'max' => 7,
850 - 'section' => 'watchlist/display',
851 - 'help' => wfMsgHtml( 'prefs-watchlist-days-max' ),
852 - 'label-message' => 'prefs-watchlist-days',
853 - );
854 - $defaultPreferences['wllimit'] =
855 - array(
856 - 'type' => 'int',
857 - 'min' => 0,
858 - 'max' => 1000,
859 - 'label-message' => 'prefs-watchlist-edits',
860 - 'help' => wfMsgHtml( 'prefs-watchlist-edits-max' ),
861 - 'section' => 'watchlist/display',
862 - );
863 - $defaultPreferences['extendwatchlist'] =
864 - array(
865 - 'type' => 'toggle',
866 - 'section' => 'watchlist/advancedwatchlist',
867 - 'label-message' => 'tog-extendwatchlist',
868 - );
869 - $defaultPreferences['watchlisthideminor'] =
870 - array(
871 - 'type' => 'toggle',
872 - 'section' => 'watchlist/advancedwatchlist',
873 - 'label-message' => 'tog-watchlisthideminor',
874 - );
875 - $defaultPreferences['watchlisthidebots'] =
876 - array(
877 - 'type' => 'toggle',
878 - 'section' => 'watchlist/advancedwatchlist',
879 - 'label-message' => 'tog-watchlisthidebots',
880 - );
881 - $defaultPreferences['watchlisthideown'] =
882 - array(
883 - 'type' => 'toggle',
884 - 'section' => 'watchlist/advancedwatchlist',
885 - 'label-message' => 'tog-watchlisthideown',
886 - );
887 - $defaultPreferences['watchlisthideanons'] =
888 - array(
889 - 'type' => 'toggle',
890 - 'section' => 'watchlist/advancedwatchlist',
891 - 'label-message' => 'tog-watchlisthideanons',
892 - );
893 - $defaultPreferences['watchlisthideliu'] =
894 - array(
895 - 'type' => 'toggle',
896 - 'section' => 'watchlist/advancedwatchlist',
897 - 'label-message' => 'tog-watchlisthideliu',
898 - );
 802+ $defaultPreferences['watchlistdays'] = array(
 803+ 'type' => 'float',
 804+ 'min' => 0,
 805+ 'max' => 7,
 806+ 'section' => 'watchlist/display',
 807+ 'help' => wfMsgHtml( 'prefs-watchlist-days-max' ),
 808+ 'label-message' => 'prefs-watchlist-days',
 809+ );
 810+ $defaultPreferences['wllimit'] = array(
 811+ 'type' => 'int',
 812+ 'min' => 0,
 813+ 'max' => 1000,
 814+ 'label-message' => 'prefs-watchlist-edits',
 815+ 'help' => wfMsgHtml( 'prefs-watchlist-edits-max' ),
 816+ 'section' => 'watchlist/display',
 817+ );
 818+ $defaultPreferences['extendwatchlist'] = array(
 819+ 'type' => 'toggle',
 820+ 'section' => 'watchlist/advancedwatchlist',
 821+ 'label-message' => 'tog-extendwatchlist',
 822+ );
 823+ $defaultPreferences['watchlisthideminor'] = array(
 824+ 'type' => 'toggle',
 825+ 'section' => 'watchlist/advancedwatchlist',
 826+ 'label-message' => 'tog-watchlisthideminor',
 827+ );
 828+ $defaultPreferences['watchlisthidebots'] = array(
 829+ 'type' => 'toggle',
 830+ 'section' => 'watchlist/advancedwatchlist',
 831+ 'label-message' => 'tog-watchlisthidebots',
 832+ );
 833+ $defaultPreferences['watchlisthideown'] = array(
 834+ 'type' => 'toggle',
 835+ 'section' => 'watchlist/advancedwatchlist',
 836+ 'label-message' => 'tog-watchlisthideown',
 837+ );
 838+ $defaultPreferences['watchlisthideanons'] = array(
 839+ 'type' => 'toggle',
 840+ 'section' => 'watchlist/advancedwatchlist',
 841+ 'label-message' => 'tog-watchlisthideanons',
 842+ );
 843+ $defaultPreferences['watchlisthideliu'] = array(
 844+ 'type' => 'toggle',
 845+ 'section' => 'watchlist/advancedwatchlist',
 846+ 'label-message' => 'tog-watchlisthideliu',
 847+ );
 848+
899849 if ( $wgEnableAPI ) {
900850 # Some random gibberish as a proposed default
901851 $hash = sha1( mt_rand() . microtime( true ) );
902 - $defaultPreferences['watchlisttoken'] =
903 - array(
904 - 'type' => 'text',
905 - 'section' => 'watchlist/advancedwatchlist',
906 - 'label-message' => 'prefs-watchlist-token',
907 - 'help' => wfMsgHtml( 'prefs-help-watchlist-token', $hash )
908 - );
 852+
 853+ $defaultPreferences['watchlisttoken'] = array(
 854+ 'type' => 'text',
 855+ 'section' => 'watchlist/advancedwatchlist',
 856+ 'label-message' => 'prefs-watchlist-token',
 857+ 'help' => wfMsgHtml( 'prefs-help-watchlist-token', $hash )
 858+ );
909859 }
910860
911861 if ( $wgUseRCPatrol ) {
912 - $defaultPreferences['watchlisthidepatrolled'] =
913 - array(
914 - 'type' => 'toggle',
915 - 'section' => 'watchlist/advancedwatchlist',
916 - 'label-message' => 'tog-watchlisthidepatrolled',
917 - );
 862+ $defaultPreferences['watchlisthidepatrolled'] = array(
 863+ 'type' => 'toggle',
 864+ 'section' => 'watchlist/advancedwatchlist',
 865+ 'label-message' => 'tog-watchlisthidepatrolled',
 866+ );
918867 }
919868
920869 $watchTypes = array(
@@ -923,11 +872,11 @@
924873 );
925874
926875 // Kinda hacky
927 - if( $user->isAllowed( 'createpage' ) || $user->isAllowed( 'createtalk' ) ) {
 876+ if ( $user->isAllowed( 'createpage' ) || $user->isAllowed( 'createtalk' ) ) {
928877 $watchTypes['read'] = 'watchcreations';
929878 }
930879
931 - foreach( $watchTypes as $action => $pref ) {
 880+ foreach ( $watchTypes as $action => $pref ) {
932881 if ( $user->isAllowed( $action ) ) {
933882 $defaultPreferences[$pref] = array(
934883 'type' => 'toggle',
@@ -942,95 +891,93 @@
943892 global $wgContLang;
944893
945894 ## Search #####################################
946 - $defaultPreferences['searchlimit'] =
947 - array(
948 - 'type' => 'int',
949 - 'label-message' => 'resultsperpage',
950 - 'section' => 'searchoptions/display',
951 - 'min' => 0,
952 - );
953 - $defaultPreferences['contextlines'] =
954 - array(
955 - 'type' => 'int',
956 - 'label-message' => 'contextlines',
957 - 'section' => 'searchoptions/display',
958 - 'min' => 0,
959 - );
960 - $defaultPreferences['contextchars'] =
961 - array(
962 - 'type' => 'int',
963 - 'label-message' => 'contextchars',
964 - 'section' => 'searchoptions/display',
965 - 'min' => 0,
966 - );
 895+ $defaultPreferences['searchlimit'] = array(
 896+ 'type' => 'int',
 897+ 'label-message' => 'resultsperpage',
 898+ 'section' => 'searchoptions/display',
 899+ 'min' => 0,
 900+ );
 901+ $defaultPreferences['contextlines'] = array(
 902+ 'type' => 'int',
 903+ 'label-message' => 'contextlines',
 904+ 'section' => 'searchoptions/display',
 905+ 'min' => 0,
 906+ );
 907+ $defaultPreferences['contextchars'] = array(
 908+ 'type' => 'int',
 909+ 'label-message' => 'contextchars',
 910+ 'section' => 'searchoptions/display',
 911+ 'min' => 0,
 912+ );
 913+
967914 global $wgEnableMWSuggest;
968 - if( $wgEnableMWSuggest ) {
969 - $defaultPreferences['disablesuggest'] =
970 - array(
971 - 'type' => 'toggle',
972 - 'label-message' => 'mwsuggest-disable',
973 - 'section' => 'searchoptions/display',
974 - );
 915+ if ( $wgEnableMWSuggest ) {
 916+ $defaultPreferences['disablesuggest'] = array(
 917+ 'type' => 'toggle',
 918+ 'label-message' => 'mwsuggest-disable',
 919+ 'section' => 'searchoptions/display',
 920+ );
975921 }
976922
977 - $defaultPreferences['searcheverything'] =
978 - array(
979 - 'type' => 'toggle',
980 - 'label-message' => 'searcheverything-enable',
981 - 'section' => 'searchoptions/advancedsearchoptions',
982 - );
 923+ $defaultPreferences['searcheverything'] = array(
 924+ 'type' => 'toggle',
 925+ 'label-message' => 'searcheverything-enable',
 926+ 'section' => 'searchoptions/advancedsearchoptions',
 927+ );
983928
984929 // Searchable namespaces back-compat with old format
985930 $searchableNamespaces = SearchEngine::searchableNamespaces();
986931
987932 $nsOptions = array();
988 - foreach( $wgContLang->getNamespaces() as $ns => $name ) {
989 - if( $ns < 0 ) continue;
 933+
 934+ foreach ( $wgContLang->getNamespaces() as $ns => $name ) {
 935+ if ( $ns < 0 ) {
 936+ continue;
 937+ }
 938+
990939 $displayNs = str_replace( '_', ' ', $name );
991940
992 - if( !$displayNs ) $displayNs = wfMsg( 'blanknamespace' );
 941+ if ( !$displayNs ) {
 942+ $displayNs = wfMsg( 'blanknamespace' );
 943+ }
993944
994945 $displayNs = htmlspecialchars( $displayNs );
995946 $nsOptions[$displayNs] = $ns;
996947 }
997948
998 - $defaultPreferences['searchnamespaces'] =
999 - array(
1000 - 'type' => 'multiselect',
1001 - 'label-message' => 'defaultns',
1002 - 'options' => $nsOptions,
1003 - 'section' => 'searchoptions/advancedsearchoptions',
1004 - 'prefix' => 'searchNs',
1005 - );
 949+ $defaultPreferences['searchnamespaces'] = array(
 950+ 'type' => 'multiselect',
 951+ 'label-message' => 'defaultns',
 952+ 'options' => $nsOptions,
 953+ 'section' => 'searchoptions/advancedsearchoptions',
 954+ 'prefix' => 'searchNs',
 955+ );
1006956 }
1007957
1008958 static function miscPreferences( $user, &$defaultPreferences ) {
1009959 ## Misc #####################################
1010 - $defaultPreferences['diffonly'] =
1011 - array(
1012 - 'type' => 'toggle',
1013 - 'section' => 'misc/diffs',
1014 - 'label-message' => 'tog-diffonly',
1015 - );
1016 - $defaultPreferences['norollbackdiff'] =
1017 - array(
1018 - 'type' => 'toggle',
1019 - 'section' => 'misc/diffs',
1020 - 'label-message' => 'tog-norollbackdiff',
1021 - );
 960+ $defaultPreferences['diffonly'] = array(
 961+ 'type' => 'toggle',
 962+ 'section' => 'misc/diffs',
 963+ 'label-message' => 'tog-diffonly',
 964+ );
 965+ $defaultPreferences['norollbackdiff'] = array(
 966+ 'type' => 'toggle',
 967+ 'section' => 'misc/diffs',
 968+ 'label-message' => 'tog-norollbackdiff',
 969+ );
1022970
1023971 // Stuff from Language::getExtraUserToggles()
1024972 global $wgContLang;
1025973
1026974 $toggles = $wgContLang->getExtraUserToggles();
1027975
1028 - foreach( $toggles as $toggle ) {
1029 - $defaultPreferences[$toggle] =
1030 - array(
1031 - 'type' => 'toggle',
1032 - 'section' => 'personal/i18n',
1033 - 'label-message' => "tog-$toggle",
1034 - );
 976+ foreach ( $toggles as $toggle ) {
 977+ $defaultPreferences[$toggle] = array(
 978+ 'type' => 'toggle',
 979+ 'section' => 'personal/i18n',
 980+ 'label-message' => "tog-$toggle",
 981+ );
1035982 }
1036983 }
1037984
@@ -1044,9 +991,11 @@
1045992
1046993 $mptitle = Title::newMainPage();
1047994 $previewtext = wfMsgHtml( 'skin-preview' );
 995+
1048996 # Only show members of Skin::getSkinNames() rather than
1049997 # $skinNames (skins is all skin names from Language.php)
1050998 $validSkinNames = Skin::getUsableSkins();
 999+
10511000 # Sort by UI skin name. First though need to update validSkinNames as sometimes
10521001 # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
10531002 foreach ( $validSkinNames as $skinkey => &$skinname ) {
@@ -1059,11 +1008,11 @@
10601009 asort( $validSkinNames );
10611010 $sk = $user->getSkin();
10621011
1063 - foreach( $validSkinNames as $skinkey => $sn ) {
 1012+ foreach ( $validSkinNames as $skinkey => $sn ) {
10641013 $linkTools = array();
10651014
10661015 # Mark the default skin
1067 - if( $skinkey == $wgDefaultSkin ) {
 1016+ if ( $skinkey == $wgDefaultSkin ) {
10681017 $linkTools[] = wfMsgHtml( 'default' );
10691018 }
10701019
@@ -1072,11 +1021,12 @@
10731022 $linkTools[] = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
10741023
10751024 # Create links to user CSS/JS pages
1076 - if( $wgAllowUserCss ) {
 1025+ if ( $wgAllowUserCss ) {
10771026 $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.css' );
10781027 $linkTools[] = $sk->link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) );
10791028 }
1080 - if( $wgAllowUserJs ) {
 1029+
 1030+ if ( $wgAllowUserJs ) {
10811031 $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.js' );
10821032 $linkTools[] = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
10831033 }
@@ -1094,11 +1044,12 @@
10951045
10961046 $ret = array();
10971047
1098 - if( $dateopts ) {
 1048+ if ( $dateopts ) {
10991049 if ( !in_array( 'default', $dateopts ) ) {
11001050 $dateopts[] = 'default'; // Make sure default is always valid
11011051 // Bug 19237
11021052 }
 1053+
11031054 // KLUGE: site default might not be valid for user language
11041055 global $wgDefaultUserOptions;
11051056 if ( !in_array( $wgDefaultUserOptions['date'], $dateopts ) ) {
@@ -1107,8 +1058,8 @@
11081059
11091060 $idCnt = 0;
11101061 $epoch = wfTimestampNow();
1111 - foreach( $dateopts as $key ) {
1112 - if( $key == 'default' ) {
 1062+ foreach ( $dateopts as $key ) {
 1063+ if ( $key == 'default' ) {
11131064 $formatted = wfMsgHtml( 'datedefault' );
11141065 } else {
11151066 $formatted = htmlspecialchars( $wgLang->timeanddate( $epoch, false, $key ) );
@@ -1147,14 +1098,13 @@
11481099
11491100 static function validateSignature( $signature, $alldata ) {
11501101 global $wgParser, $wgMaxSigChars, $wgLang;
1151 - if( mb_strlen( $signature ) > $wgMaxSigChars ) {
1152 - return
1153 - Xml::element( 'span', array( 'class' => 'error' ),
1154 - wfMsgExt( 'badsiglength', 'parsemag',
1155 - $wgLang->formatNum( $wgMaxSigChars )
1156 - )
1157 - );
1158 - } elseif( !empty( $alldata['fancysig'] ) &&
 1102+ if ( mb_strlen( $signature ) > $wgMaxSigChars ) {
 1103+ return Xml::element( 'span', array( 'class' => 'error' ),
 1104+ wfMsgExt( 'badsiglength', 'parsemag',
 1105+ $wgLang->formatNum( $wgMaxSigChars )
 1106+ )
 1107+ );
 1108+ } elseif ( !empty( $alldata['fancysig'] ) &&
11591109 false === $wgParser->validateSig( $signature ) ) {
11601110 return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'badsig' ) );
11611111 } else {
@@ -1164,7 +1114,7 @@
11651115
11661116 static function cleanSignature( $signature, $alldata ) {
11671117 global $wgParser;
1168 - if( $alldata['fancysig'] ) {
 1118+ if ( $alldata['fancysig'] ) {
11691119 $signature = $wgParser->cleanSig( $signature );
11701120 } else {
11711121 // When no fancy sig used, make sure ~{3,5} get removed.
@@ -1180,7 +1130,7 @@
11811131 }
11821132
11831133 global $wgEmailConfirmToEdit;
1184 - if( $wgEmailConfirmToEdit && !$email ) {
 1134+ if ( $wgEmailConfirmToEdit && !$email ) {
11851135 return wfMsgExt( 'noemailtitle', 'parseinline' );
11861136 }
11871137 return true;
@@ -1234,19 +1184,20 @@
12351185 $z = explode( '/', $tz, 2 );
12361186
12371187 # timezone_identifiers_list() returns a number of
1238 - # backwards-compatibility entries. This filters them out of the
 1188+ # backwards-compatibility entries. This filters them out of the
12391189 # list presented to the user.
1240 - if ( count( $z ) != 2 || !array_key_exists( $z[0], $tzRegions ) )
 1190+ if ( count( $z ) != 2 || !array_key_exists( $z[0], $tzRegions ) ) {
12411191 continue;
 1192+ }
12421193
12431194 # Localize region
12441195 $z[0] = $tzRegions[$z[0]];
12451196
12461197 $minDiff = floor( timezone_offset_get( timezone_open( $tz ), $now ) / 60 );
1247 -
 1198+
12481199 $display = str_replace( '_', ' ', $z[0] . '/' . $z[1] );
12491200 $value = "ZoneInfo|$minDiff|$tz";
1250 -
 1201+
12511202 $opt[$z[0]][$display] = $value;
12521203 }
12531204 }
@@ -1262,11 +1213,11 @@
12631214 default:
12641215 $data = explode( ':', $tz, 2 );
12651216 $minDiff = 0;
1266 - if( count( $data ) == 2 ) {
 1217+ if ( count( $data ) == 2 ) {
12671218 $data[0] = intval( $data[0] );
12681219 $data[1] = intval( $data[1] );
12691220 $minDiff = abs( $data[0] ) * 60 + $data[1];
1270 - if ( $data[0] < 0 ) $minDiff = -$minDiff;
 1221+ if ( $data[0] < 0 ) $minDiff = - $minDiff;
12711222 } else {
12721223 $minDiff = intval( $data[0] ) * 60;
12731224 }
@@ -1274,18 +1225,18 @@
12751226 # Max is +14:00 and min is -12:00, see:
12761227 # http://en.wikipedia.org/wiki/Timezone
12771228 $minDiff = min( $minDiff, 840 ); # 14:00
1278 - $minDiff = max( $minDiff, -720 ); # -12:00
1279 - return 'Offset|'.$minDiff;
 1229+ $minDiff = max( $minDiff, - 720 ); # -12:00
 1230+ return 'Offset|' . $minDiff;
12801231 }
12811232 }
1282 -
 1233+
12831234 static function tryFormSubmit( $formData, $entryPoint = 'internal' ) {
12841235 global $wgUser, $wgEmailAuthentication, $wgEnableEmail;
12851236
12861237 $result = true;
12871238
12881239 // Filter input
1289 - foreach( array_keys( $formData ) as $name ) {
 1240+ foreach ( array_keys( $formData ) as $name ) {
12901241 if ( isset( self::$saveFilters[$name] ) ) {
12911242 $formData[$name] =
12921243 call_user_func( self::$saveFilters[$name], $formData[$name], $formData );
@@ -1298,29 +1249,29 @@
12991250 'emailaddress',
13001251 );
13011252
1302 - if( $wgEnableEmail ) {
 1253+ if ( $wgEnableEmail ) {
13031254 $newaddr = $formData['emailaddress'];
13041255 $oldaddr = $wgUser->getEmail();
1305 - if( ( $newaddr != '' ) && ( $newaddr != $oldaddr ) ) {
 1256+ if ( ( $newaddr != '' ) && ( $newaddr != $oldaddr ) ) {
13061257 # the user has supplied a new email address on the login page
13071258 # new behaviour: set this new emailaddr from login-page into user database record
13081259 $wgUser->setEmail( $newaddr );
13091260 # but flag as "dirty" = unauthenticated
13101261 $wgUser->invalidateEmail();
1311 - if( $wgEmailAuthentication ) {
 1262+ if ( $wgEmailAuthentication ) {
13121263 # Mail a temporary password to the dirty address.
13131264 # User can come back through the confirmation URL to re-enable email.
13141265 $result = $wgUser->sendConfirmationMail( $oldaddr != '' );
1315 - if( WikiError::isError( $result ) ) {
 1266+ if ( WikiError::isError( $result ) ) {
13161267 return wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
1317 - } elseif( $entryPoint == 'ui' ) {
 1268+ } elseif ( $entryPoint == 'ui' ) {
13181269 $result = 'eauth';
13191270 }
13201271 }
13211272 } else {
13221273 $wgUser->setEmail( $newaddr );
13231274 }
1324 - if( $oldaddr != $newaddr ) {
 1275+ if ( $oldaddr != $newaddr ) {
13251276 wfRunHooks( 'PrefsEmailAudit', array( $wgUser, $oldaddr, $newaddr ) );
13261277 }
13271278 }
@@ -1332,14 +1283,15 @@
13331284 $wgUser->setRealName( $realName );
13341285 }
13351286
1336 - foreach( $saveBlacklist as $b )
 1287+ foreach ( $saveBlacklist as $b ) {
13371288 unset( $formData[$b] );
 1289+ }
13381290
13391291 // Keeps old preferences from interfering due to back-compat
13401292 // code, etc.
13411293 $wgUser->resetOptions();
13421294
1343 - foreach( $formData as $key => $value ) {
 1295+ foreach ( $formData as $key => $value ) {
13441296 $wgUser->setOption( $key, $value );
13451297 }
13461298
@@ -1351,14 +1303,17 @@
13521304 public static function tryUISubmit( $formData ) {
13531305 $res = self::tryFormSubmit( $formData, 'ui' );
13541306
1355 - if( $res ) {
 1307+ if ( $res ) {
13561308 $urlOptions = array( 'success' );
1357 - if( $res === 'eauth' )
 1309+
 1310+ if ( $res === 'eauth' ) {
13581311 $urlOptions[] = 'eauth';
 1312+ }
13591313
13601314 $queryString = implode( '&', $urlOptions );
13611315
13621316 $url = SpecialPage::getTitleFor( 'Preferences' )->getFullURL( $queryString );
 1317+
13631318 global $wgOut;
13641319 $wgOut->redirect( $url );
13651320 }
@@ -1371,8 +1326,8 @@
13721327 // Back compat with old format
13731328 $arr = array();
13741329
1375 - foreach( $searchableNamespaces as $ns => $name ) {
1376 - if( $user->getOption( 'searchNs' . $ns ) ) {
 1330+ foreach ( $searchableNamespaces as $ns => $name ) {
 1331+ if ( $user->getOption( 'searchNs' . $ns ) ) {
13771332 $arr[] = $ns;
13781333 }
13791334 }
@@ -1383,7 +1338,6 @@
13841339
13851340 /** Some tweaks to allow js prefs to work */
13861341 class PreferencesForm extends HTMLForm {
1387 -
13881342 function wrapForm( $html ) {
13891343 $html = Xml::tags( 'div', array( 'id' => 'preferences' ), $html );
13901344
@@ -1408,13 +1362,13 @@
14091363 function filterDataForSubmit( $data ) {
14101364 // Support for separating MultiSelect preferences into multiple preferences
14111365 // Due to lack of array support.
1412 - foreach( $this->mFlatFields as $fieldname => $field ) {
 1366+ foreach ( $this->mFlatFields as $fieldname => $field ) {
14131367 $info = $field->mParams;
1414 - if( $field instanceof HTMLMultiSelectField ) {
 1368+ if ( $field instanceof HTMLMultiSelectField ) {
14151369 $options = HTMLFormField::flattenOptions( $info['options'] );
14161370 $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $fieldname;
14171371
1418 - foreach( $options as $opt ) {
 1372+ foreach ( $options as $opt ) {
14191373 $data["$prefix$opt"] = in_array( $opt, $data[$fieldname] );
14201374 }
14211375

Status & tagging log