Exemplo n.º 1
0
 /**
  *
  * @param string $url url of video
  * @return array $video_data contains video thumbnail and duration
  */
 function vm_get_videothumbnail($url)
 {
     $youtube_url = 'https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=%video&key=' . vm_get_option('vm-youtube-api-key');
     $vimeo_url = 'http://vimeo.com/api/v2/video%video.json';
     $dailymotion_url = 'https://api.dailymotion.com/video/%video/?fields=thumbnail_720_url,duration';
     $video_data = array();
     $host = parse_url($url, PHP_URL_HOST);
     if (preg_match('/youtube/', $host)) {
         $query_string = parse_url($url, PHP_URL_QUERY);
         parse_str($query_string, $query_params);
         if (isset($query_params['v']) && !empty($query_params)) {
             $response = wp_remote_get(strtr($youtube_url, array('%video' => $query_params['v'])));
             if (!is_wp_error($response) && isset($response['response']['code']) && 200 === (int) $response['response']['code']) {
                 $videoDetails = json_decode($response['body']);
                 $start = new DateTime('@0');
                 // Unix epoch
                 $start->add(new DateInterval($videoDetails->items[0]->contentDetails->duration));
                 $duration = $start->format('H:i:s');
                 $video_object = json_decode($response['body']);
                 if (!empty($video_object) && !is_null($video_object) && is_object($video_object)) {
                     $video_data['thumbnail'] = 'http://i1.ytimg.com/vi/' . $video_object->items[0]->id . '/hqdefault.jpg';
                     $video_data['duration'] = $duration;
                 }
             } else {
                 return NULL;
             }
         }
     } else {
         if (preg_match('/vimeo/', $host)) {
             $video = parse_url($url, PHP_URL_PATH);
             $response = wp_remote_get(strtr($vimeo_url, array('%video' => $video)));
             if (!is_wp_error($response) && isset($response['response']['code']) && 200 === (int) $response['response']['code']) {
                 $video_object = json_decode($response['body']);
                 if (!empty($video_object) && !is_null($video_object) && is_object($video_object[0])) {
                     $video_data['thumbnail'] = $video_object[0]->thumbnail_large;
                     $video_data['duration'] = gmdate("i:s", $video_object[0]->duration);
                 }
             }
         } else {
             if (preg_match('/dailymotion/', $host)) {
                 $parts = explode('/', parse_url($url, PHP_URL_PATH));
                 $response = wp_remote_get(strtr($dailymotion_url, array('%video' => $parts[2])));
                 if (!is_wp_error($response) && isset($response['response']['code']) && 200 === (int) $response['response']['code']) {
                     $video_object = json_decode($response['body']);
                     if (!empty($video_object) && !is_null($video_object) && is_object($video_object)) {
                         $video_data['thumbnail'] = $video_object->thumbnail_720_url;
                         $video_data['duration'] = gmdate("i:s", $video_object->duration);
                     }
                 }
             }
         }
     }
     return $video_data;
 }
Exemplo n.º 2
0
                                <div class="searchbox">
                                    <form action="<?php 
echo site_url();
?>
" id="searchform" method="get">
                                        <ul>
                                            <li><input type="text" placeholder="Search" id="s" name="s" /></li>
                                            <li class="pull-right"><input type="submit" value="GO" id="searchsubmit" /></li>
                                        </ul>
                                    </form>
                                </div>
                            </div>
                            <!-- Search End -->
                            <!-- Advertisment Start -->
                            <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
                                <figure class="header-adv">
                                    <?php 
echo vm_get_option('vm-ads-header');
?>
                                </figure>
                            </div>
                            <!-- Advertisment End -->
                        </div>
                    </div>
                </div>
                <!-- Logo + Search + Advertisment End -->
                <?php 
echo get_nav_shortcode('category');
?>
            </header>
            <!-- Header End -->
Exemplo n.º 3
0
/**
 * Load Scripts and Styles
 */
function vm_softcircles_scripts()
{
    wp_register_style('vm-bootstrap-style', get_template_directory_uri() . '/css/bootstrap.css');
    wp_enqueue_style('vm-bootstrap-style');
    wp_enqueue_style('vm-style', get_stylesheet_uri());
    wp_register_style('vm-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css');
    wp_enqueue_style('vm-font-awesome');
    wp_enqueue_script("jquery");
    wp_enqueue_script('vm-jquery-ui', 'http://code.jquery.com/ui/1.9.2/jquery-ui.js', array(), '192', true);
    wp_enqueue_script('vm-bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '303', true);
    wp_enqueue_script('vm-responsive-carousel', get_template_directory_uri() . '/js/responsiveCarousel.js', array(), '262', true);
    wp_enqueue_script('vm-respond', get_template_directory_uri() . '/js/respond.min.js', array(), '20120206', true);
    wp_enqueue_script('vm-main-script', get_template_directory_uri() . '/js/functions.js', array(), true);
    wp_enqueue_script('vm-sharing-buttons', THEME_JS . '/share-buttons.js', array(), true);
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    if (vm_get_option('vm-rtl-option')) {
        wp_enqueue_style('vm-rtl-style', THEME_CSS . '/rtl.css');
    }
}
Exemplo n.º 4
0
    ?>
" data-toggle="tooltip" title="Facebook" class="facebook"><i class="fa fa-facebook"></i></a></li>
                        <li><a href="<?php 
    echo vm_get_option('opt-social-youtube');
    ?>
" data-toggle="tooltip" title="Youtube" class="youtube"><i class="fa fa-youtube"></i></a></li>
                        <li><a href="<?php 
    echo vm_get_option('opt-social-twitter');
    ?>
" data-toggle="tooltip" title="Twitter" class="twitter"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="<?php 
    echo vm_get_option('opt-social-vimeo');
    ?>
" data-toggle="tooltip" title="Vimeo" class="vimeo"><i class="fa fa-vimeo-square"></i></a></li>
                        <li><a href="<?php 
    echo vm_get_option('opt-social-pinterest');
    ?>
" data-toggle="tooltip" title="Pinterest" class="pinterest"><i class="fa fa-pinterest"></i></a></li>
                    </ul>
                    <div class="clearfix"></div>
                </div>
            </div>
            <?php 
}
?>
        </div>
    </div>
</footer>
<!-- Footer End --> 
<a href="#" class="pull-right gotop btn btn-primary backcolor"> <i class="fa fa-arrow-up"></i> </a>
</div>