mirror of
https://github.com/getgrav/grav.git
synced 2026-07-05 10:29:04 +02:00
Minor bug fixes
This commit is contained in:
@@ -43,7 +43,7 @@ class Excerpts
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function getPage(): PageInterface
|
||||
public function getPage(): ?PageInterface
|
||||
{
|
||||
return $this->page;
|
||||
}
|
||||
|
||||
@@ -258,14 +258,14 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface
|
||||
*/
|
||||
public function randomizeFilter($original, $offset = 0)
|
||||
{
|
||||
if (!\is_array($original)) {
|
||||
return $original;
|
||||
}
|
||||
|
||||
if ($original instanceof \Traversable) {
|
||||
$original = iterator_to_array($original, false);
|
||||
}
|
||||
|
||||
if (!\is_array($original)) {
|
||||
return $original;
|
||||
}
|
||||
|
||||
$sorted = [];
|
||||
$random = array_slice($original, $offset);
|
||||
shuffle($random);
|
||||
|
||||
@@ -81,8 +81,16 @@ class UserCollection implements UserCollectionInterface
|
||||
{
|
||||
$fields = (array)$fields;
|
||||
|
||||
$account_dir = Grav::instance()['locator']->findResource('account://');
|
||||
$files = $account_dir ? array_diff(scandir($account_dir), ['.', '..']) : [];
|
||||
$grav = Grav::instance();
|
||||
/** @var UniformResourceLocator $locator */
|
||||
$locator = $grav['locator'];
|
||||
|
||||
$account_dir = $locator->findResource('account://');
|
||||
if (!is_string($account_dir)) {
|
||||
return $this->load('');
|
||||
}
|
||||
|
||||
$files = array_diff(scandir($account_dir) ?: [], ['.', '..']);
|
||||
|
||||
// Try with username first, you never know!
|
||||
if (in_array('username', $fields, true)) {
|
||||
|
||||
@@ -362,7 +362,7 @@ class User extends FlexObject implements UserInterface, MediaManipulationInterfa
|
||||
|
||||
$old = $this->get($name, null, $separator);
|
||||
if ($old !== null) {
|
||||
$value = $this->getBlueprint()->mergeData($value, $old, $name, $separator);
|
||||
$value = $this->getBlueprint()->mergeData($value, $old, $name, $separator ?? '.');
|
||||
}
|
||||
|
||||
$this->setNestedProperty($name, $value, $separator);
|
||||
@@ -399,7 +399,7 @@ class User extends FlexObject implements UserInterface, MediaManipulationInterfa
|
||||
}
|
||||
|
||||
// Return joined data.
|
||||
return $this->getBlueprint()->mergeData($old, $value, $name, $separator);
|
||||
return $this->getBlueprint()->mergeData($old, $value, $name, $separator ?? '.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -133,7 +133,7 @@ class FlexPageCollection extends FlexCollection
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user