http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97413
Revision: 97413
Author: catrope
Date: 2011-09-18 11:21:41 +0000 (Sun, 18 Sep 2011)
Log Message:
-----------
1.18: MFT r97367, r97380
Modified Paths:
--------------
branches/REL1_18/extensions/Gadgets/Gadgets.php
branches/REL1_18/extensions/Gadgets/Gadgets_body.php
Property Changed:
----------------
branches/REL1_18/extensions/Gadgets/Gadgets_body.php
Modified: branches/REL1_18/extensions/Gadgets/Gadgets.php
===================================================================
--- branches/REL1_18/extensions/Gadgets/Gadgets.php 2011-09-18 10:05:25 UTC
(rev 97412)
+++ branches/REL1_18/extensions/Gadgets/Gadgets.php 2011-09-18 11:21:41 UTC
(rev 97413)
@@ -17,8 +17,8 @@
die( 1 );
}
-if ( version_compare( $wgVersion, '1.17alpha', '<' ) ) {
- die( "This version of Extension:Gadgets requires MediaWiki 1.17+\n" );
+if ( version_compare( $wgVersion, '1.18alpha', '<' ) ) {
+ die( "This version of Extension:Gadgets requires MediaWiki 1.18+\n" );
}
$wgExtensionCredits['other'][] = array(
@@ -31,6 +31,7 @@
$wgHooks['ArticleSaveComplete'][] =
'GadgetHooks::articleSaveComplete';
$wgHooks['BeforePageDisplay'][] = 'GadgetHooks::beforePageDisplay';
+$wgHooks['UserGetDefaultOptions'][] =
'GadgetHooks::userGetDefaultOptions';
$wgHooks['GetPreferences'][] = 'GadgetHooks::getPreferences';
$wgHooks['ResourceLoaderRegisterModules'][] = 'GadgetHooks::registerModules';
$wgHooks['UnitTestsList'][] = 'GadgetHooks::unitTestsList';
Modified: branches/REL1_18/extensions/Gadgets/Gadgets_body.php
===================================================================
--- branches/REL1_18/extensions/Gadgets/Gadgets_body.php 2011-09-18
10:05:25 UTC (rev 97412)
+++ branches/REL1_18/extensions/Gadgets/Gadgets_body.php 2011-09-18
11:21:41 UTC (rev 97413)
@@ -31,6 +31,24 @@
}
/**
+ * UserGetDefaultOptions hook handler
+ * @param $defaultOptions Array of default preference keys and values
+ */
+ public static function userGetDefaultOptions( &$defaultOptions ) {
+ $gadgets = Gadget::loadStructuredList();
+ if (!$gadgets) return true;
+
+ foreach( $gadgets as $section => $thisSection ) {
+ foreach( $thisSection as $gadgetId => $gadget ) {
+ if ( $gadget->isOnByDefault() ) {
+ $defaultOptions['gadget-' . $gadgetId]
= 1;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
* GetPreferences hook handler.
* @param $user User
* @param $preferences Array: Preference descriptions
Property changes on: branches/REL1_18/extensions/Gadgets/Gadgets_body.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/Gadgets-work/Gadgets_body.php:73145-76526
/branches/wmf/1.17wmf1/extensions/Gadgets/Gadgets_body.php:81884
+ /branches/Gadgets-work/Gadgets_body.php:73145-76526
/branches/wmf/1.17wmf1/extensions/Gadgets/Gadgets_body.php:81884
/trunk/extensions/Gadgets/Gadgets_body.php:97034,97367,97380
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs