Compare commits
2 Commits
dc477014c7
...
0f5601e66d
Author | SHA1 | Date |
---|---|---|
Jean-Christian Paul Denis | 0f5601e66d | |
Jean-Christian Paul Denis | db52b2d87f |
27
CHANGELOG.md
27
CHANGELOG.md
|
@ -1,17 +1,25 @@
|
||||||
todo
|
construction 1.8 - 2023.08.06
|
||||||
* disable widgets
|
===========================================================
|
||||||
|
* Require Dotclear 2.27
|
||||||
|
* Require PHP 7.4+
|
||||||
|
* Upgrade to Dotclear 2.27
|
||||||
|
* Move third party repository
|
||||||
|
* Use Dotclear style for changelog
|
||||||
|
|
||||||
1.7 - 2023.05.13
|
construction 1.7 - 2023.05.13
|
||||||
|
===========================================================
|
||||||
* require dotclear 2.26
|
* require dotclear 2.26
|
||||||
* fix editor ID
|
* fix editor ID
|
||||||
* fix nullsafe warnings
|
* fix nullsafe warnings
|
||||||
* add plugin Unnistaller features
|
* add plugin Unnistaller features
|
||||||
|
|
||||||
1.6 - 2023.04.10
|
construction 1.6 - 2023.04.10
|
||||||
|
===========================================================
|
||||||
* require dotclear 2.26
|
* require dotclear 2.26
|
||||||
* use namespace
|
* use namespace
|
||||||
|
|
||||||
1.5 - 2022.12.31
|
construction 1.5 - 2022.12.31
|
||||||
|
===========================================================
|
||||||
* update to dotclear 2.24
|
* update to dotclear 2.24
|
||||||
* use json intead of serialize
|
* use json intead of serialize
|
||||||
* use short settings names
|
* use short settings names
|
||||||
|
@ -19,13 +27,16 @@ todo
|
||||||
* use abstract plugin id
|
* use abstract plugin id
|
||||||
* fix phpstan and php-cs-fixer errors
|
* fix phpstan and php-cs-fixer errors
|
||||||
|
|
||||||
v1.4 - 20-12-2022 - Pierre Van Glebeke
|
construction 1.4 - 20-12-2022 - Pierre Van Glebeke
|
||||||
|
===========================================================
|
||||||
* màj partielle dc2.24
|
* màj partielle dc2.24
|
||||||
|
|
||||||
v1.3.1 - 18/02/2018 - Pierre Van Glebeke
|
construction 1.3.1 - 18/02/2018 - Pierre Van Glebeke
|
||||||
|
===========================================================
|
||||||
* modif icon
|
* modif icon
|
||||||
|
|
||||||
v1.3 - 19/02/2015 - Pierre Van Glebeke
|
construction 1.3 - 19/02/2015 - Pierre Van Glebeke
|
||||||
|
===========================================================
|
||||||
* cosmétique dc2.6
|
* cosmétique dc2.6
|
||||||
* jeux mustek et currywurst
|
* jeux mustek et currywurst
|
||||||
* localisation
|
* localisation
|
||||||
|
|
16
README.md
16
README.md
|
@ -1,11 +1,11 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/github/v/release/JcDenis/construction)](https://github.com/JcDenis/construction/releases)
|
[![Release](https://img.shields.io/github/v/release/JcDenis/construction)](https://git.dotclear.watch/JcDenis/construction/releases)
|
||||||
[![Date](https://img.shields.io/github/release-date/JcDenis/construction)](https://github.com/JcDenis/construction/releases)
|
[![Date](https://img.shields.io/github/release-date/JcDenis/construction)](https://git.dotclear.watch/JcDenis/construction/releases)
|
||||||
[![Issues](https://img.shields.io/github/issues/JcDenis/construction)](https://github.com/JcDenis/construction/issues)
|
[![Issues](https://img.shields.io/github/issues/JcDenis/construction)](https://git.dotclear.watch/JcDenis/construction/issues)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/construction)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/construction)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/construction)](https://github.com/JcDenis/construction/blob/master/LICENSE)
|
[![License](https://img.shields.io/github/license/JcDenis/construction)](https://git.dotclear.watch/JcDenis/construction/blob/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS DISCLAIMER ?
|
## WHAT IS DISCLAIMER ?
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ Blog can be accessible to defined IP addresses.
|
||||||
_construction_ requires:
|
_construction_ requires:
|
||||||
|
|
||||||
* admin permissions on blog
|
* admin permissions on blog
|
||||||
* Dotclear 2.26
|
* Dotclear 2.27
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ You can activate and setup _construction_ from sidebar menu "Construction".
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
||||||
* Source & contribution : [GitHub Page](https://github.com/JcDenis/construction)
|
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/construction) or [GitHub Page](https://github.com/JcDenis/construction)
|
||||||
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/construction)
|
* Packages & details : [Gitea Page](https://git.dotclear.watch/JcDenis/construction/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/construction)
|
||||||
* Help & discuss : [Dotclear forum](http://forum.dotclear.org/viewtopic.php?id=42875)
|
* Help & discuss : [Dotclear forum](http://forum.dotclear.org/viewtopic.php?id=42875)
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
10
_define.php
10
_define.php
|
@ -18,16 +18,16 @@ $this->registerModule(
|
||||||
'Construction',
|
'Construction',
|
||||||
'Place your blog maintenance',
|
'Place your blog maintenance',
|
||||||
'Osku and contributors',
|
'Osku and contributors',
|
||||||
'1.7',
|
'1.8',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.26']],
|
'requires' => [['core', '2.27']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => dcCore::app()->auth->makePermissions([
|
||||||
dcAuth::PERMISSION_ADMIN,
|
dcAuth::PERMISSION_ADMIN,
|
||||||
]),
|
]),
|
||||||
'priority' => 2000,
|
'priority' => 2000,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'http://forum.dotclear.org/viewtopic.php?id=42875',
|
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||||
'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
|
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
|
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
10
dcstore.xml
10
dcstore.xml
|
@ -2,12 +2,12 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="construction">
|
<module id="construction">
|
||||||
<name>Construction</name>
|
<name>Construction</name>
|
||||||
<version>1.7</version>
|
<version>1.8</version>
|
||||||
<author>Osku and contributors</author>
|
<author>Osku and contributors</author>
|
||||||
<desc>Place your blog maintenance</desc>
|
<desc>Place your blog maintenance</desc>
|
||||||
<file>https://github.com/JcDenis/construction/releases/download/v1.7/plugin-construction.zip</file>
|
<file>https://gitea.dotclear.watch/JcDenis/construction/releases/download/v1.8/plugin-construction.zip</file>
|
||||||
<da:dcmin>2.26</da:dcmin>
|
<da:dcmin>2.27</da:dcmin>
|
||||||
<da:details>https://plugins.dotaddict.org/dc2/details/construction</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/construction/src/branch/master/README.md</da:details>
|
||||||
<da:support>http://forum.dotclear.org/viewtopic.php?id=42875</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/construction/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
@ -14,65 +14,40 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
use dcAdmin;
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcPage;
|
use Dotclear\Core\Backend\{
|
||||||
use dcFavorites;
|
Favorites,
|
||||||
use dcNsProcess;
|
Menus
|
||||||
|
};
|
||||||
|
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));
|
||||||
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog) // nullsafe PHP < 8.0
|
|
||||||
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
|
||||||
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
|
|
||||||
]), dcCore::app()->blog->id);
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nullsafe PHP < 8.0
|
My::addBackendMenuItem(Menus::MENU_PLUGINS, [], '(&.*)?$', My::settings()->get('flag') ? 'construction-blog' : '');
|
||||||
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->blog) || is_null(dcCore::app()->adminurl)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
|
||||||
My::name(),
|
|
||||||
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
|
||||||
dcPage::getPF(My::id() . '/icon.svg'),
|
|
||||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
|
||||||
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_ADMIN]), dcCore::app()->blog->id),
|
|
||||||
dcCore::app()->blog->settings->get(My::id())->get('flag') ? 'construction-blog' : ''
|
|
||||||
);
|
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
dcCore::app()->addBehaviors([
|
||||||
'adminPageHTMLHead' => function (): void {
|
'adminPageHTMLHead' => function (): void {
|
||||||
// nullsafe PHP < 8.0
|
if (My::settings()->get('flag')) {
|
||||||
if (is_null(dcCore::app()->blog)) {
|
echo My::cssLoad('backend');
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (dcCore::app()->blog->settings->get(My::id())->get('flag')) {
|
|
||||||
echo dcPage::cssModuleLoad(My::id() . '/css/backend.css');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'adminDashboardFavoritesV2' => function (dcFavorites $favs): void {
|
'adminDashboardFavoritesV2' => function (Favorites $favs): void {
|
||||||
// nullsafe PHP < 8.0
|
|
||||||
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->adminurl)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$favs->register(My::id(), [
|
$favs->register(My::id(), [
|
||||||
'title' => My::name(),
|
'title' => My::name(),
|
||||||
'url' => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
'url' => My::manageUrl(),
|
||||||
'small-icon' => dcPage::getPF(My::id() . '/icon.svg'),
|
'small-icon' => My::icons(),
|
||||||
'large-icon' => dcPage::getPF(My::id() . '/icon.svg'),
|
'large-icon' => My::icons(),
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_ADMIN]),
|
'permissions' => dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_ADMIN]),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,32 +16,30 @@ namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Helper\Network\Http;
|
use Dotclear\Helper\Network\Http;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
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('publicBeforeDocument', function (): void {
|
dcCore::app()->addBehavior('publicBeforeDocumentV2', function (): void {
|
||||||
// nullsafe PHP < 8.0
|
// nullsafe PHP < 8.0
|
||||||
if (is_null(dcCore::app()->blog)) {
|
if (is_null(dcCore::app()->blog)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dcCore::app()->blog->settings->get(My::id())->get('flag')) {
|
if (!My::settings()->get('flag')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,11 +50,11 @@ class Frontend extends dcNsProcess
|
||||||
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', DC_DEFAULT_TPLSET]));
|
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', DC_DEFAULT_TPLSET]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$all_allowed_ip = json_decode(dcCore::app()->blog->settings->get(My::id())->get('allowed_ip'), true);
|
$all_allowed_ip = json_decode((string) My::settings()->get('allowed_ip'), true);
|
||||||
if (!is_array($all_allowed_ip)) {
|
if (!is_array($all_allowed_ip)) {
|
||||||
$all_allowed_ip = [];
|
$all_allowed_ip = [];
|
||||||
}
|
}
|
||||||
$extra_urls = json_decode(dcCore::app()->blog->settings->get(My::id())->get('extra_urls'), true);
|
$extra_urls = json_decode((string) My::settings()->get('extra_urls'), true);
|
||||||
if (!in_array(Http::realIP(), $all_allowed_ip)) {
|
if (!in_array(Http::realIP(), $all_allowed_ip)) {
|
||||||
dcCore::app()->url->registerDefault(function (?string $args): void {
|
dcCore::app()->url->registerDefault(function (?string $args): void {
|
||||||
dcCore::app()->url->type = 'default';
|
dcCore::app()->url->type = 'default';
|
||||||
|
@ -77,7 +75,7 @@ class Frontend extends dcNsProcess
|
||||||
|
|
||||||
echo dcCore::app()->tpl->getData(dcCore::app()->ctx->__get('current_tpl'));
|
echo dcCore::app()->tpl->getData(dcCore::app()->ctx->__get('current_tpl'));
|
||||||
|
|
||||||
# --BEHAVIOR-- publicAfterDocument
|
# --BEHAVIOR-- publicAfterDocumentV2
|
||||||
dcCore::app()->callBehavior('publicAfterDocumentV2');
|
dcCore::app()->callBehavior('publicAfterDocumentV2');
|
||||||
exit;
|
exit;
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,32 +15,24 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Process;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Install extends dcNsProcess
|
class Install extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
return self::status(My::checkContext(My::INSTALL));
|
||||||
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// nullsafe PHP < 8.0
|
|
||||||
if (is_null(dcCore::app()->blog)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$s = dcCore::app()->blog->settings->get(My::id());
|
$s = My::settings();
|
||||||
|
|
||||||
$s->put(
|
$s->put(
|
||||||
'flag',
|
'flag',
|
||||||
|
|
|
@ -14,10 +14,12 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
use dcAuth;
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Process;
|
||||||
use dcPage;
|
use Dotclear\Core\Backend\{
|
||||||
|
Notices,
|
||||||
|
Page
|
||||||
|
};
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Div,
|
Div,
|
||||||
|
@ -35,31 +37,25 @@ use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Helper\Network\Http;
|
use Dotclear\Helper\Network\Http;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Manage extends dcNsProcess
|
class Manage extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
return self::status(My::checkContext(My::MANAGE));
|
||||||
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog) // nullsafe PHP < 8.0
|
|
||||||
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
|
||||||
dcAuth::PERMISSION_CONTENT_ADMIN,
|
|
||||||
]), dcCore::app()->blog->id);
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nullsafe PHP < 8.0
|
// nullsafe PHP < 8.0
|
||||||
if (is_null(dcCore::app()->blog) || is_null(dcCore::app()->adminurl)) {
|
if (is_null(dcCore::app()->blog)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = dcCore::app()->blog->settings->get(My::id());
|
$s = My::settings();
|
||||||
|
|
||||||
if (!empty($_POST['saveconfig'])) {
|
if (!empty($_POST['saveconfig'])) {
|
||||||
try {
|
try {
|
||||||
|
@ -80,13 +76,11 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
dcCore::app()->blog->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Settings successfully updated.')
|
__('Settings successfully updated.')
|
||||||
);
|
);
|
||||||
|
|
||||||
dcCore::app()->adminurl->redirect(
|
My::redirect();
|
||||||
'admin.plugin.' . My::id()
|
|
||||||
);
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -97,16 +91,16 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
public static function render(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nullsafe PHP < 8.0
|
// nullsafe PHP < 8.0
|
||||||
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->blog) || is_null(dcCore::app()->adminurl)) {
|
if (is_null(dcCore::app()->blog)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = dcCore::app()->blog->settings->get(My::id());
|
$s = My::settings();
|
||||||
$editor = dcCore::app()->auth->getOption('editor');
|
$editor = dcCore::app()->auth->getOption('editor');
|
||||||
$nb_rows = count(json_decode($s->get('allowed_ip'), true));
|
$nb_rows = count(json_decode($s->get('allowed_ip'), true));
|
||||||
if ($nb_rows < 2) {
|
if ($nb_rows < 2) {
|
||||||
|
@ -115,22 +109,22 @@ class Manage extends dcNsProcess
|
||||||
$nb_rows = 10;
|
$nb_rows = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::openModule(
|
Page::openModule(
|
||||||
My::name(),
|
My::name(),
|
||||||
dcPage::jsConfirmClose('opts-forms') .
|
Page::jsConfirmClose('opts-forms') .
|
||||||
dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'construction', ['#construction_message'], 'xhtml') .
|
dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'construction', ['#construction_message'], 'xhtml') .
|
||||||
dcPage::jsModuleLoad(My::id() . '/js/backend.js')
|
Page::jsLoad('backend')
|
||||||
);
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
dcPage::breadcrumb([
|
Page::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
My::name() => '',
|
My::name() => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
Notices::getNotices() .
|
||||||
|
|
||||||
(new Div())->id('construction_options')->items([
|
(new Div())->id('construction_options')->items([
|
||||||
(new Form(My::id() . 'form'))->method('post')->action(dcCore::app()->adminurl->get('admin.plugin.' . My::id()))->fields([
|
(new Form(My::id() . 'form'))->method('post')->action(My::manageUrl())->fields([
|
||||||
(new Div())->class('fieldset')->items([
|
(new Div())->class('fieldset')->items([
|
||||||
(new Text('h4', __('Configuration'))),
|
(new Text('h4', __('Configuration'))),
|
||||||
(new Para())->class('filed')->items([
|
(new Para())->class('filed')->items([
|
||||||
|
@ -159,13 +153,12 @@ class Manage extends dcNsProcess
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
dcCore::app()->formNonce(false),
|
|
||||||
(new Hidden(['p'], 'construction')),
|
|
||||||
(new Submit(['saveconfig']))->value(__('Save')),
|
(new Submit(['saveconfig']))->value(__('Save')),
|
||||||
|
... My::hiddenFields(),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
])->render();
|
])->render();
|
||||||
|
|
||||||
dcPage::closeModule();
|
Page::closeModule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
29
src/My.php
29
src/My.php
|
@ -14,36 +14,11 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
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__);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,21 +15,19 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue