1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Allow Youtube playlists when API key is not found. Generic playlist icon added.

This commit is contained in:
Cameron 2015-12-12 16:54:10 -08:00
parent bc8e569896
commit f0f992c3b7
3 changed files with 33 additions and 6 deletions

View File

@ -1462,9 +1462,22 @@ class media_admin_ui extends e_admin_ui
$data['items'][0]['snippet']['title'] = 'Specified Video';
}
elseif(substr($searchQry,0,9) == 'playlist:') // playlist
{
if(empty($apiKey))
{
$playlistID = substr($searchQry,9);
$data = array();
$data['items'][0]['id']['videoId'] = $playlistID;
$data['items'][0]['snippet']['thumbnails']['medium']['url'] = e_IMAGE_ABS."generic/playlist_120.png"; // "http://i.ytimg.com/vi/".$playlistID."/mqdefault.jpg"; // not really possible, so it will show a generic grey image.
$data['items'][0]['snippet']['title'] = 'Specified Playlist';
}
else
{
$searchQry = trim(substr($searchQry,9));
$feed = "https://www.googleapis.com/youtube/v3/search?part=snippet&q=".urlencode($searchQry)."&type=playlist&maxResults=1&key=".$apiKey;
}
$extension = 'youtubepl';
}
elseif(substr($searchQry,0,8) == 'channel:')

View File

@ -3491,13 +3491,27 @@ class e_parser
if($thumb == 'tag')
{
$thumbSrc = e107::getMedia()->getThumb($id);
if(empty($thumbSrc))
{
$thumbSrc = e_IMAGE_ABS."generic/playlist_120.png";
}
return "<img class='img-responsive' src='".$thumbSrc."' alt='Youtube Video Playlist' style='width:".vartrue($parm['w'],'80')."px'/>";
}
if($thumb == 'src')
{
return e107::getMedia()->getThumb($id);
$thumb = e107::getMedia()->getThumb($id);
if(!empty($thumb))
{
return $thumb;
}
else
{
// return "https://cdn0.iconfinder.com/data/icons/internet-2-2/64/youtube_playlist_videos_vid_web_online_internet-256.png";
return e_IMAGE_ABS."generic/playlist_120.png";
}
}
$video = '<iframe width="560" height="315" src="https://www.youtube.com/embed/videoseries?list='.$id.'" style="border:0" allowfullscreen></iframe>';

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B