]>
jfr.im git - z_archive/KronOS.git/blob - video/system/core/Loader.php
1 <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
5 * An open source application development framework for PHP 5.1.6 or newer
8 * @author ExpressionEngine Dev Team
9 * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
10 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
16 // ------------------------------------------------------------------------
21 * Loads views and files
23 * @package CodeIgniter
24 * @subpackage Libraries
25 * @author ExpressionEngine Dev Team
27 * @link http://codeigniter.com/user_guide/libraries/loader.html
31 // All these are set automatically. Don't mess with them.
33 * Nesting level of the output buffering mechanism
38 protected $_ci_ob_level;
40 * List of paths to load views from
45 protected $_ci_view_paths = array();
47 * List of paths to load libraries from
52 protected $_ci_library_paths = array();
54 * List of paths to load models from
59 protected $_ci_model_paths = array();
61 * List of paths to load helpers from
66 protected $_ci_helper_paths = array();
68 * List of loaded base classes
69 * Set by the controller class
74 protected $_base_classes = array(); // Set by the controller class
76 * List of cached variables
81 protected $_ci_cached_vars = array();
83 * List of loaded classes
88 protected $_ci_classes = array();
90 * List of loaded files
95 protected $_ci_loaded_files = array();
97 * List of loaded models
102 protected $_ci_models = array();
104 * List of loaded helpers
109 protected $_ci_helpers = array();
111 * List of class name mappings
116 protected $_ci_varmap = array('unit_test' => 'unit',
117 'user_agent' => 'agent');
122 * Sets the path to the view files and gets the initial output buffering level
124 public function __construct()
126 $this->_ci_ob_level
= ob_get_level();
127 $this->_ci_library_paths
= array(APPPATH
, BASEPATH
);
128 $this->_ci_helper_paths
= array(APPPATH
, BASEPATH
);
129 $this->_ci_model_paths
= array(APPPATH
);
130 $this->_ci_view_paths
= array(APPPATH
.'views/' => TRUE);
132 log_message('debug', "Loader Class Initialized");
135 // --------------------------------------------------------------------
138 * Initialize the Loader
140 * This method is called once in CI_Controller.
145 public function initialize()
147 $this->_ci_classes
= array();
148 $this->_ci_loaded_files
= array();
149 $this->_ci_models
= array();
150 $this->_base_classes
=& is_loaded();
152 $this->_ci_autoloader();
157 // --------------------------------------------------------------------
162 * A utility function to test if a class is in the self::$_ci_classes array.
163 * This function returns the object name if the class tested for is loaded,
164 * and returns FALSE if it isn't.
166 * It is mainly used in the form_helper -> _get_validation_object()
168 * @param string class being checked for
169 * @return mixed class object name on the CI SuperObject or FALSE
171 public function is_loaded($class)
173 if (isset($this->_ci_classes
[$class]))
175 return $this->_ci_classes
[$class];
181 // --------------------------------------------------------------------
186 * This function lets users load and instantiate classes.
187 * It is designed to be called from a user's app controllers.
189 * @param string the name of the class
190 * @param mixed the optional parameters
191 * @param string an optional object name
194 public function library($library = '', $params = NULL, $object_name = NULL)
196 if (is_array($library))
198 foreach ($library as $class)
200 $this->library($class, $params);
206 if ($library == '' OR isset($this->_base_classes
[$library]))
211 if ( ! is_null($params) && ! is_array($params))
216 $this->_ci_load_class($library, $params, $object_name);
219 // --------------------------------------------------------------------
224 * This function lets users load and instantiate models.
226 * @param string the name of the class
227 * @param string name for the model
228 * @param bool database connection
231 public function model($model, $name = '', $db_conn = FALSE)
233 if (is_array($model))
235 foreach ($model as $babe)
249 // Is the model in a sub-folder? If so, parse out the filename and path.
250 if (($last_slash = strrpos($model, '/')) !== FALSE)
252 // The path is in front of the last slash
253 $path = substr($model, 0, $last_slash +
1);
255 // And the model name behind it
256 $model = substr($model, $last_slash +
1);
264 if (in_array($name, $this->_ci_models
, TRUE))
269 $CI =& get_instance();
270 if (isset($CI->$name))
272 show_error('The model name you are loading is the name of a resource that is already being used: '.$name);
275 $model = strtolower($model);
277 foreach ($this->_ci_model_paths
as $mod_path)
279 if ( ! file_exists($mod_path.'models/'.$path.$model.'.php'))
284 if ($db_conn !== FALSE AND ! class_exists('CI_DB'))
286 if ($db_conn === TRUE)
291 $CI->load
->database($db_conn, FALSE, TRUE);
294 if ( ! class_exists('CI_Model'))
296 load_class('Model', 'core');
299 require_once($mod_path.'models/'.$path.$model.'.php');
301 $model = ucfirst($model);
303 $CI->$name = new $model();
305 $this->_ci_models
[] = $name;
309 // couldn't find the model
310 show_error('Unable to locate the model you have specified: '.$model);
313 // --------------------------------------------------------------------
318 * @param string the DB credentials
319 * @param bool whether to return the DB object
320 * @param bool whether to enable active record (this allows us to override the config setting)
323 public function database($params = '', $return = FALSE, $active_record = NULL)
325 // Grab the super object
326 $CI =& get_instance();
328 // Do we even need to load the database class?
329 if (class_exists('CI_DB') AND $return == FALSE AND $active_record == NULL AND isset($CI->db
) AND is_object($CI->db
))
334 require_once(BASEPATH
.'database/DB.php');
336 if ($return === TRUE)
338 return DB($params, $active_record);
341 // Initialize the db variable. Needed to prevent
342 // reference errors with some configurations
346 $CI->db
=& DB($params, $active_record);
349 // --------------------------------------------------------------------
352 * Load the Utilities Class
356 public function dbutil()
358 if ( ! class_exists('CI_DB'))
363 $CI =& get_instance();
365 // for backwards compatibility, load dbforge so we can extend dbutils off it
366 // this use is deprecated and strongly discouraged
367 $CI->load
->dbforge();
369 require_once(BASEPATH
.'database/DB_utility.php');
370 require_once(BASEPATH
.'database/drivers/'.$CI->db
->dbdriver
.'/'.$CI->db
->dbdriver
.'_utility.php');
371 $class = 'CI_DB_'.$CI->db
->dbdriver
.'_utility';
373 $CI->dbutil
= new $class();
376 // --------------------------------------------------------------------
379 * Load the Database Forge Class
383 public function dbforge()
385 if ( ! class_exists('CI_DB'))
390 $CI =& get_instance();
392 require_once(BASEPATH
.'database/DB_forge.php');
393 require_once(BASEPATH
.'database/drivers/'.$CI->db
->dbdriver
.'/'.$CI->db
->dbdriver
.'_forge.php');
394 $class = 'CI_DB_'.$CI->db
->dbdriver
.'_forge';
396 $CI->dbforge
= new $class();
399 // --------------------------------------------------------------------
404 * This function is used to load a "view" file. It has three parameters:
406 * 1. The name of the "view" file to be included.
407 * 2. An associative array of data to be extracted for use in the view.
408 * 3. TRUE/FALSE - whether to return the data or load it. In
409 * some cases it's advantageous to be able to return data so that
410 * a developer can process it in some way.
417 public function view($view, $vars = array(), $return = FALSE)
419 return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
422 // --------------------------------------------------------------------
427 * This is a generic file loader
433 public function file($path, $return = FALSE)
435 return $this->_ci_load(array('_ci_path' => $path, '_ci_return' => $return));
438 // --------------------------------------------------------------------
443 * Once variables are set they become available within
444 * the controller class and its "view" files.
450 public function vars($vars = array(), $val = '')
452 if ($val != '' AND is_string($vars))
454 $vars = array($vars => $val);
457 $vars = $this->_ci_object_to_array($vars);
459 if (is_array($vars) AND count($vars) > 0)
461 foreach ($vars as $key => $val)
463 $this->_ci_cached_vars
[$key] = $val;
468 // --------------------------------------------------------------------
473 * Check if a variable is set and retrieve it.
478 public function get_var($key)
480 return isset($this->_ci_cached_vars
[$key]) ? $this->_ci_cached_vars
[$key] : NULL;
483 // --------------------------------------------------------------------
488 * This function loads the specified helper file.
493 public function helper($helpers = array())
495 foreach ($this->_ci_prep_filename($helpers, '_helper') as $helper)
497 if (isset($this->_ci_helpers
[$helper]))
502 $ext_helper = APPPATH
.'helpers/'.config_item('subclass_prefix').$helper.'.php';
504 // Is this a helper extension request?
505 if (file_exists($ext_helper))
507 $base_helper = BASEPATH
.'helpers/'.$helper.'.php';
509 if ( ! file_exists($base_helper))
511 show_error('Unable to load the requested file: helpers/'.$helper.'.php');
514 include_once($ext_helper);
515 include_once($base_helper);
517 $this->_ci_helpers
[$helper] = TRUE;
518 log_message('debug', 'Helper loaded: '.$helper);
522 // Try to load the helper
523 foreach ($this->_ci_helper_paths
as $path)
525 if (file_exists($path.'helpers/'.$helper.'.php'))
527 include_once($path.'helpers/'.$helper.'.php');
529 $this->_ci_helpers
[$helper] = TRUE;
530 log_message('debug', 'Helper loaded: '.$helper);
535 // unable to load the helper
536 if ( ! isset($this->_ci_helpers
[$helper]))
538 show_error('Unable to load the requested file: helpers/'.$helper.'.php');
543 // --------------------------------------------------------------------
548 * This is simply an alias to the above function in case the
549 * user has written the plural form of this function.
554 public function helpers($helpers = array())
556 $this->helper($helpers);
559 // --------------------------------------------------------------------
562 * Loads a language file
568 public function language($file = array(), $lang = '')
570 $CI =& get_instance();
572 if ( ! is_array($file))
574 $file = array($file);
577 foreach ($file as $langfile)
579 $CI->lang
->load($langfile, $lang);
583 // --------------------------------------------------------------------
586 * Loads a config file
593 public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
595 $CI =& get_instance();
596 $CI->config
->load($file, $use_sections, $fail_gracefully);
599 // --------------------------------------------------------------------
604 * Loads a driver library
606 * @param string the name of the class
607 * @param mixed the optional parameters
608 * @param string an optional object name
611 public function driver($library = '', $params = NULL, $object_name = NULL)
613 if ( ! class_exists('CI_Driver_Library'))
615 // we aren't instantiating an object here, that'll be done by the Library itself
616 require BASEPATH
.'libraries/Driver.php';
624 // We can save the loader some time since Drivers will *always* be in a subfolder,
625 // and typically identically named to the library
626 if ( ! strpos($library, '/'))
628 $library = ucfirst($library).'/'.$library;
631 return $this->library($library, $params, $object_name);
634 // --------------------------------------------------------------------
639 * Prepends a parent path to the library, model, helper, and config path arrays
645 public function add_package_path($path, $view_cascade=TRUE)
647 $path = rtrim($path, '/').'/';
649 array_unshift($this->_ci_library_paths
, $path);
650 array_unshift($this->_ci_model_paths
, $path);
651 array_unshift($this->_ci_helper_paths
, $path);
653 $this->_ci_view_paths
= array($path.'views/' => $view_cascade) +
$this->_ci_view_paths
;
655 // Add config file path
656 $config =& $this->_ci_get_component('config');
657 array_unshift($config->_config_paths
, $path);
660 // --------------------------------------------------------------------
665 * Return a list of all package paths, by default it will ignore BASEPATH.
670 public function get_package_paths($include_base = FALSE)
672 return $include_base === TRUE ? $this->_ci_library_paths
: $this->_ci_model_paths
;
675 // --------------------------------------------------------------------
678 * Remove Package Path
680 * Remove a path from the library, model, and helper path arrays if it exists
681 * If no path is provided, the most recently added path is removed.
687 public function remove_package_path($path = '', $remove_config_path = TRUE)
689 $config =& $this->_ci_get_component('config');
693 $void = array_shift($this->_ci_library_paths
);
694 $void = array_shift($this->_ci_model_paths
);
695 $void = array_shift($this->_ci_helper_paths
);
696 $void = array_shift($this->_ci_view_paths
);
697 $void = array_shift($config->_config_paths
);
701 $path = rtrim($path, '/').'/';
702 foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var)
704 if (($key = array_search($path, $this->{$
var})) !== FALSE)
706 unset($this->{$
var}[$key]);
710 if (isset($this->_ci_view_paths
[$path.'views/']))
712 unset($this->_ci_view_paths
[$path.'views/']);
715 if (($key = array_search($path, $config->_config_paths
)) !== FALSE)
717 unset($config->_config_paths
[$key]);
721 // make sure the application default paths are still in the array
722 $this->_ci_library_paths
= array_unique(array_merge($this->_ci_library_paths
, array(APPPATH
, BASEPATH
)));
723 $this->_ci_helper_paths
= array_unique(array_merge($this->_ci_helper_paths
, array(APPPATH
, BASEPATH
)));
724 $this->_ci_model_paths
= array_unique(array_merge($this->_ci_model_paths
, array(APPPATH
)));
725 $this->_ci_view_paths
= array_merge($this->_ci_view_paths
, array(APPPATH
.'views/' => TRUE));
726 $config->_config_paths
= array_unique(array_merge($config->_config_paths
, array(APPPATH
)));
729 // --------------------------------------------------------------------
734 * This function is used to load views and files.
735 * Variables are prefixed with _ci_ to avoid symbol collision with
736 * variables made available to view files
741 protected function _ci_load($_ci_data)
743 // Set the default data variables
744 foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val)
746 $
$_ci_val = ( ! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val];
749 $file_exists = FALSE;
751 // Set the path to the requested file
754 $_ci_x = explode('/', $_ci_path);
755 $_ci_file = end($_ci_x);
759 $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION
);
760 $_ci_file = ($_ci_ext == '') ? $_ci_view.'.php' : $_ci_view;
762 foreach ($this->_ci_view_paths
as $view_file => $cascade)
764 if (file_exists($view_file.$_ci_file))
766 $_ci_path = $view_file.$_ci_file;
778 if ( ! $file_exists && ! file_exists($_ci_path))
780 show_error('Unable to load the requested file: '.$_ci_file);
783 // This allows anything loaded using $this->load (views, files, etc.)
784 // to become accessible from within the Controller and Model functions.
786 $_ci_CI =& get_instance();
787 foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var)
789 if ( ! isset($this->$_ci_key))
791 $this->$_ci_key =& $_ci_CI->$_ci_key;
796 * Extract and cache variables
798 * You can either set variables using the dedicated $this->load_vars()
799 * function or via the second parameter of this function. We'll merge
800 * the two types and cache them so that views that are embedded within
801 * other views can have access to these variables.
803 if (is_array($_ci_vars))
805 $this->_ci_cached_vars
= array_merge($this->_ci_cached_vars
, $_ci_vars);
807 extract($this->_ci_cached_vars
);
812 * We buffer the output for two reasons:
813 * 1. Speed. You get a significant speed boost.
814 * 2. So that the final rendered template can be
815 * post-processed by the output class. Why do we
816 * need post processing? For one thing, in order to
817 * show the elapsed page load time. Unless we
818 * can intercept the content right before it's sent to
819 * the browser and then stop the timer it won't be accurate.
823 // If the PHP installation does not support short tags we'll
824 // do a little string replacement, changing the short tags
825 // to standard PHP echo statements.
827 if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE)
829 echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
833 include($_ci_path); // include() vs include_once() allows for multiple views with the same name
836 log_message('debug', 'File loaded: '.$_ci_path);
838 // Return the file data if requested
839 if ($_ci_return === TRUE)
841 $buffer = ob_get_contents();
847 * Flush the buffer... or buff the flusher?
849 * In order to permit views to be nested within
850 * other views, we need to flush the content back out whenever
851 * we are beyond the first level of output buffering so that
852 * it can be seen and included properly by the first included
853 * template and any subsequent ones. Oy!
856 if (ob_get_level() > $this->_ci_ob_level +
1)
862 $_ci_CI->output
->append_output(ob_get_contents());
867 // --------------------------------------------------------------------
872 * This function loads the requested class.
874 * @param string the item that is being loaded
875 * @param mixed any additional parameters
876 * @param string an optional object name
879 protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
881 // Get the class name, and while we're at it trim any slashes.
882 // The directory path can be included as part of the class name,
883 // but we don't want a leading slash
884 $class = str_replace('.php', '', trim($class, '/'));
886 // Was the path included with the class name?
887 // We look for a slash to determine this
889 if (($last_slash = strrpos($class, '/')) !== FALSE)
892 $subdir = substr($class, 0, $last_slash +
1);
894 // Get the filename from the path
895 $class = substr($class, $last_slash +
1);
898 // We'll test for both lowercase and capitalized versions of the file name
899 foreach (array(ucfirst($class), strtolower($class)) as $class)
901 $subclass = APPPATH
.'libraries/'.$subdir.config_item('subclass_prefix').$class.'.php';
903 // Is this a class extension request?
904 if (file_exists($subclass))
906 $baseclass = BASEPATH
.'libraries/'.ucfirst($class).'.php';
908 if ( ! file_exists($baseclass))
910 log_message('error', "Unable to load the requested class: ".$class);
911 show_error("Unable to load the requested class: ".$class);
914 // Safety: Was the class already loaded by a previous call?
915 if (in_array($subclass, $this->_ci_loaded_files
))
917 // Before we deem this to be a duplicate request, let's see
918 // if a custom object name is being supplied. If so, we'll
919 // return a new instance of the object
920 if ( ! is_null($object_name))
922 $CI =& get_instance();
923 if ( ! isset($CI->$object_name))
925 return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
929 $is_duplicate = TRUE;
930 log_message('debug', $class." class already loaded. Second attempt ignored.");
934 include_once($baseclass);
935 include_once($subclass);
936 $this->_ci_loaded_files
[] = $subclass;
938 return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
941 // Lets search for the requested library file and load it.
942 $is_duplicate = FALSE;
943 foreach ($this->_ci_library_paths
as $path)
945 $filepath = $path.'libraries/'.$subdir.$class.'.php';
947 // Does the file exist? No? Bummer...
948 if ( ! file_exists($filepath))
953 // Safety: Was the class already loaded by a previous call?
954 if (in_array($filepath, $this->_ci_loaded_files
))
956 // Before we deem this to be a duplicate request, let's see
957 // if a custom object name is being supplied. If so, we'll
958 // return a new instance of the object
959 if ( ! is_null($object_name))
961 $CI =& get_instance();
962 if ( ! isset($CI->$object_name))
964 return $this->_ci_init_class($class, '', $params, $object_name);
968 $is_duplicate = TRUE;
969 log_message('debug', $class." class already loaded. Second attempt ignored.");
973 include_once($filepath);
974 $this->_ci_loaded_files
[] = $filepath;
975 return $this->_ci_init_class($class, '', $params, $object_name);
980 // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified?
983 $path = strtolower($class).'/'.$class;
984 return $this->_ci_load_class($path, $params);
987 // If we got this far we were unable to find the requested class.
988 // We do not issue errors if the load call failed due to a duplicate request
989 if ($is_duplicate == FALSE)
991 log_message('error', "Unable to load the requested class: ".$class);
992 show_error("Unable to load the requested class: ".$class);
996 // --------------------------------------------------------------------
999 * Instantiates a class
1004 * @param string an optional object name
1007 protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
1009 // Is there an associated config file for this class? Note: these should always be lowercase
1010 if ($config === NULL)
1012 // Fetch the config paths containing any package paths
1013 $config_component = $this->_ci_get_component('config');
1015 if (is_array($config_component->_config_paths
))
1017 // Break on the first found file, thus package files
1018 // are not overridden by default paths
1019 foreach ($config_component->_config_paths
as $path)
1021 // We test for both uppercase and lowercase, for servers that
1022 // are case-sensitive with regard to file names. Check for environment
1023 // first, global next
1024 if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT
.'/'.strtolower($class).'.php'))
1026 include($path .'config/'.ENVIRONMENT
.'/'.strtolower($class).'.php');
1029 elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT
.'/'.ucfirst(strtolower($class)).'.php'))
1031 include($path .'config/'.ENVIRONMENT
.'/'.ucfirst(strtolower($class)).'.php');
1034 elseif (file_exists($path .'config/'.strtolower($class).'.php'))
1036 include($path .'config/'.strtolower($class).'.php');
1039 elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php'))
1041 include($path .'config/'.ucfirst(strtolower($class)).'.php');
1050 if (class_exists('CI_'.$class))
1052 $name = 'CI_'.$class;
1054 elseif (class_exists(config_item('subclass_prefix').$class))
1056 $name = config_item('subclass_prefix').$class;
1065 $name = $prefix.$class;
1068 // Is the class name valid?
1069 if ( ! class_exists($name))
1071 log_message('error', "Non-existent class: ".$name);
1072 show_error("Non-existent class: ".$class);
1075 // Set the variable name we will assign the class to
1076 // Was a custom class name supplied? If so we'll use it
1077 $class = strtolower($class);
1079 if (is_null($object_name))
1081 $classvar = ( ! isset($this->_ci_varmap
[$class])) ? $class : $this->_ci_varmap
[$class];
1085 $classvar = $object_name;
1088 // Save the class name and object name
1089 $this->_ci_classes
[$class] = $classvar;
1091 // Instantiate the class
1092 $CI =& get_instance();
1093 if ($config !== NULL)
1095 $CI->$classvar = new $name($config);
1099 $CI->$classvar = new $name;
1103 // --------------------------------------------------------------------
1108 * The config/autoload.php file contains an array that permits sub-systems,
1109 * libraries, and helpers to be loaded automatically.
1114 private function _ci_autoloader()
1116 if (defined('ENVIRONMENT') AND file_exists(APPPATH
.'config/'.ENVIRONMENT
.'/autoload.php'))
1118 include(APPPATH
.'config/'.ENVIRONMENT
.'/autoload.php');
1122 include(APPPATH
.'config/autoload.php');
1125 if ( ! isset($autoload))
1130 // Autoload packages
1131 if (isset($autoload['packages']))
1133 foreach ($autoload['packages'] as $package_path)
1135 $this->add_package_path($package_path);
1139 // Load any custom config file
1140 if (count($autoload['config']) > 0)
1142 $CI =& get_instance();
1143 foreach ($autoload['config'] as $key => $val)
1145 $CI->config
->load($val);
1149 // Autoload helpers and languages
1150 foreach (array('helper', 'language') as $type)
1152 if (isset($autoload[$type]) AND count($autoload[$type]) > 0)
1154 $this->$type($autoload[$type]);
1158 // A little tweak to remain backward compatible
1159 // The $autoload['core'] item was deprecated
1160 if ( ! isset($autoload['libraries']) AND isset($autoload['core']))
1162 $autoload['libraries'] = $autoload['core'];
1166 if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0)
1168 // Load the database driver.
1169 if (in_array('database', $autoload['libraries']))
1172 $autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
1175 // Load all other libraries
1176 foreach ($autoload['libraries'] as $item)
1178 $this->library($item);
1183 if (isset($autoload['model']))
1185 $this->model($autoload['model']);
1189 // --------------------------------------------------------------------
1194 * Takes an object as input and converts the class variables to array key/vals
1199 protected function _ci_object_to_array($object)
1201 return (is_object($object)) ? get_object_vars($object) : $object;
1204 // --------------------------------------------------------------------
1207 * Get a reference to a specific library or model
1212 protected function &_ci_get_component($component)
1214 $CI =& get_instance();
1215 return $CI->$component;
1218 // --------------------------------------------------------------------
1223 * This function preps the name of various items to make loading them more reliable.
1229 protected function _ci_prep_filename($filename, $extension)
1231 if ( ! is_array($filename))
1233 return array(strtolower(str_replace('.php', '', str_replace($extension, '', $filename)).$extension));
1237 foreach ($filename as $key => $val)
1239 $filename[$key] = strtolower(str_replace('.php', '', str_replace($extension, '', $val)).$extension);
1247 /* End of file Loader.php */
1248 /* Location: ./system/core/Loader.php */