1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00

Update Image path

This commit is contained in:
Daniel Neto 2023-08-30 09:13:11 -03:00
parent 802387e4f1
commit 3135acb4a9
114 changed files with 704 additions and 329 deletions

View file

@ -50,7 +50,7 @@ if (($video['type'] !== "audio") && ($video['type'] !== "linkAudio") && !empty($
$imgw = $data[0]; $imgw = $data[0];
$imgh = $data[1]; $imgh = $data[1];
} elseif ($video['type'] == "audio") { } elseif ($video['type'] == "audio") {
$img = getCDN()."view/img/audio_wave.jpg"; $img = ImagesPlaceHolders::getAudioLandscape(ImagesPlaceHolders::$RETURN_URL);
} }
$type = 'video'; $type = 'video';
if ($video['type'] === 'pdf') { if ($video['type'] === 'pdf') {

View file

@ -1212,52 +1212,6 @@ function cacheExpirationTime()
return intval($cacheExpirationTime); return intval($cacheExpirationTime);
} }
function _getImagesURL($fileName, $type)
{
global $global;
$files = [];
$source = Video::getSourceFile($fileName, ".jpg");
$file1 = $source['path'];
if (file_exists($file1)) {
$files["jpg"] = [
'filename' => "{$fileName}.jpg",
'path' => $file1,
'url' => $source['url'],
'type' => 'image',
];
} else {
unset($file1);
$files["jpg"] = [
'filename' => "{$type}.png",
'path' => getURL("view/img/{$type}.png"),
'url' => getURL("view/img/{$type}.png"),
'type' => 'image',
];
}
$source = Video::getSourceFile($fileName, "_portrait.jpg");
$file2 = $source['path'];
if (file_exists($file2)) {
$files["pjpg"] = [
'filename' => "{$fileName}_portrait.jpg",
'path' => $file2,
'url' => $source['url'],
'type' => 'image',
];
} elseif ($type !== 'image') {
if (!empty($file1)) {
$files["pjpg"] = $files["jpg"];
} else {
$files["pjpg"] = [
'filename' => "{$type}_portrait.png",
'path' => getURL("view/img/{$type}_portrait.png"),
'url' => getURL("view/img/{$type}_portrait.png"),
'type' => 'image',
];
}
}
return $files;
}
function getVideosURLPDF($fileName) function getVideosURLPDF($fileName)
{ {
global $global; global $global;
@ -1277,7 +1231,7 @@ function getVideosURLPDF($fileName)
'url' => $source['url'], 'url' => $source['url'],
'type' => 'pdf', 'type' => 'pdf',
]; ];
$files = array_merge($files, _getImagesURL($fileName, 'pdf')); $files = array_merge($files, array('jpg'=>ImagesPlaceHolders::getPdfLandscape(ImagesPlaceHolders::$RETURN_ARRAY)));
$time = microtime(); $time = microtime();
$time = explode(' ', $time); $time = explode(' ', $time);
$time = $time[1] + $time[0]; $time = $time[1] + $time[0];
@ -1314,7 +1268,7 @@ function getVideosURLIMAGE($fileName)
} }
} }
$files = array_merge($files, _getImagesURL($fileName, 'image')); $files = array_merge($files, array('jpg'=>ImagesPlaceHolders::getImageLandscape(ImagesPlaceHolders::$RETURN_ARRAY)));
$time = microtime(); $time = microtime();
$time = explode(' ', $time); $time = explode(' ', $time);
$time = $time[1] + $time[0]; $time = $time[1] + $time[0];
@ -1351,7 +1305,7 @@ function getVideosURLZIP($fileName)
} }
} }
$files = array_merge($files, _getImagesURL($fileName, 'zip')); $files = array_merge($files, array('jpg'=>ImagesPlaceHolders::getZipLandscape(ImagesPlaceHolders::$RETURN_ARRAY)));
$time = microtime(); $time = microtime();
$time = explode(' ', $time); $time = explode(' ', $time);
$time = $time[1] + $time[0]; $time = $time[1] + $time[0];
@ -1371,8 +1325,7 @@ function getVideosURLArticle($fileName)
$time = explode(' ', $time); $time = explode(' ', $time);
$time = $time[1] + $time[0]; $time = $time[1] + $time[0];
$start = $time; $start = $time;
//$files = array_merge($files, _getImagesURL($fileName, 'article')); $files = array('jpg'=>ImagesPlaceHolders::getArticlesLandscape(ImagesPlaceHolders::$RETURN_ARRAY));
$files = _getImagesURL($fileName, 'article');
$time = microtime(); $time = microtime();
$time = explode(' ', $time); $time = explode(' ', $time);
$time = $time[1] + $time[0]; $time = $time[1] + $time[0];
@ -1426,7 +1379,7 @@ function getVideosURLAudio($fileName, $fileNameisThePath = false)
]; ];
} }
$files = array_merge($files, _getImagesURL($fileName, 'audio_wave')); $files = array_merge($files, array('jpg'=>ImagesPlaceHolders::getAudioLandscape(ImagesPlaceHolders::$RETURN_ARRAY)));
$time = microtime(); $time = microtime();
$time = explode(' ', $time); $time = explode(' ', $time);
$time = $time[1] + $time[0]; $time = $time[1] + $time[0];
@ -1713,10 +1666,14 @@ function getVideosURL_V2($fileName, $recreateCache = false, $checkFiles = true)
ObjectYPT::setCacheGlobal($cacheName, $files); ObjectYPT::setCacheGlobal($cacheName, $files);
} }
/* /*
if(empty($recreateCache) && $fileName == "video_230813150408_va39e"){ if(empty($recreateCache) && $fileName == "v_230810144748_v424f"){
var_dump($fileName, $files, debug_backtrace());exit; var_dump($fileName, $files, debug_backtrace());exit;
} }
*/ */
if (empty($files) || empty($files['jpg'])) {
// sort by resolution
$files = array('jpg'=>ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_ARRAY));
}else
if (is_array($files)) { if (is_array($files)) {
// sort by resolution // sort by resolution
uasort($files, "sortVideosURL"); uasort($files, "sortVideosURL");
@ -1790,9 +1747,9 @@ function getResolutionFromFilename($filename)
function getSources($fileName, $returnArray = false, $try = 0) function getSources($fileName, $returnArray = false, $try = 0)
{ {
if ($returnArray) { if ($returnArray) {
$videoSources = $audioTracks = $subtitleTracks = []; $videoSources = $audioTracks = $subtitleTracks = $captionsTracks = [];
} else { } else {
$videoSources = $audioTracks = $subtitleTracks = ''; $videoSources = $audioTracks = $subtitleTracks = $captionsTracks = '';
} }
$video = Video::getVideoFromFileNameLight($fileName); $video = Video::getVideoFromFileNameLight($fileName);
@ -1821,10 +1778,14 @@ function getSources($fileName, $returnArray = false, $try = 0)
if (function_exists('getVTTTracks')) { if (function_exists('getVTTTracks')) {
$subtitleTracks = getVTTTracks($fileName, $returnArray); $subtitleTracks = getVTTTracks($fileName, $returnArray);
} }
if (function_exists('getVTTCaptionTracks')) {
$captionsTracks = getVTTCaptionTracks($fileName, $returnArray);
}
//var_dump($subtitleTracks, $captionsTracks);exit;
if ($returnArray) { if ($returnArray) {
$return = array_merge($videoSources, $audioTracks, $subtitleTracks); $return = array_merge($videoSources, $audioTracks, $subtitleTracks, $captionsTracks);
} else { } else {
$return = $videoSources . $audioTracks . $subtitleTracks; $return = $videoSources . $audioTracks . $subtitleTracks.$captionsTracks;
} }
$obj = new stdClass(); $obj = new stdClass();
@ -2955,6 +2916,10 @@ function getImageTagIfExists($relativePath, $title = '', $id = '', $style = '',
$file = createWebPIfNotExists($file); $file = createWebPIfNotExists($file);
} }
$url = getURL(getRelativePath($file)); $url = getURL(getRelativePath($file));
//var_dump($relativePath, $file, $url);exit;
if(ImagesPlaceHolders::isDefaultImage($url)){
$class .= ' ImagesPlaceHoldersDefaultImage';
}
if (file_exists($file)) { if (file_exists($file)) {
$image_info = @getimagesize($file); $image_info = @getimagesize($file);
if (!empty($image_info)) { if (!empty($image_info)) {
@ -2975,7 +2940,7 @@ function getImageTagIfExists($relativePath, $title = '', $id = '', $style = '',
if (is_string($lazyLoad)) { if (is_string($lazyLoad)) {
$loading = getURL($lazyLoad); $loading = getURL($lazyLoad);
} else { } else {
$loading = getURL('view/img/loading-gif.png'); $loading = ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL);
} }
$img .= " src=\"{$loading}\" data-src=\"{$url}\" "; $img .= " src=\"{$loading}\" data-src=\"{$url}\" ";
} else { } else {
@ -4041,7 +4006,7 @@ function siteMap()
TimeLogEnd("siteMap Video::getLink $videos_id", __LINE__, 0.5); TimeLogEnd("siteMap Video::getLink $videos_id", __LINE__, 0.5);
$title = strip_tags($video['title']); $title = strip_tags($video['title']);
TimeLogStart("siteMap Video::getLinkToVideo $videos_id"); TimeLogStart("siteMap Video::getLinkToVideo $videos_id");
$player_loc = Video::getLinkToVideo($video['id'], $video['clean_title'], true); $player_loc = Video::getLinkToVideo($video['id'], $video['clean_title'], true, 'permlink');
TimeLogEnd("siteMap Video::getLinkToVideo $videos_id", __LINE__, 0.5); TimeLogEnd("siteMap Video::getLinkToVideo $videos_id", __LINE__, 0.5);
TimeLogStart("siteMap Video::isPublic $videos_id"); TimeLogStart("siteMap Video::isPublic $videos_id");
$requires_subscription = Video::isPublic($video['id']) ? "no" : "yes"; $requires_subscription = Video::isPublic($video['id']) ? "no" : "yes";
@ -10460,6 +10425,9 @@ function getIncludeFileContent($filePath, $varsArray = [], $setCacheName = false
$return = ''; $return = '';
if (!empty($setCacheName)) { if (!empty($setCacheName)) {
$name = $filePath . '_' . User::getId() . '_' . getLanguage(); $name = $filePath . '_' . User::getId() . '_' . getLanguage();
if(is_string($setCacheName)){
$name .= $setCacheName;
}
//var_dump($name);exit; //var_dump($name);exit;
$return = ObjectYPT::getSessionCache($name, 0); $return = ObjectYPT::getSessionCache($name, 0);
} }
@ -11636,20 +11604,6 @@ function isImageNotFound($imgURL){
if(empty($imgURL)){ if(empty($imgURL)){
return true; return true;
} }
if(preg_match('/notfound/i', $imgURL)){
return true;
}
if(preg_match('/pdf_portrait/i', $imgURL)){
return true;
}
if(preg_match('/article_portrait/i', $imgURL)){
return true;
}
/*
if(preg_match('/audio_wave/i', $imgURL)){
return true;
}
*/
return false; return ImagesPlaceHolders::isDefaultImage($imgURL);
} }

182
objects/images.php Normal file
View file

@ -0,0 +1,182 @@
<?php
Class ImagesPlaceHolders {
public static $RETURN_RELATIVE = 0;
public static $RETURN_PATH = 1;
public static $RETURN_URL = 2;
public static $RETURN_ARRAY = 3;
private static $placeholders = [
'imageIcon' => 'view/img/placeholders/image.png',
'imageLandscape' => 'view/img/placeholders/imageLandscape.png',
'imagePortrait' => 'view/img/placeholders/imagePortrait.png',
'imageNotFoundIcon' => 'view/img/placeholders/imageNotFound.png',
'imageNotFoundLandscape' => 'view/img/placeholders/imageNotFoundLandscape.png',
'imageNotFoundPortrait' => 'view/img/placeholders/imageNotFoundPortrait.png',
'articlesIcon' => 'view/img/placeholders/articles.png',
'articlesLandscape' => 'view/img/placeholders/articlesLandscape.png',
'articlesPortrait' => 'view/img/placeholders/articlesPortrait.png',
'audioIcon' => 'view/img/placeholders/audio.png',
'audioLandscape' => 'view/img/placeholders/audioLandscape.png',
'audioPortrait' => 'view/img/placeholders/audioPortrait.png',
'pdfIcon' => 'view/img/placeholders/pdf.png',
'pdfLandscape' => 'view/img/placeholders/pdfLandscape.png',
'pdfPortrait' => 'view/img/placeholders/pdfPortrait.png',
'userIcon' => 'view/img/placeholders/user.png',
'userLandscape' => 'view/img/placeholders/userLandscape.png',
'userPortrait' => 'view/img/placeholders/userPortrait.png',
'zipIcon' => 'view/img/placeholders/zip.png',
'zipLandscape' => 'view/img/placeholders/zipLandscape.png',
'zipPortrait' => 'view/img/placeholders/zipPortrait.png',
'videoPlaceholder' => 'view/img/video-placeholder-gray.png',
'videoPlaceholderPortrait' => 'view/img/video-placeholder-gray-portrait.png',
'videoNotFoundPoster' => 'view/img/this-video-is-not-available.jpg'
];
static private function getComponent($type, $return = 0) {
global $global;
if (!isset(self::$placeholders[$type])) {
return null; // handle invalid type
}
$relativePath = self::$placeholders[$type];
if (!empty($global[$type])) {
$relativePath = $global[$type];
}
if ($return === ImagesPlaceHolders::$RETURN_URL) {
return getURL($relativePath);
}
if ($return === ImagesPlaceHolders::$RETURN_PATH) {
return $global['systemRootPath'] . $relativePath;
}
if ($return === ImagesPlaceHolders::$RETURN_ARRAY) {
$extension = pathinfo($relativePath, PATHINFO_EXTENSION);
return [
'filename' =>basename($relativePath),
'path' => $global['systemRootPath'] . $relativePath,
'url' => getURL($relativePath),
'url_noCDN' => $global['webSiteRootURL'] . $relativePath,
'type' => 'image',
'format' => $extension,
];
}
return $relativePath;
}
static function isDefaultImage($path) {
global $global;
foreach (self::$placeholders as $key => $defaultImagePath) {
$defaultImage = self::getComponent($key);
if (strpos($defaultImage, $path) !== false) {
return true;
}
$basename = basename($path);
if (strpos($defaultImage, $basename) !== false) {
return true;
}
$fullPath = $global['systemRootPath'] . $defaultImage;
$urlPath = getURL($defaultImage);
if ($path === $defaultImage || $path === $fullPath || $path === $urlPath) {
return true;
}
}
return false;
}
static function getImageIcon($return = 0) {
return self::getComponent('imageIcon', $return);
}
static function getImageLandscape($return = 0) {
return self::getComponent('imageLandscape', $return);
}
static function getImagePortrait($return = 0) {
return self::getComponent('imagePortrait', $return);
}
static function getImageNotFoundIcon($return = 0) {
return self::getComponent('imageNotFoundIcon', $return);
}
static function getImageNotFoundLandscape($return = 0) {
return self::getComponent('imageNotFoundLandscape', $return);
}
static function getImageNotFoundPortrait($return = 0) {
return self::getComponent('imageNotFoundPortrait', $return);
}
static function getArticlesIcon($return = 0) {
return self::getComponent('articlesIcon', $return);
}
static function getArticlesLandscape($return = 0) {
return self::getComponent('articlesLandscape', $return);
}
static function getArticlesPortrait($return = 0) {
return self::getComponent('articlesPortrait', $return);
}
static function getAudioIcon($return = 0) {
return self::getComponent('audioIcon', $return);
}
static function getAudioLandscape($return = 0) {
return self::getComponent('audioLandscape', $return);
}
static function getAudioPortrait($return = 0) {
return self::getComponent('audioPortrait', $return);
}
static function getPdfIcon($return = 0) {
return self::getComponent('pdfIcon', $return);
}
static function getPdfLandscape($return = 0) {
return self::getComponent('pdfLandscape', $return);
}
static function getPdfPortrait($return = 0) {
return self::getComponent('pdfPortrait', $return);
}
static function getUserIcon($return = 0) {
return self::getComponent('userIcon', $return);
}
static function getUserLandscape($return = 0) {
return self::getComponent('userLandscape', $return);
}
static function getUserPortrait($return = 0) {
return self::getComponent('userPortrait', $return);
}
static function getZipIcon($return = 0) {
return self::getComponent('zipIcon', $return);
}
static function getZipLandscape($return = 0) {
return self::getComponent('zipLandscape', $return);
}
static function getZipPortrait($return = 0) {
return self::getComponent('zipPortrait', $return);
}
static function getVideoPlaceholder($return = 0) {
return self::getComponent('videoPlaceholder', $return);
}
static function getVideoPlaceholderPortrait($return = 0) {
return self::getComponent('videoPlaceholderPortrait', $return);
}
static function getVideoNotFoundPoster($return = 0) {
return self::getComponent('videoNotFoundPoster', $return);
}
}

View file

@ -113,6 +113,7 @@ $global['webSiteRootURL'] = fixTestURL($global['webSiteRootURL']);
require_once $global['systemRootPath'] . 'objects/mysql_dal.php'; require_once $global['systemRootPath'] . 'objects/mysql_dal.php';
require_once $global['systemRootPath'] . 'objects/configuration.php'; require_once $global['systemRootPath'] . 'objects/configuration.php';
require_once $global['systemRootPath'] . 'objects/security.php'; require_once $global['systemRootPath'] . 'objects/security.php';
require_once $global['systemRootPath'] . 'objects/images.php';
includeConfigLog(__LINE__); includeConfigLog(__LINE__);
// for update config from old versions 2020-05-11 // for update config from old versions 2020-05-11

View file

@ -554,7 +554,7 @@ if (typeof gtag !== \"function\") {
} }
} }
if (empty($photo)) { if (empty($photo)) {
$photo = "view/img/userSilhouette.jpg"; $photo = ImagesPlaceHolders::getUserIcon();
} }
return $photo; return $photo;
} }
@ -580,7 +580,7 @@ if (typeof gtag !== \"function\") {
} }
} }
if (empty($photo)) { if (empty($photo)) {
$photo = "view/img/userSilhouette.jpg"; $photo = ImagesPlaceHolders::getUserIcon();
if (!$returnRelativePath) { if (!$returnRelativePath) {
$photo = getURL($photo); $photo = getURL($photo);
} }
@ -604,8 +604,8 @@ if (typeof gtag !== \"function\") {
{ {
global $global; global $global;
$photo = self::_getPhoto($users_id); $photo = self::_getPhoto($users_id);
if ($photo == "view/img/userSilhouette.jpg") { if ($photo == ImagesPlaceHolders::getUserIcon()) {
return getURL('view/img/userSilhouette.jpg'); return getURL($photo);
} }
if (empty($photo)) { if (empty($photo)) {
return false; return false;

View file

@ -4037,7 +4037,7 @@ if (!class_exists('Video')) {
//self::_moveSourceFilesToDir($filename); //self::_moveSourceFilesToDir($filename);
$paths = self::getPaths($filename); $paths = self::getPaths($filename);
if ($type == '_thumbsSmallV2.jpg' && empty($advancedCustom->usePreloadLowResolutionImages)) { if ($type == '_thumbsSmallV2.jpg' && empty($advancedCustom->usePreloadLowResolutionImages)) {
return ['path' => $global['systemRootPath'] . 'view/img/loading-gif.png', 'url' => getURL('view/img/loading-gif.png')]; return ['path' => ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_PATH), 'url' => ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL)];
} }
TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit); TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit);
@ -4458,7 +4458,7 @@ if (!class_exists('Video')) {
return $matches[1]; return $matches[1];
} }
$search = ['_Low', '_SD', '_HD', '_thumbsV2', '_thumbsSmallV2', '_thumbsSprit', '_roku', '_portrait', '_portrait_thumbsV2', '_portrait_thumbsSmallV2', '_thumbsV2_jpg', '_spectrum', '_tvg', '.notfound']; $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'])) { if (!empty($global['langs_codes_values_withdot']) && is_array($global['langs_codes_values_withdot'])) {
$search = array_merge($search, $global['langs_codes_values_withdot']); $search = array_merge($search, $global['langs_codes_values_withdot']);
@ -4959,7 +4959,7 @@ if (!class_exists('Video')) {
$relativePath = str_replace($global['systemRootPath'], '', $rokuImage); $relativePath = str_replace($global['systemRootPath'], '', $rokuImage);
return getURL($relativePath); return getURL($relativePath);
} }
return getURL("view/img/notfound.jpg"); return ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL);
} }
public static function clearImageCache($filename, $type = "video") public static function clearImageCache($filename, $type = "video")
@ -4982,7 +4982,7 @@ if (!class_exists('Video')) {
if (!empty($_getImageFromFilename_[$cacheFileName])) { if (!empty($_getImageFromFilename_[$cacheFileName])) {
$obj = $_getImageFromFilename_[$cacheFileName]; $obj = $_getImageFromFilename_[$cacheFileName];
} else { } else {
$cache = ObjectYPT::getCache($cacheFileName, 0, false, true, true); //$cache = ObjectYPT::getCache($cacheFileName, 0, false, true, true);
if (!empty($cache)) { if (!empty($cache)) {
return $cache; return $cache;
} }
@ -5037,34 +5037,38 @@ if (!class_exists('Video')) {
convertImageIfNotExists($jpegPortraitThumbsSmall['path'], $jpegPortraitThumbsSmall['path'], $advancedCustom->thumbsWidthPortrait / 2, $advancedCustom->thumbsHeightPortrait / 2, true); convertImageIfNotExists($jpegPortraitThumbsSmall['path'], $jpegPortraitThumbsSmall['path'], $advancedCustom->thumbsWidthPortrait / 2, $advancedCustom->thumbsHeightPortrait / 2, true);
TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit); TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit);
} else { } else {
if ($type == "article") { if ($type == Video::$videoTypeArticle) {
$obj->posterPortrait = "" . getURL("view/img/article_portrait.png"); $obj->posterPortrait = ImagesPlaceHolders::getArticlesPortrait(ImagesPlaceHolders::$RETURN_URL);
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/article_portrait.png"; $obj->posterPortraitPath = ImagesPlaceHolders::getArticlesLandscape(ImagesPlaceHolders::$RETURN_PATH);
$obj->posterPortraitThumbs = "" . getURL("view/img/article_portrait.png"); $obj->posterPortraitThumbs = $obj->posterPortrait;
$obj->posterPortraitThumbsSmall = "" . getURL("view/img/article_portrait.png"); $obj->posterPortraitThumbsSmall = $obj->posterPortrait;
} elseif ($type == "pdf") { } elseif ($type == Video::$videoTypePdf) {
$obj->posterPortrait = "" . getURL("view/img/pdf_portrait.png"); $obj->posterPortrait = ImagesPlaceHolders::getPdfPortrait(ImagesPlaceHolders::$RETURN_URL);
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/pdf_portrait.png"; $obj->posterPortraitPath = ImagesPlaceHolders::getPdfPortrait(ImagesPlaceHolders::$RETURN_PATH);
$obj->posterPortraitThumbs = "" . getURL("view/img/pdf_portrait.png"); $obj->posterPortraitThumbs = $obj->posterPortrait;
$obj->posterPortraitThumbsSmall = "" . getURL("view/img/pdf_portrait.png"); $obj->posterPortraitThumbsSmall = $obj->posterPortrait;
} /* elseif ($type == "image") { } elseif ($type == Video::$videoTypeZip) {
$obj->posterPortrait = "".getCDN()."view/img/image_portrait.png"; $obj->posterPortrait =ImagesPlaceHolders::getZipPortrait(ImagesPlaceHolders::$RETURN_URL);
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/image_portrait.png"; $obj->posterPortraitPath = ImagesPlaceHolders::getZipPortrait(ImagesPlaceHolders::$RETURN_PATH);
$obj->posterPortraitThumbs = "".getCDN()."view/img/image_portrait.png"; $obj->posterPortraitThumbs = $obj->posterPortrait;
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/image_portrait.png"; $obj->posterPortraitThumbsSmall = $obj->posterPortrait;
} */ elseif ($type == "zip") { } elseif ($type == Video::$videoTypeImage) {
$obj->posterPortrait = "" . getURL("view/img/zip_portrait.png"); $obj->posterPortrait = ImagesPlaceHolders::getImageNotFoundPortrait(ImagesPlaceHolders::$RETURN_URL);
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/zip_portrait.png"; $obj->posterPortraitPath = ImagesPlaceHolders::getImageNotFoundPortrait(ImagesPlaceHolders::$RETURN_PATH);
$obj->posterPortraitThumbs = "" . getURL("view/img/zip_portrait.png"); $obj->posterPortraitThumbs = $obj->posterPortrait;
$obj->posterPortraitThumbsSmall = "" . getURL("view/img/zip_portrait.png"); $obj->posterPortraitThumbsSmall = $obj->posterPortrait;
} elseif ($type == Video::$videoTypeAudio || $type == Video::$videoTypeLinkAudio) {
$obj->posterPortrait = ImagesPlaceHolders::getAudioPortrait(ImagesPlaceHolders::$RETURN_URL);
$obj->posterPortraitPath = ImagesPlaceHolders::getAudioPortrait(ImagesPlaceHolders::$RETURN_PATH);
$obj->posterPortraitThumbs = $obj->posterPortrait;
$obj->posterPortraitThumbsSmall = $obj->posterPortrait;
} else { } else {
$obj->posterPortrait = "" . getURL("view/img/notfound_portrait.jpg"); $obj->posterPortrait = ImagesPlaceHolders::getVideoPlaceholderPortrait(ImagesPlaceHolders::$RETURN_URL);
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/notfound_portrait.png"; $obj->posterPortraitPath = ImagesPlaceHolders::getVideoPlaceholderPortrait(ImagesPlaceHolders::$RETURN_PATH);
$obj->posterPortraitThumbs = "" . getURL("view/img/notfound_portrait.jpg"); $obj->posterPortraitThumbs = $obj->posterPortrait;
$obj->posterPortraitThumbsSmall = "" . getURL("view/img/notfound_portrait.jpg"); $obj->posterPortraitThumbsSmall = $obj->posterPortrait;
} }
} }
TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit); TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit);
if (file_exists($jpegSource['path'])) { if (file_exists($jpegSource['path'])) {
$obj->poster = $jpegSource['url']; $obj->poster = $jpegSource['url'];
@ -5074,36 +5078,36 @@ if (!class_exists('Video')) {
TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit); TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit);
} else { } else {
if ($type == "article") { if ($type == Video::$videoTypeArticle) {
$obj->poster = "" . getURL("view/img/article.png"); $obj->poster = ImagesPlaceHolders::getArticlesLandscape(ImagesPlaceHolders::$RETURN_URL);
$obj->thumbsJpg = "" . getURL("view/img/article.png"); $obj->thumbsJpg = $obj->poster;
$obj->thumbsJpgSmall = "" . getURL("view/img/article.png"); $obj->thumbsJpgSmall = $obj->poster;
} elseif ($type == "pdf") { } elseif ($type == Video::$videoTypePdf) {
$obj->poster = "" . getURL("view/img/pdf.png"); $obj->poster = ImagesPlaceHolders::getPdfLandscape(ImagesPlaceHolders::$RETURN_URL);
$obj->thumbsJpg = "" . getURL("view/img/pdf.png"); $obj->thumbsJpg = $obj->poster;
$obj->thumbsJpgSmall = "" . getURL("view/img/pdf.png"); $obj->thumbsJpgSmall = $obj->poster;
} elseif ($type == "image") { } elseif ($type == Video::$videoTypeImage) {
$obj->poster = "" . getURL("view/img/image.png"); $obj->poster = ImagesPlaceHolders::getImageLandscape(ImagesPlaceHolders::$RETURN_URL);
$obj->thumbsJpg = "" . getURL("view/img/image.png"); $obj->thumbsJpg = $obj->poster;
$obj->thumbsJpgSmall = "" . getURL("view/img/image.png"); $obj->thumbsJpgSmall = $obj->poster;
} elseif ($type == "zip") { } elseif ($type == Video::$videoTypeZip) {
$obj->poster = "" . getURL("view/img/zip.png"); $obj->poster = ImagesPlaceHolders::getZipLandscape(ImagesPlaceHolders::$RETURN_URL);
$obj->thumbsJpg = "" . getURL("view/img/zip.png"); $obj->thumbsJpg = $obj->poster;
$obj->thumbsJpgSmall = "" . getURL("view/img/zip.png"); $obj->thumbsJpgSmall = $obj->poster;
} elseif (($type !== "audio") && ($type !== "linkAudio")) { } elseif (($type !== Video::$videoTypeAudio) && ($type !== Video::$videoTypeLinkAudio)) {
if (file_exists($spectrumSource['path'])) { if (file_exists($spectrumSource['path'])) {
$obj->poster = $spectrumSource['url']; $obj->poster = $spectrumSource['url'];
$obj->thumbsJpg = $spectrumSource['url']; $obj->thumbsJpg = $spectrumSource['url'];
$obj->thumbsJpgSmall = $spectrumSource['url']; $obj->thumbsJpgSmall = $spectrumSource['url'];
} else { } else {
$obj->poster = "" . getURL("view/img/notfound.jpg"); $obj->poster = ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL);
$obj->thumbsJpg = "" . getURL("view/img/notfoundThumbs.jpg"); $obj->thumbsJpg = $obj->poster;
$obj->thumbsJpgSmall = "" . getURL("view/img/notfoundThumbsSmall.jpg"); $obj->thumbsJpgSmall = $obj->poster;
} }
} else { } else {
$obj->poster = "" . getURL("view/img/audio_wave.jpg"); $obj->poster = ImagesPlaceHolders::getAudioLandscape(ImagesPlaceHolders::$RETURN_URL);
$obj->thumbsJpg = "" . getURL("view/img/audio_waveThumbs.jpg"); $obj->thumbsJpg = $obj->poster;
$obj->thumbsJpgSmall = "" . getURL("view/img/audio_waveThumbsSmall.jpg"); $obj->thumbsJpgSmall = $obj->poster;
} }
} }
@ -5119,6 +5123,7 @@ if (!class_exists('Video')) {
$obj->thumbsGif = false; $obj->thumbsGif = false;
} }
//var_dump(__LINE__, $obj->poster);
ObjectYPT::setCache($cacheFileName, $obj); ObjectYPT::setCache($cacheFileName, $obj);
//$cache = ObjectYPT::getCache($cacheFileName, 0); //$cache = ObjectYPT::getCache($cacheFileName, 0);
//_error_log("getImageFromFilename_($filename, $type) [$cacheFileName] ".!empty($cache).' ' .json_encode($response)); //_error_log("getImageFromFilename_($filename, $type) [$cacheFileName] ".!empty($cache).' ' .json_encode($response));
@ -5181,7 +5186,7 @@ if (!class_exists('Video')) {
} else if (!empty($return->posterPortrait)) { } else if (!empty($return->posterPortrait)) {
$return->default = ['url' => $return->posterPortrait, 'path' => $return->posterPortraitPath]; $return->default = ['url' => $return->posterPortrait, 'path' => $return->posterPortraitPath];
} else { } else {
$return->default = ['url' => getURL("view/img/notfoundThumbs.jpg"), 'path' => "{$global['systemRootPath']}view/img/notfoundThumbs.jpg"]; $return->default = ['url' => ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL), 'path' => ImagesPlaceHolders::getVideoPlaceholder()];
} }
return $return; return $return;

