From 9df925901f5a0f9a5f51a13d53f6231e9bfb3f20 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 5 Mar 2023 23:29:09 +0100 Subject: [PATCH] move class --- src/Backend.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Backend.php b/src/Backend.php index 53453b6..84b47a8 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -33,7 +33,7 @@ use Exception; * * Add action and button to modules lists. */ -class Admin +class Backend { private static $init = false; @@ -60,14 +60,14 @@ class Admin 'theme-activate', ]) ? sprintf( '', - basename(__DIR__), + self::id(), html::escapeHTML($id) ) : null; }, 'adminModulesListDoActions' => function ($list, $modules, $type) { # Pack action - if (empty($_POST[basename(__DIR__)]) - || !is_array($_POST[basename(__DIR__)])) { + if (empty($_POST[self::id()]) + || !is_array($_POST[self::id()])) { return null; } @@ -85,7 +85,7 @@ class Admin } # Module to pack - $modules = array_keys($_POST[basename(__DIR__)]); + $modules = array_keys($_POST[self::id()]); $id = $modules[0]; if (!$list->modules->moduleExists($id)) { @@ -143,9 +143,9 @@ class Admin return true; } -} -/* process */ -if (Admin::init()) { - Admin::process(); + private function id() + { + return basename(dirname(__DIR__)); + } }