function wp_lightbox_load_html_overlay_js() { $browser = new WP_LIGHTBOX_CHECK_BROWSER(); $platform_name = $browser->getPlatform(); $wp_lightbox_output = ''; if ($platform_name == "iPad" || $platform_name == "iPhone") { $position = "fixed: false,"; } else { $position = ""; } $wp_lightbox_html_output = <<<EOT \t<script type="text/javascript"> \t/* <![CDATA[ */ \tjQuery(document).ready(function(\$){ \t \t\t// setup mediaelementplayer \t\t\$('video').mediaelementplayer(/* Options */);\t\t \t\t// setup overlay for external page\t\t \t\t\$(".wp_lightbox_url_content_trigger").overlay({\t \t\t \t\t\texpose: '#789', \t\t\t{$position}\t \t\t\tonBeforeLoad: function() {\t \t\t\t\t// grab wrapper element inside content \t\t\t\tvar wrap = this.getOverlay().find(".contentWrap");\t \t\t\t\t// load the page specified in the trigger \t\t\t\twrap.load(this.getTrigger().attr("href")); \t\t\t}\t \t\t});\t\t \t\t// setup overlay actions to a href \t\t\$(".wp_lightbox_html_overlay_trigger").overlay({\t\t \t\t\texpose: '#789', \t\t\t{$position}\t\t\t\t \t\t\tonLoad: function(content) { \t\t\t}, \t\t\tonClose: function(content) {\t\t\t\t \t\t\t\tif (navigator.userAgent.indexOf("Firefox")== -1) \t\t\t\t{ \t\t\t\t\tvar count = 0; \t\t\t\t\t\$("video").each(function(){\t \t\t\t\t\t\t\$("video")[count].player.pause(); \t\t\t\t\t\tcount=count+1; \t\t\t\t\t\tif(count > 20){ \t\t\t\t\t\t\treturn false;\t\t\t\t\t\t \t\t\t\t\t\t} \t\t\t\t\t}); \t\t\t\t} \t\t\t} \t\t});\t \t}); \t/*]]>*/ \t</script> EOT; echo $wp_lightbox_html_output; }
function wp_lightbox_mp4_video_display($link, $poster, $width, $height, $source) { $browser = new WP_LIGHTBOX_CHECK_BROWSER(); $platform_name = $browser->getPlatform(); $wp_lightbox_output = ''; $anchor_type = "image"; if ($platform_name == "iPad" || $platform_name == "iPhone") { $wp_lightbox_output .= get_html5_video_embed_code($link, $poster, $width, $height, $source, $anchor_type); } else { $wp_lightbox_output .= wp_lightbox_flowplayer_video_display($link, $width, $height, $source); } return $wp_lightbox_output; }
function wp_lightbox_load_flowplayer_js() { global $wp_lightbox_config; $wp_lightbox_library_url = WP_LIGHTBOX_LIB_URL; $wp_lightbox_plugin_url = WP_LIGHTBOX_PLUGIN_URL; $wp_lightbox_flowplayer_license_key = ''; $wp_lightbox_flowplayer_autoplay_value = $wp_lightbox_config->getValue('wp_lightbox_flowplayer_autoplay'); if (empty($wp_lightbox_flowplayer_autoplay_value)) { $wp_lightbox_flowplayer_autoplay_value = 'false'; /* Automatically start videos: True/false */ } $browser = new WP_LIGHTBOX_CHECK_BROWSER(); $platform_name = $browser->getPlatform(); $wp_lightbox_output = ''; if ($platform_name == "iPad" || $platform_name == "iPhone") { $position = "fixed: false,"; } else { $position = ""; } if (!empty($wp_lightbox_flowplayer_license_key)) { $wp_lightbox_flowplayer_output = <<<EOT \t\t<script type="text/javascript"> \t\t/* <![CDATA[ */ \t\tjQuery(document).ready(function(\$){\t \t\t\t// setup overlay actions to a href \t\t\t\$(".wp_lightbox_fp_trigger").overlay({\t\t \t\t\t\texpose: '#789', \t\t\t\t{$position}\t\t\t\t \t\t\t\tonLoad: function(content) { \t\t\t\t\t// find the player contained inside this overlay and load it \t\t\t\t\tthis.getOverlay().find("a.player").flowplayer(0).load(); \t\t\t\t}, \t\t\t\tonClose: function(content) { \t\t\t\t\tthis.getOverlay().find("a.player").flowplayer(0).pause(); \t\t\t\t\tthis.getOverlay().find("a.player").flowplayer(0).unload(); \t\t\t\t} \t\t\t});\t \t\t\t// install player \t\t\t\$("a.player").flowplayer("{$wp_lightbox_library_url}/js/flowplayer.commercial-3.2.7.swf", { \t\t\t\tkey: '{$wp_lightbox_flowplayer_license_key}', \t\t\t\tlogo: { \t\t\t\t\turl: '' \t\t\t\t}, \t\t\t\tplay: { \t\t\t\t\turl: '{$wp_lightbox_plugin_url}/images/play-button.png', \t\t\t\t\twidth: 64, \t\t\t\t\theight: 64 \t\t\t\t}, \t\t\t\tclip: { \t\t\t\t\tautoPlay:{$wp_lightbox_flowplayer_autoplay_value}, \t\t\t\t\tscaling:'fit'\t\t\t\t\t \t\t\t\t} \t\t\t});\t \t\t}); \t\t/*]]>*/ \t\t</script>\t EOT; } else { $wp_lightbox_flowplayer_output = <<<EOT \t\t<script type="text/javascript"> \t\t/* <![CDATA[ */ \t\tjQuery(document).ready(function(\$){\t \t\t\t// setup overlay actions to a href \t\t\t\$(".wp_lightbox_fp_trigger").overlay({\t\t \t\t\t\texpose: '#789',\t \t\t\t\t{$position}\t\t\t \t\t\t\tonLoad: function(content) { \t\t\t\t\t// find the player contained inside this overlay and load it \t\t\t\t\tthis.getOverlay().find("a.player").flowplayer(0).load(); \t\t\t\t}, \t\t\t\tonClose: function(content) { \t\t\t\t\tthis.getOverlay().find("a.player").flowplayer(0).pause(); \t\t\t\t\tthis.getOverlay().find("a.player").flowplayer(0).unload(); \t\t\t\t} \t\t\t});\t \t\t\t// install player \t\t\t\$("a.player").flowplayer("{$wp_lightbox_library_url}/js/flowplayer-3.2.7.swf", { \t\t\t \t\t\t\tclip: { \t\t\t\t\tautoPlay:{$wp_lightbox_flowplayer_autoplay_value}, \t\t\t\t\tscaling:'fit'\t\t\t\t\t \t\t\t\t} \t\t\t});\t \t\t}); \t\t/*]]>*/ \t\t</script>\t EOT; } echo $wp_lightbox_flowplayer_output; }
function wp_lightbox_load_html5_js() { global $wp_lightbox_config; $wp_lightbox_html5_autoplay = $wp_lightbox_config->getValue('wp_lightbox_html5_autoplay'); $browser = new WP_LIGHTBOX_CHECK_BROWSER(); $platform_name = $browser->getPlatform(); $wp_lightbox_output = ''; if ($platform_name == "iPad" || $platform_name == "iPhone") { $position = "fixed: false,"; } else { $position = ""; } $autoplay_code = ""; if (!empty($wp_lightbox_html5_autoplay)) { $autoplay_code = <<<EOT \t\tvar wrapped_video_id = this.getTrigger().attr("href"); \t\tvar video_id = wrapped_video_id.replace("#", "");\t\t\t\t \t\tvar element = document.getElementById(video_id); \t\telement.player.play(); EOT; } $wp_lightbox_html5_output = <<<EOT \t<script type="text/javascript"> \t/* <![CDATA[ */ \tjQuery(document).ready(function(\$){ \t \t\t// setup mediaelementplayer \t\t\$('video').mediaelementplayer(/* Options */); \t\t \t\t// setup overlay actions to a href \t\t\$(".wp_lightbox_html5_trigger").overlay({\t\t \t\t\texpose: '#789', \t\t\t{$position}\t\t\t\t \t\t\tonLoad: function(content) { \t\t\t\t{$autoplay_code} \t\t\t}, \t\t\tonClose: function(content) {\t\t\t\t \t\t\t\tif (navigator.userAgent.indexOf("Firefox")== -1) \t\t\t\t{ \t\t\t\t\tvar count = 0; \t\t\t\t\t\$("video").each(function(){\t \t\t\t\t\t\t\$("video")[count].player.pause(); \t\t\t\t\t\tcount=count+1; \t\t\t\t\t\tif(count > 20){ \t\t\t\t\t\t\treturn false;\t\t\t\t\t\t \t\t\t\t\t\t} \t\t\t\t\t}); \t\t\t\t} \t\t\t} \t\t});\t \t}); \t/*]]>*/ \t</script> EOT; echo $wp_lightbox_html5_output; }
function wp_lightbox_display_external_page_display($link, $width, $height, $title, $source) { global $wp_lightbox_config; $browser = new WP_LIGHTBOX_CHECK_BROWSER(); $platform_name = $browser->getPlatform(); $wp_lightbox_output = ''; if ($platform_name == "iPad" || $platform_name == "iPhone") { $wp_lightbox_output = wp_lightbox_special_external_page_display($link, $width, $height, $source, $title); return $wp_lightbox_output; } if (empty($width) || empty($height)) { $width = $wp_lightbox_config->getValue('wp_lightbox_width'); $height = $wp_lightbox_config->getValue('wp_lightbox_height'); } $wp_lightbox_prettyPhoto_rel = 'wp_lightbox_prettyPhoto[iframes]'; $wp_lightbox_output = <<<EOT \t<div class="lightbox_ultimate_anchor lightbox_ultimate_image_anchor"> \t<a title="{$title}" href="{$link}?iframe=true&width={$width}&height={$height}" rel="{$wp_lightbox_prettyPhoto_rel}"><img src="{$source}" alt="" /></a> \t</div>\t EOT; return $wp_lightbox_output; }