Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.php |
— | — | @@ -118,10 +118,6 @@ |
119 | 119 | $wgAutoloadClasses['WebVideoTranscodeJob'] = "$timedMediaDir/WebVideoTranscode/WebVideoTranscodeJob.php"; |
120 | 120 | $wgAutoloadClasses['ApiQueryVideoInfo'] = "$timedMediaDir/ApiQueryVideoInfo.php"; |
121 | 121 | |
122 | | -// Register the Timed Media Handler javascript resources ( MwEmbed modules ) |
123 | | -MwEmbedResourceManager::register( 'extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer' ); |
124 | | -MwEmbedResourceManager::register( 'extensions/TimedMediaHandler/MwEmbedModules/TimedText' ); |
125 | | - |
126 | 122 | // Localization |
127 | 123 | $wgExtensionMessagesFiles['TimedMediaHandler'] = "$timedMediaDir/TimedMediaHandler.i18n.php"; |
128 | 124 | $wgExtensionMessagesFiles['TimedMediaHandlerMagic'] = "$timedMediaDir/TimedMediaHandler.i18n.magic.php"; |
Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php |
— | — | @@ -13,7 +13,11 @@ |
14 | 14 | global $wgParserOutputHooks, $wgHooks, $wgJobClasses, $wgJobTypesExcludedFromDefaultQueue, |
15 | 15 | $wgMediaHandlers, $wgResourceModules, $wgExcludeFromThumbnailPurge, $wgExtraNamespaces, |
16 | 16 | $tmhFileExtensions, $wgParserOutputHooks, $wgOut, $wgAPIPropModules, $wgTimedTextNS; |
17 | | - |
| 17 | + |
| 18 | + // Register the Timed Media Handler javascript resources ( MwEmbed modules ) |
| 19 | + MwEmbedResourceManager::register( 'extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer' ); |
| 20 | + MwEmbedResourceManager::register( 'extensions/TimedMediaHandler/MwEmbedModules/TimedText' ); |
| 21 | + |
18 | 22 | // Setup media Handlers: |
19 | 23 | $wgMediaHandlers['application/ogg'] = 'OggHandler'; |
20 | 24 | $wgMediaHandlers['video/webm'] = 'WebMHandler'; |
— | — | @@ -28,6 +32,7 @@ |
29 | 33 | $wgJobClasses+= array( |
30 | 34 | 'webVideoTranscode' => 'WebVideoTranscodeJob' |
31 | 35 | ); |
| 36 | + |
32 | 37 | // Transcode jobs must be explicitly requested from the job queue: |
33 | 38 | $wgJobTypesExcludedFromDefaultQueue[] = 'webVideoTranscode'; |
34 | 39 | |
Index: trunk/extensions/MwEmbedSupport/MwEmbedSupport.php |
— | — | @@ -33,33 +33,8 @@ |
34 | 34 | ); |
35 | 35 | |
36 | 36 | $wgAutoloadClasses['MwEmbedResourceManager'] = dirname( __FILE__ ) . '/MwEmbedResourceManager.php'; |
| 37 | +$wgAutoloadClasses['MwEmbedSupportHooks'] = dirname( __FILE__ ) . '/MwEmbedSupport.hooks.php'; |
37 | 38 | |
38 | | -// Add Global MwEmbed Registration hook |
39 | | -$wgHooks['ResourceLoaderRegisterModules'][] = 'MwEmbedResourceManager::registerModules'; |
40 | | - |
41 | | -// Add MwEmbed module configuration |
42 | | -$wgHooks['ResourceLoaderGetConfigVars'][] = 'MwEmbedResourceManager::registerConfigVars'; |
43 | | - |
44 | 39 | /* MwEmbed Module Registration */ |
45 | | - |
46 | | -// Register the core MwEmbed Support Module: |
47 | | -MwEmbedResourceManager::register( 'extensions/MwEmbedSupport/MwEmbedModules/MwEmbedSupport' ); |
48 | | - |
49 | | -// Register the MwEmbed 'mediaWiki' Module: |
50 | | -MwEmbedResourceManager::register( 'extensions/MwEmbedSupport/MwEmbedModules/MediaWikiSupport' ); |
51 | | - |
52 | | -// Add MwEmbedSupport to Startup: |
53 | | -function MwUpdateStartupModules( &$modules ){ |
54 | | - array_push($modules, 'jquery.triggerQueueCallback', 'jquery.mwEmbedUtil', 'mw.MwEmbedSupport' ); |
55 | | - return true; |
56 | | -} |
57 | | -$wgHooks['ResourceLoaderGetStartupModules'][] = 'MwUpdateStartupModules'; |
58 | | - |
59 | | - |
60 | | - |
61 | | -// Add mwEmbed Support ( style sheets and messages post page ready ) |
62 | | -$wgHooks['BeforePageDisplay'][] = 'MwUpdatePageModules'; |
63 | | -function MwUpdatePageModules( &$out ){ |
64 | | - $out->addModules( 'mw.MwEmbedSupport.style' ); |
65 | | - return true; |
66 | | -} |
\ No newline at end of file |
| 40 | +$wgHooks['SetupAfterCache'][] = 'MwEmbedSupportHooks::register'; |
| 41 | + |
Index: trunk/extensions/MwEmbedSupport/MwEmbedSupport.hooks.php |
— | — | @@ -0,0 +1,49 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Hooks for MwEmbedSupport extension |
| 6 | + * |
| 7 | + * @file |
| 8 | + * @ingroup Extensions |
| 9 | + */ |
| 10 | + |
| 11 | +class MwEmbedSupportHooks { |
| 12 | + // Register MwEmbedSupport Hooks |
| 13 | + static function register(){ |
| 14 | + global $wgHooks; |
| 15 | + // Register the core MwEmbed Support Module: |
| 16 | + MwEmbedResourceManager::register( 'extensions/MwEmbedSupport/MwEmbedModules/MwEmbedSupport' ); |
| 17 | + |
| 18 | + // Register the MwEmbed 'mediaWiki' Module: |
| 19 | + MwEmbedResourceManager::register( 'extensions/MwEmbedSupport/MwEmbedModules/MediaWikiSupport' ); |
| 20 | + |
| 21 | + // Add mwEmbed Support modules that are not part of startup |
| 22 | + $wgHooks['BeforePageDisplay'][] = 'MwEmbedSupportHooks::UpdatePageModules'; |
| 23 | + |
| 24 | + // Add Global MwEmbed Registration hook |
| 25 | + $wgHooks['ResourceLoaderRegisterModules'][] = 'MwEmbedResourceManager::registerModules'; |
| 26 | + |
| 27 | + // Add MwEmbed module configuration |
| 28 | + $wgHooks['ResourceLoaderGetConfigVars'][] = 'MwEmbedResourceManager::registerConfigVars'; |
| 29 | + |
| 30 | + // Add the startup modules hook |
| 31 | + $wgHooks['ResourceLoaderGetStartupModules'][] = 'MwEmbedSupportHooks::addStartupModules'; |
| 32 | + return true; |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Update the page modules to include mwEmbed style |
| 37 | + * |
| 38 | + * TODO look into loading this on-demand instead of all pages. |
| 39 | + */ |
| 40 | + static function updatePageModules( &$out ){ |
| 41 | + $out->addModules( 'mw.MwEmbedSupport.style' ); |
| 42 | + return true; |
| 43 | + } |
| 44 | + |
| 45 | + // Add MwEmbedSupport modules to Startup: |
| 46 | + static function addStartupModules( &$modules ){ |
| 47 | + array_push($modules, 'jquery.triggerQueueCallback', 'jquery.mwEmbedUtil', 'mw.MwEmbedSupport' ); |
| 48 | + return true; |
| 49 | + } |
| 50 | +} |
\ No newline at end of file |