Update Composer packages
This commit is contained in:
parent
0320235f6c
commit
a8b68fb61b
378 changed files with 28466 additions and 28852 deletions
|
@ -33,7 +33,7 @@ class Find
|
|||
$filename = urldecode($filename);
|
||||
$file = static::parent($path)->file($filename);
|
||||
|
||||
if ($file && $file->isReadable() === true) {
|
||||
if ($file?->isReadable() === true) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class Find
|
|||
$id = str_replace(['+', ' '], '/', $id);
|
||||
$page = App::instance()->page($id);
|
||||
|
||||
if ($page && $page->isReadable() === true) {
|
||||
if ($page?->isReadable() === true) {
|
||||
return $page;
|
||||
}
|
||||
|
||||
|
@ -117,31 +117,16 @@ class Find
|
|||
|
||||
$kirby = App::instance();
|
||||
|
||||
switch ($modelName) {
|
||||
case 'site':
|
||||
$model = $kirby->site();
|
||||
break;
|
||||
case 'account':
|
||||
$model = static::user();
|
||||
break;
|
||||
case 'page':
|
||||
$model = static::page(basename($path));
|
||||
break;
|
||||
case 'file':
|
||||
$model = static::file(...explode('/files/', $path));
|
||||
break;
|
||||
case 'user':
|
||||
$model = $kirby->user(basename($path));
|
||||
break;
|
||||
default:
|
||||
throw new InvalidArgumentException('Invalid model type: ' . $modelType);
|
||||
}
|
||||
$model = match ($modelName) {
|
||||
'site' => $kirby->site(),
|
||||
'account' => static::user(),
|
||||
'page' => static::page(basename($path)),
|
||||
'file' => static::file(...explode('/files/', $path)),
|
||||
'user' => $kirby->user(basename($path)),
|
||||
default => throw new InvalidArgumentException('Invalid model type: ' . $modelType)
|
||||
};
|
||||
|
||||
if ($model) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
throw new NotFoundException([
|
||||
return $model ?? throw new NotFoundException([
|
||||
'key' => $modelName . '.undefined'
|
||||
]);
|
||||
}
|
||||
|
@ -167,21 +152,18 @@ class Find
|
|||
|
||||
// get the authenticated user
|
||||
if ($id === null) {
|
||||
if ($user = $kirby->user(null, $kirby->option('api.allowImpersonation', false))) {
|
||||
return $user;
|
||||
}
|
||||
$user = $kirby->user(
|
||||
null,
|
||||
$kirby->option('api.allowImpersonation', false)
|
||||
);
|
||||
|
||||
throw new NotFoundException([
|
||||
return $user ?? throw new NotFoundException([
|
||||
'key' => 'user.undefined'
|
||||
]);
|
||||
}
|
||||
|
||||
// get a specific user by id
|
||||
if ($user = $kirby->user($id)) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
throw new NotFoundException([
|
||||
return $kirby->user($id) ?? throw new NotFoundException([
|
||||
'key' => 'user.notFound',
|
||||
'data' => [
|
||||
'name' => $id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue