diff --git a/src/Backend.php b/src/Backend.php index 8ab4859..b0fa89a 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -43,7 +43,7 @@ class Backend extends dcNsProcess 'adminDashboardFavoritesV2' => function (dcFavorites $favs): void { $favs->register(My::id(), [ 'title' => My::name(), - 'url' => dcCore::app()->adminurl->get(My::id()), + 'url' => dcCore::app()->adminurl?->get(My::id()), 'small-icon' => urldecode(dcPage::getPF(My::id() . '/icon.svg')), 'large-icon' => urldecode(dcPage::getPF(My::id() . '/icon.svg')), //'permissions' => null, @@ -53,13 +53,13 @@ class Backend extends dcNsProcess dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( My::name(), - dcCore::app()->adminurl->get(My::id()), + dcCore::app()->adminurl?->get(My::id()), dcPage::getPF(My::id() . '/icon.svg'), preg_match( - '/' . preg_quote(dcCore::app()->adminurl->get(My::id())) . '(&.*)?$/', + '/' . preg_quote((string) dcCore::app()->adminurl?->get(My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI'] ), - dcCore::app()->auth->isSuperAdmin() + dcCore::app()->auth?->isSuperAdmin() ); return true; diff --git a/src/BackendBehaviors.php b/src/BackendBehaviors.php index f6ed398..c42654a 100644 --- a/src/BackendBehaviors.php +++ b/src/BackendBehaviors.php @@ -51,7 +51,7 @@ class BackendBehaviors { if ($list->getList() != $prop['type'] . '-activate' || !self::translater()->getSetting($prop['type'] . '_menu') - || !dcCore::app()->auth->isSuperAdmin() + || !dcCore::app()->auth?->isSuperAdmin() ) { return null; } @@ -77,7 +77,7 @@ class BackendBehaviors return; } - dcCore::app()->adminurl->redirect( + dcCore::app()->adminurl?->redirect( My::id(), ['part' => 'module', 'type' => $type, 'module' => key($_POST['translater'])], '#module-lang' diff --git a/src/Config.php b/src/Config.php index 7c06103..d3a967c 100644 --- a/src/Config.php +++ b/src/Config.php @@ -63,7 +63,7 @@ class Config extends dcNsProcess dcPage::addSuccessNotice( __('Configuration successfully updated.') ); - dcCore::app()->adminurl->redirect( + dcCore::app()->adminurl?->redirect( 'admin.plugins', ['module' => My::id(), 'conf' => 1, 'redir' => dcCore::app()->admin->__get('list')->getRedir()] ); diff --git a/src/Manage.php b/src/Manage.php index 7136507..3bb5ea2 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -92,7 +92,7 @@ class Manage extends dcNsProcess } if ($current->action == 'module_import_pack') { - if (empty($_FILES['packfile']['name'])) { + if (empty($current->module) || empty($_FILES['packfile']['name'])) { throw new Exception(__('Nothing to import')); } $current->module->importPack($_FILES['packfile']); @@ -146,23 +146,23 @@ class Manage extends dcNsProcess public static function render(): void { - if (!self::$init) { + if (!static::$init) { return; } $current = ManageVars::init(); - $breadcrumb = [My::name() => dcCore::app()->adminurl->get(My::id(), ['type' => '-'])]; + $breadcrumb = [My::name() => dcCore::app()->adminurl?->get(My::id(), ['type' => '-'])]; if (empty($current->type)) { $breadcrumb = [My::name() => '']; } elseif (empty($current->module)) { $breadcrumb[$current->type == 'plugin' ? __('Plugins') : __('Themes')] = ''; } elseif (empty($current->lang)) { - $breadcrumb[$current->type == 'plugin' ? __('Plugins') : __('Themes')] = dcCore::app()->adminurl->get(My::id(), ['type' => $current->type]); + $breadcrumb[$current->type == 'plugin' ? __('Plugins') : __('Themes')] = dcCore::app()->adminurl?->get(My::id(), ['type' => $current->type]); $breadcrumb[html::escapeHTML($current->module->name)] = ''; } elseif (!empty($current->lang)) { - $breadcrumb[$current->type == 'plugin' ? __('Plugins') : __('Themes')] = dcCore::app()->adminurl->get(My::id(), ['type' => $current->type]); - $breadcrumb[html::escapeHTML($current->module->name)] = dcCore::app()->adminurl->get(My::id(), ['type' => $current->type, 'module' => $current->module->id]); + $breadcrumb[$current->type == 'plugin' ? __('Plugins') : __('Themes')] = dcCore::app()->adminurl?->get(My::id(), ['type' => $current->type]); + $breadcrumb[html::escapeHTML($current->module->name)] = dcCore::app()->adminurl?->get(My::id(), ['type' => $current->type, 'module' => $current->module->id]); $breadcrumb[html::escapeHTML(sprintf(__('%s language edition'), $current->lang->name))] = ''; } @@ -187,7 +187,7 @@ class Manage extends dcNsProcess if (empty($current->module) && $current->type != '') { // modules list - echo '