postWidgetText/src/Backend.php

60 lines
2.7 KiB
PHP
Raw Normal View History

2021-09-10 19:06:49 +00:00
<?php
2021-09-10 19:18:51 +00:00
/**
* @brief postWidgetText, a plugin for Dotclear 2
2021-11-06 15:11:19 +00:00
*
2021-09-10 19:18:51 +00:00
* @package Dotclear
* @subpackage Plugin
2021-11-06 15:11:19 +00:00
*
2021-09-10 19:18:51 +00:00
* @author Jean-Christian Denis and Contributors
2021-11-06 15:11:19 +00:00
*
2021-09-10 19:18:51 +00:00
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2021-09-10 19:06:49 +00:00
if (!defined('DC_CONTEXT_ADMIN')) {
2021-09-10 19:18:51 +00:00
return null;
2021-09-10 19:06:49 +00:00
}
2022-11-15 21:05:23 +00:00
require __DIR__ . '/_widgets.php';
2021-09-10 19:06:49 +00:00
2022-12-23 14:22:04 +00:00
// Admin menu
if (dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')) {
2022-11-15 21:05:23 +00:00
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
2021-09-10 19:18:51 +00:00
__('Post widget text'),
dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
dcPage::getPF(basename(__DIR__) . '/icon.svg'),
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
2022-12-03 15:49:44 +00:00
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_CONTENT_ADMIN]), dcCore::app()->blog->id)
2021-09-10 19:18:51 +00:00
);
2021-09-10 19:06:49 +00:00
2022-12-23 13:10:54 +00:00
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['adminPostWidgetText', 'adminDashboardFavoritesV2']);
2021-09-10 19:06:49 +00:00
}
2022-12-23 14:22:04 +00:00
dcCore::app()->addBehaviors([
// Pref
'adminFiltersListsV2' => ['adminPostWidgetText', 'adminFiltersListsV2'],
'adminBlogPreferencesFormV2' => ['adminPostWidgetText', 'adminBlogPreferencesFormV2'],
'adminBeforeBlogSettingsUpdate' => ['adminPostWidgetText', 'adminBeforeBlogSettingsUpdate'],
// Post
'adminPostHeaders' => ['adminPostWidgetText', 'adminPostHeaders'],
'adminPostFormItems' => ['adminPostWidgetText', 'adminPostFormItems'],
'adminAfterPostUpdate' => ['adminPostWidgetText', 'adminAfterPostSave'],
'adminAfterPostCreate' => ['adminPostWidgetText', 'adminAfterPostSave'],
'adminBeforePostDelete' => ['adminPostWidgetText', 'adminBeforePostDelete'],
// Plugin "pages"
'adminPageHeaders' => ['adminPostWidgetText', 'adminPostHeaders'],
'adminPageFormItems' => ['adminPostWidgetText', 'adminPostFormItems'],
'adminAfterPageUpdate' => ['adminPostWidgetText', 'adminAfterPostSave'],
'adminAfterPageCreate' => ['adminPostWidgetText', 'adminAfterPostSave'],
'adminBeforePageDelete' => ['adminPostWidgetText', 'adminBeforePostDelete'],
]);
2021-10-30 08:30:01 +00:00
2022-12-23 14:22:04 +00:00
// Plugin "importExport"
if (dcCore::app()->blog->settings->get(basename(__DIR__))->get('importexport_active')) {
2022-12-23 14:22:04 +00:00
dcCore::app()->addBehaviors([
'exportFullV2' => ['adminPostWidgetText', 'exportFullV2'],
'exportSingleV2' => ['adminPostWidgetText', 'exportSingleV2'],
'importInitV2' => ['adminPostWidgetText', 'importInitV2'],
'importSingleV2' => ['adminPostWidgetText', 'importSingleV2'],
'importFullV2' => ['adminPostWidgetText', 'importFullV2'],
]);
2021-11-06 15:11:19 +00:00
}