/**
  * Get Video URL for ajax request
  *
  * @access public
  * @since 1.0.0
  * @return void
  */
 function wolf_ajax_get_video_url_from_post_id()
 {
     extract($_POST);
     $post_id = absint($_POST['id']);
     echo esc_url(wolf_get_first_video_url($post_id));
     exit;
 }
 /**
  * countdown shortcode
  *
  * @param array $atts
  * @return string
  */
 function wolf_shortcode_last_videos_carousel($atts)
 {
     if (class_exists('Vc_Manager') && function_exists('vc_map_get_attributes')) {
         $atts = vc_map_get_attributes('wolf_last_videos_carousel', $atts);
     }
     extract(shortcode_atts(array('count' => 3, 'category' => '', 'inline_style' => '', 'class' => ''), $atts));
     $count = absint($count);
     $category = sanitize_text_field($category);
     $class = sanitize_text_field($class);
     $inline_style = sanitize_text_field($inline_style);
     $args = array('post_type' => 'video', 'posts_per_page' => absint($count));
     if (wolf_get_theme_option('video_reorder')) {
         $args['order'] = 'ASC';
         $args['meta_key'] = '_position';
         $args['orderby'] = 'meta_value_num';
     }
     if ($category) {
         $args['video_type'] = $category;
     }
     $loop = new WP_Query($args);
     $style = '';
     $class = $class ? "{$class} " : '';
     // add space
     $class .= "videos-carousel";
     if ($inline_style) {
         $style .= $inline_style;
     }
     $style = $style ? " style='{$style}'" : '';
     $output = "<section class='{$class}'{$style}>";
     if ($loop->have_posts()) {
         while ($loop->have_posts()) {
             $loop->the_post();
             $video_url = wolf_get_first_video_url();
             $thumbnail = wolf_get_post_thumbnail_url('classic-video-thumb');
             if ($video_url) {
                 $output .= "<div class='item-video' data-merge='2' style='background-image:url({$thumbnail});'><a class='owl-video' href='{$video_url}'></a></div>";
             }
         }
     }
     $output .= '</section>';
     wp_reset_postdata();
     return $output;
 }
    }
    ?>
		<div id="share-panel" class="video-tab-content">
			<p class="share-buttons">
				<?php 
    if (wolf_get_theme_option('video_share')) {
        ?>
					<?php 
        get_template_part('partials/share', 'video');
        ?>
				<?php 
    }
    ?>
			</p>
			<input class="url" value="<?php 
    echo esc_url(wolf_get_first_video_url());
    ?>
">
		</div>
		<?php 
    if (wolf_get_theme_option('video_embed')) {
        ?>
			<div id="embed-panel" class="video-tab-content" style="<?php 
        if (wolf_get_theme_option('video_share') && wolf_get_theme_option('video_embed')) {
            echo 'display:none;';
        }
        ?>
">

				<p class="embed-input"><input class="embed" value="<?php 
        echo esc_attr(wolf_get_video_iframe_embed_code());
Esempio n. 4
0
 /**
  * Get the embed code from a youtube or vimeo URL
  *
  * @access public
  * @return void
  */
 function wolf_get_video_iframe_embed_code()
 {
     $url = wolf_get_first_video_url();
     if (preg_match('#(?:\\www.)?\\youtube.com/watch\\?v=([A-Za-z0-9\\-_]+)#', $url, $match) || preg_match('#(?:\\www.)?\\youtu.be/([A-Za-z0-9\\-_]+)#', $url, $match)) {
         //www.youtube.com/embed/iVAgTiBrrDA
         $video_id = $match[1];
         $url = '//www.youtube.com/embed/' . $video_id;
         $iframe = '<iframe width="420" height="315" src="' . $url . '" frameborder="0" allowfullscreen></iframe>';
         return htmlentities($iframe);
     } elseif (preg_match('#vimeo\\.com/([0-9]+)#', $url, $match)) {
         $video_id = $match[1];
         $url = '//player.vimeo.com/video/' . $video_id;
         $iframe = '<iframe src="' . $url . '" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
         return htmlentities($iframe);
     }
 }