Base4.php

Go to the documentation of this file.
00001 <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
00002 /**
00003  * CodeIgniter
00004  *
00005  * An open source application development framework for PHP 4.3.2 or newer
00006  *
00007  * @package             CodeIgniter
00008  * @author              ExpressionEngine Dev Team
00009  * @copyright   Copyright (c) 2008, EllisLab, Inc.
00010  * @license             http://codeigniter.com/user_guide/license.html
00011  * @link                http://codeigniter.com
00012  * @since               Version 1.3
00013  * @filesource
00014  */
00015 
00016 // ------------------------------------------------------------------------
00017 
00018 /**
00019  * CI_BASE - For PHP 4
00020  *
00021  * This file is used only when CodeIgniter is being run under PHP 4.
00022  *
00023  * In order to allow CI to work under PHP 4 we had to make the Loader class
00024  * the parent of the Controller Base class.  It's the only way we can
00025  * enable functions like $this->load->library('email') to instantiate
00026  * classes that can then be used within controllers as $this->email->send()
00027  *
00028  * PHP 4 also has trouble referencing the CI super object within application
00029  * constructors since objects do not exist until the class is fully
00030  * instantiated.  Basically PHP 4 sucks...
00031  *
00032  * Since PHP 5 doesn't suffer from this problem so we load one of
00033  * two files based on the version of PHP being run.
00034  *
00035  * @package             CodeIgniter
00036  * @subpackage  codeigniter
00037  * @category    front-controller
00038  * @author              ExpressionEngine Dev Team
00039  * @link                http://codeigniter.com/user_guide/
00040  */
00041  class CI_Base extends CI_Loader {
00042 
00043         function CI_Base()
00044         {
00045                 // This allows syntax like $this->load->foo() to work
00046                 parent::CI_Loader();
00047                 $this->load =& $this;
00048                 
00049                 // This allows resources used within controller constructors to work
00050                 global $OBJ;
00051                 $OBJ = $this->load; // Do NOT use a reference.
00052         }
00053 }
00054 
00055 function &get_instance()
00056 {
00057         global $CI, $OBJ;
00058         
00059         if (is_object($CI))
00060         {
00061                 return $CI;
00062         }
00063         
00064         return $OBJ->load;
00065 }
00066 
00067 
00068 /* End of file Base4.php */
00069 /* Location: ./system/codeigniter/Base4.php */