use namespace
This commit is contained in:
parent
e322b2da16
commit
7506fdb918
62
_admin.php
62
_admin.php
@ -10,11 +10,50 @@
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return null;
|
||||
}
|
||||
declare(strict_types=1);
|
||||
|
||||
dcCore::app()->addBehavior(
|
||||
namespace Dotclear\Plugin\tinyPacker;
|
||||
|
||||
/* dotclear */
|
||||
use dcCore;
|
||||
use dcPage;
|
||||
|
||||
/* clearbricks */
|
||||
use files;
|
||||
use fileZip;
|
||||
use html;
|
||||
use http;
|
||||
use path;
|
||||
|
||||
/* php */
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* tinyPacker admin class
|
||||
*
|
||||
* Add action and button to modules lists.
|
||||
*/
|
||||
class Admin
|
||||
{
|
||||
private static $init = false;
|
||||
|
||||
public static function init(): bool
|
||||
{
|
||||
if (defined('DC_CONTEXT_ADMIN')) {
|
||||
dcPage::checkSuper();
|
||||
self::$init = true;
|
||||
}
|
||||
|
||||
return self::$init;
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dcCore::app()->addBehavior(
|
||||
'adminModulesListGetActions',
|
||||
function ($list, $id, $_) {
|
||||
return in_array($list->getList(), [
|
||||
@ -26,9 +65,9 @@ dcCore::app()->addBehavior(
|
||||
html::escapeHTML($id)
|
||||
) : null;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
dcCore::app()->addBehavior(
|
||||
dcCore::app()->addBehavior(
|
||||
'adminModulesListDoActions',
|
||||
function ($list, $modules, $type) {
|
||||
# Pack action
|
||||
@ -105,4 +144,13 @@ dcCore::app()->addBehavior(
|
||||
);
|
||||
http::redirect($list->getURL());
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* process */
|
||||
if (Admin::init()) {
|
||||
Admin::process();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user