pacKman/_admin.php

56 lines
1.7 KiB
PHP
Raw Normal View History

2021-08-16 20:48:26 +00:00
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of pacKman, a plugin for Dotclear 2.
#
2021-08-23 13:08:59 +00:00
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
2021-08-16 20:48:26 +00:00
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
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';
}
}