Update Composer packages
This commit is contained in:
parent
0320235f6c
commit
a8b68fb61b
378 changed files with 28466 additions and 28852 deletions
|
@ -71,10 +71,8 @@ class File extends ModelWithContent
|
|||
|
||||
/**
|
||||
* The absolute path to the file
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $root;
|
||||
protected string|null $root = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -83,10 +81,8 @@ class File extends ModelWithContent
|
|||
|
||||
/**
|
||||
* The public file Url
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $url;
|
||||
protected string|null $url = null;
|
||||
|
||||
/**
|
||||
* Magic caller for file methods
|
||||
|
@ -164,7 +160,7 @@ class File extends ModelWithContent
|
|||
*/
|
||||
public function blueprint()
|
||||
{
|
||||
if (is_a($this->blueprint, 'Kirby\Cms\FileBlueprint') === true) {
|
||||
if ($this->blueprint instanceof FileBlueprint) {
|
||||
return $this->blueprint;
|
||||
}
|
||||
|
||||
|
@ -267,9 +263,10 @@ class File extends ModelWithContent
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
if (is_a($this->parent(), 'Kirby\Cms\Page') === true) {
|
||||
return $this->id = $this->parent()->id() . '/' . $this->filename();
|
||||
} elseif (is_a($this->parent(), 'Kirby\Cms\User') === true) {
|
||||
if (
|
||||
$this->parent() instanceof Page ||
|
||||
$this->parent() instanceof User
|
||||
) {
|
||||
return $this->id = $this->parent()->id() . '/' . $this->filename();
|
||||
}
|
||||
|
||||
|
@ -298,11 +295,7 @@ class File extends ModelWithContent
|
|||
|
||||
$template = $this->template();
|
||||
|
||||
if (isset($readable[$template]) === true) {
|
||||
return $readable[$template];
|
||||
}
|
||||
|
||||
return $readable[$template] = $this->permissions()->can('read');
|
||||
return $readable[$template] ??= $this->permissions()->can('read');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -398,7 +391,11 @@ class File extends ModelWithContent
|
|||
*/
|
||||
public function page()
|
||||
{
|
||||
return is_a($this->parent(), 'Kirby\Cms\Page') === true ? $this->parent() : null;
|
||||
if ($this->parent() instanceof Page) {
|
||||
return $this->parent();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -439,13 +436,22 @@ class File extends ModelWithContent
|
|||
*/
|
||||
public function parents()
|
||||
{
|
||||
if (is_a($this->parent(), 'Kirby\Cms\Page') === true) {
|
||||
if ($this->parent() instanceof Page) {
|
||||
return $this->parent()->parents()->prepend($this->parent()->id(), $this->parent());
|
||||
}
|
||||
|
||||
return new Pages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the permanent URL to the file using its UUID
|
||||
* @since 3.8.0
|
||||
*/
|
||||
public function permalink(): string|null
|
||||
{
|
||||
return $this->uuid()?->url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the permissions object for this file
|
||||
*
|
||||
|
@ -461,7 +467,7 @@ class File extends ModelWithContent
|
|||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function root(): ?string
|
||||
public function root(): string|null
|
||||
{
|
||||
return $this->root ??= $this->parent()->root() . '/' . $this->filename();
|
||||
}
|
||||
|
@ -570,7 +576,11 @@ class File extends ModelWithContent
|
|||
*/
|
||||
public function site()
|
||||
{
|
||||
return is_a($this->parent(), 'Kirby\Cms\Site') === true ? $this->parent() : $this->kirby()->site();
|
||||
if ($this->parent() instanceof Site) {
|
||||
return $this->parent();
|
||||
}
|
||||
|
||||
return $this->kirby()->site();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -578,7 +588,7 @@ class File extends ModelWithContent
|
|||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function template(): ?string
|
||||
public function template(): string|null
|
||||
{
|
||||
return $this->template ??= $this->content()->get('template')->value();
|
||||
}
|
||||
|
@ -616,98 +626,6 @@ class File extends ModelWithContent
|
|||
return $this->url ??= ($this->kirby()->component('file::url'))($this->kirby(), $this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deprecated!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides a kirbytag or markdown
|
||||
* tag for the file, which will be
|
||||
* used in the panel, when the file
|
||||
* gets dragged onto a textarea
|
||||
*
|
||||
* @todo Remove in 3.8.0
|
||||
*
|
||||
* @internal
|
||||
* @param string|null $type (null|auto|kirbytext|markdown)
|
||||
* @param bool $absolute
|
||||
* @return string
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function dragText(string $type = null, bool $absolute = false): string
|
||||
{
|
||||
Helpers::deprecated('Cms\File::dragText() has been deprecated and will be removed in Kirby 3.8.0. Use $file->panel()->dragText() instead.');
|
||||
return $this->panel()->dragText($type, $absolute);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all actions
|
||||
* that can be performed in the Panel
|
||||
*
|
||||
* @todo Remove in 3.8.0
|
||||
*
|
||||
* @since 3.3.0 This also checks for the lock status
|
||||
* @since 3.5.1 This also checks for matching accept settings
|
||||
*
|
||||
* @param array $unlock An array of options that will be force-unlocked
|
||||
* @return array
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function panelOptions(array $unlock = []): array
|
||||
{
|
||||
Helpers::deprecated('Cms\File::panelOptions() has been deprecated and will be removed in Kirby 3.8.0. Use $file->panel()->options() instead.');
|
||||
return $this->panel()->options($unlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full path without leading slash
|
||||
*
|
||||
* @todo Remove in 3.8.0
|
||||
*
|
||||
* @internal
|
||||
* @return string
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function panelPath(): string
|
||||
{
|
||||
Helpers::deprecated('Cms\File::panelPath() has been deprecated and will be removed in Kirby 3.8.0. Use $file->panel()->path() instead.');
|
||||
return $this->panel()->path();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the response data for file pickers
|
||||
* and file fields
|
||||
*
|
||||
* @todo Remove in 3.8.0
|
||||
*
|
||||
* @param array|null $params
|
||||
* @return array
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function panelPickerData(array $params = []): array
|
||||
{
|
||||
Helpers::deprecated('Cms\File::panelPickerData() has been deprecated and will be removed in Kirby 3.8.0. Use $file->panel()->pickerData() instead.');
|
||||
return $this->panel()->pickerData($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the url to the editing view
|
||||
* in the panel
|
||||
*
|
||||
* @todo Remove in 3.8.0
|
||||
*
|
||||
* @internal
|
||||
* @param bool $relative
|
||||
* @return string
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function panelUrl(bool $relative = false): string
|
||||
{
|
||||
Helpers::deprecated('Cms\File::panelUrl() has been deprecated and will be removed in Kirby 3.8.0. Use $file->panel()->url() instead.');
|
||||
return $this->panel()->url($relative);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplified File URL that uses the parent
|
||||
* Page URL and the filename as a more stable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue