Upgrade to 3.3.3
This commit is contained in:
@@ -513,11 +513,12 @@ class File extends ModelWithContent
|
||||
|
||||
if (empty($params['model']) === false) {
|
||||
$uuid = $this->parent() === $params['model'] ? $this->filename() : $this->id();
|
||||
$absolute = $this->parent() !== $params['model'];
|
||||
}
|
||||
|
||||
return [
|
||||
'filename' => $this->filename(),
|
||||
'dragText' => $this->dragText(),
|
||||
'dragText' => $this->dragText('auto', $absolute ?? false),
|
||||
'icon' => $icon,
|
||||
'id' => $this->id(),
|
||||
'image' => $image,
|
||||
|
@@ -68,6 +68,26 @@ trait FileModifications
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for File::bw()
|
||||
*
|
||||
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
|
||||
*/
|
||||
public function grayscale()
|
||||
{
|
||||
return $this->thumb(['grayscale' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for File::bw()
|
||||
*
|
||||
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
|
||||
*/
|
||||
public function greyscale()
|
||||
{
|
||||
return $this->thumb(['grayscale' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the JPEG compression quality
|
||||
*
|
||||
|
@@ -85,7 +85,10 @@ class FileRules
|
||||
static::validMime($file, $upload->mime());
|
||||
|
||||
|
||||
if ((string)$upload->mime() !== (string)$file->mime()) {
|
||||
if (
|
||||
(string)$upload->mime() !== (string)$file->mime() &&
|
||||
(string)$upload->extension() !== (string)$file->extension()
|
||||
) {
|
||||
throw new InvalidArgumentException([
|
||||
'key' => 'file.mime.differs',
|
||||
'data' => ['mime' => $file->mime()]
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Kirby\Toolkit\Dir;
|
||||
|
||||
/**
|
||||
* Extension of the Collection class that
|
||||
* introduces `Roles::factory()` to convert an
|
||||
@@ -116,12 +114,14 @@ class Roles extends Collection
|
||||
|
||||
// load roles from directory
|
||||
if ($root !== null) {
|
||||
foreach (Dir::read($root) as $filename) {
|
||||
foreach (glob($root . '/*.yml') as $file) {
|
||||
$filename = basename($file);
|
||||
|
||||
if ($filename === 'default.yml') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$role = Role::load($root . '/' . $filename, $inject);
|
||||
$role = Role::load($file, $inject);
|
||||
$roles->set($role->id(), $role);
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Kirby\Http\Url as BaseUrl;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
/**
|
||||
* The `Url` class extends the
|
||||
@@ -76,8 +77,16 @@ class Url extends BaseUrl
|
||||
}
|
||||
|
||||
// get a language url for the linked page, if the page can be found
|
||||
if ($kirby->multilang() === true && $page = page($path)) {
|
||||
$path = $page->url($language);
|
||||
if ($kirby->multilang() === true) {
|
||||
$parts = Str::split($path, '#');
|
||||
|
||||
if ($page = page($parts[0] ?? null)) {
|
||||
$path = $page->url($language);
|
||||
|
||||
if (isset($parts[1]) === true) {
|
||||
$path .= '#' . $parts[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $kirby->component('url')($kirby, $path, $options, function (string $path = null, $options = null) {
|
||||
|
@@ -65,6 +65,18 @@ class Darkroom
|
||||
$options['blur'] = 10;
|
||||
}
|
||||
|
||||
// normalize the greyscale option
|
||||
if (isset($options['greyscale']) === true) {
|
||||
$options['grayscale'] = $options['greyscale'];
|
||||
unset($options['greyscale']);
|
||||
}
|
||||
|
||||
// normalize the bw option
|
||||
if (isset($options['bw']) === true) {
|
||||
$options['grayscale'] = $options['bw'];
|
||||
unset($options['bw']);
|
||||
}
|
||||
|
||||
if ($options['quality'] === null) {
|
||||
$options['quality'] = $this->settings['quality'];
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Kirby\Toolkit;
|
||||
|
||||
use Zend\Escaper\Escaper;
|
||||
use Laminas\Escaper\Escaper;
|
||||
|
||||
/**
|
||||
* The `Escape` class provides methods
|
||||
@@ -12,8 +12,8 @@ use Zend\Escaper\Escaper;
|
||||
* attribute values like width, name,
|
||||
* value, etc.
|
||||
*
|
||||
* Wrapper for the Zend Escaper
|
||||
* @link https://github.com/zendframework/zend-escaper
|
||||
* Wrapper for the Laminas Escaper
|
||||
* @link https://github.com/laminas/laminas-escaper
|
||||
*
|
||||
* @package Kirby Toolkit
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
|
Reference in New Issue
Block a user