Index: branches/REL1_18/extensions/Gadgets/Gadgets_body.php |
— | — | @@ -31,6 +31,24 @@ |
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
| 35 | + * UserGetDefaultOptions hook handler |
| 36 | + * @param $defaultOptions Array of default preference keys and values |
| 37 | + */ |
| 38 | + public static function userGetDefaultOptions( &$defaultOptions ) { |
| 39 | + $gadgets = Gadget::loadStructuredList(); |
| 40 | + if (!$gadgets) return true; |
| 41 | + |
| 42 | + foreach( $gadgets as $section => $thisSection ) { |
| 43 | + foreach( $thisSection as $gadgetId => $gadget ) { |
| 44 | + if ( $gadget->isOnByDefault() ) { |
| 45 | + $defaultOptions['gadget-' . $gadgetId] = 1; |
| 46 | + } |
| 47 | + } |
| 48 | + } |
| 49 | + return true; |
| 50 | + } |
| 51 | + |
| 52 | + /** |
35 | 53 | * GetPreferences hook handler. |
36 | 54 | * @param $user User |
37 | 55 | * @param $preferences Array: Preference descriptions |
Property changes on: branches/REL1_18/extensions/Gadgets/Gadgets_body.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
38 | 56 | Merged /trunk/extensions/Gadgets/Gadgets_body.php:r97034,97367,97380 |
Index: branches/REL1_18/extensions/Gadgets/Gadgets.php |
— | — | @@ -17,8 +17,8 @@ |
18 | 18 | die( 1 ); |
19 | 19 | } |
20 | 20 | |
21 | | -if ( version_compare( $wgVersion, '1.17alpha', '<' ) ) { |
22 | | - die( "This version of Extension:Gadgets requires MediaWiki 1.17+\n" ); |
| 21 | +if ( version_compare( $wgVersion, '1.18alpha', '<' ) ) { |
| 22 | + die( "This version of Extension:Gadgets requires MediaWiki 1.18+\n" ); |
23 | 23 | } |
24 | 24 | |
25 | 25 | $wgExtensionCredits['other'][] = array( |
— | — | @@ -31,6 +31,7 @@ |
32 | 32 | |
33 | 33 | $wgHooks['ArticleSaveComplete'][] = 'GadgetHooks::articleSaveComplete'; |
34 | 34 | $wgHooks['BeforePageDisplay'][] = 'GadgetHooks::beforePageDisplay'; |
| 35 | +$wgHooks['UserGetDefaultOptions'][] = 'GadgetHooks::userGetDefaultOptions'; |
35 | 36 | $wgHooks['GetPreferences'][] = 'GadgetHooks::getPreferences'; |
36 | 37 | $wgHooks['ResourceLoaderRegisterModules'][] = 'GadgetHooks::registerModules'; |
37 | 38 | $wgHooks['UnitTestsList'][] = 'GadgetHooks::unitTestsList'; |