upgrade to Dotclear 2.27

This commit is contained in:
Jean-Christian Paul Denis 2023-08-15 11:48:45 +02:00
parent 6e7d12a8eb
commit 4029e0ea75
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
4 changed files with 15 additions and 58 deletions

View File

@ -15,26 +15,18 @@ declare(strict_types=1);
namespace Dotclear\Plugin\lunarPhase; namespace Dotclear\Plugin\lunarPhase;
use dcCore; use dcCore;
use dcNsProcess; use Dotclear\Core\Process;
use Dotclear\Helper\Html\Form\{
Checkbox,
Input,
Label,
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,21 +15,19 @@ declare(strict_types=1);
namespace Dotclear\Plugin\lunarPhase; namespace Dotclear\Plugin\lunarPhase;
use dcCore; use dcCore;
use dcNsProcess;
use dcUtils; use dcUtils;
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;
} }

View File

@ -14,12 +14,12 @@ declare(strict_types=1);
namespace Dotclear\Plugin\lunarPhase; namespace Dotclear\Plugin\lunarPhase;
use dcCore; use Dotclear\Module\MyPlugin;
/** /**
* This module definitions. * This module definitions.
*/ */
class My class My extends MyPlugin
{ {
/** @var array<string,string> List of lunar phase => image */ /** @var array<string,string> List of lunar phase => image */
public const LUNAR_PHASES = [ public const LUNAR_PHASES = [
@ -32,30 +32,4 @@ class My
'last_quarter_moon' => 'tqm.png', 'last_quarter_moon' => 'tqm.png',
'waning_crescent_moon' => 'wcm2.png', 'waning_crescent_moon' => 'wcm2.png',
]; ];
/**
* 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,20 +15,18 @@ declare(strict_types=1);
namespace Dotclear\Plugin\lunarPhase; namespace Dotclear\Plugin\lunarPhase;
use dcCore; use dcCore;
use dcNsProcess; use Dotclear\Core\Process;
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;
} }
@ -38,11 +36,6 @@ class Prepend extends dcNsProcess
'lunarphase.css', 'lunarphase.css',
'^lunarphase\.css', '^lunarphase\.css',
function (?string $args): void { function (?string $args): void {
// avoid null warning
if (is_null(dcCore::app()->blog)) {
return;
}
header('Content-Type: text/css; charset=UTF-8'); header('Content-Type: text/css; charset=UTF-8');
echo "/* lunarphase widget style */\n"; echo "/* lunarphase widget style */\n";
@ -50,7 +43,7 @@ class Prepend extends dcNsProcess
echo sprintf( echo sprintf(
"#sidebar .lunarphase ul li.%s{background:transparent url(%s) no-repeat left 0.2em;padding-left:2em;}\n", "#sidebar .lunarphase ul li.%s{background:transparent url(%s) no-repeat left 0.2em;padding-left:2em;}\n",
$phase, $phase,
dcCore::app()->blog->getPF(My::id() . '/img/' . $image) My::fileURL('img/' . $image)
); );
} }