r100048 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100047‎ | r100048 | r100049 >
Date:16:10, 17 October 2011
Author:yaron
Status:deferred
Tags:
Comment:
Changed Page Schemas class registration system to use a hook
Modified paths:
  • /trunk/extensions/PageSchemas/PageSchemas.hooks.php (modified) (history)
  • /trunk/extensions/SemanticDrilldown/SemanticDrilldown.php (modified) (history)
  • /trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php (modified) (history)
  • /trunk/extensions/SemanticForms/SemanticForms.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_PageSchemas.php (modified) (history)
  • /trunk/extensions/SemanticInternalObjects/SIO_PageSchemas.php (modified) (history)
  • /trunk/extensions/SemanticInternalObjects/SemanticInternalObjects.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_PageSchemas.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_PageSchemas.php
@@ -11,6 +11,11 @@
1212 */
1313
1414 class SMWPageSchemas extends PSExtensionHandler {
 15+ public static function registerClass() {
 16+ global $wgPageSchemasHandlerClasses;
 17+ $wgPageSchemasHandlerClasses[] = 'SMWPageSchemas';
 18+ return true;
 19+ }
1520
1621 public static function getDisplayColor() {
1722 return '#DEF';
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php
@@ -73,11 +73,6 @@
7474 return true;
7575 }
7676
77 -// Register class with the Page Schemas extension
78 -if ( isset( $wgPageSchemasHandlerClasses ) ) {
79 - $wgPageSchemasHandlerClasses[] = 'SMWPageSchemas';
80 -}
81 -
8277 /**
8378 * Register all SMW hooks with MediaWiki.
8479 */
@@ -88,6 +83,7 @@
8984 $wgHooks['LanguageGetMagic'][] = 'smwfAddMagicWords'; // setup names for parser functions (needed here)
9085 $wgHooks['ParserTestTables'][] = 'smwfOnParserTestTables';
9186 $wgHooks['AdminLinks'][] = 'smwfAddToAdminLinks';
 87+ $wgHooks['PageSchemasRegisterHandlers'][] = 'SMWPageSchemas::registerClass';
9288 $wgHooks['ParserFirstCallInit'][] = 'SMWSMWDoc::staticInit';
9389 $wgHooks['LanguageGetMagic'][] = 'SMWSMWDoc::staticMagic';
9490
Index: trunk/extensions/SemanticForms/SemanticForms.php
@@ -90,12 +90,8 @@
9191 $wgHooks['ParserBeforeStrip'][] = 'SFUtils::cacheFormDefinition';
9292 $wgHooks['ParserFirstCallInit'][] = 'SFParserFunctions::registerFunctions';
9393 $wgHooks['MakeGlobalVariablesScript'][] = 'SFFormUtils::setGlobalJSVariables';
 94+$wgHooks['PageSchemasRegisterHandlers'][] = 'SFPageSchemas::registerClass';
9495
95 -// Register class with the Page Schemas extension
96 -if ( isset( $wgPageSchemasHandlerClasses ) ) {
97 - $wgPageSchemasHandlerClasses[] = 'SFPageSchemas';
98 -}
99 -
10096 $wgAPIModules['sfautocomplete'] = 'SFAutocompleteAPI';
10197 $wgAPIModules['sfautoedit'] = 'SFAutoeditAPI';
10298
Index: trunk/extensions/SemanticForms/includes/SF_PageSchemas.php
@@ -10,6 +10,11 @@
1111 */
1212
1313 class SFPageSchemas extends PSExtensionHandler {
 14+ public static function registerClass() {
 15+ global $wgPageSchemasHandlerClasses;
 16+ $wgPageSchemasHandlerClasses[] = 'SFPageSchemas';
 17+ return true;
 18+ }
1419
1520 /**
1621 * Creates an object to hold form-wide information, based on an XML
Index: trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php
@@ -8,6 +8,11 @@
99 */
1010
1111 class SDPageSchemas extends PSExtensionHandler {
 12+ public static function registerClass() {
 13+ global $wgPageSchemasHandlerClasses;
 14+ $wgPageSchemasHandlerClasses[] = 'SDPageSchemas';
 15+ return true;
 16+ }
1217
1318 /**
1419 * Returns an object containing information on a filter, based on XML
Index: trunk/extensions/SemanticDrilldown/SemanticDrilldown.php
@@ -65,12 +65,8 @@
6666 $wgHooks['MagicWordwgVariableIDs'][] = 'SDUtils::addMagicWordVariableIDs';
6767 $wgHooks['LanguageGetMagic'][] = 'SDUtils::addMagicWordLanguage';
6868 $wgHooks['ParserBeforeTidy'][] = 'SDUtils::handleShowAndHide';
 69+$wgHooks['PageSchemasRegisterHandlers'][] = 'SDPageSchemas::registerClass';
6970
70 -// Register class with the Page Schemas extension
71 -if ( isset( $wgPageSchemasHandlerClasses ) ) {
72 - $wgPageSchemasHandlerClasses[] = 'SDPageSchemas';
73 -}
74 -
7571 $wgPageProps['hidefromdrilldown'] = 'Whether or not the page is set as HIDEFROMDRILLDOWN';
7672 $wgPageProps['showindrilldown'] = 'Whether or not the page is set as SHOWINDRILLDOWN';
7773
Index: trunk/extensions/PageSchemas/PageSchemas.hooks.php
@@ -12,6 +12,8 @@
1313 public static function register( &$parser ) {
1414 // Register the hook with the parser
1515 $parser->setHook( 'PageSchema', array( 'PageSchemasHooks', 'render' ) );
 16+ // Initialize the global array of "handler" classes
 17+ wfRunHooks( 'PageSchemasRegisterHandlers' );
1618 return true;
1719 }
1820
Index: trunk/extensions/SemanticInternalObjects/SIO_PageSchemas.php
@@ -10,6 +10,11 @@
1111 */
1212
1313 class SIOPageSchemas extends PSExtensionHandler {
 14+ public static function registerClass() {
 15+ global $wgPageSchemasHandlerClasses;
 16+ $wgPageSchemasHandlerClasses[] = 'SIOPageSchemas';
 17+ return true;
 18+ }
1419
1520 public static function getDisplayColor() {
1621 return '#FF8';
Index: trunk/extensions/SemanticInternalObjects/SemanticInternalObjects.php
@@ -29,12 +29,8 @@
3030 $wgHooks['TitleMoveComplete'][] = 'SIOHandler::handlePageMove';
3131 $wgHooks['smwRefreshDataJobs'][] = 'SIOHandler::handleRefreshingOfInternalObjects';
3232 $wgHooks['smwAddToRDFExport'][] = 'SIOSQLStore::createRDF';
 33+$wgHooks['PageSchemasRegisterHandlers'][] = 'SIOPageSchemas::registerClass';
3334
34 -// Register class with the Page Schemas extension
35 -if ( isset( $wgPageSchemasHandlerClasses ) ) {
36 - $wgPageSchemasHandlerClasses[] = 'SIOPageSchemas';
37 -}
38 -
3935 $siogIP = dirname( __FILE__ );
4036 $wgExtensionMessagesFiles['SemanticInternalObjects'] = $siogIP . '/SemanticInternalObjects.i18n.php';
4137 $wgAutoloadClasses['SIOHandler'] = $siogIP . '/SemanticInternalObjects_body.php';

Status & tagging log