diff --git a/_admin.php b/_admin.php index 6fc3121..7d2368f 100644 --- a/_admin.php +++ b/_admin.php @@ -14,11 +14,11 @@ if (!defined('DC_CONTEXT_ADMIN')) { return; } -# widget -require_once __DIR__ . '/_widgets.php'; - # settings namespace -dcCore::app()->blog->settings->addNamespace('saba'); +dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); + +# widget +require __DIR__ . '/_widgets.php'; # behaviors dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function ($blog_settings) { @@ -26,10 +26,10 @@ dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function ($blog_setting '
' . '

' . __('Search Across Blog Archive') . '

' . '

' . '

' . '

' . __('This suggests visitors some posts on page 404.') . @@ -38,6 +38,6 @@ dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function ($blog_setting }); dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', function ($blog_settings) { - $blog_settings->saba->put('active', !empty($_POST['saba_active'])); - $blog_settings->saba->put('error', !empty($_POST['saba_error'])); + $blog_settings->__get(basename(__DIR__))->put('active', !empty($_POST['saba_active'])); + $blog_settings->__get(basename(__DIR__))->put('error', !empty($_POST['saba_error'])); }); diff --git a/_define.php b/_define.php index 57c6cbd..2c03826 100644 --- a/_define.php +++ b/_define.php @@ -25,8 +25,8 @@ $this->registerModule( dcAuth::PERMISSION_ADMIN, ]), 'type' => 'plugin', - 'support' => 'https://github.com/JcDenis/saba', - 'details' => 'https://plugins.dotaddict.org/dc2/details/saba', - 'repository' => 'https://raw.githubusercontent.com/JcDenis/saba/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/_public.php b/_public.php index 0551ef8..0bdf4fd 100644 --- a/_public.php +++ b/_public.php @@ -15,9 +15,9 @@ if (!defined('DC_RC_PATH')) { } # setting -dcCore::app()->blog->settings->addNamespace('saba'); +dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); -if (!dcCore::app()->blog->settings->saba->active) { +if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->active) { return null; } @@ -25,7 +25,7 @@ if (!dcCore::app()->blog->settings->saba->active) { l10n::set(__DIR__ . '/locales/' . dcCore::app()->lang . '/public'); # widget -require_once __DIR__ . '/_widgets.php'; +require __DIR__ . '/_widgets.php'; # template path dcCore::app()->tpl->setPath( @@ -48,7 +48,7 @@ dcCore::app()->addBehavior( ); # url -if (dcCore::app()->blog->settings->saba->error) { +if (dcCore::app()->blog->settings->__get(basename(__DIR__))->error) { dcCore::app()->url->registerError(['urlSaba', 'error']); } diff --git a/_widgets.php b/_widgets.php index 30ba327..60795ab 100644 --- a/_widgets.php +++ b/_widgets.php @@ -76,10 +76,10 @@ class sabaWidget public static function getWidget($w) { - dcCore::app()->blog->settings->addNamespace('saba'); + dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); - if (!dcCore::app()->blog->settings->saba->active - || !dcCore::app()->blog->settings->saba->error && dcCore::app()->url->type == '404' + if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->active + || !dcCore::app()->blog->settings->__get(basename(__DIR__))->error && dcCore::app()->url->type == '404' || $w->offline ) { return;