summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2013-01-28 10:00:02 +0100
committerAndrey Andreev <narf@bofh.bg>2013-01-28 10:00:02 +0100
commitdb529ca1e13e9f9e1c73be20c3b92a7adc3c6aa2 (patch)
treed4f4ecff21af8f6e09eb764546b8bdb02646148a /system
parent1b74e70c0cfd3aedcfa427b655e2ad3868bff531 (diff)
Remove unnecessary defined('ENVIRONMENT') checks
As suggested in issue #2134 & PR #2149
Diffstat (limited to 'system')
-rw-r--r--system/core/CodeIgniter.php2
-rw-r--r--system/core/Common.php4
-rw-r--r--system/core/Config.php6
-rw-r--r--system/core/Hooks.php2
-rw-r--r--system/core/Loader.php6
-rw-r--r--system/core/Router.php2
-rw-r--r--system/database/DB.php2
-rw-r--r--system/helpers/html_helper.php2
-rw-r--r--system/helpers/smiley_helper.php2
-rw-r--r--system/helpers/text_helper.php2
-rw-r--r--system/libraries/User_agent.php2
11 files changed, 14 insertions, 18 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 8affde64d..cb4b735d5 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -58,7 +58,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* Load the framework constants
* ------------------------------------------------------
*/
- if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
+ if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
{
require(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
}
diff --git a/system/core/Common.php b/system/core/Common.php
index d494caf80..90cc5b3a4 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -241,7 +241,7 @@ if ( ! function_exists('get_config'))
}
// Is the config file in the environment folder?
- if (defined('ENVIRONMENT') && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
+ if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
{
require($file_path);
}
@@ -316,7 +316,7 @@ if ( ! function_exists('get_mimes'))
{
static $_mimes = array();
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
{
$_mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
}
diff --git a/system/core/Config.php b/system/core/Config.php
index 0160d1a15..7e64444bc 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -106,13 +106,9 @@ class CI_Config {
$file = ($file === '') ? 'config' : str_replace('.php', '', $file);
$found = $loaded = FALSE;
- $check_locations = defined('ENVIRONMENT')
- ? array(ENVIRONMENT.'/'.$file, $file)
- : array($file);
-
foreach ($this->_config_paths as $path)
{
- foreach ($check_locations as $location)
+ foreach (array(ENVIRONMENT.'/'.$file, $file) as $location)
{
$file_path = $path.'config/'.$location.'.php';
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index 2cb416c0c..59759e02e 100644
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -81,7 +81,7 @@ class CI_Hooks {
}
// Grab the "hooks" definition file.
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php');
}
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 1ad07f1fa..bbd7a84b6 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -1089,12 +1089,12 @@ class CI_Loader {
// We test for both uppercase and lowercase, for servers that
// are case-sensitive with regard to file names. Check for environment
// first, global next
- if (defined('ENVIRONMENT') && file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
+ if (file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
{
include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
break;
}
- elseif (defined('ENVIRONMENT') && file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
+ elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
{
include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
break;
@@ -1180,7 +1180,7 @@ class CI_Loader {
*/
protected function _ci_autoloader()
{
- if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
+ if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
}
diff --git a/system/core/Router.php b/system/core/Router.php
index f284e29cc..4755b3712 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -133,7 +133,7 @@ class CI_Router {
}
// Load the routes.php file.
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
}
diff --git a/system/database/DB.php b/system/database/DB.php
index f94685c51..d9104747f 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -43,7 +43,7 @@ function &DB($params = '', $query_builder_override = NULL)
if (is_string($params) && strpos($params, '://') === FALSE)
{
// Is the config file in the environment folder?
- if (( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php'))
+ if ( ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php')
&& ! file_exists($file_path = APPPATH.'config/database.php'))
{
show_error('The configuration file database.php does not exist.');
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 2d474169b..7a71eb82b 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -242,7 +242,7 @@ if ( ! function_exists('doctype'))
if ( ! is_array($_doctypes))
{
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php');
}
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 186b24ce9..c2f50ec73 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -213,7 +213,7 @@ if ( ! function_exists('_get_smiley_array'))
*/
function _get_smiley_array()
{
- if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
+ if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php');
}
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 1c7eeaf5f..c255c15a8 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -367,7 +367,7 @@ if ( ! function_exists('convert_accented_characters'))
if ( ! isset($foreign_characters) OR ! is_array($foreign_characters))
{
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
}
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 1f4b2fa52..3fe2e0519 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -175,7 +175,7 @@ class CI_User_agent {
*/
protected function _load_agent_file()
{
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php');
}