composer update

This commit is contained in:
isUnknown 2025-09-23 08:15:07 +02:00
parent 0b3c362c5e
commit a1f0701630
142 changed files with 4530 additions and 1195 deletions

View file

@ -88,7 +88,7 @@ class FileUuid extends ModelUuid
/**
* Returns permalink url
*/
public function url(): string
public function toPermalink(): string
{
// make sure UUID is cached because the permalink
// route only looks up UUIDs from cache
@ -98,4 +98,12 @@ class FileUuid extends ModelUuid
return App::instance()->url() . '/@/' . static::TYPE . '/' . $this->id();
}
/**
* @deprecated 5.1.0 Use `::toPermalink()` instead
*/
public function url(): string
{
return $this->toPermalink();
}
}

View file

@ -19,7 +19,7 @@ trait HasUuids
*/
protected function findByUuid(
string $uuid,
string|null $scheme = null
string|array|null $scheme = null
): Identifiable|null {
// handle UUID shortcuts with a leading @
if ($scheme !== null && str_starts_with($uuid, '@') === true) {

View file

@ -58,7 +58,7 @@ class PageUuid extends ModelUuid
/**
* Returns permalink url
*/
public function url(): string
public function toPermalink(): string
{
// make sure UUID is cached because the permalink
// route only looks up UUIDs from cache
@ -70,9 +70,17 @@ class PageUuid extends ModelUuid
$url = $kirby->url();
if ($language = $kirby->language('current')) {
$url .= '/' . $language->code();
$url = $language->url();
}
return $url . '/@/' . static::TYPE . '/' . $this->id();
}
/**
* @deprecated 5.1.0 Use `::toPermalink()` instead
*/
public function url(): string
{
return $this->toPermalink();
}
}

View file

@ -13,6 +13,7 @@ use Kirby\Cms\User;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Exception\LogicException;
use Kirby\Exception\NotFoundException;
use Kirby\Toolkit\A;
use Kirby\Toolkit\Str;
use Stringable;
@ -282,14 +283,16 @@ abstract class Uuid implements Stringable
*/
final public static function is(
string $string,
string|null $type = null
string|array|null $type = null
): bool {
// always return false when UUIDs have been disabled
if (Uuids::enabled() === false) {
return false;
}
$type ??= implode('|', Uri::$schemes);
// use all available schemes by default
$type ??= Uri::$schemes;
$type = implode('|', A::wrap($type));
$pattern = sprintf('!^(%s)://(.*)!', $type);
if (preg_match($pattern, $string, $matches) !== 1) {
@ -409,6 +412,32 @@ abstract class Uuid implements Stringable
return $this->uri->toString();
}
/**
* Returns the URL of the model, including the query and fragment
* @since 5.1.0
*/
public function toUrl(): string|null
{
$model = $this->model();
if ($model === null) {
return null;
}
if (method_exists($model, 'url') === false) {
return null;
}
$url = $model->url();
$url .= $this->uri->query->toString(true);
if ($this->uri->hasFragment() === true) {
$url .= '#' . $this->uri->fragment();
}
return $url;
}
/**
* Returns value to be stored in cache
*/