'.html_entity_decode($v->google).html_entity_decode($v->facebook).html_entity_decode($v->twitter).'
'; if($video_pop_out==1) { $gcd=getRatio($_GET['w'],$_GET['h']); echo ' '; } else { echo ''; } //html code echo $code; //script code if ($js_code != "") { echo ''; } echo ''; echo ''; } else { header("Content-Type: text/javascript"); echo "(function(){ if(!window.jQuery || !window.$){ var parentscript = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.src = '".$webURL."js/jquery-1.11.0.min.js'; script.type = 'text/javascript'; parentscript.appendChild(script); } var parentscript = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.src = '".$webURL."js/jquery.fitvids.js'; script.type = 'text/javascript'; //parentscript.appendChild(script); })() function loadjsfile(filename, type) { if(type == undefined || type == '' || type == null) { type = 'async'; } else if(!(type == 'async' || type == 'defer')) { type = 'async'; } var fileref=document.createElement('script'); fileref.setAttribute('type','text/javascript'); fileref.setAttribute(type,'1'); fileref.setAttribute('src', filename); document.getElementsByTagName('head')[0].appendChild(fileref); } "; $tracking_code = html_entity_decode($v->google).html_entity_decode($v->facebook).html_entity_decode($v->twitter); $tracking_code = str_replace('', '', $tracking_code); echo $tracking_code; echo $loadScript . "\r\ndocument.write('" . $code . "');"; //echo "document.write('" . $code . "');"; if ($js_code != "") echo $js_code; } } //write script code $js_code = ''; function getRatio($a, $b) { if ($a == 0 || $b == 0) return abs( max(abs($a), abs($b)) ); $r = $a % $b; return ($r != 0) ? getRatio($b, $r) : abs($b); } function write_script($script_code) { global $js_code; $js_code .= $script_code; } //is video is playing in mobile device? function use_html5() { //this should match BlackBerry, iPhone, iPad, Android //|tablet $isMobile = (bool) preg_match('#\b(ip(hone|od|ad)|android|opera m(ob|in)i|windows (phone|ce)|blackberry' . '|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp|laystation portable)|nokia|fennec|htc[\-_]' . '|mobile|up\.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\b#i', $_SERVER['HTTP_USER_AGENT']); if ($isMobile == false) $isMobile = (isset($_GET["html5"])) ? true : false; return $isMobile; return (stripos($_SERVER["HTTP_USER_AGENT"], "AppleWebKit") !== FALSE || stripos($_SERVER["HTTP_USER_AGENT"], "Mobile") !== FALSE) || isset($_GET["html5"]); } //throw error function js_die($error) { write_html('EasyWebVideo error: ' . $error . ''); die; } //detect device from which video is being played function detect_device() { $device = "Mobile"; if (stripos($_SERVER["HTTP_USER_AGENT"], "iPhone") !== FALSE) $device = "iPhone"; if (stripos($_SERVER["HTTP_USER_AGENT"], "iPod") !== FALSE) $device = "iPod"; if (stripos($_SERVER["HTTP_USER_AGENT"], "iPad") !== FALSE) $device = "iPad"; return $device; } //get IP address of user function getIP() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet $ip = $_SERVER['HTTP_CLIENT_IP']; elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; else $ip = $_SERVER['REMOTE_ADDR']; return $ip; } function make_full_url($url) { global $SITE; if ($url[0] == '/') return $SITE . substr($url, 1); else return $SITE . "/" . $url; } if (!isset($_GET["v"])) js_die("Bad usage"); else $vcode = $_GET["v"]; require_once "include/video.inc.php"; $v = Video::LoadByCode($vcode); if (!$v) js_die("Video \"$vcode\" not found"); // $v->video_pop_out flag for "Video pop Out" // kamlesh mayani $default_video_code = $v->default_video_code; /* //get data of default player. if($v->default_video_code){ $v = Video::LoadByCode($v->default_video_code); } */ $w = $v->width; $h = $v->height; $video_pop_out = $v->video_pop_out; $video_pop_out_alignment = $v->video_pop_out_alignment; $user_privileges = DbQuery("SELECT pop_out_video FROM `user_privileges` WHERE `user_id`=" . Sql($v->userid)); $user_privileges = $user_privileges[0]; if($user_privileges!=1 && isset($user_privileges)) { //user privileges is Removed By Admin So Stop Video popout $video_pop_out=0; } if (isset($_GET["w"])) $w = urldecode($_GET["w"]); if (isset($_GET["h"])) $h = urldecode($_GET["h"]); //check if site is running from https? if yes than make $SITE url https $https = is_https(); //load embed code if (!use_html5()) { if ($_GET['p'] == "") $_GET['p'] = $v->player; if ($_GET['iframe'] == 1){ $w = $h = '100%'; } $code = $v->GetEmbedCode($w, $h, $_GET['statTrack'], $_GET['isAnalytics'], $_GET['p'], $https); /*$responsiveTxt = '';*/ $playerOutrStyle = ''; if ($_GET['iframe'] == 1){ $responsiveTxt .= ''; $playerOutrStyle = 'height:100%;'; } if ($_GET['iframe'] == 0 && $video_pop_out==1){ $responsiveTxt .= ''; } $redirectScript = ''; if($_REQUEST['curl']){ $redirectScript = ''; } // hover video page show delay event $delayEventDiv = ''; if($_REQUEST['overvideodelayevent']){ $delayEventDiv = '
'; } $sxml = simplexml_load_string($v->xml); $videos = $sxml->playlist->children(); $v0thumb = make_full_url((string) $videos[0]["thumb"]); //$code = '
' . $code . addCustomEmailFormScript() . '
'; if($video_pop_out==1){ $code = '
' . $code . addCustomEmailFormScript() . $responsiveTxt . $redirectScript.$delayEventDiv. '
'; }else{ $code = '
' . $code . addCustomEmailFormScript() . $responsiveTxt . $redirectScript.$delayEventDiv. '
'; } } else { //HTML5 code if ($_GET['iframe'] == 1) { $ratio = round($w / $h, 2); $w = ( strpos($w, '%') === FALSE ) ? $w . "px" : $w; $h = ( strpos($h, '%') === FALSE ) ? $h . "px" : $h; $w = $h = '100%'; $u = User::Load($v->userid); $html5_path = $SITE . "html5player/"; $sxml = simplexml_load_string($v->xml); $videos = $sxml->playlist->children(); $id = "player" . rand(0, 100); $v0thumb = make_full_url((string) $videos[0]["thumb"]); $video_code = ""; //preroll video $num_videos = 0; if ($sxml->preroll->playlist->video) { $preroll = $sxml->preroll->playlist->video; if (in_array(pathinfo($preroll["url"], PATHINFO_EXTENSION), array('mp4'))) { // change flv path to mp4 file path $pathinfo = pathinfo($preroll["url"]); if(strtolower($pathinfo['extension']) !== 'mp4'){ $preroll["url"] = str_ireplace('.flv', '.mp4', $preroll["url"]); } $url = make_full_url((string) $preroll["url"]); $video_code .= "{ m4v:\"{$url}\", poster : \"{$v0thumb}\", remove : true },"; $num_videos++; } } $gJSVar = ''; $scriptForShowPopup = ''; $popupHtmlCont = ''; $textLabelHtmlCont = ''; $imgLabelHtmlCont = ''; //playlist videos foreach ($videos as $video) { $aweber = $video->aweber; $videoUrlExplode = explode('/', $video["url"]); $video_id = $v->code; $ifCond = ''; if ($default_video_code) { $ifCond = '|| video_url.match(/' . $default_video_code . '/gi)'; } $scriptForShowPopup .= 'if(video_url.match(/' . $video_id . '/gi) ' . $ifCond . ' ){'; // for text lavel. if ($video->labels->label) { foreach ($video->labels->label as $label) { $textLabel = $label['0']; $id = $label['id']; $start = $label['start']; $end = $label['end']; $pos = $label['pos']; list($x, $y, $labelWidth, $labelHeight) = split(',', $pos); $x = $x * 100 / $v->width; $y = $y * 100 / $v->height; $href = $label['href']; $marker = $label['marker']; $bold = ($label['bold'] == 'true') ? 'font-weight: bold;' : ''; $italic = ($label['italic'] == 'true') ? 'font-style: italic;' : ''; $color = ($label['color']) ? 'color: #' . str_replace('#FF', '', $label['color']) . ';' : 'color: black;'; $face = ($label['face']) ? 'font-family: ' . $label['face'] . ';' : ''; $size = ($label['size']) ? 'font-size: ' . $label['size'] / 10 . 'vmin;' : 'font-size: 12px;'; $labelStyle = $bold . $italic . $color . $face . $size; $textLabelHtmlCont .= ''; $scriptForShowPopup .= 'if (event.jPlayer.status.currentTime > ' . $start . ' && event.jPlayer.status.currentTime < ' . $end . ' ) {' . '$(".video-label.' . $video_id . '.' . $id . '").show();' . '}else{' . '$(".video-label.' . $video_id . '.' . $id . '").hide();' . '}'; } } // for label img if ($video->images->image) { foreach ($video->images->image as $image) { $id = $image['id']; $start = $image['start']; $end = $image['end']; $pos = $image['pos']; list($x, $y, $labelWidth, $lableHeight) = split(',', $pos); $x = $x - ($labelWidth / 2); $y = $y - ($labelHeight / 2); $x = $x * 100 / $v->width; $y = $y * 100 / $v->height; $labelWidth = $labelWidth * 100 / $v->width; $lableHeight = $lableHeight * 100 / $v->height; $rotation = $image['rotation']; $href = $image['href']; $imageUrl = $image['imageUrl']; $imgLabelHtmlCont .= ''; $scriptForShowPopup .= 'if (event.jPlayer.status.currentTime > ' . $start . ' && event.jPlayer.status.currentTime < ' . $end . ' ) {' . '$(".video-lbl-imgbox.' . $video_id . '.' . $id . '").show();' . '}else{' . '$(".video-lbl-imgbox.' . $video_id . '.' . $id . '").hide();' . '}'; } } if ($aweber) { if ($aweber['provider'] == 'custom') { $gJSVar .= 'var runFormFlag_' . $video_id . ' = true; '; $scriptForShowPopup .= 'if (event.jPlayer.status.currentTime > ' . $aweber['start'] . ' && runFormFlag_' . $video_id . ' ) { openEmailForm(); $(this).jPlayer("pause"); runFormFlag_' . $video_id . ' = false; } if(runFormFlag_' . $video_id . ' == false && event.jPlayer.status.currentTime > ' . $aweber['end'] . '){ closeEmailForm(); //$(this).jPlayer("play"); //runFormFlag_' . $video_id . ' = true; } ' . $textLabelJSScript; //$popupHtmlCont .= addCustomEmailFormScript($v->code); } else { $gJSVar .= 'var runFormFlag_' . $video_id . ' = true; '; $scriptForShowPopup .= 'if (event.jPlayer.status.currentTime > ' . $aweber['start'] . ' && runFormFlag_' . $video_id . ' ) { $(".form-box").css("background", "' . $aweber['bgColor'] . '"); // set background color to popup $(".vdo-form-title, .vdo-form-lbl, .vdo-form-error").css("color", "' . $aweber['fontColor'] . '"); // set background color to popup $(".form-box-outr.' . $video_id . '").show(); $(this).jPlayer("pause"); runFormFlag_' . $video_id . ' = false; } if(runFormFlag_' . $video_id . ' == false && event.jPlayer.status.currentTime > ' . $aweber['end'] . '){ $(".form-box-outr.' . $video_id . '").hide(); //$(this).jPlayer("play"); //runFormFlag_' . $video_id . ' = true; } ' . $textLabelJSScript; $hiddenInput = ''; switch ($aweber['provider']) { case 'aweber': $hiddenInput = ''; break; case 'infusionsoft': $hiddenInput = ''; $hiddenInput .= ''; break; case 'mailchimp': $hiddenInput = ''; $hiddenInput .= ''; break; case '1shoppingcart': // requiredfields, ARThankyouURL,copyarresponse, postUrl, defaultar, email, allowmulti, visiblefields='Name,Email1', merchantid $hiddenInput = ''; $hiddenInput .= ''; $hiddenInput .= ''; $hiddenInput .= ''; $hiddenInput .= ''; $hiddenInput .= ''; $hiddenInput .= ''; $hiddenInput .= ''; break; } $emailUrl["aweber"] = "aweberproxy.php"; $emailUrl["mailchimp"] = "mailchimpproxy.php"; // post $emailUrl["infusionsoft"] = "infusionsoftproxy.php"; // post $emailUrl["1shoppingcart"] = "1shoppingcart/1scProxy.php"; // post $popupHtmlCont .= '

' . $aweber['title'] . '

*
*
' . $hiddenInput . '
'; } } // change flv path to mp4 file path $pathinfo = pathinfo($video["url"]); if(strtolower($pathinfo['extension']) !== 'mp4'){ $video["url"] = str_ireplace('.flv', '.mp4', $video["url"]); } $url = make_full_url((string) $video["url"]); $thumb = make_full_url((string) $video["thumb"]); $video_code .= "{ m4v:\"{$url}\", poster : \"{$thumb}\", remove : false },"; $scriptForShowPopup .= '}'; $num_videos++; } if ($sxml->postroll->playlist->video) { $postroll = $sxml->postroll->playlist->video; // change flv path to mp4 file path $pathinfo = pathinfo($postroll["url"]); if(strtolower($pathinfo['extension']) !== 'mp4'){ $postroll["url"] = str_ireplace('.flv', '.mp4', $postroll["url"]); } $url = make_full_url((string) $postroll["url"]); $thumb = make_full_url((string) $postroll["thumb"]); $video_code .= "{ m4v:\"{$url}\", poster : \"{$thumb}\", remove : false },"; $num_videos++; } //ewv branding video for free user if ($u->type == "FA" || $u->type == "F") { if ($ratio > 1.55) $video_code .= "{ m4v:\"{$SITE}files/branding_video_16_9.mp4\", remove : false },"; else $video_code .= "{ m4v:\"{$SITE}files/branding_video_4_3.mp4\", remove : false },"; $num_videos++; } //get redirect to url code after all playlist video played $jplayer_redirect_code = ''; $logoURL = ''; $logoPosition = ''; $logoTrans = ''; $logoLink = ''; foreach ($sxml->settings->setting as $obj) { if ((string) $obj['name'] == "redirectURL" && (string) $obj['value'] != "") { $redirect_url = (string) $obj['value']; $jplayer_redirect_code = 'num_videos--; if( num_videos == 0 ) { //redirect if user have added redirect window.parent.location = "' . $redirect_url . '"; }'; } if ((string) $obj['name'] == "logoURL") { $logoURL = (string) $obj['value']; } if ((string) $obj['name'] == "logoPosition") { $logoPosition = (string) $obj['value']; } if ((string) $obj['name'] == "logoTrans") { $logoTrans = (string) $obj['value']; } if ((string) $obj['name'] == "logoLink") { $logoLink = (string) $obj['value']; } } if ($logoURL) { list($x, $y, $logoWidth, $logoHeight) = split(',', $logoPosition); $x = $x - ($logoWidth / 2); $y = $y - ($logoHeight / 2); $x = $x * 100 / $v->width; $y = $y * 100 / $v->height; $logoWidth = $logoWidth * 100 / $v->width; $logoHeight = $logoHeight * 100 / $v->height; $imgLabelHtmlCont .= '
' . '' . '
'; } $script = " if(navigator.userAgent.match(/Android/i)){ $('body').addClass('android'); } $('html,body').off('click').on('click', '.form-close-btn', function() { $('.form-box-outr').hide(); $('#jquery_jplayer_1').jPlayer('play'); if (navigator.userAgent.match(/ipad/i)) { $('.jp-video').find('video').prop('controls', false); } else { $('.jp-video').find('video').prop('controls', true); } }); $(window).load(function(){ if (navigator.userAgent.match(/ipad/i)) { $('body').addClass('ipad'); $('video').attr('controls', false); $('.jp-gui').addClass('ipad-control'); }else { $('video').attr('controls', true); } }); $(window).resize(function() { var winH = $(window).height(); $('#jquery_jplayer_1 video, #jquery_jplayer_1 img, .jp-type-playlist').css({'max-height': winH + 'px'}); }); $(window).load(function() { var winH = $(window).height(); $('#jquery_jplayer_1 video, #jquery_jplayer_1 img, .jp-type-playlist').css({'max-height': winH + 'px'}); });"; //jplayer playlist script code //supplied: "m4v, ogv", $script_code = 'var num_videos = ' . $num_videos . '; var runFormFlag = true; var is_play = 0; ' . $gJSVar . ' $(document).ready(function(){ ' . $script . ' new jPlayerPlaylist({ jPlayer: "#jquery_jplayer_1", cssSelectorAncestor: "#jp_container_1" }, [ ' . $video_code . ' ],{ solution:"html", supplied: "flv,m4v, ogv", smoothPlayBar: true, keyEnabled: true, size:{width:"100%", height:"100%"}, loop:true, ended: function(event) { // The $.jPlayer.event.ended event //$(".jp-video-play").show(); ' . $jplayer_redirect_code . ' }, timeupdate: function(event) { video_url = event.jPlayer.status.src; if(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/ipad/i)){ ' . $scriptForShowPopup . ' }else{ $(".jp-video-play-icon").css("display", "block !imporatant"); } }, error : function(event){ console.log(event.jPlayer.error); if(event.jPlayer.error.type == "e_url" && is_play == 1){ // alert("This video is not supported with this device"); console.log("This video is not supported with this device"); } }, play : function(event){ is_play = 1; }, autohide: { restored: true, fadeIn:500,fadeOut:500, hold:2500, }, errorAlerts:false }); //$("#jp_container_1 video").attr("controls", true); var emailFormObj = ""; $(".func-email-form-submit").on("submit", function(){ emailFormObj = $(this); var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; emailFieldValue = $(this).find("input[name=\"email\"]").val(); if (reg.test(emailFieldValue) == false) { alert("Invalid Email Address"); $(this).find("input[name=\"email\"]").focus(); return false; } if($(this).hasClass("aweber")){ $.get($(this).attr("action"), $(this).serialize(), function(data){ formHide(); }); }else{ $.post($(this).attr("action"), $(this).serialize(), function(data){ formHide(); }); } return false; }); }); function formHide(){ $(".form-box-outr").hide(); }'; write_script($script_code); //html5 jplayer code $code = '
' . addCustomEmailFormScript($v->code, true) . '
'; //inserting stat for html5 player @file_get_contents($SITE . "players/stat1.php?video_id=" . $vcode . "&event=play&timeSpent=0&session_key=" . substr(md5(mt_rand() . time() . mt_rand()), 0, 24) . "&isFirstTime=Y&device_name=" . detect_device() . "&ipAddress=" . getIP() . "&referrer=" . $_SERVER['HTTP_REFERER']); } else { //$w = $h = '100%'; //$w = '100%'; $code = $v->GetIframeCode($w, $h, $_GET['statTrack'], $_GET['isAnalytics'], $_GET['p'], $https, true); $code .= ''; } } // add script for custom email form. function addCustomEmailFormScript($code, $is_html5 = false) { global $https, $SITE_HTTPS, $SITE, $h, $w, $video_pop_out, $video_pop_out_alignment; $height = (strstr($h, '%')) ? $h : $h . 'px'; $width = (strstr($w, '%')) ? $w : $w . 'px'; $webURL = ($https) ? $SITE_HTTPS : $SITE; $webURL = $SITE; $htmlCode = ''; $htmlCode .= ''; //$htmlCode .= html_entity_decode($v->google).html_entity_decode($v->facebook).html_entity_decode($v->twitter); $htmlCode .= ''; if($video_pop_out==1) { $gcd=getRatio($width,$height); $htmlCode .= ' '; } else { $htmlCode .= ' '; } $htmlCode .= '
'; if ($is_html5 == false) $htmlCode = substr(json_encode($htmlCode), 1, -1); //$htmlCode = ''; return $htmlCode; } write_html($code); die; ?>