upgrade to Dotclear 2.27

master
Jean-Christian Paul Denis 2023-08-12 18:20:12 +02:00
parent 980f880ca5
commit 0d0e69ccc3
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
4 changed files with 30 additions and 18 deletions

View File

@ -15,20 +15,18 @@ declare(strict_types=1);
namespace Dotclear\Plugin\emailNotification; namespace Dotclear\Plugin\emailNotification;
use dcCore; use dcCore;
use dcNsProcess; use Dotclear\Core\Process;
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

@ -26,11 +26,6 @@ class BackendBehaviors
{ {
public static function adminUserForm(): void public static function adminUserForm(): void
{ {
// nullsafe PHP < 8.0
if (is_null(dcCore::app()->auth)) {
return;
}
$options = dcCore::app()->auth->getOptions(); $options = dcCore::app()->auth->getOptions();
echo echo

View File

@ -17,7 +17,7 @@ namespace Dotclear\Plugin\emailNotification;
use dcAuth; use dcAuth;
use dcBlog; use dcBlog;
use dcCore; use dcCore;
use dcNsProcess; use Dotclear\Core\Process;
use Dotclear\Database\{ use Dotclear\Database\{
Cursor, Cursor,
MetaRecord MetaRecord
@ -30,24 +30,22 @@ use Dotclear\Helper\Html\Html;
use Dotclear\Helper\Network\Mail\Mail; use Dotclear\Helper\Network\Mail\Mail;
use rsExtUser; use rsExtUser;
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;
} }
dcCore::app()->addBehavior('publicAfterCommentCreate', function (Cursor $cur, ?int $comment_id): void { dcCore::app()->addBehavior('publicAfterCommentCreate', function (Cursor $cur, ?int $comment_id): void {
// nullsafe PHP < 8.0 // nullsafe PHP < 8.0
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->blog)) { if (is_null(dcCore::app()->blog)) {
return; return;
} }

21
src/My.php 100644
View File

@ -0,0 +1,21 @@
<?php
/**
* @brief emailNotification, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Olivier Meunier 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\emailNotification;
use Dotclear\Module\MyPlugin;
class My extends MyPlugin
{
}