* @link http://expressionengine.com/index.php?affiliate=leevigraham&page=wiki/EE_2_Config_Overrides/
* @link http://eeinsider.com/blog/eeci-2010-how-erskine-rolls-with-ee/ - Hat tip to: Erskine from EECI2010 Preso
* @version 1.10
*
* == Changelog ==
*
* Version 1.1
* - Changed 'gv_' to 'global:'
* - Added {global:cm_subscriber_list_slug} for campaignmonitor.com integration
* - Added {global:google_analytics_key} for Google Analytics integration
* - Make $_POST array available as global vars with 'post:' prefix
* - Make $_GET array available as global vars with 'get:' prefix
* - Added more inline commenting
* - Swapped order of system config and global vars
*
* Version 1.2
* - Removed $_GET and $_POST parsing. You should use Mo Variables instead. https://github.com/rsanchez/mo_variables
*
* Version 1.3
* - Added encryption key
*
* Version 1.4
* - Updated NSM .htaccess path. v1.1.0 of the addon requires the config setting to be an array
*
* Version 1.5
* - Added global:404_entry_id
*
* Version 1.6
* - Added SSL support for site url
*
* Version 1.7
* - Added placeholder config for upload directories
*
* Version 1.8
* - Added $_GET['debug'] param to help with support
*
* Version 1.9
* - Added $config['third_party'] param to ease updating
* - Added $config['base_url']
* - Moved webmaster_email config into dev environment
*
* Version 1.10
* - Added changed $config['third_party'] to $config['third_party_path']
* - Added $config['path_third_themes']
* - Added $config['url_third_themes']
*/
/**
* config_bootstrap.php is included multiple times during the request
* PHP Only allows constants to be defined once so we check first
*/
if(!defined('NSM_ENV')) {
// Set your system folder
define('NSM_SYSTEM_FOLDER', 'ee-admin');
// Define the server name, basepath and site_url
// These can all be defined using the server request and filepath
define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
define('NSM_BASEPATH', dirname(__FILE__));
define('NSM_SITE_URL', "//".NSM_SERVER_NAME);
/**
* Based on the requested server we can determine the environment
* The following conditionals check the server name for specific strings
* We use NSM_ENV to define variables latter on in the bootstrap process
*
* Examples:
* http://local.my-site.com defines NSM_ENV as local
* http://dev.my-site.com defines NSM_ENV as development
*
* strstr() — Find the first occurrence of a string
* @see http://php.net/manual/en/function.strstr.php
*/
if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'development');
elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'staging');
elseif( strstr( NSM_SERVER_NAME, 'mobi.' ) ) define('NSM_ENV', 'mobile');
// Fallback to production settings
else define('NSM_ENV', 'production');
// Not sure what environment the request is?
// Add ?debug_config_bootstrap to the end of the URL
if(isset($_GET['debug_config_bootstrap'])) {
die('The current environment is: '.NSM_ENV);
}
}
/*
* Create placeholder arrays for environment settings
* Environment settings override the global settings (also defined in config_bootstrap.php) and
* the standard config.php settings
*/
$env_config = array();
$env_db_config = array();
$env_global_vars = array();
// Comparing NSM_ENV which environment specific configuration will we load?
// Local configuration:
if ('local' === NSM_ENV) {
// Environment DB configuration
$env_db_config = array(
'hostname' => '',
'username' => '',
'password' => '',
'database' => '',
);
// Environment config variables
// Overrides anything in $env_config
$env_config = array();
// Environment global vars
// These will be available in youre templates
// 'global:' is not required, it's just a naming convention we use @Newism
// Example: 'global:cm_subscriber_list_slug' will be available in templates as {global:cm_subscriber_list_slug}
// Overrides anything in $default_global_vars
$env_global_vars = array(
'global:cm_subscriber_list_slug' => ''
);
}
elseif('development' === NSM_ENV) {
$env_db_config = array(
'hostname' => '',
'username' => '',
'password' => '',
'database' => '',
);
$env_config = array();
$env_global_vars = array();
}
elseif('staging' === NSM_ENV) {
$env_db_config = array(
'hostname' => '',
'username' => '',
'password' => '',
'database' => '',
);
$env_config = array();
$env_global_vars = array();
}
elseif('mobile' === NSM_ENV) {
$env_db_config = array(
'hostname' => '',
'username' => '',
'password' => '',
'database' => '',
);
$env_config = array(
// Custom mobile templates?
'tmpl_file_basepath' => NSM_BASEPATH . '/templates_mobile/'
);
$env_global_vars = array();
}
elseif('production' === NSM_ENV) {
$env_db_config = array(
'hostname' => '',
'username' => '',
'password' => '',
'database' => '',
);
$env_config = array();
$env_global_vars = array();
}
// Config bootsrap... GO!
if(isset($config)) {
/**
* Custom global variables
*
* This is a bit sucky as they are pulled straight from the $assign_to_config array.
* See EE_Config.php around line 90 or search for: 'global $assign_to_config;'
* Output the global vars in your template with:
* '.print_r($EE->config->_global_vars, TRUE) . '
'); ?>
*/
$default_global_vars = array(
// General - Set the production environment so we can test / show / hide components
'global:env' => NSM_ENV,
// Tag parameters - Short hand tag params
'global:param_disable_default' => 'disable="categories|pagination|member_data"',
'global:param_disable_all' => 'disable="categories|custom_fields|member_data|pagination"',
'global:param_cache_param' => 'cache="yes" refresh="10"',
'-global:param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global
// Date and time - Short hand date and time
'global:date_time' => '%g:%i %a',
'global:date_short' => '%F %d, %Y',
'global:date_full' => '%F %d %Y, %g:%i %a',
/**
* Theme - URL to theme assets
* Example:
*/
'global:theme_url' => NSM_SITE_URL . '/themes/site_themes/default',
/**
* CampaignMonitor - Slug for CM signup forms
* Example: