2021-09-10 19:06:49 +00:00
|
|
|
<?php
|
2021-09-10 19:18:51 +00:00
|
|
|
/**
|
|
|
|
* @brief postWidgetText, 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
|
|
|
|
*/
|
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
|
|
|
}
|
|
|
|
|
|
|
|
require dirname(__FILE__).'/_widgets.php';
|
|
|
|
|
|
|
|
# Admin menu
|
|
|
|
if ($core->blog->settings->postwidgettext->postwidgettext_active) {
|
2021-09-10 19:18:51 +00:00
|
|
|
$_menu['Plugins']->addItem(
|
|
|
|
__('Post widget text'),
|
2021-10-29 22:36:04 +00:00
|
|
|
$core->adminurl->get('admin.plugin.postWidgetText'),
|
|
|
|
dcPage::getPF('postWidgetText/icon.png'),
|
|
|
|
preg_match('/' . preg_quote($core->adminurl->get('admin.plugin.postWidgetText')) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
2021-09-10 19:18:51 +00:00
|
|
|
$core->auth->check('contentadmin', $core->blog->id)
|
|
|
|
);
|
2021-09-10 19:06:49 +00:00
|
|
|
|
2021-10-29 22:36:04 +00:00
|
|
|
$core->addBehavior('adminDashboardFavorites', ['postWidgetTextDashboard', 'favorites']);
|
2021-10-30 08:02:04 +00:00
|
|
|
$core->addBehavior('adminBlogPreferencesForm', ['postWidgetTextAdmin', 'adminBlogPreferencesForm']);
|
|
|
|
$core->addBehavior('adminBeforeBlogSettingsUpdate', ['postWidgetTextAdmin', 'adminBeforeBlogSettingsUpdate']);
|
2021-09-10 19:06:49 +00:00
|
|
|
}
|
2021-10-29 22:36:04 +00:00
|
|
|
# Pref
|
|
|
|
$core->addBehavior('adminFiltersLists', ['postWidgetTextAdmin', 'adminFiltersLists']);
|
2021-09-10 19:06:49 +00:00
|
|
|
# Post
|
2021-10-29 22:36:04 +00:00
|
|
|
$core->addBehavior('adminPostHeaders', ['postWidgetTextAdmin', 'headers']);
|
|
|
|
$core->addBehavior('adminPostFormItems', ['postWidgetTextAdmin', 'form']);
|
|
|
|
$core->addBehavior('adminAfterPostUpdate', ['postWidgetTextAdmin', 'save']);
|
|
|
|
$core->addBehavior('adminAfterPostCreate', ['postWidgetTextAdmin', 'save']);
|
|
|
|
$core->addBehavior('adminBeforePostDelete', ['postWidgetTextAdmin', 'delete']);
|
2021-09-10 19:06:49 +00:00
|
|
|
|
|
|
|
# Plugin "pages"
|
2021-10-29 22:36:04 +00:00
|
|
|
$core->addBehavior('adminPageHeaders', ['postWidgetTextAdmin', 'headers']);
|
|
|
|
$core->addBehavior('adminPageFormItems', ['postWidgetTextAdmin', 'form']);
|
|
|
|
$core->addBehavior('adminAfterPageUpdate', ['postWidgetTextAdmin', 'save']);
|
|
|
|
$core->addBehavior('adminAfterPageCreate', ['postWidgetTextAdmin', 'save']);
|
|
|
|
$core->addBehavior('adminBeforePageDelete', ['postWidgetTextAdmin', 'delete']);
|
2021-09-10 19:06:49 +00:00
|
|
|
|
|
|
|
# Plugin "importExport"
|
|
|
|
if ($core->blog->settings->postwidgettext->postwidgettext_importexport_active) {
|
2021-10-29 22:36:04 +00:00
|
|
|
$core->addBehavior('exportFull', ['postWidgetTextBackup', 'exportFull']);
|
|
|
|
$core->addBehavior('exportSingle', ['postWidgetTextBackup', 'exportSingle']);
|
|
|
|
$core->addBehavior('importInit', ['postWidgetTextBackup', 'importInit']);
|
|
|
|
$core->addBehavior('importSingle', ['postWidgetTextBackup', 'importSingle']);
|
|
|
|
$core->addBehavior('importFull', ['postWidgetTextBackup', 'importFull']);
|
2021-09-10 19:18:51 +00:00
|
|
|
}
|