Index: trunk/extensions/UsabilityInitiative/DontSwitchMeOver/DontSwitchMeOver.php |
— | — | @@ -1,55 +1,41 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | 4 | * "Don't switch me over" extension |
5 | | - * |
| 5 | + * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | | - * |
9 | | - * This file contains the include for the "don't switch me over" extension |
10 | 8 | * |
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> |
17 | 12 | * @author Nimish Gautam <ngautam@wikimedia.org> |
| 13 | + * @author Trevor Parscal <tparscal@wikimedia.org> |
18 | 14 | * @license GPL v2 or later |
19 | | - * @version 0.1.1 |
| 15 | + * @version 0.2.0 |
20 | 16 | */ |
21 | 17 | |
22 | 18 | /* Configuration */ |
23 | 19 | |
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. |
28 | 24 | $wgDontSwitchMeOverPrefs = array( |
29 | 25 | 'skin' => 'monobook' |
30 | 26 | ); |
| 27 | +// Set default preference value |
| 28 | +$wgDefaultUserOptions['dontswitchmeover'] = 0; |
31 | 29 | |
32 | | -// Credits |
| 30 | +/* Setup */ |
| 31 | + |
33 | 32 | $wgExtensionCredits['other'][] = array( |
34 | 33 | 'path' => __FILE__, |
35 | 34 | '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', |
38 | 37 | 'url' => 'http://www.mediawiki.org/wiki/Extension:UsabilityInitiative', |
39 | 38 | 'descriptionmsg' => 'dontswitchmeover-desc', |
40 | 39 | ); |
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 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | /** |
5 | 4 | * Hooks for DontSwitchMeOver extension |
6 | 5 | * |
— | — | @@ -8,11 +7,17 @@ |
9 | 8 | */ |
10 | 9 | |
11 | 10 | 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 ) { |
13 | 18 | $defaultPreferences['dontswitchmeover'] = array( |
14 | 19 | 'type' => 'toggle', |
15 | 20 | 'label-message' => 'dontswitchmeover-pref', |
16 | | - 'section' => 'rendering/skin', // May move after discussion |
| 21 | + 'section' => 'rendering/skin', |
17 | 22 | ); |
18 | 23 | return true; |
19 | 24 | } |