mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
This commit is contained in:
parent
7c4fc6663f
commit
f91fede5d0
6 changed files with 22 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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']); ?>">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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']); ?>">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue