use anonymous functions
parent
8d9591202b
commit
2b973475a1
55
_admin.php
55
_admin.php
|
@ -16,51 +16,24 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
|
||||||
dcCore::app()->blog->settings->addNamespace('licenseBootstrap');
|
dcCore::app()->blog->settings->addNamespace('licenseBootstrap');
|
||||||
|
|
||||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', [
|
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function ($favs) {
|
||||||
'licenseBootstrapBehaviors', 'adminDashboardFavorites',
|
$favs->register('licenseBootstrap', [
|
||||||
|
'title' => __('License bootstrap'),
|
||||||
|
'url' => dcCore::app()->adminurl->get('admin.plugin.licenseBootstrap'),
|
||||||
|
'small-icon' => urldecode(dcPage::getPF('licenseBootstrap/icon.svg')),
|
||||||
|
'large-icon' => urldecode(dcPage::getPF('licenseBootstrap/icon.svg')),
|
||||||
|
'permissions' => dcCore::app()->auth->isSuperAdmin(),
|
||||||
]);
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
dcCore::app()->addBehavior('packmanBeforeCreatePackage', [
|
dcCore::app()->addBehavior('packmanBeforeCreatePackage', function ($module) {
|
||||||
'licenseBootstrapBehaviors', 'packmanBeforeCreatePackage',
|
licenseBootstrap::addLicense($module);
|
||||||
]);
|
});
|
||||||
|
|
||||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
__('License bootstrap'),
|
__('License bootstrap'),
|
||||||
'plugin.php?p=licenseBootstrap',
|
dcCore::app()->adminurl->get('admin.plugin.licenseBootstrap'),
|
||||||
'index.php?pf=licenseBootstrap/icon.svg',
|
urldecode(dcPage::getPF('licenseBootstrap/icon.svg')),
|
||||||
preg_match(
|
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.licenseBootstrap')) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||||
'/plugin.php\?p=licenseBootstrap(&.*)?$/',
|
|
||||||
$_SERVER['REQUEST_URI']
|
|
||||||
),
|
|
||||||
dcCore::app()->auth->isSuperAdmin()
|
dcCore::app()->auth->isSuperAdmin()
|
||||||
);
|
);
|
||||||
|
|
||||||
class licenseBootstrapBehaviors
|
|
||||||
{
|
|
||||||
public static function adminDashboardFavorites($favs)
|
|
||||||
{
|
|
||||||
$favs->register('licenseBootstrap', [
|
|
||||||
'title' => __('License bootstrap'),
|
|
||||||
'url' => 'plugin.php?p=licenseBootstrap',
|
|
||||||
'small-icon' => 'index.php?pf=licenseBootstrap/icon.svg',
|
|
||||||
'large-icon' => 'index.php?pf=licenseBootstrap/icon.svg',
|
|
||||||
'permissions' => dcCore::app()->auth->isSuperAdmin(),
|
|
||||||
'active_cb' => [
|
|
||||||
'licenseBootstrapBehaviors',
|
|
||||||
'adminDashboardFavoritesActive',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function adminDashboardFavoritesActive($request, $params)
|
|
||||||
{
|
|
||||||
return $request == 'plugin.php'
|
|
||||||
&& isset($params['p'])
|
|
||||||
&& $params['p'] == 'licenseBootstrap';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function packmanBeforeCreatePackage($module)
|
|
||||||
{
|
|
||||||
licenseBootstrap::addLicense($module);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue