cinecturlink2/_admin.php

56 lines
1.6 KiB
PHP
Raw Normal View History

2021-09-07 12:33:18 +00:00
<?php
2021-09-07 13:21:38 +00:00
/**
* @brief cinecturlink2, 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-07 12:33:18 +00:00
if (!defined('DC_CONTEXT_ADMIN')) {
2021-09-07 13:21:38 +00:00
return null;
2021-09-07 12:33:18 +00:00
}
2021-09-07 13:21:38 +00:00
require_once dirname(__FILE__) . '/_widgets.php';
2021-09-07 12:33:18 +00:00
$_menu['Plugins']->addItem(
2021-09-07 13:21:38 +00:00
__('My cinecturlink'),
$core->adminurl->get('admin.plugin.cinecturlink2'),
dcPage::getPF('cinecturlink2/icon.png'),
preg_match(
'/' . preg_quote($core->adminurl->get('admin.plugin.dcAdvancedCleaner')) . '(&.*)?$/',
$_SERVER['REQUEST_URI']
),
$core->auth->check('contentadmin', $core->blog->id)
2021-09-07 12:33:18 +00:00
);
$core->addBehavior(
2021-09-07 13:21:38 +00:00
'adminDashboardFavorites',
['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
2021-09-07 12:33:18 +00:00
);
class cinecturlink2AdminBehaviors
{
2021-09-07 13:21:38 +00:00
public static function adminDashboardFavorites($core, $favs)
{
2021-09-08 22:24:34 +00:00
$favs->register('cinecturlink2', [
'title' => __('My cinecturlink'),
'url' => $core->adminurl->get('admin.plugin.cinecturlink2').'#links',
'small-icon' => dcPage::getPF('cinecturlink2/icon.png'),
'large-icon' => dcPage::getPF('cinecturlink2/icon-big.png'),
'permissions' => $core->auth->check('contentadmin', $core->blog->id),
2021-09-07 13:21:38 +00:00
'active_cb' => ['cinecturlink2AdminBehaviors', 'adminDashboardFavoritesActive']
2021-09-08 22:24:34 +00:00
]);
2021-09-07 13:21:38 +00:00
}
2021-09-07 12:33:18 +00:00
2021-09-07 13:21:38 +00:00
public static function adminDashboardFavoritesActive($request, $params)
{
return $request == 'plugin.php'
&& isset($params['p'])
&& $params['p'] == 'cinecturlink2';
}
}