summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/application.php59
-rw-r--r--core/configuration-example.php91
2 files changed, 65 insertions, 85 deletions
diff --git a/core/application.php b/core/application.php
index a575f9d..c5a73a8 100644
--- a/core/application.php
+++ b/core/application.php
@@ -3,7 +3,8 @@
# Application initialization [Thomas Lange <code@nerdmind.de>] #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
# #
-# This file brings the application up! #
+# This file brings the application up and defines default configuration values #
+# for the application which can be overwritten in configuration.php. #
# #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
@@ -33,7 +34,61 @@ set_exception_handler(function(Throwable $Exception) {
HTTP::init($_GET, $_POST, $_FILES, TRUE);
#===============================================================================
-# Include configuration
+# Default configuration (can be overwritten in configuration.php)
+#===============================================================================
+$configuration = [
+ 'CORE.LANGUAGE' => 'en',
+ 'CORE.SEND_304' => FALSE,
+ 'BLOGMETA.NAME' => 'Example blog',
+ 'BLOGMETA.HOME' => 'This is an example blog.',
+ 'BLOGMETA.MAIL' => 'mail@example.org',
+ 'BLOGMETA.LANG' => 'en',
+ 'DATABASE.HOSTNAME' => 'localhost',
+ 'DATABASE.BASENAME' => 'blog',
+ 'DATABASE.USERNAME' => 'blog',
+ 'DATABASE.PASSWORD' => '',
+ 'TEMPLATE.NAME' => 'standard',
+ 'TEMPLATE.LANG' => 'en',
+ 'ADMIN.TEMPLATE' => 'admin',
+ 'ADMIN.LANGUAGE' => 'en',
+ 'PATHINFO.PROT' => $_SERVER['REQUEST_SCHEME'],
+ 'PATHINFO.HOST' => $_SERVER['HTTP_HOST'],
+ 'PATHINFO.BASE' => '',
+ 'PAGE.DIRECTORY' => 'page',
+ 'POST.DIRECTORY' => 'post',
+ 'USER.DIRECTORY' => 'user',
+ 'PAGE.SLUG_URLS' => TRUE,
+ 'POST.SLUG_URLS' => TRUE,
+ 'USER.SLUG_URLS' => TRUE,
+ 'PAGE.EMOTICONS' => TRUE,
+ 'POST.EMOTICONS' => TRUE,
+ 'USER.EMOTICONS' => TRUE,
+ 'PAGE.LIST_SIZE' => 10,
+ 'POST.LIST_SIZE' => 10,
+ 'USER.LIST_SIZE' => 10,
+ 'PAGE.FEED_SIZE' => 25,
+ 'POST.FEED_SIZE' => 25,
+ 'PAGE.DESCRIPTION_SIZE' => 200,
+ 'POST.DESCRIPTION_SIZE' => 200,
+ 'USER.DESCRIPTION_SIZE' => 200,
+ 'PAGE.LIST_SORT' => 'time_insert DESC',
+ 'POST.LIST_SORT' => 'time_insert DESC',
+ 'USER.LIST_SORT' => 'time_insert DESC',
+ 'PAGE.FEED_SORT' => 'time_insert DESC',
+ 'POST.FEED_SORT' => 'time_insert DESC',
+ 'PAGE.FEED_GUID' => ['id', 'time_insert'],
+ 'POST.FEED_GUID' => ['id', 'time_insert']
+];
+
+#===============================================================================
+# Set default configuration
+#===============================================================================
+foreach($configuration as $name => $value) {
+ Application::set($name, $value);
+}
+
+#===============================================================================
+# Include custom configuration
#===============================================================================
require 'configuration.php';
diff --git a/core/configuration-example.php b/core/configuration-example.php
index d56ce84..7805320 100644
--- a/core/configuration-example.php
+++ b/core/configuration-example.php
@@ -1,103 +1,28 @@
<?php
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
-# Application configuration [Thomas Lange <code@nerdmind.de>] #
+# Main configuration [Thomas Lange <code@nerdmind.de>] #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
# #
-# [see documentation] #
+# This file overwrites the pre-defined configuration values of the application #
+# and is the primary file where you change the configuration. Do not touch any #
+# other files to change your configuration – just overwrite it here! #
+# #
+# Documentation: #
+# 1. https://github.com/Nerdmind/Blog/wiki/Configuration #
+# 2. https://code.nerdmind.de/blog/wiki/tree/Configuration.md #
# #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
-#===============================================================================
-# Core configuration
-#===============================================================================
Application::set('CORE.LANGUAGE', 'en');
-Application::set('CORE.SEND_304', FALSE);
-
-#===============================================================================
-# Blog configuration
-#===============================================================================
Application::set('BLOGMETA.NAME', 'My Techblog');
Application::set('BLOGMETA.DESC', '[a creative description]');
Application::set('BLOGMETA.HOME', 'Home');
Application::set('BLOGMETA.MAIL', 'mail@example.org');
Application::set('BLOGMETA.LANG', 'en');
-
-#===============================================================================
-# Database configuration
-#===============================================================================
-Application::set('DATABASE.HOSTNAME', 'localhost');
Application::set('DATABASE.BASENAME', 'blog');
Application::set('DATABASE.USERNAME', '');
Application::set('DATABASE.PASSWORD', '');
-
-#===============================================================================
-# Template configuration
-#===============================================================================
Application::set('TEMPLATE.NAME', 'standard');
Application::set('TEMPLATE.LANG', Application::get('CORE.LANGUAGE'));
-
-#===============================================================================
-# Backend configuration
-#===============================================================================
-Application::set('ADMIN.TEMPLATE', 'admin');
Application::set('ADMIN.LANGUAGE', Application::get('CORE.LANGUAGE'));
-
-#===============================================================================
-# Protocol, hostname and base directory for this installation
-#===============================================================================
-Application::set('PATHINFO.PROT', $_SERVER['REQUEST_SCHEME']);
-Application::set('PATHINFO.HOST', $_SERVER['HTTP_HOST']);
-Application::set('PATHINFO.BASE', '');
-
-#===============================================================================
-# Item base directories
-#===============================================================================
-Application::set('PAGE.DIRECTORY', 'page');
-Application::set('POST.DIRECTORY', 'post');
-Application::set('USER.DIRECTORY', 'user');
-
-#===============================================================================
-# Use slug URLs for item permalinks
-#===============================================================================
-Application::set('PAGE.SLUG_URLS', TRUE);
-Application::set('POST.SLUG_URLS', TRUE);
-Application::set('USER.SLUG_URLS', TRUE);
-
-#===============================================================================
-# Parse emoticons in items content
-#===============================================================================
-Application::set('PAGE.EMOTICONS', TRUE);
-Application::set('POST.EMOTICONS', TRUE);
-Application::set('USER.EMOTICONS', TRUE);
-
-#===============================================================================
-# Number of items to show on feed and item overview
-#===============================================================================
-Application::set('PAGE.LIST_SIZE', 10);
-Application::set('POST.LIST_SIZE', 10);
-Application::set('USER.LIST_SIZE', 10);
-Application::set('PAGE.FEED_SIZE', 25);
-Application::set('POST.FEED_SIZE', 25);
-
-#===============================================================================
-# Number of characters to show in the items <meta> description
-#===============================================================================
-Application::set('PAGE.DESCRIPTION_SIZE', 200);
-Application::set('POST.DESCRIPTION_SIZE', 200);
-Application::set('USER.DESCRIPTION_SIZE', 200);
-
-#===============================================================================
-# "ORDER BY" clause for item sorting on feed and item overview
-#===============================================================================
-Application::set('PAGE.LIST_SORT', 'time_insert DESC');
-Application::set('POST.LIST_SORT', 'time_insert DESC');
-Application::set('USER.LIST_SORT', 'time_insert DESC');
-Application::set('PAGE.FEED_SORT', 'time_insert DESC');
-Application::set('POST.FEED_SORT', 'time_insert DESC');
-
-#===============================================================================
-# Item attributes used to generate the <guid> hash for feed items
-#===============================================================================
-Application::set('PAGE.FEED_GUID', ['id', 'time_insert']);
-Application::set('POST.FEED_GUID', ['id', 'time_insert']);
?> \ No newline at end of file