Upgrade to 3.5.1

This commit is contained in:
Bastian Allgeier
2021-01-19 12:20:38 +01:00
parent 8f55019e01
commit 99c36fa137
119 changed files with 2973 additions and 3707 deletions

View File

@@ -5,6 +5,7 @@ use Kirby\Cms\Asset;
use Kirby\Cms\Html;
use Kirby\Cms\Response;
use Kirby\Cms\Url;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Toolkit\Escape;
use Kirby\Toolkit\F;
use Kirby\Toolkit\I18n;
@@ -110,7 +111,7 @@ function css($url, $options = null): ?string
}
}
$url = $kirby->component('css')($kirby, $url, $options);
$url = ($kirby->component('css'))($kirby, $url, $options);
$url = Url::to($url);
$attr = array_merge((array)$options, [
'href' => $url,
@@ -148,7 +149,7 @@ if (function_exists('dump') === false) {
function dump($variable, bool $echo = true): string
{
$kirby = App::instance();
return $kirby->component('dump')($kirby, $variable, $echo);
return ($kirby->component('dump'))($kirby, $variable, $echo);
}
}
@@ -382,7 +383,7 @@ function js($url, $options = null): ?string
}
}
$url = $kirby->component('js')($kirby, $url, $options);
$url = ($kirby->component('js'))($kirby, $url, $options);
$url = Url::to($url);
$attr = array_merge((array)$options, ['src' => $url]);
@@ -623,7 +624,7 @@ function site()
function size($value): int
{
if (is_numeric($value)) {
return $value;
return (int)$value;
}
if (is_string($value)) {
@@ -643,6 +644,8 @@ function size($value): int
return $value->count();
}
}
throw new InvalidArgumentException('Could not determine the size of the given value');
}
/**
@@ -744,9 +747,9 @@ function tc($key, int $count)
*
* @param string $date
* @param int $step array of `unit` and `size` to round to nearest
* @return string|null
* @return int|null
*/
function timestamp(string $date = null, $step = null): ?string
function timestamp(string $date = null, $step = null): ?int
{
if (V::date($date) === false) {
return null;
@@ -791,7 +794,7 @@ function timestamp(string $date = null, $step = null): ?string
$parts[$part] = 0;
}
return strtotime(
$timestamp = strtotime(
$parts['year'] . '-' .
str_pad($parts['month'], 2, 0, STR_PAD_LEFT) . '-' .
str_pad($parts['day'], 2, 0, STR_PAD_LEFT) . ' ' .
@@ -799,6 +802,9 @@ function timestamp(string $date = null, $step = null): ?string
str_pad($parts['minute'], 2, 0, STR_PAD_LEFT) . ':' .
str_pad($parts['second'], 2, 0, STR_PAD_LEFT)
);
// on error, convert `false` into `null`
return $timestamp ? $timestamp : null;
}
/**