Upgrade to 3.1.3

This commit is contained in:
Bastian Allgeier
2019-04-23 16:13:26 +02:00
parent eb29ef6d6c
commit 066913cb6e
53 changed files with 606 additions and 261 deletions

View File

@@ -232,6 +232,33 @@ class App
return $this;
}
/**
* Returns all available blueprints for this installation
*
* @param string $type
* @return array
*/
public function blueprints(string $type = 'pages')
{
$blueprints = [];
foreach ($this->extensions('blueprints') as $name => $blueprint) {
if (dirname($name) === $type) {
$name = basename($name);
$blueprints[$name] = $name;
}
}
foreach (glob($this->root('blueprints') . '/' . $type . '/*.yml') as $blueprint) {
$name = F::name($blueprint);
$blueprints[$name] = $name;
}
ksort($blueprints);
return array_values($blueprints);
}
/**
* Calls any Kirby route
*
@@ -406,7 +433,7 @@ class App
$visitor = $this->visitor();
foreach ($visitor->acceptedLanguages() as $lang) {
if ($language = $languages->findBy('locale', $lang->locale())) {
if ($language = $languages->findBy('locale', $lang->locale(LC_ALL))) {
return $language;
}
}
@@ -1156,9 +1183,11 @@ class App
public function trigger(string $name, ...$arguments)
{
if ($functions = $this->extension('hooks', $name)) {
static $level = 0;
static $triggered = [];
$level++;
foreach ($functions as $function) {
foreach ($functions as $index => $function) {
if (in_array($function, $triggered[$name] ?? []) === true) {
continue;
}
@@ -1169,6 +1198,12 @@ class App
// bind the App object to the hook
$function->call($this, ...$arguments);
}
$level--;
if ($level === 0) {
$triggered = [];
}
}
}
@@ -1204,6 +1239,16 @@ class App
return static::$version = static::$version ?? Data::read(static::$root . '/composer.json')['version'] ?? null;
}
/**
* Creates a hash of the version number
*
* @return string
*/
public static function versionHash(): string
{
return md5(static::version());
}
/**
* Returns the visitor object
*