pacKman/_admin.php

57 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.
#
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
# contact@jcdenis.fr http://jcd.lv
#
# 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', [
'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' => array(
'packmanBehaviors',
'adminDashboardFavoritesActive'
)
]);
}
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';
}
}