kUtRL/src/Backend.php

69 lines
2.5 KiB
PHP
Raw Normal View History

2021-08-25 23:06:22 +00:00
<?php
/**
* @brief kUtRL, a plugin for Dotclear 2
2021-11-06 15:43:02 +00:00
*
* @package Dotclear
* @subpackage Plugin
2021-11-06 15:43:02 +00:00
*
* @author Jean-Christian Denis and contributors
2021-11-06 15:43:02 +00:00
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
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-08-21 14:55:06 +00:00
use dcCore;
use Dotclear\Core\Process;
2021-08-25 23:06:22 +00:00
2023-08-21 14:55:06 +00:00
/**
* Backend prepend.
*/
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')) {
dcCore::app()->addBehaviors([
'adminDashboardFavoritesV2' => [BackendBehaviors::class, 'antispamDashboardFavoritesV2'],
'adminColumnsListsV2' => [BackendBehaviors::class, 'adminColumnsListsV2'],
'adminFiltersListsV2' => [BackendBehaviors::class, 'adminFiltersListsV2'],
'adminPostHeaders' => [BackendBehaviors::class, 'adminPostHeaders'],
'adminPostFormItems' => [BackendBehaviors::class, 'adminPostFormItems'],
'adminAfterPostUpdate' => [BackendBehaviors::class, 'adminAfterPostUpdate'], // update existing short url
'adminAfterPostUpdate' => [BackendBehaviors::class, 'adminAfterPostCreate'], // create new short url
'adminAfterPostCreate' => [BackendBehaviors::class, 'adminAfterPostCreate'],
'adminBeforePostDelete' => [BackendBehaviors::class, 'adminBeforePostDelete'],
'adminPostsActions' => [BackendBehaviors::class, 'adminPostsActions'],
]);
}
2022-11-20 16:15:36 +00:00
2023-08-21 14:55:06 +00:00
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initShorten']);
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initRank']);
2023-08-21 14:55:06 +00:00
dcCore::app()->addBehaviors([
'exportFullV2' => [ImportExportBehaviors::class, 'exportFullV2'],
'exportSingleV2' => [ImportExportBehaviors::class, 'exportSingleV2'],
'importInitV2' => [ImportExportBehaviors::class, 'importInitV2'],
'importSingleV2' => [ImportExportBehaviors::class, 'importSingleV2'],
'importFullV2' => [ImportExportBehaviors::class, 'importFullV2'],
]);
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
}