Index: trunk/docs/examples/_config.inc.php
===================================================================
--- trunk/docs/examples/_config.inc.php	(revision 767)
+++ trunk/docs/examples/_config.inc.php	(revision 803)
@@ -25,5 +25,5 @@
  *
  * @author  Quinn Comendant <quinn@strangecode.com>
- * @version 1.3
+ * @version 1.4
  * @since   03 Dec 2005 19:09:32
  */
@@ -44,9 +44,27 @@
 
 // Set include path for all templates and libraries.
-ini_set('include_path', join(PATH_SEPARATOR, array(
+ini_set('include_path', join(PATH_SEPARATOR, [
     COMMON_BASE,
     SITE_BASE . '/_templates',
     get_include_path(),
-)));
+]));
+
+// Define server environments.
+// Use this to toggle feature flags via, e.g., `if (ENVIRONMENT === PRODUCTION) { seriousStuff(); }`
+define('PRODUCTION', 'production');
+define('DEVELOPMENT', 'development');
+define('LOCAL', 'local');
+switch (getenv('ENVIRONMENT')) {
+case 'production':
+    define('ENVIRONMENT', PRODUCTION);
+    break;
+case 'dev':
+case 'staging':
+    define('ENVIRONMENT', DEVELOPMENT);
+    break;
+case 'local':
+    define('ENVIRONMENT', LOCAL);
+    break;
+}
 
 // Include core libraries.
@@ -56,5 +74,5 @@
 // Primary application class.
 $app =& App::getInstance('public');
-$app->setParam(array(
+$app->setParam([
     'site_name' => 'WWW Public Site',
     'site_email' => 'hello@example.com',
@@ -75,33 +93,29 @@
 
     // 'ssl_domain' => 'www.example.com',
-    // 'ssl_enabled' => ($_SERVER['SERVER_NAME'] == 'www.example.com'),
+    // 'ssl_enabled' => ENVIRONMENT === PRODUCTION,
 
     'enable_db' => true,
     'db_always_debug' => false,
-    'db_debug' => true,
+    'db_debug' => false,
     'db_die_on_failure' => true,
-    'db_create_tables' => true, // Disable after site launch.
+    'db_create_tables' => true, /// Disable after site launch.
 
-    'display_errors' => true,
+    'display_errors' => ENVIRONMENT !== PRODUCTION,
     'error_reporting' => E_ALL & ~E_DEPRECATED & ~E_STRICT,
 
     'log_directory' => '/tmp',
     'log_filename' => 'site_log',
-    'log_file_priority' => LOG_DEBUG,
-    'log_email_priority' => false,
-    'log_sms_priority' => false,
-    'log_screen_priority' => false,
+    'log_file_priority' => ENVIRONMENT === PRODUCTION ? LOG_DEBUG : LOG_DEBUG,
+    'log_email_priority' => ENVIRONMENT === PRODUCTION ? LOG_WARNING : false,
+    'log_sms_priority' => ENVIRONMENT === PRODUCTION ? LOG_ALERT : false,
+    'log_screen_priority' => ENVIRONMENT === PRODUCTION ? LOG_WARNING : LOG_INFO,
     // Email address to receive log event emails. Use multiple addresses by separating them with commas.
     'log_to_email_address' => 'my-emailalert-address@example.com',
     // SMS Email address to receive log event SMS messages. Use multiple addresses by separating them with commas.
     'log_to_sms_address' => 'my-smsalert-address@example.com',
-));
 
-if ($app->isCLI()) {
-    // DB credentials for command line scripts stored in a file with read rights
-    // given only to the user who will be executing the scripts: -rw-------
-    // This file includes $app-> method calls so this must be included after App::getInstance().
-    require_once 'global/db_auth.inc.php';
-}
+    // Prettify json when testing.
+    'json_options' => ENVIRONMENT === PRODUCTION ? 0 : JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES,
+]);
 
 // Start application-based functionality: database, session, environment, ini setup, etc.
@@ -115,5 +129,5 @@
 require_once 'codebase/lib/Auth_SQL.inc.php';
 $auth = new Auth_SQL('public');
-$auth->setParam(array(
+$auth->setParam([
     'db_table'          => 'user_tbl',
     'db_primary_key'    => 'user_id',
@@ -121,45 +135,35 @@
     'login_timeout' => 260000, // 72 hours
     'idle_timeout' => 86400, // 24 hours
-));
+]);
 
 // Load preferences for the user.
 require_once 'codebase/lib/Prefs.inc.php';
-$prefs = new Prefs('permanent', array(
+$prefs = new Prefs('permanent', [
     'storagetype' => ($auth->isLoggedIn() ? 'database' : 'session'),
     'user_id' => $auth->get('user_id'),
-));
-$prefs->setDefaults(array(
-    // ...
-));
+]);
+$prefs->setDefaults([
+    'dark-mode' => true,
+]);
 $prefs->load();
-// Load preferences for temporary usage.
-require_once 'codebase/lib/Prefs.inc.php';
-$c_prefs = new Prefs('config');
-$c_prefs->setParam(array(
-    'storagetype' => 'cookie',
-));
-// Temporary prefs.
-$c_prefs = new Prefs('settings');
-$c_prefs->setDefaults(array(
-));
 
 // Global record-locking object.
 require_once 'codebase/lib/Lock.inc.php';
 $lock =& Lock::getInstance($auth);
-$lock->setParam(array(
+$lock->setParam([
     'timeout' => 0,
     'auto_timeout' => 1800,
     'error_url' => '/lock.php',
-));
+]);
 
 // Global cache object.
 require_once 'codebase/lib/Cache.inc.php';
 $cache = new Cache('global');
-$cache->setParam(array('enabled' => true)); // TODO: Enable caching after site launch.
+$cache->setParam(['enabled' => ENVIRONMENT === PRODUCTION]);
 
 // Setup CSS files to include. These will always be available.
 require_once 'codebase/lib/CSS.inc.php';
 $css = new CSS();
-$css->setParam(array('cache_css' => false)); // TODO: Enable caching after site launch.
+$css->setParam(['cache_css' => ENVIRONMENT === PRODUCTION]);
 $css->setFile('codebase/css/codebase.inc.css');
 $css->setFile('codebase/css/utilities.inc.css');
@@ -169,11 +173,10 @@
 // Global navigation titles, breadcrumbs, and page features.
 require_once 'codebase/lib/Navigation.inc.php';
-$nav = new Navigation(array(
+$nav = new Navigation([
     'path_delimiter' => ' / ',
     'last_crumb_format' => '<b>%s</b>',
-));
+]);
 
 // Global site-specific configuration.
-// $cfg = array();
+// $cfg = [];
 // require_once 'global/config.inc.php';
-
