Index: trunk/extensions/OggHandler/OggHandler.php |
— | — | @@ -32,38 +32,6 @@ |
33 | 33 | $wgHooks['LanguageGetMagic'][] = 'OggHandler::registerMagicWords'; |
34 | 34 | |
35 | 35 | |
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 | | - |
68 | 36 | //Setup a hook for iframe=true (will strip the interface and only output the player) |
69 | 37 | $wgHooks['ArticleFromTitle'][] = 'OggHandler::iframeOutputHook'; |
70 | 38 | |
— | — | @@ -87,11 +55,14 @@ |
88 | 56 | |
89 | 57 | //if $wgEnableJS2system = true and the below variable is set to true |
90 | 58 | // then we can output the <video> tag and its re-written by mv_embed |
91 | | -$wgVideoTagOut = true; |
| 59 | +$wgVideoTagOut = false; |
92 | 60 | |
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; |
95 | 63 | |
| 64 | +// If timedText is enabled |
| 65 | +$wgEnableTimedText = false; |
| 66 | + |
96 | 67 | //Location of oggThumb binary (used over the ffmpeg version) |
97 | 68 | $wgOggThumbLocation = '/usr/bin/oggThumb'; |
98 | 69 | |
— | — | @@ -121,3 +92,38 @@ |
122 | 93 | // prevent the applet from loading them. |
123 | 94 | // |
124 | 95 | $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 @@ |
468 | 468 | |
469 | 469 | function setHeaders( $out ) { |
470 | 470 | global $wgOggScriptVersion, $wgCortadoJarFile, $wgServer, $wgUser, $wgScriptPath, |
471 | | - $wgPlayerStatsCollection, $wgVideoTagOut, $wgEnableJS2system; |
| 471 | + $wgPlayerStatsCollection, $wgVideoTagOut; |
472 | 472 | |
473 | | - if( $wgVideoTagOut && $wgEnableJS2system){ |
| 473 | + if( $wgVideoTagOut ){ |
474 | 474 | // We could add "video" tag module stuff here if want. specifically: |
475 | 475 | |
476 | 476 | // <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 @@ |
525 | 525 | ); |
526 | 526 | } |
527 | 527 | |
528 | | - //if collecting stats add relevant code: |
| 528 | + // If collecting stats add relevant code: |
529 | 529 | if( $wgPlayerStatsCollection ){ |
530 | 530 | //the player stats js file MUST be on the same server as OggHandler |
531 | 531 | $playerStats_js = htmlspecialchars ( $wgScriptPath ). '/extensions/PlayerStatsGrabber/playerStats.js'; |
— | — | @@ -595,8 +595,8 @@ |
596 | 596 | } |
597 | 597 | |
598 | 598 | function toHtml( $options = array() ) { |
599 | | - global $wgEnableTemporalOggUrls, $wgVideoTagOut, $wgEnableJS2system, |
600 | | - $wgScriptPath; |
| 599 | + global $wgEnableTemporalOggUrls, $wgVideoTagOut, |
| 600 | + $wgScriptPath, $wgEnableTimedText; |
601 | 601 | |
602 | 602 | wfLoadExtensionMessages( 'OggHandler' ); |
603 | 603 | if ( count( func_get_args() ) == 2 ) { |
— | — | @@ -620,8 +620,8 @@ |
621 | 621 | $thumbDivAttribs = array(); |
622 | 622 | $showDescIcon = false; |
623 | 623 | |
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 ){ |
626 | 626 | //video tag output: |
627 | 627 | if ( $this->isVideo ) { |
628 | 628 | $playerHeight = $height; |
— | — | @@ -648,11 +648,12 @@ |
649 | 649 | 'startOffset' => $offset, |
650 | 650 | 'linkback' => $linkAttribs['href'] |
651 | 651 | ); |
| 652 | + // Init $timedTextSources string |
| 653 | + $timedTextSources = ''; |
652 | 654 | |
653 | | - |
654 | 655 | if( $this->file->getRepoName() == 'shared' ){ |
655 | 656 | $videoAttr['sharedWiki'] = true; |
656 | | - }else{ |
| 657 | + }else if( $wgEnableTimedText ){ |
657 | 658 | // Get the list of subtitles available |
658 | 659 | $params = new FauxRequest( array ( |
659 | 660 | 'action' => 'query', |
— | — | @@ -668,7 +669,7 @@ |
669 | 670 | // Get the list of language Names |
670 | 671 | $langNames = Language::getLanguageNames(); |
671 | 672 | |
672 | | - $timedTextSources = ''; |
| 673 | + |
673 | 674 | if($data['query'] && $data['query']['allpages'] ){ |
674 | 675 | foreach( $data['query']['allpages'] as $na => $page ){ |
675 | 676 | $pageTitle = $page['title']; |
— | — | @@ -678,12 +679,9 @@ |
679 | 680 | $languageKey = array_pop( $tileParts ); |
680 | 681 | } |
681 | 682 | //If there is no valid language continue: |
682 | | - |
683 | 683 | if( !isset( $langNames[ $languageKey ] ) ){ |
684 | 684 | continue; |
685 | 685 | } |
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 |
688 | 686 | $textAttr = array( |
689 | 687 | 'src' => "{$wgServer}{$wgScriptPath}/api.php?" . |
690 | 688 | 'action=parse&format=json&page=' . $pageTitle, |
— | — | @@ -695,8 +693,9 @@ |
696 | 694 | } |
697 | 695 | } |
698 | 696 | |
699 | | - if( $wgEnableTemporalOggUrls ) |
| 697 | + if( $wgEnableTemporalOggUrls ){ |
700 | 698 | $videoAttr['URLTimeEncoding'] = 'true'; |
| 699 | + } |
701 | 700 | |
702 | 701 | $s = Xml::tags( 'video', $videoAttr, |
703 | 702 | Xml::tags('div', array( |