Compare commits
No commits in common. "0f5601e66d88b6a1a51a8c4a8e6f4bc8987b455e" and "dc477014c7a0ee3ea8d6b67f9d1a9eedf6ab5269" have entirely different histories.
0f5601e66d
...
dc477014c7
27
CHANGELOG.md
27
CHANGELOG.md
|
@ -1,25 +1,17 @@
|
||||||
construction 1.8 - 2023.08.06
|
todo
|
||||||
===========================================================
|
* disable widgets
|
||||||
* Require Dotclear 2.27
|
|
||||||
* Require PHP 7.4+
|
|
||||||
* Upgrade to Dotclear 2.27
|
|
||||||
* Move third party repository
|
|
||||||
* Use Dotclear style for changelog
|
|
||||||
|
|
||||||
construction 1.7 - 2023.05.13
|
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
|
||||||
|
|
||||||
construction 1.6 - 2023.04.10
|
1.6 - 2023.04.10
|
||||||
===========================================================
|
|
||||||
* require dotclear 2.26
|
* require dotclear 2.26
|
||||||
* use namespace
|
* use namespace
|
||||||
|
|
||||||
construction 1.5 - 2022.12.31
|
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
|
||||||
|
@ -27,16 +19,13 @@ construction 1.5 - 2022.12.31
|
||||||
* use abstract plugin id
|
* use abstract plugin id
|
||||||
* fix phpstan and php-cs-fixer errors
|
* fix phpstan and php-cs-fixer errors
|
||||||
|
|
||||||
construction 1.4 - 20-12-2022 - Pierre Van Glebeke
|
v1.4 - 20-12-2022 - Pierre Van Glebeke
|
||||||
===========================================================
|
|
||||||
* màj partielle dc2.24
|
* màj partielle dc2.24
|
||||||
|
|
||||||
construction 1.3.1 - 18/02/2018 - Pierre Van Glebeke
|
v1.3.1 - 18/02/2018 - Pierre Van Glebeke
|
||||||
===========================================================
|
|
||||||
* modif icon
|
* modif icon
|
||||||
|
|
||||||
construction 1.3 - 19/02/2015 - Pierre Van Glebeke
|
v1.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://git.dotclear.watch/JcDenis/construction/releases)
|
[![Release](https://img.shields.io/github/v/release/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)
|
[![Date](https://img.shields.io/github/release-date/JcDenis/construction)](https://github.com/JcDenis/construction/releases)
|
||||||
[![Issues](https://img.shields.io/github/issues/JcDenis/construction)](https://git.dotclear.watch/JcDenis/construction/issues)
|
[![Issues](https://img.shields.io/github/issues/JcDenis/construction)](https://github.com/JcDenis/construction/issues)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-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://git.dotclear.watch/JcDenis/construction/blob/master/LICENSE)
|
[![License](https://img.shields.io/github/license/JcDenis/construction)](https://github.com/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.27
|
* Dotclear 2.26
|
||||||
|
|
||||||
## 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 : [Gitea Page](https://git.dotclear.watch/JcDenis/construction) or [GitHub Page](https://github.com/JcDenis/construction)
|
* Source & contribution : [GitHub Page](https://github.com/JcDenis/construction)
|
||||||
* Packages & details : [Gitea Page](https://git.dotclear.watch/JcDenis/construction/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/construction)
|
* Packages & details : [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.8',
|
'1.7',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.27']],
|
'requires' => [['core', '2.26']],
|
||||||
'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' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
'support' => 'http://forum.dotclear.org/viewtopic.php?id=42875',
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
|
||||||
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/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.8</version>
|
<version>1.7</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://gitea.dotclear.watch/JcDenis/construction/releases/download/v1.8/plugin-construction.zip</file>
|
<file>https://github.com/JcDenis/construction/releases/download/v1.7/plugin-construction.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.26</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/construction/src/branch/master/README.md</da:details>
|
<da:details>https://plugins.dotaddict.org/dc2/details/construction</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/construction/issues</da:support>
|
<da:support>http://forum.dotclear.org/viewtopic.php?id=42875</da:support>
|
||||||
</module>
|
</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
@ -14,40 +14,65 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
|
use dcAdmin;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Core\Backend\{
|
use dcPage;
|
||||||
Favorites,
|
use dcFavorites;
|
||||||
Menus
|
use dcNsProcess;
|
||||||
};
|
|
||||||
use Dotclear\Core\Process;
|
|
||||||
|
|
||||||
class Backend extends Process
|
class Backend extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::BACKEND));
|
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||||
|
&& !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 (!self::status()) {
|
if (!static::$init) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
My::addBackendMenuItem(Menus::MENU_PLUGINS, [], '(&.*)?$', My::settings()->get('flag') ? 'construction-blog' : '');
|
// nullsafe PHP < 8.0
|
||||||
|
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 {
|
||||||
if (My::settings()->get('flag')) {
|
// nullsafe PHP < 8.0
|
||||||
echo My::cssLoad('backend');
|
if (is_null(dcCore::app()->blog)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dcCore::app()->blog->settings->get(My::id())->get('flag')) {
|
||||||
|
echo dcPage::cssModuleLoad(My::id() . '/css/backend.css');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'adminDashboardFavoritesV2' => function (Favorites $favs): void {
|
'adminDashboardFavoritesV2' => function (dcFavorites $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' => My::manageUrl(),
|
'url' => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
'small-icon' => My::icons(),
|
'small-icon' => dcPage::getPF(My::id() . '/icon.svg'),
|
||||||
'large-icon' => My::icons(),
|
'large-icon' => dcPage::getPF(My::id() . '/icon.svg'),
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_ADMIN]),
|
'permissions' => dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_ADMIN]),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,30 +16,32 @@ namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Core\Process;
|
use dcNsProcess;
|
||||||
use Dotclear\Helper\Network\Http;
|
use Dotclear\Helper\Network\Http;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Frontend extends Process
|
class Frontend extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::FRONTEND));
|
static::$init = defined('DC_RC_PATH');
|
||||||
|
|
||||||
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status()) {
|
if (!static::$init) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehavior('publicBeforeDocumentV2', function (): void {
|
dcCore::app()->addBehavior('publicBeforeDocument', 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 (!My::settings()->get('flag')) {
|
if (!dcCore::app()->blog->settings->get(My::id())->get('flag')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +52,11 @@ class Frontend extends Process
|
||||||
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((string) My::settings()->get('allowed_ip'), true);
|
$all_allowed_ip = json_decode(dcCore::app()->blog->settings->get(My::id())->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((string) My::settings()->get('extra_urls'), true);
|
$extra_urls = json_decode(dcCore::app()->blog->settings->get(My::id())->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';
|
||||||
|
@ -75,7 +77,7 @@ class Frontend extends Process
|
||||||
|
|
||||||
echo dcCore::app()->tpl->getData(dcCore::app()->ctx->__get('current_tpl'));
|
echo dcCore::app()->tpl->getData(dcCore::app()->ctx->__get('current_tpl'));
|
||||||
|
|
||||||
# --BEHAVIOR-- publicAfterDocumentV2
|
# --BEHAVIOR-- publicAfterDocument
|
||||||
dcCore::app()->callBehavior('publicAfterDocumentV2');
|
dcCore::app()->callBehavior('publicAfterDocumentV2');
|
||||||
exit;
|
exit;
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,24 +15,32 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Core\Process;
|
use dcNsProcess;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Install extends Process
|
class Install extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::INSTALL));
|
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||||
|
&& 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 (!self::status()) {
|
if (!static::$init) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// nullsafe PHP < 8.0
|
||||||
|
if (is_null(dcCore::app()->blog)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$s = My::settings();
|
$s = dcCore::app()->blog->settings->get(My::id());
|
||||||
|
|
||||||
$s->put(
|
$s->put(
|
||||||
'flag',
|
'flag',
|
||||||
|
|
|
@ -14,12 +14,10 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
|
use dcAuth;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Core\Process;
|
use dcNsProcess;
|
||||||
use Dotclear\Core\Backend\{
|
use dcPage;
|
||||||
Notices,
|
|
||||||
Page
|
|
||||||
};
|
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Div,
|
Div,
|
||||||
|
@ -37,25 +35,31 @@ use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Helper\Network\Http;
|
use Dotclear\Helper\Network\Http;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Manage extends Process
|
class Manage extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::MANAGE));
|
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||||
|
&& !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 (!self::status()) {
|
if (!static::$init) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nullsafe PHP < 8.0
|
// nullsafe PHP < 8.0
|
||||||
if (is_null(dcCore::app()->blog)) {
|
if (is_null(dcCore::app()->blog) || is_null(dcCore::app()->adminurl)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = My::settings();
|
$s = dcCore::app()->blog->settings->get(My::id());
|
||||||
|
|
||||||
if (!empty($_POST['saveconfig'])) {
|
if (!empty($_POST['saveconfig'])) {
|
||||||
try {
|
try {
|
||||||
|
@ -76,11 +80,13 @@ class Manage extends Process
|
||||||
|
|
||||||
dcCore::app()->blog->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
dcPage::addSuccessNotice(
|
||||||
__('Settings successfully updated.')
|
__('Settings successfully updated.')
|
||||||
);
|
);
|
||||||
|
|
||||||
My::redirect();
|
dcCore::app()->adminurl->redirect(
|
||||||
|
'admin.plugin.' . My::id()
|
||||||
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -91,16 +97,16 @@ class Manage extends Process
|
||||||
|
|
||||||
public static function render(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
if (!self::status()) {
|
if (!static::$init) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nullsafe PHP < 8.0
|
// nullsafe PHP < 8.0
|
||||||
if (is_null(dcCore::app()->blog)) {
|
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->blog) || is_null(dcCore::app()->adminurl)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = My::settings();
|
$s = dcCore::app()->blog->settings->get(My::id());
|
||||||
$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) {
|
||||||
|
@ -109,22 +115,22 @@ class Manage extends Process
|
||||||
$nb_rows = 10;
|
$nb_rows = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
Page::openModule(
|
dcPage::openModule(
|
||||||
My::name(),
|
My::name(),
|
||||||
Page::jsConfirmClose('opts-forms') .
|
dcPage::jsConfirmClose('opts-forms') .
|
||||||
dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'construction', ['#construction_message'], 'xhtml') .
|
dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'construction', ['#construction_message'], 'xhtml') .
|
||||||
Page::jsLoad('backend')
|
dcPage::jsModuleLoad(My::id() . '/js/backend.js')
|
||||||
);
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
Page::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
My::name() => '',
|
My::name() => '',
|
||||||
]) .
|
]) .
|
||||||
Notices::getNotices() .
|
dcPage::notices() .
|
||||||
|
|
||||||
(new Div())->id('construction_options')->items([
|
(new Div())->id('construction_options')->items([
|
||||||
(new Form(My::id() . 'form'))->method('post')->action(My::manageUrl())->fields([
|
(new Form(My::id() . 'form'))->method('post')->action(dcCore::app()->adminurl->get('admin.plugin.' . My::id()))->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([
|
||||||
|
@ -153,12 +159,13 @@ class Manage extends Process
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
(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();
|
||||||
|
|
||||||
Page::closeModule();
|
dcPage::closeModule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
29
src/My.php
29
src/My.php
|
@ -14,11 +14,36 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
use Dotclear\Module\MyPlugin;
|
use dcCore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module definitions.
|
* This module definitions.
|
||||||
*/
|
*/
|
||||||
class My extends MyPlugin
|
class My
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* 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,19 +15,21 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\construction;
|
namespace Dotclear\Plugin\construction;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Core\Process;
|
use dcNsProcess;
|
||||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||||
|
|
||||||
class Uninstall extends Process
|
class Uninstall extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::UNINSTALL));
|
static::$init = defined('DC_CONTEXT_ADMIN');
|
||||||
|
|
||||||
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue