Upgrade to 3.4.3

This commit is contained in:
Bastian Allgeier
2020-09-15 10:25:09 +02:00
parent 54b9ba3047
commit d8e797dd9b
108 changed files with 1750 additions and 523 deletions

View File

@@ -601,36 +601,7 @@ function r($condition, $value, $alternative = null)
}
/**
* Rounds the minutes of the given date
* by the defined step
*
* @param string $date
* @param int $step
* @return string|null
*/
function timestamp(string $date = null, int $step = null): ?string
{
if (V::date($date) === false) {
return null;
}
$date = strtotime($date);
if ($step === null) {
return $date;
}
$hours = date('H', $date);
$minutes = date('i', $date);
$minutes = floor($minutes / $step) * $step;
$minutes = str_pad($minutes, 2, 0, STR_PAD_LEFT);
$date = date('Y-m-d', $date) . ' ' . $hours . ':' . $minutes;
return strtotime($date);
}
/**
* Returns the currrent site object
* Returns the current site object
*
* @return \Kirby\Cms\Site
*/
@@ -767,6 +738,35 @@ function tc($key, int $count)
return I18n::translateCount($key, $count);
}
/**
* Rounds the minutes of the given date
* by the defined step
*
* @param string $date
* @param int $step
* @return string|null
*/
function timestamp(string $date = null, int $step = null): ?string
{
if (V::date($date) === false) {
return null;
}
$date = strtotime($date);
if ($step === null) {
return $date;
}
$hours = date('H', $date);
$minutes = date('i', $date);
$minutes = floor($minutes / $step) * $step;
$minutes = str_pad($minutes, 2, 0, STR_PAD_LEFT);
$date = date('Y-m-d', $date) . ' ' . $hours . ':' . $minutes;
return strtotime($date);
}
/**
* Translate by key and then replace
* placeholders in the text