r60498 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60497‎ | r60498 | r60499 >
Date:10:33, 30 December 2009
Author:dale
Status:deferred
Tags:
Comment:
* removed reference to $wgEnableJS2system
* disabled timedText & video tag ( mwEmbed ) features by default
Modified paths:
  • /trunk/extensions/OggHandler/OggHandler.php (modified) (history)
  • /trunk/extensions/OggHandler/OggHandler_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OggHandler/OggHandler.php
@@ -32,38 +32,6 @@
3333 $wgHooks['LanguageGetMagic'][] = 'OggHandler::registerMagicWords';
3434
3535
36 -/**
37 - * Handle Adding of "timedText" NameSpace
38 - */
39 -$wgTimedTextNS = null;
40 -
41 -// Make sure $wgExtraNamespaces in an array (set to NULL by default) :
42 -if ( !is_array( $wgExtraNamespaces ) ) {
43 - $wgExtraNamespaces = array();
44 -}
45 -// Check for "TimedText" NS
46 -$maxNS = 101; // content pages need "even" namespaces
47 -foreach($wgExtraNamespaces as $ns => $nsTitle ){
48 - if( $nsTitle == 'TimedText' ){
49 - $wgTimedTextNS = $ns;
50 - }
51 - if( $ns > $maxNS ){
52 - $maxNs = $ns;
53 - }
54 -}
55 -// If not found add Add a custom timedText NS
56 -if( !$wgTimedTextNS ){
57 - $wgTimedTextNS = ( $maxNS + 1 );
58 - $wgExtraNamespaces[ $wgTimedTextNS ] = 'TimedText';
59 - $wgExtraNamespaces[ $wgTimedTextNS +1 ] = 'TimedText_talk';
60 -}
61 -define( "NS_TIMEDTEXT", $wgTimedTextNS);
62 -// Assume $wgTimedTextNS +1 for talk
63 -define( "NS_TIMEDTEXT_TALK", $wgTimedTextNS +1);
64 -
65 -
66 -// end of handling timedText
67 -
6836 //Setup a hook for iframe=true (will strip the interface and only output the player)
6937 $wgHooks['ArticleFromTitle'][] = 'OggHandler::iframeOutputHook';
7038
@@ -87,11 +55,14 @@
8856
8957 //if $wgEnableJS2system = true and the below variable is set to true
9058 // then we can output the <video> tag and its re-written by mv_embed
91 -$wgVideoTagOut = true;
 59+$wgVideoTagOut = false;
9260
93 -//if we should enable iframe embedding of form ?title=File:name&iframe=true
94 -$wgEnableIframeEmbed = true;
 61+// Support striped player iframe output for remote embedding
 62+$wgEnableIframeEmbed = false;
9563
 64+// If timedText is enabled
 65+$wgEnableTimedText = false;
 66+
9667 //Location of oggThumb binary (used over the ffmpeg version)
9768 $wgOggThumbLocation = '/usr/bin/oggThumb';
9869
@@ -121,3 +92,38 @@
12293 // prevent the applet from loading them.
12394 //
12495 $wgCortadoJarFile = "cortado-ovt-stripped-0.5.1.jar";
 96+
 97+/******************* CONFIGURATION ENDS HERE **********************/
 98+
 99+if( $wgEnableTimedText ){
 100+/**
 101+ * Handle Adding of "timedText" NameSpace
 102+ */
 103+$wgTimedTextNS = null;
 104+
 105+// Make sure $wgExtraNamespaces in an array (set to NULL by default) :
 106+if ( !is_array( $wgExtraNamespaces ) ) {
 107+ $wgExtraNamespaces = array();
 108+}
 109+// Check for "TimedText" NS
 110+$maxNS = 101; // content pages need "even" namespaces
 111+foreach($wgExtraNamespaces as $ns => $nsTitle ){
 112+ if( $nsTitle == 'TimedText' ){
 113+ $wgTimedTextNS = $ns;
 114+ }
 115+ if( $ns > $maxNS ){
 116+ $maxNs = $ns;
 117+ }
 118+}
 119+// If not found add Add a custom timedText NS
 120+if( !$wgTimedTextNS ){
 121+ $wgTimedTextNS = ( $maxNS + 1 );
 122+ $wgExtraNamespaces[ $wgTimedTextNS ] = 'TimedText';
 123+ $wgExtraNamespaces[ $wgTimedTextNS +1 ] = 'TimedText_talk';
 124+}
 125+define( "NS_TIMEDTEXT", $wgTimedTextNS);
 126+// Assume $wgTimedTextNS +1 for talk
 127+define( "NS_TIMEDTEXT_TALK", $wgTimedTextNS +1);
 128+
 129+
 130+} // end of handling timedText
