Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Outputs.php |
— | — | @@ -47,6 +47,7 @@ |
48 | 48 | |
49 | 49 | if ( is_numeric( $id ) ) { |
50 | 50 | global $wgOut; |
| 51 | + |
51 | 52 | switch ( $id ) { |
52 | 53 | case SMW_HEADER_TOOLTIP: |
53 | 54 | $wgOut->addModules( 'ext.smw.tooltips' ); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php |
— | — | @@ -60,6 +60,8 @@ |
61 | 61 | $wgExtensionAliasesFiles['SemanticMediaWiki'] = $smwgIP . 'languages/SMW_Aliases.php'; |
62 | 62 | |
63 | 63 | // Set up autoloading; essentially all classes should be autoloaded! |
| 64 | + $wgAutoloadClasses['SMWHooks'] = $smwgIP . 'SMW.hooks.php'; |
| 65 | + |
64 | 66 | $wgAutoloadClasses['SMWParserExtensions'] = $smwgIP . 'includes/SMW_ParserExtensions.php'; |
65 | 67 | $wgAutoloadClasses['SMWInfolink'] = $smwgIP . 'includes/SMW_Infolink.php'; |
66 | 68 | // $wgAutoloadClasses['SMWFactbox'] = $smwgIP . 'includes/SMW_Factbox.php'; |
— | — | @@ -229,7 +231,7 @@ |
230 | 232 | $wgHooks['ArticleFromTitle'][] = 'smwfOnArticleFromTitle'; // special implementations for property/type articles |
231 | 233 | $wgHooks['ParserFirstCallInit'][] = 'smwfRegisterParserFunctions'; |
232 | 234 | |
233 | | - $wgHooks['ResourceLoaderRegisterModules'][] = 'smwfRegisterResourceLoaderModules'; |
| 235 | + $wgHooks['ResourceLoaderRegisterModules'][] = 'SMWHooks::registerResourceLoaderModules'; |
234 | 236 | |
235 | 237 | $smwgMW_1_14 = true; // assume latest 1.14 API |
236 | 238 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | $wgHooks['ParserTestTables'][] = 'smwfOnParserTestTables'; |
57 | 57 | $wgHooks['AdminLinks'][] = 'smwfAddToAdminLinks'; |
58 | 58 | |
59 | | - $wgHooks['ResourceLoaderRegisterModules'][] = 'smwfRegisterResourceLoaderModules'; |
| 59 | + $wgHooks['ResourceLoaderRegisterModules'][] = 'SMWHooks::registerResourceLoaderModules'; |
60 | 60 | |
61 | 61 | if ( version_compare( $wgVersion, '1.17alpha', '>=' ) ) { |
62 | 62 | // For MediaWiki 1.17 alpha and later. |
— | — | @@ -69,6 +69,8 @@ |
70 | 70 | $wgExtensionAliasesFiles['SemanticMediaWiki'] = $smwgIP . 'languages/SMW_Aliases.php'; |
71 | 71 | |
72 | 72 | // Set up autoloading; essentially all classes should be autoloaded! |
| 73 | + $wgAutoloadClasses['SMWHooks'] = $smwgIP . 'SMW.hooks.php'; |
| 74 | + |
73 | 75 | $wgAutoloadClasses['SMWParserExtensions'] = $smwgIP . 'includes/SMW_ParserExtensions.php'; |
74 | 76 | $wgAutoloadClasses['SMWInfolink'] = $smwgIP . 'includes/SMW_Infolink.php'; |
75 | 77 | $wgAutoloadClasses['SMWFactbox'] = $smwgIP . 'includes/SMW_Factbox.php'; |
— | — | @@ -512,44 +514,6 @@ |
513 | 515 | } |
514 | 516 | |
515 | 517 | /** |
516 | | - * Register the resource modules for the resource loader. |
517 | | - * |
518 | | - * @since 1.5.3 |
519 | | - * |
520 | | - * @param ResourceLoader $resourceLoader |
521 | | - * |
522 | | - * @return true |
523 | | - */ |
524 | | -function smwfRegisterResourceLoaderModules( ResourceLoader &$resourceLoader ) { |
525 | | - global $smwgScriptPath, $wgContLang; |
526 | | - |
527 | | - $modules = array( |
528 | | - 'ext.smw.style' => array( |
529 | | - 'styles' => $smwgScriptPath . ( $wgContLang->isRTL() ? '/skins/SMW_custom_rtl.css' : '/skins/SMW_custom.css' ) |
530 | | - ), |
531 | | - 'ext.smw.tooltips' => array( |
532 | | - 'scripts' => $smwgScriptPath . '/skins/SMW_tooltip.js', |
533 | | - 'dependencies' => array( |
534 | | - 'mediawiki.legacy.wikibits', |
535 | | - 'ext.smw.style' |
536 | | - ) |
537 | | - ), |
538 | | - 'ext.smw.sorttable' => array( |
539 | | - 'scripts' => $smwgScriptPath . '/skins/SMW_sorttable.js', |
540 | | - 'dependencies' => 'ext.smw.style' |
541 | | - ) |
542 | | - ); |
543 | | - |
544 | | - foreach ( $modules as $name => $resources ) { |
545 | | - $resourceLoader->register( $name, new ResourceLoaderFileModule( |
546 | | - array_merge_recursive( $resources, array( 'group' => 'ext.smw' ) ) |
547 | | - ) ); |
548 | | - } |
549 | | - |
550 | | - return true; |
551 | | -} |
552 | | - |
553 | | -/** |
554 | 518 | * This hook registers parser functions and hooks to the given parser. It is |
555 | 519 | * called during SMW initialisation. Note that parser hooks are something different |
556 | 520 | * than MW hooks in general, which explains the two-level registration. |
Index: trunk/extensions/SemanticMediaWiki/SMW.hooks.php |
— | — | @@ -0,0 +1,60 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Static class for hooks handled by the SMW extension. |
| 6 | + * |
| 7 | + * This class is an attempt to clean up SMW initialization, as it's rather messy at the moment, |
| 8 | + * and the split between SMW and SMW light is not very clean. |
| 9 | + * |
| 10 | + * @since 1.5.3 |
| 11 | + * |
| 12 | + * @file SMW.hooks.php |
| 13 | + * @ingroup SMW |
| 14 | + * |
| 15 | + * @author Jeroen De Dauw |
| 16 | + */ |
| 17 | +final class SMWHooks { |
| 18 | + |
| 19 | + /** |
| 20 | + * Register the resource modules for the resource loader. |
| 21 | + * |
| 22 | + * @since 1.5.3 |
| 23 | + * |
| 24 | + * @param ResourceLoader $resourceLoader |
| 25 | + * |
| 26 | + * @return true |
| 27 | + */ |
| 28 | + public static function registerResourceLoaderModules( ResourceLoader &$resourceLoader ) { |
| 29 | + global $wgContLang; |
| 30 | + |
| 31 | + $modules = array( |
| 32 | + 'ext.smw.style' => array( |
| 33 | + 'styles' => ( $wgContLang->isRTL() ? 'SMW_custom_rtl.css' : 'SMW_custom.css' ) |
| 34 | + ), |
| 35 | + 'ext.smw.tooltips' => array( |
| 36 | + 'scripts' => 'SMW_tooltip.js', |
| 37 | + 'dependencies' => array( |
| 38 | + 'mediawiki.legacy.wikibits', |
| 39 | + 'ext.smw.style' |
| 40 | + ) |
| 41 | + ), |
| 42 | + 'ext.smw.sorttable' => array( |
| 43 | + 'scripts' => dirname( __FILE__ ) . 'SMW_sorttable.js', |
| 44 | + 'dependencies' => 'ext.smw.style' |
| 45 | + ) |
| 46 | + ); |
| 47 | + |
| 48 | + foreach ( $modules as $name => $resources ) { |
| 49 | + $resourceLoader->register( |
| 50 | + $name, |
| 51 | + new ResourceLoaderFileModule( |
| 52 | + array_merge_recursive( $resources, array( 'group' => 'ext.smw' ) ), |
| 53 | + 'extensions/SemanticMediaWiki/skins/' |
| 54 | + ) |
| 55 | + ); |
| 56 | + } |
| 57 | + |
| 58 | + return true; |
| 59 | + } |
| 60 | + |
| 61 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/SemanticMediaWiki/SMW.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 62 | + native |