upgrade to Dotclear 2.27
This commit is contained in:
parent
7057ffb7b9
commit
afe38af912
7 changed files with 23 additions and 70 deletions
|
@ -16,10 +16,10 @@ namespace Dotclear\Plugin\whiteListCom;
|
|||
|
||||
use dcCore;
|
||||
use dcNamespace;
|
||||
use dcNsProcess;
|
||||
use Dotclear\Core\Process;
|
||||
use Exception;
|
||||
|
||||
class Install extends dcNsProcess
|
||||
class Install extends Process
|
||||
{
|
||||
// Module specs
|
||||
private static array $mod_conf = [
|
||||
|
@ -39,18 +39,12 @@ class Install extends dcNsProcess
|
|||
|
||||
public static function init(): bool
|
||||
{
|
||||
static::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
||||
|
||||
return static::$init;
|
||||
return self::status(My::checkContext(My::INSTALL));
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!static::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
if (!self::status()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -60,7 +54,7 @@ class Install extends dcNsProcess
|
|||
|
||||
// Set module settings
|
||||
foreach (self::$mod_conf as $v) {
|
||||
dcCore::app()->blog->settings->get(My::id())->put(
|
||||
My::settings()->put(
|
||||
$v[0],
|
||||
$v[1],
|
||||
$v[2],
|
||||
|
|
29
src/My.php
29
src/My.php
|
@ -14,36 +14,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Dotclear\Plugin\whiteListCom;
|
||||
|
||||
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__);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,20 +16,18 @@ namespace Dotclear\Plugin\whiteListCom;
|
|||
|
||||
use dcBlog;
|
||||
use dcCore;
|
||||
use dcNsProcess;
|
||||
use Dotclear\Core\Process;
|
||||
|
||||
class Prepend extends dcNsProcess
|
||||
class Prepend extends Process
|
||||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
static::$init = true;
|
||||
|
||||
return static::$init;
|
||||
return self::status(My::checkContext(My::PREPEND));
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!static::$init) {
|
||||
if (!self::status()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ declare(strict_types=1);
|
|||
namespace Dotclear\Plugin\whiteListCom;
|
||||
|
||||
use dcCore;
|
||||
use dcPage;
|
||||
use Dotclear\Core\Backend\Notices;
|
||||
use Dotclear\Helper\Html\Form\{
|
||||
Checkbox,
|
||||
Hidden
|
||||
|
@ -91,7 +91,7 @@ class ReservedWhiteList extends SpamFilter
|
|||
Utils::addReserved($name, $_POST['reserved_email'][$i]);
|
||||
}
|
||||
Utils::commit();
|
||||
dcPage::addSuccessNotice(__('Reserved names have been successfully updated.'));
|
||||
Notices::addSuccessNotice(__('Reserved names have been successfully updated.'));
|
||||
Http::redirect($url);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,21 +15,19 @@ declare(strict_types=1);
|
|||
namespace Dotclear\Plugin\whiteListCom;
|
||||
|
||||
use dcCore;
|
||||
use dcNsProcess;
|
||||
use Dotclear\Core\Process;
|
||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||
|
||||
class Uninstall extends dcNsProcess
|
||||
class Uninstall extends Process
|
||||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
static::$init = defined('DC_CONTEXT_ADMIN');
|
||||
|
||||
return static::$init;
|
||||
return self::status(My::checkContext(My::UNINSTALL));
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
||||
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ declare(strict_types=1);
|
|||
namespace Dotclear\Plugin\whiteListCom;
|
||||
|
||||
use dcCore;
|
||||
use dcPage;
|
||||
use Dotclear\COre\Backend\Notices;
|
||||
use Dotclear\Helper\Html\Form\Checkbox;
|
||||
use Dotclear\Helper\Html\Html;
|
||||
use Dotclear\Helper\Network\Http;
|
||||
|
@ -79,7 +79,7 @@ class UnmoderatedWhiteList extends SpamFilter
|
|||
Utils::addUnmoderated($email);
|
||||
}
|
||||
Utils::commit();
|
||||
dcPage::addSuccessNotice(__('Unmoderated names have been successfully updated.'));
|
||||
Notices::addSuccessNotice(__('Unmoderated names have been successfully updated.'));
|
||||
Http::redirect($url);
|
||||
}
|
||||
$posts = Utils::getPostsUsers();
|
||||
|
|
|
@ -47,14 +47,8 @@ class Utils
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$s = dcCore::app()->blog->settings->get(My::id());
|
||||
|
||||
self::$unmoderated = self::decode($s->get('unmoderated'));
|
||||
self::$reserved = self::decode($s->get('reserved'));
|
||||
self::$unmoderated = self::decode(My::settings()->get('unmoderated'));
|
||||
self::$reserved = self::decode(My::settings()->get('reserved'));
|
||||
|
||||
self::$init = true;
|
||||
}
|
||||
|
@ -64,15 +58,9 @@ class Utils
|
|||
*/
|
||||
public static function commit(): void
|
||||
{
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::init();
|
||||
|
||||
$s = dcCore::app()->blog->settings->get(My::id());
|
||||
|
||||
$s->put(
|
||||
My::settings()->put(
|
||||
'unmoderated',
|
||||
self::encode(self::$unmoderated),
|
||||
'string',
|
||||
|
@ -81,7 +69,7 @@ class Utils
|
|||
false
|
||||
);
|
||||
|
||||
$s->put(
|
||||
My::settings()->put(
|
||||
'reserved',
|
||||
self::encode(self::$reserved),
|
||||
'string',
|
||||
|
|
Loading…
Reference in a new issue