blob: 2644f6eabc4f0973fdfdac4775837a28d2dd1701 [file] [log] [blame]
Derek Jones0b59f272008-05-13 04:22:33 +00001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allardd2df9bc2007-04-15 17:41:17 +00002/**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 4.3.2 or newer
6 *
7 * @package CodeIgniter
Derek Allard3d879d52008-01-18 19:41:32 +00008 * @author ExpressionEngine Dev Team
Derek Allardd2df9bc2007-04-15 17:41:17 +00009 * @copyright Copyright (c) 2006, EllisLab, Inc.
Derek Jones7a9193a2008-01-21 18:39:20 +000010 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
Derek Allardd2df9bc2007-04-15 17:41:17 +000012 * @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.
34 *
35 * @package CodeIgniter
36 * @subpackage codeigniter
37 * @category front-controller
Derek Allard3d879d52008-01-18 19:41:32 +000038 * @author ExpressionEngine Dev Team
Derek Jones7a9193a2008-01-21 18:39:20 +000039 * @link http://codeigniter.com/user_guide/
Derek Allardd2df9bc2007-04-15 17:41:17 +000040 */
41 class CI_Base extends CI_Loader {
42
43 function CI_Base()
44 {
45 // This allows syntax like $this->load->foo() to work
46 parent::CI_Loader();
47 $this->load =& $this;
48
49 // This allows resources used within controller constructors to work
50 global $OBJ;
51 $OBJ = $this->load; // Do NOT use a reference.
52 }
53}
54
55function &get_instance()
56{
57 global $CI, $OBJ;
58
59 if (is_object($CI))
60 {
61 return $CI;
62 }
63
64 return $OBJ->load;
65}
66
Derek Jones0b59f272008-05-13 04:22:33 +000067
68/* End of file Base4.php */
Derek Jonesa3ffbbb2008-05-11 18:18:29 +000069/* Location: ./system/codeigniter/Base4.php */