r73185 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73184‎ | r73185 | r73186 >
Date:00:01, 17 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
Removed unnessecary dependency on UsabilityInitiative.php. Refactored a bit, mostly just naming things nicer and adding comments.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/DontSwitchMeOver/DontSwitchMeOver.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/DontSwitchMeOver/DontSwitchMeOver.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/DontSwitchMeOver/DontSwitchMeOver.php
@@ -1,55 +1,41 @@
22 <?php
33 /**
44 * "Don't switch me over" extension
5 - *
 5+ *
66 * @file
77 * @ingroup Extensions
8 - *
9 - * This file contains the include for the "don't switch me over" extension
108 *
11 - * This allows users to indicate that they don't want to be switched over to
12 - * Vector in any future rollout.
13 - *
14 - * Usage: Include the following line in your LocalSettings.php
15 - * require_once( "$IP/extensions/UsabilityInitiative/DontSwitchMeOver/DontSwitchMeOver.php" );
16 - *
 9+ * This allows users to indicate that they don't want to be affected by a default preference change.
 10+ *
 11+ * @author Roan Kattouw <roan.kattouw@gmail.com>
1712 * @author Nimish Gautam <ngautam@wikimedia.org>
 13+ * @author Trevor Parscal <tparscal@wikimedia.org>
1814 * @license GPL v2 or later
19 - * @version 0.1.1
 15+ * @version 0.2.0
2016 */
2117
2218 /* Configuration */
2319
24 -// Preferences to switch back to. This has to be set because the old default
25 -// skin isn't remembered after a switchover.
26 -// You can also add more preferences here, and on wikis with PrefSwitch setting
27 -// $wgDontSwitchMeOverPrefs = $wgPrefSwitchPrefs['off']; is probably wise
 20+// Preferences to switch back to. This has to be set because the old default skin isn't remembered after a switchover.
 21+// You can also add more preferences here, and on wikis with PrefSwitch running, adding...
 22+// $wgDontSwitchMeOverPrefs = $wgPrefSwitchPrefs['off'];
 23+// to your LocalSettings.php file is probably wise.
2824 $wgDontSwitchMeOverPrefs = array(
2925 'skin' => 'monobook'
3026 );
 27+// Set default preference value
 28+$wgDefaultUserOptions['dontswitchmeover'] = 0;
3129
32 -// Credits
 30+/* Setup */
 31+
3332 $wgExtensionCredits['other'][] = array(
3433 'path' => __FILE__,
3534 'name' => "Don't Switch Me Over",
36 - 'author' => array( 'Roan Kattouw', 'Nimish Gautam' ),
37 - 'version' => '0.1',
 35+ 'author' => array( 'Roan Kattouw', 'Nimish Gautam', 'Trevor Parscal' ),
 36+ 'version' => '0.2.0',
3837 'url' => 'http://www.mediawiki.org/wiki/Extension:UsabilityInitiative',
3938 'descriptionmsg' => 'dontswitchmeover-desc',
4039 );
41 -
42 -// Includes parent extension
43 -require_once( dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative.php" );
44 -
45 -// Adds autoload classes
46 -$dir = dirname( __FILE__ ) . '/';
47 -$wgAutoloadClasses['DontSwitchMeOverHooks'] = $dir . 'DontSwitchMeOver.hooks.php';
48 -
49 -// Adds internationalized messages
50 -$wgExtensionMessagesFiles['DontSwitchMeOver'] = $dir . 'DontSwitchMeOver.i18n.php';
51 -
52 -// Hooked functions
53 -$wgHooks['GetPreferences'][] = 'DontSwitchMeOverHooks::addPreferences';
54 -
55 -// Set default
56 -$wgDefaultUserOptions['dontswitchmeover'] = 0;
 40+$wgAutoloadClasses['DontSwitchMeOverHooks'] = dirname( __FILE__ ) . '/DontSwitchMeOver.hooks.php';
 41+$wgExtensionMessagesFiles['DontSwitchMeOver'] = dirname( __FILE__ ) . '/DontSwitchMeOver.i18n.php';
 42+$wgHooks['GetPreferences'][] = 'DontSwitchMeOverHooks::getPreferences';
Index: trunk/extensions/UsabilityInitiative/DontSwitchMeOver/DontSwitchMeOver.hooks.php
@@ -1,5 +1,4 @@
22 <?php
3 -
43 /**
54 * Hooks for DontSwitchMeOver extension
65 *
@@ -8,11 +7,17 @@
98 */
109
1110 class DontSwitchMeOverHooks {
12 - public static function addPreferences( $user, &$defaultPreferences ) {
 11+
 12+ /* Static Methods */
 13+
 14+ /**
 15+ * GetPreferences hook
 16+ */
 17+ public static function getPreferences( $user, &$defaultPreferences ) {
1318 $defaultPreferences['dontswitchmeover'] = array(
1419 'type' => 'toggle',
1520 'label-message' => 'dontswitchmeover-pref',
16 - 'section' => 'rendering/skin', // May move after discussion
 21+ 'section' => 'rendering/skin',
1722 );
1823 return true;
1924 }

Status & tagging log