From 4abfa686ca53177b7dbbb7e1bac3febbbe27ec0f Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Wed, 10 Nov 2010 14:44:26 -0600 Subject: Blasting the Base4/5 files. Updating Controller.php to inherit bits from the old Base5. If a constructor is needed in a controller, call parent::__contruct() --- system/core/Base4.php | 70 --------------------------------------------- system/core/Base5.php | 57 ------------------------------------ system/core/CodeIgniter.php | 20 ++++--------- system/core/Controller.php | 40 +++++++++----------------- 4 files changed, 18 insertions(+), 169 deletions(-) delete mode 100644 system/core/Base4.php delete mode 100644 system/core/Base5.php (limited to 'system/core') diff --git a/system/core/Base4.php b/system/core/Base4.php deleted file mode 100644 index ef7838d69..000000000 --- a/system/core/Base4.php +++ /dev/null @@ -1,70 +0,0 @@ -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 - * constructors since objects do not exist until the class is fully - * instantiated. Basically PHP 4 sucks... - * - * Since PHP 5 doesn't suffer from this problem so we load one of - * two files based on the version of PHP being run. - * @PHP4 - * - * @package CodeIgniter - * @subpackage codeigniter - * @category front-controller - * @author ExpressionEngine Dev Team - * @link http://codeigniter.com/user_guide/ - */ - class CI_Base extends CI_Loader { - - function CI_Base() - { - // This allows syntax like $this->load->foo() to work - parent::CI_Loader(); - $this->load =& $this; - - // This allows resources used within controller constructors to work - global $OBJ; - $OBJ = $this->load; // Do NOT use a reference. - } -} - -function &get_instance() -{ - global $CI, $OBJ; - - if (is_object($CI)) - { - return $CI; - } - - return $OBJ->load; -} - - -/* End of file Base4.php */ -/* Location: ./system/core/Base4.php */ \ No newline at end of file diff --git a/system/core/Base5.php b/system/core/Base5.php deleted file mode 100644 index ac6c7f020..000000000 --- a/system/core/Base5.php +++ /dev/null @@ -1,57 +0,0 @@ -config['subclass_prefix'].'Controller'.EXT)) { diff --git a/system/core/Controller.php b/system/core/Controller.php index e250caf4b..c78be8724 100644 --- a/system/core/Controller.php +++ b/system/core/Controller.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 4.3.2 or newer + * An open source application development framework for PHP 5.1.6 or newer * * @package CodeIgniter * @author ExpressionEngine Dev Team @@ -27,16 +27,16 @@ * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/general/controllers.html */ -class CI_Controller extends CI_Base { +class CI_Controller { + + private static $instance; /** * Constructor - * - * Calls the initialize() function */ - function CI_Controller() + public function __construct() { - parent::CI_Base(); + self::$instance =& $this; // Assign all the class objects that were instantiated by the // bootstrap file (CodeIgniter.php) to local class variables @@ -46,34 +46,20 @@ class CI_Controller extends CI_Base { $this->$var =& load_class($class); } - // In PHP 5 the Loader class is run as a discreet - // class. In PHP 4 it extends the Controller @PHP4 - if (is_php('5.0.0') == TRUE) - { - $this->load =& load_class('Loader', 'core'); - - $this->load->_base_classes =& is_loaded(); + $this->load =& load_class('Loader', 'core'); - $this->load->_ci_autoloader(); - } - else - { - $this->_ci_autoloader(); + $this->load->_base_classes =& is_loaded(); - // sync up the objects since PHP4 was working from a copy - foreach (array_keys(get_object_vars($this)) as $attribute) - { - if (is_object($this->$attribute)) - { - $this->load->$attribute =& $this->$attribute; - } - } - } + $this->load->_ci_autoloader(); log_message('debug', "Controller Class Initialized"); } + public static function &get_instance() + { + return self::$instance; + } } // END Controller class -- cgit v1.2.3-24-g4f1b