Upgrade to 3.1.4
This commit is contained in:
@@ -650,6 +650,11 @@ class App
|
||||
$text = $this->apply('kirbytext:before', $text);
|
||||
$text = $this->kirbytags($text, $data);
|
||||
$text = $this->markdown($text, $inline);
|
||||
|
||||
if ($this->option('smartypants', false) !== false) {
|
||||
$text = $this->smartypants($text);
|
||||
}
|
||||
|
||||
$text = $this->apply('kirbytext:after', $text);
|
||||
|
||||
return $text;
|
||||
@@ -700,7 +705,11 @@ class App
|
||||
*/
|
||||
public function languages(): Languages
|
||||
{
|
||||
return $this->languages = $this->languages ?? Languages::load();
|
||||
if ($this->languages !== null) {
|
||||
return clone $this->languages;
|
||||
}
|
||||
|
||||
return $this->languages = Languages::load();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1122,7 +1131,13 @@ class App
|
||||
*/
|
||||
public function smartypants(string $text = null): string
|
||||
{
|
||||
return $this->component('smartypants')($this, $text, $this->options['smartypants'] ?? []);
|
||||
$options = $this->option('smartypants', []);
|
||||
|
||||
if ($options === true) {
|
||||
$options = [];
|
||||
}
|
||||
|
||||
return $this->component('smartypants')($this, $text, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Closure;
|
||||
use Exception;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Toolkit\Collection as BaseCollection;
|
||||
use Kirby\Toolkit\Str;
|
||||
@@ -125,8 +126,12 @@ class Collection extends BaseCollection
|
||||
* @param bool $i (ignore upper/lowercase for group names)
|
||||
* @return Collection A collection with an item for each group and a Collection for each group
|
||||
*/
|
||||
public function groupBy(string $field, bool $i = true)
|
||||
public function groupBy($field, bool $i = true)
|
||||
{
|
||||
if (is_string($field) === false) {
|
||||
throw new Exception('Cannot group by non-string values. Did you mean to call group()?');
|
||||
}
|
||||
|
||||
$groups = new Collection([], $this->parent());
|
||||
|
||||
foreach ($this->data as $key => $item) {
|
||||
|
||||
@@ -67,17 +67,23 @@ class Collections
|
||||
}
|
||||
|
||||
// if not yet cached
|
||||
if (isset($this->cache[$name]) === false) {
|
||||
if (
|
||||
isset($this->cache[$name]) === false ||
|
||||
$this->cache[$name]['data'] !== $data
|
||||
) {
|
||||
$controller = new Controller($this->collections[$name]);
|
||||
$this->cache[$name] = $controller->call(null, $data);
|
||||
$this->cache[$name] = [
|
||||
'result' => $controller->call(null, $data),
|
||||
'data' => $data
|
||||
];
|
||||
}
|
||||
|
||||
// return cloned object
|
||||
if (is_object($this->cache[$name]) === true) {
|
||||
return clone $this->cache[$name];
|
||||
if (is_object($this->cache[$name]['result']) === true) {
|
||||
return clone $this->cache[$name]['result'];
|
||||
}
|
||||
|
||||
return $this->cache[$name];
|
||||
return $this->cache[$name]['result'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -132,6 +132,11 @@ class Language extends Model
|
||||
$kirby = App::instance();
|
||||
$site = $kirby->site();
|
||||
|
||||
// convert site
|
||||
foreach ($site->files() as $file) {
|
||||
F::move($file->contentFile($from, true), $file->contentFile($to, true));
|
||||
}
|
||||
|
||||
F::move($site->contentFile($from, true), $site->contentFile($to, true));
|
||||
|
||||
// convert all pages
|
||||
@@ -489,7 +494,7 @@ class Language extends Model
|
||||
*/
|
||||
public function url(): string
|
||||
{
|
||||
return Url::to($this->pattern());
|
||||
return Url::makeAbsolute($this->pattern(), $this->kirby()->url());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ class Nest
|
||||
foreach ($data as $key => $value) {
|
||||
if (is_array($value) === true) {
|
||||
$result[$key] = static::create($value, $parent);
|
||||
} elseif (is_string($value) === true) {
|
||||
} elseif (is_scalar($value) === true) {
|
||||
$result[$key] = new Field($parent, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,9 +247,13 @@ class Page extends ModelWithContent
|
||||
}
|
||||
|
||||
$blueprints = [];
|
||||
$templates = $this->blueprint()->options()['changeTemplate'] ?? false;
|
||||
$templates = $this->blueprint()->options()['changeTemplate'] ?? [];
|
||||
$currentTemplate = $this->intendedTemplate()->name();
|
||||
|
||||
if (is_array($templates) === false) {
|
||||
$templates = [];
|
||||
}
|
||||
|
||||
// add the current template to the array
|
||||
$templates[] = $currentTemplate;
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ class PanelPlugins
|
||||
*/
|
||||
public function id(): string
|
||||
{
|
||||
return crc32(implode(array_values($this->files())));
|
||||
return hash('crc32', implode(array_values($this->files())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,6 +101,21 @@ class StructureObject extends Model
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the current object with the given structure object
|
||||
*
|
||||
* @param mixed $structure
|
||||
* @return bool
|
||||
*/
|
||||
public function is($structure): bool
|
||||
{
|
||||
if (is_a($structure, StructureObject::class) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this === $structure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent Model object
|
||||
*
|
||||
|
||||
@@ -372,6 +372,8 @@ class User extends ModelWithContent
|
||||
* @param string $password
|
||||
* @param Session|array $session Session options or session object to set the user in
|
||||
* @return bool
|
||||
*
|
||||
* @throws PermissionException If the password is not valid
|
||||
*/
|
||||
public function login(string $password, $session = null): bool
|
||||
{
|
||||
@@ -783,6 +785,10 @@ class User extends ModelWithContent
|
||||
*
|
||||
* @param string $password
|
||||
* @return boolean
|
||||
*
|
||||
* @throws NotFoundException If the user has no password
|
||||
* @throws InvalidArgumentException If the entered password is not valid
|
||||
* @throws InvalidArgumentException If the entered password does not match the user password
|
||||
*/
|
||||
public function validatePassword(string $password = null): bool
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user