Skip to content

Commit

Permalink
Merge branch 'fv-player-8' of https://github.com/foliovision/fv-wordp…
Browse files Browse the repository at this point in the history
…ress-flowplayer into fv-player-8
  • Loading branch information
fvmartin committed Nov 8, 2024
2 parents daa7d12 + 1776ad9 commit bea1728
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 35 deletions.
22 changes: 5 additions & 17 deletions test/integration/frontend/testSimpleShortcode.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,32 @@
<link rel='stylesheet' id='fv_freedomplayer_additions-css' href='http://example.org/wp-content/plugins/fv-wordpress-flowplayer/css/fv-player-additions.css?ver=1.2.3' type='text/css' media='all' />
<link rel="https://api.w.org/" href="http://example.org/index.php?rest_route=/" /><link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://example.org/xmlrpc.php?rsd" />
<style type="text/css">
.flowplayer.skin-slim { background-color: #000000 !important; }
.flowplayer.skin-slim .fp-color, .flowplayer.skin-slim .fp-selected, .fp-playlist-external.skin-slim .fvp-progress, .fp-color { background-color: #bb0000 !important; }
.flowplayer.skin-slim .fp-color-fill .svg-color, .flowplayer.skin-slim .fp-color-fill svg.fvp-icon, .flowplayer.skin-slim .fp-color-fill { fill: #bb0000 !important; color: #bb0000 !important; }
.flowplayer.skin-slim .fp-controls, .fv-player-buttons a:active, .fv-player-buttons a { background-color: transparent !important; }
.flowplayer.skin-slim .fp-elapsed, .flowplayer.skin-slim .fp-duration { color: whitesmoke !important; }
.flowplayer.skin-slim .fv-player-video-checker { color: whitesmoke !important; }
.flowplayer.skin-slim .fp-bar span.chapter_passed{ background-color: #bb0000 !important; }
.fv-player-buttons a.current { background-color: #bb0000 !important; }
#content .flowplayer.skin-slim, .flowplayer.skin-slim { font-family: Tahoma, Geneva, sans-serif; }
.flowplayer.skin-slim .fp-dropdown li.active { background-color: #bb0000 !important }
.flowplayer.skin-youtuby { background-color: #000000 !important; }
.flowplayer.skin-youtuby .fp-color, .flowplayer.skin-youtuby .fp-selected, .fp-playlist-external.skin-youtuby .fvp-progress, .fp-color { background-color: #bb0000 !important; }
.flowplayer.skin-youtuby .fp-color-fill .svg-color, .flowplayer.skin-youtuby .fp-color-fill svg.fvp-icon, .flowplayer.skin-youtuby .fp-color-fill { fill: #bb0000 !important; color: #bb0000 !important; }
.flowplayer.skin-youtuby .fp-controls, .fv-player-buttons a:active, .fv-player-buttons a { background-color: rgba(0, 0, 0, 0.5) !important; }
.flowplayer.skin-youtuby .fp-elapsed, .flowplayer.skin-youtuby .fp-duration { color: #ffffff !important; }
.flowplayer.skin-youtuby .fv-player-video-checker { color: #ffffff !important; }
.flowplayer.skin-youtuby .fv-ab-loop { background-color: rgba(0, 0, 0, 0.5) !important; }
.flowplayer.skin-youtuby .fv_player_popup, .fvfp_admin_error_content { background: rgba(0, 0, 0, 0.5); }
.flowplayer.skin-youtuby .fp-bar span.chapter_passed{ background-color: #bb0000 !important; }
.fv-player-buttons a.current { background-color: #bb0000 !important; }
#content .flowplayer.skin-youtuby, .flowplayer.skin-youtuby { font-family: Tahoma, Geneva, sans-serif; }
.flowplayer.skin-youtuby .fp-dropdown li.active { background-color: #bb0000 !important }
.flowplayer.skin-custom { background-color: #000000 !important; }
.flowplayer.skin-custom .fp-color, .flowplayer.skin-custom .fp-selected, .fp-playlist-external.skin-custom .fvp-progress, .fp-color { background-color: #bb0000 !important; }
.flowplayer.skin-custom .fp-color-fill .svg-color, .flowplayer.skin-custom .fp-color-fill svg.fvp-icon, .flowplayer.skin-custom .fp-color-fill { fill: #bb0000 !important; color: #bb0000 !important; }
.flowplayer.skin-custom .fp-controls, .fv-player-buttons a:active, .fv-player-buttons a { background-color: #333333 !important; }
.flowplayer.skin-custom a.fp-play, .flowplayer.skin-custom a.fp-volumebtn, .flowplayer.skin-custom .fp-controls, .flowplayer.skin-custom .fv-ab-loop, .fv-player-buttons a:active, .fv-player-buttons a { color: #eeeeee !important; }
.flowplayer.skin-custom a.fp-play, .flowplayer.skin-custom a.fp-volumebtn, .flowplayer.skin-custom .fp-controls, .flowplayer.skin-custom .fv-ab-loop, .fv-player-buttons a:active, .fv-player-buttons a { color: #eeeeee }
.flowplayer.skin-custom .fp-controls .fv-fp-prevbtn:before, .flowplayer.skin-custom .fp-controls .fv-fp-nextbtn:before { border-color: #eeeeee !important; }
.flowplayer.skin-custom .fvfp_admin_error, .flowplayer.skin-custom .fvfp_admin_error a, #content .flowplayer.skin-custom .fvfp_admin_error a { color: #eeeeee; }
.flowplayer.skin-custom svg.fvp-icon { fill: #eeeeee !important; }
.flowplayer.skin-custom .fp-volumeslider, .flowplayer.skin-custom .fp-buffer { background-color: #eeeeee !important; }
.flowplayer.skin-custom .fp-bar span.chapter_buffered{ background-color: #eeeeee !important; }
.flowplayer.skin-custom .fp-elapsed, .flowplayer.skin-custom .fp-duration { color: #eeeeee !important; }
.flowplayer.skin-custom .fv-player-video-checker { color: #eeeeee !important; }
.flowplayer.skin-custom .fp-controls svg { fill: #eeeeee; stroke: #eeeeee }
.flowplayer.skin-custom .fv-ab-loop { background-color: #333333 !important; }
.flowplayer.skin-custom .fv_player_popup, .fvfp_admin_error_content { background: #333333; }
.flowplayer.skin-custom .fp-bar span.chapter_passed{ background-color: #bb0000 !important; }
Expand All @@ -63,28 +55,24 @@
.fp-playlist-external.fp-playlist-only-captions a.is-active h4,
.fp-playlist-external.fp-playlist-only-captions a.is-active:hover h4 { color:#bb0000; }
.fp-playlist-vertical { background-color:#808080; }
.flowplayer .fp-player .fp-captions p { font-size: 16px; } .flowplayer .fp-logo { bottom: 30px; left: 15px; }
.flowplayer .fp-player .fp-captions p { font-size: 16px; } .flowplayer > .fp-player > .fp-logo > img { margin: auto auto 2% 2% }
.flowplayer .fp-player .fp-captions p { background-color: rgba(0,0,0,0.5) }
.flowplayer .fp-player.is-sticky { max-width: 380px }
@media screen and ( max-width: 480px ) {
.flowplayer .fp-player.is-sticky { max-width: 100% }
}

</style>
<div id="wpfp_3607b211dfa3827d5a62f96a0823a499" data-item="{&quot;sources&quot;:[{&quot;src&quot;:&quot;https:\/\/cdn.site.com\/video.mp4&quot;,&quot;type&quot;:&quot;video\/mp4&quot;}]}" class="freedomplayer flowplayer no-brand is-splash is-paused skin-slim no-svg fp-slim fp-edgy" data-fv-embed="http://example.org/?p=1234&amp;fv_player_embed=1" style="max-width: 640px; max-height: 360px; " data-ratio="0.5625">
<div id="wpfp_3607b211dfa3827d5a62f96a0823a499" data-item="{&quot;sources&quot;:[{&quot;src&quot;:&quot;https:\/\/cdn.site.com\/video.mp4&quot;,&quot;type&quot;:&quot;video\/mp4&quot;}]}" class="freedomplayer flowplayer no-brand is-splash is-paused skin-slim no-svg fp-slim fp-edgy" style="max-width: 640px; max-height: 360px; " data-ratio="0.5625">
<div class="fp-ratio" style="padding-top: 56.25%"></div>
<div class="fp-ui"><noscript>Please enable JavaScript</noscript><div class="fp-play fp-visible"><svg class="fp-play-sharp-fill" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><style>.fp-color-play{opacity:0.65;}.controlbutton{fill:#fff;}</style></defs><title>play-sharp-fill</title><path class="fp-color-play" d="M49.9217-.078a50,50,0,1,0,50,50A50.0564,50.0564,0,0,0,49.9217-.078Z"/><polygon class="controlbutton" points="73.601 50 37.968 70.573 37.968 29.427 73.601 50" filter="url(#f1)"/></svg></div><div class="fp-preload"><b></b><b></b><b></b><b></b></div></div>
<div class='fvp-share-bar'><ul class="fvp-sharing">
<li><a class="sharing-facebook" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fexample.org%2F%3Fp%3D1234" target="_blank"></a></li>
<li><a class="sharing-twitter" href="https://twitter.com/intent/tweet?text=Test+Blog+&url=http%3A%2F%2Fexample.org%2F%3Fp%3D1234" target="_blank"></a></li>
<li><a class="sharing-email" href="mailto:?body=Check%20out%20the%20amazing%20video%20here%3A%20http%3A%2F%2Fexample.org%2F%3Fp%3D1234" target="_blank"></a></li></ul><div><a class="sharing-link" href="http://example.org/?p=1234" target="_blank">Link</a></div><div><label><a class="embed-code-toggle" href="#"><strong>Embed</strong></a></label></div><div class="embed-code"><label>Copy and paste this HTML code into your webpage to embed.</label><textarea></textarea></div></div>
</div>

<script type='text/javascript' src='http://example.org/wp-includes/js/jquery/jquery.js?ver=3.6.3' id='jquery-core-js'></script>
<script type='text/javascript' src='http://example.org/wp-includes/js/jquery/jquery-migrate.js?ver=3.3.2' id='jquery-migrate-js'></script>
<script type='text/javascript' id='flowplayer-js-extra'>
/* <![CDATA[ */
var fv_flowplayer_conf = {"speeds":[0.25,0.5,0.75,1,1.25,1.5,1.75,2],"video_hash_links":"1","safety_resize":"1","volume":"0.7","default_volume":"0.7","mobile_landscape_fullscreen":"1","video_position_save_enable":"1","sticky_video":"off","sticky_place":"right-bottom","sticky_min_width":"1020","script_hls_js":"http:\/\/example.org\/wp-content\/plugins\/fv-wordpress-flowplayer\/freedom-video-player\/hls.min.js?ver=1.2.3","script_dash_js":"http:\/\/example.org\/wp-content\/plugins\/fv-wordpress-flowplayer\/freedom-video-player\/dash.mediaplayer.min.js?ver=1.2.3","script_dash_js_engine":"http:\/\/example.org\/wp-content\/plugins\/fv-wordpress-flowplayer\/freedom-video-player\/fv-player-dashjs.dev.js?ver=1.2.3","chromecast":"","youtube_browser_chrome":"standard","hlsjs":{"startLevel":-1,"fragLoadingMaxRetry":3,"levelLoadingMaxRetry":3,"capLevelToPlayerSize":true}};
var fv_flowplayer_conf = {"speeds":[0.25,0.5,0.75,1,1.25,1.5,1.75,2],"video_hash_links":"","safety_resize":"1","logo_over_video":"1","volume":"0.7","default_volume":"0.7","mobile_landscape_fullscreen":"1","video_position_save_enable":"1","sticky_video":"off","sticky_place":"right-bottom","sticky_min_width":"1020","script_hls_js":"http:\/\/example.org\/wp-content\/plugins\/fv-wordpress-flowplayer\/freedom-video-player\/hls.min.js?ver=1.2.3","script_dash_js":"http:\/\/example.org\/wp-content\/plugins\/fv-wordpress-flowplayer\/freedom-video-player\/dash.mediaplayer.min.js?ver=1.2.3","script_dash_js_engine":"http:\/\/example.org\/wp-content\/plugins\/fv-wordpress-flowplayer\/freedom-video-player\/fv-player-dashjs.dev.js?ver=1.2.3","airplay":"1","chromecast":"","youtube_browser_chrome":"standard","hlsjs":{"startLevel":-1,"fragLoadingMaxRetry":3,"levelLoadingMaxRetry":3,"capLevelToPlayerSize":true}};
var fv_player = {"ajaxurl":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"b9d85a3515","email_signup_nonce":"2c7fdf8087","video_position_save_nonce":"c5e58a9bed"};
var fv_flowplayer_translations = {"0":"","1":"Video loading aborted","2":"Network error","3":"Video not properly encoded","4":"Video file not found","5":"Unsupported video","6":"Skin not found","7":"SWF file not found","8":"Subtitles not found","10":"Unsupported video format.","11":"Click to watch the video","12":"[This post contains video, click to play]","video_expired":"<h2>Video file expired.<br \/>Please reload the page and play it again.<\/h2>","unsupported_format":"<h2>Unsupported video format.<br \/>Please use a Flash compatible device.<\/h2>","mobile_browser_detected_1":"Mobile browser detected, serving low bandwidth video.","mobile_browser_detected_2":"Click here for full quality","live_stream_failed":"<h2>Live stream load failed.<\/h2><h3>Please try again later, perhaps the stream is currently offline.<\/h3>","live_stream_failed_2":"<h2>Live stream load failed.<\/h2><h3>Please try again later, perhaps the stream is currently offline.<\/h3>","what_is_wrong":"Please tell us what is wrong :","full_sentence":"Please give us more information (a full sentence) so we can help you better","error_JSON":"Admin: Error parsing JSON","no_support_IE9":"Admin: Video checker doesn't support IE 9.","check_failed":"Admin: Check failed.","playlist_current":"Now Playing","playlist_item_no":"Item %d.","playlist_play_all":"Play All","playlist_play_all_button":"All","playlist_replay_all":"Replay Playlist","playlist_replay_video":"Repeat Track","playlist_shuffle":"Shuffle Playlist","video_issues":"Video Issues","video_reload":"Video loading has stalled, click to reload","link_copied":"Video Link Copied to Clipboard","live_stream_starting":"<h2>Live stream scheduled<\/h2><p>Starting in <span>%d<\/span>.<\/p>","live_stream_retry":"<h2>We are sorry, currently no live stream available.<\/h2><p>Retrying in <span>%d<\/span> ...<\/p>","live_stream_continue":"<h2>It appears the stream went down.<\/h2><p>Retrying in <span>%d<\/span> ...<\/p>","embed_copied":"Embed Code Copied to Clipboard","error_copy_clipboard":"Error copying text into clipboard!","subtitles_disabled":"Subtitles disabled","subtitles_switched":"Subtitles switched to ","warning_iphone_subs":"This video has subtitles, that are not supported on your device.","warning_unstable_android":"You are using an old Android device. If you experience issues with the video please use <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=org.mozilla.firefox\">Firefox<\/a>.","warning_samsungbrowser":"You are using the Samsung Browser which is an older and buggy version of Google Chrome. If you experience issues with the video please use <a href=\"https:\/\/www.mozilla.org\/en-US\/firefox\/new\/\">Firefox<\/a> or other modern browser.","warning_old_safari":"You are using an old Safari browser. If you experience issues with the video please use <a href=\"https:\/\/www.mozilla.org\/en-US\/firefox\/new\/\">Firefox<\/a> or other modern browser.","warning_old_chrome":"You are using an old Chrome browser. Please make sure you use the latest version.","warning_old_firefox":"You are using an old Firefox browser. Please make sure you use the latest version.","warning_old_ie":"You are using a deprecated browser. If you experience issues with the video please use <a href=\"https:\/\/www.mozilla.org\/en-US\/firefox\/new\/\">Firefox<\/a> or other modern browser.","quality":"Quality","closed_captions":"Closed Captions","no_subtitles":"No subtitles","speed":"Speed","duration_1_day":"%s day","duration_n_days":"%s days","duration_1_hour":"%s hour","duration_n_hours":"%s hours","duration_1_minute":"%s min","duration_n_minutes":"%s mins","duration_1_second":"%s second","duration_n_seconds":"%s seconds","and":" and ","chrome_extension_disable_html5_autoplay":"It appears you are using the Disable HTML5 Autoplay Chrome extension, disable it to play videos","click_to_unmute":"Click to unmute","audio_button":"AUD","audio_menu":"Audio","iphone_swipe_up_location_bar":"To enjoy fullscreen swipe up to hide location bar.","invalid_youtube":"Invalid Youtube video ID.","video_loaded":"Video loaded, click to play.","msg_no_skipping":"Skipping is not allowed.","msg_watch_video":"Please watch the video carefully."};
var fv_flowplayer_playlists = [];
Expand Down
39 changes: 21 additions & 18 deletions test/unit/controller/frontendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ protected function setUp(): void {
include_once "../../models/lightbox.php";
global $fv_fp;
$fv_fp = new flowplayer();

include_once "../../controller/frontend.php";
}
public function test_flowplayer_prepare_scripts_js_everywhere() {

public function test_flowplayer_prepare_scripts_js_everywhere() {
global $fv_fp;
$fv_fp->conf['js-everywhere'] = true;

ob_start();
flowplayer_prepare_scripts();
$output = ob_get_clean();

$expected = "Registering jquery-ui-tabs for ?ver=1.2.3.4 footer? 1
Registering fv_flowplayer for fv-wordpress-flowplayer/css/fv-player.min.css?ver=1.2.3.4
Registering fv_freedomplayer_playlists for fv-wordpress-flowplayer/css/playlists.css?ver=1.2.3.4
Expand All @@ -118,8 +118,9 @@ public function test_flowplayer_prepare_scripts_js_everywhere() {
[7] => 2
)
[video_hash_links] => 1
[video_hash_links] =>
[safety_resize] => 1
[logo_over_video] => 1
[volume] => 0.7
[default_volume] => 0.7
[mobile_landscape_fullscreen] => 1
Expand All @@ -130,7 +131,8 @@ public function test_flowplayer_prepare_scripts_js_everywhere() {
[script_hls_js] => fv-wordpress-flowplayer/freedom-video-player/hls.min.js?ver=1.2.3.4
[script_dash_js] => fv-wordpress-flowplayer/freedom-video-player/dash.mediaplayer.min.js?ver=1.2.3.4
[script_dash_js_engine] => fv-wordpress-flowplayer/freedom-video-player/fv-player-dashjs.min.js?ver=1.2.3.4
[chromecast] =>
[airplay] => 1
[chromecast] =>
[youtube_browser_chrome] => standard
[hlsjs] => Array
(
Expand All @@ -152,7 +154,7 @@ public function test_flowplayer_prepare_scripts_js_everywhere() {
Localizing flowplayer with fv_flowplayer_translations = Array
(
[0] =>
[0] =>
[1] => Video loading aborted
[2] => Network error
[3] => Video not properly encoded
Expand Down Expand Up @@ -191,7 +193,7 @@ public function test_flowplayer_prepare_scripts_js_everywhere() {
[embed_copied] => Embed Code Copied to Clipboard
[error_copy_clipboard] => Error copying text into clipboard!
[subtitles_disabled] => Subtitles disabled
[subtitles_switched] => Subtitles switched to
[subtitles_switched] => Subtitles switched to
[warning_iphone_subs] => This video has subtitles, that are not supported on your device.
[warning_unstable_android] => You are using an old Android device. If you experience issues with the video please use <a href=\"https://play.google.com/store/apps/details?id=org.mozilla.firefox\">Firefox</a>.
[warning_samsungbrowser] => You are using the Samsung Browser which is an older and buggy version of Google Chrome. If you experience issues with the video please use <a href=\"https://www.mozilla.org/en-US/firefox/new/\">Firefox</a> or other modern browser.
Expand All @@ -211,7 +213,7 @@ public function test_flowplayer_prepare_scripts_js_everywhere() {
[duration_n_minutes] => %s min
[duration_1_second] => %s second
[duration_n_seconds] => %s second
[and] => and
[and] => and
[chrome_extension_disable_html5_autoplay] => It appears you are using the Disable HTML5 Autoplay Chrome extension, disable it to play videos
[click_to_unmute] => Click to unmute
[audio_button] => AUD
Expand All @@ -237,27 +239,28 @@ public function test_flowplayer_prepare_scripts_js_everywhere() {
)
Registering fv_player_lightbox for ?ver=
Registering fv_player_lightbox for ?ver= footer?
Registering fv_player_lightbox for ?ver= footer?
Adding inline script for fv_player_lightbox: ( function() { let fv_player_fancybox_loaded = false; const triggers = document.querySelectorAll( '[data-fancybox], .fp-playlist-external[rel$=_lightbox_starter] a' ); for (let i = 0; i < triggers.length; i++) { triggers[i].addEventListener( 'ontouchstart' in window ? 'touchstart' : 'click', function( e ) { if ( fv_player_fancybox_loaded ) return; fv_player_fancybox_loaded = true; let i = this, l = document.createElement('link'), s = document.createElement('script'); e.preventDefault(); e.stopPropagation(); l.rel = 'stylesheet'; l.type = 'text/css'; l.href = fv_player_lightbox.css_url; document.head.appendChild(l); s.onload = function () { let evt = new MouseEvent('click',{bubbles: true,cancelable:true,view:window}); i.dispatchEvent(evt); }; s.src = fv_player_lightbox.js_url; document.head.appendChild(s); }); } })();
Localizing fv_player_lightbox with fv_player_lightbox = Array
(
[lightbox_images] =>
[lightbox_images] =>
[js_url] => fv-wordpress-flowplayer/js/fancybox.js
[css_url] => fv-wordpress-flowplayer/css/fancybox.css
)
";
";

$output = preg_replace( '~\?ver=[0-9.mod-]+~', '?ver=1.2.3.4', $output );
/*$aOut = explode( "\n", preg_replace( '~\r\n~', "\n", $output) );

/*$aOut = explode( "\n", preg_replace( '~\r\n~', "\n", $output) );
$aExpected = explode( "\n", preg_replace( '~\r\n~', "\n", $expected ) );
foreach( $aOut AS $k => $v ) {
$this->assertEquals( $v, $aExpected[$k] );
}*/

$this->assertEquals( preg_replace( '~\r\n~', "\n", $expected ), preg_replace( '~\r\n~', "\n", $output) );

// Replace windows newlines with unix newlines, including any whitespace before newline
$this->assertEquals( preg_replace( '~\s*?\r?\n~', "\n", $expected ), preg_replace( '~\s*?\r?\n~', "\n", $output) );
}

}

0 comments on commit bea1728

Please sign in to comment.