From f95ee36f69c9acce1e46510860ffd0d65ff28b60 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 26 Mar 2023 21:04:37 +0200 Subject: [PATCH] fix static init --- src/Frontend.php | 6 +++--- src/Install.php | 6 +++--- src/Manage.php | 16 +++++++--------- src/Prepend.php | 6 +++--- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/Frontend.php b/src/Frontend.php index d62e8e6..9936da4 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -22,14 +22,14 @@ class Frontend extends dcNsProcess { public static function init(): bool { - self::$init = defined('DC_RC_PATH'); + static::$init = defined('DC_RC_PATH'); - return self::$init; + return static::$init; } public static function process(): bool { - if (!self::$init || !Utils::isActive()) { + if (!static::$init || !Utils::isActive()) { return false; } diff --git a/src/Install.php b/src/Install.php index 4fc3d4e..f8774f6 100644 --- a/src/Install.php +++ b/src/Install.php @@ -22,14 +22,14 @@ class Install extends dcNsProcess { public static function init(): bool { - self::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version')); + static::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version')); - return self::$init; + return static::$init; } public static function process(): bool { - if (!self::$init) { + if (!static::$init) { return false; } diff --git a/src/Manage.php b/src/Manage.php index a585de8..7fce194 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -40,20 +40,18 @@ class Manage extends dcNsProcess { public static function init(): bool { - if (defined('DC_CONTEXT_ADMIN')) { - dcPage::check(dcCore::app()->auth->makePermissions([ + static::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->check( + dcCore::app()->auth->makePermissions([ My::PERMISSION, - ])); + ]), dcCore::app()->blog->id + ); - self::$init = true; - } - - return self::$init; + return static::$init; } public static function process(): bool { - if (!self::$init) { + if (!static::$init) { return false; } @@ -155,7 +153,7 @@ class Manage extends dcNsProcess public static function render(): void { - if (!self::$init) { + if (!static::$init) { return; } diff --git a/src/Prepend.php b/src/Prepend.php index f0e51a4..1979625 100644 --- a/src/Prepend.php +++ b/src/Prepend.php @@ -21,14 +21,14 @@ class Prepend extends dcNsProcess { public static function init(): bool { - self::$init = true; + static::$init = true; - return self::$init; + return static::$init; } public static function process(): bool { - if (!self::$init) { + if (!static::$init) { return false; }