From de3f675e33c7ce264762365fd1af10624ed1f5fc Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 26 Mar 2023 21:11:26 +0200 Subject: [PATCH] fix static init --- src/Backend.php | 6 +++--- src/Install.php | 6 +++--- src/Manage.php | 19 +++++++++---------- src/Prepend.php | 6 +++--- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/Backend.php b/src/Backend.php index f42acd6..234b852 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -25,14 +25,14 @@ class Backend extends dcNsProcess { public static function init(): bool { - self::$init = defined('DC_CONTEXT_ADMIN'); + static::$init = defined('DC_CONTEXT_ADMIN'); - return self::$init; + return static::$init; } public static function process(): bool { - if (!self::$init) { + if (!static::$init) { return false; } diff --git a/src/Install.php b/src/Install.php index 5271e97..1932b08 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 32fa48b..75615c5 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -30,20 +30,19 @@ class Manage extends dcNsProcess { public static function init(): bool { - if (defined('DC_CONTEXT_ADMIN')) { - dcPage::check(dcCore::app()->auth->makePermissions([ - dcAuth::PERMISSION_CONTENT_ADMIN, - ])); + static::$init = defined('DC_CONTEXT_ADMIN') + && dcCore:app()->auth->check( + dcCore::app()->auth->makePermissions([ + dcAuth::PERMISSION_CONTENT_ADMIN, + ]), 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; } @@ -117,7 +116,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 b89be04..bb0afb4 100644 --- a/src/Prepend.php +++ b/src/Prepend.php @@ -20,14 +20,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; }