r82587 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82586‎ | r82587 | r82588 >
Date:00:34, 22 February 2011
Author:dale
Status:deferred
Tags:
Comment:
moved PopUpMediaTransform to parserOutput hook
Modified paths:
  • /trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/TimedMediaHandler_body.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/resources/PopUpThumbVideo.js (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler_body.php
@@ -83,9 +83,25 @@
8484
8585 return true;
8686 }
87 -
88 -
 87+ function parserTransformHook( $parser, $file ) {
 88+ if ( isset( $parser->mOutput->hasTimedMediaTransform ) ) {
 89+ return;
 90+ }
 91+ $parser->mOutput->hasTimedMediaTransform = true;
 92+ $parser->mOutput->addOutputHook( 'TimedMediaHandler' );
 93+ }
8994 /**
 95+ * Output hook only adds the PopUpMediaTransform
 96+ *
 97+ * The core embedPlayer module is part of a "loaderScript" so it does not need to
 98+ * be registered here.
 99+ */
 100+ static function outputHook( $outputPage, $parserOutput, $data ) {
 101+ // Add the PopUpMediaTransform code
 102+ $outputPage->addModules( 'PopUpMediaTransform' );
 103+ $outputPage->addModuleStyles( 'PopUpMediaTransform' );
 104+ }
 105+ /**
90106 * Utility functions
91107 */
92108 public static function parseTimeString( $seekString, $length = false ) {
Index: trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php
@@ -51,9 +51,6 @@
5252
5353 // Check if the video is too small to play inline ( instead do a pop-up dialog )
5454 if( $this->width <= $wgMinimumVideoPlayerSize && $this->isVideo ){
55 - // Make sure we add the popUpThum module
56 - $wgOut->addModules( 'PopUpMediaTransform' );
57 - $wgOut->addModuleStyles( 'PopUpMediaTransform' );
5855 return $this->getImagePopUp();
5956 } else {
6057 return $this->getXmlMediaTagOutput();
Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php
@@ -12,7 +12,7 @@
1313 static function register(){
1414 global $wgParserOutputHooks, $wgHooks, $wgJobClasses, $wgJobExplitRequestTypes,
1515 $wgMediaHandlers, $wgResourceModules, $wgExcludeFromThumbnailPurge,
16 - $wgTimedMediaHandlerFileExtensions;
 16+ $wgTimedMediaHandlerFileExtensions, $wgParserOutputHooks;
1717
1818 // Setup media Handlers:
1919 $wgMediaHandlers['application/ogg'] = 'OggHandler';
@@ -21,6 +21,9 @@
2222 // Setup a hook for iframe embed handling:
2323 $wgHooks['ArticleFromTitle'][] = 'TimedMediaIframeOutput::iframeHook';
2424
 25+ // Add parser hook
 26+ $wgParserOutputHooks['TimedMediaHandler'] = array( 'TimedMediaHandler', 'outputHook' );
 27+
2528 // Add transcode job class:
2629 $wgJobClasses+= array(
2730 'webVideoTranscode' => 'WebVideoTranscodeJob'
Index: trunk/extensions/TimedMediaHandler/resources/PopUpThumbVideo.js
@@ -18,7 +18,6 @@
1919 // don't follow file link
2020 return false;
2121 });
22 -
2322 });
2423 });
2524

Status & tagging log