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

@@ -1,5 +1,6 @@
<?php
// @codeCoverageIgnoreStart
return [
// cms classes
'asset' => 'Kirby\Cms\Asset',
@@ -58,3 +59,4 @@ return [
'v' => 'Kirby\Toolkit\V',
'xml' => 'Kirby\Toolkit\Xml'
];
// @codeCoverageIgnoreEnd

View File

@@ -26,6 +26,24 @@ return [
return $this->page($id)->delete($this->requestBody('force', false));
}
],
[
'pattern' => 'pages/(:any)/blueprint',
'method' => 'GET',
'action' => function (string $id) {
return $this->page($id)->blueprint();
}
],
[
'pattern' => [
'pages/(:any)/blueprints',
// Deprecated: remove in 3.6.0
'pages/(:any)/children/blueprints',
],
'method' => 'GET',
'action' => function (string $id) {
return $this->page($id)->blueprints($this->requestQuery('section'));
}
],
[
'pattern' => 'pages/(:any)/children',
'method' => 'GET',
@@ -40,13 +58,6 @@ return [
return $this->page($id)->createChild($this->requestBody());
}
],
[
'pattern' => 'pages/(:any)/children/blueprints',
'method' => 'GET',
'action' => function (string $id) {
return $this->page($id)->blueprints($this->requestQuery('section'));
}
],
[
'pattern' => 'pages/(:any)/children/search',
'method' => 'GET|POST',

View File

@@ -32,13 +32,6 @@ return [
return $this->site()->createChild($this->requestBody());
}
],
[
'pattern' => 'site/children/blueprints',
'method' => 'GET',
'action' => function () {
return $this->site()->blueprints($this->requestQuery('section'));
}
],
[
'pattern' => 'site/children/search',
'method' => 'POST',
@@ -46,6 +39,24 @@ return [
return $this->site()->children()->query($this->requestBody());
}
],
[
'pattern' => 'site/blueprint',
'method' => 'GET',
'action' => function () {
return $this->site()->blueprint();
}
],
[
'pattern' => [
'site/blueprints',
// Deprecated: remove in 3.6.0
'site/children/blueprints',
],
'method' => 'GET',
'action' => function () {
return $this->site()->blueprints($this->requestQuery('section'));
}
],
[
'pattern' => 'site/find',
'method' => 'POST',

View File

@@ -84,6 +84,20 @@ return [
return $this->user($id)->avatar()->delete();
}
],
[
'pattern' => 'users/(:any)/blueprint',
'method' => 'GET',
'action' => function (string $id) {
return $this->user($id)->blueprint();
}
],
[
'pattern' => 'users/(:any)/blueprints',
'method' => 'GET',
'action' => function (string $id) {
return $this->user($id)->blueprints($this->requestQuery('section'));
}
],
[
'pattern' => 'users/(:any)/email',
'method' => 'PATCH',
@@ -91,6 +105,15 @@ return [
return $this->user($id)->changeEmail($this->requestBody('email'));
}
],
[
'pattern' => 'users/(:any)/fields/(:any)/(:all?)',
'method' => 'ALL',
'action' => function (string $id, string $fieldName, string $path = null) {
if ($user = $this->user($id)) {
return $this->fieldApi($user, $fieldName, $path);
}
}
],
[
'pattern' => 'users/(:any)/language',
'method' => 'PATCH',
@@ -134,14 +157,4 @@ return [
}
}
],
[
'pattern' => 'users/(:any)/fields/(:any)/(:all?)',
'method' => 'ALL',
'action' => function (string $id, string $fieldName, string $path = null) {
if ($user = $this->user($id)) {
return $this->fieldApi($user, $fieldName, $path);
}
}
]
];

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