View file

@ -137,7 +137,7 @@ if (!User::isAdmin()) {
<div class="row"> <div class="row">
<h3><?php echo __("Add Videos into Campaign"); ?> - <strong id="campaignName"></strong></h3> <h3><?php echo __("Add Videos into Campaign"); ?> - <strong id="campaignName"></strong></h3>
<div class="col-md-4"> <div class="col-md-4">
<img id="inputVideo-poster" src="<?php echo $global['webSiteRootURL']; ?>img/notfound.jpg" class="ui-state-default img-responsive" alt=""> <img id="inputVideo-poster" src="<?php echo ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL); ?>" class="ui-state-default img-responsive" alt="">
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<input id="inputVideo" placeholder="<?php echo __("Video"); ?>" class="form-control"> <input id="inputVideo" placeholder="<?php echo __("Video"); ?>" class="form-control">
@ -237,7 +237,7 @@ if (!User::isAdmin()) {
var tableLinks; var tableLinks;
var videoUploadModalinterval; var videoUploadModalinterval;
function clearVideoForm() { function clearVideoForm() {
$('#inputVideo-poster').attr('src', "<?php echo $global['webSiteRootURL']; ?>view/img/notfound.jpg"); $('#inputVideo-poster').attr('src', "<?php echo ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL); ?>");
$('#inputVideo').val(''); $('#inputVideo').val('');
$('#inputVideoClean').val(''); $('#inputVideoClean').val('');
$('#inputVideoURI').val(''); $('#inputVideoURI').val('');

View file

@ -495,7 +495,7 @@ class API extends PluginAbstract
if (is_array($tags)) { if (is_array($tags)) {
foreach ($tags as $key => $row) { foreach ($tags as $key => $row) {
$tags[$key]['videos'] = array(); $tags[$key]['videos'] = array();
$tags[$key]['photo'] = $global['webSiteRootURL'] . 'view/img/notfound.jpg'; $tags[$key]['photo'] = ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL);
if (!empty($row['subscription'])) { if (!empty($row['subscription'])) {
$videos = TagsHasVideos::getAllVideosFromTagsId($row['id']); $videos = TagsHasVideos::getAllVideosFromTagsId($row['id']);
$tags[$key]['videos'] = PlayLists::videosToPlaylist($videos, @$parameters['index'], !empty($parameters['audioOnly'])); $tags[$key]['videos'] = PlayLists::videosToPlaylist($videos, @$parameters['index'], !empty($parameters['audioOnly']));

View file

@ -4,42 +4,179 @@ global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php'; require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/Bookmark/Objects/BookmarkTable.php'; require_once $global['systemRootPath'] . 'plugin/Bookmark/Objects/BookmarkTable.php';
class Bookmark extends PluginAbstract { class Bookmark extends PluginAbstract
{
public function getDescription() { public function getDescription()
return "You can add bookmarks to indicate points of interest in a video or audio clip."; {
return "You can add bookmarks in a video or audio clip to highlight interest points or select chapters";
} }
public function getName() { public function getName()
{
return "Bookmark"; return "Bookmark";
} }
public function getUUID() { public function getUUID()
{
return "27570956-dc62-46e3-ace9-86c6e8f9c84b"; return "27570956-dc62-46e3-ace9-86c6e8f9c84b";
} }
public function getPluginMenu(){ public function getPluginMenu()
{
global $global; global $global;
$filename = $global['systemRootPath'] . 'plugin/Bookmark/pluginMenu.html'; $filename = $global['systemRootPath'] . 'plugin/Bookmark/pluginMenu.html';
return file_get_contents($filename); return file_get_contents($filename);
} }
public function getFooterCode() { public function getFooterCode()
if(empty($_GET['videoName'])){ {
return false; global $global;
$videos_id = getVideos_id();
if (!empty($videos_id)) {
$rows = BookmarkTable::getAllFromVideo($videos_id);
//var_dump($rows);exit;
if (!empty($rows)) {
include $global['systemRootPath'] . 'plugin/Bookmark/footer.php';
}
} }
global $global;
$video = Video::getVideoFromCleanTitle($_GET['videoName']);
$rows = BookmarkTable::getAllFromVideo($video['id']);
include $global['systemRootPath'] . 'plugin/Bookmark/footer.php';
} }
public function getVideosManagerListButton() { public function getVideosManagerListButton()
{
global $global; global $global;
$btn = ''; $btn = '';
$btn .= '<button type="button" class="btn btn-default btn-light btn-sm btn-xs btn-block " onclick="avideoModalIframeFull(webSiteRootURL+\\\'plugin/Bookmark/editorVideo.php?videos_id=\'+ row.id +\'\\\');" ><i class="fas fa-bookmark"></i> Add Bookmarks</button>'; $btn .= '<button type="button" class="btn btn-default btn-light btn-sm btn-xs btn-block " onclick="avideoModalIframeFull(webSiteRootURL+\\\'plugin/Bookmark/editorVideo.php?videos_id=\'+ row.id +\'\\\');" ><i class="fas fa-bookmark"></i> Add Bookmarks</button>';
return $btn; return $btn;
} }
static function parseTimeString($str)
{
$pattern = "/\s*(\d{2}:\d{2}(?::\d{2})?)\s*-\s*(.+)$/m";
preg_match_all($pattern, $str, $matches, PREG_SET_ORDER);
$result = [];
foreach ($matches as $match) {
// Normalize time format to HH:MM:SS
$timeParts = explode(":", $match[1]);
if (count($timeParts) == 2) {
$match[1] = $match[1] . ":00";
}
$result[] = [
'seconds' => timeToSeconds($match[1]),
'time' => $match[1],
'text' => $match[2]
];
}
// Sort the array by time
usort($result, function ($a, $b) {
return $a['seconds'] - $b['seconds'];
});
return $result;
}
static function videoToVtt($videos_id)
{
$data = BookmarkTable::getAllFromVideo($videos_id);
$output = "WEBVTT\n\n";
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
$end_time = ($index == count($data) - 1) ? $start_time + 5 : $data[$index + 1]["timeInSeconds"] - 1;
$output .= secondsToTime($start_time) . " --> " . secondsToTime($end_time) . "\n";
$output .= $item["name"] . "\n\n";
}
// Save to a WebVTT file
$bytes = file_put_contents(self::getChaptersFilename($videos_id), $output);
return $bytes;
//var_dump($bytes, self::getChaptersFilename($videos_id), $output);exit;
}
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') {
$video = new Video("", "", $videos_id);
$filename = $video->getFilename();
$path = Video::getPathToFile($filename);
if (empty($lang) || strtoupper($lang) == 'CC') {
$vttFilename = "{$path}.chapters.vtt";
} else {
$vttFilename = "{$path}.chapters.{$lang}.vtt";
}
return $vttFilename;
}
} }
function getVTTCaptionTracks($fileName, $returnArray = false) {
global $global;
$cache = getVTTCaptionCache($fileName);
if (!empty($cache)) {
$objCache = _json_decode($cache);
} else {
$sourcesArray = array();
$tracks = "";
if (!empty($fileName)) {
$defaultFile = Bookmark::getChaptersFilenameFromFilename($fileName);
//var_dump( $defaultFile, Video::getCleanFilenameFromFile($defaultFile));exit;
if (file_exists($defaultFile)) {
$path_parts = pathinfo($defaultFile);
$src = Video::getURLToFile($path_parts['basename']);
$obj = new stdClass();
$obj->srclang = 'en';
$obj->src = $src;
$obj->filename = $defaultFile;
$obj->label = 'Chapters';
$obj->desc = 'Chapters';
$tracks .= "<track kind=\"chapters\" src=\"{$obj->src}\" srclang=\"{$obj->srclang}\" label=\"{$obj->label}\" default>";
$sourcesArray[] = $obj;
}
}
$objCache = new stdClass();
$objCache->sourcesArray = $sourcesArray;
$objCache->tracks = $tracks;
createVTTCaptionCache($fileName, json_encode($objCache));
}
return $returnArray ? $objCache->sourcesArray : $objCache->tracks;
}
function getVTTCaptionCache($fileName) {
global $global;
$cacheDir = $global['systemRootPath'] . 'videos/cache/vttCaption/';
$file = "{$cacheDir}{$fileName}.cache";
if (!file_exists($file)) {
return false;
}
return file_get_contents($file);
}
function createVTTCaptionCache($fileName, $data) {
global $global;
$cacheDir = $global['systemRootPath'] . 'videos/cache/vttCaption/';
if (!file_exists($cacheDir)) {
mkdir($cacheDir, 0777, true);
}
file_put_contents("{$cacheDir}{$fileName}.cache", $data);
}
function deleteVTTCaptionCache($fileName) {
global $global;
$cacheDir = $global['systemRootPath'] . 'videos/cache/vttCaption/';
@unlink("{$cacheDir}{$fileName}.cache");
}

View file

@ -29,7 +29,7 @@ class BookmarkTable extends ObjectYPT {
} }
function setTimeInSeconds($timeInSeconds) { function setTimeInSeconds($timeInSeconds) {
$this->timeInSeconds = $timeInSeconds; $this->timeInSeconds = floatval($timeInSeconds);
} }
function setName($name) { function setName($name) {
@ -43,6 +43,7 @@ class BookmarkTable extends ObjectYPT {
static function deleteAllFromVideo($videos_id) { static function deleteAllFromVideo($videos_id) {
global $global; global $global;
if (!empty($videos_id)) { if (!empty($videos_id)) {
Bookmark::videoToVtt($videos_id);
$sql = "DELETE FROM " . static::getTableName() . " "; $sql = "DELETE FROM " . static::getTableName() . " ";
$sql .= " WHERE videos_id = ?"; $sql .= " WHERE videos_id = ?";
$global['lastQuery'] = $sql; $global['lastQuery'] = $sql;
@ -64,9 +65,7 @@ class BookmarkTable extends ObjectYPT {
foreach ($fullData as $row) { foreach ($fullData as $row) {
$rows[] = $row; $rows[] = $row;
} }
} else { }
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows; return $rows;
} }
@ -84,8 +83,6 @@ class BookmarkTable extends ObjectYPT {
foreach ($fullData as $row) { foreach ($fullData as $row) {
$rows[] = $row; $rows[] = $row;
} }
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
} }
return $rows; return $rows;
} }
@ -96,7 +93,22 @@ class BookmarkTable extends ObjectYPT {
if(!empty($row)){ if(!empty($row)){
$this->id = $row['id']; $this->id = $row['id'];
} }
parent::save(); $id = parent::save();
if(!empty($id)){
Bookmark::videoToVtt($id);
}
return $id;
}
public function delete() {
if(!empty($this->id)){
$b = new BookmarkTable($this->id);
}
$deleted = parent::delete();
if(!empty($b)){
Bookmark::videoToVtt($b->getVideos_id());
}
return $deleted;
} }
static protected function getFromTime($videos_id, $timeInSeconds) { static protected function getFromTime($videos_id, $timeInSeconds) {

View file

@ -84,6 +84,6 @@
function clearBookmarkForm() { function clearBookmarkForm() {
$('#bookmarkForm')[0].reset(); $('#bookmarkForm')[0].reset();
$('#inputVideo-poster').attr('src','<?php echo $global['webSiteRootURL']; ?>img/notfound.jpg'); $('#inputVideo-poster').attr('src','<?php echo ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL); ?>');
} }
</script> </script>

View file

@ -417,10 +417,11 @@ Allow: /plugin/Gallery/*.js
Allow: /plugin/YouPHPFlix2/*.png Allow: /plugin/YouPHPFlix2/*.png
Allow: /plugin/Live/*.css Allow: /plugin/Live/*.css
Allow: /plugin/Live/*.js Allow: /plugin/Live/*.js
Allow: /plugin/LiveLink/?*
Allow: /plugin/*.css Allow: /plugin/*.css
Allow: /plugin/*.js Allow: /plugin/*.js
Allow: .js Allow: *.js
Allow: .css Allow: *.css
Disallow: /user Disallow: /user
Disallow: /plugin Disallow: /plugin
Disallow: /mvideos Disallow: /mvideos
@ -432,8 +433,8 @@ Disallow: /subscribes
Disallow: /update Disallow: /update
Disallow: /locale Disallow: /locale
Disallow: /objects/* Disallow: /objects/*
Disallow: /view/?lang=*
Allow: /plugin/Live/?* Allow: /plugin/Live/?*
Allow: /plugin/LiveLink/?*
Allow: /plugin/PlayLists/*.css Allow: /plugin/PlayLists/*.css
Allow: /plugin/PlayLists/*.js Allow: /plugin/PlayLists/*.js
Allow: /plugin/TopMenu/*.css Allow: /plugin/TopMenu/*.css
@ -445,10 +446,12 @@ Allow: /plugin/Gallery/*.js
Allow: /plugin/YouPHPFlix2/*.png Allow: /plugin/YouPHPFlix2/*.png
Allow: /plugin/Live/*.css Allow: /plugin/Live/*.css
Allow: /plugin/Live/*.js Allow: /plugin/Live/*.js
Allow: /plugin/LiveLink/?*
Allow: /plugin/*.css Allow: /plugin/*.css
Allow: /plugin/*.js Allow: /plugin/*.js
Allow: *.js Allow: *.js
Allow: *.css"; Allow: *.css
";
$obj->robotsTXT = $o; $obj->robotsTXT = $o;
self::addDataObjectHelper('robotsTXT', 'robots.txt file content', 'robots.txt is a plain text file that follows the Robots Exclusion Standard. A robots.txt file consists of one or more rules. Each rule blocks (or allows) access for a given crawler to a specified file path in that website.'); self::addDataObjectHelper('robotsTXT', 'robots.txt file content', 'robots.txt is a plain text file that follows the Robots Exclusion Standard. A robots.txt file consists of one or more rules. Each rule blocks (or allows) access for a given crawler to a specified file path in that website.');
@ -903,6 +906,6 @@ $global['social_medias'] = array(
'LinkedIn' => new SocialMedias('fab fa-linkedin-in', ''), 'LinkedIn' => new SocialMedias('fab fa-linkedin-in', ''),
'Wordpress' => new SocialMedias('fab fa-wordpress-simple', ''), 'Wordpress' => new SocialMedias('fab fa-wordpress-simple', ''),
'Pinboard' => new SocialMedias('fas fa-thumbtack', ''), 'Pinboard' => new SocialMedias('fas fa-thumbtack', ''),
'Gab' => new SocialMedias('', getURL('view/img/gab.png')), 'Gab' => new SocialMedias('', getURL('view/img/social/gab.png')),
'CloutHub' => new SocialMedias('', getURL('view/img/cloutHub.png')), 'CloutHub' => new SocialMedias('', getURL('view/img/social/cloutHub.png')),
); );

View file

@ -4,7 +4,7 @@ require_once dirname(__FILE__) . '/../../videos/configuration.php';
setIsConfirmationPage(); setIsConfirmationPage();
$images = Video::getImageFromFilename($video['filename']); $images = Video::getImageFromFilename($video['filename']);
$img = $images->poster; $img = $images->poster;
if (!empty($images->posterPortrait) && strpos($images->posterPortrait, 'notfound_portrait') === false) { if (!empty($images->posterPortrait) && !ImagesPlaceHolders::isDefaultImage($images->posterPortrait)) {
$img = $images->posterPortrait; $img = $images->posterPortrait;
} }
$imgw = 1280; $imgw = 1280;

View file

@ -3,7 +3,7 @@ require_once '../videos/configuration.php';
setIsConfirmationPage(); setIsConfirmationPage();
$images = Video::getImageFromFilename($video['filename']); $images = Video::getImageFromFilename($video['filename']);
$img = $images->poster; $img = $images->poster;
if (!empty($images->posterPortrait) && strpos($images->posterPortrait, 'notfound_portrait') === false) { if (!empty($images->posterPortrait) && !ImagesPlaceHolders::isDefaultImage($images->posterPortrait)) {
$img = $images->posterPortrait; $img = $images->posterPortrait;
} }
$imgw = 1280; $imgw = 1280;

View file

@ -42,7 +42,7 @@ class Gallery extends PluginAbstract
global $global; global $global;
$obj = $this->getDataObject(); $obj = $this->getDataObject();
// preload image // preload image
$js = "<script>var img1 = new Image();img1.src=\"" . getURL('view/img/video-placeholder-gray.png') . "\";</script>"; $js = "<script>var img1 = new Image();img1.src=\"" . ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL) . "\";</script>";
$css = '<link href="' . getURL('plugin/Gallery/style.css') . '" rel="stylesheet" type="text/css"/>'; $css = '<link href="' . getURL('plugin/Gallery/style.css') . '" rel="stylesheet" type="text/css"/>';
if (!empty($obj->playVideoOnFullscreenOnIframe)) { if (!empty($obj->playVideoOnFullscreenOnIframe)) {

View file

@ -116,7 +116,7 @@ if ((!empty($videos)) || (!empty($obj) && $obj->SubCategorys)) {
break; break;
} }
} else { } else {
$poster = $global['webSiteRootURL'] . "view/img/notfound.jpg"; $poster = ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL);
?> ?>
<img src="<?php echo $poster; ?>" alt="" data-toggle="tooltip" title="<?php echo $description; ?>" class="thumbsJPG img img-responsive" id="thumbsJPG<?php echo $cat['id']; ?>" /> <img src="<?php echo $poster; ?>" alt="" data-toggle="tooltip" title="<?php echo $description; ?>" class="thumbsJPG img img-responsive" id="thumbsJPG<?php echo $cat['id']; ?>" />
<?php <?php

View file

@ -39,7 +39,8 @@ $_REQUEST['rowCount'] = $obj->CategoriesRowCount;
<?php <?php
$timeLogName = TimeLogStart('modeGalleryCategory'); $timeLogName = TimeLogStart('modeGalleryCategory');
foreach ($categories as $_cat) { foreach ($categories as $_cat) {
$setCacheName = "include{$_cat['clean_name']}"; $setCacheName = "include{$_cat['id']}";
//var_dump($_cat, $setCacheName);exit;
$contents = getIncludeFileContent("{$global['systemRootPath']}plugin/Gallery/view/modeGalleryCategoryInclude.php", $contents = getIncludeFileContent("{$global['systemRootPath']}plugin/Gallery/view/modeGalleryCategoryInclude.php",
['_cat'=>$_cat, 'obj'=>$obj], $setCacheName); ['_cat'=>$_cat, 'obj'=>$obj], $setCacheName);
echo $contents; echo $contents;

View file

@ -1,7 +1,7 @@
<?php <?php
if (empty($_cat['clean_name'])) { if (empty($_cat['clean_name'])) {
return; return;
} }//var_dump($_cat);exit;
$_REQUEST['catName'] = $_cat['clean_name']; $_REQUEST['catName'] = $_cat['clean_name'];
if (!empty($liveobj) && empty($liveobj->doNotShowLiveOnCategoryList)) { if (!empty($liveobj) && empty($liveobj->doNotShowLiveOnCategoryList)) {
$currentCat = $_cat; $currentCat = $_cat;

View file

@ -9,7 +9,7 @@ if (!empty($default_users_id)) {
if (empty($name)) { if (empty($name)) {
$name = ''; $name = '';
$user_image = getURL('view/img/userSilhouette.jpg'); $user_image = ImagesPlaceHolders::getUserIcon(ImagesPlaceHolders::$RETURN_URL);
$default_users_id = 0; $default_users_id = 0;
} }
?> ?>
@ -55,7 +55,7 @@ if (empty($name)) {
function resetUserAutocomplete<?php echo $id; ?>() { function resetUserAutocomplete<?php echo $id; ?>() {
$("#user<?php echo $id; ?>").val(''); $("#user<?php echo $id; ?>").val('');
$("#<?php echo $id; ?>").val(0); $("#<?php echo $id; ?>").val(0);
var photoURL = webSiteRootURL + 'img/userSilhouette.jpg' var photoURL = webSiteRootURL + 'view/img/placeholders/user.png'
$("#user-img<?php echo $id; ?>").attr("src", photoURL); $("#user-img<?php echo $id; ?>").attr("src", photoURL);
} }
@ -90,7 +90,7 @@ if (empty($name)) {
select: function (event, ui) { select: function (event, ui) {
$("#user<?php echo $id; ?>").val(ui.item.identification); $("#user<?php echo $id; ?>").val(ui.item.identification);
$("#<?php echo $id; ?>").val(ui.item.id); $("#<?php echo $id; ?>").val(ui.item.id);
var photoURL = webSiteRootURL + 'img/userSilhouette.jpg' var photoURL = webSiteRootURL + 'view/img/placeholders/user.png'
if (ui.item.photo) { if (ui.item.photo) {
photoURL = ui.item.photo; photoURL = ui.item.photo;
} }

View file

@ -9,7 +9,7 @@ if (!empty($default_videos_id)) {
if (empty($name)) { if (empty($name)) {
$name = ''; $name = '';
$video_image = getURL('img/notfound.jpg'); $video_image = ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL);
$default_videos_id = 0; $default_videos_id = 0;
} }
?> ?>
@ -56,7 +56,7 @@ if (empty($name)) {
function resetvideoAutocomplete<?php echo $id; ?>() { function resetvideoAutocomplete<?php echo $id; ?>() {
$("#videoAutocomplete<?php echo $id; ?>").val(''); $("#videoAutocomplete<?php echo $id; ?>").val('');
$("#<?php echo $id; ?>").val(0); $("#<?php echo $id; ?>").val(0);
var photoURL = webSiteRootURL + 'img/notfound.jpg' var photoURL = '<?php echo ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL); ?>'
$("#videoAutocomplete-img<?php echo $id; ?>").attr("src", photoURL); $("#videoAutocomplete-img<?php echo $id; ?>").attr("src", photoURL);
} }
@ -93,7 +93,7 @@ if (empty($name)) {
select: function (event, ui) { select: function (event, ui) {
$("#videoAutocomplete<?php echo $id; ?>").val(ui.item.title); $("#videoAutocomplete<?php echo $id; ?>").val(ui.item.title);
$("#<?php echo $id; ?>").val(ui.item.id); $("#<?php echo $id; ?>").val(ui.item.id);
var photoURL = webSiteRootURL + 'img/notfound.jpg' var photoURL = '<?php echo ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL); ?>'
if (ui.item.videosURL.jpg.url) { if (ui.item.videosURL.jpg.url) {
photoURL = ui.item.videosURL.jpg.url; photoURL = ui.item.videosURL.jpg.url;
} }

View file

@ -489,8 +489,8 @@ class Live extends PluginAbstract {
$title, $title,
$u->getNameIdentificationBd(), $u->getNameIdentificationBd(),
$link, $link,
(!empty($imgJPG) ? '<img src="' . getURL('view/img/loading-gif.png') . '" data-src="' . $imgJPG . '" class="thumbsJPG img-responsive" height="130">' : ''), (!empty($imgJPG) ? '<img src="' . ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL) . '" data-src="' . $imgJPG . '" class="thumbsJPG img-responsive" height="130">' : ''),
(!empty($imgGIF) ? ('<img src="' . getURL('view/img/loading-gif.png') . '" data-src="' . $imgGIF . '" style="position: absolute; top: 0px; height: 0px; width: 0px; display: none;" class="thumbsGIF img-responsive" height="130">') : ''), (!empty($imgGIF) ? ('<img src="' .ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_URL) . '" data-src="' . $imgGIF . '" style="position: absolute; top: 0px; height: 0px; width: 0px; display: none;" class="thumbsGIF img-responsive" height="130">') : ''),
$LiveUsersLabelLive, $LiveUsersLabelLive,
$class, $class,
]; ];

View file

@ -115,20 +115,6 @@ class PlayerSkins extends PluginAbstract {
$htmlMediaTag .= "<!-- Video Link {$video['title']} {$video['filename']} --><source src='{$url}' type='" . ((strpos($video['videoLink'], 'm3u8') !== false) ? "application/x-mpegURL" : "video/mp4") . "' >"; $htmlMediaTag .= "<!-- Video Link {$video['title']} {$video['filename']} --><source src='{$url}' type='" . ((strpos($video['videoLink'], 'm3u8') !== false) ? "application/x-mpegURL" : "video/mp4") . "' >";
$html .= "<script>$(document).ready(function () {\$('time.duration').hide();});</script>"; $html .= "<script>$(document).ready(function () {\$('time.duration').hide();});</script>";
} }
/*
if (AVideoPlugin::isEnabledByName('SubtitleSwitcher') && function_exists('getVTTTracks')) {
$htmlMediaTag .= "<!-- getVTTTracks 1 -->";
$htmlMediaTag .= getVTTTracks($video['filename']);
}else{
if(!AVideoPlugin::isEnabledByName('SubtitleSwitcher')){
$htmlMediaTag .= "<!-- SubtitleSwitcher disabled -->";
}
if(!function_exists('getVTTTracks')){
$htmlMediaTag .= "<!-- getVTTTracks not found -->";
}
}
*
*/
$htmlMediaTag .= '<p>' . __("If you can't view this video, your browser does not support HTML5 videos") . '</p><p class="vjs-no-js">' . __("To view this video please enable JavaScript, and consider upgrading to a web browser that") . '<a href="http://videojs.com/html5-video-support/" target="_blank" rel="noopener noreferrer">supports HTML5 video</a></p></video>'; $htmlMediaTag .= '<p>' . __("If you can't view this video, your browser does not support HTML5 videos") . '</p><p class="vjs-no-js">' . __("To view this video please enable JavaScript, and consider upgrading to a web browser that") . '<a href="http://videojs.com/html5-video-support/" target="_blank" rel="noopener noreferrer">supports HTML5 video</a></p></video>';
} else if ($vType == 'audio') { } else if ($vType == 'audio') {
$htmlMediaTag = '<audio ' . self::getPlaysinline() . ' $htmlMediaTag = '<audio ' . self::getPlaysinline() . '
@ -491,107 +477,56 @@ class PlayerSkins extends PluginAbstract {
$prepareStartPlayerJS_getDataSetup = array(); $prepareStartPlayerJS_getDataSetup = array();
} }
if (empty($noReadyFunction)) { if (empty($noReadyFunction)) {
$js .= "var originalVideo; $js .= "var originalVideo;";
var adTagOptions; $js .= "var currentTime = $currentTime;";
var _adTagUrl = '{$IMAADTag}'; var player; " $js .= "var adTagOptions = {};";
. "$(document).ready(function () {"; $js .= "var _adTagUrl = '{$IMAADTag}'; var player; ";
$js .= "var startEvent = 'click';";
} }
$js .= "$(document).ready(function () {";
$js .= " $js .= "
originalVideo = $('#mainVideo').clone(); originalVideo = $('#mainVideo').clone();
/* prepareStartPlayerJS_onPlayerReady = " . count($prepareStartPlayerJS_onPlayerReady) . ", prepareStartPlayerJS_getDataSetup = " . count($prepareStartPlayerJS_getDataSetup) . " */
if (typeof player === 'undefined' && $('#mainVideo').length) { if (typeof player === 'undefined' && $('#mainVideo').length) {
player = videojs('mainVideo'" . (self::getDataSetup(implode(" ", $prepareStartPlayerJS_getDataSetup))) . "); player = videojs('mainVideo'" . (self::getDataSetup(implode(" ", $prepareStartPlayerJS_getDataSetup))) . ");";
";
if (!empty($IMAADTag) && isVideoPlayerHasProgressBar()) { if (!empty($IMAADTag) && isVideoPlayerHasProgressBar()) {
$js .= "adTagOptions = {" $adTagOptions = array(
. "id: 'mainVideo', " 'id' => 'mainVideo',
. "adTagUrl: '{$IMAADTag}', " 'adTagUrl' => $IMAADTag,
. "debug: true, " 'debug' => true,
. "/*useStyledLinearAds: false,*/" // 'useStyledLinearAds' => false,
. "/*useStyledNonLinearAds: true,*/" // 'useStyledNonLinearAds' => true,
. "forceNonLinearFullSlot: true, " 'forceNonLinearFullSlot' => true,
. "/*adLabel: 'Advertisement',*/ " 'adLabel' => __('Advertisement'),
. "/*autoPlayAdBreaks:false,*/" // 'autoPlayAdBreaks' => false,
. "}; " );
. "player.ima(adTagOptions);"; $js .= PHP_EOL."adTagOptions = " . json_encode($adTagOptions) . ";".PHP_EOL;
$js .= "setInterval(function(){ fixAdSize(); }, 300); $js .= "player.ima(adTagOptions);";
// first time it's clicked.
var startEvent = 'click';";
if (isMobile()) { if (isMobile()) {
$js .= "// Remove controls from the player on iPad to stop native controls from stealing $js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerAdsEventsMobile.js').PHP_EOL;
// our click
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer && (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)) &&
contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
// Initialize the ad container when the video player is clicked, but only the
if (navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)) {
startEvent = 'touchend';
}";
} }
$js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerAdsEvents.js').PHP_EOL;
$js .= "
player.on('adsready', function () {
console.log('adsready');
player.ima.setAdBreakReadyListener(function(e) {
if(!_adWasPlayed){
console.log('ADs !_adWasPlayed player.ima.playAdBreak();',e);
//player.ima.requestAds();
player.on('play', function () {
if(!_adWasPlayed){
player.ima.playAdBreak();
_adWasPlayed = 1;
}
});
}else{
console.log('ADs _adWasPlayed player.ima.playAdBreak();',e);
player.ima.playAdBreak();
}
});
});player.on('ads-ad-started', function () {
console.log('ads-ad-started');
});player.on('ads-manager', function (a) {
console.log('ads-manager', a);
});player.on('ads-loader', function (a) {
console.log('ads-loader', a);
});player.on('ads-request', function (a) {
console.log('ads-request', a);
});player.one(startEvent, function () {player.ima.initializeAdDisplayContainer();});";
} }
$js .= "}"; $js .= "};".PHP_EOL;
$js .= "if(typeof player !== 'undefined'){"; $js .= PHP_EOL."if(typeof player !== 'undefined'){";
$js .= "player.ready(function () {console.log('player.ready');"; $js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerReady.js');
$js .= "player.on('error', () => {AvideoJSError(player.error().code);});";
// this is here because for some reason videos on the storage only works if it loads dinamically on android devices only // this is here because for some reason videos on the storage only works if it loads dinamically on android devices only
if (isMobile()) { if (isMobile()) {
$js .= "player.src(player.currentSources());"; $js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerReadyMobile.js');
} }
if (empty($_REQUEST['mute'])) { if (empty($_REQUEST['mute'])) {
$play = "playerPlayIfAutoPlay({$currentTime});"; $js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerReadyUnmuted.js');
$js .= "player.persistvolume({namespace: 'AVideo'});";
} else { } else {
$play = "player.volume(0);player.muted(true);playerPlayMutedIfAutoPlay({$currentTime});"; $js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerReadyMuted.js');
} }
$js .= "try { $js .= "player.ready(function () {";
var err = this.error(); $js .= " try {";
if (err && err.code) {
$('.vjs-error-display').hide();
$('#mainVideo').find('.vjs-poster').css({'background-image': 'url({$global['webSiteRootURL']}plugin/Live/view/Offline.jpg)'});
}} catch (e) {
console.error('error-display', e);
};";
$js .= "try {";
$js .= implode(' } catch (e) {console.error(\'onPlayerReady\', e);};try { ', $prepareStartPlayerJS_onPlayerReady) . ";"; $js .= implode(' } catch (e) {console.error(\'onPlayerReady\', e);};try { ', $prepareStartPlayerJS_onPlayerReady) . ";";
$js .= " } catch (e) {console.error('onPlayerReady', e);}"; $js .= " } catch (e) {";
$js .= $play; $js .= " console.error('onPlayerReady', e);";
$js .= " }";
$js .= "});"; $js .= "});";
if ($obj->showLoopButton && isVideoPlayerHasProgressBar()) { if ($obj->showLoopButton && isVideoPlayerHasProgressBar()) {
@ -600,10 +535,8 @@ class PlayerSkins extends PluginAbstract {
$js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/fixCurrentSources.js'); $js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/fixCurrentSources.js');
$js .= "}"; $js .= "}";
if (empty($noReadyFunction)) {
$js .= "});"; $js .= "});";
}
//var_dump('getStartPlayerJSWasRequested', debug_backtrace()); //var_dump('getStartPlayerJSWasRequested', debug_backtrace());
$getStartPlayerJSWasRequested = true; $getStartPlayerJSWasRequested = true;
return $js; return $js;

View file

@ -0,0 +1,32 @@
setInterval(function () { fixAdSize(); }, 300);
player.on('adsready', function () {
console.log('adsready');
player.ima.setAdBreakReadyListener(function (e) {
if (!_adWasPlayed) {
console.log('ADs !_adWasPlayed player.ima.playAdBreak();', e);
//player.ima.requestAds();
player.on('play', function () {
if (!_adWasPlayed) {
player.ima.playAdBreak();
_adWasPlayed = 1;
}
});
} else {
console.log('ADs _adWasPlayed player.ima.playAdBreak();', e);
player.ima.playAdBreak();
}
});
});
player.on('ads-ad-started', function () {
console.log('ads-ad-started');
});
player.on('ads-manager', function (a) {
console.log('ads-manager', a);
});
player.on('ads-loader', function (a) {
console.log('ads-loader', a);
});
player.on('ads-request', function (a) {
console.log('ads-request', a);
});
player.one(startEvent, function () { player.ima.initializeAdDisplayContainer(); });

View file

@ -0,0 +1,15 @@
// Remove controls from the player on iPad to stop native controls from stealing
// our click
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer && (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)) &&
contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
// Initialize the ad container when the video player is clicked, but only the
if (navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)) {
startEvent = 'touchend';
}

View file

@ -0,0 +1,22 @@
player.ready(function () {
console.log('player.ready');
player.on('error', () => { AvideoJSError(player.error().code); });
try {
var err = this.error();
if (err && err.code) {
$('.vjs-error-display').hide();
$('#mainVideo').find('.vjs-poster').css({ 'background-image': 'url(' + webSiteRootURL + 'plugin/Live/view/Offline.jpg)' });
}
} catch (e) {
console.error('error-display', e);
}
setTimeout(() => {
$('.vjs-menu-item').on('click', function() {
// Remove vjs-selected class from all chapter menu items
$(this).parent().find('.vjs-menu-item').removeClass('vjs-selected');
// Add vjs-selected class back to the clicked chapter
$(this).addClass('vjs-selected');
});
}, 2000);
});

View file

@ -0,0 +1,3 @@
player.ready(function () {
player.src(player.currentSources());
});

View file

@ -0,0 +1,5 @@
player.ready(function () {
player.volume(0);
player.muted(true);
playerPlayMutedIfAutoPlay(currentTime);
});

View file

@ -0,0 +1,4 @@
player.ready(function () {
playerPlayIfAutoPlay(currentTime);
player.persistvolume({ namespace: 'AVideo' });
});

View file

@ -19,4 +19,12 @@ function startAudioSpectrumProgress(spectrumImage) {
}else{ }else{
setTimeout(function(){startAudioSpectrumProgress(spectrumImage);},500); setTimeout(function(){startAudioSpectrumProgress(spectrumImage);},500);
} }
}
function appendOnPlayer(element){
if (typeof player !== 'undefined') {
$(element).insertBefore($(player.el()).find('.vjs-control-bar'));
} else {
setTimeout(function () { appendOnPlayer(element); }, 1000);
}
} }

View file

@ -145,9 +145,7 @@ class IP2Location extends ObjectYPT {
} }
$content = json_encode($rows); $content = json_encode($rows);
file_put_contents($cachefile, $content); file_put_contents($cachefile, $content);
} else { }
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
} else { } else {
$content = file_get_contents($cachefile); $content = file_get_contents($cachefile);
} }
@ -181,8 +179,6 @@ class IP2Location extends ObjectYPT {
} }
$content = json_encode($rows); $content = json_encode($rows);
file_put_contents($cachefile, $content); file_put_contents($cachefile, $content);
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
} }
} else { } else {
$content = file_get_contents($cachefile); $content = file_get_contents($cachefile);

View file

@ -42,6 +42,7 @@ class VideoTags extends PluginAbstract {
$obj->maxTags = 100; $obj->maxTags = 100;
$obj->maxChars = 100; $obj->maxChars = 100;
$obj->disableTagsSubscriptions = false; $obj->disableTagsSubscriptions = false;
$obj->showTagsOnEmbed = true;
return $obj; return $obj;
} }
@ -378,7 +379,7 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
return $users; return $users;
} }
static function getLabels($videos_id, $showType = true) { static function getLabels($videos_id, $showType = true, $showSubscription = true) {
global $global; global $global;
$currentPage = getCurrentPage(); $currentPage = getCurrentPage();
@ -400,7 +401,7 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
if (empty($value['name']) || $value['name'] === '-') { if (empty($value['name']) || $value['name'] === '-') {
continue; continue;
} }
if($obj->disableTagsSubscriptions){ if($obj->disableTagsSubscriptions || empty($showSubscription)){
$strT .= self::getTagHTMLLink($value['tags_id'], $value['total']); $strT .= self::getTagHTMLLink($value['tags_id'], $value['total']);
}else{ }else{
$strT .= self::getButton($value['tags_id'], $videos_id); $strT .= self::getButton($value['tags_id'], $videos_id);
@ -492,7 +493,20 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
return $css; return $css;
} }
public function getFooterCode(){ public function getFooterCode(){
$js = '<script src="' .getURL('plugin/VideoTags/View/script.js') . '" type="text/javascript"></script>'; $js = '';
$obj = AVideoPlugin::getDataObject('VideoTags');
if($obj->showTagsOnEmbed && isEmbed() && isVideo()){
$videos_id = getVideos_id();
if(!empty($videos_id)){
$labels = self::getLabels($videos_id, true, false);
//var_dump($labels);exit;
if(!empty($labels)){
$js .= '<script>videoTagsLabels = '.json_encode($labels).';</script>';
}
}
}
//var_dump($js);exit;
$js .= '<script src="' .getURL('plugin/VideoTags/View/script.js') . '" type="text/javascript"></script>';
return $js; return $js;
} }
} }

