foreach ($video_filer['items'] as $video) {
if (isset($video['id'])) {
$date = new DateTime($video['snippet']['publishedAt']);
$time = covtime($video['contentDetails']['duration']);
//convert the date
$video_date = date_format($date, 'd/m/y');
//create the video list details
$data[] = array(
"thumbnail" => $video['snippet']['thumbnails']['medium']['url'],
"title" => htmlspecialchars($video['snippet']['title'], ENT_QUOTES, 'UTF-8'),
"title_short" => short_text_out(htmlspecialchars($video['snippet']['title'], ENT_QUOTES, 'UTF-8'), 4),
"username" => $video['snippet']['channelTitle'],
"profile" => "https://www.youtube.com/channel/" . $video['snippet']['channelId'],
"views" => (isset($video['statistics']['viewCount'])) ? $video['statistics']['viewCount'] : '',
"date" => $video_date,
"time" => $time,
"more" => 'https://www.youtube.com/watch?v=' . $video['id'],
"embed_url" => 'http://www.youtube.com/embed/' . $video['id'] . '?autoplay=1',
);
}
}