Upgrade to 3.4.4

This commit is contained in:
Bastian Allgeier
2020-10-06 10:23:02 +02:00
parent c091f04115
commit 0b80361a79
53 changed files with 976 additions and 83 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "getkirby/cms", "name": "getkirby/cms",
"description": "The Kirby 3 core", "description": "The Kirby 3 core",
"version": "3.4.3", "version": "3.4.4",
"license": "proprietary", "license": "proprietary",
"keywords": ["kirby", "cms", "core"], "keywords": ["kirby", "cms", "core"],
"homepage": "https://getkirby.com", "homepage": "https://getkirby.com",

2
kirby/composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "3c8b128ea6de49c70f9ec3056bcb18a2", "content-hash": "b85ce02787ff0e052a3cc7a01c2daa91",
"packages": [ "packages": [
{ {
"name": "claviska/simpleimage", "name": "claviska/simpleimage",

View File

@@ -48,7 +48,7 @@ return [
'pattern' => 'pages/(:any)/children', 'pattern' => 'pages/(:any)/children',
'method' => 'GET', 'method' => 'GET',
'action' => function (string $id) { 'action' => function (string $id) {
return $this->page($id)->children(); return $this->pages($id, $this->requestQuery('status'));
} }
], ],
[ [
@@ -62,13 +62,7 @@ return [
'pattern' => 'pages/(:any)/children/search', 'pattern' => 'pages/(:any)/children/search',
'method' => 'GET|POST', 'method' => 'GET|POST',
'action' => function (string $id) { 'action' => function (string $id) {
$pages = $this->page($id)->children(); return $this->searchPages($id);
if ($this->requestMethod() === 'GET') {
return $pages->search($this->requestQuery('q'));
} else {
return $pages->query($this->requestBody());
}
} }
], ],
[ [

View File

@@ -22,7 +22,7 @@ return [
'pattern' => 'site/children', 'pattern' => 'site/children',
'method' => 'GET', 'method' => 'GET',
'action' => function () { 'action' => function () {
return $this->site()->children(); return $this->pages(null, $this->requestQuery('status'));
} }
], ],
[ [
@@ -34,9 +34,9 @@ return [
], ],
[ [
'pattern' => 'site/children/search', 'pattern' => 'site/children/search',
'method' => 'POST', 'method' => 'GET|POST',
'action' => function () { 'action' => function () {
return $this->site()->children()->query($this->requestBody()); return $this->searchPages();
} }
], ],
[ [

View File

@@ -81,8 +81,8 @@ return [
// create url and root // create url and root
$mediaRoot = dirname($file->mediaRoot()); $mediaRoot = dirname($file->mediaRoot());
$dst = $mediaRoot . '/{{ name }}{{ attributes }}.{{ extension }}'; $template = $mediaRoot . '/{{ name }}{{ attributes }}.{{ extension }}';
$thumbRoot = (new Filename($file->root(), $dst, $options))->toString(); $thumbRoot = (new Filename($file->root(), $template, $options))->toString();
$thumbName = basename($thumbRoot); $thumbName = basename($thumbRoot);
$job = $mediaRoot . '/.jobs/' . $thumbName . '.json'; $job = $mediaRoot . '/.jobs/' . $thumbName . '.json';
@@ -306,14 +306,14 @@ return [
* *
* @param \Kirby\Cms\App $kirby Kirby instance * @param \Kirby\Cms\App $kirby Kirby instance
* @param string $src The root of the original file * @param string $src The root of the original file
* @param string $dst The root to the desired destination * @param string $template The template for the root to the desired destination
* @param array $options All thumb options that should be applied: `width`, `height`, `crop`, `blur`, `grayscale` * @param array $options All thumb options that should be applied: `width`, `height`, `crop`, `blur`, `grayscale`
* @return string * @return string
*/ */
'thumb' => function (App $kirby, string $src, string $dst, array $options): string { 'thumb' => function (App $kirby, string $src, string $template, array $options): string {
$darkroom = Darkroom::factory(option('thumbs.driver', 'gd'), option('thumbs', [])); $darkroom = Darkroom::factory(option('thumbs.driver', 'gd'), option('thumbs', []));
$options = $darkroom->preprocess($src, $options); $options = $darkroom->preprocess($src, $options);
$root = (new Filename($src, $dst, $options))->toString(); $root = (new Filename($src, $template, $options))->toString();
F::copy($src, $root, true); F::copy($src, $root, true);
$darkroom->process($root, $options); $darkroom->process($root, $options);

View File

@@ -136,30 +136,34 @@ function deprecated(string $message): bool
return false; return false;
} }
/** if (function_exists('dump') === false) {
* Simple object and variable dumper /**
* to help with debugging. * Simple object and variable dumper
* * to help with debugging.
* @param mixed $variable *
* @param bool $echo * @param mixed $variable
* @return string * @param bool $echo
*/ * @return string
function dump($variable, bool $echo = true): string */
{ function dump($variable, bool $echo = true): string
$kirby = App::instance(); {
return $kirby->component('dump')($kirby, $variable, $echo); $kirby = App::instance();
return $kirby->component('dump')($kirby, $variable, $echo);
}
} }
/** if (function_exists('e') === false) {
* Smart version of echo with an if condition as first argument /**
* * Smart version of echo with an if condition as first argument
* @param mixed $condition *
* @param mixed $value The string to be echoed if the condition is true * @param mixed $condition
* @param mixed $alternative An alternative string which should be echoed when the condition is false * @param mixed $value The string to be echoed if the condition is true
*/ * @param mixed $alternative An alternative string which should be echoed when the condition is false
function e($condition, $value, $alternative = null) */
{ function e($condition, $value, $alternative = null)
echo r($condition, $value, $alternative); {
echo r($condition, $value, $alternative);
}
} }
/** /**

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Страницата \"{slug}\" не може да бъде намерена", "error.page.notFound": "Страницата \"{slug}\" не може да бъде намерена",
"error.page.num.invalid": "Моля въведете валидно число за сортиране. Числата не трябва да са негативни.", "error.page.num.invalid": "Моля въведете валидно число за сортиране. Числата не трябва да са негативни.",
"error.page.slug.invalid": "Моля въведете валиден URL префикс", "error.page.slug.invalid": "Моля въведете валиден URL префикс",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Страницата \"{slug}\" не може да бъде сортирана", "error.page.sort.permission": "Страницата \"{slug}\" не може да бъде сортирана",
"error.page.status.invalid": "Моля изберете валиден статус на страницата", "error.page.status.invalid": "Моля изберете валиден статус на страницата",
"error.page.undefined": "\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0442\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435 \u0434\u0430 \u0431\u044a\u0434\u0435 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0430", "error.page.undefined": "\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0442\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435 \u0434\u0430 \u0431\u044a\u0434\u0435 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0430",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Отвори", "open": "Отвори",
"options": "Options", "options": "Options",
"options.none": "No options",
"orientation": "Ориентация", "orientation": "Ориентация",
"orientation.landscape": "Пейзаж", "orientation.landscape": "Пейзаж",
@@ -344,6 +346,9 @@
"save": "\u0417\u0430\u043f\u0438\u0448\u0438", "save": "\u0417\u0430\u043f\u0438\u0448\u0438",
"search": "Търси", "search": "Търси",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "The section is required", "section.required": "The section is required",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "La pàgina \"{slug}\" no s'ha trobat", "error.page.notFound": "La pàgina \"{slug}\" no s'ha trobat",
"error.page.num.invalid": "Si us plau, introdueix un número d 'ordenació vàlid. Els números no poden ser negatius.", "error.page.num.invalid": "Si us plau, introdueix un número d 'ordenació vàlid. Els números no poden ser negatius.",
"error.page.slug.invalid": "Introduïu un prefix d'URL vàlid", "error.page.slug.invalid": "Introduïu un prefix d'URL vàlid",
"error.page.slug.maxlength": "La longitud del nom ha de tenir menys de caràcters \"{length}\"",
"error.page.sort.permission": "La pàgina \"{slug}\" no es pot ordenar", "error.page.sort.permission": "La pàgina \"{slug}\" no es pot ordenar",
"error.page.status.invalid": "Si us plau, estableix un estat de pàgina vàlid", "error.page.status.invalid": "Si us plau, estableix un estat de pàgina vàlid",
"error.page.undefined": "La p\u00e0gina no s'ha trobat", "error.page.undefined": "La p\u00e0gina no s'ha trobat",
@@ -288,6 +289,7 @@
"on": "encès", "on": "encès",
"open": "Obrir", "open": "Obrir",
"options": "Opcions", "options": "Opcions",
"options.none": "Sense opcions",
"orientation": "Orientació", "orientation": "Orientació",
"orientation.landscape": "Horitzontal", "orientation.landscape": "Horitzontal",
@@ -344,6 +346,9 @@
"save": "Desar", "save": "Desar",
"search": "Cercar", "search": "Cercar",
"search.min": "Introduïu {min} caràcters per cercar",
"search.all": "Mostrar tots",
"search.results.none": "Sense resultats",
"section.required": "La secció és obligatòria", "section.required": "La secció és obligatòria",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Siden kunne ikke findes", "error.page.notFound": "Siden kunne ikke findes",
"error.page.num.invalid": "Indtast venligst et gyldigt sorteringsnummer. Nummeret kan ikke være negativt.", "error.page.num.invalid": "Indtast venligst et gyldigt sorteringsnummer. Nummeret kan ikke være negativt.",
"error.page.slug.invalid": "Indtast venligst en gyldig URL prefix", "error.page.slug.invalid": "Indtast venligst en gyldig URL prefix",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Siden \"{slug}\" kan ikke sorteres", "error.page.sort.permission": "Siden \"{slug}\" kan ikke sorteres",
"error.page.status.invalid": "Sæt venligst en gyldig status for siden", "error.page.status.invalid": "Sæt venligst en gyldig status for siden",
"error.page.undefined": "Siden kunne ikke findes", "error.page.undefined": "Siden kunne ikke findes",
@@ -288,6 +289,7 @@
"on": "Tænd", "on": "Tænd",
"open": "Åben", "open": "Åben",
"options": "Indstillinger", "options": "Indstillinger",
"options.none": "No options",
"orientation": "Orientering", "orientation": "Orientering",
"orientation.landscape": "Landskab", "orientation.landscape": "Landskab",
@@ -344,6 +346,9 @@
"save": "Gem", "save": "Gem",
"search": "Søg", "search": "Søg",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "Sektionen er påkrævet", "section.required": "Sektionen er påkrævet",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Δεν ήταν δυνατή η εύρεση της σελίδας \"{slug}\"", "error.page.notFound": "Δεν ήταν δυνατή η εύρεση της σελίδας \"{slug}\"",
"error.page.num.invalid": "Παρακαλώ εισάγετε έναν έγκυρο αριθμό ταξινόμησης. Οι αριθμοί δεν μπορεί να είναι αρνητικοί.", "error.page.num.invalid": "Παρακαλώ εισάγετε έναν έγκυρο αριθμό ταξινόμησης. Οι αριθμοί δεν μπορεί να είναι αρνητικοί.",
"error.page.slug.invalid": "Παρακαλώ εισάγετε ένα έγκυρο πρόθεμα διεύθυνσης URL", "error.page.slug.invalid": "Παρακαλώ εισάγετε ένα έγκυρο πρόθεμα διεύθυνσης URL",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Δεν είναι δυνατή η ταξινόμηση της σελίδας \"{slug}\"", "error.page.sort.permission": "Δεν είναι δυνατή η ταξινόμηση της σελίδας \"{slug}\"",
"error.page.status.invalid": "Ορίστε μια έγκυρη κατάσταση σελίδας", "error.page.status.invalid": "Ορίστε μια έγκυρη κατάσταση σελίδας",
"error.page.undefined": "Δεν ήταν δυνατή η εύρεση της σελίδας", "error.page.undefined": "Δεν ήταν δυνατή η εύρεση της σελίδας",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Άνοιγμα", "open": "Άνοιγμα",
"options": "Eπιλογές", "options": "Eπιλογές",
"options.none": "No options",
"orientation": "Προσανατολισμός", "orientation": "Προσανατολισμός",
"orientation.landscape": "Οριζόντιος", "orientation.landscape": "Οριζόντιος",
@@ -344,6 +346,9 @@
"save": "\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7", "save": "\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7",
"search": "Αναζήτηση", "search": "Αναζήτηση",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "The section is required", "section.required": "The section is required",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "La página \"{slug}\" no se encuentra", "error.page.notFound": "La página \"{slug}\" no se encuentra",
"error.page.num.invalid": "Por favor, introduce un número de posición válido. Los números no deben ser negativos.", "error.page.num.invalid": "Por favor, introduce un número de posición válido. Los números no deben ser negativos.",
"error.page.slug.invalid": "Por favor ingresa un prefijo de URL válido", "error.page.slug.invalid": "Por favor ingresa un prefijo de URL válido",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "La página \"{slug}\" no se puede ordenar", "error.page.sort.permission": "La página \"{slug}\" no se puede ordenar",
"error.page.status.invalid": "Por favor, establece una estado de página válido", "error.page.status.invalid": "Por favor, establece una estado de página válido",
"error.page.undefined": "La p\u00e1gina no fue encontrada", "error.page.undefined": "La p\u00e1gina no fue encontrada",
@@ -288,6 +289,7 @@
"on": "Encendido", "on": "Encendido",
"open": "Abrir", "open": "Abrir",
"options": "Opciones", "options": "Opciones",
"options.none": "No options",
"orientation": "Orientación", "orientation": "Orientación",
"orientation.landscape": "Paisaje", "orientation.landscape": "Paisaje",
@@ -344,6 +346,9 @@
"save": "Guardar", "save": "Guardar",
"search": "Buscar", "search": "Buscar",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "Esta sección es requerida", "section.required": "Esta sección es requerida",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "La página \"{slug}\" no puede ser encontrada", "error.page.notFound": "La página \"{slug}\" no puede ser encontrada",
"error.page.num.invalid": "Por favor, introduzca un número válido. Estos no deben ser negativos.", "error.page.num.invalid": "Por favor, introduzca un número válido. Estos no deben ser negativos.",
"error.page.slug.invalid": "Por favor ingrese un prefijo de URL válido", "error.page.slug.invalid": "Por favor ingrese un prefijo de URL válido",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "La página \"{slug}\" no se puede ordenar", "error.page.sort.permission": "La página \"{slug}\" no se puede ordenar",
"error.page.status.invalid": "Por favor, establezca un estado de página válido", "error.page.status.invalid": "Por favor, establezca un estado de página válido",
"error.page.undefined": "La página no se puede encontrar", "error.page.undefined": "La página no se puede encontrar",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Abrir", "open": "Abrir",
"options": "Opciones", "options": "Opciones",
"options.none": "No options",
"orientation": "Orientación", "orientation": "Orientación",
"orientation.landscape": "Paisaje", "orientation.landscape": "Paisaje",
@@ -344,6 +346,9 @@
"save": "Guardar", "save": "Guardar",
"search": "Buscar", "search": "Buscar",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "The section is required", "section.required": "The section is required",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "صفحه مورد نظر با آدرس «{slug}» پیدا نشد.", "error.page.notFound": "صفحه مورد نظر با آدرس «{slug}» پیدا نشد.",
"error.page.num.invalid": "لطفا شماره ترتیب را بدرستی وارد نمایید. اعداد نباید منفی باشند.", "error.page.num.invalid": "لطفا شماره ترتیب را بدرستی وارد نمایید. اعداد نباید منفی باشند.",
"error.page.slug.invalid": "لطفا یک پیشوند Url صحیح وارد کنید", "error.page.slug.invalid": "لطفا یک پیشوند Url صحیح وارد کنید",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "امکان مرتب‌سازی «{slug}» نیست", "error.page.sort.permission": "امکان مرتب‌سازی «{slug}» نیست",
"error.page.status.invalid": "لطفا وضعیت صحیحی برای صفحه انتخاب کنید", "error.page.status.invalid": "لطفا وضعیت صحیحی برای صفحه انتخاب کنید",
"error.page.undefined": "صفحه مورد نظر پیدا نشد", "error.page.undefined": "صفحه مورد نظر پیدا نشد",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "بازکردن", "open": "بازکردن",
"options": "گزینه‌ها", "options": "گزینه‌ها",
"options.none": "No options",
"orientation": "جهت", "orientation": "جهت",
"orientation.landscape": "افقی", "orientation.landscape": "افقی",
@@ -344,6 +346,9 @@
"save": "\u0630\u062e\u06cc\u0631\u0647", "save": "\u0630\u062e\u06cc\u0631\u0647",
"search": "جستجو", "search": "جستجو",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "The section is required", "section.required": "The section is required",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Sivua \"{slug}\" ei löytynyt", "error.page.notFound": "Sivua \"{slug}\" ei löytynyt",
"error.page.num.invalid": "Anna kelpaava järjestysnumero. Numero ei voi olla negatiivinen.", "error.page.num.invalid": "Anna kelpaava järjestysnumero. Numero ei voi olla negatiivinen.",
"error.page.slug.invalid": "Anna kelpaava URL-etuliite", "error.page.slug.invalid": "Anna kelpaava URL-etuliite",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Sivua \"{slug}\" ei voi järjestellä", "error.page.sort.permission": "Sivua \"{slug}\" ei voi järjestellä",
"error.page.status.invalid": "Aseta kelvollinen sivun tila", "error.page.status.invalid": "Aseta kelvollinen sivun tila",
"error.page.undefined": "Sivua ei l\u00f6ytynyt", "error.page.undefined": "Sivua ei l\u00f6ytynyt",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Avaa", "open": "Avaa",
"options": "Asetukset", "options": "Asetukset",
"options.none": "No options",
"orientation": "Suunta", "orientation": "Suunta",
"orientation.landscape": "Vaakasuuntainen", "orientation.landscape": "Vaakasuuntainen",
@@ -344,6 +346,9 @@
"save": "Tallenna", "save": "Tallenna",
"search": "Haku", "search": "Haku",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "Osio on pakollinen", "section.required": "Osio on pakollinen",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "La page « {slug} » na pu être trouvée", "error.page.notFound": "La page « {slug} » na pu être trouvée",
"error.page.num.invalid": "Veuillez saisir un numéro de position valide. Les numéros ne doivent pas être négatifs.", "error.page.num.invalid": "Veuillez saisir un numéro de position valide. Les numéros ne doivent pas être négatifs.",
"error.page.slug.invalid": "Veuillez saisir un préfixe dURL valide", "error.page.slug.invalid": "Veuillez saisir un préfixe dURL valide",
"error.page.slug.maxlength": "Lidentifiant dURL doit faire moins de \"{length}\" caractères",
"error.page.sort.permission": "La page « {slug} » ne peut être réordonnée", "error.page.sort.permission": "La page « {slug} » ne peut être réordonnée",
"error.page.status.invalid": "Veuillez choisir un statut de page valide", "error.page.status.invalid": "Veuillez choisir un statut de page valide",
"error.page.undefined": "La page na pu être trouvée", "error.page.undefined": "La page na pu être trouvée",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Ouvrir", "open": "Ouvrir",
"options": "Options", "options": "Options",
"options.none": "Pas doptions",
"orientation": "Orientation", "orientation": "Orientation",
"orientation.landscape": "Paysage", "orientation.landscape": "Paysage",
@@ -344,6 +346,9 @@
"save": "Enregistrer", "save": "Enregistrer",
"search": "Rechercher", "search": "Rechercher",
"search.min": "Entrez {min} caractères pour rechercher",
"search.all": "Tout afficher",
"search.results.none": "Pas de résultats",
"section.required": "Cette section est obligatoire", "section.required": "Cette section est obligatoire",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Az oldal nem tal\u00e1lhat\u00f3", "error.page.notFound": "Az oldal nem tal\u00e1lhat\u00f3",
"error.page.num.invalid": "Kérlek megfelelő oldalszámozást adj meg. Negatív szám itt nem használható.", "error.page.num.invalid": "Kérlek megfelelő oldalszámozást adj meg. Negatív szám itt nem használható.",
"error.page.slug.invalid": "Kérlek megfelelő URL-előtagot adj meg", "error.page.slug.invalid": "Kérlek megfelelő URL-előtagot adj meg",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "A(z) \"{slug}\" oldal nem illeszthető a sorrendbe", "error.page.sort.permission": "A(z) \"{slug}\" oldal nem illeszthető a sorrendbe",
"error.page.status.invalid": "Kérlek add meg a megfelelő oldalstátuszt", "error.page.status.invalid": "Kérlek add meg a megfelelő oldalstátuszt",
"error.page.undefined": "Az oldal nem tal\u00e1lhat\u00f3", "error.page.undefined": "Az oldal nem tal\u00e1lhat\u00f3",
@@ -288,6 +289,7 @@
"on": "be", "on": "be",
"open": "Megnyitás", "open": "Megnyitás",
"options": "Beállítások", "options": "Beállítások",
"options.none": "No options",
"orientation": "Tájolás", "orientation": "Tájolás",
"orientation.landscape": "Fekvő", "orientation.landscape": "Fekvő",
@@ -344,6 +346,9 @@
"save": "Ment\u00e9s", "save": "Ment\u00e9s",
"search": "Keresés", "search": "Keresés",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "The section is required", "section.required": "The section is required",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "La pagina \"{slug}\" non è stata trovata", "error.page.notFound": "La pagina \"{slug}\" non è stata trovata",
"error.page.num.invalid": "Inserisci un numero di ordinamento valido. I numeri non devono essere negativi", "error.page.num.invalid": "Inserisci un numero di ordinamento valido. I numeri non devono essere negativi",
"error.page.slug.invalid": "Inserisci un prefisso URL valido", "error.page.slug.invalid": "Inserisci un prefisso URL valido",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "La pagina \"{slug}\" non può essere ordinata", "error.page.sort.permission": "La pagina \"{slug}\" non può essere ordinata",
"error.page.status.invalid": "Imposta uno stato valido per la pagina", "error.page.status.invalid": "Imposta uno stato valido per la pagina",
"error.page.undefined": "La pagina non \u00e8 stata trovata", "error.page.undefined": "La pagina non \u00e8 stata trovata",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Apri", "open": "Apri",
"options": "Opzioni", "options": "Opzioni",
"options.none": "No options",
"orientation": "Orientamento", "orientation": "Orientamento",
"orientation.landscape": "Panorama", "orientation.landscape": "Panorama",
@@ -344,6 +346,9 @@
"save": "Salva", "save": "Salva",
"search": "Cerca", "search": "Cerca",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "The section is required", "section.required": "The section is required",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "페이지({slug})가 없습니다.", "error.page.notFound": "페이지({slug})가 없습니다.",
"error.page.num.invalid": "올바른 정수를 입력하세요.", "error.page.num.invalid": "올바른 정수를 입력하세요.",
"error.page.slug.invalid": "올바른 접두사를 입력하세요.", "error.page.slug.invalid": "올바른 접두사를 입력하세요.",
"error.page.slug.maxlength": "{length}자 이하로 지정하세요.",
"error.page.sort.permission": "페이지({slug})를 정렬할 수 없습니다.", "error.page.sort.permission": "페이지({slug})를 정렬할 수 없습니다.",
"error.page.status.invalid": "올바른 상태를 설정하세요.", "error.page.status.invalid": "올바른 상태를 설정하세요.",
"error.page.undefined": "\ud398\uc774\uc9c0\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.", "error.page.undefined": "\ud398\uc774\uc9c0\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.",
@@ -179,7 +180,7 @@
"error.validation.notin": "{notIn}에 포함된 값은 입력할 수 없습니다.", "error.validation.notin": "{notIn}에 포함된 값은 입력할 수 없습니다.",
"error.validation.option": "올바른 옵션을 선택하세요.", "error.validation.option": "올바른 옵션을 선택하세요.",
"error.validation.num": "올바른 숫자를 입력하세요.", "error.validation.num": "올바른 숫자를 입력하세요.",
"error.validation.required": "아무거나 입력하세요.", "error.validation.required": "해당 항목을 확인하세요.",
"error.validation.same": "다음을 입력하세요: {other}", "error.validation.same": "다음을 입력하세요: {other}",
"error.validation.size": "값의 크기는 다음과 같아야 합니다: {size}", "error.validation.size": "값의 크기는 다음과 같아야 합니다: {size}",
"error.validation.startswith": "값은 다음으로 시작해야 합니다: {start}", "error.validation.startswith": "값은 다음으로 시작해야 합니다: {start}",
@@ -288,6 +289,7 @@
"on": "켬", "on": "켬",
"open": "열기", "open": "열기",
"options": "옵션", "options": "옵션",
"options.none": "옵션이 없습니다.",
"orientation": "비율", "orientation": "비율",
"orientation.landscape": "가로로 긴 사각형", "orientation.landscape": "가로로 긴 사각형",
@@ -344,6 +346,9 @@
"save": "\uc800\uc7a5", "save": "\uc800\uc7a5",
"search": "검색", "search": "검색",
"search.min": "{min}자 이상 입력하세요.",
"search.all": "모두 보기",
"search.results.none": "해당하는 결과가 없습니다.",
"section.required": "섹션이 필요합니다.", "section.required": "섹션이 필요합니다.",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Puslapis \"{slug}\" nerastas", "error.page.notFound": "Puslapis \"{slug}\" nerastas",
"error.page.num.invalid": "Įrašykite teisingą eiliškumo numerį. Numeris negali būti neigiamas.", "error.page.num.invalid": "Įrašykite teisingą eiliškumo numerį. Numeris negali būti neigiamas.",
"error.page.slug.invalid": "Įrašykite teisingą URL prefiksą", "error.page.slug.invalid": "Įrašykite teisingą URL prefiksą",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Puslapiui \"{slug}\" negalima pakeisti eiliškumo", "error.page.sort.permission": "Puslapiui \"{slug}\" negalima pakeisti eiliškumo",
"error.page.status.invalid": "Nustatykite teisingą puslapio statusą", "error.page.status.invalid": "Nustatykite teisingą puslapio statusą",
"error.page.undefined": "Puslapis nerastas", "error.page.undefined": "Puslapis nerastas",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Atidaryti", "open": "Atidaryti",
"options": "Pasirinkimai", "options": "Pasirinkimai",
"options.none": "No options",
"orientation": "Orientacija", "orientation": "Orientacija",
"orientation.landscape": "Horizontali", "orientation.landscape": "Horizontali",
@@ -344,6 +346,9 @@
"save": "Išsaugoti", "save": "Išsaugoti",
"search": "Ieškoti", "search": "Ieškoti",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "Sekcija privaloma", "section.required": "Sekcija privaloma",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Siden \"{slug}\" ble ikke funnet", "error.page.notFound": "Siden \"{slug}\" ble ikke funnet",
"error.page.num.invalid": "Vennligst skriv inn et gyldig sorteringsnummer. Tallet må ikke være negativt.", "error.page.num.invalid": "Vennligst skriv inn et gyldig sorteringsnummer. Tallet må ikke være negativt.",
"error.page.slug.invalid": "Vennligst skriv inn en gyldig URL-prefiks", "error.page.slug.invalid": "Vennligst skriv inn en gyldig URL-prefiks",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Siden \"{slug}\" kan ikke sorteres", "error.page.sort.permission": "Siden \"{slug}\" kan ikke sorteres",
"error.page.status.invalid": "Vennligst angi en gyldig sidestatus", "error.page.status.invalid": "Vennligst angi en gyldig sidestatus",
"error.page.undefined": "Siden kunne ikke bli funnet", "error.page.undefined": "Siden kunne ikke bli funnet",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Åpne", "open": "Åpne",
"options": "Alternativer", "options": "Alternativer",
"options.none": "No options",
"orientation": "Orientering", "orientation": "Orientering",
"orientation.landscape": "Landskap", "orientation.landscape": "Landskap",
@@ -344,6 +346,9 @@
"save": "Lagre", "save": "Lagre",
"search": "Søk", "search": "Søk",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "The section is required", "section.required": "The section is required",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "De pagina \"{slug}\" kan niet worden gevonden", "error.page.notFound": "De pagina \"{slug}\" kan niet worden gevonden",
"error.page.num.invalid": "Vul een geldig sorteer-cijfer in. Het cijfer mag niet negatief zijn", "error.page.num.invalid": "Vul een geldig sorteer-cijfer in. Het cijfer mag niet negatief zijn",
"error.page.slug.invalid": "Vul een geldige URL-prefix in", "error.page.slug.invalid": "Vul een geldige URL-prefix in",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "De pagina \"{slug}\" kan niet worden gesorteerd", "error.page.sort.permission": "De pagina \"{slug}\" kan niet worden gesorteerd",
"error.page.status.invalid": "Zorg voor een geldige paginastatus", "error.page.status.invalid": "Zorg voor een geldige paginastatus",
"error.page.undefined": "De pagina kan niet worden gevonden", "error.page.undefined": "De pagina kan niet worden gevonden",
@@ -288,6 +289,7 @@
"on": "aan", "on": "aan",
"open": "Open", "open": "Open",
"options": "Opties", "options": "Opties",
"options.none": "No options",
"orientation": "Oriëntatie", "orientation": "Oriëntatie",
"orientation.landscape": "Liggend", "orientation.landscape": "Liggend",
@@ -344,6 +346,9 @@
"save": "Opslaan", "save": "Opslaan",
"search": "Zoeken", "search": "Zoeken",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "De sectie is verplicht", "section.required": "De sectie is verplicht",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Nie można znaleźć strony \"{slug}\"", "error.page.notFound": "Nie można znaleźć strony \"{slug}\"",
"error.page.num.invalid": "Wprowadź poprawny numer sortujący. Liczby nie mogą być ujemne.", "error.page.num.invalid": "Wprowadź poprawny numer sortujący. Liczby nie mogą być ujemne.",
"error.page.slug.invalid": "Wprowadź poprawną końcówkę adresu URL", "error.page.slug.invalid": "Wprowadź poprawną końcówkę adresu URL",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Nie można sortować strony \"{slug}\"", "error.page.sort.permission": "Nie można sortować strony \"{slug}\"",
"error.page.status.invalid": "Ustaw prawidłowy status strony", "error.page.status.invalid": "Ustaw prawidłowy status strony",
"error.page.undefined": "Nie udało się znaleźć strony", "error.page.undefined": "Nie udało się znaleźć strony",
@@ -288,6 +289,7 @@
"on": "włączone", "on": "włączone",
"open": "Otwórz", "open": "Otwórz",
"options": "Opcje", "options": "Opcje",
"options.none": "No options",
"orientation": "Orientacja", "orientation": "Orientacja",
"orientation.landscape": "Pozioma", "orientation.landscape": "Pozioma",
@@ -344,6 +346,9 @@
"save": "Zapisz", "save": "Zapisz",
"search": "Szukaj", "search": "Szukaj",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "Sekcja jest wymagana", "section.required": "Sekcja jest wymagana",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Página\"{slug}\" não encontrada", "error.page.notFound": "Página\"{slug}\" não encontrada",
"error.page.num.invalid": "Digite um número de ordenação válido. Este número não pode ser negativo.", "error.page.num.invalid": "Digite um número de ordenação válido. Este número não pode ser negativo.",
"error.page.slug.invalid": "Por favor, digite uma URL válida", "error.page.slug.invalid": "Por favor, digite uma URL válida",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "A página \"{slug}\" não pode ser ordenada", "error.page.sort.permission": "A página \"{slug}\" não pode ser ordenada",
"error.page.status.invalid": "Por favor, defina um estado de página válido", "error.page.status.invalid": "Por favor, defina um estado de página válido",
"error.page.undefined": "P\u00e1gina n\u00e3o encontrada", "error.page.undefined": "P\u00e1gina n\u00e3o encontrada",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Abrir", "open": "Abrir",
"options": "Opções", "options": "Opções",
"options.none": "No options",
"orientation": "Orientação", "orientation": "Orientação",
"orientation.landscape": "Paisagem", "orientation.landscape": "Paisagem",
@@ -344,6 +346,9 @@
"save": "Salvar", "save": "Salvar",
"search": "Buscar", "search": "Buscar",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "The section is required", "section.required": "The section is required",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Página\"{slug}\" não encontrada", "error.page.notFound": "Página\"{slug}\" não encontrada",
"error.page.num.invalid": "Digite um número de ordenação válido. Este número não pode ser negativo.", "error.page.num.invalid": "Digite um número de ordenação válido. Este número não pode ser negativo.",
"error.page.slug.invalid": "Por favor, digite um prefixo de URL válido", "error.page.slug.invalid": "Por favor, digite um prefixo de URL válido",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "A página \"{slug}\" não pode ser ordenada", "error.page.sort.permission": "A página \"{slug}\" não pode ser ordenada",
"error.page.status.invalid": "Por favor, defina um estado de página válido", "error.page.status.invalid": "Por favor, defina um estado de página válido",
"error.page.undefined": "P\u00e1gina n\u00e3o encontrada", "error.page.undefined": "P\u00e1gina n\u00e3o encontrada",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Abrir", "open": "Abrir",
"options": "Opções", "options": "Opções",
"options.none": "No options",
"orientation": "Orientação", "orientation": "Orientação",
"orientation.landscape": "Paisagem", "orientation.landscape": "Paisagem",
@@ -344,6 +346,9 @@
"save": "Salvar", "save": "Salvar",
"search": "Buscar", "search": "Buscar",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "Esta seção é necessária", "section.required": "Esta seção é necessária",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430", "error.page.notFound": "\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430",
"error.page.num.invalid": "Пожалуйста, впишите правильное число сортировки. Число не может быть отрицательным.", "error.page.num.invalid": "Пожалуйста, впишите правильное число сортировки. Число не может быть отрицательным.",
"error.page.slug.invalid": "Пожалуйста, впишите правильный префикс URL", "error.page.slug.invalid": "Пожалуйста, впишите правильный префикс URL",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Невозможно сортировать страницу \"{slug}\"", "error.page.sort.permission": "Невозможно сортировать страницу \"{slug}\"",
"error.page.status.invalid": "Пожалуйста, установите верный статус страницы", "error.page.status.invalid": "Пожалуйста, установите верный статус страницы",
"error.page.undefined": "\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430", "error.page.undefined": "\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430",
@@ -288,6 +289,7 @@
"on": "включено", "on": "включено",
"open": "Открыть", "open": "Открыть",
"options": "Опции", "options": "Опции",
"options.none": "No options",
"orientation": "Ориентация", "orientation": "Ориентация",
"orientation.landscape": "Горизонтальная", "orientation.landscape": "Горизонтальная",
@@ -344,6 +346,9 @@
"save": "\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c", "save": "\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",
"search": "Поиск", "search": "Поиск",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "Секция обязательна", "section.required": "Секция обязательна",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Stránku \"{slug}\" nie je možné nájsť", "error.page.notFound": "Stránku \"{slug}\" nie je možné nájsť",
"error.page.num.invalid": "Prosím, zadajte platné číslo pre radenie. Čísla nemôžu byť záporné.", "error.page.num.invalid": "Prosím, zadajte platné číslo pre radenie. Čísla nemôžu byť záporné.",
"error.page.slug.invalid": "Prosím, zadajte platný URL prefix.", "error.page.slug.invalid": "Prosím, zadajte platný URL prefix.",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Stránku \"{slug}\" nie je možné preradiť.", "error.page.sort.permission": "Stránku \"{slug}\" nie je možné preradiť.",
"error.page.status.invalid": "Prosím, nastavte platnú status pre stránku", "error.page.status.invalid": "Prosím, nastavte platnú status pre stránku",
"error.page.undefined": "Stránku nie je možné nájsť", "error.page.undefined": "Stránku nie je možné nájsť",
@@ -288,6 +289,7 @@
"on": "on", "on": "on",
"open": "Otvoriť", "open": "Otvoriť",
"options": "Nastavenia", "options": "Nastavenia",
"options.none": "No options",
"orientation": "Orientácia", "orientation": "Orientácia",
"orientation.landscape": "Širokouhlá", "orientation.landscape": "Širokouhlá",
@@ -344,6 +346,9 @@
"save": "Uložiť", "save": "Uložiť",
"search": "Hľadať", "search": "Hľadať",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "The section is required", "section.required": "The section is required",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "Sidan \"{slug}\" kan inte hittas", "error.page.notFound": "Sidan \"{slug}\" kan inte hittas",
"error.page.num.invalid": "Ange ett giltigt nummer för sortering. Numret får inte vara negativt.", "error.page.num.invalid": "Ange ett giltigt nummer för sortering. Numret får inte vara negativt.",
"error.page.slug.invalid": "Ange ett giltigt URL-prefix", "error.page.slug.invalid": "Ange ett giltigt URL-prefix",
"error.page.slug.maxlength": "Slug length must be less than \"{length}\" characters",
"error.page.sort.permission": "Sidan \"{slug}\" kan inte sorteras", "error.page.sort.permission": "Sidan \"{slug}\" kan inte sorteras",
"error.page.status.invalid": "Sätt en giltig status för sidan", "error.page.status.invalid": "Sätt en giltig status för sidan",
"error.page.undefined": "Sidan kan inte hittas", "error.page.undefined": "Sidan kan inte hittas",
@@ -288,6 +289,7 @@
"on": "på", "on": "på",
"open": "Öppna", "open": "Öppna",
"options": "Alternativ", "options": "Alternativ",
"options.none": "No options",
"orientation": "Orientering", "orientation": "Orientering",
"orientation.landscape": "Liggande", "orientation.landscape": "Liggande",
@@ -344,6 +346,9 @@
"save": "Spara", "save": "Spara",
"search": "Sök", "search": "Sök",
"search.min": "Enter {min} characters to search",
"search.all": "Show all",
"search.results.none": "No results",
"section.required": "Sektionen krävs", "section.required": "Sektionen krävs",

View File

@@ -102,6 +102,7 @@
"error.page.notFound": "\"{slug}\" uzantısındaki sayfa bulunamadı", "error.page.notFound": "\"{slug}\" uzantısındaki sayfa bulunamadı",
"error.page.num.invalid": "Lütfen geçerli bir sıralama numarası girin. Sayılar negatif olmamalıdır.", "error.page.num.invalid": "Lütfen geçerli bir sıralama numarası girin. Sayılar negatif olmamalıdır.",
"error.page.slug.invalid": "Lütfen geçerli bir adres öneki girin", "error.page.slug.invalid": "Lütfen geçerli bir adres öneki girin",
"error.page.slug.maxlength": "Adres uzantısı \"{length}\" karakterden az olmalıdır",
"error.page.sort.permission": "\"{slug}\" sayfası sıralanamıyor", "error.page.sort.permission": "\"{slug}\" sayfası sıralanamıyor",
"error.page.status.invalid": "Lütfen geçerli bir sayfa durumu ayarlayın", "error.page.status.invalid": "Lütfen geçerli bir sayfa durumu ayarlayın",
"error.page.undefined": "Sayfa bulunamad\u0131", "error.page.undefined": "Sayfa bulunamad\u0131",
@@ -288,6 +289,7 @@
"on": "açık", "on": "açık",
"open": "Önizleme", "open": "Önizleme",
"options": "Seçenekler", "options": "Seçenekler",
"options.none": "Seçenek yok",
"orientation": "Oryantasyon", "orientation": "Oryantasyon",
"orientation.landscape": "Yatay", "orientation.landscape": "Yatay",
@@ -344,6 +346,9 @@
"save": "Kaydet", "save": "Kaydet",
"search": "Arama", "search": "Arama",
"search.min": "Aramak için {min} karakter girin",
"search.all": "Tümünü göster",
"search.results.none": "Sonuç yok",
"section.required": "Bölüm gereklidir", "section.required": "Bölüm gereklidir",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -212,6 +212,53 @@ class Api extends BaseApi
]); ]);
} }
/**
* Returns the subpages for the given
* parent. The subpages can be filtered
* by status (draft, listed, unlisted, published, all)
*
* @param string|null $parentId
* @param string|null $status
* @return \Kirby\Cms\Pages
*/
public function pages(string $parentId = null, string $status = null)
{
$parent = $parentId === null ? $this->site() : $this->page($parentId);
switch ($status) {
case 'all':
return $parent->childrenAndDrafts();
case 'draft':
case 'drafts':
return $parent->drafts();
case 'listed':
return $parent->children()->listed();
case 'unlisted':
return $parent->children()->unlisted();
case 'published':
default:
return $parent->children();
}
}
/**
* Search for direct subpages of the
* given parent
*
* @param string|null $parent
* @return \Kirby\Cms\Pages
*/
public function searchPages(string $parent = null)
{
$pages = $this->pages($parent, $this->requestQuery('status'));
if ($this->requestMethod() === 'GET') {
return $pages->search($this->requestQuery('q'));
}
return $pages->query($this->requestBody());
}
/** /**
* Returns the current Session instance * Returns the current Session instance
* *

View File

@@ -1079,10 +1079,15 @@ class App
// when the page has been found // when the page has been found
if ($page) { if ($page) {
try { try {
return $this $response = $this->response();
->response()
->body($page->render([], $extension)) // attach a MIME type based on the representation
->type($extension); // only if no custom MIME type was set
if ($response->type() === null) {
$response->type($extension);
}
return $response->body($page->render([], $extension));
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return null; return null;
} }

View File

@@ -111,10 +111,14 @@ trait AppErrors
$httpCode = $exception->getHttpCode(); $httpCode = $exception->getHttpCode();
$code = $exception->getCode(); $code = $exception->getCode();
$details = $exception->getDetails(); $details = $exception->getDetails();
} else { } elseif (is_a($exception, '\Throwable') === true) {
$httpCode = 500; $httpCode = 500;
$code = $exception->getCode(); $code = $exception->getCode();
$details = null; $details = null;
} else {
$httpCode = 500;
$code = 500;
$details = null;
} }
if ($this->option('debug') === true) { if ($this->option('debug') === true) {

View File

@@ -265,6 +265,8 @@ class Auth
// check for blocked ips // check for blocked ips
if ($this->isBlocked($email) === true) { if ($this->isBlocked($email) === true) {
$this->kirby->trigger('user.login:failed', compact('email'));
if ($this->kirby->option('debug') === true) { if ($this->kirby->option('debug') === true) {
$message = 'Rate limit exceeded'; $message = 'Rate limit exceeded';
} else { } else {
@@ -397,6 +399,8 @@ class Auth
*/ */
public function track(string $email): bool public function track(string $email): bool
{ {
$this->kirby->trigger('user.login:failed', compact('email'));
$ip = $this->ipHash(); $ip = $this->ipHash();
$log = $this->log(); $log = $this->log();
$time = time(); $time = time();

View File

@@ -245,6 +245,9 @@ trait FileActions
F::remove($file->root()); F::remove($file->root());
// remove the file from the sibling collection
$file->parent()->files()->remove($file);
return true; return true;
}); });
} }

View File

@@ -86,7 +86,7 @@ class Media
* given filename and then calls the thumb * given filename and then calls the thumb
* component to create a thumbnail accordingly * component to create a thumbnail accordingly
* *
* @param \Kirby\Cms\Model $model * @param \Kirby\Cms\Model|string $model
* @param string $hash * @param string $hash
* @param string $filename * @param string $filename
* @return \Kirby\Cms\Response|false * @return \Kirby\Cms\Response|false
@@ -95,11 +95,14 @@ class Media
{ {
$kirby = App::instance(); $kirby = App::instance();
// assets
if (is_string($model) === true) { if (is_string($model) === true) {
// assets
$root = $kirby->root('media') . '/assets/' . $model . '/' . $hash; $root = $kirby->root('media') . '/assets/' . $model . '/' . $hash;
// parent files for file model that already included hash
} elseif (is_a($model, '\Kirby\Cms\File')) {
$root = dirname($model->mediaRoot());
// model files
} else { } else {
// model files
$root = $model->mediaRoot() . '/' . $hash; $root = $model->mediaRoot() . '/' . $hash;
} }

View File

@@ -8,7 +8,6 @@ use Kirby\Exception\NotFoundException;
use Kirby\Http\Uri; use Kirby\Http\Uri;
use Kirby\Toolkit\A; use Kirby\Toolkit\A;
use Kirby\Toolkit\F; use Kirby\Toolkit\F;
use Kirby\Toolkit\Str;
/** /**
* The `$page` object is the heart and * The `$page` object is the heart and
@@ -964,11 +963,6 @@ class Page extends ModelWithContent
{ {
if ($icon = $this->blueprint()->icon()) { if ($icon = $this->blueprint()->icon()) {
$params['type'] = $icon; $params['type'] = $icon;
// check for emojis
if (strlen($icon) !== Str::length($icon)) {
$params['emoji'] = true;
}
} }
return parent::panelIcon($params); return parent::panelIcon($params);

View File

@@ -27,11 +27,6 @@ class User extends ModelWithContent
use HasSiblings; use HasSiblings;
use UserActions; use UserActions;
/**
* @var File
*/
protected $avatar;
/** /**
* @var UserBlueprint * @var UserBlueprint
*/ */
@@ -798,7 +793,7 @@ class User extends ModelWithContent
*/ */
protected function setName(string $name = null) protected function setName(string $name = null)
{ {
$this->name = $name !== null ? trim($name) : null; $this->name = $name !== null ? trim(strip_tags($name)) : null;
return $this; return $this;
} }

View File

@@ -50,7 +50,7 @@ class UserPermissions extends ModelPermissions
} }
// users who are not admins cannot create admins // users who are not admins cannot create admins
if ($this->model->isAdmin() === true) { if ($this->model->isAdmin() === false) {
return false; return false;
} }

View File

@@ -6,7 +6,7 @@ use Kirby\Exception\InvalidArgumentException;
use Spyc; use Spyc;
/** /**
* Simple Wrapper around Symfony's Yaml Component * Simple Wrapper around the Spyc YAML class
* *
* @package Kirby Data * @package Kirby Data
* @author Bastian Allgeier <bastian@getkirby.com> * @author Bastian Allgeier <bastian@getkirby.com>

View File

@@ -19,30 +19,64 @@ class Body
{ {
use Properties; use Properties;
/**
* @var string|null
*/
protected $html; protected $html;
/**
* @var string|null
*/
protected $text; protected $text;
/**
* Email body constructor
*
* @param array $props
*/
public function __construct(array $props = []) public function __construct(array $props = [])
{ {
$this->setProperties($props); $this->setProperties($props);
} }
/**
* Returns the HTML content of the email body
*
* @return string|null
*/
public function html() public function html()
{ {
return $this->html; return $this->html;
} }
/**
* Returns the plain text content of the email body
*
* @return string|null
*/
public function text() public function text()
{ {
return $this->text; return $this->text;
} }
/**
* Sets the HTML content for the email body
*
* @param string|null $html
* @return self
*/
protected function setHtml(string $html = null) protected function setHtml(string $html = null)
{ {
$this->html = $html; $this->html = $html;
return $this; return $this;
} }
/**
* Sets the plain text content for the email body
*
* @param string|null $text
* @return self
*/
protected function setText(string $text = null) protected function setText(string $text = null)
{ {
$this->text = $text; $this->text = $text;

View File

@@ -21,57 +21,142 @@ class Email
{ {
use Properties; use Properties;
/**
* @var array|null
*/
protected $attachments; protected $attachments;
/**
* @var \Kirby\Email\Body|null
*/
protected $body; protected $body;
/**
* @var array|null
*/
protected $bcc; protected $bcc;
/**
* @var \Closure|null
*/
protected $beforeSend; protected $beforeSend;
/**
* @var array|null
*/
protected $cc; protected $cc;
/**
* @var string|null
*/
protected $from; protected $from;
/**
* @var string|null
*/
protected $fromName; protected $fromName;
/**
* @var string|null
*/
protected $replyTo; protected $replyTo;
/**
* @var string|null
*/
protected $replyToName; protected $replyToName;
/**
* @var bool
*/
protected $isSent = false; protected $isSent = false;
/**
* @var string|null
*/
protected $subject; protected $subject;
/**
* @var array|null
*/
protected $to; protected $to;
/**
* @var array|null
*/
protected $transport; protected $transport;
/**
* Email constructor
*
* @param array $props
* @param bool $debug
*/
public function __construct(array $props = [], bool $debug = false) public function __construct(array $props = [], bool $debug = false)
{ {
$this->setProperties($props); $this->setProperties($props);
if ($debug === false) { if ($debug === false) {
$this->send(); $this->send(); // @codeCoverageIgnore
} }
} }
/**
* Returns the email attachments
*
* @return array
*/
public function attachments(): array public function attachments(): array
{ {
return $this->attachments; return $this->attachments;
} }
/** /**
* @return \Kirby\Email\Body * Returns the email body
*
* @return \Kirby\Email\Body|null
*/ */
public function body() public function body()
{ {
return $this->body; return $this->body;
} }
/**
* Returns "bcc" recipients
*
* @return array
*/
public function bcc(): array public function bcc(): array
{ {
return $this->bcc; return $this->bcc;
} }
/**
* Returns the beforeSend callback closure,
* which has access to the PHPMailer instance
*
* @return \Closure|null
*/
public function beforeSend(): ?Closure public function beforeSend(): ?Closure
{ {
return $this->beforeSend; return $this->beforeSend;
} }
/**
* Returns "cc" recipients
*
* @return array
*/
public function cc(): array public function cc(): array
{ {
return $this->cc; return $this->cc;
} }
/**
* Returns default transport settings
*
* @return array
*/
protected function defaultTransport(): array protected function defaultTransport(): array
{ {
return [ return [
@@ -79,36 +164,74 @@ class Email
]; ];
} }
/**
* Returns the "from" email address
*
* @return string
*/
public function from(): string public function from(): string
{ {
return $this->from; return $this->from;
} }
/**
* Returns the "from" name
*
* @return string|null
*/
public function fromName(): ?string public function fromName(): ?string
{ {
return $this->fromName; return $this->fromName;
} }
/**
* Checks if the email has an HTML body
*
* @return bool
*/
public function isHtml() public function isHtml()
{ {
return $this->body()->html() !== null; return $this->body()->html() !== null;
} }
/**
* Checks if the email has been sent successfully
*
* @return bool
*/
public function isSent(): bool public function isSent(): bool
{ {
return $this->isSent; return $this->isSent;
} }
/**
* Returns the "reply to" email address
*
* @return string
*/
public function replyTo(): string public function replyTo(): string
{ {
return $this->replyTo; return $this->replyTo;
} }
/**
* Returns the "reply to" name
*
* @return string|null
*/
public function replyToName(): ?string public function replyToName(): ?string
{ {
return $this->replyToName; return $this->replyToName;
} }
/**
* Converts single or multiple email addresses to a sanitized format
*
* @param string|array|null $email
* @param bool $multiple
* @return array|mixed|string
* @throws \Exception
*/
protected function resolveEmail($email = null, bool $multiple = true) protected function resolveEmail($email = null, bool $multiple = true)
{ {
if ($email === null) { if ($email === null) {
@@ -139,17 +262,34 @@ class Email
return $multiple === true ? $result : array_keys($result)[0]; return $multiple === true ? $result : array_keys($result)[0];
} }
/**
* Sends the email
*
* @return bool
*/
public function send(): bool public function send(): bool
{ {
return $this->isSent = true; return $this->isSent = true;
} }
/**
* Sets the email attachments
*
* @param array|null $attachments
* @return self
*/
protected function setAttachments($attachments = null) protected function setAttachments($attachments = null)
{ {
$this->attachments = $attachments ?? []; $this->attachments = $attachments ?? [];
return $this; return $this;
} }
/**
* Sets the email body
*
* @param string|array $body
* @return self
*/
protected function setBody($body) protected function setBody($body)
{ {
if (is_string($body) === true) { if (is_string($body) === true) {
@@ -160,76 +300,151 @@ class Email
return $this; return $this;
} }
/**
* Sets "bcc" recipients
*
* @param string|array|null $bcc
* @return $this
*/
protected function setBcc($bcc = null) protected function setBcc($bcc = null)
{ {
$this->bcc = $this->resolveEmail($bcc); $this->bcc = $this->resolveEmail($bcc);
return $this; return $this;
} }
/**
* Sets the "beforeSend" callback
*
* @param \Closure|null $beforeSend
* @return self
*/
protected function setBeforeSend(?Closure $beforeSend = null) protected function setBeforeSend(?Closure $beforeSend = null)
{ {
$this->beforeSend = $beforeSend; $this->beforeSend = $beforeSend;
return $this; return $this;
} }
/**
* Sets "cc" recipients
*
* @param string|array|null $cc
* @return self
*/
protected function setCc($cc = null) protected function setCc($cc = null)
{ {
$this->cc = $this->resolveEmail($cc); $this->cc = $this->resolveEmail($cc);
return $this; return $this;
} }
/**
* Sets the "from" email address
*
* @param string $from
* @return self
*/
protected function setFrom(string $from) protected function setFrom(string $from)
{ {
$this->from = $this->resolveEmail($from, false); $this->from = $this->resolveEmail($from, false);
return $this; return $this;
} }
/**
* Sets the "from" name
*
* @param string|null $fromName
* @return self
*/
protected function setFromName(string $fromName = null) protected function setFromName(string $fromName = null)
{ {
$this->fromName = $fromName; $this->fromName = $fromName;
return $this; return $this;
} }
/**
* Sets the "reply to" email address
*
* @param string|null $replyTo
* @return self
*/
protected function setReplyTo(string $replyTo = null) protected function setReplyTo(string $replyTo = null)
{ {
$this->replyTo = $this->resolveEmail($replyTo, false); $this->replyTo = $this->resolveEmail($replyTo, false);
return $this; return $this;
} }
/**
* Sets the "reply to" name
*
* @param string|null $replyToName
* @return self
*/
protected function setReplyToName(string $replyToName = null) protected function setReplyToName(string $replyToName = null)
{ {
$this->replyToName = $replyToName; $this->replyToName = $replyToName;
return $this; return $this;
} }
/**
* Sets the email subject
*
* @param string $subject
* @return self
*/
protected function setSubject(string $subject) protected function setSubject(string $subject)
{ {
$this->subject = $subject; $this->subject = $subject;
return $this; return $this;
} }
/**
* Sets the recipients of the email
*
* @param string|array $to
* @return self
*/
protected function setTo($to) protected function setTo($to)
{ {
$this->to = $this->resolveEmail($to); $this->to = $this->resolveEmail($to);
return $this; return $this;
} }
/**
* Sets the email transport settings
*
* @param array|null $transport
* @return self
*/
protected function setTransport($transport = null) protected function setTransport($transport = null)
{ {
$this->transport = $transport; $this->transport = $transport;
return $this; return $this;
} }
/**
* Returns the email subject
*
* @return string
*/
public function subject(): string public function subject(): string
{ {
return $this->subject; return $this->subject;
} }
/**
* Returns the email recipients
*
* @return array
*/
public function to(): array public function to(): array
{ {
return $this->to; return $this->to;
} }
/**
* Returns the email transports settings
*
* @return array
*/
public function transport(): array public function transport(): array
{ {
return $this->transport ?? $this->defaultTransport(); return $this->transport ?? $this->defaultTransport();

View File

@@ -17,6 +17,13 @@ use PHPMailer\PHPMailer\PHPMailer as Mailer;
*/ */
class PHPMailer extends Email class PHPMailer extends Email
{ {
/**
* Sends email via PHPMailer library
*
* @param bool $debug
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function send(bool $debug = false): bool public function send(bool $debug = false): bool
{ {
$mailer = new Mailer(true); $mailer = new Mailer(true);
@@ -83,6 +90,6 @@ class PHPMailer extends Email
return $this->isSent = true; return $this->isSent = true;
} }
return $this->isSent = $mailer->send(); return $this->isSent = $mailer->send(); // @codeCoverageIgnore
} }
} }

View File

@@ -3,7 +3,6 @@
namespace Kirby\Form; namespace Kirby\Form;
use Exception; use Exception;
use Kirby\Cms\Model;
use Kirby\Exception\InvalidArgumentException; use Kirby\Exception\InvalidArgumentException;
use Kirby\Toolkit\A; use Kirby\Toolkit\A;
use Kirby\Toolkit\Component; use Kirby\Toolkit\Component;
@@ -51,6 +50,14 @@ class Field extends Component
*/ */
public static $types = []; public static $types = [];
/**
* Field constructor
*
* @param string $type
* @param array $attrs
* @param \Kirby\Form\Fields|null $formFields
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function __construct(string $type, array $attrs = [], ?Fields $formFields = null) public function __construct(string $type, array $attrs = [], ?Fields $formFields = null)
{ {
if (isset(static::$types[$type]) === false) { if (isset(static::$types[$type]) === false) {
@@ -71,6 +78,8 @@ class Field extends Component
} }
/** /**
* Returns field api call
*
* @return mixed * @return mixed
*/ */
public function api() public function api()
@@ -81,10 +90,12 @@ class Field extends Component
} }
/** /**
* @param mixed $default * Returns field data
*
* @param bool $default
* @return mixed * @return mixed
*/ */
public function data($default = false) public function data(bool $default = false)
{ {
$save = $this->options['save'] ?? true; $save = $this->options['save'] ?? true;
@@ -103,6 +114,11 @@ class Field extends Component
} }
} }
/**
* Default props and computed of the field
*
* @return array
*/
public static function defaults(): array public static function defaults(): array
{ {
return [ return [
@@ -232,11 +248,21 @@ class Field extends Component
]; ];
} }
/**
* Parent collection with all fields of the current form
*
* @return \Kirby\Form\Fields|null
*/
public function formFields(): ?Fields public function formFields(): ?Fields
{ {
return $this->formFields; return $this->formFields;
} }
/**
* Validates when run for the first time and returns any errors
*
* @return array
*/
public function errors(): array public function errors(): array
{ {
if ($this->errors === null) { if ($this->errors === null) {
@@ -246,6 +272,12 @@ class Field extends Component
return $this->errors; return $this->errors;
} }
/**
* Checks if the field is empty
*
* @param mixed ...$args
* @return bool
*/
public function isEmpty(...$args): bool public function isEmpty(...$args): bool
{ {
if (count($args) === 0) { if (count($args) === 0) {
@@ -261,22 +293,39 @@ class Field extends Component
return in_array($value, [null, '', []], true); return in_array($value, [null, '', []], true);
} }
/**
* Checks if the field is invalid
*
* @return bool
*/
public function isInvalid(): bool public function isInvalid(): bool
{ {
return empty($this->errors()) === false; return empty($this->errors()) === false;
} }
/**
* Checks if the field is required
*
* @return bool
*/
public function isRequired(): bool public function isRequired(): bool
{ {
return $this->required ?? false; return $this->required ?? false;
} }
/**
* Checks if the field is valid
*
* @return bool
*/
public function isValid(): bool public function isValid(): bool
{ {
return empty($this->errors()) === true; return empty($this->errors()) === true;
} }
/** /**
* Returns the Kirby instance
*
* @return \Kirby\Cms\App * @return \Kirby\Cms\App
*/ */
public function kirby() public function kirby()
@@ -284,6 +333,11 @@ class Field extends Component
return $this->model->kirby(); return $this->model->kirby();
} }
/**
* Returns the parent model
*
* @return mixed|null
*/
public function model() public function model()
{ {
return $this->model; return $this->model;
@@ -329,11 +383,21 @@ class Field extends Component
return true; return true;
} }
/**
* Checks if the field is saveable
*
* @return bool
*/
public function save(): bool public function save(): bool
{ {
return ($this->options['save'] ?? true) !== false; return ($this->options['save'] ?? true) !== false;
} }
/**
* Converts the field to a plain array
*
* @return array
*/
public function toArray(): array public function toArray(): array
{ {
$array = parent::toArray(); $array = parent::toArray();
@@ -352,6 +416,11 @@ class Field extends Component
}); });
} }
/**
* Runs the validations defined for the field
*
* @return void
*/
protected function validate(): void protected function validate(): void
{ {
$validations = $this->options['validations'] ?? []; $validations = $this->options['validations'] ?? [];
@@ -395,6 +464,12 @@ class Field extends Component
} }
} }
/**
* Returns the value of the field if saveable
* otherwise it returns null
*
* @return mixed
*/
public function value() public function value()
{ {
return $this->save() ? $this->value : null; return $this->save() ? $this->value : null;

View File

@@ -22,11 +22,12 @@ class Fields extends Collection
* the collection prop on each object correctly. * the collection prop on each object correctly.
* *
* @param string $name * @param string $name
* @param object $field * @param object|array $field
* @return self
*/ */
public function __set(string $name, $field) public function __set(string $name, $field)
{ {
if (is_array($field)) { if (is_array($field) === true) {
// use the array key as name if the name is not set // use the array key as name if the name is not set
$field['name'] = $field['name'] ?? $name; $field['name'] = $field['name'] ?? $name;
$field = new Field($field['type'], $field); $field = new Field($field['type'], $field);
@@ -40,7 +41,7 @@ class Fields extends Collection
* array and also does that for every * array and also does that for every
* included field. * included field.
* *
* @param Closure $map * @param \Closure|null $map
* @return array * @return array
*/ */
public function toArray(Closure $map = null): array public function toArray(Closure $map = null): array

View File

@@ -19,10 +19,32 @@ use Throwable;
*/ */
class Form class Form
{ {
/**
* An array of all found errors
*
* @var array|null
*/
protected $errors; protected $errors;
/**
* Fields in the form
*
* @var \Kirby\Form\Fields|null
*/
protected $fields; protected $fields;
/**
* All values of form
*
* @var array
*/
protected $values = []; protected $values = [];
/**
* Form constructor
*
* @param array $props
*/
public function __construct(array $props) public function __construct(array $props)
{ {
$fields = $props['fields'] ?? []; $fields = $props['fields'] ?? [];
@@ -85,11 +107,24 @@ class Form
} }
} }
/**
* Returns the data required to write to the content file
* Doesn't include default and null values
*
* @return array
*/
public function content(): array public function content(): array
{ {
return $this->data(false, false); return $this->data(false, false);
} }
/**
* Returns data for all fields in the form
*
* @param false $defaults
* @param bool $includeNulls
* @return array
*/
public function data($defaults = false, bool $includeNulls = true): array public function data($defaults = false, bool $includeNulls = true): array
{ {
$data = $this->values; $data = $this->values;
@@ -109,6 +144,11 @@ class Form
return $data; return $data;
} }
/**
* An array of all found errors
*
* @return array
*/
public function errors(): array public function errors(): array
{ {
if ($this->errors !== null) { if ($this->errors !== null) {
@@ -129,6 +169,13 @@ class Form
return $this->errors; return $this->errors;
} }
/**
* Shows the error with the field
*
* @param \Throwable $exception
* @param array $props
* @return \Kirby\Form\Field
*/
public static function exceptionField(Throwable $exception, array $props = []) public static function exceptionField(Throwable $exception, array $props = [])
{ {
$props = array_merge($props, [ $props = array_merge($props, [
@@ -140,21 +187,42 @@ class Form
return new Field('info', $props); return new Field('info', $props);
} }
/**
* Returns form fields
*
* @return \Kirby\Form\Fields|null
*/
public function fields() public function fields()
{ {
return $this->fields; return $this->fields;
} }
/**
* Checks if the form is invalid
*
* @return bool
*/
public function isInvalid(): bool public function isInvalid(): bool
{ {
return empty($this->errors()) === false; return empty($this->errors()) === false;
} }
/**
* Checks if the form is valid
*
* @return bool
*/
public function isValid(): bool public function isValid(): bool
{ {
return empty($this->errors()) === true; return empty($this->errors()) === true;
} }
/**
* Converts the data of fields to strings
*
* @param false $defaults
* @return array
*/
public function strings($defaults = false): array public function strings($defaults = false): array
{ {
$strings = []; $strings = [];
@@ -172,6 +240,11 @@ class Form
return $strings; return $strings;
} }
/**
* Converts the form to a plain array
*
* @return array
*/
public function toArray(): array public function toArray(): array
{ {
$array = [ $array = [
@@ -185,6 +258,11 @@ class Form
return $array; return $array;
} }
/**
* Returns form values
*
* @return array
*/
public function values(): array public function values(): array
{ {
return $this->values; return $this->values;

View File

@@ -19,6 +19,11 @@ use Kirby\Toolkit\I18n;
*/ */
class Options class Options
{ {
/**
* Returns the classes of predefined Kirby objects
*
* @return array
*/
protected static function aliases(): array protected static function aliases(): array
{ {
return [ return [
@@ -30,6 +35,13 @@ class Options
]; ];
} }
/**
* Brings options through api
*
* @param $api
* @param $model
* @return array
*/
public static function api($api, $model = null): array public static function api($api, $model = null): array
{ {
$model = $model ?? App::instance()->site(); $model = $model ?? App::instance()->site();
@@ -57,6 +69,10 @@ class Options
return $optionsApi->options(); return $optionsApi->options();
} }
/**
* @param $model
* @return array
*/
protected static function data($model): array protected static function data($model): array
{ {
$kirby = $model->kirby(); $kirby = $model->kirby();
@@ -78,6 +94,14 @@ class Options
return $data; return $data;
} }
/**
* Brings options by supporting both api and query
*
* @param $options
* @param array $props
* @param null $model
* @return array
*/
public static function factory($options, array $props = [], $model = null): array public static function factory($options, array $props = [], $model = null): array
{ {
switch ($options) { switch ($options) {
@@ -131,6 +155,13 @@ class Options
return $result; return $result;
} }
/**
* Brings options with query
*
* @param $query
* @param null $model
* @return array
*/
public static function query($query, $model = null): array public static function query($query, $model = null): array
{ {
$model = $model ?? App::instance()->site(); $model = $model ?? App::instance()->site();

View File

@@ -25,34 +25,78 @@ class OptionsApi
{ {
use Properties; use Properties;
/**
* @var
*/
protected $data; protected $data;
/**
* @var
*/
protected $fetch; protected $fetch;
/**
* @var
*/
protected $options; protected $options;
/**
* @var string
*/
protected $text = '{{ item.value }}'; protected $text = '{{ item.value }}';
/**
* @var
*/
protected $url; protected $url;
/**
* @var string
*/
protected $value = '{{ item.key }}'; protected $value = '{{ item.key }}';
/**
* OptionsApi constructor
*
* @param array $props
*/
public function __construct(array $props) public function __construct(array $props)
{ {
$this->setProperties($props); $this->setProperties($props);
} }
/**
* @return array
*/
public function data(): array public function data(): array
{ {
return $this->data; return $this->data;
} }
/**
* @return mixed
*/
public function fetch() public function fetch()
{ {
return $this->fetch; return $this->fetch;
} }
/**
* @param string $field
* @param array $data
* @return string
*/
protected function field(string $field, array $data) protected function field(string $field, array $data)
{ {
$value = $this->$field(); $value = $this->$field();
return Str::template($value, $data); return Str::template($value, $data);
} }
/**
* @return array
* @throws \Exception
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function options(): array public function options(): array
{ {
if (is_array($this->options) === true) { if (is_array($this->options) === true) {
@@ -103,51 +147,94 @@ class OptionsApi
return $options; return $options;
} }
/**
* @param array $data
* @return self
*/
protected function setData(array $data) protected function setData(array $data)
{ {
$this->data = $data; $this->data = $data;
return $this; return $this;
} }
/**
* @param string|null $fetch
* @return self
*/
protected function setFetch(string $fetch = null) protected function setFetch(string $fetch = null)
{ {
$this->fetch = $fetch; $this->fetch = $fetch;
return $this; return $this;
} }
/**
* @param $options
* @return self
*/
protected function setOptions($options = null)
{
$this->options = $options;
return $this;
}
/**
* @param $text
* @return self
*/
protected function setText($text = null) protected function setText($text = null)
{ {
$this->text = $text; $this->text = $text;
return $this; return $this;
} }
/**
* @param $url
* @return self
*/
protected function setUrl($url) protected function setUrl($url)
{ {
$this->url = $url; $this->url = $url;
return $this; return $this;
} }
/**
* @param null $value
* @return self
*/
protected function setValue($value = null) protected function setValue($value = null)
{ {
$this->value = $value; $this->value = $value;
return $this; return $this;
} }
/**
* @return string
*/
public function text() public function text()
{ {
return $this->text; return $this->text;
} }
/**
* @return array
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function toArray(): array public function toArray(): array
{ {
return $this->options(); return $this->options();
} }
/**
* @return string
*/
public function url(): string public function url(): string
{ {
return Str::template($this->url, $this->data()); return Str::template($this->url, $this->data());
} }
/**
* @return string
*/
public function value() public function value()
{ {
return $this->value; return $this->value;

View File

@@ -27,28 +27,69 @@ class OptionsQuery
{ {
use Properties; use Properties;
/**
* @var array
*/
protected $aliases = []; protected $aliases = [];
/**
* @var
*/
protected $data; protected $data;
/**
* @var
*/
protected $options; protected $options;
/**
* @var
*/
protected $query; protected $query;
/**
* @var
*/
protected $text; protected $text;
/**
* @var
*/
protected $value; protected $value;
/**
* OptionsQuery constructor
*
* @param array $props
*/
public function __construct(array $props) public function __construct(array $props)
{ {
$this->setProperties($props); $this->setProperties($props);
} }
/**
* @return array
*/
public function aliases(): array public function aliases(): array
{ {
return $this->aliases; return $this->aliases;
} }
/**
* @return array
*/
public function data(): array public function data(): array
{ {
return $this->data; return $this->data;
} }
/**
* @param string $object
* @param string $field
* @param array $data
* @return string
* @throws \Kirby\Exception\NotFoundException
*/
protected function template(string $object, string $field, array $data) protected function template(string $object, string $field, array $data)
{ {
$value = $this->$field(); $value = $this->$field();
@@ -64,6 +105,9 @@ class OptionsQuery
return Str::template($value, $data); return Str::template($value, $data);
} }
/**
* @return array
*/
public function options(): array public function options(): array
{ {
if (is_array($this->options) === true) { if (is_array($this->options) === true) {
@@ -89,11 +133,18 @@ class OptionsQuery
return $this->options = $options; return $this->options = $options;
} }
/**
* @return string
*/
public function query(): string public function query(): string
{ {
return $this->query; return $this->query;
} }
/**
* @param $object
* @return mixed|string|null
*/
public function resolve($object) public function resolve($object)
{ {
// fast access // fast access
@@ -111,6 +162,10 @@ class OptionsQuery
return 'item'; return 'item';
} }
/**
* @param $result
* @throws \Kirby\Exception\InvalidArgumentException
*/
protected function resultToCollection($result) protected function resultToCollection($result)
{ {
if (is_array($result)) { if (is_array($result)) {
@@ -133,36 +188,69 @@ class OptionsQuery
return $result; return $result;
} }
/**
* @param array|null $aliases
* @return self
*/
protected function setAliases(array $aliases = null) protected function setAliases(array $aliases = null)
{ {
$this->aliases = $aliases; $this->aliases = $aliases;
return $this; return $this;
} }
/**
* @param array $data
* @return self
*/
protected function setData(array $data) protected function setData(array $data)
{ {
$this->data = $data; $this->data = $data;
return $this; return $this;
} }
/**
* @param $options
* @return self
*/
protected function setOptions($options = null)
{
$this->options = $options;
return $this;
}
/**
* @param string $query
* @return self
*/
protected function setQuery(string $query) protected function setQuery(string $query)
{ {
$this->query = $query; $this->query = $query;
return $this; return $this;
} }
/**
* @param $text
* @return self
*/
protected function setText($text) protected function setText($text)
{ {
$this->text = $text; $this->text = $text;
return $this; return $this;
} }
/**
* @param $value
* @return self
*/
protected function setValue($value) protected function setValue($value)
{ {
$this->value = $value; $this->value = $value;
return $this; return $this;
} }
/**
* @return mixed
*/
public function text() public function text()
{ {
return $this->text; return $this->text;
@@ -173,6 +261,9 @@ class OptionsQuery
return $this->options(); return $this->options();
} }
/**
* @return mixed
*/
public function value() public function value()
{ {
return $this->value; return $this->value;

View File

@@ -16,6 +16,14 @@ use Kirby\Toolkit\V;
*/ */
class Validations class Validations
{ {
/**
* Validates if the field value is boolean
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function boolean(Field $field, $value): bool public static function boolean(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false) { if ($field->isEmpty($value) === false) {
@@ -29,6 +37,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is valid date
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function date(Field $field, $value): bool public static function date(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false) { if ($field->isEmpty($value) === false) {
@@ -42,6 +58,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is valid email
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function email(Field $field, $value): bool public static function email(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false) { if ($field->isEmpty($value) === false) {
@@ -55,6 +79,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is maximum
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function max(Field $field, $value): bool public static function max(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false && $field->max() !== null) { if ($field->isEmpty($value) === false && $field->max() !== null) {
@@ -68,6 +100,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is max length
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function maxlength(Field $field, $value): bool public static function maxlength(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false && $field->maxlength() !== null) { if ($field->isEmpty($value) === false && $field->maxlength() !== null) {
@@ -81,6 +121,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is minimum
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function min(Field $field, $value): bool public static function min(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false && $field->min() !== null) { if ($field->isEmpty($value) === false && $field->min() !== null) {
@@ -94,6 +142,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is min length
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function minlength(Field $field, $value): bool public static function minlength(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false && $field->minlength() !== null) { if ($field->isEmpty($value) === false && $field->minlength() !== null) {
@@ -107,6 +163,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value matches defined pattern
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function pattern(Field $field, $value): bool public static function pattern(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false && $field->pattern() !== null) { if ($field->isEmpty($value) === false && $field->pattern() !== null) {
@@ -120,6 +184,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is required
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function required(Field $field, $value): bool public static function required(Field $field, $value): bool
{ {
if ($field->isRequired() === true && $field->save() === true && $field->isEmpty($value) === true) { if ($field->isRequired() === true && $field->save() === true && $field->isEmpty($value) === true) {
@@ -131,6 +203,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is in defined options
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function option(Field $field, $value): bool public static function option(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false) { if ($field->isEmpty($value) === false) {
@@ -146,6 +226,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field values is in defined options
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function options(Field $field, $value): bool public static function options(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false) { if ($field->isEmpty($value) === false) {
@@ -162,6 +250,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is valid time
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function time(Field $field, $value): bool public static function time(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false) { if ($field->isEmpty($value) === false) {
@@ -175,6 +271,14 @@ class Validations
return true; return true;
} }
/**
* Validates if the field value is valid url
*
* @param \Kirby\Form\Field $field
* @param $value
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function url(Field $field, $value): bool public static function url(Field $field, $value): bool
{ {
if ($field->isEmpty($value) === false) { if ($field->isEmpty($value) === false) {

View File

@@ -71,10 +71,13 @@ class F
], ],
'image' => [ 'image' => [
'ai', 'ai',
'avif',
'bmp', 'bmp',
'gif', 'gif',
'eps', 'eps',
'ico', 'ico',
'j2k',
'jp2',
'jpeg', 'jpeg',
'jpg', 'jpg',
'jpe', 'jpe',

View File

@@ -29,6 +29,7 @@ class Mime
'aifc' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff',
'avi' => 'video/x-msvideo', 'avi' => 'video/x-msvideo',
'avif' => 'image/avif',
'bmp' => 'image/bmp', 'bmp' => 'image/bmp',
'css' => 'text/css', 'css' => 'text/css',
'csv' => ['text/csv', 'text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream'], 'csv' => ['text/csv', 'text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream'],
@@ -48,6 +49,8 @@ class Mime
'ics' => 'text/calendar', 'ics' => 'text/calendar',
'js' => 'application/x-javascript', 'js' => 'application/x-javascript',
'json' => ['application/json', 'text/json'], 'json' => ['application/json', 'text/json'],
'j2k' => ['image/jp2'],
'jp2' => ['image/jp2'],
'jpg' => ['image/jpeg', 'image/pjpeg'], 'jpg' => ['image/jpeg', 'image/pjpeg'],
'jpeg' => ['image/jpeg', 'image/pjpeg'], 'jpeg' => ['image/jpeg', 'image/pjpeg'],
'jpe' => ['image/jpeg', 'image/pjpeg'], 'jpe' => ['image/jpeg', 'image/pjpeg'],

View File

@@ -353,17 +353,18 @@ class Pagination
return range($start, $end); return range($start, $end);
} }
$start = $page - (int)floor($range/2); $middle = (int)floor($range/2);
$end = $page + (int)floor($range/2); $start = $page - $middle + ($range % 2 === 0);
$end = $start + $range - 1;
if ($start <= 0) { if ($start <= 0) {
$end += abs($start); $end = $range;
$start = 1; $start = 1;
} }
if ($end > $pages) { if ($end > $pages) {
$start -= $end - $pages; $start = $pages - $range + 1;
$end = $pages; $end = $pages;
} }
return range($start, $end); return range($start, $end);