Example #1
0
function wp_vid_lightbox_get_auto_thumb($atts)
{
    $video_id = $atts['video_id'];
    $pieces = explode("&", $video_id);
    $video_id = $pieces[0];
    $anchor_replacement = "";
    if ($atts['vid_type'] == "youtube") {
        $anchor_replacement = '<div class="wpvl_auto_thumb_box_wrapper"><div class="wpvl_auto_thumb_box">';
        $anchor_replacement .= '<img src="https://img.youtube.com/vi/' . $video_id . '/0.jpg" class="video_lightbox_auto_anchor_image" alt="" />';
        $anchor_replacement .= '<div class="wpvl_auto_thumb_play"><img src="' . WP_VID_LIGHTBOX_URL . '/images/play.png" class="wpvl_playbutton" /></div>';
        $anchor_replacement .= '</div></div>';
    } else {
        if ($atts['vid_type'] == "vimeo") {
            $VideoInfo = wp_vid_lightbox_getVimeoInfo($video_id);
            $thumb = $VideoInfo['thumbnail_medium'];
            //print_r($VideoInfo);
            $anchor_replacement = '<div class="wpvl_auto_thumb_box_wrapper"><div class="wpvl_auto_thumb_box">';
            $anchor_replacement .= '<img src="' . $thumb . '" class="video_lightbox_auto_anchor_image" alt="" />';
            $anchor_replacement .= '<div class="wpvl_auto_thumb_play"><img src="' . WP_VID_LIGHTBOX_URL . '/images/play.png" class="wpvl_playbutton" /></div>';
            $anchor_replacement .= '</div></div>';
        } else {
            wp_die("<p>no video type specified</p>");
        }
    }
    return $anchor_replacement;
}
function wp_vid_lightbox_get_auto_thumb($atts)
{
    $video_id = $atts['video_id'];
    $pieces = explode("&", $video_id);
    $video_id = $pieces[0];
    $alt = '';
    if (isset($atts['alt']) && !empty($atts['alt'])) {
        $alt = $atts['alt'];
    }
    $anchor_replacement = "";
    if ($atts['vid_type'] == "youtube") {
        /*$anchor_replacement = '<div class="wpvl_auto_thumb_box_wrapper"><div class="wpvl_auto_thumb_box">';
          $anchor_replacement .= '<img src="https://img.youtube.com/vi/'.$video_id.'/0.jpg" class="video_lightbox_auto_anchor_image" alt="'.$alt.'" />';
          $anchor_replacement .= '<div class="wpvl_auto_thumb_play"><img src="'.WP_VID_LIGHTBOX_URL.'/images/play.png" class="wpvl_playbutton" /></div>';
          $anchor_replacement .= '</div></div>';*/
        $anchor_replacement = '<img src="https://img.youtube.com/vi/' . $video_id . '/maxresdefault.jpg" alt="' . $alt . '" />
            <div class="overlay">
                <div class="srs__video--actions">
                    <div class="table-cell">
                        <div class="video_caption">Veja o vídeo de apresentação da +SRS</div>
                        <img src="' . WP_VID_LIGHTBOX_URL . '/images/play.png" class="wpvl_playbutton" />
                    </div>                  
                </div>              
            </div>';
    } else {
        if ($atts['vid_type'] == "vimeo") {
            $VideoInfo = wp_vid_lightbox_getVimeoInfo($video_id);
            $thumb = $VideoInfo['thumbnail_medium'];
            //print_r($VideoInfo);
            $anchor_replacement = '<div class="wpvl_auto_thumb_box_wrapper"><div class="wpvl_auto_thumb_box">';
            $anchor_replacement .= '<img src="' . $thumb . '" class="video_lightbox_auto_anchor_image" alt="' . $alt . '" />';
            $anchor_replacement .= '<div class="wpvl_auto_thumb_play"><img src="' . WP_VID_LIGHTBOX_URL . '/images/play.png" class="wpvl_playbutton" /></div>';
            $anchor_replacement .= '</div></div>';
        } else {
            wp_die("<p>no video type specified</p>");
        }
    }
    return $anchor_replacement;
}
Example #3
0
<?php

function wp_vid_lightbox_getVimeoInfo($id)
{
    if (!function_exists('curl_init')) {
        die('CURL is not installed!');
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://vimeo.com/api/v2/video/{$id}.php");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $output = unserialize(curl_exec($ch));
    $output = $output[0];
    curl_close($ch);
    return $output;
}
if (isset($_REQUEST["id"])) {
    $id = $_REQUEST["id"];
    $response = json_encode(wp_vid_lightbox_getVimeoInfo($id));
    echo $response;
} else {
    echo "Not Set";
}