Upgrade to 3.6.3
This commit is contained in:
@@ -22,7 +22,7 @@ use Throwable;
|
||||
* @package Kirby Api
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Api
|
||||
@@ -181,7 +181,7 @@ class Api
|
||||
|
||||
// get the locale from the translation
|
||||
$translation = $user->kirby()->translation($language);
|
||||
$locale = ($translation !== null)? $translation->locale() : $language;
|
||||
$locale = ($translation !== null) ? $translation->locale() : $language;
|
||||
|
||||
// provide some variants as fallbacks to be
|
||||
// compatible with as many systems as possible
|
||||
|
@@ -14,7 +14,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Api
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Collection
|
||||
|
@@ -16,7 +16,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Api
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Model
|
||||
|
@@ -10,7 +10,7 @@ use APCUIterator;
|
||||
* @package Kirby Cache
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class ApcuCache extends Cache
|
||||
|
@@ -11,7 +11,7 @@ namespace Kirby\Cache;
|
||||
* @package Kirby Cache
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
abstract class Cache
|
||||
|
@@ -13,7 +13,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cache
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class FileCache extends Cache
|
||||
|
@@ -10,7 +10,7 @@ use Memcached as MemcachedExt;
|
||||
* @package Kirby Cache
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class MemCached extends Cache
|
||||
|
@@ -8,7 +8,7 @@ namespace Kirby\Cache;
|
||||
* @package Kirby Cache
|
||||
* @author Lukas Bestle <lukas@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class MemoryCache extends Cache
|
||||
|
@@ -8,7 +8,7 @@ namespace Kirby\Cache;
|
||||
* @package Kirby Cache
|
||||
* @author Lukas Bestle <lukas@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class NullCache extends Cache
|
||||
|
@@ -12,7 +12,7 @@ use Throwable;
|
||||
* @package Kirby Cache
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class Value
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Form\Form;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Api extends BaseApi
|
||||
|
@@ -33,13 +33,11 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class App
|
||||
{
|
||||
const CLASS_ALIAS = 'kirby';
|
||||
|
||||
use AppCaches;
|
||||
use AppErrors;
|
||||
use AppPlugins;
|
||||
@@ -47,6 +45,8 @@ class App
|
||||
use AppUsers;
|
||||
use Properties;
|
||||
|
||||
public const CLASS_ALIAS = 'kirby';
|
||||
|
||||
protected static $instance;
|
||||
protected static $version;
|
||||
|
||||
@@ -56,6 +56,7 @@ class App
|
||||
protected $collections;
|
||||
protected $core;
|
||||
protected $defaultLanguage;
|
||||
protected $environment;
|
||||
protected $language;
|
||||
protected $languages;
|
||||
protected $locks;
|
||||
@@ -91,12 +92,17 @@ class App
|
||||
// register all roots to be able to load stuff afterwards
|
||||
$this->bakeRoots($props['roots'] ?? []);
|
||||
|
||||
// stuff from config and additional options
|
||||
$this->optionsFromConfig();
|
||||
$this->optionsFromProps($props['options'] ?? []);
|
||||
|
||||
// register the Whoops error handler
|
||||
$this->handleErrors();
|
||||
try {
|
||||
// stuff from config and additional options
|
||||
$this->optionsFromConfig();
|
||||
$this->optionsFromProps($props['options'] ?? []);
|
||||
$this->optionsFromEnvironment();
|
||||
} finally {
|
||||
// register the Whoops error handler inside of a
|
||||
// try-finally block to ensure it's still registered
|
||||
// even if there is a problem loading the configurations
|
||||
$this->handleErrors();
|
||||
}
|
||||
|
||||
// set the path to make it available for the url bakery
|
||||
$this->setPath($props['path'] ?? null);
|
||||
@@ -282,11 +288,6 @@ class App
|
||||
*/
|
||||
protected function bakeUrls(array $urls = null)
|
||||
{
|
||||
// inject the index URL from the config
|
||||
if (isset($this->options['url']) === true) {
|
||||
$urls['index'] = $this->options['url'];
|
||||
}
|
||||
|
||||
$urls = array_merge($this->core->urls(), (array)$urls);
|
||||
$this->urls = Ingredients::bake($urls);
|
||||
return $this;
|
||||
@@ -589,6 +590,17 @@ class App
|
||||
return ($this->component('email'))($this, $props, $debug);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the environment object with access
|
||||
* to the detected host, base url and dedicated options
|
||||
*
|
||||
* @return \Kirby\Cms\Environment
|
||||
*/
|
||||
public function environment()
|
||||
{
|
||||
return $this->environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds any file in the content directory
|
||||
*
|
||||
@@ -924,7 +936,10 @@ class App
|
||||
(array)$options
|
||||
);
|
||||
|
||||
return ($this->component('markdown'))($this, $text, $options);
|
||||
// TODO: deprecate passing the $inline parameter in 3.7.0
|
||||
// TODO: remove passing the $inline parameter in 3.8.0
|
||||
$inline = $options['inline'] ?? false;
|
||||
return ($this->component('markdown'))($this, $text, $options, $inline);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -982,18 +997,30 @@ class App
|
||||
*/
|
||||
protected function optionsFromConfig(): array
|
||||
{
|
||||
$server = $this->server();
|
||||
$root = $this->root('config');
|
||||
|
||||
// create an empty config container
|
||||
Config::$data = [];
|
||||
|
||||
$main = F::load($root . '/config.php', []);
|
||||
$host = F::load($root . '/config.' . basename($server->host()) . '.php', []);
|
||||
$addr = F::load($root . '/config.' . basename($server->address()) . '.php', []);
|
||||
// load the main config options
|
||||
$root = $this->root('config');
|
||||
$options = F::load($root . '/config.php', []);
|
||||
|
||||
$config = Config::$data;
|
||||
// merge into one clean options array
|
||||
return $this->options = array_replace_recursive(Config::$data, $options);
|
||||
}
|
||||
|
||||
return $this->options = array_replace_recursive($config, $main, $host, $addr);
|
||||
/**
|
||||
* Load all options for the current
|
||||
* server environment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function optionsFromEnvironment(): array
|
||||
{
|
||||
// create the environment based on the URL setup
|
||||
$this->environment = new Environment($this->root('config'), $this->options['url'] ?? null);
|
||||
|
||||
// merge into one clean options array
|
||||
return $this->options = array_replace_recursive($this->options, $this->environment->options());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1004,7 +1031,10 @@ class App
|
||||
*/
|
||||
protected function optionsFromProps(array $options = []): array
|
||||
{
|
||||
return $this->options = array_replace_recursive($this->options, $options);
|
||||
return $this->options = array_replace_recursive(
|
||||
$this->options,
|
||||
$options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1411,7 +1441,7 @@ class App
|
||||
*/
|
||||
public function server()
|
||||
{
|
||||
return $this->server = $this->server ?? new Server();
|
||||
return $this->server ??= new Server();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -11,7 +11,7 @@ use Kirby\Exception\InvalidArgumentException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait AppCaches
|
||||
|
@@ -16,7 +16,7 @@ use Whoops\Run as Whoops;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait AppErrors
|
||||
|
@@ -21,7 +21,7 @@ use Kirby\Toolkit\V;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait AppPlugins
|
||||
@@ -181,7 +181,7 @@ trait AppPlugins
|
||||
{
|
||||
return $this->extensions['blockModels'] = Block::$models = array_merge(Block::$models, $models);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Registers additional blocks methods
|
||||
*
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait AppTranslations
|
||||
|
@@ -11,7 +11,7 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait AppUsers
|
||||
|
@@ -20,7 +20,7 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Auth
|
||||
|
@@ -11,7 +11,7 @@ use Kirby\Cms\User;
|
||||
* @package Kirby Cms
|
||||
* @author Lukas Bestle <lukas@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
abstract class Challenge
|
||||
|
@@ -13,7 +13,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Lukas Bestle <lukas@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class EmailChallenge extends Challenge
|
||||
|
@@ -14,7 +14,7 @@ use Kirby\Toolkit\Properties;
|
||||
* @package Kirby Cms
|
||||
* @author Lukas Bestle <lukas@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Status
|
||||
|
@@ -15,15 +15,15 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Block extends Item
|
||||
{
|
||||
const ITEMS_CLASS = '\Kirby\Cms\Blocks';
|
||||
|
||||
use HasMethods;
|
||||
|
||||
public const ITEMS_CLASS = '\Kirby\Cms\Blocks';
|
||||
|
||||
/**
|
||||
* @var \Kirby\Cms\Content
|
||||
*/
|
||||
|
@@ -10,7 +10,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class BlockConverter
|
||||
|
@@ -18,12 +18,12 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Blocks extends Items
|
||||
{
|
||||
const ITEM_CLASS = '\Kirby\Cms\Block';
|
||||
public const ITEM_CLASS = '\Kirby\Cms\Block';
|
||||
|
||||
/**
|
||||
* Return HTML when the collection is
|
||||
|
@@ -20,7 +20,7 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Blueprint
|
||||
|
@@ -19,7 +19,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Collection extends BaseCollection
|
||||
|
@@ -17,7 +17,7 @@ use Kirby\Toolkit\Controller;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Collections
|
||||
|
@@ -11,7 +11,7 @@ use Kirby\Form\Form;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Content
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Exception\PermissionException;
|
||||
* @package Kirby Cms
|
||||
* @author Nico Hoffmann <nico@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class ContentLock
|
||||
|
@@ -13,7 +13,7 @@ use Kirby\Filesystem\F;
|
||||
* @author Nico Hoffmann <nico@getkirby.com>,
|
||||
* Lukas Bestle <lukas@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class ContentLocks
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Toolkit\Properties;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class ContentTranslation
|
||||
|
@@ -16,7 +16,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Core
|
||||
@@ -452,7 +452,7 @@ class Core
|
||||
public function urls(): array
|
||||
{
|
||||
return $this->cache['urls'] ??= [
|
||||
'index' => fn () => Url::index(),
|
||||
'index' => fn () => $this->kirby->environment()->url(),
|
||||
'base' => fn (array $urls) => rtrim($urls['index'], '/'),
|
||||
'current' => function (array $urls) {
|
||||
$path = trim($this->kirby->path(), '/');
|
||||
|
@@ -14,7 +14,7 @@ use Kirby\Exception\NotFoundException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Email
|
||||
|
222
kirby/src/Cms/Environment.php
Executable file
222
kirby/src/Cms/Environment.php
Executable file
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Filesystem\F;
|
||||
use Kirby\Http\Server;
|
||||
use Kirby\Http\Uri;
|
||||
|
||||
/**
|
||||
* The environment object takes care of
|
||||
* secure host and base URL detection, as
|
||||
* well as loading the dedicated
|
||||
* environment options.
|
||||
*
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Environment
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $root;
|
||||
|
||||
/**
|
||||
* @var \Kirby\Http\Uri
|
||||
*/
|
||||
protected $uri;
|
||||
|
||||
/**
|
||||
* @param string $root
|
||||
* @param bool|string|array|null $allowed
|
||||
*/
|
||||
public function __construct(string $root, $allowed = null)
|
||||
{
|
||||
$this->root = $root;
|
||||
|
||||
if (is_string($allowed) === true) {
|
||||
$this->setupFromString($allowed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_array($allowed) === true) {
|
||||
$this->setupFromArray($allowed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_int($allowed) === true) {
|
||||
$this->setupFromFlag($allowed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_null($allowed) === true) {
|
||||
$this->setupFromFlag(Server::HOST_FROM_SERVER | Server::HOST_ALLOW_EMPTY);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('Invalid allow list setup for base URLs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw an exception if the host in the URI
|
||||
* object is empty
|
||||
*
|
||||
* @throws \Kirby\Exception\InvalidArgumentException
|
||||
* @return void
|
||||
*/
|
||||
protected function blockEmptyHost(): void
|
||||
{
|
||||
if (empty($this->uri->host()) === true) {
|
||||
throw new InvalidArgumentException('Invalid host setup. The detected host is not allowed.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the detected host name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function host(): ?string
|
||||
{
|
||||
return $this->uri->host();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and returns the environment options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function options(): array
|
||||
{
|
||||
$configHost = [];
|
||||
$configAddr = [];
|
||||
|
||||
$host = $this->host();
|
||||
$addr = Server::address();
|
||||
|
||||
// load the config for the host
|
||||
if (empty($host) === false) {
|
||||
$configHost = F::load($this->root . '/config.' . $host . '.php', []);
|
||||
}
|
||||
|
||||
// load the config for the server IP
|
||||
if (empty($addr) === false) {
|
||||
$configAddr = F::load($this->root . '/config.' . $addr . '.php', []);
|
||||
}
|
||||
|
||||
return array_replace_recursive($configHost, $configAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* The current URL should be auto detected from a host allowlist
|
||||
*
|
||||
* @param array $allowed
|
||||
* @return \Kirby\Http\Uri
|
||||
*/
|
||||
public function setupFromArray(array $allowed)
|
||||
{
|
||||
$allowedStrings = [];
|
||||
$allowedUris = [];
|
||||
$hosts = [];
|
||||
|
||||
foreach ($allowed as $url) {
|
||||
$allowedUris[] = $uri = new Uri($url, ['slash' => false]);
|
||||
$allowedStrings[] = $uri->toString();
|
||||
$hosts[] = $uri->host();
|
||||
}
|
||||
|
||||
// register all allowed hosts
|
||||
Server::hosts($hosts);
|
||||
|
||||
// get the index URL, including the subfolder if it exists
|
||||
$this->uri = Uri::index();
|
||||
|
||||
// empty URLs don't make sense in an allow list
|
||||
$this->blockEmptyHost();
|
||||
|
||||
// validate against the list of allowed base URLs
|
||||
if (in_array($this->uri->toString(), $allowedStrings) === false) {
|
||||
throw new InvalidArgumentException('The subfolder is not in the allowed base URL list');
|
||||
}
|
||||
|
||||
return $this->uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL option receives a set of Server constant flags
|
||||
*
|
||||
* Server::HOST_FROM_SERVER
|
||||
* Server::HOST_FROM_SERVER | Server::HOST_ALLOW_EMPTY
|
||||
* Server::HOST_FROM_HOST
|
||||
* Server::HOST_FROM_HOST | Server::HOST_ALLOW_EMPTY
|
||||
*
|
||||
* @param int $allowed
|
||||
* @return \Kirby\Http\Uri
|
||||
*/
|
||||
public function setupFromFlag(int $allowed)
|
||||
{
|
||||
// allow host detection from host headers
|
||||
if ($allowed & Server::HOST_FROM_HEADER) {
|
||||
Server::hosts(Server::HOST_FROM_HEADER);
|
||||
|
||||
// detect host only from server name
|
||||
} else {
|
||||
Server::hosts(Server::HOST_FROM_SERVER);
|
||||
}
|
||||
|
||||
// get the base URL
|
||||
$this->uri = Uri::index();
|
||||
|
||||
// accept empty hosts
|
||||
if ($allowed & Server::HOST_ALLOW_EMPTY) {
|
||||
return $this->uri;
|
||||
}
|
||||
|
||||
// block empty hosts
|
||||
$this->blockEmptyHost();
|
||||
|
||||
return $this->uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current URL is predefined with a single string
|
||||
* and not detected automatically.
|
||||
*
|
||||
* If the url option is relative (i.e. '/' or '/some/subfolder')
|
||||
* The host will be empty and that's totally fine.
|
||||
* No need to block an empty host here
|
||||
*
|
||||
* @param string $allowed
|
||||
* @return \Kirby\Http\Uri
|
||||
*/
|
||||
public function setupFromString(string $allowed)
|
||||
{
|
||||
// create the URI object directly from the given option
|
||||
// without any form of detection from the server
|
||||
$this->uri = new Uri($allowed);
|
||||
|
||||
// only create an allow list from absolute URLs
|
||||
// otherwise the default secure host detection
|
||||
// behavior will be used
|
||||
if (empty($host = $this->uri->host()) === false) {
|
||||
Server::hosts([$host]);
|
||||
}
|
||||
|
||||
return $this->uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base URL for the environment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function url(): string
|
||||
{
|
||||
return $this->uri;
|
||||
}
|
||||
}
|
@@ -16,7 +16,7 @@ use Kirby\Toolkit\Controller;
|
||||
* @author Lukas Bestle <lukas@getkirby.com>,
|
||||
* Ahmet Bora
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Event
|
||||
|
@@ -21,7 +21,7 @@ use Kirby\Exception\InvalidArgumentException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Field
|
||||
|
@@ -14,12 +14,12 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Fieldset extends Item
|
||||
{
|
||||
const ITEMS_CLASS = '\Kirby\Cms\Fieldsets';
|
||||
public const ITEMS_CLASS = '\Kirby\Cms\Fieldsets';
|
||||
|
||||
protected $disabled;
|
||||
protected $editable;
|
||||
|
@@ -14,12 +14,12 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Fieldsets extends Items
|
||||
{
|
||||
const ITEM_CLASS = '\Kirby\Cms\Fieldset';
|
||||
public const ITEM_CLASS = '\Kirby\Cms\Fieldset';
|
||||
|
||||
protected static function createFieldsets($params)
|
||||
{
|
||||
|
@@ -25,19 +25,19 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class File extends ModelWithContent
|
||||
{
|
||||
const CLASS_ALIAS = 'file';
|
||||
|
||||
use FileActions;
|
||||
use FileModifications;
|
||||
use HasMethods;
|
||||
use HasSiblings;
|
||||
use IsFile;
|
||||
|
||||
public const CLASS_ALIAS = 'file';
|
||||
|
||||
/**
|
||||
* Cache for the initialized blueprint object
|
||||
*
|
||||
|
@@ -14,7 +14,7 @@ use Kirby\Form\Form;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait FileActions
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class FileBlueprint extends Blueprint
|
||||
|
@@ -10,7 +10,7 @@ use Kirby\Exception\InvalidArgumentException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait FileModifications
|
||||
|
@@ -8,7 +8,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class FilePermissions extends ModelPermissions
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Exception\InvalidArgumentException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class FilePicker extends Picker
|
||||
|
@@ -15,7 +15,7 @@ use Kirby\Toolkit\V;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class FileRules
|
||||
|
@@ -10,7 +10,7 @@ use Kirby\Filesystem\IsFile;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class FileVersion
|
||||
|
@@ -16,7 +16,7 @@ use Kirby\Filesystem\F;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Files extends Collection
|
||||
|
@@ -14,7 +14,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Find
|
||||
|
@@ -11,7 +11,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait HasChildren
|
||||
|
@@ -8,7 +8,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait HasFiles
|
||||
|
@@ -10,7 +10,7 @@ use Kirby\Exception\BadMethodCallException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait HasMethods
|
||||
|
@@ -9,7 +9,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait HasSiblings
|
||||
|
@@ -10,7 +10,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Html extends \Kirby\Toolkit\Html
|
||||
|
@@ -11,7 +11,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Ingredients
|
||||
|
@@ -15,15 +15,15 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Item
|
||||
{
|
||||
const ITEMS_CLASS = '\Kirby\Cms\Items';
|
||||
|
||||
use HasSiblings;
|
||||
|
||||
public const ITEMS_CLASS = '\Kirby\Cms\Items';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@@ -12,12 +12,12 @@ use Exception;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Items extends Collection
|
||||
{
|
||||
const ITEM_CLASS = '\Kirby\Cms\Item';
|
||||
public const ITEM_CLASS = '\Kirby\Cms\Item';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
@@ -23,7 +23,7 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Language extends Model
|
||||
|
@@ -15,7 +15,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class LanguageRouter
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class LanguageRules
|
||||
|
@@ -11,7 +11,7 @@ use Kirby\Filesystem\F;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Languages extends Collection
|
||||
|
@@ -10,15 +10,15 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Layout extends Item
|
||||
{
|
||||
const ITEMS_CLASS = '\Kirby\Cms\Layouts';
|
||||
|
||||
use HasMethods;
|
||||
|
||||
public const ITEMS_CLASS = '\Kirby\Cms\Layouts';
|
||||
|
||||
/**
|
||||
* @var \Kirby\Cms\Content
|
||||
*/
|
||||
|
@@ -12,15 +12,15 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class LayoutColumn extends Item
|
||||
{
|
||||
const ITEMS_CLASS = '\Kirby\Cms\LayoutColumns';
|
||||
|
||||
use HasMethods;
|
||||
|
||||
public const ITEMS_CLASS = '\Kirby\Cms\LayoutColumns';
|
||||
|
||||
/**
|
||||
* @var \Kirby\Cms\Blocks
|
||||
*/
|
||||
|
@@ -9,10 +9,10 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class LayoutColumns extends Items
|
||||
{
|
||||
const ITEM_CLASS = '\Kirby\Cms\LayoutColumn';
|
||||
public const ITEM_CLASS = '\Kirby\Cms\LayoutColumn';
|
||||
}
|
||||
|
@@ -12,12 +12,12 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Layouts extends Items
|
||||
{
|
||||
const ITEM_CLASS = '\Kirby\Cms\Layout';
|
||||
public const ITEM_CLASS = '\Kirby\Cms\Layout';
|
||||
|
||||
public static function factory(array $items = null, array $params = [])
|
||||
{
|
||||
|
@@ -23,7 +23,7 @@ use Kirby\Filesystem\F;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Loader
|
||||
|
@@ -15,7 +15,7 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Media
|
||||
|
@@ -10,7 +10,7 @@ use Kirby\Toolkit\Properties;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
abstract class Model
|
||||
@@ -23,7 +23,7 @@ abstract class Model
|
||||
* The CLASS_ALIAS is a short human-readable
|
||||
* version of the class name. I.e. page.
|
||||
*/
|
||||
const CLASS_ALIAS = null;
|
||||
public const CLASS_ALIAS = null;
|
||||
|
||||
/**
|
||||
* The parent Kirby instance
|
||||
|
@@ -10,7 +10,7 @@ use Kirby\Toolkit\A;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
abstract class ModelPermissions
|
||||
|
@@ -15,7 +15,7 @@ use Throwable;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
abstract class ModelWithContent extends Model
|
||||
|
@@ -13,7 +13,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Nest
|
||||
|
@@ -11,7 +11,7 @@ use Kirby\Toolkit\Collection as BaseCollection;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class NestCollection extends BaseCollection
|
||||
|
@@ -10,7 +10,7 @@ use Kirby\Toolkit\Obj;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class NestObject extends Obj
|
||||
|
@@ -20,13 +20,11 @@ use Kirby\Toolkit\A;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Page extends ModelWithContent
|
||||
{
|
||||
const CLASS_ALIAS = 'page';
|
||||
|
||||
use PageActions;
|
||||
use PageSiblings;
|
||||
use HasChildren;
|
||||
@@ -34,6 +32,8 @@ class Page extends ModelWithContent
|
||||
use HasMethods;
|
||||
use HasSiblings;
|
||||
|
||||
public const CLASS_ALIAS = 'page';
|
||||
|
||||
/**
|
||||
* All registered page methods
|
||||
*
|
||||
@@ -1338,7 +1338,7 @@ class Page extends ModelWithContent
|
||||
'mediaUrl' => $this->mediaUrl(),
|
||||
'mediaRoot' => $this->mediaRoot(),
|
||||
'num' => $this->num(),
|
||||
'parent' => $this->parent() ? $this->parent()->id(): null,
|
||||
'parent' => $this->parent() ? $this->parent()->id() : null,
|
||||
'slug' => $this->slug(),
|
||||
'template' => $this->template(),
|
||||
'translations' => $this->translations()->toArray(),
|
||||
|
@@ -19,7 +19,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait PageActions
|
||||
@@ -780,10 +780,8 @@ trait PageActions
|
||||
foreach ($sorted as $key => $id) {
|
||||
if ($id === $this->id()) {
|
||||
continue;
|
||||
} else {
|
||||
if ($sibling = $siblings->get($id)) {
|
||||
$sibling->changeNum($key + 1);
|
||||
}
|
||||
} elseif ($sibling = $siblings->get($id)) {
|
||||
$sibling->changeNum($key + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class PageBlueprint extends Blueprint
|
||||
|
@@ -8,7 +8,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class PagePermissions extends ModelPermissions
|
||||
|
@@ -13,7 +13,7 @@ use Kirby\Exception\InvalidArgumentException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class PagePicker extends Picker
|
||||
|
@@ -14,7 +14,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class PageRules
|
||||
|
@@ -8,7 +8,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait PageSiblings
|
||||
|
@@ -17,7 +17,7 @@ use Kirby\Exception\InvalidArgumentException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Pages extends Collection
|
||||
|
@@ -17,7 +17,7 @@ use Kirby\Toolkit\Pagination as BasePagination;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Pagination extends BasePagination
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Exception\InvalidArgumentException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Permissions
|
||||
|
@@ -9,7 +9,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
abstract class Picker
|
||||
|
@@ -15,7 +15,7 @@ use Kirby\Toolkit\V;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Plugin extends Model
|
||||
|
@@ -14,7 +14,7 @@ use Kirby\Http\Response;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class PluginAssets
|
||||
|
@@ -10,7 +10,7 @@ use Kirby\Toolkit\Facade;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class R extends Facade
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Responder
|
||||
|
@@ -9,7 +9,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Response extends \Kirby\Http\Response
|
||||
|
@@ -14,7 +14,7 @@ use Kirby\Toolkit\I18n;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Role extends Model
|
||||
|
@@ -13,7 +13,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Roles extends Collection
|
||||
|
@@ -10,7 +10,7 @@ use Kirby\Toolkit\Facade;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class S extends Facade
|
||||
|
@@ -11,7 +11,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Search
|
||||
|
@@ -11,7 +11,7 @@ use Kirby\Toolkit\Component;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Section extends Component
|
||||
|
@@ -17,18 +17,18 @@ use Kirby\Toolkit\A;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Site extends ModelWithContent
|
||||
{
|
||||
const CLASS_ALIAS = 'site';
|
||||
|
||||
use SiteActions;
|
||||
use HasChildren;
|
||||
use HasFiles;
|
||||
use HasMethods;
|
||||
|
||||
public const CLASS_ALIAS = 'site';
|
||||
|
||||
/**
|
||||
* The SiteBlueprint object
|
||||
*
|
||||
@@ -572,10 +572,10 @@ class Site extends ModelWithContent
|
||||
return [
|
||||
'children' => $this->children()->keys(),
|
||||
'content' => $this->content()->toArray(),
|
||||
'errorPage' => $this->errorPage() ? $this->errorPage()->id(): false,
|
||||
'errorPage' => $this->errorPage() ? $this->errorPage()->id() : false,
|
||||
'files' => $this->files()->keys(),
|
||||
'homePage' => $this->homePage() ? $this->homePage()->id(): false,
|
||||
'page' => $this->page() ? $this->page()->id(): false,
|
||||
'homePage' => $this->homePage() ? $this->homePage()->id() : false,
|
||||
'page' => $this->page() ? $this->page()->id() : false,
|
||||
'title' => $this->title()->value(),
|
||||
'url' => $this->url(),
|
||||
];
|
||||
|
@@ -10,7 +10,7 @@ use Closure;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait SiteActions
|
||||
|
@@ -9,7 +9,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class SiteBlueprint extends Blueprint
|
||||
|
@@ -8,7 +8,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class SitePermissions extends ModelPermissions
|
||||
|
@@ -12,7 +12,7 @@ use Kirby\Toolkit\Str;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class SiteRules
|
||||
|
@@ -15,7 +15,7 @@ use Kirby\Exception\InvalidArgumentException;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Structure extends Collection
|
||||
|
@@ -15,7 +15,7 @@ namespace Kirby\Cms;
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class StructureObject extends Model
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user