本文整理汇总了PHP中get_youtube_id_from_url函数的典型用法代码示例。如果您正苦于以下问题:PHP get_youtube_id_from_url函数的具体用法?PHP get_youtube_id_from_url怎么用?PHP get_youtube_id_from_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_youtube_id_from_url函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: front_end_slider
//.........这里部分代码省略.........
onPlay();
onPause();
jQuery('#huge_it_slideshow_left_<?php
echo $sliderID;
?>
, #huge_it_slideshow_right_<?php
echo $sliderID;
?>
,.huge_it_slideshow_dots_<?php
echo $sliderID;
?>
').click(function(){
stopVimeoVideo(player_id);
});
}
setupEventListeners();
}
});
</script>
<?php
}
?>
<?php
if ($hasyoutube == true) {
?>
<script src="<?php
echo plugins_url('js/youtube.lib.js', __FILE__);
?>
"></script>
<script>
<?php
function get_youtube_id_from_url($url)
{
if (preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $url, $match)) {
return $match[1];
}
}
$i = 0;
foreach ($images as $key => $image_row) {
if ($image_row->sl_type == "video" and strpos($image_row->image_url, 'youtu') !== false) {
?>
var player_<?php
echo $image_row->id;
?>
;
<?php
} else {
if (strpos($image_row->image_url, 'vimeo') !== false) {
?>
<?php
} else {
continue;
}
}
$i++;
}
?>
huge_video_playing['video_is_playing_'+<?php
echo $sliderID;
?>
]=false;
function onYouTubeIframeAPIReady() {
示例2: Html_editvideogallery
//.........这里部分代码省略.........
<?php
}
}
?>
<li class="add-new">
<a onclick="window.location.href='admin.php?page=videogallerys_huge_it_videogallery&task=add_cat'">+</a>
</li>
</ul>
</div>
<div id="post-body" class="metabox-holder columns-2">
<!-- Content -->
<div id="post-body-content">
<?php
add_thickbox();
?>
<div id="post-body">
<div id="post-body-heading">
<h3>Projects/Videos</h3>
<?php
$_GET['id'] = esc_html($_GET['id']);
?>
<a href="admin.php?page=videogallerys_huge_it_videogallery&task=videogallery_video&id=<?php
echo $_GET['id'];
?>
&TB_iframe=1" class="button button-primary add-video-slide thickbox" id="slideup3s" value="iframepop">
<span class="wp-media-buttons-icon"></span>Add Video
</a>
</div>
<ul id="images-list">
<?php
function get_youtube_id_from_url($url)
{
if (preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $url, $match)) {
return $match[1];
}
}
$i = 2;
foreach ($rowim as $key => $rowimages) {
?>
<?php
if ($rowimages->sl_type == '') {
$rowimages->sl_type = 'image';
}
switch ($rowimages->sl_type) {
case 'video':
?>
<li <?php
if ($i % 2 == 0) {
echo "class='has-background'";
}
$i++;
?>
>
<input class="order_by" type="hidden" name="order_by_<?php
echo $rowimages->id;
?>
" value="<?php
echo $rowimages->ordering;
?>
" />
<?php
if (empty($rowimages->thumb_url)) {
示例3: Html_editslider
//.........这里部分代码省略.........
</a>
<script>
jQuery(document).ready(function ($) {
jQuery("#slideup").click(function () {
window.parent.uploadID = jQuery(this).prev('input');
formfield = jQuery('.upload').attr('name');
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
return false;
});
window.send_to_editor = function (html) {
imgurl = jQuery('img', html).attr('src');
if(imgurl) {
window.parent.uploadID.val(imgurl);
tb_remove();
jQuery("#save-buttom").click();
}
else {
imgurl = jQuery('#embed-url-field').val();
if(imgurl) {
window.parent.jQuery("#_unique_name").val(imgurl+';;;');
jQuery("#save-buttom").click();
tb_remove();
}
}
};
});
</script>
</div>
<ul id="images-list">
<?php
function get_youtube_id_from_url($url)
{
if (preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $url, $match)) {
return $match[1];
}
}
$i = 2;
foreach ($rowim as $key => $rowimages) {
?>
<?php
if ($rowimages->sl_type == '') {
$rowimages->sl_type = 'image';
}
switch ($rowimages->sl_type) {
case 'image':
?>
<li <?php
if ($i % 2 == 0) {
echo "class='has-background'";
}
$i++;
?>
>
<input class="order_by" type="hidden" name="order_by_<?php
echo $rowimages->id;
?>
" value="<?php
echo $rowimages->ordering;
?>
" />
<div class="image-container">
<img src="<?php
echo $rowimages->image_url;
示例4: Html_editvideogallery
//.........这里部分代码省略.........
<?php
}
}
?>
<li class="add-new">
<a onclick="window.location.href='admin.php?page=videogallerys_huge_it_videogallery&task=add_cat'">+</a>
</li>
</ul>
</div>
<div id="post-body" class="metabox-holder columns-2">
<!-- Content -->
<div id="post-body-content">
<?php
add_thickbox();
?>
<div id="post-body">
<div id="post-body-heading">
<h3>Projects/Videos</h3>
<?php
$_GET['id'] = esc_html($_GET['id']);
?>
<a href="admin.php?page=videogallerys_huge_it_videogallery&task=videogallery_video&id=<?php
echo $_GET['id'];
?>
&TB_iframe=1" class="button button-primary add-video-slide thickbox" id="slideup3s" value="iframepop">
<span class="wp-media-buttons-icon"></span>Add Video
</a>
</div>
<ul id="images-list">
<?php
function get_youtube_id_from_url($url)
{
if (preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $url, $match)) {
return $match[1];
}
}
$i = 2;
foreach ($rowim as $key => $rowimages) {
?>
<?php
if ($rowimages->sl_type == '') {
$rowimages->sl_type = 'image';
}
switch ($rowimages->sl_type) {
case 'video':
?>
<li <?php
if ($i % 2 == 0) {
echo "class='has-background'";
}
$i++;
?>
>
<input class="order_by" type="hidden" name="order_by_<?php
echo $rowimages->id;
?>
" value="<?php
echo $rowimages->ordering;
?>
" />
<?php
if (empty($rowimages->thumb_url)) {
示例5: foreach
</div>
</div>
<div class="content-wrap grey-border">
<ul class="slick-multimedia">
<?php
foreach ($multimedia_video as $video) {
?>
<li>
<a class="video fancybox.iframe" href="https://www.youtube.com/embed/<?php
echo get_youtube_id_from_url($video['iframe']);
?>
">
<div class="multi-img ">
<div class="play_multi_btn"></div>
<img src="http://i1.ytimg.com/vi/<?php
echo get_youtube_id_from_url($video['iframe']);
?>
/sddefault.jpg">
</div>
<div class="multi-content">
<span class="multi-title" style="height: 56px;overflow: hidden;"><?php
echo $video['name_' . $lng];
?>
</span>
<p class="date"><i class="mdi mdi-calendar-clock"></i><?php
echo show_date($video['data']);
?>
</p>
</div>
</a>
</li>
示例6: front_end_videogallery
//.........这里部分代码省略.........
onPlay();
onPause();
jQuery('#huge_it_slideshow_left_videogallery_<?php
echo $sliderID;
?>
, #huge_it_slideshow_right_videogallery_<?php
echo $sliderID;
?>
,.huge_it_slideshow_dots_videogallery_<?php
echo $sliderID;
?>
').click(function(){
stopVimeoVideo(player_id);
});
}
setupEventListeners();
}
});
</script>
<?php
}
?>
<?php
if ($hasyoutube == true) {
?>
<script src="<?php
echo plugins_url('js/youtube.lib.js', __FILE__);
?>
"></script>
<script>
<?php
if (!function_exists('get_youtube_id_from_url')) {
function get_youtube_id_from_url($url)
{
if (stristr($url, 'youtu.be/')) {
preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $url, $final_ID);
return $final_ID[4];
} else {
preg_match('/(https:|http:|):(\\/\\/www\\.|\\/\\/|)(.*?)\\/(embed\\/|watch\\?v=|(.*?)&v=|v\\/|e\\/|.+\\/|watch.*v=|)([a-z_A-Z0-9]{11})/i', $url, $IDD);
/*var_dump($IDD);*/
return $IDD[6];
}
}
}
$i = 0;
foreach ($images as $key => $image_row) {
if ($image_row->sl_type == "video" and strpos($image_row->image_url, 'youtu') !== false) {
?>
var player_<?php
echo $image_row->id;
?>
;
<?php
} else {
if (strpos($image_row->image_url, 'vimeo') !== false) {
?>
<?php
} else {
continue;
}
}
$i++;
示例7: front_end_slider
//.........这里部分代码省略.........
onPlay();
onPause();
jQuery('#huge_it_slideshow_left_<?php
echo $sliderID;
?>
, #huge_it_slideshow_right_<?php
echo $sliderID;
?>
,.huge_it_slideshow_dots_<?php
echo $sliderID;
?>
').click(function(){
stopVimeoVideo(player_id);
});
}
setupEventListeners();
}
});
</script>
<?php
}
?>
<?php
if ($hasyoutube == true) {
?>
<script src="<?php
echo plugins_url('js/youtube.lib.js', __FILE__);
?>
"></script>
<script>
<?php
function get_youtube_id_from_url($url)
{
if (stristr($url, 'youtu.be/')) {
preg_match('/(https:|http:|)(\\/\\/www\\.|\\/\\/|)(.*?)\\/(.{11})/i', $url, $final_ID);
return $final_ID[4];
} else {
preg_match('/(https:|http:|):(\\/\\/www\\.|\\/\\/|)(.*?)\\/(embed\\/|watch\\?v=|(.*?)&v=|v\\/|e\\/|.+\\/|watch.*v=|)([a-z_A-Z0-9]{11})/i', $url, $IDD);
return $IDD[6];
}
}
$i = 0;
foreach ($images as $key => $image_row) {
if ($image_row->sl_type == "video" and strpos($image_row->image_url, 'youtube') !== false) {
?>
var player_<?php
echo $image_row->id;
?>
;
<?php
} else {
if (strpos($image_row->image_url, 'vimeo') !== false) {
?>
<?php
} else {
continue;
}
}
$i++;
}
?>
video_is_playing_<?php
示例8: get_image_from_video
function get_image_from_video($image_url)
{
if (strpos($image_url, 'youtube') !== false || strpos($image_url, 'youtu') !== false) {
$liclass = "youtube";
$video_thumb_url = get_youtube_id_from_url($image_url);
$thumburl = 'http://img.youtube.com/vi/' . $video_thumb_url . '/mqdefault.jpg';
} else {
if (strpos($image_url, 'vimeo') !== false) {
$liclass = "vimeo";
$vimeo = $image_url;
$vimeo_explode = explode("/", $vimeo);
$imgid = end($vimeo_explode);
$hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/" . $imgid . ".php"));
$imgsrc = $hash[0]['thumbnail_large'];
$thumburl = $imgsrc;
}
}
return $thumburl;
}
示例9: front_end_gallery
//.........这里部分代码省略.........
onPlay();
onPause();
jQuery('#huge_it_slideshow_left_gallery_<?php
echo $sliderID;
?>
, #huge_it_slideshow_right_gallery_<?php
echo $sliderID;
?>
,.huge_it_slideshow_dots_gallery_<?php
echo $sliderID;
?>
').click(function(){
stopVimeoVideo(player_id);
});
}
setupEventListeners();
}
});
</script>
<?php
}
?>
<?php
if ($hasyoutube == true) {
?>
<script src="<?php
echo plugins_url('js/youtube.lib.js', __FILE__);
?>
"></script>
<script>
<?php
function get_youtube_id_from_url($url)
{
if (stristr($url, 'youtu.be/')) {
preg_match('/(https:|http:|)(\\/\\/www\\.|\\/\\/|)(.*?)\\/(.{11})/i', $url, $final_ID);
return $final_ID[4];
} else {
preg_match('/(https:|http:|):(\\/\\/www\\.|\\/\\/|)(.*?)\\/(embed\\/|watch\\?v=|(.*?)&v=|v\\/|e\\/|.+\\/|watch.*v=|)([a-z_A-Z0-9]{11})/i', $url, $IDD);
return $IDD[6];
}
}
$i = 0;
foreach ($images as $key => $image_row) {
if ($image_row->sl_type == "video" and strpos($image_row->image_url, 'youtube') !== false) {
?>
var player_<?php
echo $image_row->id;
?>
;
<?php
} else {
if (strpos($image_row->image_url, 'vimeo') !== false) {
?>
<?php
} else {
continue;
}
}
$i++;
}
?>
video_is_playing_gallery_<?php
示例10: if
<tbody>
<? if ($video) { ?>
<? foreach ($video as $item) { ?>
<tr>
<td class="center"><input type="checkbox" name="selected[]" value="<?php
echo $item['id_video'];
?>
" /></td>
<td class="left" valign="top">
<?php
if ($item['iframe']) {
?>
<img src="http://img.youtube.com/vi/<?php
echo get_youtube_id_from_url($item['iframe']);
?>
/0.jpg" width="40" />
<?php
} else {
?>
<img src="/assets/backend/img/no_image.jpg" width="40" height="35" />
<?php
}
?>
</td>
<td class="left"><a href="/admin/video_form/<?php
echo $item['parent'];
?>
/<?php
示例11: Html_editgallery
//.........这里部分代码省略.........
});
/* jQuery(".wp-media-buttons-icon").click(function() {
jQuery(".media-menu .media-menu-item").css("display","none");
jQuery(".media-menu-item:first").css("display","block");
jQuery(".separator").next().css("display","none");
jQuery('.attachment-filters').val('image').trigger('change');
jQuery(".attachment-filters").css("display","none");
});*/
});
</script>
<input type="hidden" name="imagess" id="_unique_name" />
<span class="wp-media-buttons-icon"></span>
<div class="huge-it-newuploader uploader button button-primary add-new-image">
<input type="button" class="button wp-media-buttons-icon" name="_unique_name_button" id="_unique_name_button" value="Add Image" />
</div>
<?php
$_GET['id'] = esc_html($_GET['id']);
?>
<a href="admin.php?page=gallerys_huge_it_gallery&task=gallery_video&id=<?php
echo $_GET['id'];
?>
&TB_iframe=1" class="button button-primary add-video-slide thickbox" id="slideup3s" value="iframepop">
<span class="wp-media-buttons-icon"></span>Add Video
</a>
</div>
<ul id="images-list">
<?php
function get_youtube_id_from_url($url)
{
if (preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $url, $match)) {
return $match[1];
}
}
$i = 2;
foreach ($rowim as $key => $rowimages) {
?>
<?php
if ($rowimages->sl_type == '') {
$rowimages->sl_type = 'image';
}
switch ($rowimages->sl_type) {
case 'image':
?>
<li <?php
if ($i % 2 == 0) {
echo "class='has-background'";
}
$i++;
?>
>
<input class="order_by" type="hidden" name="order_by_<?php
echo $rowimages->id;
?>
" value="<?php
echo $rowimages->ordering;
?>
" />
<div class="image-container">
<img src="<?php
echo $rowimages->image_url;
示例12: foreach
foreach ($video as $value) {
?>
<div class="col-md-6">
<?php
if ($value['iframe'] != '') {
?>
<div class="multimedia-block">
<a class="video fancybox.iframe" href="https://www.youtube.com/embed/<?php
echo get_youtube_id_from_url($value['iframe']);
?>
">
<div class="multi-img ">
<div class="play_multi_btn"></div>
<img class="img-responsive" src="http://i1.ytimg.com/vi/<?php
echo get_youtube_id_from_url($value['iframe']);
?>
/sddefault.jpg"/>
</div>
<div class="multimedia-title">
<p class="center"><?php
echo $value['name_' . $lng];
?>
</p>
</div>
</a>
<div class="date-time-posts">
<span class="center"><i class="mdi mdi-calendar-clock"></i> <?php
echo show_date_time($value['data']);
?>
示例13: foreach
} else {
if ($slide->type == 'indicator') {
$src = '';
foreach ($indicators as $k => $ind) {
if ($ind->id == $slide->content) {
$src = $ind->link;
}
}
$content_to_display = '<iframe src="' . $src . '" frameborder="0" ></iframe>';
//$content_to_display = '<input type="hidden" class="src" value="'.$src.'" />';
} else {
if ($slide->type == 'media') {
if (is_img($slide->content)) {
$content_to_display = '<img src="' . $slide->content . '" alt="' . $slide->title . '" class="full_width" />';
} else {
$vid_id = get_youtube_id_from_url($slide->content);
if (!empty($vid_id)) {
$content_to_display = '<iframe style="" src="//www.youtube.com/embed/' . $vid_id . '" frameborder="0"></iframe>';
//$content_to_display = '<input type="hidden" class="src" value="//www.youtube.com/embed/'.$vid_id.'" />';
} else {
$vid_id = get_vimeo_id_from_url($slide->content);
if (!empty($vid_id)) {
$content_to_display = '<iframe style="" src="//player.vimeo.com/video/' . $vid_id . '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
}
}
}
//$all_content = '<div id="slide_preview_content_area" class="col-sm-8 col-md-9">' . $content_to_display . '</div><div id="slide_preview_desc_area" class="col-sm-4 col-md-3 ' . $obj->style . '"><h1>' . $slide->title . '</h1><p>' . remove_unicode($slide->description) . '</p></div>';
} else {
if ($slide->type == 'wordcloud') {
$winWidth = 800;
$winHeight = 600;