1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
Daniel Neto 2023-09-01 09:17:08 -03:00
parent 5fdc8a895a
commit 099313b89a
7 changed files with 412 additions and 327 deletions

View file

@ -1793,8 +1793,8 @@ function getSources($fileName, $returnArray = false, $try = 0)
if (function_exists('getVTTTracks')) {
$subtitleTracks = getVTTTracks($fileName, $returnArray);
}
if (function_exists('getVTTCaptionTracks')) {
$captionsTracks = getVTTCaptionTracks($fileName, $returnArray);
if (function_exists('getVTTChapterTracks')) {
$captionsTracks = getVTTChapterTracks($fileName, $returnArray);
}
//var_dump($subtitleTracks, $captionsTracks);exit;
if ($returnArray) {
@ -4504,6 +4504,12 @@ function getLdJson($videos_id)
)
)
);
if(AVideoPlugin::isEnabledByName('Bookmark')){
$chapters = Bookmark::generateChaptersJSONLD($videos_id);
if(!empty($chapters)){
$data['videoChapter'] = $chapters;
}
}
$output = '<script type="application/ld+json" id="application_ld_json">';
$output .= json_encode($data, JSON_UNESCAPED_SLASHES);

View file

@ -4458,7 +4458,7 @@ if (!class_exists('Video')) {
return $matches[1];
}
$search = ['_Low', '_SD', '_HD', '_thumbsV2', '_thumbsSmallV2', '_thumbsSprit', '_roku', '_portrait', '_portrait_thumbsV2', '_portrait_thumbsSmallV2', '_thumbsV2_jpg', '_spectrum', '_tvg', '.notfound', '.chapters'];
$search = ['_Low', '_SD', '_HD', '_thumbsV2', '_thumbsSmallV2', '_thumbsSprit', '_roku', '_portrait', '_portrait_thumbsV2', '_portrait_thumbsSmallV2', '_thumbsV2_jpg', '_spectrum', '_tvg', '.notfound', '.Chapters'];
if (!empty($global['langs_codes_values_withdot']) && is_array($global['langs_codes_values_withdot'])) {
$search = array_merge($search, $global['langs_codes_values_withdot']);

View file

@ -9,7 +9,7 @@ class Bookmark extends PluginAbstract
public function getDescription()
{
return "You can add bookmarks in a video or audio clip to highlight interest points or select chapters";
return "You can add bookmarks in a video or audio clip to highlight interest points or select Chapters";
}
public function getName()
@ -78,6 +78,57 @@ class Bookmark extends PluginAbstract
return $result;
}
static function generateChaptersHTML($videos_id)
{
$ChaptersData = BookmarkTable::getAllFromVideo($videos_id);
if (empty($ChaptersData)) {
return '';
}
$html = '<div class="Chapters">';
foreach ($ChaptersData as $index => $item) {
$time = secondsToTime($item["timeInSeconds"], '%02d');
$html .= '<a href="#" id="Chapter-' . $index . '" class="Chapter" data-timestamp="' . $time . '" onclick="playChapter(' . $item["timeInSeconds"] . ');return false;">'
. $time . '</a> '
. $item["name"] . '<br>';
}
$html .= '</div>';
return $html;
}
static function generateChaptersJSONLD($videos_id)
{
$ChaptersData = BookmarkTable::getAllFromVideo($videos_id);
$Chapters = [];
if (!empty($ChaptersData)) {
$video = new VIdeo('', '', $videos_id);
$durationInSeconds = $video->getDuration_in_seconds();
foreach ($ChaptersData as $index => $item) {
$startTime = secondsToTime($item["timeInSeconds"], '%02d');
// Calculate end time based on the next chapter's start time
$endTimeInSeconds = ($index < count($ChaptersData) - 1)
? $ChaptersData[$index + 1]["timeInSeconds"]
: $durationInSeconds;
$endTime = secondsToTime($endTimeInSeconds, '%02d');
$Chapter = [
"@type" => "VideoGameClip",
"name" => $item["name"],
"startTime" => "PT" . $startTime . "S",
"endTime" => "PT" . $endTime . "S"
];
$Chapters[] = $Chapter;
}
}
return $Chapters;
}
static function videoToVtt($videos_id)
{
$data = BookmarkTable::getAllFromVideo($videos_id);
@ -87,8 +138,8 @@ class Bookmark extends PluginAbstract
foreach ($data as $index => $item) {
$start_time = $item["timeInSeconds"];
// Assume each chapter is 5 seconds long if it's the last one,
// or calculate the time until the next chapter starts
// Assume each Chapter is 5 seconds long if it's the last one,
// or calculate the time until the next Chapter starts
$end_time = ($index == count($data) - 1) ? $start_time + 5 : $data[$index + 1]["timeInSeconds"] - 1;
$output .= secondsToTime($start_time) . " --> " . secondsToTime($end_time) . "\n";
@ -101,30 +152,32 @@ class Bookmark extends PluginAbstract
//var_dump($bytes, self::getChaptersFilename($videos_id), $output);exit;
}
static function getChaptersFilenameFromFilename($fileName, $lang='en') {
static function getChaptersFilenameFromFilename($fileName, $lang = 'en')
{
$video = Video::getVideoFromFileNameLight($fileName);
//var_dump($video);
return self::getChaptersFilename($video['id'], $lang);
}
static function getChaptersFilename($videos_id, $lang='en') {
static function getChaptersFilename($videos_id, $lang = 'en')
{
$video = new Video("", "", $videos_id);
$filename = $video->getFilename();
$path = Video::getPathToFile($filename);
if (empty($lang) || strtoupper($lang) == 'CC') {
$vttFilename = "{$path}.chapters.vtt";
$vttFilename = "{$path}.Chapters.vtt";
} else {
$vttFilename = "{$path}.chapters.{$lang}.vtt";
$vttFilename = "{$path}.Chapters.{$lang}.vtt";
}
return $vttFilename;
}
}
function getVTTCaptionTracks($fileName, $returnArray = false) {
function getVTTChapterTracks($fileName, $returnArray = false)
{
global $global;
$cache = getVTTCaptionCache($fileName);
$cache = getVTTChapterCache($fileName);
if (!empty($cache)) {
$objCache = _json_decode($cache);
} else {
@ -143,7 +196,7 @@ function getVTTCaptionTracks($fileName, $returnArray = false) {
$obj->label = 'Chapters';
$obj->desc = 'Chapters';
$tracks .= "<track kind=\"chapters\" src=\"{$obj->src}\" srclang=\"{$obj->srclang}\" label=\"{$obj->label}\" default>";
$tracks .= "<track kind=\"chapters\" src=\"{$obj->src}\" default>";
$sourcesArray[] = $obj;
}
@ -151,14 +204,15 @@ function getVTTCaptionTracks($fileName, $returnArray = false) {
$objCache = new stdClass();
$objCache->sourcesArray = $sourcesArray;
$objCache->tracks = $tracks;
createVTTCaptionCache($fileName, json_encode($objCache));
createVTTChapterCache($fileName, json_encode($objCache));
}
return $returnArray ? $objCache->sourcesArray : $objCache->tracks;
}
function getVTTCaptionCache($fileName) {
function getVTTChapterCache($fileName)
{
global $global;
$cacheDir = $global['systemRootPath'] . 'videos/cache/vttCaption/';
$cacheDir = $global['systemRootPath'] . 'videos/cache/vttChapter/';
$file = "{$cacheDir}{$fileName}.cache";
if (!file_exists($file)) {
return false;
@ -166,17 +220,19 @@ function getVTTCaptionCache($fileName) {
return file_get_contents($file);
}
function createVTTCaptionCache($fileName, $data) {
function createVTTChapterCache($fileName, $data)
{
global $global;
$cacheDir = $global['systemRootPath'] . 'videos/cache/vttCaption/';
$cacheDir = $global['systemRootPath'] . 'videos/cache/vttChapter/';
if (!file_exists($cacheDir)) {
mkdir($cacheDir, 0777, true);
}
file_put_contents("{$cacheDir}{$fileName}.cache", $data);
}
function deleteVTTCaptionCache($fileName) {
function deleteVTTChapterCache($fileName)
{
global $global;
$cacheDir = $global['systemRootPath'] . 'videos/cache/vttCaption/';
$cacheDir = $global['systemRootPath'] . 'videos/cache/vttChapter/';
@unlink("{$cacheDir}{$fileName}.cache");
}
}

View file

@ -55,7 +55,7 @@ class BookmarkTable extends ObjectYPT {
static function getAllFromVideo($videos_id) {
global $global;
$sql = "SELECT * FROM " . static::getTableName() . " WHERE videos_id = ? ";
$sql = "SELECT * FROM " . static::getTableName() . " WHERE videos_id = ? ORDER BY timeInSeconds ASC ";
//$sql .= self::getSqlFromPost();
$res = sqlDAL::readSql($sql,"i",array($videos_id));
$fullData = sqlDAL::fetchAllAssoc($res);

View file

@ -1,235 +1,236 @@
<?php
require_once '../../videos/configuration.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugin Audit"));
exit;
$videos_id = getVideos_id();
if (empty($videos_id)) {
forbiddenPage('videos_id is required');
}
require_once $global['systemRootPath'] . 'objects/video.php';
$_video = new Video('', '', $videos_id);
$defaultBookmarkTime = 3;
if (!$_video->userCanManageVideo()) {
forbiddenPage('You cannot manage this video');
}
$video = Video::getVideo($_GET['videos_id'], "", true);
$video = Video::getVideo($videos_id, "", true);
$poster = Video::getPathToFile("{$video['filename']}.jpg");
$_page = new Page(array('Edit Bookmark'));
$_page->setExtraStyles(
array(
'view/css/DataTables/datatables.min.css',
'node_modules/video.js/dist/video-js.min.css'
)
);
$_page->setExtraScripts(
array(
'node_modules/video.js/dist/video.min.js',
'view/js/videojs-persistvolume/videojs.persistvolume.js',
'view/js/BootstrapMenu.min.js',
'view/css/DataTables/datatables.min.js',
)
);
?>
<!DOCTYPE html>
<html lang="<?php echo getLanguage(); ?>">
<head>
<?php
echo getHTMLTitle( __("Bookmark Editor"));
?>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<link rel="stylesheet" type="text/css" href="<?php echo getCDN(); ?>view/css/DataTables/datatables.min.css"/>
<link href="<?php echo getURL('node_modules/video.js/dist/video-js.min.css'); ?>" rel="stylesheet" type="text/css"/>
<style>
</style>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container">
<?php
require_once $global['systemRootPath'] . 'view/include/video.php';
?>
<div class="panel panel-default">
<div class="panel-body">
<div class="container">
<?php
include $global['systemRootPath'] . 'view/include/video.php';
?>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-2">
<label for="currentTime"><?php echo __("Current Time"); ?>:</label>
<input class="form-control" type="text" id="currentTime">
</div>
<div class="col-sm-10">
<label for="subtitle"><?php echo __("Text"); ?>:</label>
<div class="input-group">
<input type="text" class="form-control" placeholder="<?php echo __("Text"); ?>" id="subtitle">
<span class="input-group-btn">
<button type="button" class="btn btn-default" id="addBookmarkButton"><?php echo __("Add"); ?></button>
</span>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-sm-12">
<div class="list-group" id="bookmarksList">
</div>
</div>
<div class="col-sm-2">
<label for="currentTime"><?php echo __("Current Time"); ?>:</label>
<input class="form-control" type="text" id="currentTime">
</div>
<div class="col-sm-10">
<label for="subtitle"><?php echo __("Text"); ?>:</label>
<div class="input-group">
<input type="text" class="form-control" placeholder="<?php echo __("Text"); ?>" id="subtitle">
<span class="input-group-btn">
<button type="button" class="btn btn-default" id="addBookmarkButton"><?php echo __("Add"); ?></button>
</span>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-sm-12">
<div class="list-group" id="bookmarksList">
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script src="<?php echo getURL('node_modules/video.js/dist/video.min.js'); ?>" type="text/javascript"></script>
<?php
$videoJSArray = array(
"view/js/videojs-persistvolume/videojs.persistvolume.js",
"view/js/BootstrapMenu.min.js");
$jsURL = combineFiles($videoJSArray, "js");
?>
<script src="<?php echo $jsURL; ?>" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo getURL('view/css/DataTables/datatables.min.js'); ?>"></script>
<script>
var bookmarksArray = [];
var allBookmarksArray = [];
var indexEditing = -1;
function secondsToTime(sec) {
var rest = parseInt((sec % 1) * 100);
var date = new Date(null);
date.setSeconds(sec); // specify value for SECONDS here
var timeString = date.toISOString().substr(11, 8);
return (timeString + '.' + rest);
}
</div>
function timeToSeconds(hms) {
var a = hms.split(':'); // split it at the colons
// minutes are worth 60 seconds. Hours are worth 60 minutes.
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
return (seconds);
}
</div>
function getTimeIndex(time) {
for (var i = 0; i < bookmarksArray.length; i++) {
if (bookmarksArray[i].start <= time && bookmarksArray[i].end >= time) {
return i;
}
<script>
var bookmarksArray = [];
var allBookmarksArray = [];
var indexEditing = -1;
function secondsToTime(sec) {
var rest = parseInt((sec % 1) * 100);
var date = new Date(null);
date.setSeconds(sec); // specify value for SECONDS here
var timeString = date.toISOString().substr(11, 8);
return (timeString + '.' + rest);
}
function timeToSeconds(hms) {
var a = hms.split(':'); // split it at the colons
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
return (seconds);
}
function getTimeIndex(time) {
for (var i = 0; i < bookmarksArray.length; i++) {
if (bookmarksArray[i].start <= time && bookmarksArray[i].end >= time) {
return i;
}
}
}
function setTime(time) {
$('#currentTime').val(secondsToTime(time));
}
function setPosition(time) {
player.pause();
player.currentTime(time);
setTime(time);
}
function addBookmark() {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Bookmark/page/bookmarkSave.json.php',
data: {
"videos_id": <?php echo $_GET['videos_id'] ?>,
"timeInSeconds": timeToSeconds($('#currentTime').val()),
"name": $('#subtitle').val()
},
type: 'post',
success: function(response) {
loadBookmark();
modal.hidePleaseWait();
}
});
}
function createList() {
$("#bookmarksList").empty();
bookmarksArray.sort(function(a, b) {
return b.timeInSeconds - a.timeInSeconds;
});
for (i = bookmarksArray.length; i > 0; i--) {
var index = i - 1;
$("#bookmarksList").append('<div class="list-group-item list-group-item-action subtitleItem" bookmarkId="' + bookmarksArray[index].id + '" index="' + index + '" id="subtitleItem' + index + '">' +
'<small class=\'text-muted\'>' + secondsToTime(bookmarksArray[index].timeInSeconds) + "</small> - " + bookmarksArray[i - 1].name +
'<button class=\'btn btn-danger pull-right deleteBookmark btn-sm btn-xs\'><i class=\'fa fa-trash\'></i></button>' +
'<button class=\'btn btn-primary pull-right editBookmark btn-sm btn-xs\'><i class=\'fa fa-edit\'></i></button>' +
'</div>');
}
$('.editBookmark').click(function() {
var li = $(this).closest('div');
var index = $(li).attr('index');
$('.subtitleItem').removeClass('active');
$('#subtitleItem' + index).addClass('active');
setPosition(bookmarksArray[index].timeInSeconds);
$('#subtitle').val(bookmarksArray[index].name);
indexEditing = index;
return false;
});
$('.deleteBookmark').click(function() {
modal.showPleaseWait();
var li = $(this).closest('div');
var index = $(li).attr('index');
var id = $(li).attr('bookmarkId');
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Bookmark/page/bookmarkDelete.json.php',
data: {
"id": id
},
type: 'post',
success: function(response) {
loadBookmark();
modal.hidePleaseWait();
}
});
});
}
function loadBookmark() {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Bookmark/getBookmarks.json.php?videos_id=<?php echo $_GET['videos_id'] ?>',
success: function(response) {
allBookmarksArray = response;
bookmarksArray = (allBookmarksArray.rows);
createList();
modal.hidePleaseWait();
}
});
}
function setTime(time) {
$('#currentTime').val(secondsToTime(time));
}
$(document).ready(function() {
function setPosition(time) {
loadBookmark();
$('#addBookmarkButton').click(function() {
addBookmark();
});
$('#currentTime').change(function() {
setPosition(timeToSeconds($('#currentTime').val()));
});
$('#subtitle').keydown(function(e) {
if (e.keyCode == 13) {
addBookmark();
} else if ($('#subtitle').val() != '') {
player.pause();
player.currentTime(time);
setTime(time);
} else {
playerPlay(0);
}
});
function addBookmark() {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Bookmark/page/bookmarkSave.json.php',
data: {"videos_id": <?php echo $_GET['videos_id'] ?>, "timeInSeconds": timeToSeconds($('#currentTime').val()), "name": $('#subtitle').val()},
type: 'post',
success: function (response) {
loadBookmark();
modal.hidePleaseWait();
}
});
}
if (typeof player === 'undefined' && $('#mainVideo').length) {
player = videojs('mainVideo'
<?php echo PlayerSkins::getDataSetup(); ?>);
}
player.on('timeupdate', function() {
setTime(this.currentTime());
});
function createList() {
$("#bookmarksList").empty();
bookmarksArray.sort(function (a, b) {
return b.timeInSeconds - a.timeInSeconds;
});
for (i = bookmarksArray.length; i > 0; i--) {
var index = i - 1;
$("#bookmarksList").append('<div class="list-group-item list-group-item-action subtitleItem" bookmarkId="' + bookmarksArray[index].id + '" index="' + index + '" id="subtitleItem' + index + '">' +
'<small class=\'text-muted\'>' + secondsToTime(bookmarksArray[index].timeInSeconds) + "</small> - " + bookmarksArray[i - 1].name +
'<button class=\'btn btn-danger pull-right deleteBookmark btn-sm btn-xs\'><i class=\'fa fa-trash\'></i></button>' +
'<button class=\'btn btn-primary pull-right editBookmark btn-sm btn-xs\'><i class=\'fa fa-edit\'></i></button>' +
'</div>');
}
$('.editBookmark').click(function () {
var li = $(this).closest('div');
var index = $(li).attr('index');
$('.subtitleItem').removeClass('active');
$('#subtitleItem' + index).addClass('active');
setPosition(bookmarksArray[index].timeInSeconds);
setInterval(function() {
if (!player.paused()) {
var index = getTimeIndex(player.currentTime());
$('.subtitleItem').removeClass('active');
$('#subtitleItem' + index).addClass('active');
if (typeof bookmarksArray[index] !== 'undefined') {
$('#subtitle').val(bookmarksArray[index].name);
indexEditing = index;
return false;
});
$('.deleteBookmark').click(function () {
modal.showPleaseWait();
var li = $(this).closest('div');
var index = $(li).attr('index');
var id = $(li).attr('bookmarkId');
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Bookmark/page/bookmarkDelete.json.php',
data: {"id": id},
type: 'post',
success: function (response) {
loadBookmark();
modal.hidePleaseWait();
}
});
});
}
}
}, 500);
});
</script>
function loadBookmark() {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Bookmark/getBookmarks.json.php?videos_id=<?php echo $_GET['videos_id'] ?>',
success: function (response) {
allBookmarksArray = response;
bookmarksArray = (allBookmarksArray.rows);
createList();
modal.hidePleaseWait();
}
});
}
$(document).ready(function () {
loadBookmark();
$('#addBookmarkButton').click(function () {
addBookmark();
});
$('#currentTime').change(function () {
setPosition(timeToSeconds($('#currentTime').val()));
});
$('#subtitle').keydown(function (e) {
if (e.keyCode == 13) {
addBookmark();
} else if ($('#subtitle').val() != '') {
player.pause();
} else {
playerPlay(0);
}
});
if (typeof player === 'undefined' && $('#mainVideo').length) {
player = videojs('mainVideo'<?php echo PlayerSkins::getDataSetup(); ?>);
}
player.on('timeupdate', function () {
setTime(this.currentTime());
});
setInterval(function () {
if (!player.paused()) {
var index = getTimeIndex(player.currentTime());
$('.subtitleItem').removeClass('active');
$('#subtitleItem' + index).addClass('active');
if (typeof bookmarksArray[index] !== 'undefined') {
$('#subtitle').val(bookmarksArray[index].name);
}
}
}, 500);
});
</script>
</body>
</html>
<?php
$_page->print();
?>

View file

@ -4002,4 +4002,13 @@ function __(str, allowHTML = false) {
// Escape certain characters for security
return returnStr.replace(/'/g, "&apos;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
function playChapter(seconds){
if(typeof player != 'undefined'){
player.currentTime(seconds);
var currentURL = window.location.href;
newURL = addQueryStringParameter(currentURL, 't', seconds);
history.replaceState({}, "", newURL);
}
}

View file

@ -3,9 +3,9 @@ if (empty($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/subscribe.php';
if ((empty($video) || !is_array($video) ) && !empty($_GET['videos_id'])) {
if ((empty($video) || !is_array($video)) && !empty($_GET['videos_id'])) {
$video = Video::getVideo(intval($_GET['videos_id']), "viewable", true, false, true, true);
$created = !empty($video['videoCreation'])?$video['videoCreation']:$video['created'];
$created = !empty($video['videoCreation']) ? $video['videoCreation'] : $video['created'];
$video['creator'] = Video::getCreatorHTML($video['users_id'], '<div class="clearfix"></div><small>' . humanTiming(_strtotime($created)) . '</small>');
$source = Video::getSourceFile($video['filename']);
if (($video['type'] !== "audio") && ($video['type'] !== "linkAudio") && !empty($source['url'])) {
@ -57,9 +57,9 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
?>
<?php
if (!empty($video['id']) && Video::showYoutubeModeOptions() && Video::canEdit($video['id'])) {
?>
?>
<div class="btn-group pull-right" role="group" aria-label="Botttom Buttons">
<button type="button" class="btn btn-primary btn-xs" onclick="avideoModalIframe(webSiteRootURL + 'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $video['id']; ?>');return false;" data-toggle="tooltip" title="<?php echo __("Edit Video"); ?>">
<button type="button" class="btn btn-primary btn-xs" onclick="avideoModalIframe(webSiteRootURL + 'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $video['id']; ?>');return false;" data-toggle="tooltip" title="<?php echo __("Edit Video"); ?>">
<i class="fa fa-edit"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Edit Video"); ?></span>
</button>
<button type="button" class="btn btn-default btn-xs" onclick="avideoModalIframeFull(webSiteRootURL + 'view/videoViewsInfo.php?videos_id=<?php echo $video['id']; ?>');
@ -70,13 +70,13 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
echo Layout::getSuggestedButton($video['id']);
?>
</div>
<?php
<?php
}
?>
</div>
<div class="panel-body">
<div class="row divMainVideo">
<div class="col-xs-4 col-sm-4 col-md-4">
<div class="col-sm-4 col-md-4 hidden-xs">
<?php
echo Video::getVideoImagewithHoverAnimationFromVideosId($video, true, false);
?>
@ -87,14 +87,14 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
?>
<!-- modeYouTubeBottom end plugins tags -->
</div>
<div class="col-xs-8 col-sm-8 col-md-8">
<div class="col-xs-12 col-sm-8 col-md-8">
<?php echo $video['creator']; ?>
<?php
if (Video::showYoutubeModeOptions() && empty($advancedCustom->doNotDisplayViews)) {
?>
?>
<span class="watch-view-count pull-right text-muted" itemprop="interactionCount"><span class="view-count<?php echo $video['id']; ?>"><?php echo number_format_short($video['views_count']); ?></span> <?php echo __("Views"); ?></span>
<?php
<?php
}
?>
<?php
@ -109,7 +109,7 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
<?php
if (Video::showYoutubeModeOptions()) {
?>
?>
<div class="row">
<div class="col-md-12 text-muted">
<?php if (empty($advancedCustom->disableShareAndPlaylist)) { ?>
@ -126,8 +126,7 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
if ($video['type'] == "zip") {
$files = getVideosURLZIP($video['filename']);
} else if ($video['type'] == "pdf") {
$files = getVideosURLPDF($video['filename']);
;
$files = getVideosURLPDF($video['filename']);;
} else if ($canDownloadFiles) {
$files = getVideosURL($video['filename']);
}
@ -180,12 +179,12 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
}
if (!empty($filesToDownload)) {
?>
?>
<a href="#" class="btn btn-default no-outline" id="downloadBtn">
<span class="fa fa-download"></span>
<span class="hidden-sm hidden-xs"><?php echo __("Download"); ?></span>
</a>
<?php
<?php
} else {
echo '<!-- files to download are empty -->';
}
@ -193,7 +192,7 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
echo '<!-- CustomizeUser::canDownloadVideosFromVideo said NO -->';
}
?>
<?php
<?php
}
$_v = $video;
echo AVideoPlugin::getWatchActionButton($video['id']);
@ -201,8 +200,8 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
?>
<?php
if (!empty($video['id']) && empty($advancedCustom->removeThumbsUpAndDown)) {
?>
<a href="#" class="faa-parent animated-hover btn btn-default no-outline pull-right <?php echo (@$video['myVote'] == - 1) ? "myVote" : "" ?>" id="dislikeBtn" <?php if (!User::isLogged()) { ?> data-toggle="tooltip" title="<?php echo __("Don´t like this video? Sign in to make your opinion count."); ?>" <?php } ?>>
?>
<a href="#" class="faa-parent animated-hover btn btn-default no-outline pull-right <?php echo (@$video['myVote'] == -1) ? "myVote" : "" ?>" id="dislikeBtn" <?php if (!User::isLogged()) { ?> data-toggle="tooltip" title="<?php echo __("Don´t like this video? Sign in to make your opinion count."); ?>" <?php } ?>>
<span class="fa fa-thumbs-down faa-bounce faa-reverse "></span> <small><?php echo $video['dislikes']; ?></small>
</a>
<a href="#" class="faa-parent animated-hover btn btn-default no-outline pull-right <?php echo (@$video['myVote'] == 1) ? "myVote" : "" ?>" id="likeBtn" <?php if (!User::isLogged()) { ?> data-toggle="tooltip" title="<?php echo __("Like this video? Sign in to make your opinion count."); ?>" <?php } ?>>
@ -210,14 +209,16 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
<small><?php echo $video['likes']; ?></small>
</a>
<script>
$(document).ready(function () {
<?php if (User::isLogged()) { ?>
$("#dislikeBtn, #likeBtn").click(function () {
$(document).ready(function() {
<?php if (User::isLogged()) { ?>
$("#dislikeBtn, #likeBtn").click(function() {
$.ajax({
url: webSiteRootURL + ($(this).attr("id") == "dislikeBtn" ? "dislike" : "like"),
method: 'POST',
data: {'videos_id': <?php echo $video['id']; ?>},
success: function (response) {
data: {
'videos_id': <?php echo $video['id']; ?>
},
success: function(response) {
$("#likeBtn, #dislikeBtn").removeClass("myVote");
if (response.myVote == 1) {
$("#likeBtn").addClass("myVote");
@ -230,12 +231,12 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
});
return false;
});
<?php } else { ?>
$("#dislikeBtn, #likeBtn").click(function () {
<?php } else { ?>
$("#dislikeBtn, #likeBtn").click(function() {
$(this).tooltip("show");
return false;
});
<?php } ?>
<?php } ?>
});
</script>
@ -243,7 +244,7 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
?>
</div>
</div>
<?php
<?php
}
?>
</div>
@ -259,18 +260,17 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
continue;
}
if (preg_match('/\.json/i', $theLink['url'])) {
?>
<button type="button" onclick="downloadURLOrAlertError('<?php echo $theLink['url']; ?>', {}, '<?php echo $video['clean_title']; ?>.<?php echo strtolower($theLink['name']); ?>', '<?php echo $theLink['progress']; ?>');"
class="btn btn-default" target="_blank">
?>
<button type="button" onclick="downloadURLOrAlertError('<?php echo $theLink['url']; ?>', {}, '<?php echo $video['clean_title']; ?>.<?php echo strtolower($theLink['name']); ?>', '<?php echo $theLink['progress']; ?>');" class="btn btn-default" target="_blank">
<i class="fas fa-download"></i> <?php echo $theLink['name']; ?>
</button>
<?php
<?php
} else {
?>
?>
<a href="<?php echo $theLink['url']; ?>" class="list-group-item list-group-item-action" target="_blank">
<i class="fas fa-download"></i> <?php echo $theLink['name']; ?>
</a>
<?php
<?php
}
}
?>
@ -278,16 +278,16 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
</div>
</div>
<script>
$(document).ready(function () {
$(document).ready(function() {
$("#downloadDiv").slideUp();
$("#downloadBtn").click(function () {
$("#downloadBtn").click(function() {
$(".menusDiv").not("#downloadDiv").slideUp();
$("#downloadDiv").slideToggle();
return false;
});
});
</script>
<?php
<?php
}
if ($video['type'] !== 'notfound' && CustomizeUser::canShareVideosFromVideo($video['id'])) {
@ -302,92 +302,105 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
</div>
<div class="panel-body" id="modeYoutubeBottomContentDetails">
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-12">
<div class="col-xs-4 col-sm-2 col-lg-2 text-right"><strong><?php echo __("Category"); ?>:</strong></div>
<div class="col-xs-8 col-sm-10 col-lg-10"><a class="btn btn-xs btn-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo @$video['clean_category']; ?>"><span class="<?php echo @$video['iconClass']; ?>"></span> <?php echo @$video['category']; ?></a></div>
<div class="col-xs-4 col-sm-2 col-lg-2 text-right"><strong><?php echo __("Category"); ?>:</strong></div>
<div class="col-xs-8 col-sm-10 col-lg-10"><a class="btn btn-xs btn-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo @$video['clean_category']; ?>"><span class="<?php echo @$video['iconClass']; ?>"></span> <?php echo @$video['category']; ?></a></div>
<?php
if (!empty($video['rrating'])) {
?>
<?php
if (!empty($video['rrating'])) {
?>
<div class="col-xs-4 col-sm-2 col-lg-2 text-right"><strong><?php echo __("Rating"); ?>:</strong></div>
<div class="col-xs-8 col-sm-10 col-lg-10">
<img src="<?php echo getURL('view/rrating/rating-' . $video['rrating'] . '.png'); ?>"
class="img img-responsive zoom"
style="width:30px;"/>
</div>
<div class="col-xs-4 col-sm-2 col-lg-2 text-right"><strong><?php echo __("Rating"); ?>:</strong></div>
<div class="col-xs-8 col-sm-10 col-lg-10">
<img src="<?php echo getURL('view/rrating/rating-' . $video['rrating'] . '.png'); ?>" class="img img-responsive zoom" style="width:30px;" />
</div>
<?php
}
?>
<?php
if (!empty($advancedCustom->showVideoDownloadedLink) && isValidURL($video['videoDownloadedLink'])) {
$parse = parse_url($video['videoDownloadedLink']);
$domain = str_replace('www.', '', $parse['host']);
?>
<div class="col-xs-4 col-sm-2 col-lg-2 text-right"><strong><?php echo __("Source"); ?>:</strong></div>
<div class="col-xs-8 col-sm-10 col-lg-10 descriptionArea" itemprop="source">
<a class="btn btn-xs btn-default" href="<?php echo $video['videoDownloadedLink']; ?>" target="_blank" rel="nofollow">
<i class="fas fa-external-link-alt"></i>
<?php
echo $domain;
?>
</a>
</div>
<?php
}
if ($video['type'] !== 'notfound' && $video['type'] !== 'article' && !isHTMLEmpty($video['description'])) {
?>
<div class="col-xs-4 col-sm-2 col-lg-2 text-right"><strong><?php echo __("Description"); ?>:</strong></div>
<div class="col-xs-8 col-sm-10 col-lg-10 descriptionArea" itemprop="description">
<?php
}
?>
<?php
if (!empty($advancedCustom->showVideoDownloadedLink) && isValidURL($video['videoDownloadedLink'])) {
$parse = parse_url($video['videoDownloadedLink']);
$domain = str_replace('www.', '', $parse['host']);
?>
<div class="col-xs-4 col-sm-2 col-lg-2 text-right"><strong><?php echo __("Source"); ?>:</strong></div>
<div class="col-xs-8 col-sm-10 col-lg-10 descriptionArea" itemprop="source">
<a class="btn btn-xs btn-default" href="<?php echo $video['videoDownloadedLink']; ?>" target="_blank" rel="nofollow">
<i class="fas fa-external-link-alt"></i>
<?php
if (empty($advancedCustom->disableShowMOreLessDescription)) {
?>
<div class="descriptionAreaPreContent">
<div class="descriptionAreaContent">
<?php echo Video::htmlDescription($video['description']); ?>
</div>
</div>
<button onclick="$(this).closest('.descriptionArea').toggleClass('expanded');" class="btn btn-xs btn-default descriptionAreaShowMoreBtn" style="display: none; ">
<span class="showMore"><i class="fas fa-caret-down"></i> <?php echo __("Show More"); ?></span>
<span class="showLess"><i class="fas fa-caret-up"></i> <?php echo __("Show Less"); ?></span>
</button>
<?php
} else {
echo Video::htmlDescription($video['description']);
}
echo $domain;
?>
</a>
</div>
<?php
}
if (AVideoPlugin::isEnabledByName('Bookmark')) {
$Chapters = Bookmark::generateChaptersHTML($video['id']);
if (!empty($Chapters)) {
?>
<div class="col-xs-4 col-sm-2 col-lg-2 text-right">
<strong>
<?php echo __("Chapters"); ?>:
</strong>
</div>
<div class="col-xs-8 col-sm-10 col-lg-10">
<?php
echo $Chapters;
?>
</div>
<?php
<?php
}
}
if ($video['type'] !== 'notfound' && $video['type'] !== 'article' && !isHTMLEmpty($video['description'])) {
?>
</div>
<div class="col-xs-4 col-sm-2 col-lg-2 text-right"><strong><?php echo __("Description"); ?>:</strong></div>
<div class="col-xs-8 col-sm-10 col-lg-10 descriptionArea" itemprop="description">
<?php
if (empty($advancedCustom->disableShowMOreLessDescription)) {
?>
<div class="descriptionAreaPreContent">
<div class="descriptionAreaContent">
<?php echo Video::htmlDescription($video['description']); ?>
</div>
</div>
<button onclick="$(this).closest('.descriptionArea').toggleClass('expanded');" class="btn btn-xs btn-default descriptionAreaShowMoreBtn" style="display: none; ">
<span class="showMore"><i class="fas fa-caret-down"></i> <?php echo __("Show More"); ?></span>
<span class="showLess"><i class="fas fa-caret-up"></i> <?php echo __("Show Less"); ?></span>
</button>
<?php
} else {
echo Video::htmlDescription($video['description']);
}
?>
</div>
<?php
}
?>
</div>
</div>
<?php
if (!empty($video['id']) && empty($advancedCustom->disableComments) && Video::showYoutubeModeOptions()) {
?>
?>
<div class="panel-footer" id="modeYoutubeBottomContentDetails">
<?php include $global['systemRootPath'] . 'view/videoComments.php'; ?>
</div>
<?php
<?php
}
?>
</div>
<script>
$(document).ready(function () {
<?php
if (empty($advancedCustom->showShareMenuOpenByDefault)) {
?>
$(document).ready(function() {
<?php
if (empty($advancedCustom->showShareMenuOpenByDefault)) {
?>
$("#shareDiv").slideUp();
<?php
}
?>
$("#shareBtn").click(function () {
<?php
}
?>
$("#shareBtn").click(function() {
$(".menusDiv").not("#shareDiv").slideUp();
$("#shareDiv").slideToggle();
return false;
});
});
</script>
</script>