Index: branches/js2-work/phase3/includes/OutputPage.php |
— | — | @@ -2201,7 +2201,7 @@ |
2202 | 2202 | |
2203 | 2203 | $ret .= implode( "\n", array( |
2204 | 2204 | $this->getHeadLinks(), |
2205 | | - $this->getCssLinks(), |
| 2205 | + $this->buildCssLinks(), |
2206 | 2206 | $this->getHeadScripts( $sk ), |
2207 | 2207 | $this->getHeadItems(), |
2208 | 2208 | ) ); |
— | — | @@ -2532,7 +2532,7 @@ |
2533 | 2533 | * Build a set of <link>s for the stylesheets specified in the $this->styles array. |
2534 | 2534 | * These will be applied to various media & IE conditionals. |
2535 | 2535 | */ |
2536 | | - public function getCssLinks() { |
| 2536 | + public function buildCssLinks() { |
2537 | 2537 | global $wgEnableScriptLoader; |
2538 | 2538 | |
2539 | 2539 | $scriptLoaderCss = ''; |
Index: branches/js2-work/phase3/includes/Skin.php |
— | — | @@ -395,6 +395,7 @@ |
396 | 396 | 'wgUrlProtocols' => wfUrlProtocols(), |
397 | 397 | 'wgArticlePath' => $wgArticlePath, |
398 | 398 | 'wgScriptPath' => $wgScriptPath, |
| 399 | + 'wgScriptLoaderLocation' => $wgScriptPath . 'mwScriptLoader.php', |
399 | 400 | 'wgScriptExtension' => $wgScriptExtension, |
400 | 401 | 'wgScript' => $wgScript, |
401 | 402 | 'wgVariantArticlePath' => $wgVariantArticlePath, |
Index: branches/js2-work/phase3/js/mwEmbed/includes/jsClassLoader.php |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | } |
40 | 40 | self::$classesLoaded = true; |
41 | 41 | |
42 | | - $mwEmbedAbsolutePath = ( $wgMwEmbedDirectory == '' )? $IP: $IP .'/' .$wgMwEmbedDirectory; |
| 42 | + $mwEmbedAbsolutePath = ( $wgMwEmbedDirectory == '' ) ? $IP : $IP .'/' .$wgMwEmbedDirectory; |
43 | 43 | // Add the mwEmbed localizations |
44 | 44 | $wgExtensionMessagesFiles[ 'mwEmbed' ] = $mwEmbedAbsolutePath . '/languages/mwEmbed.i18n.php'; |
45 | 45 | |
Index: branches/js2-work/phase3/js/mwEmbed/includes/noMediaWikiConfig.php |
— | — | @@ -1,7 +1,9 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * No mediaWikiConfig sets variables for using the script-loader and mwEmbed modules |
| 4 | + * NoMediaWikiConfig sets variables for using the script-loader and mwEmbed modules |
5 | 5 | * without a complete mediaWiki install. |
| 6 | + * |
| 7 | + * NoMediaWikiConfig also copies some utility functions from mediaWiki |
6 | 8 | */ |
7 | 9 | |
8 | 10 | // Google Closure Compiler ( for improved minification ) |
— | — | @@ -195,6 +197,28 @@ |
196 | 198 | function wfRestoreWarnings() { |
197 | 199 | wfSuppressWarnings( true ); |
198 | 200 | } |
| 201 | + |
| 202 | + |
| 203 | +/** |
| 204 | + * Simplifed MediaWiki wfShellExec Function |
| 205 | + * |
| 206 | + * Execute a shell command, with time and memory limits mirrored from the PHP |
| 207 | + * configuration if supported. |
| 208 | + * @param $cmd Command line, properly escaped for shell. |
| 209 | + * @param &$retval optional, will receive the program's exit code. |
| 210 | + * (non-zero is usually failure) |
| 211 | + * @return collected stdout as a string (trailing newlines stripped) |
| 212 | + */ |
| 213 | +function wfShellExec( $cmd, &$retval=null ) { |
| 214 | + $retval = 1; // error by default? |
| 215 | + ob_start(); |
| 216 | + passthru( $cmd, $retval ); |
| 217 | + $output = ob_get_contents(); |
| 218 | + ob_end_clean(); |
| 219 | + return $output; |
| 220 | +} |
| 221 | + |
| 222 | +/* Stubs for mediawiki XML class */ |
199 | 223 | class Xml { |
200 | 224 | public static function escapeJsString( $string ) { |
201 | 225 | // See ECMA 262 section 7.8.4 for string literal format |
Index: branches/js2-work/phase3/js/mwEmbed/languages/mw.Language.js |
— | — | @@ -28,30 +28,35 @@ |
29 | 29 | messageCache[ i ] = msgSet[i]; |
30 | 30 | } |
31 | 31 | } |
32 | | - |
33 | | - var messageKeyQueue = []; |
| 32 | + |
| 33 | + mw.currentClassMissingMessages = true; |
34 | 34 | /** |
35 | 35 | * mw.addMessagesKey function |
36 | 36 | * Adds a msgKey to be pulled in remotely. |
37 | 37 | * |
38 | | - * NOTE the script-loader should replace this with localized addMessages calls |
| 38 | + * NOTE the script-loader should replace addMessageKeys with localized addMessages calls |
39 | 39 | * |
40 | 40 | * If addMessagesKey is called then we are running in raw file debug mode. |
41 | 41 | * it populates the messegeKeyQueue and loads the values in a separate request callback |
42 | 42 | * |
43 | 43 | * @param {Array} msgSet The set of msgs to be loaded |
44 | 44 | */ |
45 | | - mw.addMessageKeys = function( msgSet ) { |
46 | | - messageKeyQueue.concat( msgSet ); |
| 45 | + mw.addMessageKeys = function( msgSet ) { |
| 46 | + // Msg set is ignored ( we use class names to retrive msgs from script-loader ) |
| 47 | + mw.currentClassMissingMessages = true; |
47 | 48 | } |
48 | 49 | |
49 | 50 | /** |
50 | 51 | * NOTE: this is somewhat of a hack. But its only used in debug mode since |
51 | 52 | * normal msg loading happens via script-loader |
52 | 53 | */ |
53 | | - mw.loadQueuedMessages = function( classSet, callback ){ |
54 | | - // Load the queued msgs ( requires access to the mediaWiki entry point ) |
55 | | - |
| 54 | + mw.loadQueuedMessages = function( classSet, callback ) { |
| 55 | + // Check if wgScriptLoaderPath is set ( else guess the path relative to mwEmbed) |
| 56 | + if ( wgScriptLoaderLocation == 'undefined' || !wgScriptLoaderLocation ){ |
| 57 | + wgScriptLoaderLocation = mw.getMwEmbedPath() + 'jsScriptLoader.php'; |
| 58 | + } |
| 59 | + // Run the addMessages script-loader call |
| 60 | + $j.getScript( wgScriptLoaderLocation + '?class=' + classSet.join(',') + '&ctype=onlymsg', callback); |
56 | 61 | } |
57 | 62 | |
58 | 63 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -8,65 +8,65 @@ |
9 | 9 | * |
10 | 10 | */ |
11 | 11 | |
12 | | -mw.addMessages( { |
13 | | - "mwe-loading_plugin" : "loading plugin ...", |
14 | | - "mwe-select_playback" : "Set playback preference", |
15 | | - "mwe-link_back" : "Link back", |
16 | | - "mwe-error_swap_vid" : "Error: mwEmbed was unable to swap the video tag for the mwEmbed interface", |
17 | | - "mwe-add_to_end_of_sequence" : "Add to end of sequence", |
18 | | - "mwe-missing_video_stream" : "The video file for this stream is missing", |
19 | | - "mwe-play_clip" : "Play clip", |
20 | | - "mwe-pause_clip" : "Pause clip", |
21 | | - "mwe-volume_control" : "Volume control", |
22 | | - "mwe-player_options" : "Player options", |
23 | | - "mwe-timed_text" : "Timed text", |
24 | | - "mwe-player_fullscreen" : "Fullscreen", |
25 | | - "mwe-next_clip_msg" : "Play next clip", |
26 | | - "mwe-prev_clip_msg" : "Play previous clip", |
27 | | - "mwe-current_clip_msg" : "Continue playing this clip", |
28 | | - "mwe-seek_to" : "Seek $1", |
29 | | - "mwe-paused" : "paused", |
30 | | - "mwe-download_segment" : "Download selection:", |
31 | | - "mwe-download_full" : "Download full video file:", |
32 | | - "mwe-download_right_click" : "To download, right click and select <i>Save link as...<\/i>", |
33 | | - "mwe-download_clip" : "Download video", |
34 | | - "mwe-download_text" : "Download text (<a style=\"color:white\" title=\"cmml\" href=\"http:\/\/wiki.xiph.org\/index.php\/CMML\">CMML<\/a> xml):", |
35 | | - "mwe-download" : "Download", |
36 | | - "mwe-share" : "Share", |
37 | | - "mwe-credits" : "Credits", |
38 | | - "mwe-clip_linkback" : "Clip source page", |
39 | | - "mwe-chose_player" : "Chose video player", |
40 | | - "mwe-no-player" : "No player available for $1", |
41 | | - "mwe-share_this_video" : "Share this video", |
42 | | - "mwe-video_credits" : "Video credits", |
43 | | - "mwe-kaltura-platform-title" : "Kaltura open source video platform", |
44 | | - "mwe-menu_btn" : "Menu", |
45 | | - "mwe-close_btn" : "Close", |
46 | | - "mwe-ogg-player-vlc-player" : "VLC player", |
47 | | - "mwe-ogg-player-oggNative" : "HTML5 ogg player", |
48 | | - "mwe-ogg-player-h264Native" : "HTML5 h.264 player", |
49 | | - "mwe-ogg-player-oggPlugin" : "Generic Ogg plugin", |
50 | | - "mwe-ogg-player-quicktime-mozilla" : "QuickTime plugin", |
51 | | - "mwe-ogg-player-quicktime-activex" : "QuickTime ActiveX", |
52 | | - "mwe-ogg-player-cortado" : "Java Cortado", |
53 | | - "mwe-ogg-player-flowplayer" : "Flowplayer", |
54 | | - "mwe-ogg-player-kplayer" : "Kaltura flash player", |
55 | | - "mwe-ogg-player-selected" : "(selected)", |
56 | | - "mwe-ogg-player-omtkplayer" : "OMTK Flash Vorbis", |
57 | | - "mwe-generic_missing_plugin" : "You browser does not appear to support the following playback type: <b>$1<\/b><br \/>Visit the <a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Media_help\">Playback Methods<\/a> page to download a player.<br \/>", |
58 | | - "mwe-for_best_experience" : "For a better video playback experience we recommend the <b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">latest firefox<\/a>.<\/b>", |
59 | | - "mwe-do_not_warn_again" : "Dismiss for now.", |
60 | | - "mwe-playerSelect" : "Players", |
61 | | - "mwe-read_before_embed" : "<a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">Read this<\/a> before embedding.", |
62 | | - "mwe-embed_site_or_blog" : "Embed on a page", |
63 | | - "mwe-related_videos" : "Related videos", |
64 | | - "mwe-seeking" : "seeking", |
65 | | - "mwe-copy-code" : "Copy code", |
66 | | - "mwe-video-h264" : "H.264 video", |
67 | | - "mwe-video-flv" : "Flash video", |
68 | | - "mwe-video-ogg" : "Ogg video", |
69 | | - "mwe-video-audio" : "Ogg audio" |
70 | | -} ); |
| 12 | +mw.addMessageKeys( [ |
| 13 | + "mwe-loading_plugin", |
| 14 | + "mwe-select_playback", |
| 15 | + "mwe-link_back", |
| 16 | + "mwe-error_swap_vid", |
| 17 | + "mwe-add_to_end_of_sequence", |
| 18 | + "mwe-missing_video_stream", |
| 19 | + "mwe-play_clip", |
| 20 | + "mwe-pause_clip", |
| 21 | + "mwe-volume_control", |
| 22 | + "mwe-player_options", |
| 23 | + "mwe-timed_text", |
| 24 | + "mwe-player_fullscreen", |
| 25 | + "mwe-next_clip_msg", |
| 26 | + "mwe-prev_clip_msg", |
| 27 | + "mwe-current_clip_msg", |
| 28 | + "mwe-seek_to", |
| 29 | + "mwe-paused", |
| 30 | + "mwe-download_segment", |
| 31 | + "mwe-download_full", |
| 32 | + "mwe-download_right_click", |
| 33 | + "mwe-download_clip", |
| 34 | + "mwe-download_text", |
| 35 | + "mwe-download", |
| 36 | + "mwe-share", |
| 37 | + "mwe-credits", |
| 38 | + "mwe-clip_linkback", |
| 39 | + "mwe-chose_player", |
| 40 | + "mwe-no-player", |
| 41 | + "mwe-share_this_video", |
| 42 | + "mwe-video_credits", |
| 43 | + "mwe-kaltura-platform-title", |
| 44 | + "mwe-menu_btn", |
| 45 | + "mwe-close_btn", |
| 46 | + "mwe-ogg-player-vlc-player", |
| 47 | + "mwe-ogg-player-oggNative", |
| 48 | + "mwe-ogg-player-h264Native", |
| 49 | + "mwe-ogg-player-oggPlugin", |
| 50 | + "mwe-ogg-player-quicktime-mozilla", |
| 51 | + "mwe-ogg-player-quicktime-activex", |
| 52 | + "mwe-ogg-player-cortado", |
| 53 | + "mwe-ogg-player-flowplayer", |
| 54 | + "mwe-ogg-player-kplayer", |
| 55 | + "mwe-ogg-player-selected", |
| 56 | + "mwe-ogg-player-omtkplayer", |
| 57 | + "mwe-generic_missing_plugin", |
| 58 | + "mwe-for_best_experience", |
| 59 | + "mwe-do_not_warn_again", |
| 60 | + "mwe-playerSelect", |
| 61 | + "mwe-read_before_embed", |
| 62 | + "mwe-embed_site_or_blog", |
| 63 | + "mwe-related_videos", |
| 64 | + "mwe-seeking", |
| 65 | + "mwe-copy-code", |
| 66 | + "mwe-video-h264", |
| 67 | + "mwe-video-flv", |
| 68 | + "mwe-video-ogg", |
| 69 | + "mwe-video-audio" |
| 70 | +] ); |
71 | 71 | |
72 | 72 | /* |
73 | 73 | * The default video attributes supported by embedPlayer |
Index: branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php |
— | — | @@ -194,7 +194,7 @@ |
195 | 195 | |
196 | 196 | |
197 | 197 | // Check if google closure compiler is enabled and we can get its output |
198 | | - if( $wgJavaPath && $wgClosureCompilerPath && wfShellExecEnabled() ){ |
| 198 | + if( $wgJavaPath && $wgClosureCompilerPath ){ |
199 | 199 | $jsMinVal = self::getClosureMinifiedJs( $js_string, $requestKey ); |
200 | 200 | if( $jsMinVal ){ |
201 | 201 | return $jsMinVal; |
— | — | @@ -239,13 +239,14 @@ |
240 | 240 | $cmd.= ' --compilation_level ' . wfEscapeShellArg( $wgClosureCompilerLevel ); |
241 | 241 | |
242 | 242 | // only output js ( no warnings ) |
243 | | - $cmd.= ' --warning_level QUIET'; |
244 | | - //print "run: $cmd"; |
| 243 | + $cmd.= ' --warning_level QUIET'; |
245 | 244 | // Run the command: |
246 | 245 | $jsMinVal = wfShellExec($cmd , $retval); |
247 | 246 | |
248 | 247 | // Clean up ( remove temporary file ) |
| 248 | + wfSuppressWarnings(); |
249 | 249 | unlink( $jsFileName ); |
| 250 | + wfRestoreWarnings(); |
250 | 251 | |
251 | 252 | if( strlen( $jsMinVal ) != 0 && $retval === 0){ |
252 | 253 | //die( "used closure" ); |
— | — | @@ -530,15 +531,8 @@ |
531 | 532 | //set English as default |
532 | 533 | $this->langCode = 'en'; |
533 | 534 | } |
534 | | - $this->langCode = self::checkForCommonsLanguageFormHack( $this->langCode ); |
| 535 | + $this->langCode = self::checkForCommonsLanguageFormHack( $this->langCode ); |
535 | 536 | |
536 | | - // Check if the outupt format is "css" or "js" |
537 | | - if( isset( $_GET['ctype'] ) && $_GET['ctype'] == 'css' ){ |
538 | | - $this->outputFormat = 'css'; |
539 | | - } else { |
540 | | - $this->outputFormat = 'js'; |
541 | | - } |
542 | | - |
543 | 537 | $reqClassList = false; |
544 | 538 | if ( isset( $_GET['class'] ) && $_GET['class'] != '' ) { |
545 | 539 | $reqClassList = explode( ',', $_GET['class'] ); |
— | — | @@ -657,9 +651,9 @@ |
658 | 652 | } |
659 | 653 | // Check if the outupt format is "css" or "js" |
660 | 654 | if( isset( $_GET['ctype'] ) && $_GET['ctype'] == 'css' ){ |
661 | | - $outputFormat = 'css'; |
| 655 | + $this->outputFormat = 'css'; |
662 | 656 | } else { |
663 | | - $outputFormat = 'js'; |
| 657 | + $this->outputFormat = 'js'; |
664 | 658 | } |
665 | 659 | |
666 | 660 | // Add the language code to the requestKey: |