\ No newline at end of file
Index: trunk/extensions/OggHandler/OggHandler_body.php
@@ -467,9 +467,9 @@
468468
469469 function setHeaders( $out ) {
470470 global $wgOggScriptVersion, $wgCortadoJarFile, $wgServer, $wgUser, $wgScriptPath,
471 - $wgPlayerStatsCollection, $wgVideoTagOut, $wgEnableJS2system;
 471+ $wgPlayerStatsCollection, $wgVideoTagOut;
472472
473 - if( $wgVideoTagOut && $wgEnableJS2system){
 473+ if( $wgVideoTagOut ){
474474 // We could add "video" tag module stuff here if want. specifically:
475475
476476 // <script type="text/javascript" src="js/mwEmbed/jsScriptLoader.php?class=window.jQuery,mwEmbed,$j.ui,mw.EmbedPlayer,nativeEmbed,ctrlBuilder,mvpcfConfig,kskinConfig,$j.fn.menu,$j.cookie,$j.ui.slider,mw.TimedText&debug=true"></script>
@@ -524,7 +524,7 @@
525525 );
526526 }
527527
528 - //if collecting stats add relevant code:
 528+ // If collecting stats add relevant code:
529529 if( $wgPlayerStatsCollection ){
530530 //the player stats js file MUST be on the same server as OggHandler
531531 $playerStats_js = htmlspecialchars ( $wgScriptPath ). '/extensions/PlayerStatsGrabber/playerStats.js';
@@ -595,8 +595,8 @@
596596 }
597597
598598 function toHtml( $options = array() ) {
599 - global $wgEnableTemporalOggUrls, $wgVideoTagOut, $wgEnableJS2system,
600 - $wgScriptPath;
 599+ global $wgEnableTemporalOggUrls, $wgVideoTagOut,
 600+ $wgScriptPath, $wgEnableTimedText;
601601
602602 wfLoadExtensionMessages( 'OggHandler' );
603603 if ( count( func_get_args() ) == 2 ) {
@@ -620,8 +620,8 @@
621621 $thumbDivAttribs = array();
622622 $showDescIcon = false;
623623
624 - //check if outputting to video tag or oggHandler
625 - if( $wgVideoTagOut && $wgEnableJS2system ){
 624+ // Check if outputting to video tag or oggHandler
 625+ if( $wgVideoTagOut ){
626626 //video tag output:
627627 if ( $this->isVideo ) {
628628 $playerHeight = $height;
@@ -648,11 +648,12 @@
649649 'startOffset' => $offset,
650650 'linkback' => $linkAttribs['href']
651651 );
 652+ // Init $timedTextSources string
 653+ $timedTextSources = '';
652654
653 -
654655 if( $this->file->getRepoName() == 'shared' ){
655656 $videoAttr['sharedWiki'] = true;
656 - }else{
 657+ }else if( $wgEnableTimedText ){
657658 // Get the list of subtitles available
658659 $params = new FauxRequest( array (
659660 'action' => 'query',
@@ -668,7 +669,7 @@
669670 // Get the list of language Names
670671 $langNames = Language::getLanguageNames();
671672
672 - $timedTextSources = '';
 673+
673674 if($data['query'] && $data['query']['allpages'] ){
674675 foreach( $data['query']['allpages'] as $na => $page ){
675676 $pageTitle = $page['title'];
@@ -678,12 +679,9 @@
679680 $languageKey = array_pop( $tileParts );
680681 }
681682 //If there is no valid language continue:
682 -
683683 if( !isset( $langNames[ $languageKey ] ) ){
684684 continue;
685685 }
686 - // NOTE: I don't know if api.php pointer is the cleanest path system
687 - // At any rate we need a strip XML call for desktop srt players
688686 $textAttr = array(
689687 'src' => "{$wgServer}{$wgScriptPath}/api.php?" .
690688 'action=parse&format=json&page=' . $pageTitle,
@@ -695,8 +693,9 @@
696694 }
697695 }
698696
699 - if( $wgEnableTemporalOggUrls )
 697+ if( $wgEnableTemporalOggUrls ){
700698 $videoAttr['URLTimeEncoding'] = 'true';
 699+ }
701700
702701 $s = Xml::tags( 'video', $videoAttr,
703702 Xml::tags('div', array(

Status & tagging log