diff --git a/_admin.php b/_admin.php index a89c1d3..7bcbc38 100644 --- a/_admin.php +++ b/_admin.php @@ -14,14 +14,14 @@ if (!defined('DC_CONTEXT_ADMIN')) { return null; } -dcCore::app()->blog->settings->addNamespace('licenseBootstrap'); +dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); dcCore::app()->addBehavior('adminDashboardFavoritesV2', function ($favs) { - $favs->register('licenseBootstrap', [ + $favs->register(basename(__DIR__), [ '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')), + 'url' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)), + 'small-icon' => urldecode(dcPage::getPF(basename(__DIR__) . '/icon.svg')), + 'large-icon' => urldecode(dcPage::getPF(basename(__DIR__) . '/icon.svg')), //'permissions' => dcCore::app()->auth->isSuperAdmin(), ]); }); @@ -32,8 +32,8 @@ dcCore::app()->addBehavior('packmanBeforeCreatePackage', function ($module) { dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( __('License bootstrap'), - dcCore::app()->adminurl->get('admin.plugin.licenseBootstrap'), - urldecode(dcPage::getPF('licenseBootstrap/icon.svg')), - preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.licenseBootstrap')) . '(&.*)?$/', $_SERVER['REQUEST_URI']), + dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)), + urldecode(dcPage::getPF(basename(__DIR__) . '/icon.svg')), + preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']), dcCore::app()->auth->isSuperAdmin() ); diff --git a/_config.php b/_config.php index 4c1cd2f..cffe37f 100644 --- a/_config.php +++ b/_config.php @@ -18,8 +18,7 @@ $redir = empty($_REQUEST['redir']) ? dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir']; # -- Get settings -- -dcCore::app()->blog->settings->addNamespace('licenseBootstrap'); -$s = dcCore::app()->blog->settings->licenseBootstrap; +$s = dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); $lb_overwrite = (bool) $s->overwrite; $lb_write_full = (bool) $s->write_full; @@ -52,7 +51,7 @@ if (!empty($_POST['save'])) { __('Configuration has been successfully updated.') ); http::redirect( - dcCore::app()->admin->list->getURL('module=licenseBootstrap&conf=1&redir=' . + dcCore::app()->admin->list->getURL('module=' . basename(__DIR__) . '&conf=1&redir=' . dcCore::app()->admin->list->getRedir()) ); } catch (Exception $e) { diff --git a/_define.php b/_define.php index 054be58..e90a1be 100644 --- a/_define.php +++ b/_define.php @@ -23,8 +23,8 @@ $this->registerModule( 'requires' => [['core', '2.24']], 'permissions' => null, 'type' => 'plugin', - 'support' => 'https://github.com/JcDenis/licenseBootstrap', - 'details' => 'https://plugins.dotaddict.org/dc2/details/licenseBootstrap', - 'repository' => 'https://raw.githubusercontent.com/JcDenis/licenseBootstrap/master/dcstore.xml', + 'support' => 'https://github.com/JcDenis/' . basename(__DIR__), + 'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__), + 'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml', ] ); diff --git a/_uninstall.php b/_uninstall.php index 8c42106..0af5e4a 100644 --- a/_uninstall.php +++ b/_uninstall.php @@ -14,15 +14,13 @@ if (!defined('DC_CONTEXT_ADMIN')) { return null; } -$mod_id = 'pacKman'; - $this->addUserAction( /* type */ 'settings', /* action */ 'delete_all', /* ns */ - $mod_id, + basename(__DIR__), /* desc */ __('delete all settings') ); @@ -33,7 +31,7 @@ $this->addUserAction( /* action */ 'delete', /* ns */ - $mod_id, + basename(__DIR__), /* desc */ __('delete plugin files') ); @@ -44,9 +42,9 @@ $this->addDirectAction( /* action */ 'delete_all', /* ns */ - $mod_id, + basename(__DIR__), /* desc */ - sprintf(__('delete all %s settings'), $mod_id) + sprintf(__('delete all %s settings'), basename(__DIR__)) ); $this->addDirectAction( @@ -55,7 +53,7 @@ $this->addDirectAction( /* action */ 'delete', /* ns */ - $mod_id, + basename(__DIR__), /* desc */ - sprintf(__('delete %s plugin files'), $mod_id) + sprintf(__('delete %s plugin files'), basename(__DIR__)) ); diff --git a/inc/class.license.bootstrap.php b/inc/class.license.bootstrap.php index 03bd6e5..8c21292 100644 --- a/inc/class.license.bootstrap.php +++ b/inc/class.license.bootstrap.php @@ -28,7 +28,7 @@ class licenseBootstrap */ public static function addLicense($module) { - $s = dcCore::app()->blog->settings->licenseBootstrap; + $s = dcCore::app()->blog->settings->get(basename(__DIR__)); # --BEHAVIOR-- licenseBootstrapBeforeAddLicense dcCore::app()->callBehavior( diff --git a/index.php b/index.php index f910820..c9349ab 100644 --- a/index.php +++ b/index.php @@ -17,13 +17,11 @@ if (!defined('DC_CONTEXT_ADMIN')) { dcPage::checkSuper(); # Queries -$p_url = 'plugin.php?p=licenseBootstrap'; $action = $_POST['action'] ?? ''; $type = isset($_POST['type']) && in_array($_POST['type'], ['plugins', 'themes']) ? $_POST['type'] : ''; # Settings -dcCore::app()->blog->settings->addNamespace('licenseBootstrap'); -$s = dcCore::app()->blog->settings->licenseBootstrap; +$s = dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); # Modules if (!isset(dcCore::app()->themes)) { @@ -72,7 +70,7 @@ try { echo '' . __('License bootstrap') . '' . dcPage::jsPageTabs() . -dcPage::jsLoad('index.php?pf=licenseBootstrap/js/licensebootstrap.js') . +dcPage::jsModuleLoad(basename(__DIR__) . '/js/licensebootstrap.js') . # --BEHAVIOR-- licenseBootstrapAdminHeader dcCore::app()->callBehavior('licenseBootstrapAdminHeader') .