controller = $controller; } function get_defaults() { return array( 'videotype' => 'iframe', 'iframe' => '', 'mp4' => '', 'webm' => '', 'poster' => '', 'videowidth' => 480, 'videoheight' => 270, 'keepaspectratio' => 1, 'autoplay' => 0, 'loop' => 0, 'videocss' => 'position:relative;display:block;background-color:#000;overflow:hidden;max-width:100%;margin:0 auto;', 'playbutton' => WONDERPLUGIN_VIDEOEMBED_URL . 'engine/playvideo-64-64-0.png', 'lightbox' => 0, 'lightboxsize' => 1, 'lightboxwidth' => 960, 'lightboxheight' => 540, 'autoopen' => 0, 'autoopendelay' => 1000, 'autoclose' => 0, 'lightboxtitle' => '', 'lightboxgroup' => '', 'lightboxshownavigation' => 0, 'lightboxoptions' => '', 'showimage' => '' ); } function get_boolparams() { return array('lightbox', 'lightboxsize', 'autoopen', 'autoclose', 'lightboxshownavigation', 'autoplay', 'loop', 'keepaspectratio'); } function get_htmlparams() { return array('lightboxtitle'); } function double_escape_html($str) { $str = str_replace('"', '\\"', $str); $str = str_replace('&', '&', $str); $str = str_replace('<', '<', $str); $str = str_replace('>', '>', $str); $str = str_replace('"', '"', $str); return str_replace('&', '&', $str); } function un_double_escape_html($str) { $str = str_replace('&', '&', $str); return str_replace('&', '&', $str); } function un_double_escape_html_for_display($str) { $str = $this->un_double_escape_html($str); return str_replace('"', '"', $str); } function unescape_html_for_edit($str) { $str = str_replace('&', '&', $str); return str_replace('\\"', '"', $str); } function process_wistiaurl($url, $autoplay, $loop) { $glue = (strpos($url, '?') !== false) ? '&' : '?'; if ($autoplay) { $url .= $glue . 'autoPlay=true'; $glue = '&'; } if ($loop) { $url .= $glue . 'endVideoBehavior=loop'; } return $url; } function process_vimeourl($url, $autoplay, $loop) { $id = null; $qs = null; $result = $url; preg_match('/(https?:\/\/)?(www\.)?(player\.)?vimeo\.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/', $url, $matches); if (!empty($matches) && !empty($matches[5])) $id = $matches[5]; if (!empty($id)) { $result = 'https://player.vimeo.com/video/' . $id; $query_array = array(); if ($autoplay) $query_array[] = 'autoplay=1'; if ($loop) $query_array[] = 'loop=1'; $parts = parse_url($url); if (isset($parts['query'])) parse_str($parts['query'], $qs); if (!empty($qs)) { foreach( $qs as $key => $value ) $query_array[] = urlencode( $key ) . '=' . urlencode( $value ); } if (!empty($query_array)) $result .= '?' . implode( '&', $query_array ); } return $result; } function process_youtubeurl($url, $autoplay, $loop) { $id = null; $qs = null; $result = $url; $parts = parse_url($url); if (isset($parts['query'])) { parse_str($parts['query'], $qs); if (isset($qs['v'])) $id = $qs['v']; else if (isset($qs['vi'])) $id = $qs['vi']; unset($qs['v']); unset($qs['vi']); } if (empty($id) && isset($parts['path'])) { $path = explode('/', trim($parts['path'], '/')); $id = $path[count($path)-1]; } if (!empty($id)) { $result = 'https://www.youtube.com/embed/' . $id; $query_array = array(); if ($autoplay) $query_array[] = 'autoplay=1'; if ($loop) $query_array[] = 'loop=1&playlist=' . $id; if (!empty($qs)) { foreach( $qs as $key => $value ) $query_array[] = urlencode( $key ) . '=' . urlencode( $value ); } if (!empty($query_array)) $result .= '?' . implode( '&', $query_array ); } return $result; } function process_iframeurl($url, $autoplay, $loop) { if ((strpos(strtolower($url), 'youtube.com') !== false) || (strpos(strtolower($url), 'youtu.be') !== false)) $url = $this->process_youtubeurl($url, $autoplay, $loop); else if (strpos(strtolower($url), 'vimeo.com') !== false) $url = $this->process_vimeourl($url, $autoplay, $loop); else if (strpos(strtolower($url), 'wistia') !== false) $url = $this->process_wistiaurl($url, $autoplay, $loop); return $url; } function lightbox_data_tags($atts) { $content = ' data-autoplay="' . ((!empty($atts['autoplay'])) ? 'true' : 'false') . '"'; if (!empty($atts['loop'])) $content .= ' data-loopvideo="true"'; if (!empty($atts['lightboxsize'])) $content .= ' data-width=' . $atts['lightboxwidth'] . ' data-height=' . $atts['lightboxheight']; if (!empty($atts['autoopen'])) $content .= ' data-autoopen="true" data-autoopendelay=' . $atts['autoopendelay']; if (!empty($atts['autoclose'])) $content .= ' data-autoclose="true"'; if (!empty($atts['lightboxgroup'])) $content .= ' data-group="' . $atts['lightboxgroup'] . '"'; if (!empty($atts['lightboxshownavigation']) && !empty($atts['showimage'])) $content .= ' data-thumbnail="' . $atts['showimage'] . '"'; if (!empty($atts['lightboxtitle'])) $content .= ' title="' . $this->un_double_escape_html($atts['lightboxtitle']) . '"'; if (!empty($atts['lightboxoptions'])) $content .= ' ' . $this->un_double_escape_html_for_display($atts['lightboxoptions']); return $content; } function shortcode_handler($atts) { $content = '
" value="" />
" value="" />
" value="" />
>* To play in lightbox, Wonder Lightbox must be installed and activated.
" value="" class="small-text" /> / " value="" class="small-text" />
" value="" />
" value="" class="small-text" />
" value="" class="small-text" /> / " value="" class="small-text" />
* Autoplay does not work on mobile and tablets.
" value="" />
" value="" /> OR