From fef508d3298d31551b74d9fcdee859f282533ef0 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 16 Apr 2023 15:49:26 +0200 Subject: [PATCH] cosmetic --- src/Backend.php | 2 +- src/Manage.php | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Backend.php b/src/Backend.php index ccc3f5e..f2edac3 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -41,7 +41,7 @@ class Backend extends dcNsProcess 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())) . '(&.*)?$/', + '/' . preg_quote((string) dcCore::app()->adminurl?->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI'] ), dcCore::app()->auth?->isSuperAdmin() diff --git a/src/Manage.php b/src/Manage.php index 7c18286..b1e0268 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -26,7 +26,8 @@ use Dotclear\Helper\Html\Form\{ Note, Para, Select, - Submit + Submit, + Text }; use Dotclear\Helper\Html\Html; use Exception; @@ -50,6 +51,10 @@ class Manage extends dcNsProcess $vars = ManageVars::init(); + if (null === $vars->cleaner) { + return true; + } + if (!empty($_POST['option-action'])) { dcCore::app()->blog?->settings->get(My::id())->dropEvery( 'dcproperty_hide' @@ -65,19 +70,19 @@ class Manage extends dcNsProcess dcPage::addSuccessNotice(__('Configuration successfuly updated')); dcCore::app()->adminurl?->redirect( 'admin.plugin.' . My::id(), - ['part' => $vars->cleaner?->id] + ['part' => $vars->cleaner->id] ); } if (!empty($vars->entries) && !empty($vars->action)) { try { foreach ($vars->entries as $ns) { - $vars->cleaners->execute($vars->cleaner?->id, $vars->action, $ns); + $vars->cleaners->execute($vars->cleaner->id, $vars->action, $ns); } dcPage::addSuccessNotice(__('Action successfuly excecuted')); dcCore::app()->adminurl?->redirect( 'admin.plugin.' . My::id(), - ['part' => $vars->cleaner?->id] + ['part' => $vars->cleaner->id] ); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); @@ -111,7 +116,8 @@ class Manage extends dcNsProcess ]) . dcPage::notices(); - if ($vars->cleaner === null) { + if (null === $vars->cleaner) { + echo (new Text('p', __('There is nothing to display')))->class('error')->render(); dcPage::closeModule(); return; @@ -132,7 +138,7 @@ class Manage extends dcNsProcess $rs = $vars->cleaner->values(); if (empty($rs)) { - echo '

' . __('There is nothing to display') . '

'; + echo (new Text('p', __('There is nothing to display')))->class('error')->render(); } else { $combo_actions = []; foreach ($vars->cleaner->actions as $descriptor) {