示例#1
0
/** YouTube shortcode */
function shortcode_lyte($atts)
{
    extract(shortcode_atts(array("id" => '', "audio" => '', "playlist" => ''), $atts));
    if ($audio) {
        $proto = "httpa";
    } else {
        $proto = "httpv";
    }
    if ($playlist) {
        $action = "playlist?list=PL";
    } else {
        $action = "watch?v=";
    }
    return lyte_parse($proto . '://www.youtube.com/' . $action . $id);
}
function lyte_preparse($videoId)
{
    return lyte_parse('httpv://www.youtube.com/watch?v=' . $videoId);
}
示例#3
0
 function get_portfolio_content($item)
 {
     global $portfolio, $post, $msd_portfolio_url;
     $portfolio->the_meta($item->ID);
     $youtube = $portfolio->get_the_value('youtube');
     if ($youtube != '') {
         $youtube = preg_replace('@http(s)?\\:\\/\\/@i', 'httpv://', $youtube);
         $norelated = strrpos($youtube, '?') > 1 ? '&rel=0' : '?rel=0';
         $content = $youtube . $norelated;
         if (function_exists('lyte_parse')) {
             $content = lyte_parse($content);
         }
     } else {
         $large_image = wp_get_attachment_image_src(get_post_thumbnail_id($item->ID), 'large');
         $content = $large_image ? '<img lazy-src="' . $large_image[0] . '" class="dropshadow" />' : FALSE;
     }
     $content = array('title' => $item->post_title, 'description' => $item->post_content, 'image' => $content);
     if ($content_array = $this->get_additional_portfolio_content($item)) {
         array_unshift($content_array, $content);
         return $content_array;
     }
     $content_array[] = $content;
     return $content_array;
 }