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-12-23 13:09:26 +00:00
|
|
|
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'),
|
2022-12-23 13:09:26 +00:00
|
|
|
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-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-12-23 13:09:26 +00:00
|
|
|
dcCore::app()->addBehavior('adminFiltersListsV2', ['adminPostWidgetText', 'adminFiltersListsV2']);
|
|
|
|
dcCore::app()->addBehavior('adminBlogPreferencesFormV2', ['adminPostWidgetText', 'adminBlogPreferencesFormV2']);
|
2022-11-15 21:05:23 +00:00
|
|
|
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-12-23 13:09:26 +00:00
|
|
|
if (dcCore::app()->blog->settings->get(basename(__DIR__))->get('importexport_active')) {
|
|
|
|
dcCore::app()->addBehavior('exportFullV2', ['adminPostWidgetText', 'exportFullV2']);
|
|
|
|
dcCore::app()->addBehavior('exportSingleV2', ['adminPostWidgetText', 'exportSingleV2']);
|
|
|
|
dcCore::app()->addBehavior('importInitV2', ['adminPostWidgetText', 'importInitV2']);
|
|
|
|
dcCore::app()->addBehavior('importSingleV2', ['adminPostWidgetText', 'importSingleV2']);
|
|
|
|
dcCore::app()->addBehavior('importFullV2', ['adminPostWidgetText', 'importFullV2']);
|
2021-11-06 15:11:19 +00:00
|
|
|
}
|