mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Allow Youtube playlists when API key is not found. Generic playlist icon added.
This commit is contained in:
parent
bc8e569896
commit
f0f992c3b7
@ -1463,9 +1463,22 @@ class media_admin_ui extends e_admin_ui
|
|||||||
}
|
}
|
||||||
elseif(substr($searchQry,0,9) == 'playlist:') // playlist
|
elseif(substr($searchQry,0,9) == 'playlist:') // playlist
|
||||||
{
|
{
|
||||||
$searchQry = trim(substr($searchQry,9));
|
|
||||||
$feed = "https://www.googleapis.com/youtube/v3/search?part=snippet&q=".urlencode($searchQry)."&type=playlist&maxResults=1&key=".$apiKey;
|
if(empty($apiKey))
|
||||||
$extension = 'youtubepl';
|
{
|
||||||
|
$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:')
|
elseif(substr($searchQry,0,8) == 'channel:')
|
||||||
{
|
{
|
||||||
|
@ -3416,8 +3416,8 @@ class e_parser
|
|||||||
list($id,$type) = explode(".",$file,2);
|
list($id,$type) = explode(".",$file,2);
|
||||||
|
|
||||||
$thumb = vartrue($parm['thumb']);
|
$thumb = vartrue($parm['thumb']);
|
||||||
|
|
||||||
|
|
||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
$ytpref = array();
|
$ytpref = array();
|
||||||
foreach($pref as $k=>$v) // Find all Youtube Prefs.
|
foreach($pref as $k=>$v) // Find all Youtube Prefs.
|
||||||
@ -3491,13 +3491,27 @@ class e_parser
|
|||||||
if($thumb == 'tag')
|
if($thumb == 'tag')
|
||||||
{
|
{
|
||||||
$thumbSrc = e107::getMedia()->getThumb($id);
|
$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'/>";
|
return "<img class='img-responsive' src='".$thumbSrc."' alt='Youtube Video Playlist' style='width:".vartrue($parm['w'],'80')."px'/>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($thumb == 'src')
|
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>';
|
$video = '<iframe width="560" height="315" src="https://www.youtube.com/embed/videoseries?list='.$id.'" style="border:0" allowfullscreen></iframe>';
|
||||||
|
BIN
e107_images/generic/playlist_120.png
Normal file
BIN
e107_images/generic/playlist_120.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 581 B |
Loading…
x
Reference in New Issue
Block a user