Ejemplo n.º 1
0
 public static function fetchData($url, $fields = array())
 {
     $id = Video_Fetcher::extractIDFromURL($url);
     $channel = Video_Fetcher::extractChanneldFromURL($url);
     switch ($channel) {
         case 'youtube':
             return Video_Fetcher::fetchYoutubeData($id, $fields);
         case 'vimeo':
             return Video_Fetcher::fetchVimeoData($id, $fields);
         default:
             return null;
     }
 }
Ejemplo n.º 2
0
function post_updated($post_id)
{
    if ('post' != get_post_type($post_id)) {
        return;
    }
    if (isset($_POST['tm_video_url'])) {
        $url = $_POST['tm_video_url'];
    }
    //print_r($url);exit;
    if ($url == '') {
        $url = get_post_meta($post_id, 'tm_video_url', true);
    }
    $data = Video_Fetcher::fetchData($url, $fields = array(), $post_id);
    $post['ID'] = $post_id;
    //print_r($data);exit;
    $auto_get_info = get_post_meta($post_id, 'fetch_info', true);
    //var_dump($auto_get_info);
    if ($url != '' && strpos($url, 'youtube.com') !== false || $url != '' && strpos($url, 'vimeo.com') !== false || $url != '' && strpos($url, 'dailymotion.com') !== false) {
        if (empty($auto_get_info) || $auto_get_info['0'] != '1') {
            if (function_exists('ot_get_option')) {
                $get_info = ot_get_option('auto_get_info');
            }
            if ($get_info['0'] == '1') {
                //$post['post_title'] = get_post_meta($post_id,'title_video',true);
                $post['post_title'] = $data['title'];
                $post['post_name'] = $data['title'];
            }
            if ($get_info['1'] == '2') {
                //$post['post_content'] = get_post_meta($post_id,'ct_video',true);
                $post['post_content'] = $data['description'];
            }
            if ($get_info['2'] == '3') {
                //$post['tags'] = get_post_meta($post_id,'tags',true);
                //echo $data['tags'] ;exit;
                wp_set_post_tags($post_id, $data['tags'], true);
                //$post['tags'] = $data['tags'] ;
            }
            if ($get_info['3'] == '4') {
                update_post_meta($post_id, '_count-views_all', $data['viewCount']);
            }
            // update the post, removing the action to prevent an infinite loop
            remove_action('save_post', 'post_updated');
            wp_update_post($post);
            add_action('save_post', 'post_updated');
        }
    }
}
            ?>
"></param>
										<?php 
            if ($interactive_videos == 0) {
                ?>
										<param name="allowScriptAccess" value="samedomain"></param>
										<?php 
            } else {
                ?>
										<param name="allowScriptAccess" value="always"></param>
										<?php 
            }
            ?>
										<param name="wmode" value="transparent"></param>
										<embed src="http://www.youtube.com/v/<?php 
            echo Video_Fetcher::extractIDFromURL($url);
            if ($onoff_related_yt != '0') {
                ?>
&rel=0<?php 
            }
            if ($auto_play == '1') {
                ?>
&autoplay=1<?php 
            }
            if ($onoff_info_yt == '1') {
                ?>
&showinfo=0<?php 
            }
            if ($remove_annotations != '1') {
                ?>
&iv_load_policy=3<?php 
Ejemplo n.º 4
0
    function quick_view_tm()
    {
        $html = '';
        $title = get_the_title();
        $title = strip_tags($title);
        $link_q = get_post_meta(get_the_id(), 'tm_video_url', true);
        $link_q = str_replace('http://vimeo.com/', 'http://player.vimeo.com/video/', $link_q);
        if (strpos($link_q, 'wistia.com') !== false) {
            $link_q = '';
        }
        if ($link_q == '') {
            $file = get_post_meta(get_the_id(), 'tm_video_file', true);
            $files = !empty($file) ? explode("\n", $file) : array();
            $link_q = isset($files[0]) ? $files[0] : '';
        }
        if ($link_q != '') {
            if (strpos($link_q, 'youtube.com') !== false) {
                $id_vd = Video_Fetcher::extractIDFromURL($link_q);
                $link_q = 'http://www.youtube.com/embed/' . $id_vd . '?rel=0&amp;wmode=transparent';
            }
            $html .= '<div><a href=' . $link_q . ' class=\'youtube\'  title=\'' . $title . '\' data-url=\'' . esc_url(get_permalink()) . '\' id=\'light_box\'>
				' . __('Quick View', 'cactusthemes') . '
			</a></div>';
        }
        return $html;
    }