Add blueprints and fake content
This commit is contained in:
parent
1ff19bf38f
commit
8235816462
592 changed files with 22385 additions and 31535 deletions
|
@ -3,22 +3,23 @@
|
|||
namespace Kirby\Cms;
|
||||
|
||||
use Kirby\Data\Data;
|
||||
use Kirby\Email\PHPMailer as Emailer;
|
||||
use Kirby\Exception\ErrorPageException;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Exception\LogicException;
|
||||
use Kirby\Exception\NotFoundException;
|
||||
use Kirby\Filesystem\Dir;
|
||||
use Kirby\Filesystem\F;
|
||||
use Kirby\Http\Request;
|
||||
use Kirby\Http\Router;
|
||||
use Kirby\Http\Server;
|
||||
use Kirby\Http\Uri;
|
||||
use Kirby\Http\Visitor;
|
||||
use Kirby\Session\AutoSession;
|
||||
use Kirby\Text\KirbyTag;
|
||||
use Kirby\Text\KirbyTags;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\Config;
|
||||
use Kirby\Toolkit\Controller;
|
||||
use Kirby\Toolkit\Dir;
|
||||
use Kirby\Toolkit\F;
|
||||
use Kirby\Toolkit\Properties;
|
||||
use Throwable;
|
||||
|
||||
|
@ -53,6 +54,7 @@ class App
|
|||
|
||||
protected $api;
|
||||
protected $collections;
|
||||
protected $core;
|
||||
protected $defaultLanguage;
|
||||
protected $language;
|
||||
protected $languages;
|
||||
|
@ -84,6 +86,8 @@ class App
|
|||
*/
|
||||
public function __construct(array $props = [], bool $setInstance = true)
|
||||
{
|
||||
$this->core = new Core($this);
|
||||
|
||||
// register all roots to be able to load stuff afterwards
|
||||
$this->bakeRoots($props['roots'] ?? []);
|
||||
|
||||
|
@ -265,7 +269,7 @@ class App
|
|||
*/
|
||||
protected function bakeRoots(array $roots = null)
|
||||
{
|
||||
$roots = array_merge(require dirname(__DIR__, 2) . '/config/roots.php', (array)$roots);
|
||||
$roots = array_merge($this->core->roots(), (array)$roots);
|
||||
$this->roots = Ingredients::bake($roots);
|
||||
return $this;
|
||||
}
|
||||
|
@ -283,7 +287,7 @@ class App
|
|||
$urls['index'] = $this->options['url'];
|
||||
}
|
||||
|
||||
$urls = array_merge(require $this->root('kirby') . '/config/urls.php', (array)$urls);
|
||||
$urls = array_merge($this->core->urls(), (array)$urls);
|
||||
$this->urls = Ingredients::bake($urls);
|
||||
return $this;
|
||||
}
|
||||
|
@ -503,6 +507,17 @@ class App
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get access to object that lists
|
||||
* all parts of Kirby core
|
||||
*
|
||||
* @return \Kirby\Cms\Core
|
||||
*/
|
||||
public function core()
|
||||
{
|
||||
return $this->core;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default language object
|
||||
*
|
||||
|
@ -555,11 +570,14 @@ class App
|
|||
*
|
||||
* @param mixed $preset
|
||||
* @param array $props
|
||||
* @return \Kirby\Email\PHPMailer
|
||||
* @return \Kirby\Email\Email
|
||||
*/
|
||||
public function email($preset = [], array $props = [])
|
||||
{
|
||||
return new Emailer((new Email($preset, $props))->toArray(), $props['debug'] ?? false);
|
||||
$debug = $props['debug'] ?? false;
|
||||
$props = (new Email($preset, $props))->toArray();
|
||||
|
||||
return ($this->component('email'))($this, $props, $debug);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -641,12 +659,11 @@ class App
|
|||
// any direct exception will be turned into an error page
|
||||
if (is_a($input, 'Throwable') === true) {
|
||||
if (is_a($input, 'Kirby\Exception\Exception') === true) {
|
||||
$code = $input->getHttpCode();
|
||||
$message = $input->getMessage();
|
||||
$code = $input->getHttpCode();
|
||||
} else {
|
||||
$code = $input->getCode();
|
||||
$message = $input->getMessage();
|
||||
$code = $input->getCode();
|
||||
}
|
||||
$message = $input->getMessage();
|
||||
|
||||
if ($code < 400 || $code > 599) {
|
||||
$code = 500;
|
||||
|
@ -748,8 +765,13 @@ class App
|
|||
$data['kirby'] = $data['kirby'] ?? $this;
|
||||
$data['site'] = $data['site'] ?? $data['kirby']->site();
|
||||
$data['parent'] = $data['parent'] ?? $data['site']->page();
|
||||
$options = $this->options;
|
||||
|
||||
return KirbyTags::parse($text, $data, $this->options, $this);
|
||||
$text = $this->apply('kirbytags:before', compact('text', 'data', 'options'), 'text');
|
||||
$text = KirbyTags::parse($text, $data, $options);
|
||||
$text = $this->apply('kirbytags:after', compact('text', 'data', 'options'), 'text');
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -818,17 +840,28 @@ class App
|
|||
/**
|
||||
* Returns all available site languages
|
||||
*
|
||||
* @param bool
|
||||
* @return \Kirby\Cms\Languages
|
||||
*/
|
||||
public function languages()
|
||||
public function languages(bool $clone = true)
|
||||
{
|
||||
if ($this->languages !== null) {
|
||||
return clone $this->languages;
|
||||
return $clone === true ? clone $this->languages : $this->languages;
|
||||
}
|
||||
|
||||
return $this->languages = Languages::load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Access Kirby's part loader
|
||||
*
|
||||
* @return \Kirby\Cms\Loader
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
return new Loader($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the app's locks object
|
||||
*
|
||||
|
@ -996,6 +1029,10 @@ class App
|
|||
$parent = $parent ?? $this->site();
|
||||
|
||||
if ($page = $parent->find($id)) {
|
||||
/**
|
||||
* We passed a single $id, we can be sure that the result is
|
||||
* @var \Kirby\Cms\Page $page
|
||||
*/
|
||||
return $page;
|
||||
}
|
||||
|
||||
|
@ -1213,7 +1250,7 @@ class App
|
|||
}
|
||||
|
||||
$registry = $this->extensions('routes');
|
||||
$system = (include $this->root('kirby') . '/config/routes.php')($this);
|
||||
$system = $this->core->routes();
|
||||
$routes = array_merge($system['before'], $registry, $system['after']);
|
||||
|
||||
return $this->routes = $routes;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue