zoneclearFeedServer/src/Backend.php

56 lines
2.1 KiB
PHP
Raw Normal View History

2015-04-25 19:25:03 +00:00
<?php
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
2021-11-06 15:30:19 +00:00
*
* @package Dotclear
* @subpackage Plugin
2021-11-06 15:30:19 +00:00
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
2021-11-06 15:30:19 +00:00
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2015-04-25 19:25:03 +00:00
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
2015-04-25 19:25:03 +00:00
}
2022-12-10 16:16:41 +00:00
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
2015-04-25 19:25:03 +00:00
2022-11-15 20:05:21 +00:00
require_once __DIR__ . '/_widgets.php';
2015-04-25 19:25:03 +00:00
2022-11-30 20:54:56 +00:00
$perm = dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id);
2022-12-11 19:18:26 +00:00
if (dcCore::app()->blog->settings->__get(basename(__DIR__))->active
&& '' != dcCore::app()->blog->settings->__get(basename(__DIR__))->user
2022-11-26 20:19:55 +00:00
) {
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
__('Feeds server'),
2022-12-10 16:16:41 +00:00
dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
dcPage::getPF(basename(__DIR__) . '/icon.svg'),
2022-11-26 20:19:55 +00:00
preg_match(
2022-12-10 16:16:41 +00:00
'/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/',
2022-11-26 20:19:55 +00:00
$_SERVER['REQUEST_URI']
),
2022-11-30 20:54:56 +00:00
$perm
2022-11-26 20:19:55 +00:00
);
2015-04-25 19:25:03 +00:00
2022-11-30 20:54:56 +00:00
if ($perm) {
2022-11-26 20:19:55 +00:00
# Dashboard icon
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['zcfsAdminBehaviors', 'adminDashboardFavoritesV2']);
# User pref
dcCore::app()->addBehavior('adminColumnsListsV2', ['zcfsAdminBehaviors', 'adminColumnsListsV2']);
dcCore::app()->addBehavior('adminFiltersListsV2', ['zcfsAdminBehaviors', 'adminFiltersListsV2']);
# Add info about feed on post page sidebar
dcCore::app()->addBehavior('adminPostHeaders', ['zcfsAdminBehaviors', 'adminPostHeaders']);
dcCore::app()->addBehavior('adminPostFormItems', ['zcfsAdminBehaviors', 'adminPostFormItems']);
}
2015-04-25 19:25:03 +00:00
2022-11-26 20:19:55 +00:00
# Take care about tweakurls (thanks Mathieu M.)
2022-12-10 22:02:38 +00:00
dcCore::app()->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
2015-04-25 19:25:03 +00:00
}
2022-11-26 20:19:55 +00:00
# Delete related info about feed post in meta table
dcCore::app()->addBehavior('adminBeforePostDelete', ['zcfsAdminBehaviors', 'adminBeforePostDelete']);