View file

@ -1,5 +1,5 @@
function toogleTagSubscribe(encryptedIdAndUser, notify) { function toogleTagSubscribe(encryptedIdAndUser, notify) {
var data = {encryptedIdAndUser: encryptedIdAndUser, notify:notify}; var data = { encryptedIdAndUser: encryptedIdAndUser, notify: notify };
var url = webSiteRootURL + 'plugin/VideoTags/subscribe.json.php'; var url = webSiteRootURL + 'plugin/VideoTags/subscribe.json.php';
modal.showPleaseWait(); modal.showPleaseWait();
$.ajax({ $.ajax({
@ -26,4 +26,18 @@ function toogleTagSubscribe(encryptedIdAndUser, notify) {
} }
} }
}); });
} }
function loadVideoTagsLabels() {
if (typeof videoTagsLabels !== 'undefined') {
var videoTagsLabelsElement = $('<div>' + videoTagsLabels + '</div>');
videoTagsLabelsElement.addClass('hideOnPlayerUserInactive');
videoTagsLabelsElement.addClass('pull-right');
videoTagsLabelsElement.addClass('videoTagsLabelsElement');
appendOnPlayer(videoTagsLabelsElement);
} else {
setTimeout(function () { loadVideoTagsLabels(); }, 1000);
}
}
$(function () {
loadVideoTagsLabels();
})

