1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
DanieL 2022-11-11 11:41:10 -03:00
parent 7c4fc6663f
commit f91fede5d0
6 changed files with 22 additions and 10 deletions

View file

@ -138,9 +138,14 @@ function get_max_file_size() {
return humanFileSize(file_upload_max_size());
}
function humanTiming($time, $precision = 0, $useDatabaseTime = true) {
function humanTiming($time, $precision = 0, $useDatabaseTime = true, $addAgo = false) {
$time = secondsIntervalFromNow($time, $useDatabaseTime);
return secondsToHumanTiming($time, $precision);
if($addAgo){
$addAgo = $time - time();
}
return secondsToHumanTiming($time, $precision, $addAgo);
}
/**
@ -171,7 +176,7 @@ function humanTimingAfterwards($time, $precision = 0, $useDatabaseTime = true) {
return __('Coming in') . ' ' . secondsToHumanTiming($time, $precision);
}
function secondsToHumanTiming($time, $precision = 0) {
function secondsToHumanTiming($time, $precision = 0, $addAgo = false) {
if (empty($time)) {
return __("Now");
}
@ -223,8 +228,15 @@ function secondsToHumanTiming($time, $precision = 0) {
$text .= ' ' . secondsToHumanTiming($rest, $precision - 1);
}
}
$return = $numberOfUnits . ' ' . $text;
if(!empty($addAgo) && $addAgo<0){
$return = sprintf(__('%s Ago'), $return);
}
return $return;
return $numberOfUnits . ' ' . $text;
}
}

View file

@ -280,7 +280,7 @@ function createGallerySectionVideo($video, $crc = "", $get = array(), $ignoreAds
<?php
}
}
$humanTiming = humanTiming(strtotime($video['videoCreation'])) . " " . __('ago');
$humanTiming = humanTiming(strtotime($video['videoCreation']), 0, true,true);
?>
<div data-toggle="tooltip" class="videoHumanTime" title="<?php echo $humanTiming; ?>">
<i class="far fa-clock"></i>

View file

@ -170,7 +170,7 @@ if ($obj->BigVideo && empty($_GET['showOnly'])) {
?>
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($videoRow['videoCreation'])), " ", __('ago'); ?>
<?php echo humanTiming(strtotime($videoRow['videoCreation']), 0, true,true); ?>
</div>
<div>
<a href="<?php echo User::getChannelLink($videoRow['users_id']); ?>">

View file

@ -168,7 +168,7 @@ unset($_POST['current']);
?>
</div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($serie['created'])), " ", __('ago'); ?>
<?php echo humanTiming(strtotime($serie['created']), 0, true,true); ?>
<?php
if (!empty($serie['trailer1'])) {
@ -237,7 +237,7 @@ unset($_POST['current']);
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($value['videoCreation'])), " ", __('ago'); ?>
<?php echo humanTiming(strtotime($value['videoCreation']), 0, true,true); ?>
</div>
<div>
<i class="fa fa-user"></i>

View file

@ -174,7 +174,7 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($value['videoCreation'])), " ", __('ago'); ?>
<?php echo humanTiming(strtotime($value['videoCreation']), 0, true,true); ?>
</div>
<div>
<i class="fa fa-user"></i>

View file

@ -116,7 +116,7 @@ $metaDescription = __("Trending");
} ?>
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($value['videoCreation'])), " ", __('ago'); ?>
<?php echo humanTiming(strtotime($value['videoCreation']), 0, true,true); ?>
</div>
<div>
<a href="<?php echo User::getChannelLink($value['users_id']); ?>">