From 7099a589d1719311427d7552523ec962ebc3b650 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 10 Oct 2006 17:47:59 +0000 Subject: --- system/codeigniter/Base4.php | 4 ++-- system/codeigniter/CodeIgniter.php | 20 ++++++++-------- system/codeigniter/Common.php | 28 ++++++++++++---------- system/database/DB_driver.php | 12 ++++++---- system/database/DB_utility.php | 3 ++- system/database/drivers/oci8/oci8_driver.php | 3 ++- .../database/drivers/postgre/postgre_utility.php | 2 +- system/libraries/Config.php | 2 +- system/libraries/Controller.php | 2 +- system/libraries/Hooks.php | 2 +- system/libraries/Input.php | 5 ++-- system/libraries/Log.php | 2 +- system/libraries/Output.php | 4 ++-- system/libraries/Router.php | 2 +- system/libraries/URI.php | 2 +- 15 files changed, 52 insertions(+), 41 deletions(-) (limited to 'system') diff --git a/system/codeigniter/Base4.php b/system/codeigniter/Base4.php index 8b3dc92f3..9366b4588 100644 --- a/system/codeigniter/Base4.php +++ b/system/codeigniter/Base4.php @@ -21,8 +21,8 @@ * This file is used only when Code Igniter is being run under PHP 4. * * In order to allow CI to work under PHP 4 we had to make the Loader class - * the parent class of the Controller Base class. It's the only way we - * could enable functions like $this->load->library('email') to instantiate + * the parent of the Controller Base class. It's the only way we enabled + * enable functions like $this->load->library('email') to instantiate * classes that can then be used within controllers as $this->email->send() * * PHP 4 also has trouble referencing the CI super object within application diff --git a/system/codeigniter/CodeIgniter.php b/system/codeigniter/CodeIgniter.php index 63ae45864..611b1a621 100644 --- a/system/codeigniter/CodeIgniter.php +++ b/system/codeigniter/CodeIgniter.php @@ -50,7 +50,7 @@ set_magic_quotes_runtime(0); // Kill magic quotes * ------------------------------------------------------ */ -$BM =& _load_class('Benchmark'); +$BM =& load_class('Benchmark'); $BM->mark('total_execution_time_start'); $BM->mark('loading_time_base_clases_start'); @@ -60,7 +60,7 @@ $BM->mark('loading_time_base_clases_start'); * ------------------------------------------------------ */ -$EXT =& _load_class('Hooks'); +$EXT =& load_class('Hooks'); /* * ------------------------------------------------------ @@ -75,9 +75,9 @@ $EXT->_call_hook('pre_system'); * ------------------------------------------------------ */ -$CFG =& _load_class('Config'); -$RTR =& _load_class('Router'); -$OUT =& _load_class('Output'); +$CFG =& load_class('Config'); +$RTR =& load_class('Router'); +$OUT =& load_class('Output'); /* * ------------------------------------------------------ @@ -99,9 +99,9 @@ if ($EXT->_call_hook('cache_override') === FALSE) * ------------------------------------------------------ */ -$IN =& _load_class('Input'); -$URI =& _load_class('URI'); -$LANG =& _load_class('Language'); +$IN =& load_class('Input'); +$URI =& load_class('URI'); +$LANG =& load_class('Language'); /* * ------------------------------------------------------ @@ -116,7 +116,7 @@ $LANG =& _load_class('Language'); * */ -_load_class('Loader', FALSE); +load_class('Loader', FALSE); if (floor(phpversion()) < 5) { @@ -127,7 +127,7 @@ else require(BASEPATH.'codeigniter/Base5'.EXT); } -_load_class('Controller', FALSE); +load_class('Controller', FALSE); require(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT); diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php index a801c0821..8ac80d634 100644 --- a/system/codeigniter/Common.php +++ b/system/codeigniter/Common.php @@ -41,7 +41,7 @@ * @param bool optional flag that lets classes get loaded but not instantiated * @return object */ -function _load_class($class, $instantiate = TRUE) +function &load_class($class, $instantiate = TRUE) { static $objects = array(); @@ -55,7 +55,8 @@ function _load_class($class, $instantiate = TRUE) // which we don't need to load. We only instantiate it. if ($class == 'Instance') { - return $objects[$class] =& new $class(); + $objects[$class] =& new $class(); + return $objects[$class]; } // If the requested class does not exist in the application/libraries @@ -104,18 +105,21 @@ function _load_class($class, $instantiate = TRUE) if ($instantiate == FALSE) { - return $objects[$class] = TRUE; + $objects[$class] = TRUE; + return $objects[$class]; } if ($is_subclass == TRUE) { $name = 'MY_'.$class; - return $objects[$class] =& new $name(); + $objects[$class] =& new $name(); + return $objects[$class]; } $name = ($class != 'Controller') ? 'CI_'.$class : $class; - return $objects[$class] =& new $name(); + $objects[$class] =& new $name(); + return $objects[$class]; } /** @@ -124,7 +128,7 @@ function _load_class($class, $instantiate = TRUE) * @access private * @return array */ -function &_get_config() +function &get_config() { static $main_conf; @@ -162,7 +166,7 @@ function &_get_config() */ function show_error($message) { - $error =& _load_class('Exceptions'); + $error =& load_class('Exceptions'); echo $error->show_error('An Error Was Encountered', $message); exit; } @@ -180,7 +184,7 @@ function show_error($message) */ function show_404($page = '') { - $error =& _load_class('Exceptions'); + $error =& load_class('Exceptions'); $error->show_404($page); exit; } @@ -199,13 +203,13 @@ function log_message($level = 'error', $message, $php_error = FALSE) { static $LOG; - $config =& _get_config(); + $config = get_config(); if ($config['log_errors'] === FALSE) { return; } - $LOG =& _load_class('Log'); + $LOG =& load_class('Log'); $LOG->write_log($level, $message, $php_error); } @@ -238,7 +242,7 @@ function _exception_handler($severity, $message, $filepath, $line) return; } - $error =& _load_class('Exceptions'); + $error =& load_class('Exceptions'); // Should we display the error? // We'll get the current error_reporting level and add its bits @@ -250,7 +254,7 @@ function _exception_handler($severity, $message, $filepath, $line) } // Should we log the error? No? We're done... - $config =& _get_config(); + $config = get_config(); if ($config['log_errors'] === FALSE) { return; diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index c8a00b7b1..99c95a6f2 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -682,7 +682,8 @@ class CI_DB_driver { } } - return $this->data_cache['table_names'] =& $retval; + $this->data_cache['table_names'] = $retval; + return $this->data_cache['table_names']; } // -------------------------------------------------------------------- @@ -747,7 +748,8 @@ class CI_DB_driver { } } - return $this->data_cache['field_names'][$table] =& $retval; + $this->data_cache['field_names'][$table] = $retval; + return $this->data_cache['field_names'][$table]; } // -------------------------------------------------------------------- @@ -931,7 +933,8 @@ class CI_DB_driver { */ function cache_on() { - return $this->cache_on = TRUE; + $this->cache_on = TRUE; + return TRUE; } // -------------------------------------------------------------------- @@ -944,7 +947,8 @@ class CI_DB_driver { */ function cache_off() { - return $this->cache_on = FALSE; + $this->cache_on = FALSE; + return FALSE; } diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index c2c5f1fe0..51e43a7c8 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -110,7 +110,8 @@ class CI_DB_utility { } } - return $this->data_cache['db_names'] =& $dbs; + $this->data_cache['db_names'] = $dbs; + return $this->data_cache['db_names']; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index e83c640bd..794405a03 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -163,7 +163,8 @@ class CI_DB_oci8_driver extends CI_DB { */ function get_cursor() { - return $this->curs_id = ocinewcursor($this->conn_id); + $this->curs_id = ocinewcursor($this->conn_id); + return $this->curs_id; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index 0c265de16..b08b879d7 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -106,7 +106,7 @@ class CI_DB_postgre_utility extends CI_DB_utility { */ function _repair_table($table) { - return return FALSE; + return FALSE; } // -------------------------------------------------------------------- diff --git a/system/libraries/Config.php b/system/libraries/Config.php index 26770cc4f..82836b1f3 100644 --- a/system/libraries/Config.php +++ b/system/libraries/Config.php @@ -44,7 +44,7 @@ class CI_Config { */ function CI_Config() { - $this->config =& _get_config(); + $this->config = get_config(); log_message('debug', "Config Class Initialized"); } // END CI_Config() diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php index 7a3f5e5d5..938c46e4c 100644 --- a/system/libraries/Controller.php +++ b/system/libraries/Controller.php @@ -73,7 +73,7 @@ class Controller extends CI_Base { foreach ($classes as $var => $class) { - $this->$var =& _load_class($class); + $this->$var =& load_class($class); } diff --git a/system/libraries/Hooks.php b/system/libraries/Hooks.php index 8767e10d0..e2d0500c0 100644 --- a/system/libraries/Hooks.php +++ b/system/libraries/Hooks.php @@ -53,7 +53,7 @@ class CI_Hooks { */ function _initialize() { - $CFG =& _load_class('Config'); + $CFG =& load_class('Config'); // If hooks are not enabled in the config file // there is nothing else to do diff --git a/system/libraries/Input.php b/system/libraries/Input.php index 0d3c87b49..72344e343 100644 --- a/system/libraries/Input.php +++ b/system/libraries/Input.php @@ -44,7 +44,7 @@ class CI_Input { { log_message('debug', "Input Class Initialized"); - $CFG =& _load_class('Config'); + $CFG =& load_class('Config'); $this->use_xss_clean = ($CFG->item('global_xss_filtering') === TRUE) ? TRUE : FALSE; $this->allow_get_array = ($CFG->item('enable_query_strings') === TRUE) ? TRUE : FALSE; $this->_sanitize_globals(); @@ -306,7 +306,8 @@ class CI_Input { if ($this->ip_address === FALSE) { - return $this->ip_address = '0.0.0.0'; + $this->ip_address = '0.0.0.0'; + return $this->ip_address; } if (strstr($this->ip_address, ',')) diff --git a/system/libraries/Log.php b/system/libraries/Log.php index eff7cb7fc..09538fa0b 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -42,7 +42,7 @@ class CI_Log { */ function CI_Log() { - $config =& _get_config(); + $config = get_config(); $this->log_path = ($config['log_path'] != '') ? $config['log_path'] : BASEPATH.'logs/'; diff --git a/system/libraries/Output.php b/system/libraries/Output.php index 507beab59..7e859453e 100644 --- a/system/libraries/Output.php +++ b/system/libraries/Output.php @@ -299,8 +299,8 @@ class CI_Output { */ function _display_cache(&$CFG, &$RTR) { - $CFG =& _load_class('Config'); - $RTR =& _load_class('Router'); + $CFG =& load_class('Config'); + $RTR =& load_class(('Router'); $cache_path = ($CFG->item('cache_path') == '') ? BASEPATH.'cache/' : $CFG->item('cache_path'); diff --git a/system/libraries/Router.php b/system/libraries/Router.php index 27e3c27cc..dab84883e 100644 --- a/system/libraries/Router.php +++ b/system/libraries/Router.php @@ -48,7 +48,7 @@ class CI_Router { */ function CI_Router() { - $this->config =& _load_class('Config'); + $this->config =& load_class('Config'); $this->_set_route_mapping(); log_message('debug', "Router Class Initialized"); } diff --git a/system/libraries/URI.php b/system/libraries/URI.php index 80b112660..fcf6afe4b 100644 --- a/system/libraries/URI.php +++ b/system/libraries/URI.php @@ -42,7 +42,7 @@ class CI_URI { */ function CI_URI() { - $this->router =& _load_class('Router'); + $this->router =& load_class('Router'); log_message('debug', "URI Class Initialized"); } -- cgit v1.2.3-24-g4f1b