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