2021-08-16 20:48:26 +00:00
|
|
|
<?php
|
2021-09-02 20:14:32 +00:00
|
|
|
/**
|
|
|
|
* @brief pacKman, a plugin for Dotclear 2
|
2021-11-01 10:39:02 +00:00
|
|
|
*
|
2021-09-02 20:14:32 +00:00
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
2021-11-01 10:39:02 +00:00
|
|
|
*
|
2021-09-02 20:14:32 +00:00
|
|
|
* @author Jean-Christian Denis
|
2021-11-01 10:39:02 +00:00
|
|
|
*
|
2021-09-02 20:14:32 +00:00
|
|
|
* @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-11-01 10:39:02 +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',
|
2021-08-23 13:07:29 +00:00
|
|
|
'permissions' => $core->auth->isSuperAdmin(),
|
2021-11-01 10:39:02 +00:00
|
|
|
'active_cb' => [
|
|
|
|
'packmanBehaviors',
|
2021-08-17 21:12:33 +00:00
|
|
|
'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)
|
|
|
|
{
|
2021-11-01 10:39:02 +00:00
|
|
|
return $request == 'plugin.php'
|
|
|
|
&& isset($params['p'])
|
2021-08-17 21:12:33 +00:00
|
|
|
&& $params['p'] == 'pacKman';
|
|
|
|
}
|
|
|
|
}
|