youtubePlayerModel->newestVids('15'); $return = ''; if (!empty($data)) { foreach ($data as $row) { $videoId = $row['contentDetails']; $videoId = $videoId['videoId']; $title = $this->youtubePlayerModel->getInfos($videoId)['title']; if ($id == $videoId) { $return .= '
✔️', '
➕', '
©'];
$description .= str_replace($items1, $items2, $item) . ' ';
} else {
$description .= $item . ' ';
}
}
}
$return['description'] = $description;
$published = strtotime($infos['publishedAt']);
$return['published'] = DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$published"), $_SESSION['site_lang']);
$return['channelName'] = $infos['channelTitle'];
$return['channelUrl'] = 'http://youtube.com/channel/' . $infos['channelId'];
$return['views'] = number_format($stats['viewCount'], 0, ',', '.');
$return['likes'] = $stats['likeCount'];
$return['dislikes'] = $stats['dislikeCount'];
$return['comments'] = number_format($stats['commentCount'], 0, ',', '.');
$rateCount = intval($return['likes']) + intval($return['dislikes']);
if (intval($return['likes']) > 0 && intval($return['dislikes']) > 0) {
$return['likeWidth'] = intval($return['likes']) / $rateCount * 100;
$return['dislikeWidth'] = intval($return['dislikes']) / $rateCount * 100;
$return['grayWidth'] = 0;
} elseif (intval($return['likes']) == 0 && intval($return['dislikes']) == 0) {
$return['likeWidth'] = 0;
$return['dislikeWidth'] = 0;
$return['grayWidth'] = 100;
} elseif (intval($return['likes']) == 0) {
$return['likeWidth'] = 0;
$return['dislikeWidth'] = 100;
$return['grayWidth'] = 0;
} else {
$return['likeWidth'] = 100;
$return['dislikeWidth'] = 0;
$return['grayWidth'] = 0;
}
$return['thumbnails'] = $infos['thumbnails'];
return $return;
}
public function checkVideo($videoID)
{
$data = json_decode(@file_get_contents("https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=" . $videoID . "&key=AIzaSyAZi6W9FODqd-bjlmV0sGJ8vjvSgFNTXVM"));
return $data->pageInfo->totalResults !== 0;
}
}