page evenement
This commit is contained in:
Regular → Executable
+19
-13
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace Grav\Common;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Grav\Common\Config\Config;
|
||||
use Grav\Common\Config\Setup;
|
||||
use Grav\Common\Helpers\Exif;
|
||||
@@ -134,7 +135,7 @@ class Grav extends Container
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function resetInstance()
|
||||
public static function resetInstance(): void
|
||||
{
|
||||
if (self::$instance) {
|
||||
// @phpstan-ignore-next-line
|
||||
@@ -152,6 +153,13 @@ class Grav extends Container
|
||||
{
|
||||
if (null === self::$instance) {
|
||||
self::$instance = static::load($values);
|
||||
|
||||
/** @var ClassLoader|null $loader */
|
||||
$loader = self::$instance['loader'] ?? null;
|
||||
if ($loader) {
|
||||
// Load fix for Deferred Twig Extension
|
||||
$loader->addPsr4('Phive\\Twig\\Extensions\\Deferred\\', LIB_DIR . 'Phive/Twig/Extensions/Deferred/', true);
|
||||
}
|
||||
} elseif ($values) {
|
||||
$instance = self::$instance;
|
||||
foreach ($values as $key => $value) {
|
||||
@@ -234,7 +242,7 @@ class Grav extends Container
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function process()
|
||||
public function process(): void
|
||||
{
|
||||
if (isset($this->initialized['process'])) {
|
||||
return;
|
||||
@@ -466,7 +474,7 @@ class Grav extends Container
|
||||
* @param int $code Redirection code (30x)
|
||||
* @return void
|
||||
*/
|
||||
public function redirectLangSafe($route, $code = null)
|
||||
public function redirectLangSafe($route, $code = null): void
|
||||
{
|
||||
if (!$this['uri']->isExternal($route)) {
|
||||
$this->redirect($this['pages']->route($route), $code);
|
||||
@@ -481,7 +489,7 @@ class Grav extends Container
|
||||
* @param ResponseInterface|null $response
|
||||
* @return void
|
||||
*/
|
||||
public function header(ResponseInterface $response = null)
|
||||
public function header(ResponseInterface $response = null): void
|
||||
{
|
||||
if (null === $response) {
|
||||
/** @var PageInterface $page */
|
||||
@@ -506,7 +514,7 @@ class Grav extends Container
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLocale()
|
||||
public function setLocale(): void
|
||||
{
|
||||
// Initialize Locale if set and configured.
|
||||
if ($this['language']->enabled() && $this['config']->get('system.languages.override_locale')) {
|
||||
@@ -567,7 +575,7 @@ class Grav extends Container
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function shutdown()
|
||||
public function shutdown(): void
|
||||
{
|
||||
// Prevent user abort allowing onShutdown event to run without interruptions.
|
||||
if (function_exists('ignore_user_abort')) {
|
||||
@@ -686,7 +694,7 @@ class Grav extends Container
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerServices()
|
||||
protected function registerServices(): void
|
||||
{
|
||||
foreach (self::$diMap as $serviceKey => $serviceClass) {
|
||||
if (is_int($serviceKey)) {
|
||||
@@ -753,12 +761,10 @@ class Grav extends Container
|
||||
// unsupported media type, try to download it...
|
||||
if ($uri_extension) {
|
||||
$extension = $uri_extension;
|
||||
} elseif (isset($path_parts['extension'])) {
|
||||
$extension = $path_parts['extension'];
|
||||
} else {
|
||||
if (isset($path_parts['extension'])) {
|
||||
$extension = $path_parts['extension'];
|
||||
} else {
|
||||
$extension = null;
|
||||
}
|
||||
$extension = null;
|
||||
}
|
||||
|
||||
if ($extension) {
|
||||
@@ -773,6 +779,6 @@ class Grav extends Container
|
||||
return false;
|
||||
}
|
||||
|
||||
return $page;
|
||||
return $page ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user