2023-03-24 22:12:11 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @brief periodical, a plugin for Dotclear 2
|
|
|
|
*
|
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
|
|
|
*
|
|
|
|
* @author Jean-Christian Denis and contributors
|
|
|
|
*
|
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Dotclear\Plugin\periodical;
|
|
|
|
|
|
|
|
use dcCore;
|
2023-07-29 20:48:09 +00:00
|
|
|
use Dotclear\Core\Process;
|
2023-03-24 22:12:11 +00:00
|
|
|
|
2023-07-29 20:48:09 +00:00
|
|
|
class Backend extends Process
|
2023-03-24 22:12:11 +00:00
|
|
|
{
|
|
|
|
public static function init(): bool
|
|
|
|
{
|
2023-07-29 20:48:09 +00:00
|
|
|
return self::status(My::checkContext(My::BACKEND));
|
2023-03-24 22:12:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function process(): bool
|
|
|
|
{
|
2023-07-29 20:48:09 +00:00
|
|
|
if (!self::status()) {
|
2023-03-24 22:12:11 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-04-22 22:14:18 +00:00
|
|
|
// register backend behaviors
|
2023-03-24 22:12:11 +00:00
|
|
|
dcCore::app()->addBehaviors([
|
2023-07-29 20:48:09 +00:00
|
|
|
'adminBlogPreferencesFormV2' => [BackendBehaviors::class, 'adminBlogPreferencesFormV2'],
|
2023-03-24 22:12:11 +00:00
|
|
|
'adminBeforeBlogSettingsUpdate' => [BackendBehaviors::class, 'adminBeforeBlogSettingsUpdate'],
|
2023-07-29 20:48:09 +00:00
|
|
|
'adminFiltersListsV2' => [BackendBehaviors::class, 'adminFiltersListsV2'],
|
|
|
|
'adminColumnsListsV2' => [BackendBehaviors::class, 'adminColumnsListsV2'],
|
|
|
|
'adminPostListHeaderV2' => [BackendBehaviors::class, 'adminPostListHeaderV2'],
|
|
|
|
'adminPostListValueV2' => [BackendBehaviors::class, 'adminPostListValueV2'],
|
2023-03-24 22:12:11 +00:00
|
|
|
'adminBeforePostDelete' => [BackendBehaviors::class, 'adminBeforePostDelete'],
|
|
|
|
]);
|
|
|
|
|
2023-07-29 20:48:09 +00:00
|
|
|
if (My::settings()->get('periodical_active')) {
|
2023-04-22 22:14:18 +00:00
|
|
|
// add backend sidebar icon
|
2023-07-29 20:48:09 +00:00
|
|
|
My::addBackendMenuItem();
|
2023-03-24 22:12:11 +00:00
|
|
|
|
2023-04-22 22:14:18 +00:00
|
|
|
// register bakend behaviors required user permissions
|
2023-03-24 22:12:11 +00:00
|
|
|
dcCore::app()->addBehaviors([
|
|
|
|
'adminDashboardFavoritesV2' => [BackendBehaviors::class, 'adminDashboardFavoritesV2'],
|
|
|
|
'adminPostHeaders' => [BackendBehaviors::class, 'adminPostHeaders'],
|
|
|
|
'adminPostsActions' => [BackendBehaviors::class, 'adminPostsActions'],
|
|
|
|
'adminPostFormItems' => [BackendBehaviors::class, 'adminPostFormItems'],
|
|
|
|
'adminAfterPostUpdate' => [BackendBehaviors::class, 'adminAfterPostSave'],
|
|
|
|
'adminAfterPostCreate' => [BackendBehaviors::class, 'adminAfterPostSave'],
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|