summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Kriete <pascal.kriete@ellislab.com>2010-11-10 21:49:22 +0100
committerPascal Kriete <pascal.kriete@ellislab.com>2010-11-10 21:49:22 +0100
commit17eddc918607bff693d9e557ab83e77aa8ce295d (patch)
tree6105712c400cff20e9df9cbc3dd8b3c9100d53c1
parent89ace43fb4fdfb79cb885eaf671780d52fd61e3f (diff)
parent3791853fa72c53062fd72b249efc733b311b3a80 (diff)
Automated merge with http://hg.ellislab.com/CodeIgniterNoPhp4/
-rw-r--r--application/controllers/welcome.php6
-rw-r--r--system/core/Base4.php70
-rw-r--r--system/core/Base5.php57
-rw-r--r--system/core/CodeIgniter.php20
-rw-r--r--system/core/Compat.php99
-rw-r--r--system/core/Controller.php40
6 files changed, 21 insertions, 271 deletions
diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php
index 3c2f7e1cf..79689f012 100644
--- a/application/controllers/welcome.php
+++ b/application/controllers/welcome.php
@@ -1,10 +1,10 @@
-<?php
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
- function Welcome()
+ function __construct()
{
- parent::CI_Controller();
+ parent::__construct();
}
function index()
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 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
- * @link http://codeigniter.com
- * @since Version 1.3
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CI_BASE - For PHP 4
- *
- * This file is used only when CodeIgniter 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 of the Controller Base class. It's the only way we can
- * 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
- * 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 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
- * @link http://codeigniter.com
- * @since Version 1.3
- * @filesource
- */
-
-
-// ------------------------------------------------------------------------
-
-/**
- * CI_BASE - For PHP 5
- *
- * This file contains some code used only when CodeIgniter is being
- * run under PHP 5. It allows us to manage the CI super object more
- * gracefully than what is possible with PHP 4.
- * @PHP4 (no need for separate Bases after PHP 4 is gone)
- *
- * @package CodeIgniter
- * @subpackage codeigniter
- * @category front-controller
- * @author ExpressionEngine Dev Team
- * @link http://codeigniter.com/user_guide/
- */
-
-class CI_Base {
-
- private static $instance;
-
- public function CI_Base()
- {
- self::$instance =& $this;
- }
-
- public static function &get_instance()
- {
- return self::$instance;
- }
-}
-
-function &get_instance()
-{
- return CI_Base::get_instance();
-}
-
-
-
-/* End of file Base5.php */
-/* Location: ./system/core/Base5.php */ \ No newline at end of file
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index bf412b21d..c50ae6d2b 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -208,25 +208,15 @@
* Load the app controller and local controller
* ------------------------------------------------------
*
- * Note: Due to the poor object handling in PHP 4 we'll
- * conditionally load different versions of the base
- * class. Retaining PHP 4 compatibility requires a bit of a hack.
- * @PHP4
- *
*/
- if (is_php('5.0.0') == TRUE)
- {
- require(BASEPATH.'core/Base5'.EXT);
- }
- else
+ // Load the base controller class
+ require BASEPATH.'core/Controller'.EXT;
+
+ function &get_instance()
{
- // The Loader class needs to be included first when running PHP 4.x
- load_class('Loader', 'core');
- require(BASEPATH.'core/Base4'.EXT);
+ return CI_Controller::get_instance();
}
- // Load the base controller class
- require BASEPATH.'core/Controller'.EXT;
if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT))
{
diff --git a/system/core/Compat.php b/system/core/Compat.php
deleted file mode 100644
index bd11b9836..000000000
--- a/system/core/Compat.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
- * @link http://codeigniter.com
- * @since Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Compatibility Functions
- *
- * Function overrides for older versions of PHP or PHP environments missing
- * certain extensions / libraries
- *
- * @package CodeIgniter
- * @subpackage codeigniter
- * @category Compatibility Functions
- * @author ExpressionEngine Dev Team
- * @link http://codeigniter.com/user_guide/
- */
-
-// ------------------------------------------------------------------------
-
-/*
- * PHP versions prior to 5.0 don't support the E_STRICT constant
- * so we need to explicitly define it otherwise the Exception class
- * will generate errors when running under PHP 4
- * @PHP4
- *
- */
-if ( ! defined('E_STRICT'))
-{
- define('E_STRICT', 2048);
-}
-
-/**
- * ctype_digit()
- *
- * Determines if a string is comprised only of digits
- * http://us.php.net/manual/en/function.ctype_digit.php
- * @PHP4
- *
- * @access public
- * @param string
- * @return bool
- */
-if ( ! function_exists('ctype_digit'))
-{
- function ctype_digit($str)
- {
- if ( ! is_string($str) OR $str == '')
- {
- return FALSE;
- }
-
- return ! preg_match('/[^0-9]/', $str);
- }
-}
-
-// --------------------------------------------------------------------
-
-/**
- * ctype_alnum()
- *
- * Determines if a string is comprised of only alphanumeric characters
- * http://us.php.net/manual/en/function.ctype-alnum.php
- * @PHP4
- *
- * @access public
- * @param string
- * @return bool
- */
-if ( ! function_exists('ctype_alnum'))
-{
- function ctype_alnum($str)
- {
- if ( ! is_string($str) OR $str == '')
- {
- return FALSE;
- }
-
- return ! preg_match('/[^0-9a-z]/i', $str);
- }
-}
-
-// --------------------------------------------------------------------
-
-
-/* End of file Compat.php */
-/* Location: ./system/core/Compat.php */ \ No newline at end of file
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