tweakStores/src/Backend.php

53 lines
1.5 KiB
PHP
Raw Normal View History

2021-08-26 22:38:34 +00:00
<?php
2021-09-27 22:45:10 +00:00
/**
* @brief tweakStores, a plugin for Dotclear 2
2021-11-04 10:17:26 +00:00
*
2021-09-27 22:45:10 +00:00
* @package Dotclear
* @subpackage Plugin
2021-11-04 10:17:26 +00:00
*
2021-09-27 22:45:10 +00:00
* @author Jean-Christian Denis and Contributors
2021-11-04 10:17:26 +00:00
*
2021-09-27 22:45:10 +00:00
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2023-01-06 08:31:44 +00:00
declare(strict_types=1);
2021-08-26 22:38:34 +00:00
2023-01-06 08:31:44 +00:00
namespace Dotclear\Plugin\tweakStores;
2021-08-26 22:38:34 +00:00
2023-01-06 08:31:44 +00:00
use dcCore;
2023-03-19 20:17:24 +00:00
use dcNsProcess;
2021-08-26 22:38:34 +00:00
2023-03-19 20:17:24 +00:00
class Backend extends dcNsProcess
2021-08-26 22:38:34 +00:00
{
2023-01-06 08:31:44 +00:00
public static function init(): bool
{
2023-04-24 13:34:16 +00:00
static::$init = defined('DC_CONTEXT_ADMIN')
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog)
&& My::phpCompliant()
2023-03-19 20:17:24 +00:00
&& dcCore::app()->auth->isSuperAdmin()
&& dcCore::app()->blog->settings->get(My::id())->get('active');
2023-01-06 08:31:44 +00:00
2023-03-19 20:17:24 +00:00
return static::$init;
}
2023-03-19 20:17:24 +00:00
public static function process(): bool
2021-11-04 10:17:26 +00:00
{
2023-03-19 20:17:24 +00:00
if (!static::$init) {
2023-01-06 08:31:44 +00:00
return false;
}
dcCore::app()->addBehaviors([
// addd some js
2023-03-19 20:17:24 +00:00
'pluginsToolsHeadersV2' => [BackendBehaviors::class, 'modulesToolsHeaders'],
'themesToolsHeadersV2' => [BackendBehaviors::class, 'modulesToolsHeaders'],
// admin modules page tab
'pluginsToolsTabsV2' => [BackendBehaviors::class, 'pluginsToolsTabsV2'],
'themesToolsTabsV2' => [BackendBehaviors::class, 'themesToolsTabsV2'],
// add to plugin pacKman
'packmanBeforeCreatePackage' => [BackendBehaviors::class, 'packmanBeforeCreatePackage'],
2023-01-06 08:31:44 +00:00
]);
return true;
}
2021-11-04 10:17:26 +00:00
}