From 5c55eaa50388017e58d32677b6b7a5e773268f45 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 6 Aug 2023 18:26:15 +0200 Subject: [PATCH] upgrade to Dotclear 2.27 --- src/Backend.php | 10 ++++------ src/Frontend.php | 10 ++++------ src/My.php | 29 ++--------------------------- src/Prepend.php | 10 ++++------ 4 files changed, 14 insertions(+), 45 deletions(-) diff --git a/src/Backend.php b/src/Backend.php index 37c635c..8de956d 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -15,20 +15,18 @@ declare(strict_types=1); namespace Dotclear\Plugin\CategoriesPage; use dcCore; -use dcNsProcess; +use Dotclear\Core\Process; -class Backend extends dcNsProcess +class Backend extends Process { public static function init(): bool { - static::$init = defined('DC_CONTEXT_ADMIN'); - - return static::$init; + return self::status(My::checkContext(My::BACKEND)); } public static function process(): bool { - if (!static::$init) { + if (!self::status()) { return false; } diff --git a/src/Frontend.php b/src/Frontend.php index 9fadc04..172d673 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -16,20 +16,18 @@ namespace Dotclear\Plugin\CategoriesPage; use ArrayObject; use dcCore; -use dcNsProcess; +use Dotclear\Core\Process; -class Frontend extends dcNsProcess +class Frontend extends Process { public static function init(): bool { - static::$init = defined('DC_RC_PATH'); - - return static::$init; + return self::status(My::checkContext(My::FRONTEND)); } public static function process(): bool { - if (!static::$init) { + if (!self::status()) { return false; } diff --git a/src/My.php b/src/My.php index f12b804..b01b31c 100644 --- a/src/My.php +++ b/src/My.php @@ -14,36 +14,11 @@ declare(strict_types=1); namespace Dotclear\Plugin\CategoriesPage; -use dcCore; +use Dotclear\Module\MyPlugin; /** * This module definitions. */ -class My +class My extends MyPlugin { - /** - * This module id. - */ - public static function id(): string - { - return basename(dirname(__DIR__)); - } - - /** - * This module name. - */ - public static function name(): string - { - $name = dcCore::app()->plugins->moduleInfo(self::id(), 'name'); - - return __(is_string($name) ? $name : self::id()); - } - - /** - * This module path. - */ - public static function path(): string - { - return dirname(__DIR__); - } } diff --git a/src/Prepend.php b/src/Prepend.php index 7757e28..7d781a9 100644 --- a/src/Prepend.php +++ b/src/Prepend.php @@ -15,20 +15,18 @@ declare(strict_types=1); namespace Dotclear\Plugin\CategoriesPage; use dcCore; -use dcNsProcess; +use Dotclear\Core\Process; -class Prepend extends dcNsProcess +class Prepend extends Process { public static function init(): bool { - static::$init = defined('DC_RC_PATH'); - - return static::$init; + return self::status(My::checkContext(My::PREPEND)); } public static function process(): bool { - if (!static::$init) { + if (!self::status()) { return false; }