Пример #1
0
		<?php 
//display the video
if ($external_video || $video_mp4) {
    //self hosted videos
    if ($video_mp4) {
        do_action("create_media_output", array('id' => 'video-' . get_the_ID(), 'type' => "video", 'file_mp4' => $video_mp4, 'file_webm' => $video_webm, 'poster' => $featured_image_url));
    }
    //external videos
    if ($external_video) {
        if (strpos($external_video, 'youtube')) {
            //youtube
            echo '<div class="video-container"><iframe src="//www.youtube.com/embed/' . rt_find_tube_video_id($external_video) . '" allowfullscreen></iframe></div>';
        }
        if (strpos($external_video, 'vimeo')) {
            //vimeo
            echo '<div class="video-container"><iframe src="//player.vimeo.com/video/' . rt_find_tube_video_id($external_video) . '?color=d6d6d6&title=0&amp;byline=0&amp;portrait=0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>';
        }
    }
    echo '<div class="space margin-t20"></div>';
}
?>


		<?php 
the_content();
?>
		<?php 
wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'rt_theme') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>'));
?>

		<?php 
Пример #2
0
 function save_video_images($url)
 {
     $saved_image_url = "";
     //find the video id
     $video_id = rt_find_tube_video_id($url);
     //get uploads dir of WP
     $uploads = wp_upload_dir();
     //wich service
     if (strpos($url, 'youtube')) {
         $type = 'youtube';
     }
     if (strpos($url, 'vimeo')) {
         $type = 'vimeo';
     }
     if (function_exists('file_get_contents')) {
         if (isset($type) && isset($video_id)) {
             //Youtube image
             if ($type == 'youtube') {
                 $image = 'http://img.youtube.com/vi/' . $video_id . '/0.jpg';
             }
             //Vimeo image
             if ($type == 'vimeo') {
                 $hash = @unserialize($this->get_content("http://vimeo.com/api/v2/video/{$video_id}.php"));
                 if ($hash) {
                     $image = $hash[0]['thumbnail_large'];
                 }
             }
             if ($image) {
                 $save_as = $uploads['path'] . '/' . $video_id . '-' . $type . '.jpg';
                 $get_image = @$this->get_content($image);
                 if ($get_image) {
                     @file_put_contents($save_as, $get_image);
                     $saved_image_url = $uploads['url'] . '/' . $video_id . '-' . $type . '.jpg';
                 }
             }
         }
     }
     return $saved_image_url;
 }
Пример #3
0
 function rt_video_embed($atts, $content = null)
 {
     //[video_embed  url=""]
     //defaults
     extract(shortcode_atts(array("url" => ''), $atts));
     //external videos
     if ($url) {
         if (!strpos($url, 'youtube') || !strpos($url, 'vimeo')) {
             $video = __("Only YouTube and Vimeo videos are supported with this shortcode.", "rt_theme_admin");
         }
         if (strpos($url, 'youtube')) {
             //youtube
             $video = '<div class="video-container"><iframe src="//www.youtube.com/embed/' . rt_find_tube_video_id($url) . '" allowfullscreen></iframe></div>';
         }
         if (strpos($url, 'vimeo')) {
             //vimeo
             $video = '<div class="video-container"><iframe  src="//player.vimeo.com/video/' . rt_find_tube_video_id($url) . '?color=d6d6d6&title=0&amp;byline=0&amp;portrait=0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>';
         }
     }
     return $video;
 }