upgrade to Dotclear 2.27

This commit is contained in:
Jean-Christian Paul Denis 2023-08-06 22:24:59 +02:00
parent 16c264ebcb
commit a31ad5a915
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
4 changed files with 37 additions and 22 deletions

View File

@ -15,20 +15,18 @@ declare(strict_types=1);
namespace Dotclear\Plugin\countdown;
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;
}

View File

@ -15,20 +15,18 @@ declare(strict_types=1);
namespace Dotclear\Plugin\countdown;
use dcCore;
use dcNsProcess;
use Dotclear\Core\Process;
class Frontend extends dcNsProcess
class Frontend extends Process
{
public static function init(): bool
{
static::$init = true;
return static::$init;
return self::status(My::checkContext(My::FRONTEND));
}
public static function process(): bool
{
if (!static::$init) {
if (!self::status()) {
return false;
}

24
src/My.php Normal file
View File

@ -0,0 +1,24 @@
<?php
/**
* @brief countdown, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Moe (http://gniark.net/) and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
namespace Dotclear\Plugin\countdown;
use Dotclear\Module\MyPlugin;
/**
* This module definitions.
*/
class My extends MyPlugin
{
}

View File

@ -15,7 +15,6 @@ declare(strict_types=1);
namespace Dotclear\Plugin\countdown;
use dcCore;
use dcUtils;
use Dotclear\Helper\Date;
use Dotclear\Helper\Html\Html;
use Dotclear\Plugin\widgets\WidgetsStack;
@ -23,10 +22,6 @@ use Dotclear\Plugin\widgets\WidgetsElement;
class Widgets
{
public static function id(): string
{
return basename(dirname(__DIR__));
}
public static function initWidgets(WidgetsStack $w): void
{
if (is_null(dcCore::app()->blog)) {
@ -203,7 +198,7 @@ class Widgets
}
if (!$w->dynamic || is_null(dcCore::app()->ctx)) {
$res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
$res = ($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') .
'<p>' . $text . '<span>' . $str . '</span></p>';
return $w->renderDiv((bool) $w->content_only, 'countdown ' . $w->class, '', $res);
@ -219,13 +214,13 @@ class Widgets
$script = '';
if (!defined('COUNTDOWN_SCRIPT')) {
$script .= dcUtils::cssLoad(dcCore::app()->blog->getPF(self::id() . '/css/jquery.countdown.css')) .
dcUtils::jsLoad(dcCore::app()->blog->getPF(self::id() . '/js/jquery.plugin.min.js')) .
dcUtils::jsLoad(dcCore::app()->blog->getPF(self::id() . '/js/jquery.countdown.min.js'));
$script .= My::cssLoad('jquery.countdown.css') .
My::jsLoad('jquery.plugin.min.js') .
My::jsLoad('jquery.countdown.min.js');
$l10n_file = 'jquery.countdown-' . dcCore::app()->blog->settings->get('system')->get('lang') . '.js';
if (file_exists(__DIR__ . '/../js/' . $l10n_file)) {
$script .= dcUtils::jsLoad(dcCore::app()->blog->getPF(self::id() . '/js/' . $l10n_file));
$script .= My::jsLoad($l10n_file);
}
define('COUNTDOWN_SCRIPT', (bool) true);