kUtRL/src/Backend.php

61 lines
2.2 KiB
PHP
Raw Normal View History

2021-08-25 23:06:22 +00:00
<?php
2023-10-19 18:32:57 +00:00
2023-08-21 14:55:06 +00:00
declare(strict_types=1);
2023-08-21 14:55:06 +00:00
namespace Dotclear\Plugin\kUtRL;
2021-08-25 23:06:22 +00:00
2023-10-19 18:32:57 +00:00
use Dotclear\App;
2023-08-21 14:55:06 +00:00
use Dotclear\Core\Process;
2021-08-25 23:06:22 +00:00
2023-08-21 14:55:06 +00:00
/**
2023-10-19 18:32:57 +00:00
* @brief kUtRL backend class.
* @ingroup kUtRL
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
2023-08-21 14:55:06 +00:00
*/
class Backend extends Process
2021-08-25 23:06:22 +00:00
{
2023-08-21 14:55:06 +00:00
public static function init(): bool
{
2023-08-21 14:55:06 +00:00
return self::status(My::checkContext(My::BACKEND));
}
2023-08-21 14:55:06 +00:00
public static function process(): bool
{
2023-08-21 14:55:06 +00:00
if (!self::status()) {
return false;
}
2023-08-21 14:55:06 +00:00
// sidebar menu
My::addBackendMenuItem();
2023-08-21 14:55:06 +00:00
# Admin behaviors
if (My::settings()->get('active')) {
2023-10-19 18:32:57 +00:00
App::behavior()->addBehaviors([
'adminDashboardFavoritesV2' => BackendBehaviors::antispamDashboardFavoritesV2(...),
'adminColumnsListsV2' => BackendBehaviors::adminColumnsListsV2(...),
'adminFiltersListsV2' => BackendBehaviors::adminFiltersListsV2(...),
'adminPostHeaders' => BackendBehaviors::adminPostHeaders(...),
'adminPostFormItems' => BackendBehaviors::adminPostFormItems(...),
'adminAfterPostUpdate' => BackendBehaviors::adminAfterPostUpdate(...), // update existing short url
'adminAfterPostUpdate' => BackendBehaviors::adminAfterPostCreate(...), // create new short url
'adminAfterPostCreate' => BackendBehaviors::adminAfterPostCreate(...),
'adminBeforePostDelete' => BackendBehaviors::adminBeforePostDelete(...),
'adminPostsActions' => BackendBehaviors::adminPostsActions(...),
2023-08-21 14:55:06 +00:00
]);
}
2022-11-20 16:15:36 +00:00
2023-10-19 18:32:57 +00:00
App::behavior()->addBehaviors([
'initWidgets' => Widgets::init(...),
'exportFullV2' => ImportExportBehaviors::exportFullV2(...),
'exportSingleV2' => ImportExportBehaviors::exportSingleV2(...),
'importInitV2' => ImportExportBehaviors::importInitV2(...),
'importSingleV2' => ImportExportBehaviors::importSingleV2(...),
'importFullV2' => ImportExportBehaviors::importFullV2(...),
2023-08-21 14:55:06 +00:00
]);
2022-12-22 14:37:09 +00:00
2023-08-21 14:55:06 +00:00
return true;
}
2021-11-06 15:43:02 +00:00
}