Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Json support for get settings when retrieving one value
givanz1d53d70f8cd2
diff --git a/system/setting.php b/system/setting.phpindex 031fc78..3d21662 100755--- a/system/setting.php+++ b/system/setting.php@@ -56,9 +56,10 @@ class Setting {foreach ($result as $value) {$val = $value['value'];- if ($val[0] == '{') {++ if ($val && is_string($val) && $val[0] == '{') {$json = json_decode($val, true);- $val = $json ?: $val;+ $val = $json ?: $val;}$return[$value['key']] = $val;}@@ -82,7 +83,14 @@ class Setting {return $this->setting[$namespace][$key];}- return $this->settingSql->getSetting(['namespace' => $namespace, 'key' => $key, 'site_id' => $site_id]) ?? $default;+ $result = $this->settingSql->getSetting(['namespace' => $namespace, 'key' => $key, 'site_id' => $site_id]) ?? $default;++ if ($result && is_string($result) && $result[0] == '{') {+ $json = json_decode($result, true);+ $result = $json ?: $result;+ }++ return $result;}}@@ -92,6 +100,7 @@ class Setting {}$this->setting[$namespace][$key] = $value;+if (is_array($value)) {$value = json_encode($value);}