upgrade to Dotclear 2.27

This commit is contained in:
Jean-Christian Denis 2023-08-13 21:19:54 +02:00
parent 7e82d4d552
commit a969f1b66a
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
5 changed files with 20 additions and 53 deletions

View file

@ -15,26 +15,24 @@ declare(strict_types=1);
namespace Dotclear\Plugin\saba; namespace Dotclear\Plugin\saba;
use dcCore; use dcCore;
use dcNsProcess;
use dcSettings; use dcSettings;
use Dotclear\Core\Process;
use Dotclear\Helper\Html\Form\{ use Dotclear\Helper\Html\Form\{
Checkbox, Checkbox,
Label, Label,
Para Para
}; };
class Backend extends dcNsProcess class Backend extends Process
{ {
public static function init(): bool public static function init(): bool
{ {
static::$init = defined('DC_CONTEXT_ADMIN'); return self::status(My::checkContext(My::BACKEND));
return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!static::$init) { if (!self::status()) {
return false; return false;
} }

View file

@ -15,28 +15,26 @@ declare(strict_types=1);
namespace Dotclear\Plugin\saba; namespace Dotclear\Plugin\saba;
use dcCore; use dcCore;
use dcNsProcess; use Dotclear\Core\Process;
class Frontend extends dcNsProcess class Frontend extends Process
{ {
public static function init(): bool public static function init(): bool
{ {
static::$init = defined('DC_RC_PATH'); return self::status(My::checkContext(My::FRONTEND));
return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!static::$init) { if (!self::status()) {
return false; return false;
} }
if (is_null(dcCore::app()->blog) || !dcCore::app()->blog->settings->get(My::id())->get('active')) { if (My::settings()->get('active')) {
return false; return false;
} }
if (dcCore::app()->blog->settings->get(My::id())->get('error')) { if (My::settings()->get('error')) {
dcCore::app()->url->registerError([UrlHandler::class, 'error']); dcCore::app()->url->registerError([UrlHandler::class, 'error']);
} }

View file

@ -14,36 +14,11 @@ declare(strict_types=1);
namespace Dotclear\Plugin\saba; namespace Dotclear\Plugin\saba;
use dcCore; use Dotclear\Module\MyPlugin;
/** /**
* This module definitions. * 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__);
}
} }

View file

@ -15,25 +15,23 @@ declare(strict_types=1);
namespace Dotclear\Plugin\saba; namespace Dotclear\Plugin\saba;
use dcCore; use dcCore;
use dcNsProcess; use Dotclear\Core\Process;
use Dotclear\Plugin\activityReport\{ use Dotclear\Plugin\activityReport\{
Action, Action,
ActivityReport, ActivityReport,
Group Group
}; };
class Prepend extends dcNsProcess class Prepend extends Process
{ {
public static function init(): bool public static function init(): bool
{ {
static::$init = defined('DC_RC_PATH'); return self::status(My::checkContext(My::PREPEND));
return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!static::$init) { if (!self::status()) {
return false; return false;
} }

View file

@ -15,21 +15,19 @@ declare(strict_types=1);
namespace Dotclear\Plugin\saba; namespace Dotclear\Plugin\saba;
use dcCore; use dcCore;
use dcNsProcess; use Dotclear\Core\Process;
use Dotclear\Plugin\Uninstaller\Uninstaller; use Dotclear\Plugin\Uninstaller\Uninstaller;
class Uninstall extends dcNsProcess class Uninstall extends Process
{ {
public static function init(): bool public static function init(): bool
{ {
static::$init = defined('DC_CONTEXT_ADMIN'); return self::status(My::checkContext(My::UNINSTALL));
return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) { if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
return false; return false;
} }