From 56e8c7bf2483afe458b58a2847129bce4531a8fd Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Fri, 23 Dec 2022 11:41:20 +0100 Subject: [PATCH] code review --- _admin.php | 8 ++++---- _public.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/_admin.php b/_admin.php index c8ffb2d..cf7f08a 100644 --- a/_admin.php +++ b/_admin.php @@ -16,7 +16,7 @@ if (!defined('DC_CONTEXT_ADMIN')) { dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function ($blog_settings) { $exists = []; - $path = path::fullFromRoot((string) $blog_settings->system->public_path, DC_ROOT); + $path = path::fullFromRoot((string) $blog_settings->get('system')->get('public_path'), DC_ROOT); foreach (['ico', 'png', 'bmp', 'gif', 'jpg', 'mng'] as $ext) { if (file_exists($path . '/favicon.' . $ext)) { $exists[] = sprintf('
  • %s
  • ', $path . '/favicon.' . $ext, 'favicon.' . $ext); @@ -24,10 +24,10 @@ dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function ($blog_setting } echo - '

    Favicon

    ' . + '

    ' . __('Favicon') . '

    ' . '
    ' . '

    ' . '

    ' . __("You must place an image called favicon.png or .jpg or .ico into your blog's public directory.") . @@ -41,5 +41,5 @@ dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function ($blog_setting }); dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', function ($blog_settings) { - $blog_settings->system->put('simply_favicon', !empty($_POST['simply_favicon'])); + $blog_settings->get('system')->put('simply_favicon', !empty($_POST['simply_favicon'])); }); diff --git a/_public.php b/_public.php index f8b0b82..b8ed319 100644 --- a/_public.php +++ b/_public.php @@ -29,9 +29,9 @@ class publicSimplyFavicon extends dcUrlHandlers public static function simplyFaviconUrl($arg) { - $public_path = path::fullFromRoot(dcCore::app()->blog->settings->system->public_path, DC_ROOT); + $public_path = path::fullFromRoot(dcCore::app()->blog->settings->get('system')->get('public_path'), DC_ROOT); - if (dcCore::app()->blog->settings->system->simply_favicon + if (dcCore::app()->blog->settings->get('system')->get('simply_favicon') && !empty($arg) && array_key_exists($arg, self::$mimetypes) && file_exists($public_path . '/favicon.' . $arg) @@ -48,11 +48,11 @@ class publicSimplyFavicon extends dcUrlHandlers public static function publicHeadContent() { - if (!dcCore::app()->blog->settings->system->simply_favicon) { + if (!dcCore::app()->blog->settings->get('system')->get('simply_favicon')) { return null; } - $public_path = path::fullFromRoot(dcCore::app()->blog->settings->system->public_path, DC_ROOT) . '/favicon.'; + $public_path = path::fullFromRoot(dcCore::app()->blog->settings->get('system')->get('public_path'), DC_ROOT) . '/favicon.'; $public_url = dcCore::app()->blog->url . dcCore::app()->url->getBase('simplyFavicon') . '.'; // ico : IE6