2015-05-30 15:21:33 +00:00
|
|
|
<?php
|
2023-01-02 00:00:05 +00:00
|
|
|
/**
|
|
|
|
* @brief comListe, a plugin for Dotclear 2
|
|
|
|
*
|
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
|
|
|
*
|
|
|
|
* @author Benoit de Marne, Pierre Van Glabeke and contributors
|
|
|
|
*
|
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
|
|
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
|
|
|
return null;
|
|
|
|
}
|
2015-05-30 15:21:33 +00:00
|
|
|
|
2023-01-02 00:00:05 +00:00
|
|
|
require __DIR__ . '/_widgets.php';
|
2015-05-30 15:21:33 +00:00
|
|
|
|
2023-01-02 00:00:05 +00:00
|
|
|
// Admin menu
|
|
|
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
|
|
|
__('Comments list'),
|
|
|
|
dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
|
|
|
|
urldecode(dcPage::getPF(basename(__DIR__) . '/icon.png')),
|
|
|
|
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
|
|
|
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]), dcCore::app()->blog->id)
|
|
|
|
);
|
2015-05-30 15:21:33 +00:00
|
|
|
|
2023-01-02 00:00:05 +00:00
|
|
|
dcCore::app()->addBehaviors([
|
|
|
|
// Dashboard favorites
|
|
|
|
'adminDashboardFavoritesV2' => function (dcFavorites $favs) {
|
|
|
|
$favs->register(basename(__DIR__), [
|
|
|
|
'title' => __('Comments list'),
|
|
|
|
'url' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
|
|
|
|
'small-icon' => urldecode(dcPage::getPF(basename(__DIR__) . '/icon.png')),
|
|
|
|
'large-icon' => urldecode(dcPage::getPF(basename(__DIR__) . '/icon-big.png')),
|
|
|
|
'permissions' => dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]),
|
|
|
|
]);
|
|
|
|
},
|
2023-01-02 00:29:15 +00:00
|
|
|
'adminSimpleMenuAddType' => function (ArrayObject $items) {
|
2023-01-03 23:50:34 +00:00
|
|
|
$items[basename(__DIR__)] = new ArrayObject([__('Comments list'), false]);
|
2023-01-02 00:29:15 +00:00
|
|
|
},
|
|
|
|
'adminSimpleMenuBeforeEdit' => function ($type, $select, &$item) {
|
2023-01-03 23:50:34 +00:00
|
|
|
if (basename(__DIR__) == $type) {
|
2023-01-02 00:29:15 +00:00
|
|
|
$item[0] = __('Comments list');
|
2023-01-03 23:50:34 +00:00
|
|
|
$item[1] = dcCore::app()->blog->settings->get(basename(__DIR__))->get('page_title') ?? __('Comments list');
|
2023-01-02 00:29:15 +00:00
|
|
|
$item[2] = dcCore::app()->admin->blog_url . dcCore::app()->url->getURLFor(basename(__DIR__));
|
|
|
|
}
|
2023-01-03 23:50:34 +00:00
|
|
|
},
|
2023-01-02 00:00:05 +00:00
|
|
|
]);
|