diff --git a/src/Backend.php b/src/Backend.php index 8701927..fd07841 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -15,20 +15,18 @@ declare(strict_types=1); namespace Dotclear\Plugin\shortArchives; 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 6ceeb40..cbaaeec 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -15,21 +15,18 @@ declare(strict_types=1); namespace Dotclear\Plugin\shortArchives; use dcCore; -use dcNsProcess; -use dcUtils; +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; } @@ -37,8 +34,8 @@ class Frontend extends dcNsProcess 'initWidgets' => [Widgets::class, 'initWidgets'], 'publicHeadContent' => function (): void { echo - dcUtils::jsModuleLoad(My::id() . '/js/accordion.js') . - dcUtils::cssModuleLoad(My::id() . '/css/frontend.css'); + My::jsLoad('accordion') . + My::cssLoad('frontend'); }, ]); diff --git a/src/My.php b/src/My.php index 7d0ce72..2a42d37 100644 --- a/src/My.php +++ b/src/My.php @@ -14,36 +14,11 @@ declare(strict_types=1); namespace Dotclear\Plugin\shortArchives; -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__); - } }