postWidgetText/_admin.php

58 lines
2.9 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
# Admin menu
2022-11-15 21:05:23 +00:00
if (dcCore::app()->blog->settings->postwidgettext->postwidgettext_active) {
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
2021-09-10 19:18:51 +00:00
__('Post widget text'),
2022-11-15 21:05:23 +00:00
dcCore::app()->adminurl->get('admin.plugin.postWidgetText'),
2022-11-26 14:04:22 +00:00
dcPage::getPF('postWidgetText/icon.svg'),
2022-11-15 21:05:23 +00:00
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.postWidgetText')) . '(&.*)?$/', $_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-11-15 21:05:23 +00:00
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['adminPostWidgetText', 'adminDashboardFavorites']);
2021-09-10 19:06:49 +00:00
}
2021-10-29 22:36:04 +00:00
# Pref
2022-11-15 21:05:23 +00:00
dcCore::app()->addBehavior('adminFiltersListsV2', ['adminPostWidgetText', 'adminFiltersLists']);
dcCore::app()->addBehavior('adminBlogPreferencesFormV2', ['adminPostWidgetText', 'adminBlogPreferencesForm']);
dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', ['adminPostWidgetText', 'adminBeforeBlogSettingsUpdate']);
2021-10-30 08:30:01 +00:00
2021-09-10 19:06:49 +00:00
# Post
2022-11-15 21:05:23 +00:00
dcCore::app()->addBehavior('adminPostHeaders', ['adminPostWidgetText', 'adminPostHeaders']);
dcCore::app()->addBehavior('adminPostFormItems', ['adminPostWidgetText', 'adminPostFormItems']);
dcCore::app()->addBehavior('adminAfterPostUpdate', ['adminPostWidgetText', 'adminAfterPostSave']);
dcCore::app()->addBehavior('adminAfterPostCreate', ['adminPostWidgetText', 'adminAfterPostSave']);
dcCore::app()->addBehavior('adminBeforePostDelete', ['adminPostWidgetText', 'adminBeforePostDelete']);
2021-09-10 19:06:49 +00:00
# Plugin "pages"
2022-11-15 21:05:23 +00:00
dcCore::app()->addBehavior('adminPageHeaders', ['adminPostWidgetText', 'adminPostHeaders']);
dcCore::app()->addBehavior('adminPageFormItems', ['adminPostWidgetText', 'adminPostFormItems']);
dcCore::app()->addBehavior('adminAfterPageUpdate', ['adminPostWidgetText', 'adminAfterPostSave']);
dcCore::app()->addBehavior('adminAfterPageCreate', ['adminPostWidgetText', 'adminAfterPostSave']);
dcCore::app()->addBehavior('adminBeforePageDelete', ['adminPostWidgetText', 'adminBeforePostDelete']);
2021-09-10 19:06:49 +00:00
# Plugin "importExport"
2022-11-15 21:05:23 +00:00
if (dcCore::app()->blog->settings->postwidgettext->postwidgettext_importexport_active) {
dcCore::app()->addBehavior('exportFull', ['adminPostWidgetText', 'exportFull']);
dcCore::app()->addBehavior('exportSingle', ['adminPostWidgetText', 'exportSingle']);
dcCore::app()->addBehavior('importInit', ['adminPostWidgetText', 'importInit']);
dcCore::app()->addBehavior('importSingle', ['adminPostWidgetText', 'importSingle']);
dcCore::app()->addBehavior('importFull', ['adminPostWidgetText', 'importFull']);
2021-11-06 15:11:19 +00:00
}