Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
| 2 | /** |
| 3 | * CodeIgniter |
| 4 | * |
| 5 | * An open source application development framework for PHP 4.3.2 or newer |
| 6 | * |
| 7 | * @package CodeIgniter |
| 8 | * @author ExpressionEngine Dev Team |
Derek Jones | 7f3719f | 2010-01-05 13:35:37 +0000 | [diff] [blame] | 9 | * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc. |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 10 | * @license http://codeigniter.com/user_guide/license.html |
| 11 | * @link http://codeigniter.com |
| 12 | * @since Version 1.3 |
| 13 | * @filesource |
| 14 | */ |
| 15 | |
| 16 | // ------------------------------------------------------------------------ |
| 17 | |
| 18 | /** |
| 19 | * CI_BASE - For PHP 4 |
| 20 | * |
| 21 | * This file is used only when CodeIgniter is being run under PHP 4. |
| 22 | * |
| 23 | * In order to allow CI to work under PHP 4 we had to make the Loader class |
| 24 | * the parent of the Controller Base class. It's the only way we can |
| 25 | * enable functions like $this->load->library('email') to instantiate |
| 26 | * classes that can then be used within controllers as $this->email->send() |
| 27 | * |
| 28 | * PHP 4 also has trouble referencing the CI super object within application |
| 29 | * constructors since objects do not exist until the class is fully |
| 30 | * instantiated. Basically PHP 4 sucks... |
| 31 | * |
| 32 | * Since PHP 5 doesn't suffer from this problem so we load one of |
| 33 | * two files based on the version of PHP being run. |
Derek Jones | d7055aa | 2010-03-02 13:32:57 -0600 | [diff] [blame] | 34 | * @PHP4 |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame^] | 35 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 36 | * @package CodeIgniter |
| 37 | * @subpackage codeigniter |
| 38 | * @category front-controller |
| 39 | * @author ExpressionEngine Dev Team |
| 40 | * @link http://codeigniter.com/user_guide/ |
| 41 | */ |
| 42 | class CI_Base extends CI_Loader { |
| 43 | |
| 44 | function CI_Base() |
| 45 | { |
| 46 | // This allows syntax like $this->load->foo() to work |
| 47 | parent::CI_Loader(); |
| 48 | $this->load =& $this; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame^] | 49 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 50 | // This allows resources used within controller constructors to work |
| 51 | global $OBJ; |
| 52 | $OBJ = $this->load; // Do NOT use a reference. |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | function &get_instance() |
| 57 | { |
| 58 | global $CI, $OBJ; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame^] | 59 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 60 | if (is_object($CI)) |
| 61 | { |
| 62 | return $CI; |
| 63 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame^] | 64 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 65 | return $OBJ->load; |
| 66 | } |
| 67 | |
| 68 | |
| 69 | /* End of file Base4.php */ |
Derek Jones | c68dfbf | 2010-03-02 12:59:23 -0600 | [diff] [blame] | 70 | /* Location: ./system/core/Base4.php */ |