Update Composer packages
This commit is contained in:
parent
d482354bdf
commit
e7e7361480
219 changed files with 6487 additions and 4444 deletions
|
@ -18,6 +18,7 @@ use Kirby\Http\Router;
|
|||
use Kirby\Http\Uri;
|
||||
use Kirby\Http\Visitor;
|
||||
use Kirby\Session\AutoSession;
|
||||
use Kirby\Template\Snippet;
|
||||
use Kirby\Text\KirbyTag;
|
||||
use Kirby\Text\KirbyTags;
|
||||
use Kirby\Toolkit\A;
|
||||
|
@ -481,28 +482,23 @@ class App
|
|||
|
||||
/**
|
||||
* Try to find a controller by name
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $contentType
|
||||
* @return \Kirby\Toolkit\Controller|null
|
||||
*/
|
||||
protected function controllerLookup(string $name, string $contentType = 'html')
|
||||
protected function controllerLookup(string $name, string $contentType = 'html'): Controller|null
|
||||
{
|
||||
if ($contentType !== null && $contentType !== 'html') {
|
||||
$name .= '.' . $contentType;
|
||||
}
|
||||
|
||||
// controller on disk
|
||||
if ($controller = Controller::load($this->root('controllers') . '/' . $name . '.php')) {
|
||||
// controller from site root
|
||||
$controller = Controller::load($this->root('controllers') . '/' . $name . '.php');
|
||||
// controller from extension
|
||||
$controller ??= $this->extension('controllers', $name);
|
||||
|
||||
if ($controller instanceof Controller) {
|
||||
return $controller;
|
||||
}
|
||||
|
||||
// registry controller
|
||||
if ($controller = $this->extension('controllers', $name)) {
|
||||
if ($controller instanceof Controller) {
|
||||
return $controller;
|
||||
}
|
||||
|
||||
if ($controller !== null) {
|
||||
return new Controller($controller);
|
||||
}
|
||||
|
||||
|
@ -1278,6 +1274,11 @@ class App
|
|||
// set the current locale
|
||||
$this->setCurrentLanguage($language);
|
||||
|
||||
// directly prevent path with incomplete content representation
|
||||
if (Str::endsWith($path, '.') === true) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// the site is needed a couple times here
|
||||
$site = $this->site();
|
||||
|
||||
|
@ -1557,24 +1558,6 @@ class App
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Environment object
|
||||
* @deprecated 3.7.0 Use `$kirby->environment()` instead
|
||||
*
|
||||
* @return \Kirby\Http\Environment
|
||||
* @deprecated Will be removed in Kirby 3.9.0
|
||||
* @todo Remove in 3.9.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function server()
|
||||
{
|
||||
// @codeCoverageIgnoreStart
|
||||
Helpers::deprecated('$kirby->server() has been deprecated and will be removed in Kirby 3.9.0. Use $kirby->environment() instead.');
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
return $this->environment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes and returns the Site object
|
||||
*
|
||||
|
@ -1624,21 +1607,24 @@ class App
|
|||
* Uses the snippet component to create
|
||||
* and return a template snippet
|
||||
*
|
||||
* @param mixed $name
|
||||
* @param array|object $data Variables or an object that becomes `$item`
|
||||
* @param bool $return On `false`, directly echo the snippet
|
||||
* @return string|null
|
||||
* @psalm-return ($return is true ? string : null)
|
||||
*/
|
||||
public function snippet($name, $data = [], bool $return = true): string|null
|
||||
public function snippet(string|array|null $name, $data = [], bool $return = true, bool $slots = false): Snippet|string|null
|
||||
{
|
||||
if (is_object($data) === true) {
|
||||
$data = ['item' => $data];
|
||||
}
|
||||
|
||||
$snippet = ($this->component('snippet'))($this, $name, array_merge($this->data, $data));
|
||||
$snippet = ($this->component('snippet'))(
|
||||
$this,
|
||||
$name,
|
||||
array_merge($this->data, $data),
|
||||
$slots
|
||||
);
|
||||
|
||||
if ($return === true) {
|
||||
if ($return === true || $slots === true) {
|
||||
return $snippet;
|
||||
}
|
||||
|
||||
|
@ -1661,7 +1647,7 @@ class App
|
|||
* and return the Template object
|
||||
*
|
||||
* @internal
|
||||
* @return \Kirby\Cms\Template
|
||||
* @return \Kirby\Template\Template
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @param string $defaultType
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue