From 5a08b980c13f49c8fab12384435ed19e254dcca2 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Thu, 22 Dec 2022 23:27:12 +0100 Subject: [PATCH] cosmetic --- _admin.php | 8 ++++---- _prepend.php | 4 ++-- _public.php | 14 +++++++------- _widgets.php | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/_admin.php b/_admin.php index 4a2bfd8..7279244 100644 --- a/_admin.php +++ b/_admin.php @@ -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->__get(basename(__DIR__))->put('active', !empty($_POST['saba_active'])); - $blog_settings->__get(basename(__DIR__))->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/_prepend.php b/_prepend.php index d65efe5..2d17883 100644 --- a/_prepend.php +++ b/_prepend.php @@ -15,7 +15,7 @@ if (!defined('DC_RC_PATH')) { } if (defined('ACTIVITY_REPORT_V2')) { - dcCore::app()->activityReport->addAction( + dcCore::app()->__get('activityReport')->addAction( 'blog', 'saba404', __('404 error (saba)'), @@ -23,7 +23,7 @@ if (defined('ACTIVITY_REPORT_V2')) { 'sabaBeforeErrorDocument', function () { $logs = [dcCore::app()->blog->url . urldecode($_SERVER['QUERY_STRING'])]; - dcCore::app()->activityReport->addLog('blog', 'saba404', $logs); + dcCore::app()->__get('activityReport')->addLog('blog', 'saba404', $logs); } ); } diff --git a/_public.php b/_public.php index 9cee13e..4ed86ef 100644 --- a/_public.php +++ b/_public.php @@ -17,7 +17,7 @@ if (!defined('DC_RC_PATH')) { # setting dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); -if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->active) { +if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')) { return null; } @@ -48,7 +48,7 @@ dcCore::app()->addBehavior( ); # url -if (dcCore::app()->blog->settings->__get(basename(__DIR__))->error) { +if (dcCore::app()->blog->settings->get(basename(__DIR__))->get('error')) { dcCore::app()->url->registerError(['urlSaba', 'error']); } @@ -90,7 +90,7 @@ class pubSaba if ($_page_number < 1) { $_page_number = 1; } - $params['limit'] = dcCore::app()->ctx->nb_entry_per_page; + $params['limit'] = dcCore::app()->ctx->__get('nb_entry_per_page'); $params['limit'] = [(($_page_number - 1) * $params['limit']), $params['limit']]; # get posts @@ -99,12 +99,12 @@ class pubSaba $params = ['limit' => $params['limit']]; $posts = dcCore::app()->blog->getPosts($params); } - dcCore::app()->ctx->post_params = $params; - dcCore::app()->ctx->posts = $posts; + dcCore::app()->ctx->__set('post_params', $params); + dcCore::app()->ctx->__set('posts', $posts); unset($params); } - dcCore::app()->ctx->saba_options = $options; + dcCore::app()->ctx->__set('saba_options', $options); } public static function getPostsParams(&$params) @@ -269,7 +269,7 @@ class urlSaba extends dcUrlHandlers $GLOBALS['_from_error'] = true; # Serve saba - $tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->system->theme, 'tplset'); + $tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->get('system')->get('theme'), 'tplset'); self::serveDocument('saba_404_' . (!empty($tplset) && in_array($tplset, ['dotty', 'mustek']) ? $tplset : 'default') . '.html'); return true; diff --git a/_widgets.php b/_widgets.php index 5162423..668aea8 100644 --- a/_widgets.php +++ b/_widgets.php @@ -76,10 +76,10 @@ class sabaWidget public static function getWidget($w) { - dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); + $s = dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); - if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->active - || !dcCore::app()->blog->settings->__get(basename(__DIR__))->error && dcCore::app()->url->type == '404' + if (!$s->get('active') + || !$s->get('error') && dcCore::app()->url->type == '404' || $w->offline ) { return;