From 275602c80415a3a3b558d2283f173cdb5680caf0 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 5 Mar 2023 23:01:10 +0100 Subject: [PATCH] cosmetic fix --- src/Backend.php | 8 +++--- src/Config.php | 42 ++++++++++++++++++------------ src/Utils.php | 1 - src/module/dcdeprecated/dc2.21.php | 2 +- src/module/newline.php | 8 +----- 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/Backend.php b/src/Backend.php index 16acb19..38cbd5a 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -22,7 +22,7 @@ use dcFavorites; use dcNsProcess; /* clearbricks */ -use Clearbricks; +use Dotclear\Helper\Clearbricks; use files; /** @@ -49,9 +49,9 @@ class Backend extends dcNsProcess dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $favs): void { $favs->register( - 'improve', + Core::id(), [ - 'title' => __('improve'), + 'title' => Core::name(), 'url' => dcCore::app()->adminurl->get('admin.plugin.' . Core::id()), 'small-icon' => dcPage::getPF(Core::id() . '/icon.svg'), 'large-icon' => dcPage::getPF(Core::id() . '/icon.svg'), @@ -61,7 +61,7 @@ class Backend extends dcNsProcess }); dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( - __('improve'), + Core::name(), dcCore::app()->adminurl->get('admin.plugin.' . Core::id()), dcPage::getPF(Core::id() . '/icon.svg'), preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . Core::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']), diff --git a/src/Config.php b/src/Config.php index e70af82..a70d5eb 100644 --- a/src/Config.php +++ b/src/Config.php @@ -20,7 +20,15 @@ use dcPage; use dcNsProcess; /* clearbricks */ -use form; +use Dotclear\Helper\Html\Form\{ + Checkbox, + Div, + Fieldset, + Label, + Legend, + Para, + Text +}; /* php */ use Exception; @@ -64,7 +72,7 @@ class Config extends dcNsProcess dcCore::app()->adminurl->redirect( 'admin.plugins', - ['module' => 'improve', 'conf' => 1, 'chk' => 1, 'redir' => dcCore::app()->admin->__get('list')->getRedir()] + ['module' => Core::id(), 'conf' => 1, 'chk' => 1, 'redir' => dcCore::app()->admin->__get('list')->getRedir()] ); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); @@ -80,26 +88,28 @@ class Config extends dcNsProcess } $improve = new Core(); + $modules = $items = []; - $modules = []; foreach ($improve->modules() as $action) { $modules[$action->name()] = $action->id(); } - $modules = array_merge($modules, array_flip($improve->disabled())); - echo '

' . __('List of disabled actions:') . '

'; - - foreach ($modules as $name => $id) { - echo - '

'; + foreach (array_merge($modules, array_flip($improve->disabled())) as $name => $id) { + $items[] = (new Para())->items([ + (new Checkbox(['disabled_' . $id, 'disabled[]'], array_key_exists($id, $improve->disabled())))->value($id), + (new Label($id))->class('classic')->for('disabled_' . $id), + ]); } + echo - '

' . __('Options') . '

' . - '

' . - '
'; + (new Div())->items([ + (new Fieldset())->class('fieldset')->legend(new Legend(__('List of disabled actions')))->fields($items), + (new Fieldset())->class('fieldset')->legend(new Legend(__('Options')))->fields([ + (new Para())->items([ + (new Checkbox('nodetails', dcCore::app()->blog->settings->get(Core::id())->get('nodetails')))->value('1'), + (new Label(__('Hide details of rendered actions')))->class('classic')->for('nodetails'), + ]), + ]), + ])->render(); } } diff --git a/src/Utils.php b/src/Utils.php index 99c34a7..4d7befe 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -19,7 +19,6 @@ namespace Dotclear\Plugin\improve; */ class Utils { - public static function getActionsDir(): string { return __DIR__ . '/module/'; diff --git a/src/module/dcdeprecated/dc2.21.php b/src/module/dcdeprecated/dc2.21.php index bca6457..0f184db 100644 --- a/src/module/dcdeprecated/dc2.21.php +++ b/src/module/dcdeprecated/dc2.21.php @@ -44,7 +44,7 @@ return [ ['three-cols', 'three-cols', 'three-boxes', '2.6', ''], ], - 'js' => [ + 'js' => [ ['\sstoreLocalData', 'storeLocalData', 'dotclear.storeLocalData', '2.21', ''], ['\sdropLocalData', 'dropLocalData', 'dotclear.dropLocalData', '2.21', ''], ['\sreadLocalData', 'readLocalData', 'dotclear.readLocalData', '2.21', ''], diff --git a/src/module/newline.php b/src/module/newline.php index 200a2e6..41527c3 100644 --- a/src/module/newline.php +++ b/src/module/newline.php @@ -36,13 +36,7 @@ class newline extends Action 'configurator' => true, 'types' => ['plugin', 'theme'], ]); - /* - $ext = @unserialize(dcCore::app()->blog->settings->improve->newline_extensions); - $ext = Improve::cleanExtensions($ext); - if (!empty($ext)) { - $this->extensions = $ext; - } - */ + return true; }