View file

@ -37,4 +37,19 @@ div.mainAreaTags .btn-link b{
} }
div.mainAreaTags .btn-link{ div.mainAreaTags .btn-link{
font-size: 16px; font-size: 16px;
}
#mainVideo .videoTagsLabelsElement{
position: fixed;
right: 10px;
bottom: 100px;
}
#mainVideo .videoTagsLabelsElement > div.text-muted{
margin: 15px;
}
#mainVideo .videoTagsLabelsElement strong.label.text-muted{
display: none;
} }

View file

@ -10,7 +10,7 @@ if ($obj->BigVideo && empty($_GET['showOnly'])) {
if (empty($video)) { if (empty($video)) {
?> ?>
<center> <center>
<img src="<?php echo $global['webSiteRootURL']; ?>view/img/this-video-is-not-available.jpg"> <img src="<?php echo getURL('view/img/this-video-is-not-available.jpg'); ?>">
</center> </center>
<?php <?php
} else { } else {
@ -45,15 +45,16 @@ if ($obj->BigVideo && empty($_GET['showOnly'])) {
} else { } else {
$percent = 40; $percent = 40;
} }
$style = "
padding: 60px 20px 56.25% 20px;
background: -webkit-linear-gradient(left, rgba({$obj->backgroundRGB},1) {$percent}%, rgba({$obj->backgroundRGB},0) 100%);
background: -o-linear-gradient(right, rgba({$obj->backgroundRGB},1) {$percent}%, rgba({$obj->backgroundRGB},0) 100%);
background: linear-gradient(right, rgba({$obj->backgroundRGB},1) {$percent}%, rgba({$obj->backgroundRGB},0) 100%);
background: -moz-linear-gradient(to right, rgba({$obj->backgroundRGB},1) {$percent}%, rgba({$obj->backgroundRGB},0) 100%);
";
?> ?>
<div class="posterDetails" style=" <div class="posterDetails" style="<?php echo $style; ?>">
padding: 60px 20px 56.25% 20px;
background: -webkit-linear-gradient(left, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%);
background: -o-linear-gradient(right, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%);
background: linear-gradient(right, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%);
background: -moz-linear-gradient(to right, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%);
">
<?php <?php
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/BigVideoInfoDetails.php'; include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/BigVideoInfoDetails.php';
?> ?>

View file

@ -50,6 +50,10 @@ TimeLogStart($timeLog3);
$img = $images->posterPortraitThumbs; $img = $images->posterPortraitThumbs;
$cssClass = "posterPortrait"; $cssClass = "posterPortrait";
} }
if(ImagesPlaceHolders::isDefaultImage($img)){
$cssClass .= ' ImagesPlaceHoldersDefaultImage';
}
?> ?>
<div class="carousel-cell" > <div class="carousel-cell" >
<div class="tile"> <div class="tile">
@ -62,9 +66,9 @@ TimeLogStart($timeLog3);
iframe="<?php echo $global['webSiteRootURL']; ?>videoEmbed/<?php echo $value['clean_title']; ?>" iframe="<?php echo $global['webSiteRootURL']; ?>videoEmbed/<?php echo $value['clean_title']; ?>"
ajaxLoad="<?php echo $ajaxLoad; ?>"> ajaxLoad="<?php echo $ajaxLoad; ?>">
<div class="tile__media "> <div class="tile__media ">
<img alt="<?php echo $value['title']; ?>" src="<?php echo $global['webSiteRootURL']; ?>view/img/placeholder-image.png" class="tile__img <?php echo $cssClass; ?> thumbsJPG img img-responsive carousel-cell-image" data-flickity-lazyload="<?php echo $img; ?>" /> <img alt="<?php echo $value['title']; ?>" src="<?php echo ImagesPlaceHolders::getImageLandscape(ImagesPlaceHolders::$RETURN_URL); ?>" class="tile__img <?php echo $cssClass; ?> thumbsJPG img img-responsive carousel-cell-image" data-flickity-lazyload="<?php echo $img; ?>" />
<?php if (!empty($imgGif)) { ?> <?php if (!empty($imgGif)) { ?>
<img style="position: absolute; top: 0; display: none;" src="<?php echo $global['webSiteRootURL']; ?>view/img/placeholder-image.png" alt="<?php echo $value['title']; ?>" id="tile__img thumbsGIF<?php echo $value['id']; ?>" class="thumbsGIF img-responsive img carousel-cell-image" data-flickity-lazyload="<?php echo $imgGif; ?>" /> <img style="position: absolute; top: 0; display: none;" src="<?php echo ImagesPlaceHolders::getImageLandscape(ImagesPlaceHolders::$RETURN_URL); ?>" alt="<?php echo $value['title']; ?>" id="tile__img thumbsGIF<?php echo $value['id']; ?>" class="thumbsGIF img-responsive img carousel-cell-image" data-flickity-lazyload="<?php echo $imgGif; ?>" />
<?php } ?> <?php } ?>
<?php <?php
if ($advancedCustom->paidOnlyShowLabels && $obj->paidOnlyLabelOverPoster) { if ($advancedCustom->paidOnlyShowLabels && $obj->paidOnlyLabelOverPoster) {

View file

@ -65,7 +65,7 @@ TimeLogStart($timeLog6);
</div> </div>
<div class="row"> <div class="row">
<?php <?php
if (!empty($images->posterPortrait) && basename($images->posterPortrait) !== 'notfound_portrait.jpg' && basename($images->posterPortrait) !== 'pdf_portrait.png' && basename($images->posterPortrait) !== 'article_portrait.png') { if (!empty($images->posterPortrait) && !ImagesPlaceHolders::isDefaultImage($images->posterPortrait)) {
?> ?>
<!-- row video 1 --> <!-- row video 1 -->
<div class="col-md-2 col-sm-3 col-xs-4 hidden-xs"> <div class="col-md-2 col-sm-3 col-xs-4 hidden-xs">
@ -74,7 +74,7 @@ TimeLogStart($timeLog6);
</center> </center>
</div> </div>
<?php <?php
} else if (!empty($images->poster) && basename($images->poster) !== 'notfound.jpg' && basename($images->poster) !== 'pdf.png' && basename($images->poster) !== 'article.png') { } else if (!empty($images->poster) && !ImagesPlaceHolders::isDefaultImage($images->poster)) {
?> ?>
<!-- row video 2 --> <!-- row video 2 -->
<div class="col-md-2 col-sm-3 col-xs-4 hidden-xs"> <div class="col-md-2 col-sm-3 col-xs-4 hidden-xs">

View file

@ -2018,6 +2018,19 @@ body.ypt-is-compressed #videoCol {
display: none !important; display: none !important;
} }
.ImagesPlaceHoldersDefaultImage {
filter: grayscale(100%);
background-color: rgba(128, 128, 128, 0.25); /* This is the grey background with 80% transparency */
transition: filter 0.3s ease, background-color 0.3s ease; /* This ensures a smooth transition effect */
}
.thumbsImageContainer:hover .ImagesPlaceHoldersDefaultImage,
.ImagesPlaceHoldersDefaultImage:hover {
filter: grayscale(0%);
background-color: rgba(128, 128, 128, 0.5); /* This is the grey background with 50% transparency on hover */
}
/* /*
#_avideoPageLoader{ #_avideoPageLoader{
display: none !important; display: none !important;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View file

@ -8,7 +8,7 @@ require_once $configFile;
session_write_close(); session_write_close();
// Default image settings // Default image settings
$file = 'video-placeholder-gray.png'; $file = ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_PATH);
$type = 'image/png'; $type = 'image/png';
// Fetch requested image URL // Fetch requested image URL
@ -59,7 +59,7 @@ if (preg_match('/videos\/(.*\/)?(.*)_thumbs(V2)?.jpg/', $imageURL, $matches)) {
} }
// If a 404 image needs to be shown, redirect to it // If a 404 image needs to be shown, redirect to it
if ($file === 'video-placeholder-gray.png' && empty($_GET['notFound'])) { if (empty($_GET['notFound']) && ImagesPlaceHolders::isDefaultImage($file)) {
header("Location: " . getCDN() . "view/img/image404.php?notFound=1"); header("Location: " . getCDN() . "view/img/image404.php?notFound=1");
exit; exit;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 901 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 KiB

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Some files were not shown because too many files have changed in this diff Show more