Update config.php

This commit is contained in:
Namhyeon Go 2019-12-05 15:59:52 +09:00 committed by GitHub
parent 3790b69a3e
commit 65ba89198f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,7 +89,27 @@ if(!check_function_exists("get_current_timestamp")) {
// adjust time
if(!array_key_empty("adjust", $options)) {
$timestamp = strtotime($options['adjust'], $timestamp);
$units = array(
"s" => array( 1, "second", "seconds"),
"m" => array( 60, "minute", "minutes"),
"h" => array( 120, "hour", "hours" ),
"d" => array(86400, "day", "days" )
);
$adjust = trim($options['adjust']);
$_adjust = "";
if(strlen($adjust) > 0) {
$_L = intval(substr($adjust, 0, -1));
$_R = substr($adjust, -1);
if(array_key_exists($_R, $units)) {
if(abs($_L) > 1) {
$_adjust = sprintf("%s %s", $_L, $units[$_R][2]);
} else {
$_adjust = sprintf("%s %s", $_L, $units[$_R][1]);
}
}
}
$timestamp = strtotime($_adjust, $timestamp);
}
return $timestamp;