Upgrade to 3.2.5

This commit is contained in:
Bastian Allgeier
2019-09-24 11:00:59 +02:00
parent ff9b5b1861
commit 447a9dd266
234 changed files with 1990 additions and 1224 deletions

View File

@@ -5,7 +5,6 @@ namespace Kirby\Cms;
use Kirby\Image\Image;
use Kirby\Toolkit\A;
use Kirby\Toolkit\F;
use Kirby\Toolkit\Str;
/**
* The `$file` object provides a set
@@ -42,14 +41,14 @@ class File extends ModelWithContent
* This is used to do actual file
* method calls, like size, mime, etc.
*
* @var Kirby\Image\Image
* @var \Kirby\Image\Image
*/
protected $asset;
/**
* Cache for the initialized blueprint object
*
* @var Kirby\Cms\FileBlueprint
* @var \Kirby\Cms\FileBlueprint
*/
protected $blueprint;
@@ -73,7 +72,7 @@ class File extends ModelWithContent
/**
* The parent object
*
* @var Kirby\Cms\Model
* @var \Kirby\Cms\Model
*/
protected $parent;
@@ -141,7 +140,7 @@ class File extends ModelWithContent
*
* @return array
*/
public function __debuginfo(): array
public function __debugInfo(): array
{
return array_merge($this->toArray(), [
'content' => $this->content(),
@@ -165,7 +164,7 @@ class File extends ModelWithContent
* Returns the Image object
*
* @internal
* @return Kirby\Image\Image
* @return \Kirby\Image\Image
*/
public function asset()
{
@@ -175,7 +174,7 @@ class File extends ModelWithContent
/**
* Returns the FileBlueprint object for the file
*
* @return Kirby\Cms\FileBlueprint
* @return \Kirby\Cms\FileBlueprint
*/
public function blueprint()
{
@@ -189,7 +188,7 @@ class File extends ModelWithContent
/**
* Store the template in addition to the
* other content.
*
* @internal
* @param array $data
* @param string|null $languageCode
@@ -232,28 +231,32 @@ class File extends ModelWithContent
* gets dragged onto a textarea
*
* @internal
* @param string $type
* @param string $type (auto|kirbytext|markdown)
* @param bool $absolute
* @return string
*/
public function dragText($type = 'kirbytext', bool $absolute = false): string
public function dragText($type = 'auto', bool $absolute = false): string
{
if ($type === 'auto') {
$type = option('panel.kirbytext', true) ? 'kirbytext' : 'markdown';
}
$url = $absolute ? $this->id() : $this->filename();
switch ($type) {
case 'kirbytext':
if ($this->type() === 'image') {
return '(image: ' . $url . ')';
} else {
return '(file: ' . $url . ')';
}
// no break
case 'markdown':
if ($this->type() === 'image') {
return '![' . $this->alt() . '](' . $url . ')';
} else {
return '[' . $this->filename() . '](' . $url . ')';
}
// no break
default:
if ($this->type() === 'image') {
return '(image: ' . $url . ')';
} else {
return '(file: ' . $url . ')';
}
}
}
@@ -261,6 +264,7 @@ class File extends ModelWithContent
* Constructs a File object
*
* @internal
* @param mixed $props
* @return self
*/
public static function factory($props)
@@ -281,7 +285,7 @@ class File extends ModelWithContent
/**
* Returns the parent Files collection
*
* @return Kirby\Cms\Files
* @return \Kirby\Cms\Files
*/
public function files()
{
@@ -311,7 +315,7 @@ class File extends ModelWithContent
/**
* Compares the current object with the given file object
*
* @param Kirby\Cms\File $file
* @param \Kirby\Cms\File $file
* @return bool
*/
public function is(File $file): bool
@@ -355,7 +359,7 @@ class File extends ModelWithContent
/**
* @deprecated 3.0.0 Use `File::content()` instead
*
* @return Kirby\Cms\Content
* @return \Kirby\Cms\Content
*/
public function meta()
{
@@ -409,7 +413,7 @@ class File extends ModelWithContent
/**
* Returns the parent Page object
*
* @return Kirby\Cms\Page|null
* @return \Kirby\Cms\Page|null
*/
public function page()
{
@@ -468,7 +472,7 @@ class File extends ModelWithContent
*
* @internal
* @param string|null $query
* @return Kirby\Cms\File|Kirby\Cms\Asset|null
* @return \Kirby\Cms\File|\Kirby\Cms\Asset|null
*/
protected function panelImageSource(string $query = null)
{
@@ -538,7 +542,7 @@ class File extends ModelWithContent
/**
* Returns the parent Model object
*
* @return Kirby\Cms\Model
* @return \Kirby\Cms\Model
*/
public function parent()
{
@@ -563,7 +567,7 @@ class File extends ModelWithContent
/**
* Returns a collection of all parent pages
*
* @return Kirby\Cms\Pages
* @return \Kirby\Cms\Pages
*/
public function parents()
{
@@ -571,13 +575,13 @@ class File extends ModelWithContent
return $this->parent()->parents()->prepend($this->parent()->id(), $this->parent());
}
return new Pages;
return new Pages();
}
/**
* Returns the permissions object for this file
*
* @return Kirby\Cms\FilePermissions
* @return \Kirby\Cms\FilePermissions
*/
public function permissions()
{
@@ -598,7 +602,7 @@ class File extends ModelWithContent
* Returns the FileRules class to
* validate any important action.
*
* @return Kirby\Cms\FileRules
* @return \Kirby\Cms\FileRules
*/
protected function rules()
{
@@ -636,7 +640,7 @@ class File extends ModelWithContent
/**
* Sets the parent model object
*
* @param Kirby\Cms\Model $parent
* @param \Kirby\Cms\Model $parent
* @return self
*/
protected function setParent(Model $parent = null)
@@ -684,7 +688,7 @@ class File extends ModelWithContent
* Returns the parent Files collection
* @internal
*
* @return Kirby\Cms\Files
* @return \Kirby\Cms\Files
*/
protected function siblingsCollection()
{
@@ -694,7 +698,7 @@ class File extends ModelWithContent
/**
* Returns the parent Site object
*
* @return Kirby\Cms\Site
* @return \Kirby\Cms\Site
*/
public function site()
{
@@ -715,7 +719,7 @@ class File extends ModelWithContent
* Returns siblings with the same template
*
* @param bool $self
* @return Kirby\Cms\Files
* @return \Kirby\Cms\Files
*/
public function templateSiblings(bool $self = true)
{