blob: 2de2bd7f2edfb5a3f7fa1db6408a40e787829b49 [file] [log] [blame]
Derek Allard02658572007-12-20 14:00:50 +00001<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2/**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 4.3.2 or newer
6 *
7 * @package CodeIgniter
8 * @author Rick Ellis
9 * @copyright Copyright (c) 2006, EllisLab, Inc.
10 * @license http://www.codeigniter.com/user_guide/license.html
11 * @link http://www.codeigniter.com
12 * @since Version 1.0
13 * @filesource
14 */
15
16// ------------------------------------------------------------------------
17
18/**
19 * Loader Class
20 *
21 * Loads views and files
22 *
23 * @package CodeIgniter
24 * @subpackage Libraries
25 * @author Rick Ellis
26 * @category Loader
27 * @link http://www.codeigniter.com/user_guide/libraries/loader.html
28 */
29class CI_Loader {
30
31 // All these are set automatically. Don't mess with them.
32 var $_ci_ob_level;
33 var $_ci_view_path = '';
34 var $_ci_is_php5 = FALSE;
35 var $_ci_is_instance = FALSE; // Whether we should use $this or $CI =& get_instance()
36 var $_ci_cached_vars = array();
37 var $_ci_classes = array();
38 var $_ci_models = array();
39 var $_ci_helpers = array();
40 var $_ci_plugins = array();
41 var $_ci_scripts = array();
42 var $_ci_varmap = array('unit_test' => 'unit', 'user_agent' => 'agent');
43
44
45 /**
46 * Constructor
47 *
48 * Sets the path to the view files and gets the initial output buffering level
49 *
50 * @access public
51 */
52 function CI_Loader()
53 {
54 $this->_ci_is_php5 = (floor(phpversion()) >= 5) ? TRUE : FALSE;
55 $this->_ci_view_path = APPPATH.'views/';
56 $this->_ci_ob_level = ob_get_level();
57
58 log_message('debug', "Loader Class Initialized");
59 }
60
61 // --------------------------------------------------------------------
62
63 /**
64 * Class Loader
65 *
66 * This function lets users load and instantiate classes.
67 * It is designed to be called from a user's app controllers.
68 *
69 * @access public
70 * @param string the name of the class
71 * @param mixed the optional parameters
72 * @return void
73 */
74 function library($library = '', $params = NULL)
75 {
76 if ($library == '')
77 {
78 return FALSE;
79 }
80
81 if (is_array($library))
82 {
83 foreach ($library as $class)
84 {
85 $this->_ci_load_class($class, $params);
86 }
87 }
88 else
89 {
90 $this->_ci_load_class($library, $params);
91 }
92
93 $this->_ci_assign_to_models();
94 }
95
96 // --------------------------------------------------------------------
97
98 /**
99 * Model Loader
100 *
101 * This function lets users load and instantiate models.
102 *
103 * @access public
104 * @param string the name of the class
105 * @param mixed any initialization parameters
106 * @return void
107 */
108 function model($model, $name = '', $db_conn = FALSE)
109 {
110 if (is_array($model))
111 {
112 foreach($model as $babe)
113 {
114 $this->model($babe);
115 }
116 return;
117 }
118
119 if ($model == '')
120 {
121 return;
122 }
123
124 // Is the model in a sub-folder? If so, parse out the filename and path.
125 if (strpos($model, '/') === FALSE)
126 {
127 $path = '';
128 }
129 else
130 {
131 $x = explode('/', $model);
132 $model = end($x);
133 unset($x[count($x)-1]);
134 $path = implode('/', $x).'/';
135 }
136
137 if ($name == '')
138 {
139 $name = $model;
140 }
141
142 if (in_array($name, $this->_ci_models, TRUE))
143 {
144 return;
145 }
146
147 $CI =& get_instance();
148 if (isset($CI->$name))
149 {
150 show_error('The model name you are loading is the name of a resource that is already being used: '.$name);
151 }
152
153 $model = strtolower($model);
154
155 if ( ! file_exists(APPPATH.'models/'.$path.$model.EXT))
156 {
157 show_error('Unable to locate the model you have specified: '.$model);
158 }
159
160 if ($db_conn !== FALSE AND ! class_exists('CI_DB'))
161 {
162 if ($db_conn === TRUE)
163 $db_conn = '';
164
165 $CI->load->database($db_conn, FALSE, TRUE);
166 }
167
168 if ( ! class_exists('Model'))
169 {
170 require_once(BASEPATH.'libraries/Model'.EXT);
171 }
172
173 require_once(APPPATH.'models/'.$path.$model.EXT);
174
175 $model = ucfirst($model);
176
177 $CI->$name = new $model();
178 $CI->$name->_assign_libraries();
179
180 $this->_ci_models[] = $name;
181 }
182
183 // --------------------------------------------------------------------
184
185 /**
186 * Database Loader
187 *
188 * @access public
189 * @param string the DB credentials
190 * @param bool whether to return the DB object
191 * @param bool whether to enable active record (this allows us to override the config setting)
192 * @return object
193 */
194 function database($params = '', $return = FALSE, $active_record = FALSE)
195 {
196 // Do we even need to load the database class?
197 if (class_exists('CI_DB') AND $return == FALSE AND $active_record == FALSE)
198 {
199 return FALSE;
200 }
201
202 require_once(BASEPATH.'database/DB'.EXT);
203
204 if ($return === TRUE)
205 {
206 return DB($params, $active_record);
207 }
208
209 // Grab the super object
210 $CI =& get_instance();
211
212 // Initialize the db variable. Needed to prevent
213 // reference errors with some configurations
214 $CI->db = '';
215
216 // Load the DB class
217 $CI->db =& DB($params, $active_record);
218
219 // Assign the DB object to any existing models
220 $this->_ci_assign_to_models();
221 }
222
223 // --------------------------------------------------------------------
224
225 /**
226 * Load the Utilities Class
227 *
228 * @access public
229 * @return string
230 */
231 function dbutil()
232 {
233 if ( ! class_exists('CI_DB'))
234 {
235 $this->database();
236 }
237
238 $CI =& get_instance();
239
240 require_once(BASEPATH.'database/DB_utility'.EXT);
241 require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_utility'.EXT);
242 $class = 'CI_DB_'.$CI->db->dbdriver.'_utility';
243
244 $CI->dbutil = new $class();
245 $CI->load->_ci_assign_to_models();
246 }
247
248 // --------------------------------------------------------------------
249
250 /**
251 * Load View
252 *
253 * This function is used to load a "view" file. It has three parameters:
254 *
255 * 1. The name of the "view" file to be included.
256 * 2. An associative array of data to be extracted for use in the view.
257 * 3. TRUE/FALSE - whether to return the data or load it. In
258 * some cases it's advantageous to be able to return data so that
259 * a developer can process it in some way.
260 *
261 * @access public
262 * @param string
263 * @param array
264 * @param bool
265 * @return void
266 */
267 function view($view, $vars = array(), $return = FALSE)
268 {
269 return $this->_ci_load(array('view' => $view, 'vars' => $this->_ci_object_to_array($vars), 'return' => $return));
270 }
271
272 // --------------------------------------------------------------------
273
274 /**
275 * Load File
276 *
277 * This is a generic file loader
278 *
279 * @access public
280 * @param string
281 * @param bool
282 * @return string
283 */
284 function file($path, $return = FALSE)
285 {
286 return $this->_ci_load(array('path' => $path, 'return' => $return));
287 }
288
289 // --------------------------------------------------------------------
290
291 /**
292 * Set Variables
293 *
294 * Once variables are set they become available within
295 * the controller class and its "view" files.
296 *
297 * @access public
298 * @param array
299 * @return void
300 */
301 function vars($vars = array())
302 {
303 $vars = $this->_ci_object_to_array($vars);
304
305 if (is_array($vars) AND count($vars) > 0)
306 {
307 foreach ($vars as $key => $val)
308 {
309 $this->_ci_cached_vars[$key] = $val;
310 }
311 }
312 }
313
314 // --------------------------------------------------------------------
315
316 /**
317 * Load Helper
318 *
319 * This function loads the specified helper file.
320 *
321 * @access public
322 * @param mixed
323 * @return void
324 */
325 function helper($helpers = array())
326 {
327 if ( ! is_array($helpers))
328 {
329 $helpers = array($helpers);
330 }
331
332 foreach ($helpers as $helper)
333 {
334 $helper = strtolower(str_replace(EXT, '', str_replace('_helper', '', $helper)).'_helper');
335
336 if (isset($this->_ci_helpers[$helper]))
337 {
338 continue;
339 }
340
341 if (file_exists(APPPATH.'helpers/'.$helper.EXT))
342 {
343 include_once(APPPATH.'helpers/'.$helper.EXT);
344 }
345 else
346 {
347 if (file_exists(BASEPATH.'helpers/'.$helper.EXT))
348 {
349 include(BASEPATH.'helpers/'.$helper.EXT);
350 }
351 else
352 {
353 show_error('Unable to load the requested file: helpers/'.$helper.EXT);
354 }
355 }
356
357 $this->_ci_helpers[$helper] = TRUE;
358
359 }
360
361 log_message('debug', 'Helpers loaded: '.implode(', ', $helpers));
362 }
363
364 // --------------------------------------------------------------------
365
366 /**
367 * Load Helpers
368 *
369 * This is simply an alias to the above function in case the
370 * user has written the plural form of this function.
371 *
372 * @access public
373 * @param array
374 * @return void
375 */
376 function helpers($helpers = array())
377 {
378 $this->helper($helpers);
379 }
380
381 // --------------------------------------------------------------------
382
383 /**
384 * Load Plugin
385 *
386 * This function loads the specified plugin.
387 *
388 * @access public
389 * @param array
390 * @return void
391 */
392 function plugin($plugins = array())
393 {
394 if ( ! is_array($plugins))
395 {
396 $plugins = array($plugins);
397 }
398
399 foreach ($plugins as $plugin)
400 {
401 $plugin = strtolower(str_replace(EXT, '', str_replace('_plugin.', '', $plugin)).'_pi');
402
403 if (isset($this->_ci_plugins[$plugin]))
404 {
405 continue;
406 }
407
408 if (file_exists(APPPATH.'plugins/'.$plugin.EXT))
409 {
410 include(APPPATH.'plugins/'.$plugin.EXT);
411 }
412 else
413 {
414 if (file_exists(BASEPATH.'plugins/'.$plugin.EXT))
415 {
416 include(BASEPATH.'plugins/'.$plugin.EXT);
417 }
418 else
419 {
420 show_error('Unable to load the requested file: plugins/'.$plugin.EXT);
421 }
422 }
423
424 $this->_ci_plugins[$plugin] = TRUE;
425 }
426
427 log_message('debug', 'Plugins loaded: '.implode(', ', $plugins));
428 }
429
430 // --------------------------------------------------------------------
431
432 /**
433 * Load Plugins
434 *
435 * This is simply an alias to the above function in case the
436 * user has written the plural form of this function.
437 *
438 * @access public
439 * @param array
440 * @return void
441 */
442 function plugins($plugins = array())
443 {
444 $this->plugin($plugins);
445 }
446
447 // --------------------------------------------------------------------
448
449 /**
450 * Load Script
451 *
452 * This function loads the specified include file from the
453 * application/scripts/ folder.
454 *
455 * NOTE: This feature has been deprecated but it will remain available
456 * for legacy users.
457 *
458 * @access public
459 * @param array
460 * @return void
461 */
462 function script($scripts = array())
463 {
464 if ( ! is_array($scripts))
465 {
466 $scripts = array($scripts);
467 }
468
469 foreach ($scripts as $script)
470 {
471 $script = strtolower(str_replace(EXT, '', $script));
472
473 if (isset($this->_ci_scripts[$script]))
474 {
475 continue;
476 }
477
478 if ( ! file_exists(APPPATH.'scripts/'.$script.EXT))
479 {
480 show_error('Unable to load the requested script: scripts/'.$script.EXT);
481 }
482
483 include(APPPATH.'scripts/'.$script.EXT);
484 }
485
486 log_message('debug', 'Scripts loaded: '.implode(', ', $scripts));
487 }
488
489 // --------------------------------------------------------------------
490
491 /**
492 * Loads a language file
493 *
494 * @access public
495 * @param array
496 * @param string
497 * @return void
498 */
499 function language($file = array(), $lang = '')
500 {
501 $CI =& get_instance();
502
503 if ( ! is_array($file))
504 {
505 $file = array($file);
506 }
507
508 foreach ($file as $langfile)
509 {
510 $CI->lang->load($langfile, $lang);
511 }
512 }
513
514 /**
515 * Loads language files for scaffolding
516 *
517 * @access public
518 * @param string
519 * @return arra
520 */
521 function scaffold_language($file = '', $lang = '', $return = FALSE)
522 {
523 $CI =& get_instance();
524 return $CI->lang->load($file, $lang, $return);
525 }
526
527 // --------------------------------------------------------------------
528
529 /**
530 * Loads a config file
531 *
532 * @access public
533 * @param string
534 * @return void
535 */
536 function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
537 {
538 $CI =& get_instance();
539 $CI->config->load($file, $use_sections, $fail_gracefully);
540 }
541
542 // --------------------------------------------------------------------
543
544 /**
545 * Scaffolding Loader
546 *
547 * This initializing function works a bit different than the
548 * others. It doesn't load the class. Instead, it simply
549 * sets a flag indicating that scaffolding is allowed to be
550 * used. The actual scaffolding function below is
551 * called by the front controller based on whether the
552 * second segment of the URL matches the "secret" scaffolding
553 * word stored in the application/config/routes.php
554 *
555 * @access public
556 * @param string
557 * @return void
558 */
559 function scaffolding($table = '')
560 {
561 if ($table === FALSE)
562 {
563 show_error('You must include the name of the table you would like to access when you initialize scaffolding');
564 }
565
566 $CI =& get_instance();
567 $CI->_ci_scaffolding = TRUE;
568 $CI->_ci_scaff_table = $table;
569 }
570
571 // --------------------------------------------------------------------
572
573 /**
574 * Loader
575 *
576 * This function is used to load views and files.
577 *
578 * @access private
579 * @param array
580 * @return void
581 */
582 function _ci_load($data)
583 {
584 // Set the default data variables
585 foreach (array('view', 'vars', 'path', 'return') as $val)
586 {
587 $$val = ( ! isset($data[$val])) ? FALSE : $data[$val];
588 }
589
590 // Set the path to the requested file
591 if ($path == '')
592 {
593 $ext = pathinfo($view, PATHINFO_EXTENSION);
594 $file = ($ext == '') ? $view.EXT : $view;
595 $path = $this->_ci_view_path.$file;
596 }
597 else
598 {
599 $x = explode('/', $path);
600 $file = end($x);
601 }
602
603 if ( ! file_exists($path))
604 {
605 show_error('Unable to load the requested file: '.$file);
606 }
607
608 // This allows anything loaded using $this->load (views, files, etc.)
609 // to become accessible from within the Controller and Model functions.
610 // Only needed when running PHP 5
611
612 if ($this->_ci_is_instance())
613 {
614 $CI =& get_instance();
615 foreach (get_object_vars($CI) as $key => $var)
616 {
617 if ( ! isset($this->$key))
618 {
619 $this->$key =& $CI->$key;
620 }
621 }
622 }
623
624 /*
625 * Extract and cache variables
626 *
627 * You can either set variables using the dedicated $this->load_vars()
628 * function or via the second parameter of this function. We'll merge
629 * the two types and cache them so that views that are embedded within
630 * other views can have access to these variables.
631 */
632 if (is_array($vars))
633 {
634 $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $vars);
635 }
636 extract($this->_ci_cached_vars);
637
638 /*
639 * Buffer the output
640 *
641 * We buffer the output for two reasons:
642 * 1. Speed. You get a significant speed boost.
643 * 2. So that the final rendered template can be
644 * post-processed by the output class. Why do we
645 * need post processing? For one thing, in order to
646 * show the elapsed page load time. Unless we
647 * can intercept the content right before it's sent to
648 * the browser and then stop the timer it won't be accurate.
649 */
650 ob_start();
651
652 // If the PHP installation does not support short tags we'll
653 // do a little string replacement, changing the short tags
654 // to standard PHP echo statements.
655
656 if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE)
657 {
658 echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('<?=', '<?php echo ', file_get_contents($path))).'<?php ');
659 }
660 else
661 {
662 include($path);
663 }
664
665 log_message('debug', 'File loaded: '.$path);
666
667 // Return the file data if requested
668 if ($return === TRUE)
669 {
670 $buffer = ob_get_contents();
671 @ob_end_clean();
672 return $buffer;
673 }
674
675 /*
676 * Flush the buffer... or buff the flusher?
677 *
678 * In order to permit views to be nested within
679 * other views, we need to flush the content back out whenever
680 * we are beyond the first level of output buffering so that
681 * it can be seen and included properly by the first included
682 * template and any subsequent ones. Oy!
683 *
684 */
685 if (ob_get_level() > $this->_ci_ob_level + 1)
686 {
687 ob_end_flush();
688 }
689 else
690 {
691 // PHP 4 requires that we use a global
692 global $OUT;
693 $OUT->set_output(ob_get_contents());
694 @ob_end_clean();
695 }
696 }
697
698 // --------------------------------------------------------------------
699
700 /**
701 * Load class
702 *
703 * This function loads the requested class.
704 *
705 * @access private
706 * @param string the item that is being loaded
707 * @param mixed any additional parameters
708 * @return void
709 */
710 function _ci_load_class($class, $params = NULL)
711 {
712 // Get the class name
713 $class = str_replace(EXT, '', $class);
714
715 // We'll test for both lowercase and capitalized versions of the file name
716 foreach (array(ucfirst($class), strtolower($class)) as $class)
717 {
718 $subclass = APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT;
719
720 // Is this a class extension request?
721 if (file_exists($subclass))
722 {
723 $baseclass = BASEPATH.'libraries/'.ucfirst($class).EXT;
724
725 if ( ! file_exists($baseclass))
726 {
727 log_message('error', "Unable to load the requested class: ".$class);
728 show_error("Unable to load the requested class: ".$class);
729 }
730
731 // Safety: Was the class already loaded by a previous call?
732 if (in_array($subclass, $this->_ci_classes))
733 {
734 $is_duplicate = TRUE;
735 log_message('debug', $class." class already loaded. Second attempt ignored.");
736 return;
737 }
738
739 include($baseclass);
740 include($subclass);
741 $this->_ci_classes[] = $subclass;
742
743 return $this->_ci_init_class($class, config_item('subclass_prefix'), $params);
744 }
745
746 // Lets search for the requested library file and load it.
747 $is_duplicate = FALSE;
748 for ($i = 1; $i < 3; $i++)
749 {
750 $path = ($i % 2) ? APPPATH : BASEPATH;
751 $filepath = $path.'libraries/'.$class.EXT;
752
753 // Does the file exist? No? Bummer...
754 if ( ! file_exists($filepath))
755 {
756 continue;
757 }
758
759 // Safety: Was the class already loaded by a previous call?
760 if (in_array($filepath, $this->_ci_classes))
761 {
762 $is_duplicate = TRUE;
763 log_message('debug', $class." class already loaded. Second attempt ignored.");
764 return;
765 }
766
767 include($filepath);
768 $this->_ci_classes[] = $filepath;
769 return $this->_ci_init_class($class, '', $params);
770 }
771 } // END FOREACH
772
773 // If we got this far we were unable to find the requested class.
774 // We do not issue errors if the load call failed due to a duplicate request
775 if ($is_duplicate == FALSE)
776 {
777 log_message('error', "Unable to load the requested class: ".$class);
778 show_error("Unable to load the requested class: ".$class);
779 }
780 }
781
782 // --------------------------------------------------------------------
783
784 /**
785 * Instantiates a class
786 *
787 * @access private
788 * @param string
789 * @param string
790 * @return null
791 */
792 function _ci_init_class($class, $prefix = '', $config = FALSE)
793 {
794 // Is there an associated config file for this class?
795 if ($config === NULL)
796 {
797 if (file_exists(APPPATH.'config/'.$class.EXT))
798 {
799 include(APPPATH.'config/'.$class.EXT);
800 }
801 }
802
803 if ($prefix == '')
804 {
805 $name = (class_exists('CI_'.$class)) ? 'CI_'.$class : $class;
806 }
807 else
808 {
809 $name = $prefix.$class;
810 }
811
812 // Set the variable name we will assign the class to
813 $class = strtolower($class);
814 $classvar = ( ! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class];
815
816 // Instantiate the class
817 $CI =& get_instance();
818 if ($config !== NULL)
819 {
820 $CI->$classvar = new $name($config);
821 }
822 else
823 {
824 $CI->$classvar = new $name;
825 }
826 }
827
828 // --------------------------------------------------------------------
829
830 /**
831 * Autoloader
832 *
833 * The config/autoload.php file contains an array that permits sub-systems,
834 * libraries, plugins, and helpers to be loaded automatically.
835 *
836 * @access private
837 * @param array
838 * @return void
839 */
840 function _ci_autoloader()
841 {
842 include(APPPATH.'config/autoload'.EXT);
843
844 if ( ! isset($autoload))
845 {
846 return FALSE;
847 }
848
849 // Load any custom config file
850 if (count($autoload['config']) > 0)
851 {
852 $CI =& get_instance();
853 foreach ($autoload['config'] as $key => $val)
854 {
855 $CI->config->load($val);
856 }
857 }
858
859 // Autoload plugins, helpers, scripts and languages
860 foreach (array('helper', 'plugin', 'script', 'language') as $type)
861 {
862 if (isset($autoload[$type]) AND count($autoload[$type]) > 0)
863 {
864 $this->$type($autoload[$type]);
865 }
866 }
867
868 // Autoload models
869 if (isset($autoload['model']))
870 {
871 $this->model($autoload['model']);
872 }
873
874 // A little tweak to remain backward compatible
875 // The $autoload['core'] item was deprecated
876 if ( ! isset($autoload['libraries']))
877 {
878 $autoload['libraries'] = $autoload['core'];
879 }
880
881 // Load libraries
882 if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0)
883 {
884 // Load the database driver.
885 if (in_array('database', $autoload['libraries']))
886 {
887 $this->database();
888 $autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
889 }
890
891 // Load scaffolding
892 if (in_array('scaffolding', $autoload['libraries']))
893 {
894 $this->scaffolding();
895 $autoload['libraries'] = array_diff($autoload['libraries'], array('scaffolding'));
896 }
897
898 // Load all other libraries
899 foreach ($autoload['libraries'] as $item)
900 {
901 $this->library($item);
902 }
903
904 // Load the model class.
905 if (in_array('model', $autoload['libraries']))
906 {
907 $this->model();
908 $autoload['libraries'] = array_diff($autoload['libraries'], array('model'));
909 }
910 }
911 }
912
913 // --------------------------------------------------------------------
914
915 /**
916 * Assign to Models
917 *
918 * Makes sure that anything loaded by the loader class (libraries, plugins, etc.)
919 * will be available to models, if any exist.
920 *
921 * @access private
922 * @param object
923 * @return array
924 */
925 function _ci_assign_to_models()
926 {
927 if (count($this->_ci_models) == 0)
928 {
929 return;
930 }
931
932 if ($this->_ci_is_instance())
933 {
934 $CI =& get_instance();
935 foreach ($this->_ci_models as $model)
936 {
937 $CI->$model->_assign_libraries();
938 }
939 }
940 else
941 {
942 foreach ($this->_ci_models as $model)
943 {
944 $this->$model->_assign_libraries();
945 }
946 }
947 }
948
949 // --------------------------------------------------------------------
950
951 /**
952 * Object to Array
953 *
954 * Takes an object as input and converts the class variables to array key/vals
955 *
956 * @access private
957 * @param object
958 * @return array
959 */
960 function _ci_object_to_array($object)
961 {
962 return (is_object($object)) ? get_object_vars($object) : $object;
963 }
964
965 // --------------------------------------------------------------------
966
967 /**
968 * Determines whether we should use the CI instance or $this
969 *
970 * @access private
971 * @return bool
972 */
973 function _ci_is_instance()
974 {
975 if ($this->_ci_is_php5 == TRUE)
976 {
977 return TRUE;
978 }
979
980 global $CI;
981 return (is_object($CI)) ? TRUE : FALSE;
982 }
983
984}
985?>