* @subpackage Simple_Video_Embed/public/partials */ ?> <div class="wpsve-youtube" id="wpsve-youtube-{playerapiid}"> <div class="wpsve-wrapper-with-margin"> <div class="owl-video-carousel owl-carousel-{playerapiid}"> <?php if (array_key_exists('items', $this->api_data)) { foreach ($this->api_data['items'] as $item) { $contentDetails = $item['contentDetails']; $param = $this->toArray(); $param["type"] = 'video'; $param["autoplay"] = 1; $param["loop"] = 0; $s = Sve_Youtube::withParams($item['contentDetails']["videoId"], $param, "1"); ?> <div class="item-video" data-merge="3"> <a class="owl-video" href="<?php echo $s->getUrl(); ?> "></a> </div> <?php } } ?> </div> </div> <?php if (array_key_exists('error', $this->api_data)) {
/** * Initialize the class, set its id and params. * * @since 1.0.0 * @param string $id * The id of the video or playlist. * @param array $param * A array with the youtube object parameter. * @param string $uniqueId * A value to append to the end of playerapiid to ensure that it will be unique */ public static function withParams($id, $params, $uniqueId) { $yt = Sve_Youtube::withId($id); $yt->playerapiid .= '-' . $uniqueId; if (is_array($params)) { if (isset($params['type'])) { $yt->type = $params['type']; } if (isset($params['autohide'])) { $yt->autohide = $params['autohide']; } if (isset($params['autoplay'])) { $yt->autoplay = $params['autoplay']; } if (isset($params['controls'])) { $yt->controls = $params['controls']; } if (isset($params['enablejsapi'])) { $yt->enablejsapi = $params['enablejsapi']; } if (isset($params['origin'])) { $yt->origin = $params['origin']; } if (isset($params['fs'])) { $yt->fs = $params['fs']; } if (isset($params['list'])) { $yt->list = $params['list']; } if (isset($params['listType'])) { $yt->listType = $params['listType']; } if (isset($params['loop'])) { $yt->loop = $params['loop']; } if (isset($params['playlist'])) { $yt->playlist = $params['playlist']; } if (isset($params['template'])) { $yt->template = $params['template']; } foreach ($yt->template_params as $key => $value) { if (isset($params[$key])) { $yt->template_params[$key] = $params[$key]; } } } return $yt; }
/** * Shortcode wpsve definition */ function wpsve_shortcode($atts) { // Attributes extract(shortcode_atts(array('object' => '', 'type' => '', 'id' => '', 'autoplay' => '', 'template' => '', 'height' => '', 'col' => '', 'thumb_title' => ''), $atts)); // Code static $uniqueId = 0; $uniqueId++; if (array_key_exists('height', $atts)) { $atts['video-carousel-height'] = $atts['height']; } if (array_key_exists('col', $atts)) { $atts['thumb-columns-number'] = $atts['col']; } switch ($atts['object']) { case 'youtube': $yt = Sve_Youtube::withParams($atts['id'], $atts, $uniqueId); break; } return $yt->getHtml(); }