blob: 09e948714c558ae64ea1fbfcb940956b6891605e [file] [log] [blame]
Andrey Andreevd7297352012-01-07 22:53:14 +02001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +00002/**
3 * CodeIgniter
4 *
Phil Sturgeon07c1ac82012-03-09 17:03:37 +00005 * An open source application development framework for PHP 5.2.4 or newer
Derek Allard2067d1a2008-11-13 22:59:24 +00006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
Andrey Andreevd7297352012-01-07 22:53:14 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreevd7297352012-01-07 22:53:14 +020010 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -050011 * This source file is subject to the Open Software License (OSL 3.0) that is
12 * bundled with this package in the files license.txt / license.rst. It is
13 * also available through the world wide web at this URL:
14 * http://opensource.org/licenses/OSL-3.0
15 * If you did not receive a copy of the license and are unable to obtain it
16 * through the world wide web, please send an email to
17 * licensing@ellislab.com so we can send you a copy immediately.
18 *
Derek Allard2067d1a2008-11-13 22:59:24 +000019 * @package CodeIgniter
Derek Jonesf4a4bd82011-10-20 12:18:42 -050020 * @author EllisLab Dev Team
Greg Aker0defe5d2012-01-01 18:46:41 -060021 * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
Derek Jonesf4a4bd82011-10-20 12:18:42 -050022 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
Derek Allard2067d1a2008-11-13 22:59:24 +000023 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
27
Derek Allard2067d1a2008-11-13 22:59:24 +000028/**
29 * Loader Class
30 *
31 * Loads views and files
32 *
33 * @package CodeIgniter
34 * @subpackage Libraries
Derek Allard2067d1a2008-11-13 22:59:24 +000035 * @category Loader
Andrey Andreev92ebfb62012-05-17 12:49:24 +030036 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000037 * @link http://codeigniter.com/user_guide/libraries/loader.html
38 */
39class CI_Loader {
40
41 // All these are set automatically. Don't mess with them.
David Behlercda768a2011-08-14 23:52:48 +020042 /**
43 * Nesting level of the output buffering mechanism
44 *
45 * @var int
David Behlercda768a2011-08-14 23:52:48 +020046 */
Greg Aker0c9ee4a2011-04-20 09:40:17 -050047 protected $_ci_ob_level;
Andrey Andreev92ebfb62012-05-17 12:49:24 +030048
David Behlercda768a2011-08-14 23:52:48 +020049 /**
50 * List of paths to load views from
51 *
52 * @var array
David Behlercda768a2011-08-14 23:52:48 +020053 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -040054 protected $_ci_view_paths = array();
Andrey Andreev92ebfb62012-05-17 12:49:24 +030055
David Behlercda768a2011-08-14 23:52:48 +020056 /**
57 * List of paths to load libraries from
58 *
59 * @var array
David Behlercda768a2011-08-14 23:52:48 +020060 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -040061 protected $_ci_library_paths = array();
Andrey Andreev92ebfb62012-05-17 12:49:24 +030062
David Behlercda768a2011-08-14 23:52:48 +020063 /**
64 * List of paths to load models from
65 *
66 * @var array
David Behlercda768a2011-08-14 23:52:48 +020067 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -040068 protected $_ci_model_paths = array();
Andrey Andreev92ebfb62012-05-17 12:49:24 +030069
David Behlercda768a2011-08-14 23:52:48 +020070 /**
71 * List of paths to load helpers from
72 *
73 * @var array
David Behlercda768a2011-08-14 23:52:48 +020074 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -040075 protected $_ci_helper_paths = array();
Andrey Andreev92ebfb62012-05-17 12:49:24 +030076
David Behlercda768a2011-08-14 23:52:48 +020077 /**
78 * List of loaded base classes
David Behlercda768a2011-08-14 23:52:48 +020079 *
80 * @var array
David Behlercda768a2011-08-14 23:52:48 +020081 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -040082 protected $_base_classes = array(); // Set by the controller class
Andrey Andreev92ebfb62012-05-17 12:49:24 +030083
David Behlercda768a2011-08-14 23:52:48 +020084 /**
85 * List of cached variables
86 *
87 * @var array
David Behlercda768a2011-08-14 23:52:48 +020088 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -040089 protected $_ci_cached_vars = array();
Andrey Andreev92ebfb62012-05-17 12:49:24 +030090
David Behlercda768a2011-08-14 23:52:48 +020091 /**
92 * List of loaded classes
93 *
94 * @var array
David Behlercda768a2011-08-14 23:52:48 +020095 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -040096 protected $_ci_classes = array();
Andrey Andreev92ebfb62012-05-17 12:49:24 +030097
David Behlercda768a2011-08-14 23:52:48 +020098 /**
99 * List of loaded files
100 *
101 * @var array
David Behlercda768a2011-08-14 23:52:48 +0200102 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -0400103 protected $_ci_loaded_files = array();
Andrey Andreev92ebfb62012-05-17 12:49:24 +0300104
David Behlercda768a2011-08-14 23:52:48 +0200105 /**
106 * List of loaded models
107 *
108 * @var array
David Behlercda768a2011-08-14 23:52:48 +0200109 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -0400110 protected $_ci_models = array();
Andrey Andreev92ebfb62012-05-17 12:49:24 +0300111
David Behlercda768a2011-08-14 23:52:48 +0200112 /**
113 * List of loaded helpers
114 *
115 * @var array
David Behlercda768a2011-08-14 23:52:48 +0200116 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -0400117 protected $_ci_helpers = array();
Andrey Andreev92ebfb62012-05-17 12:49:24 +0300118
David Behlercda768a2011-08-14 23:52:48 +0200119 /**
120 * List of class name mappings
121 *
122 * @var array
David Behlercda768a2011-08-14 23:52:48 +0200123 */
Timothy Warren48a7fbb2012-04-23 11:58:16 -0400124 protected $_ci_varmap = array(
Timothy Warren40403d22012-04-19 16:38:50 -0400125 'unit_test' => 'unit',
126 'user_agent' => 'agent'
127 );
Derek Allard2067d1a2008-11-13 22:59:24 +0000128
129 /**
130 * Constructor
131 *
132 * Sets the path to the view files and gets the initial output buffering level
Andrey Andreev92ebfb62012-05-17 12:49:24 +0300133 *
134 * @return void
Derek Allard2067d1a2008-11-13 22:59:24 +0000135 */
Greg Akerf5c84022011-04-19 17:13:03 -0500136 public function __construct()
Barry Mienydd671972010-10-04 16:33:58 +0200137 {
Derek Jones37f4b9c2011-07-01 17:56:50 -0500138 $this->_ci_ob_level = ob_get_level();
Derek Jones32bf1862010-03-02 13:46:07 -0600139 $this->_ci_library_paths = array(APPPATH, BASEPATH);
140 $this->_ci_helper_paths = array(APPPATH, BASEPATH);
141 $this->_ci_model_paths = array(APPPATH);
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400142 $this->_ci_view_paths = array(VIEWPATH => TRUE);
David Behlercda768a2011-08-14 23:52:48 +0200143
Andrey Andreevd7297352012-01-07 22:53:14 +0200144 log_message('debug', 'Loader Class Initialized');
Derek Allard2067d1a2008-11-13 22:59:24 +0000145 }
Barry Mienydd671972010-10-04 16:33:58 +0200146
Derek Allard2067d1a2008-11-13 22:59:24 +0000147 // --------------------------------------------------------------------
David Behlercda768a2011-08-14 23:52:48 +0200148
Greg Aker0c9ee4a2011-04-20 09:40:17 -0500149 /**
Shane Pearson6adfe632011-08-10 16:42:53 -0500150 * Initialize the Loader
Greg Aker0c9ee4a2011-04-20 09:40:17 -0500151 *
152 * This method is called once in CI_Controller.
153 *
Greg Aker0c9ee4a2011-04-20 09:40:17 -0500154 * @return object
155 */
Shane Pearson6adfe632011-08-10 16:42:53 -0500156 public function initialize()
Greg Aker0c9ee4a2011-04-20 09:40:17 -0500157 {
Shane Pearson6adfe632011-08-10 16:42:53 -0500158 $this->_ci_classes = array();
159 $this->_ci_loaded_files = array();
160 $this->_ci_models = array();
Greg Aker0c9ee4a2011-04-20 09:40:17 -0500161 $this->_base_classes =& is_loaded();
Shane Pearson6adfe632011-08-10 16:42:53 -0500162
163 $this->_ci_autoloader();
Greg Aker0c9ee4a2011-04-20 09:40:17 -0500164 return $this;
165 }
166
167 // --------------------------------------------------------------------
168
169 /**
170 * Is Loaded
171 *
172 * A utility function to test if a class is in the self::$_ci_classes array.
173 * This function returns the object name if the class tested for is loaded,
174 * and returns FALSE if it isn't.
175 *
176 * It is mainly used in the form_helper -> _get_validation_object()
177 *
178 * @param string class being checked for
179 * @return mixed class object name on the CI SuperObject or FALSE
180 */
181 public function is_loaded($class)
182 {
Andrey Andreev92ebfb62012-05-17 12:49:24 +0300183 return isset($this->_ci_classes[$class]) ? $this->_ci_classes[$class] : FALSE;
Greg Aker0c9ee4a2011-04-20 09:40:17 -0500184 }
185
186 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200187
Derek Allard2067d1a2008-11-13 22:59:24 +0000188 /**
189 * Class Loader
190 *
191 * This function lets users load and instantiate classes.
192 * It is designed to be called from a user's app controllers.
193 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000194 * @param string the name of the class
195 * @param mixed the optional parameters
196 * @param string an optional object name
197 * @return void
Barry Mienydd671972010-10-04 16:33:58 +0200198 */
Greg Aker0c9ee4a2011-04-20 09:40:17 -0500199 public function library($library = '', $params = NULL, $object_name = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000200 {
Greg Akerce433962010-10-12 09:29:35 -0500201 if (is_array($library))
202 {
Phil Sturgeon08b51692011-04-03 18:05:42 +0100203 foreach ($library as $class)
Greg Akerce433962010-10-12 09:29:35 -0500204 {
Kellas Reeves3c6e4852011-02-09 11:57:56 -0600205 $this->library($class, $params);
Greg Akerce433962010-10-12 09:29:35 -0500206 }
Phil Sturgeonde3dbc32010-12-27 17:41:02 +0000207
Greg Akerce433962010-10-12 09:29:35 -0500208 return;
209 }
Phil Sturgeonde3dbc32010-12-27 17:41:02 +0000210
Alex Bilbieed944a32012-06-02 11:07:47 +0100211 if ($library === '' OR isset($this->_base_classes[$library]))
Derek Allard2067d1a2008-11-13 22:59:24 +0000212 {
213 return FALSE;
214 }
215
Derek Jones32bf1862010-03-02 13:46:07 -0600216 if ( ! is_null($params) && ! is_array($params))
Derek Allard2067d1a2008-11-13 22:59:24 +0000217 {
218 $params = NULL;
219 }
220
Kellas Reeves3c6e4852011-02-09 11:57:56 -0600221 $this->_ci_load_class($library, $params, $object_name);
Derek Allard2067d1a2008-11-13 22:59:24 +0000222 }
223
224 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200225
Derek Allard2067d1a2008-11-13 22:59:24 +0000226 /**
227 * Model Loader
228 *
229 * This function lets users load and instantiate models.
230 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000231 * @param string the name of the class
232 * @param string name for the model
233 * @param bool database connection
234 * @return void
Barry Mienydd671972010-10-04 16:33:58 +0200235 */
Greg Akerf5c84022011-04-19 17:13:03 -0500236 public function model($model, $name = '', $db_conn = FALSE)
Barry Mienydd671972010-10-04 16:33:58 +0200237 {
Derek Allard2067d1a2008-11-13 22:59:24 +0000238 if (is_array($model))
239 {
Pascal Kriete5d5895f2011-02-14 13:27:07 -0500240 foreach ($model as $babe)
Derek Allard2067d1a2008-11-13 22:59:24 +0000241 {
Barry Mienydd671972010-10-04 16:33:58 +0200242 $this->model($babe);
Derek Allard2067d1a2008-11-13 22:59:24 +0000243 }
244 return;
245 }
246
Alex Bilbieed944a32012-06-02 11:07:47 +0100247 if ($model === '')
Derek Allard2067d1a2008-11-13 22:59:24 +0000248 {
249 return;
250 }
Barry Mienydd671972010-10-04 16:33:58 +0200251
Derek Jones32bf1862010-03-02 13:46:07 -0600252 $path = '';
Barry Mienydd671972010-10-04 16:33:58 +0200253
Derek Allard2067d1a2008-11-13 22:59:24 +0000254 // Is the model in a sub-folder? If so, parse out the filename and path.
Derek Jones32bf1862010-03-02 13:46:07 -0600255 if (($last_slash = strrpos($model, '/')) !== FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000256 {
Derek Jones32bf1862010-03-02 13:46:07 -0600257 // The path is in front of the last slash
Andrey Andreevd47baab2012-01-09 16:56:46 +0200258 $path = substr($model, 0, ++$last_slash);
Derek Jones32bf1862010-03-02 13:46:07 -0600259
260 // And the model name behind it
Andrey Andreevd47baab2012-01-09 16:56:46 +0200261 $model = substr($model, $last_slash);
Derek Allard2067d1a2008-11-13 22:59:24 +0000262 }
Barry Mienydd671972010-10-04 16:33:58 +0200263
Phil Sturgeon10d78f62012-06-04 14:41:53 -0500264 if (empty($name))
Derek Allard2067d1a2008-11-13 22:59:24 +0000265 {
266 $name = $model;
267 }
Barry Mienydd671972010-10-04 16:33:58 +0200268
Derek Allard2067d1a2008-11-13 22:59:24 +0000269 if (in_array($name, $this->_ci_models, TRUE))
270 {
271 return;
272 }
Barry Mienydd671972010-10-04 16:33:58 +0200273
Derek Allard2067d1a2008-11-13 22:59:24 +0000274 $CI =& get_instance();
275 if (isset($CI->$name))
276 {
277 show_error('The model name you are loading is the name of a resource that is already being used: '.$name);
278 }
Barry Mienydd671972010-10-04 16:33:58 +0200279
Derek Allard2067d1a2008-11-13 22:59:24 +0000280 $model = strtolower($model);
Derek Allard2067d1a2008-11-13 22:59:24 +0000281
Derek Jones32bf1862010-03-02 13:46:07 -0600282 foreach ($this->_ci_model_paths as $mod_path)
283 {
Greg Aker3a746652011-04-19 10:59:47 -0500284 if ( ! file_exists($mod_path.'models/'.$path.$model.'.php'))
Derek Jones32bf1862010-03-02 13:46:07 -0600285 {
286 continue;
287 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000288
Andrey Andreev94af3552012-03-26 23:10:42 +0300289 if ($db_conn !== FALSE && ! class_exists('CI_DB'))
Derek Jones32bf1862010-03-02 13:46:07 -0600290 {
291 if ($db_conn === TRUE)
Pascal Kriete287781e2010-11-10 15:43:49 -0500292 {
Derek Jones32bf1862010-03-02 13:46:07 -0600293 $db_conn = '';
Pascal Kriete287781e2010-11-10 15:43:49 -0500294 }
Derek Jones32bf1862010-03-02 13:46:07 -0600295
296 $CI->load->database($db_conn, FALSE, TRUE);
297 }
298
Greg Akerbce13482010-10-11 15:37:16 -0500299 if ( ! class_exists('CI_Model'))
Derek Jones32bf1862010-03-02 13:46:07 -0600300 {
301 load_class('Model', 'core');
302 }
303
Greg Aker3a746652011-04-19 10:59:47 -0500304 require_once($mod_path.'models/'.$path.$model.'.php');
Derek Jones32bf1862010-03-02 13:46:07 -0600305
306 $model = ucfirst($model);
Derek Jones32bf1862010-03-02 13:46:07 -0600307 $CI->$name = new $model();
Derek Jones32bf1862010-03-02 13:46:07 -0600308 $this->_ci_models[] = $name;
309 return;
310 }
Barry Mienydd671972010-10-04 16:33:58 +0200311
Derek Jones32bf1862010-03-02 13:46:07 -0600312 // couldn't find the model
313 show_error('Unable to locate the model you have specified: '.$model);
Derek Allard2067d1a2008-11-13 22:59:24 +0000314 }
Barry Mienydd671972010-10-04 16:33:58 +0200315
Derek Allard2067d1a2008-11-13 22:59:24 +0000316 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200317
Derek Allard2067d1a2008-11-13 22:59:24 +0000318 /**
319 * Database Loader
320 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000321 * @param string the DB credentials
322 * @param bool whether to return the DB object
Jamie Rumbelow7efad202012-02-19 12:37:00 +0000323 * @param bool whether to enable query builder (this allows us to override the config setting)
Derek Allard2067d1a2008-11-13 22:59:24 +0000324 * @return object
Barry Mienydd671972010-10-04 16:33:58 +0200325 */
Jamie Rumbelow7efad202012-02-19 12:37:00 +0000326 public function database($params = '', $return = FALSE, $query_builder = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000327 {
328 // Grab the super object
329 $CI =& get_instance();
Barry Mienydd671972010-10-04 16:33:58 +0200330
Derek Allard2067d1a2008-11-13 22:59:24 +0000331 // Do we even need to load the database class?
Alex Bilbieed944a32012-06-02 11:07:47 +0100332 if (class_exists('CI_DB') && $return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db))
Derek Allard2067d1a2008-11-13 22:59:24 +0000333 {
334 return FALSE;
Barry Mienydd671972010-10-04 16:33:58 +0200335 }
336
Greg Aker3a746652011-04-19 10:59:47 -0500337 require_once(BASEPATH.'database/DB.php');
Derek Allard2067d1a2008-11-13 22:59:24 +0000338
339 if ($return === TRUE)
340 {
Jamie Rumbelow7efad202012-02-19 12:37:00 +0000341 return DB($params, $query_builder);
Derek Allard2067d1a2008-11-13 22:59:24 +0000342 }
Barry Mienydd671972010-10-04 16:33:58 +0200343
Andrey Andreevd7297352012-01-07 22:53:14 +0200344 // Initialize the db variable. Needed to prevent
Derek Allard2067d1a2008-11-13 22:59:24 +0000345 // reference errors with some configurations
346 $CI->db = '';
Barry Mienydd671972010-10-04 16:33:58 +0200347
Derek Allard2067d1a2008-11-13 22:59:24 +0000348 // Load the DB class
Jamie Rumbelow7efad202012-02-19 12:37:00 +0000349 $CI->db =& DB($params, $query_builder);
Derek Allard2067d1a2008-11-13 22:59:24 +0000350 }
Barry Mienydd671972010-10-04 16:33:58 +0200351
Derek Allard2067d1a2008-11-13 22:59:24 +0000352 // --------------------------------------------------------------------
353
354 /**
355 * Load the Utilities Class
356 *
Barry Mienydd671972010-10-04 16:33:58 +0200357 * @return string
358 */
Greg Akerf5c84022011-04-19 17:13:03 -0500359 public function dbutil()
Derek Allard2067d1a2008-11-13 22:59:24 +0000360 {
361 if ( ! class_exists('CI_DB'))
362 {
363 $this->database();
364 }
Barry Mienydd671972010-10-04 16:33:58 +0200365
Derek Allard2067d1a2008-11-13 22:59:24 +0000366 $CI =& get_instance();
367
368 // for backwards compatibility, load dbforge so we can extend dbutils off it
369 // this use is deprecated and strongly discouraged
370 $CI->load->dbforge();
Barry Mienydd671972010-10-04 16:33:58 +0200371
Greg Aker3a746652011-04-19 10:59:47 -0500372 require_once(BASEPATH.'database/DB_utility.php');
373 require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_utility.php');
Derek Allard2067d1a2008-11-13 22:59:24 +0000374 $class = 'CI_DB_'.$CI->db->dbdriver.'_utility';
375
Pascal Kriete58560022010-11-10 16:01:20 -0500376 $CI->dbutil = new $class();
Derek Allard2067d1a2008-11-13 22:59:24 +0000377 }
Barry Mienydd671972010-10-04 16:33:58 +0200378
Derek Allard2067d1a2008-11-13 22:59:24 +0000379 // --------------------------------------------------------------------
380
381 /**
382 * Load the Database Forge Class
383 *
Barry Mienydd671972010-10-04 16:33:58 +0200384 * @return string
385 */
Greg Akerf5c84022011-04-19 17:13:03 -0500386 public function dbforge()
Derek Allard2067d1a2008-11-13 22:59:24 +0000387 {
388 if ( ! class_exists('CI_DB'))
389 {
390 $this->database();
391 }
Barry Mienydd671972010-10-04 16:33:58 +0200392
Derek Allard2067d1a2008-11-13 22:59:24 +0000393 $CI =& get_instance();
Barry Mienydd671972010-10-04 16:33:58 +0200394
Greg Aker3a746652011-04-19 10:59:47 -0500395 require_once(BASEPATH.'database/DB_forge.php');
396 require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_forge.php');
Derek Allard2067d1a2008-11-13 22:59:24 +0000397 $class = 'CI_DB_'.$CI->db->dbdriver.'_forge';
398
399 $CI->dbforge = new $class();
Derek Allard2067d1a2008-11-13 22:59:24 +0000400 }
Barry Mienydd671972010-10-04 16:33:58 +0200401
Derek Allard2067d1a2008-11-13 22:59:24 +0000402 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200403
Derek Allard2067d1a2008-11-13 22:59:24 +0000404 /**
405 * Load View
406 *
Andrey Andreev94af3552012-03-26 23:10:42 +0300407 * This function is used to load a "view" file. It has three parameters:
Derek Allard2067d1a2008-11-13 22:59:24 +0000408 *
409 * 1. The name of the "view" file to be included.
410 * 2. An associative array of data to be extracted for use in the view.
Andrey Andreev94af3552012-03-26 23:10:42 +0300411 * 3. TRUE/FALSE - whether to return the data or load it. In
412 * some cases it's advantageous to be able to return data so that
413 * a developer can process it in some way.
Derek Allard2067d1a2008-11-13 22:59:24 +0000414 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000415 * @param string
416 * @param array
417 * @param bool
418 * @return void
419 */
Greg Akerf5c84022011-04-19 17:13:03 -0500420 public function view($view, $vars = array(), $return = FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000421 {
422 return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
423 }
Barry Mienydd671972010-10-04 16:33:58 +0200424
Derek Allard2067d1a2008-11-13 22:59:24 +0000425 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200426
Derek Allard2067d1a2008-11-13 22:59:24 +0000427 /**
428 * Load File
429 *
430 * This is a generic file loader
431 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000432 * @param string
433 * @param bool
434 * @return string
435 */
Greg Akerf5c84022011-04-19 17:13:03 -0500436 public function file($path, $return = FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000437 {
438 return $this->_ci_load(array('_ci_path' => $path, '_ci_return' => $return));
439 }
Barry Mienydd671972010-10-04 16:33:58 +0200440
Derek Allard2067d1a2008-11-13 22:59:24 +0000441 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200442
Derek Allard2067d1a2008-11-13 22:59:24 +0000443 /**
444 * Set Variables
445 *
446 * Once variables are set they become available within
447 * the controller class and its "view" files.
448 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000449 * @param array
David Behlercda768a2011-08-14 23:52:48 +0200450 * @param string
Derek Allard2067d1a2008-11-13 22:59:24 +0000451 * @return void
452 */
Greg Akerf5c84022011-04-19 17:13:03 -0500453 public function vars($vars = array(), $val = '')
Derek Allard2067d1a2008-11-13 22:59:24 +0000454 {
Alex Bilbieed944a32012-06-02 11:07:47 +0100455 if ($val !== '' && is_string($vars))
Derek Allard2067d1a2008-11-13 22:59:24 +0000456 {
457 $vars = array($vars => $val);
458 }
Barry Mienydd671972010-10-04 16:33:58 +0200459
Derek Allard2067d1a2008-11-13 22:59:24 +0000460 $vars = $this->_ci_object_to_array($vars);
Barry Mienydd671972010-10-04 16:33:58 +0200461
Andrey Andreev94af3552012-03-26 23:10:42 +0300462 if (is_array($vars) && count($vars) > 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000463 {
464 foreach ($vars as $key => $val)
465 {
466 $this->_ci_cached_vars[$key] = $val;
467 }
468 }
469 }
Barry Mienydd671972010-10-04 16:33:58 +0200470
Derek Allard2067d1a2008-11-13 22:59:24 +0000471 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200472
Derek Allard2067d1a2008-11-13 22:59:24 +0000473 /**
Phil Sturgeon8731f642011-07-22 16:11:34 -0600474 * Get Variable
475 *
476 * Check if a variable is set and retrieve it.
477 *
478 * @param array
479 * @return void
480 */
481 public function get_var($key)
482 {
483 return isset($this->_ci_cached_vars[$key]) ? $this->_ci_cached_vars[$key] : NULL;
484 }
485
486 // --------------------------------------------------------------------
487
488 /**
Shane Pearson81dd2232011-11-18 20:49:35 -0600489 * Get Variables
490 *
491 * Retrieve all loaded variables
492 *
493 * @return array
494 */
495 public function get_vars()
496 {
497 return $this->_ci_cached_vars;
498 }
499
500 // --------------------------------------------------------------------
501
502 /**
Derek Allard2067d1a2008-11-13 22:59:24 +0000503 * Load Helper
504 *
505 * This function loads the specified helper file.
506 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000507 * @param mixed
508 * @return void
509 */
Greg Akerf5c84022011-04-19 17:13:03 -0500510 public function helper($helpers = array())
Barry Mienydd671972010-10-04 16:33:58 +0200511 {
Derek Jones32bf1862010-03-02 13:46:07 -0600512 foreach ($this->_ci_prep_filename($helpers, '_helper') as $helper)
Barry Mienydd671972010-10-04 16:33:58 +0200513 {
Derek Allard2067d1a2008-11-13 22:59:24 +0000514 if (isset($this->_ci_helpers[$helper]))
515 {
516 continue;
517 }
Derek Jones32bf1862010-03-02 13:46:07 -0600518
Greg Aker3a746652011-04-19 10:59:47 -0500519 $ext_helper = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.'.php';
Derek Allard2067d1a2008-11-13 22:59:24 +0000520
Barry Mienydd671972010-10-04 16:33:58 +0200521 // Is this a helper extension request?
Derek Allard2067d1a2008-11-13 22:59:24 +0000522 if (file_exists($ext_helper))
523 {
Greg Aker3a746652011-04-19 10:59:47 -0500524 $base_helper = BASEPATH.'helpers/'.$helper.'.php';
Barry Mienydd671972010-10-04 16:33:58 +0200525
Derek Allard2067d1a2008-11-13 22:59:24 +0000526 if ( ! file_exists($base_helper))
527 {
Greg Aker3a746652011-04-19 10:59:47 -0500528 show_error('Unable to load the requested file: helpers/'.$helper.'.php');
Derek Allard2067d1a2008-11-13 22:59:24 +0000529 }
Barry Mienydd671972010-10-04 16:33:58 +0200530
Derek Allard2067d1a2008-11-13 22:59:24 +0000531 include_once($ext_helper);
532 include_once($base_helper);
Barry Mienydd671972010-10-04 16:33:58 +0200533
Derek Jones32bf1862010-03-02 13:46:07 -0600534 $this->_ci_helpers[$helper] = TRUE;
535 log_message('debug', 'Helper loaded: '.$helper);
536 continue;
Derek Allard2067d1a2008-11-13 22:59:24 +0000537 }
Barry Mienydd671972010-10-04 16:33:58 +0200538
Derek Jones32bf1862010-03-02 13:46:07 -0600539 // Try to load the helper
540 foreach ($this->_ci_helper_paths as $path)
541 {
Greg Aker3a746652011-04-19 10:59:47 -0500542 if (file_exists($path.'helpers/'.$helper.'.php'))
Barry Mienydd671972010-10-04 16:33:58 +0200543 {
Greg Aker3a746652011-04-19 10:59:47 -0500544 include_once($path.'helpers/'.$helper.'.php');
Derek Jones32bf1862010-03-02 13:46:07 -0600545
546 $this->_ci_helpers[$helper] = TRUE;
Barry Mienydd671972010-10-04 16:33:58 +0200547 log_message('debug', 'Helper loaded: '.$helper);
Derek Jones32bf1862010-03-02 13:46:07 -0600548 break;
Derek Allard2067d1a2008-11-13 22:59:24 +0000549 }
550 }
551
Derek Jones32bf1862010-03-02 13:46:07 -0600552 // unable to load the helper
553 if ( ! isset($this->_ci_helpers[$helper]))
554 {
Greg Aker3a746652011-04-19 10:59:47 -0500555 show_error('Unable to load the requested file: helpers/'.$helper.'.php');
Derek Jones32bf1862010-03-02 13:46:07 -0600556 }
Barry Mienydd671972010-10-04 16:33:58 +0200557 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000558 }
Barry Mienydd671972010-10-04 16:33:58 +0200559
Derek Allard2067d1a2008-11-13 22:59:24 +0000560 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200561
Derek Allard2067d1a2008-11-13 22:59:24 +0000562 /**
563 * Load Helpers
564 *
565 * This is simply an alias to the above function in case the
566 * user has written the plural form of this function.
567 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000568 * @param array
569 * @return void
570 */
Greg Akerf5c84022011-04-19 17:13:03 -0500571 public function helpers($helpers = array())
Derek Allard2067d1a2008-11-13 22:59:24 +0000572 {
573 $this->helper($helpers);
574 }
Barry Mienydd671972010-10-04 16:33:58 +0200575
Derek Allard2067d1a2008-11-13 22:59:24 +0000576 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200577
Derek Allard2067d1a2008-11-13 22:59:24 +0000578 /**
Derek Allard2067d1a2008-11-13 22:59:24 +0000579 * Loads a language file
580 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000581 * @param array
582 * @param string
583 * @return void
584 */
Greg Akerf5c84022011-04-19 17:13:03 -0500585 public function language($file = array(), $lang = '')
Derek Allard2067d1a2008-11-13 22:59:24 +0000586 {
587 $CI =& get_instance();
588
589 if ( ! is_array($file))
590 {
591 $file = array($file);
592 }
593
594 foreach ($file as $langfile)
Barry Mienydd671972010-10-04 16:33:58 +0200595 {
Derek Allard2067d1a2008-11-13 22:59:24 +0000596 $CI->lang->load($langfile, $lang);
597 }
598 }
Barry Mienydd671972010-10-04 16:33:58 +0200599
Derek Allard2067d1a2008-11-13 22:59:24 +0000600 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200601
Derek Allard2067d1a2008-11-13 22:59:24 +0000602 /**
603 * Loads a config file
604 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000605 * @param string
David Behlercda768a2011-08-14 23:52:48 +0200606 * @param bool
607 * @param bool
Derek Allard2067d1a2008-11-13 22:59:24 +0000608 * @return void
609 */
Greg Akerf5c84022011-04-19 17:13:03 -0500610 public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
Barry Mienydd671972010-10-04 16:33:58 +0200611 {
Derek Allard2067d1a2008-11-13 22:59:24 +0000612 $CI =& get_instance();
613 $CI->config->load($file, $use_sections, $fail_gracefully);
614 }
615
616 // --------------------------------------------------------------------
Derek Jones32bf1862010-03-02 13:46:07 -0600617
Derek Allard2067d1a2008-11-13 22:59:24 +0000618 /**
Derek Jones8dca0412010-03-05 13:01:44 -0600619 * Driver
620 *
621 * Loads a driver library
622 *
Christopher Guiney9929d6f2012-03-09 19:53:24 -0800623 * @param mixed the name of the class or array of classes
Derek Jones8dca0412010-03-05 13:01:44 -0600624 * @param mixed the optional parameters
625 * @param string an optional object name
626 * @return void
627 */
Greg Akerf5c84022011-04-19 17:13:03 -0500628 public function driver($library = '', $params = NULL, $object_name = NULL)
Derek Jones8dca0412010-03-05 13:01:44 -0600629 {
Christopher Guineyb54d3552012-03-10 08:38:10 -0800630 if (is_array($library))
Christopher Guiney9929d6f2012-03-09 19:53:24 -0800631 {
Christopher Guineyb54d3552012-03-10 08:38:10 -0800632 foreach ($library as $driver)
Christopher Guiney9929d6f2012-03-09 19:53:24 -0800633 {
634 $this->driver($driver);
635 }
636 return FALSE;
637 }
638
Derek Jones8dca0412010-03-05 13:01:44 -0600639 if ( ! class_exists('CI_Driver_Library'))
640 {
641 // we aren't instantiating an object here, that'll be done by the Library itself
Greg Aker3a746652011-04-19 10:59:47 -0500642 require BASEPATH.'libraries/Driver.php';
Derek Jonesd5e0cb52010-03-09 20:20:46 -0600643 }
Barry Mienydd671972010-10-04 16:33:58 +0200644
Alex Bilbieed944a32012-06-02 11:07:47 +0100645 if ($library === '')
Tom Klingenberg6a15b2d2011-10-07 20:03:30 +0200646 {
647 return FALSE;
648 }
649
Derek Jonesd5e0cb52010-03-09 20:20:46 -0600650 // We can save the loader some time since Drivers will *always* be in a subfolder,
651 // and typically identically named to the library
652 if ( ! strpos($library, '/'))
653 {
Greg Akerd25e66a2010-03-28 01:07:09 -0500654 $library = ucfirst($library).'/'.$library;
Derek Jones8dca0412010-03-05 13:01:44 -0600655 }
Barry Mienydd671972010-10-04 16:33:58 +0200656
Derek Jones8dca0412010-03-05 13:01:44 -0600657 return $this->library($library, $params, $object_name);
658 }
659
660 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200661
Derek Jones8dca0412010-03-05 13:01:44 -0600662 /**
Derek Jones32bf1862010-03-02 13:46:07 -0600663 * Add Package Path
Derek Allard2067d1a2008-11-13 22:59:24 +0000664 *
Derek Jones32bf1862010-03-02 13:46:07 -0600665 * Prepends a parent path to the library, model, helper, and config path arrays
Derek Allard2067d1a2008-11-13 22:59:24 +0000666 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000667 * @param string
Andrey Andreev94af3552012-03-26 23:10:42 +0300668 * @param bool
Derek Allard2067d1a2008-11-13 22:59:24 +0000669 * @return void
Derek Jones32bf1862010-03-02 13:46:07 -0600670 */
Greg Akerf5c84022011-04-19 17:13:03 -0500671 public function add_package_path($path, $view_cascade=TRUE)
Derek Jones32bf1862010-03-02 13:46:07 -0600672 {
Pascal Kriete6b6c2742010-11-09 13:12:22 -0500673 $path = rtrim($path, '/').'/';
David Behlercda768a2011-08-14 23:52:48 +0200674
Derek Jones32bf1862010-03-02 13:46:07 -0600675 array_unshift($this->_ci_library_paths, $path);
676 array_unshift($this->_ci_model_paths, $path);
677 array_unshift($this->_ci_helper_paths, $path);
Barry Mienydd671972010-10-04 16:33:58 +0200678
Greg Akerf5c84022011-04-19 17:13:03 -0500679 $this->_ci_view_paths = array($path.'views/' => $view_cascade) + $this->_ci_view_paths;
680
Derek Jones32bf1862010-03-02 13:46:07 -0600681 // Add config file path
682 $config =& $this->_ci_get_component('config');
Korri3684d342012-04-17 00:35:08 -0400683 array_push($config->_config_paths, $path);
Derek Allard2067d1a2008-11-13 22:59:24 +0000684 }
685
686 // --------------------------------------------------------------------
Derek Jones32bf1862010-03-02 13:46:07 -0600687
688 /**
Phil Sturgeonde3dbc32010-12-27 17:41:02 +0000689 * Get Package Paths
690 *
691 * Return a list of all package paths, by default it will ignore BASEPATH.
692 *
Phil Sturgeonde3dbc32010-12-27 17:41:02 +0000693 * @param string
694 * @return void
695 */
Greg Akerf5c84022011-04-19 17:13:03 -0500696 public function get_package_paths($include_base = FALSE)
Phil Sturgeonde3dbc32010-12-27 17:41:02 +0000697 {
698 return $include_base === TRUE ? $this->_ci_library_paths : $this->_ci_model_paths;
699 }
700
701 // --------------------------------------------------------------------
702
703 /**
Derek Jones32bf1862010-03-02 13:46:07 -0600704 * Remove Package Path
705 *
706 * Remove a path from the library, model, and helper path arrays if it exists
707 * If no path is provided, the most recently added path is removed.
708 *
Andrey Andreev94af3552012-03-26 23:10:42 +0300709 * @param string
David Behlercda768a2011-08-14 23:52:48 +0200710 * @param bool
Andrey Andreev94af3552012-03-26 23:10:42 +0300711 * @return void
Derek Jones32bf1862010-03-02 13:46:07 -0600712 */
Greg Akerf5c84022011-04-19 17:13:03 -0500713 public function remove_package_path($path = '', $remove_config_path = TRUE)
Derek Jones32bf1862010-03-02 13:46:07 -0600714 {
715 $config =& $this->_ci_get_component('config');
Barry Mienydd671972010-10-04 16:33:58 +0200716
Alex Bilbieed944a32012-06-02 11:07:47 +0100717 if ($path === '')
Derek Jones32bf1862010-03-02 13:46:07 -0600718 {
Andrey Andreevd7297352012-01-07 22:53:14 +0200719 array_shift($this->_ci_library_paths);
720 array_shift($this->_ci_model_paths);
721 array_shift($this->_ci_helper_paths);
722 array_shift($this->_ci_view_paths);
Korri3684d342012-04-17 00:35:08 -0400723 array_pop($config->_config_paths);
Derek Jones32bf1862010-03-02 13:46:07 -0600724 }
725 else
726 {
Pascal Kriete6b6c2742010-11-09 13:12:22 -0500727 $path = rtrim($path, '/').'/';
Derek Jones32bf1862010-03-02 13:46:07 -0600728 foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var)
729 {
730 if (($key = array_search($path, $this->{$var})) !== FALSE)
731 {
732 unset($this->{$var}[$key]);
733 }
734 }
David Behlercda768a2011-08-14 23:52:48 +0200735
Greg Akerf5c84022011-04-19 17:13:03 -0500736 if (isset($this->_ci_view_paths[$path.'views/']))
737 {
738 unset($this->_ci_view_paths[$path.'views/']);
739 }
Barry Mienydd671972010-10-04 16:33:58 +0200740
Derek Jones32bf1862010-03-02 13:46:07 -0600741 if (($key = array_search($path, $config->_config_paths)) !== FALSE)
742 {
743 unset($config->_config_paths[$key]);
744 }
745 }
Barry Mienydd671972010-10-04 16:33:58 +0200746
Derek Jones32bf1862010-03-02 13:46:07 -0600747 // make sure the application default paths are still in the array
748 $this->_ci_library_paths = array_unique(array_merge($this->_ci_library_paths, array(APPPATH, BASEPATH)));
749 $this->_ci_helper_paths = array_unique(array_merge($this->_ci_helper_paths, array(APPPATH, BASEPATH)));
750 $this->_ci_model_paths = array_unique(array_merge($this->_ci_model_paths, array(APPPATH)));
Greg Akerf5c84022011-04-19 17:13:03 -0500751 $this->_ci_view_paths = array_merge($this->_ci_view_paths, array(APPPATH.'views/' => TRUE));
Derek Jones32bf1862010-03-02 13:46:07 -0600752 $config->_config_paths = array_unique(array_merge($config->_config_paths, array(APPPATH)));
753 }
754
755 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200756
Derek Allard2067d1a2008-11-13 22:59:24 +0000757 /**
758 * Loader
759 *
760 * This function is used to load views and files.
761 * Variables are prefixed with _ci_ to avoid symbol collision with
762 * variables made available to view files
763 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000764 * @param array
765 * @return void
766 */
Greg Akerf5c84022011-04-19 17:13:03 -0500767 protected function _ci_load($_ci_data)
Derek Allard2067d1a2008-11-13 22:59:24 +0000768 {
769 // Set the default data variables
770 foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val)
771 {
Andrey Andreev94af3552012-03-26 23:10:42 +0300772 $$_ci_val = isset($_ci_data[$_ci_val]) ? $_ci_data[$_ci_val] : FALSE;
Derek Allard2067d1a2008-11-13 22:59:24 +0000773 }
David Behlercda768a2011-08-14 23:52:48 +0200774
Greg Akerf5c84022011-04-19 17:13:03 -0500775 $file_exists = FALSE;
Derek Allard2067d1a2008-11-13 22:59:24 +0000776
777 // Set the path to the requested file
Alex Bilbie40bd2a72012-06-02 16:04:15 +0100778 if (is_string($_ci_path) && $_ci_path !== '')
Greg Aker8807be32011-04-21 13:06:15 -0500779 {
780 $_ci_x = explode('/', $_ci_path);
781 $_ci_file = end($_ci_x);
782 }
783 else
Derek Allard2067d1a2008-11-13 22:59:24 +0000784 {
785 $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
Alex Bilbieed944a32012-06-02 11:07:47 +0100786 $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view;
Greg Akerf5c84022011-04-19 17:13:03 -0500787
788 foreach ($this->_ci_view_paths as $view_file => $cascade)
789 {
790 if (file_exists($view_file.$_ci_file))
791 {
792 $_ci_path = $view_file.$_ci_file;
793 $file_exists = TRUE;
794 break;
795 }
David Behlercda768a2011-08-14 23:52:48 +0200796
Greg Akerf5c84022011-04-19 17:13:03 -0500797 if ( ! $cascade)
798 {
799 break;
David Behlercda768a2011-08-14 23:52:48 +0200800 }
Greg Akerf5c84022011-04-19 17:13:03 -0500801 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000802 }
Barry Mienydd671972010-10-04 16:33:58 +0200803
Greg Akerf5c84022011-04-19 17:13:03 -0500804 if ( ! $file_exists && ! file_exists($_ci_path))
Derek Allard2067d1a2008-11-13 22:59:24 +0000805 {
806 show_error('Unable to load the requested file: '.$_ci_file);
807 }
Barry Mienydd671972010-10-04 16:33:58 +0200808
Derek Allard2067d1a2008-11-13 22:59:24 +0000809 // This allows anything loaded using $this->load (views, files, etc.)
810 // to become accessible from within the Controller and Model functions.
Pascal Kriete89ace432010-11-10 15:49:10 -0500811 $_ci_CI =& get_instance();
812 foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var)
Derek Allard2067d1a2008-11-13 22:59:24 +0000813 {
Pascal Kriete89ace432010-11-10 15:49:10 -0500814 if ( ! isset($this->$_ci_key))
Derek Allard2067d1a2008-11-13 22:59:24 +0000815 {
Pascal Kriete89ace432010-11-10 15:49:10 -0500816 $this->$_ci_key =& $_ci_CI->$_ci_key;
Derek Allard2067d1a2008-11-13 22:59:24 +0000817 }
818 }
819
820 /*
821 * Extract and cache variables
822 *
823 * You can either set variables using the dedicated $this->load_vars()
824 * function or via the second parameter of this function. We'll merge
825 * the two types and cache them so that views that are embedded within
826 * other views can have access to these variables.
Barry Mienydd671972010-10-04 16:33:58 +0200827 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000828 if (is_array($_ci_vars))
829 {
830 $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
831 }
832 extract($this->_ci_cached_vars);
Barry Mienydd671972010-10-04 16:33:58 +0200833
Derek Allard2067d1a2008-11-13 22:59:24 +0000834 /*
835 * Buffer the output
836 *
837 * We buffer the output for two reasons:
838 * 1. Speed. You get a significant speed boost.
Andrey Andreevd7297352012-01-07 22:53:14 +0200839 * 2. So that the final rendered template can be post-processed by
840 * the output class. Why do we need post processing? For one thing,
841 * in order to show the elapsed page load time. Unless we can
842 * intercept the content right before it's sent to the browser and
843 * then stop the timer it won't be accurate.
Derek Allard2067d1a2008-11-13 22:59:24 +0000844 */
845 ob_start();
Barry Mienydd671972010-10-04 16:33:58 +0200846
Derek Allard2067d1a2008-11-13 22:59:24 +0000847 // If the PHP installation does not support short tags we'll
848 // do a little string replacement, changing the short tags
849 // to standard PHP echo statements.
Alex Bilbieed944a32012-06-02 11:07:47 +0100850 if ( ! is_php('5.4') && (bool) @ini_get('short_open_tag') === FALSE && config_item('rewrite_short_tags') === TRUE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000851 {
Andrey Andreevd47baab2012-01-09 16:56:46 +0200852 echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
Derek Allard2067d1a2008-11-13 22:59:24 +0000853 }
854 else
855 {
856 include($_ci_path); // include() vs include_once() allows for multiple views with the same name
857 }
Barry Mienydd671972010-10-04 16:33:58 +0200858
Derek Allard2067d1a2008-11-13 22:59:24 +0000859 log_message('debug', 'File loaded: '.$_ci_path);
Barry Mienydd671972010-10-04 16:33:58 +0200860
Derek Allard2067d1a2008-11-13 22:59:24 +0000861 // Return the file data if requested
862 if ($_ci_return === TRUE)
Barry Mienydd671972010-10-04 16:33:58 +0200863 {
Derek Allard2067d1a2008-11-13 22:59:24 +0000864 $buffer = ob_get_contents();
865 @ob_end_clean();
866 return $buffer;
867 }
868
869 /*
870 * Flush the buffer... or buff the flusher?
871 *
872 * In order to permit views to be nested within
873 * other views, we need to flush the content back out whenever
874 * we are beyond the first level of output buffering so that
875 * it can be seen and included properly by the first included
876 * template and any subsequent ones. Oy!
Barry Mienydd671972010-10-04 16:33:58 +0200877 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000878 if (ob_get_level() > $this->_ci_ob_level + 1)
879 {
880 ob_end_flush();
881 }
882 else
883 {
Greg Aker22f1a632010-11-10 15:34:35 -0600884 $_ci_CI->output->append_output(ob_get_contents());
Derek Allard2067d1a2008-11-13 22:59:24 +0000885 @ob_end_clean();
886 }
887 }
888
889 // --------------------------------------------------------------------
890
891 /**
892 * Load class
893 *
894 * This function loads the requested class.
895 *
Barry Mienydd671972010-10-04 16:33:58 +0200896 * @param string the item that is being loaded
Derek Allard2067d1a2008-11-13 22:59:24 +0000897 * @param mixed any additional parameters
898 * @param string an optional object name
Barry Mienydd671972010-10-04 16:33:58 +0200899 * @return void
Derek Allard2067d1a2008-11-13 22:59:24 +0000900 */
Greg Akerf5c84022011-04-19 17:13:03 -0500901 protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
Barry Mienydd671972010-10-04 16:33:58 +0200902 {
903 // Get the class name, and while we're at it trim any slashes.
904 // The directory path can be included as part of the class name,
Derek Allard2067d1a2008-11-13 22:59:24 +0000905 // but we don't want a leading slash
Greg Aker3a746652011-04-19 10:59:47 -0500906 $class = str_replace('.php', '', trim($class, '/'));
Barry Mienydd671972010-10-04 16:33:58 +0200907
Derek Allard2067d1a2008-11-13 22:59:24 +0000908 // Was the path included with the class name?
909 // We look for a slash to determine this
910 $subdir = '';
Derek Jones32bf1862010-03-02 13:46:07 -0600911 if (($last_slash = strrpos($class, '/')) !== FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000912 {
Derek Jones32bf1862010-03-02 13:46:07 -0600913 // Extract the path
Andrey Andreevd7297352012-01-07 22:53:14 +0200914 $subdir = substr($class, 0, ++$last_slash);
Barry Mienydd671972010-10-04 16:33:58 +0200915
Derek Jones32bf1862010-03-02 13:46:07 -0600916 // Get the filename from the path
Andrey Andreevd7297352012-01-07 22:53:14 +0200917 $class = substr($class, $last_slash);
Derek Allard2067d1a2008-11-13 22:59:24 +0000918 }
919
920 // We'll test for both lowercase and capitalized versions of the file name
921 foreach (array(ucfirst($class), strtolower($class)) as $class)
922 {
Greg Aker3a746652011-04-19 10:59:47 -0500923 $subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.'.php';
Derek Allard2067d1a2008-11-13 22:59:24 +0000924
Barry Mienydd671972010-10-04 16:33:58 +0200925 // Is this a class extension request?
Derek Allard2067d1a2008-11-13 22:59:24 +0000926 if (file_exists($subclass))
927 {
Greg Aker3a746652011-04-19 10:59:47 -0500928 $baseclass = BASEPATH.'libraries/'.ucfirst($class).'.php';
Barry Mienydd671972010-10-04 16:33:58 +0200929
Derek Allard2067d1a2008-11-13 22:59:24 +0000930 if ( ! file_exists($baseclass))
931 {
Andrey Andreevd7297352012-01-07 22:53:14 +0200932 log_message('error', 'Unable to load the requested class: '.$class);
933 show_error('Unable to load the requested class: '.$class);
Derek Allard2067d1a2008-11-13 22:59:24 +0000934 }
935
Andrey Andreevd7297352012-01-07 22:53:14 +0200936 // Safety: Was the class already loaded by a previous call?
Derek Allard2067d1a2008-11-13 22:59:24 +0000937 if (in_array($subclass, $this->_ci_loaded_files))
938 {
939 // Before we deem this to be a duplicate request, let's see
Andrey Andreevd7297352012-01-07 22:53:14 +0200940 // if a custom object name is being supplied. If so, we'll
Derek Allard2067d1a2008-11-13 22:59:24 +0000941 // return a new instance of the object
942 if ( ! is_null($object_name))
943 {
944 $CI =& get_instance();
945 if ( ! isset($CI->$object_name))
946 {
Barry Mienydd671972010-10-04 16:33:58 +0200947 return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
Derek Allard2067d1a2008-11-13 22:59:24 +0000948 }
949 }
Barry Mienydd671972010-10-04 16:33:58 +0200950
Derek Allard2067d1a2008-11-13 22:59:24 +0000951 $is_duplicate = TRUE;
Andrey Andreevd7297352012-01-07 22:53:14 +0200952 log_message('debug', $class.' class already loaded. Second attempt ignored.');
Derek Allard2067d1a2008-11-13 22:59:24 +0000953 return;
954 }
Barry Mienydd671972010-10-04 16:33:58 +0200955
956 include_once($baseclass);
Derek Allard2067d1a2008-11-13 22:59:24 +0000957 include_once($subclass);
958 $this->_ci_loaded_files[] = $subclass;
Barry Mienydd671972010-10-04 16:33:58 +0200959
960 return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
Derek Allard2067d1a2008-11-13 22:59:24 +0000961 }
Barry Mienydd671972010-10-04 16:33:58 +0200962
Derek Allard2067d1a2008-11-13 22:59:24 +0000963 // Lets search for the requested library file and load it.
Derek Jones32bf1862010-03-02 13:46:07 -0600964 $is_duplicate = FALSE;
965 foreach ($this->_ci_library_paths as $path)
Derek Allard2067d1a2008-11-13 22:59:24 +0000966 {
Greg Aker3a746652011-04-19 10:59:47 -0500967 $filepath = $path.'libraries/'.$subdir.$class.'.php';
Derek Jones32bf1862010-03-02 13:46:07 -0600968
Andrey Andreevd7297352012-01-07 22:53:14 +0200969 // Does the file exist? No? Bummer...
Derek Allard2067d1a2008-11-13 22:59:24 +0000970 if ( ! file_exists($filepath))
971 {
972 continue;
973 }
Barry Mienydd671972010-10-04 16:33:58 +0200974
Andrey Andreevd7297352012-01-07 22:53:14 +0200975 // Safety: Was the class already loaded by a previous call?
Derek Allard2067d1a2008-11-13 22:59:24 +0000976 if (in_array($filepath, $this->_ci_loaded_files))
977 {
978 // Before we deem this to be a duplicate request, let's see
Andrey Andreevd7297352012-01-07 22:53:14 +0200979 // if a custom object name is being supplied. If so, we'll
Derek Allard2067d1a2008-11-13 22:59:24 +0000980 // return a new instance of the object
981 if ( ! is_null($object_name))
982 {
983 $CI =& get_instance();
984 if ( ! isset($CI->$object_name))
985 {
986 return $this->_ci_init_class($class, '', $params, $object_name);
987 }
988 }
Barry Mienydd671972010-10-04 16:33:58 +0200989
Derek Allard2067d1a2008-11-13 22:59:24 +0000990 $is_duplicate = TRUE;
Andrey Andreevd7297352012-01-07 22:53:14 +0200991 log_message('debug', $class.' class already loaded. Second attempt ignored.');
Derek Allard2067d1a2008-11-13 22:59:24 +0000992 return;
993 }
Barry Mienydd671972010-10-04 16:33:58 +0200994
Derek Allard2067d1a2008-11-13 22:59:24 +0000995 include_once($filepath);
996 $this->_ci_loaded_files[] = $filepath;
Barry Mienydd671972010-10-04 16:33:58 +0200997 return $this->_ci_init_class($class, '', $params, $object_name);
Derek Allard2067d1a2008-11-13 22:59:24 +0000998 }
Derek Jones32bf1862010-03-02 13:46:07 -0600999
Derek Allard2067d1a2008-11-13 22:59:24 +00001000 } // END FOREACH
1001
Andrey Andreevd7297352012-01-07 22:53:14 +02001002 // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified?
Alex Bilbieed944a32012-06-02 11:07:47 +01001003 if ($subdir === '')
Derek Allard2067d1a2008-11-13 22:59:24 +00001004 {
1005 $path = strtolower($class).'/'.$class;
1006 return $this->_ci_load_class($path, $params);
1007 }
Barry Mienydd671972010-10-04 16:33:58 +02001008
Derek Allard2067d1a2008-11-13 22:59:24 +00001009 // If we got this far we were unable to find the requested class.
1010 // We do not issue errors if the load call failed due to a duplicate request
Alex Bilbieed944a32012-06-02 11:07:47 +01001011 if ($is_duplicate === FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +00001012 {
Andrey Andreevd7297352012-01-07 22:53:14 +02001013 log_message('error', 'Unable to load the requested class: '.$class);
1014 show_error('Unable to load the requested class: '.$class);
Derek Allard2067d1a2008-11-13 22:59:24 +00001015 }
1016 }
Barry Mienydd671972010-10-04 16:33:58 +02001017
Derek Allard2067d1a2008-11-13 22:59:24 +00001018 // --------------------------------------------------------------------
1019
1020 /**
1021 * Instantiates a class
1022 *
Derek Allard2067d1a2008-11-13 22:59:24 +00001023 * @param string
1024 * @param string
David Behlercda768a2011-08-14 23:52:48 +02001025 * @param bool
Derek Allard2067d1a2008-11-13 22:59:24 +00001026 * @param string an optional object name
Andrey Andreev94af3552012-03-26 23:10:42 +03001027 * @return void
Derek Allard2067d1a2008-11-13 22:59:24 +00001028 */
Greg Aker0c9ee4a2011-04-20 09:40:17 -05001029 protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
Barry Mienydd671972010-10-04 16:33:58 +02001030 {
Andrey Andreev94af3552012-03-26 23:10:42 +03001031 // Is there an associated config file for this class? Note: these should always be lowercase
Derek Allard2067d1a2008-11-13 22:59:24 +00001032 if ($config === NULL)
1033 {
Eric Barnes5e16ec62011-01-04 17:25:23 -05001034 // Fetch the config paths containing any package paths
1035 $config_component = $this->_ci_get_component('config');
1036
1037 if (is_array($config_component->_config_paths))
Derek Allard2067d1a2008-11-13 22:59:24 +00001038 {
Eric Barnes5e16ec62011-01-04 17:25:23 -05001039 // Break on the first found file, thus package files
1040 // are not overridden by default paths
1041 foreach ($config_component->_config_paths as $path)
1042 {
1043 // We test for both uppercase and lowercase, for servers that
joelcox1bfd9fa2011-01-16 18:49:39 +01001044 // are case-sensitive with regard to file names. Check for environment
1045 // first, global next
Andrey Andreev94af3552012-03-26 23:10:42 +03001046 if (defined('ENVIRONMENT') && file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
joelcox1bfd9fa2011-01-16 18:49:39 +01001047 {
Andrey Andreev94af3552012-03-26 23:10:42 +03001048 include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
joelcox1bfd9fa2011-01-16 18:49:39 +01001049 break;
1050 }
Andrey Andreev94af3552012-03-26 23:10:42 +03001051 elseif (defined('ENVIRONMENT') && file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
joelcox1bfd9fa2011-01-16 18:49:39 +01001052 {
Andrey Andreev94af3552012-03-26 23:10:42 +03001053 include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
joelcox1bfd9fa2011-01-16 18:49:39 +01001054 break;
1055 }
Andrey Andreev94af3552012-03-26 23:10:42 +03001056 elseif (file_exists($path.'config/'.strtolower($class).'.php'))
Eric Barnes5e16ec62011-01-04 17:25:23 -05001057 {
Andrey Andreev94af3552012-03-26 23:10:42 +03001058 include($path.'config/'.strtolower($class).'.php');
Eric Barnes5e16ec62011-01-04 17:25:23 -05001059 break;
1060 }
Andrey Andreev94af3552012-03-26 23:10:42 +03001061 elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php'))
Eric Barnes5e16ec62011-01-04 17:25:23 -05001062 {
Andrey Andreev94af3552012-03-26 23:10:42 +03001063 include($path.'config/'.ucfirst(strtolower($class)).'.php');
Eric Barnes5e16ec62011-01-04 17:25:23 -05001064 break;
1065 }
1066 }
Derek Allard2067d1a2008-11-13 22:59:24 +00001067 }
1068 }
Barry Mienydd671972010-10-04 16:33:58 +02001069
Alex Bilbieed944a32012-06-02 11:07:47 +01001070 if ($prefix === '')
Barry Mienydd671972010-10-04 16:33:58 +02001071 {
1072 if (class_exists('CI_'.$class))
Derek Allard2067d1a2008-11-13 22:59:24 +00001073 {
1074 $name = 'CI_'.$class;
1075 }
Barry Mienydd671972010-10-04 16:33:58 +02001076 elseif (class_exists(config_item('subclass_prefix').$class))
Derek Allard2067d1a2008-11-13 22:59:24 +00001077 {
1078 $name = config_item('subclass_prefix').$class;
1079 }
1080 else
1081 {
1082 $name = $class;
1083 }
1084 }
1085 else
1086 {
1087 $name = $prefix.$class;
1088 }
Barry Mienydd671972010-10-04 16:33:58 +02001089
Derek Allard2067d1a2008-11-13 22:59:24 +00001090 // Is the class name valid?
1091 if ( ! class_exists($name))
1092 {
Andrey Andreevd7297352012-01-07 22:53:14 +02001093 log_message('error', 'Non-existent class: '.$name);
1094 show_error('Non-existent class: '.$class);
Derek Allard2067d1a2008-11-13 22:59:24 +00001095 }
Barry Mienydd671972010-10-04 16:33:58 +02001096
Derek Allard2067d1a2008-11-13 22:59:24 +00001097 // Set the variable name we will assign the class to
Andrey Andreevd7297352012-01-07 22:53:14 +02001098 // Was a custom class name supplied? If so we'll use it
Derek Allard2067d1a2008-11-13 22:59:24 +00001099 $class = strtolower($class);
Barry Mienydd671972010-10-04 16:33:58 +02001100
Derek Allard2067d1a2008-11-13 22:59:24 +00001101 if (is_null($object_name))
1102 {
Andrey Andreev94af3552012-03-26 23:10:42 +03001103 $classvar = isset($this->_ci_varmap[$class]) ? $this->_ci_varmap[$class] : $class;
Derek Allard2067d1a2008-11-13 22:59:24 +00001104 }
1105 else
1106 {
1107 $classvar = $object_name;
1108 }
1109
Barry Mienydd671972010-10-04 16:33:58 +02001110 // Save the class name and object name
Derek Allard2067d1a2008-11-13 22:59:24 +00001111 $this->_ci_classes[$class] = $classvar;
1112
Barry Mienydd671972010-10-04 16:33:58 +02001113 // Instantiate the class
Derek Allard2067d1a2008-11-13 22:59:24 +00001114 $CI =& get_instance();
1115 if ($config !== NULL)
1116 {
1117 $CI->$classvar = new $name($config);
1118 }
1119 else
Barry Mienydd671972010-10-04 16:33:58 +02001120 {
Andrey Andreeva11b16b2012-03-28 12:22:04 +03001121 $CI->$classvar = new $name();
Barry Mienydd671972010-10-04 16:33:58 +02001122 }
1123 }
1124
Derek Allard2067d1a2008-11-13 22:59:24 +00001125 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +02001126
Derek Allard2067d1a2008-11-13 22:59:24 +00001127 /**
1128 * Autoloader
1129 *
1130 * The config/autoload.php file contains an array that permits sub-systems,
Derek Jonesc6da5032010-03-09 20:44:27 -06001131 * libraries, and helpers to be loaded automatically.
Derek Allard2067d1a2008-11-13 22:59:24 +00001132 *
Derek Allard2067d1a2008-11-13 22:59:24 +00001133 * @return void
1134 */
Shane Pearson665baec2011-08-22 18:52:19 -05001135 protected function _ci_autoloader()
Barry Mienydd671972010-10-04 16:33:58 +02001136 {
Andrey Andreev94af3552012-03-26 23:10:42 +03001137 if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
Greg Akerd96f8822011-12-27 16:23:47 -06001138 {
1139 include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
1140 }
1141 else
1142 {
1143 include(APPPATH.'config/autoload.php');
1144 }
Barry Mienydd671972010-10-04 16:33:58 +02001145
Derek Allard2067d1a2008-11-13 22:59:24 +00001146 if ( ! isset($autoload))
1147 {
1148 return FALSE;
1149 }
Barry Mienydd671972010-10-04 16:33:58 +02001150
Phil Sturgeon9730c752010-12-15 10:50:15 +00001151 // Autoload packages
1152 if (isset($autoload['packages']))
1153 {
1154 foreach ($autoload['packages'] as $package_path)
1155 {
1156 $this->add_package_path($package_path);
1157 }
1158 }
1159
Derek Allard2067d1a2008-11-13 22:59:24 +00001160 // Load any custom config file
1161 if (count($autoload['config']) > 0)
Barry Mienydd671972010-10-04 16:33:58 +02001162 {
Derek Allard2067d1a2008-11-13 22:59:24 +00001163 $CI =& get_instance();
1164 foreach ($autoload['config'] as $key => $val)
1165 {
1166 $CI->config->load($val);
1167 }
Barry Mienydd671972010-10-04 16:33:58 +02001168 }
Derek Allard2067d1a2008-11-13 22:59:24 +00001169
Derek Jonesc6da5032010-03-09 20:44:27 -06001170 // Autoload helpers and languages
1171 foreach (array('helper', 'language') as $type)
Barry Mienydd671972010-10-04 16:33:58 +02001172 {
Andrey Andreev94af3552012-03-26 23:10:42 +03001173 if (isset($autoload[$type]) && count($autoload[$type]) > 0)
Derek Allard2067d1a2008-11-13 22:59:24 +00001174 {
1175 $this->$type($autoload[$type]);
Barry Mienydd671972010-10-04 16:33:58 +02001176 }
Derek Allard2067d1a2008-11-13 22:59:24 +00001177 }
1178
Derek Allard2067d1a2008-11-13 22:59:24 +00001179 // Load libraries
Andrey Andreev94af3552012-03-26 23:10:42 +03001180 if (isset($autoload['libraries']) && count($autoload['libraries']) > 0)
Derek Allard2067d1a2008-11-13 22:59:24 +00001181 {
1182 // Load the database driver.
1183 if (in_array('database', $autoload['libraries']))
1184 {
1185 $this->database();
1186 $autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
1187 }
Barry Mienydd671972010-10-04 16:33:58 +02001188
Derek Allard2067d1a2008-11-13 22:59:24 +00001189 // Load all other libraries
1190 foreach ($autoload['libraries'] as $item)
1191 {
1192 $this->library($item);
1193 }
Barry Mienydd671972010-10-04 16:33:58 +02001194 }
Derek Allard2067d1a2008-11-13 22:59:24 +00001195
1196 // Autoload models
1197 if (isset($autoload['model']))
1198 {
1199 $this->model($autoload['model']);
1200 }
Barry Mienydd671972010-10-04 16:33:58 +02001201 }
Derek Allard2067d1a2008-11-13 22:59:24 +00001202
1203 // --------------------------------------------------------------------
1204
1205 /**
1206 * Object to Array
1207 *
1208 * Takes an object as input and converts the class variables to array key/vals
1209 *
Derek Allard2067d1a2008-11-13 22:59:24 +00001210 * @param object
1211 * @return array
1212 */
Greg Akerf5c84022011-04-19 17:13:03 -05001213 protected function _ci_object_to_array($object)
Derek Allard2067d1a2008-11-13 22:59:24 +00001214 {
Andrey Andreev94af3552012-03-26 23:10:42 +03001215 return is_object($object) ? get_object_vars($object) : $object;
Derek Allard2067d1a2008-11-13 22:59:24 +00001216 }
1217
1218 // --------------------------------------------------------------------
1219
1220 /**
Derek Jones32bf1862010-03-02 13:46:07 -06001221 * Get a reference to a specific library or model
1222 *
David Behlercda768a2011-08-14 23:52:48 +02001223 * @param string
Derek Jones32bf1862010-03-02 13:46:07 -06001224 * @return bool
1225 */
Greg Akerf5c84022011-04-19 17:13:03 -05001226 protected function &_ci_get_component($component)
Derek Jones32bf1862010-03-02 13:46:07 -06001227 {
Pascal Kriete89ace432010-11-10 15:49:10 -05001228 $CI =& get_instance();
1229 return $CI->$component;
Derek Jones32bf1862010-03-02 13:46:07 -06001230 }
1231
1232 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +02001233
Derek Jones32bf1862010-03-02 13:46:07 -06001234 /**
1235 * Prep filename
1236 *
1237 * This function preps the name of various items to make loading them more reliable.
1238 *
Derek Jones32bf1862010-03-02 13:46:07 -06001239 * @param mixed
David Behlercda768a2011-08-14 23:52:48 +02001240 * @param string
Derek Jones32bf1862010-03-02 13:46:07 -06001241 * @return array
1242 */
Greg Akerf5c84022011-04-19 17:13:03 -05001243 protected function _ci_prep_filename($filename, $extension)
Derek Jones32bf1862010-03-02 13:46:07 -06001244 {
1245 if ( ! is_array($filename))
Barry Mienydd671972010-10-04 16:33:58 +02001246 {
Andrey Andreevd47baab2012-01-09 16:56:46 +02001247 return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension));
Derek Jones32bf1862010-03-02 13:46:07 -06001248 }
1249 else
1250 {
1251 foreach ($filename as $key => $val)
1252 {
Andrey Andreevd47baab2012-01-09 16:56:46 +02001253 $filename[$key] = strtolower(str_replace(array($extension, '.php'), '', $val).$extension);
Derek Jones32bf1862010-03-02 13:46:07 -06001254 }
Barry Mienydd671972010-10-04 16:33:58 +02001255
Derek Jones32bf1862010-03-02 13:46:07 -06001256 return $filename;
1257 }
1258 }
Andrey Andreev94af3552012-03-26 23:10:42 +03001259
Derek Allard2067d1a2008-11-13 22:59:24 +00001260}
1261
1262/* End of file Loader.php */
Andrey Andreev92ebfb62012-05-17 12:49:24 +03001263/* Location: ./system/core/Loader.php */