pacKman/_admin.php

56 lines
1.5 KiB
PHP
Raw Normal View History

2021-08-16 20:48:26 +00:00
<?php
2021-09-02 20:14:32 +00:00
/**
* @brief pacKman, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2021-08-16 20:48:26 +00:00
if (!defined('DC_CONTEXT_ADMIN')) {
2021-08-17 21:12:33 +00:00
return null;
2021-08-16 20:48:26 +00:00
}
$core->blog->settings->addNamespace('pacKman');
2021-08-17 21:12:33 +00:00
$core->addBehavior('adminDashboardFavorites', ['packmanBehaviors', 'adminDashboardFavorites']);
2021-08-16 20:48:26 +00:00
$_menu['Plugins']->addItem(
2021-08-17 21:12:33 +00:00
__('Packages repository'),
'plugin.php?p=pacKman#packman-repository-repository',
'index.php?pf=pacKman/icon.png',
preg_match(
'/plugin.php\?p=pacKman(&.*)?$/',
$_SERVER['REQUEST_URI']
),
$core->auth->isSuperAdmin()
2021-08-16 20:48:26 +00:00
);
class packmanBehaviors
{
2021-08-17 21:12:33 +00:00
public static function adminDashboardFavorites($core, $favs)
{
$favs->register('pacKman', [
2021-08-23 13:07:29 +00:00
'title' => __('Packages repository'),
'url' => 'plugin.php?p=pacKman#packman-repository-repository',
'small-icon' => 'index.php?pf=pacKman/icon.png',
'large-icon' => 'index.php?pf=pacKman/icon-big.png',
'permissions' => $core->auth->isSuperAdmin(),
'active_cb' => [
2021-08-17 21:12:33 +00:00
'packmanBehaviors',
'adminDashboardFavoritesActive'
2021-08-23 13:07:29 +00:00
]
2021-08-17 21:12:33 +00:00
]);
}
2021-08-16 20:48:26 +00:00
2021-08-17 21:12:33 +00:00
public static function adminDashboardFavoritesActive($request, $params)
{
return $request == 'plugin.php'
&& isset($params['p'])
&& $params['p'] == 'pacKman';
}
}