本文整理汇总了PHP中yit_video_type_by_url函数的典型用法代码示例。如果您正苦于以下问题:PHP yit_video_type_by_url函数的具体用法?PHP yit_video_type_by_url怎么用?PHP yit_video_type_by_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yit_video_type_by_url函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: yit_work_get
}
$video_url = yit_work_get('video_url');
$image_url = yit_work_get('image_url');
$image_id = yit_work_get('item_id');
$post_permalink = yit_work_permalink($image_id);
?>
<li <?php
yit_work_class($classes);
?>
>
<?php
$class = '';
if (!empty($video_url)) {
list($video_type, $video_id) = explode(':', yit_video_type_by_url($video_url));
if ($video_type == 'youtube') {
$video_url = 'http://www.youtube.com/embed/' . $video_id . '?width=640&height=480&iframe=true';
} else {
if ($video_type == 'vimeo') {
$video_url = 'http://player.vimeo.com/video/' . $video_id;
}
}
$thumb = $video_url;
//$class = 'video';
} else {
$thumb = $image_url;
//$class = 'img';
}
$both = 0;
$class = '';
示例2: while
* Classic Portfolio Section Style
*/
?>
<?php
$count = 0;
while (yit_have_works()) {
$work_terms = yit_work_get('terms');
$work_permalink = yit_work_permalink(yit_work_get('item_id'));
$work_title = yit_work_get('title');
$work_video_url = yit_work_get('video_url');
$work_image_url = yit_work_get('image_url');
// Check for thumbnail or video
$thumb = '';
if (!empty($work_video_url)) {
if ($is_really_video = yit_video_type_by_url($work_video_url)) {
list($work_video_type, $work_video_id) = explode(':', $is_really_video);
}
if (isset($work_video_type)) {
if ($work_video_type == 'youtube') {
$work_video_url = 'http://www.youtube.com/embed/' . $work_video_id . '?width=640&height=480&iframe=true';
} else {
if ($work_video_type == 'vimeo') {
$work_video_url = 'http://player.vimeo.com/video/' . $work_video_id;
}
}
$thumb = $work_video_url;
} else {
$thumb = '';
// fix if $work_vide_url is not set
}
示例3: yit_ajax_portfolio_thumbs
/**
* Return JSON well formatted portfolio work
*
* @param array $work
* @return string
* @since 1.0.0
*/
function yit_ajax_portfolio_thumbs()
{
$work = $_POST['work'];
$type = $_POST['type'];
//thumb
$thumb_output = '';
$lightbox = $_POST['overlay'];
if (isset($work['video_url']) && $work['video_url']) {
list($video_type, $video_id) = explode(':', yit_video_type_by_url($work['video_url']));
if ($video_type == 'youtube') {
$video_url = 'http://www.youtube.com/embed/' . $video_id . '?width=640&height=480&iframe=true';
} else {
if ($video_type == 'vimeo') {
$video_url = 'http://player.vimeo.com/video/' . $video_id;
}
}
$thumb_output = do_shortcode("[{$video_type} video_id=\"{$video_id}\" width=\"100%\" height=\"100%\"]");
} elseif (!empty($work['extra-images'])) {
$thumb_output = '<div class="extra-images-slider"><ul class="slides">';
$thumb_size = $type == 'portfolio' ? 'thumb_medium_portfolio_thumbs' : 'section_portfolio';
array_unshift($work['extra-images'], $work['item_id']);
foreach ($work['extra-images'] as $image_id) {
$thumb_output .= '<li><div class="picture_overlay">';
$thumb_output .= yit_image("id={$image_id}&size={$thumb_size}", false);
//wp_get_attachment_image( $image_id, $thumb_size );
if ($lightbox) {
$thumb = yit_image("id={$image_id}&output=url", false);
$thumb_output .= '<div class="overlay"><div><p>';
$thumb_output .= '<a href="' . $thumb . '" rel="lightbox_thumbs"><img src="' . get_template_directory_uri() . '/images/icons/zoom.png" alt="' . __('Open Lightbox', 'yit') . '" /></a>';
$thumb_output .= '</p></div></div>';
}
$thumb_output .= '</div></li>';
}
$thumb_output .= '</ul></div>';
} else {
$thumb_size = $type == 'portfolio' ? 'thumb_medium_portfolio_thumbs' : 'section_portfolio';
$thumb_output = '<div class="picture_overlay">';
$thumb_output .= yit_image("id={$work['item_id']}&size={$thumb_size}", false);
//wp_get_attachment_image( $work['item_id'], $thumb_size );
if ($lightbox) {
$thumb_output .= '<div class="overlay"><div><p>';
$thumb_output .= '<a href="' . $work['image'] . '" rel="lightbox_thumbs"><img src="' . get_template_directory_uri() . '/images/icons/zoom.png" alt="' . __('Open Lightbox', 'yit') . '" /></a>';
$thumb_output .= '</p></div></div>';
}
$thumb_output .= '</div>';
}
//content
$thumb_content = '';
if ($type != 'portfolio') {
$thumb_content = '<h3 class="title">' . yit_decode_title($work['title']) . '</h3>';
if (isset($work['subtitle']) && $work['subtitle']) {
$thumb_content .= '<h4 class="subtitle">' . yit_decode_title($work['subtitle']) . '</h4>';
}
}
$thumb_content .= yit_clean_text($work['text']);
//meta
$meta_content = '';
$customer = $work['customer'];
$skills = $work['skills'];
$skills_label = empty($work['skills_label']) ? yit_string('<strong>', __('Skills: ', 'yit'), '</strong>', 0) : yit_string('<strong>', $work['skills_label'], '</strong>', 0) . ': ';
$website = $work['website_name'] ? $work['website_name'] : $work['website_url'];
$website_url = $work['website_url'];
$year = $work['year'];
$terms = isset($work['terms']) ? $work['terms'] : '';
$meta_content = '<ul>';
if ($terms) {
$terms_plain = '';
$categories = $work['categories'];
foreach ($terms as $term) {
$terms_plain .= $categories[$term] . ', ';
}
$terms_plain = substr($terms_plain, 0, strlen($terms_plain) - 2);
$icon = '<span><img src="' . YIT_THEME_ASSETS_URL . '/images/categories.png" alt="categories" /></span>';
$meta_content .= '<li class="categories">' . $icon . yit_string('<strong>', __('Categories: ', 'yit'), '</strong>', 0) . $terms_plain . '</li>';
}
if ($customer) {
$icon = '<span><img src="' . YIT_THEME_ASSETS_URL . '/images/customer.png" alt="customer" /></span>';
$meta_content .= '<li class="customer">' . $icon . yit_string('<strong>', __('Customer: ', 'yit'), '</strong>', 0) . $customer;
if ($website_url) {
$meta_content .= ' - <a href="' . $website_url . '">' . $website . '</a>';
}
$meta_content .= '</li>';
}
if ($skills) {
$icon = '<span><img src="' . YIT_THEME_ASSETS_URL . '/images/project.png" alt="skills" /></span>';
$meta_content .= '<li class="skills">' . $icon . $skills_label . $skills . '</li>';
}
if ($year) {
$icon = '<span><img src="' . YIT_THEME_ASSETS_URL . '/images/year.png" alt="year" /></span>';
$meta_content .= '<li class="year">' . $icon . yit_string('<strong>', __('Year: ', 'yit'), '</strong>', 0) . $year . '</li>';
}
echo json_encode(array('thumb' => $thumb_output, 'content' => $thumb_content, 'meta' => $meta_content, 'title' => yit_decode_title($work['title'])));
die;
//.........这里部分代码省略.........
示例4: featured_content
/**
* Retrieve and print the type and content of the slide
*
* @param $content_type string 'image' = to show the image, 'video' => to show the video
* @return null
*
* @since 1.0
*/
public function featured_content($content_type, $args = array())
{
$default = array('container' => true, 'id_container' => '', 'before' => '', 'after' => '', 'video_width' => 425, 'video_height' => 356, 'echo' => true);
$args = wp_parse_args($args, $default);
extract($args, EXTR_SKIP);
$slide = $this->_current_slide;
$link = $this->_there_is_link;
$link_url = $this->_url_slide;
$output = $attr = '';
$output .= $before;
if (!empty($id_container)) {
$id_container = " id=\"{$id_container}\"";
}
switch ($content_type) {
case 'image':
if ($container) {
$output .= '<div class="featured-image"' . $id_container . '>';
}
$output .= $this->_a_before . wp_get_attachment_image($slide['item_id'], 'full') . $this->_a_after;
if ($container) {
$output .= '</div>';
}
break;
case 'video':
list($type, $id) = explode(':', yit_video_type_by_url($slide['url_video']));
switch ($type) {
case 'youtube':
$output .= '<div class="video-container">' . do_shortcode("[youtube width=\"{$video_width}\" height=\"{$video_height}\" video_id=\"{$id}\"]") . '</div>';
break;
case 'vimeo':
$output .= '<div class="video-container">' . do_shortcode("[vimeo width=\"{$video_width}\" height=\"{$video_height}\" video_id=\"{$id}\"]") . '</div>';
break;
}
break;
}
$output .= $after . "\n";
if ($echo) {
echo $output;
} else {
return $output;
}
}