Upgrade to 3.4.3
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user