Index: trunk/extensions/UsabilityInitiative/UpdateMyPrefs/UpdateMyPrefs.php |
— | — | @@ -0,0 +1,48 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * "Update my preferences" extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * |
| 9 | + * This file contains the include for the "update my preferences" extension |
| 10 | + * |
| 11 | + * This allows users to set a flag ('on' by default) that will expressly allow them to |
| 12 | + * state whether they would like their preferences to be updated with the 'latest and greatest' that we come out |
| 13 | + * with or not |
| 14 | + * |
| 15 | + * Usage: Include the following line in your LocalSettings.php |
| 16 | + * require_once( "$IP/extensions/UsabilityInitiative/UpdateMyPrefs/UpdateMyPrefs.php" ); |
| 17 | + * |
| 18 | + * @author Nimish Gautam <ngautam@wikimedia.org> |
| 19 | + * @license GPL v2 or later |
| 20 | + * @version 0.1.1 |
| 21 | + */ |
| 22 | + |
| 23 | +/* Configuration */ |
| 24 | + |
| 25 | +// Credits |
| 26 | +$wgExtensionCredits['other'][] = array( |
| 27 | + 'path' => __FILE__, |
| 28 | + 'name' => 'Update My Prefs', |
| 29 | + 'author' => 'Nimish Gautam', |
| 30 | + 'version' => '0.1.1', |
| 31 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:UsabilityInitiative', |
| 32 | + 'descriptionmsg' => 'updatemyprefs-desc', |
| 33 | +); |
| 34 | + |
| 35 | +// Includes parent extension |
| 36 | +require_once( dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative.php" ); |
| 37 | + |
| 38 | +// Adds Autoload Classes |
| 39 | +$dir = dirname( __FILE__ ) . '/'; |
| 40 | +$wgAutoloadClasses['UpdateMyPrefsHooks'] = $dir . 'UpdateMyPrefs.hooks.php'; |
| 41 | + |
| 42 | +// Adds Internationalized Messages |
| 43 | +$wgExtensionMessagesFiles['UpdateMyPrefs'] = $dir . 'UpdateMyPrefs.i18n.php'; |
| 44 | + |
| 45 | +// Hooked functions |
| 46 | +$wgHooks['GetPreferences'][] = 'UpdateMyPrefsHooks::addPreferences'; |
| 47 | + |
| 48 | +//set default |
| 49 | +$wgDefaultUserOptions['updatemyprefs'] = 1; |
\ No newline at end of file |
Property changes on: trunk/extensions/UsabilityInitiative/UpdateMyPrefs/UpdateMyPrefs.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 50 | + native |
Index: trunk/extensions/UsabilityInitiative/UpdateMyPrefs/UpdateMyPrefs.hooks.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Hooks for "Update My Prefs" extension |
| 6 | + * |
| 7 | + * @file |
| 8 | + * @ingroup Extensions |
| 9 | + */ |
| 10 | + |
| 11 | +class UpdateMyPrefsHooks { |
| 12 | + |
| 13 | + public static function addPreferences( $user, &$defaultPreferences ) { |
| 14 | + wfLoadExtensionMessages( 'UpdateMyPrefs' ); |
| 15 | + $ui = array( |
| 16 | + 'type' => 'toggle', |
| 17 | + 'label-message' => 'updatemyprefs-label-message', |
| 18 | + 'section' => 'personal/updates', |
| 19 | + ); |
| 20 | + $defaultPreferences['updatemyprefs'] = $ui; |
| 21 | + return true; |
| 22 | + } |
| 23 | + |
| 24 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/UsabilityInitiative/UpdateMyPrefs/UpdateMyPrefs.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Index: trunk/extensions/UsabilityInitiative/UpdateMyPrefs/UpdateMyPrefs.i18n.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation for "UpdateMyPrefs" extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +$messages = array(); |
| 11 | + |
| 12 | +/** English |
| 13 | + * @author Nimish Gautam |
| 14 | + */ |
| 15 | +$messages['en'] = array( |
| 16 | + 'prefs-updates' => 'Updates', |
| 17 | + 'updatemyprefs-desc' => 'Preference for users to to specify whether they want periodic user interface updates as they are made available', |
| 18 | + 'updatemyprefs-label-message' => 'Automatically update my preferences with new default settings and tools as they become available', |
| 19 | +); |
| 20 | + |
| 21 | + |
| 22 | +$messages['qqq'] = array( |
| 23 | + 'prefs-updates' => 'In the context of software updates', |
| 24 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/UsabilityInitiative/UpdateMyPrefs/UpdateMyPrefs.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |