From 5a507cfae2929ab14299a444dcddae8d2f56b67b Mon Sep 17 00:00:00 2001 From: Awilum Date: Wed, 24 Apr 2019 10:59:40 +0300 Subject: [PATCH] Using clean JSON instead of YAML #123 #117 --- flextype/bootstrap.php | 8 +-- flextype/config/settings.json | 60 +++++++++++++++++ flextype/config/settings.yaml | 121 ---------------------------------- site/config/settings.json | 1 + site/config/settings.yaml | 0 5 files changed, 65 insertions(+), 125 deletions(-) create mode 100644 flextype/config/settings.json delete mode 100644 flextype/config/settings.yaml create mode 100644 site/config/settings.json delete mode 100644 site/config/settings.yaml diff --git a/flextype/bootstrap.php b/flextype/bootstrap.php index fc386537..773e334a 100755 --- a/flextype/bootstrap.php +++ b/flextype/bootstrap.php @@ -103,8 +103,8 @@ $flextype['registry'] = function($container) { $flextype['registry']->set('settings', []); // Set settings files path -$default_settings_file_path = PATH['config']['default'] . '/settings.yaml'; -$site_settings_file_path = PATH['config']['site'] . '/settings.yaml'; +$default_settings_file_path = PATH['config']['default'] . '/settings.json'; +$site_settings_file_path = PATH['config']['site'] . '/settings.json'; // Set settings if Flextype settings and Site settings config files exist if (Filesystem::has($default_settings_file_path) && Filesystem::has($site_settings_file_path)) { @@ -112,13 +112,13 @@ if (Filesystem::has($default_settings_file_path) && Filesystem::has($site_settin if (($content = Filesystem::read($default_settings_file_path)) === false) { throw new \RuntimeException('Load file: ' . $default_settings_file_path . ' - failed!'); } else { - $default_settings = YamlParser::decode($content); + $default_settings = JsonParser::decode($content); } if (($content = Filesystem::read($site_settings_file_path)) === false) { throw new \RuntimeException('Load file: ' . $site_settings_file_path . ' - failed!'); } else { - $site_settings = YamlParser::decode($content); + $site_settings = JsonParser::decode($content); } // Merge settings diff --git a/flextype/config/settings.json b/flextype/config/settings.json new file mode 100644 index 00000000..2256fa96 --- /dev/null +++ b/flextype/config/settings.json @@ -0,0 +1,60 @@ +{ + "title": "Flextype", + "description": "Build fast, flexible, easier to manage websites with Flextype.", + "keywords": "flextype, php, cms, flat-file cms, flat cms, flatfile cms, html", + "robots": "index, follow", + "author": { + "email": "", + "name": "" + }, + "timezone": "UTC", + "charset": "UTF-8", + "date_format": "F d Y H:i:s", + "theme": "default", + "locale": "en_US", + "entries": { + "main": "home", + "media": { + "upload_images_quality": 70, + "upload_images_width": 1600, + "upload_images_height": 0, + "accept_file_types": "gif, jpg, jpeg, png, ico, zip, tgz, txt, md, doc, docx, pdf, epub, xls, xlsx, ppt, pptx, mp3, ogg, wav, m4a, mp4, m4v, ogv, wmv, avi, webm, svg" + }, + "error404": { + "title": "Error 404", + "description": "We're sorry but the page you are looking for doesn't appear to exist!", + "content": "We're sorry but the page you are looking for doesn't appear to exist!", + "template": "default" + } + }, + "errors": { + "display": true + }, + "cache": { + "enabled": false, + "prefix": "flextype", + "driver": "auto", + "lifetime": 604800, + "memcache": { + "server": "localhost", + "port": 11211 + }, + "memcached": { + "server": "localhost", + "port": 11211 + }, + "redis": { + "socket": false, + "password": false, + "server": "localhost", + "port": 6379 + }, + "sqlite3": { + "database": "flextype", + "table": "flextype" + } + }, + "admin_panel": { + "theme": "light" + } +} diff --git a/flextype/config/settings.yaml b/flextype/config/settings.yaml deleted file mode 100644 index bc7fe744..00000000 --- a/flextype/config/settings.yaml +++ /dev/null @@ -1,121 +0,0 @@ -# The title of the website -title: "Flextype" - -# The description of the website -description: "Build fast, flexible, easier to manage websites with Flextype." - -# The keywords of the website -keywords: "flextype, php, cms, flat-file cms, flat cms, flatfile cms, html" - -# The robots of the website -robots: "index, follow" - -# The name and email address of the website author -author: - email: "" - name: "" - -# Set the timezone to be used on the website. -# For a list of valid timezone settings, see: -# http://php.net/manual/en/timezones.php -timezone: UTC - -# Charset -# -# Set internal character encoding. -# -# Currently the following names are supported: -# http://php.net/manual/ru/function.mb-regex-encoding.php#121645 -charset: UTF-8 - -# Valid date format -# see: http://php.net/manual/ru/function.date.php -date_format: "F d Y H:i:s" - -# The theme to use. -# -# Don't edit the provided theme templates directly, because they get updated -# in next releases. If you wish to modify a default theme, copy its folder, and -# change the name here accordingly. -theme: default - -# The locale that'll be used by the Flextype. -locale: "en_US" - -# The entries settings -# Define the file types (extensions to be exact) that are acceptable for upload. -entries: - main: home - media: - upload_images_quality: 70 - upload_images_width: 1600 - upload_images_height: 0 - accept_file_types: "gif, jpg, jpeg, png, ico, zip, tgz, txt, md, doc, docx, pdf, epub, xls, xlsx, ppt, pptx, mp3, ogg, wav, m4a, mp4, m4v, ogv, wmv, avi, webm, svg" - error404: - title: "Error 404" - description: "We're sorry but the page you are looking for doesn't appear to exist!" - content: "We're sorry but the page you are looking for doesn't appear to exist!" - template: "default" - -# Display errors -# -# - display: Display errors or not. -errors: - display: true - -# Cache -# -# - enabled: Set to true to enable caching -# -# - prefix: Cache prefix string (prevents cache conflicts) -# -# - driver: Available drivers: auto (will get one from installed cache drivers), apcu, -# apc, array, wincache, xcache, memcache, memcached, redis, file. -# -# - lifetime: Lifetime of cached data in seconds -# -# - redis.socket: Path to redis unix socket (e.g. /var/run/redis/redis.sock), -# false = use server and port to connect -# -# - redis.password Redis password -# -# - redis.server Redis server -# -# - redis.port Redis port -# -# - memcache.server Memcache server -# -# - memcache.port Memcache port -# -# - memcached.server Memcached server -# -# - memcached.port Memcached port -# -# - sqlite3.database SQLite3 Database -# -# - sqlite3.table SQLite3 Table -cache: - enabled: false - prefix: flextype - driver: auto - lifetime: 604800 - memcache: - server: 'localhost' - port: 11211 - memcached: - server: 'localhost' - port: 11211 - redis: - socket: false - password: false - server: 'localhost' - port: 6379 - sqlite3: - database: flextype - table: flextype - -# Admin Panel -# -# - themes: Theme (dark, light) -admin_panel: - theme: light diff --git a/site/config/settings.json b/site/config/settings.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/site/config/settings.json @@ -0,0 +1 @@ +{} diff --git a/site/config/settings.yaml b/site/config/settings.yaml deleted file mode 100644 index e69de29b..00000000