diff options
author | admin <devnull@localhost> | 2006-09-26 05:52:45 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-09-26 05:52:45 +0200 |
commit | e79dc7130a0003a07833609487b8ebb5ebcf31c8 (patch) | |
tree | 8400c41761ddcd7a9338637eefc9429d501d87ff /system/libraries | |
parent | 30c3b9709a12b7346c7057e656a491ffb9168f55 (diff) |
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Calendar.php | 7 | ||||
-rw-r--r-- | system/libraries/Controller.php | 42 | ||||
-rw-r--r-- | system/libraries/Email.php | 5 | ||||
-rw-r--r-- | system/libraries/Encrypt.php | 5 | ||||
-rw-r--r-- | system/libraries/Image_lib.php | 11 | ||||
-rw-r--r-- | system/libraries/Loader.php | 20 | ||||
-rw-r--r-- | system/libraries/Model.php | 9 | ||||
-rw-r--r-- | system/libraries/Pagination.php | 11 | ||||
-rw-r--r-- | system/libraries/Parser.php | 5 | ||||
-rw-r--r-- | system/libraries/Session.php | 5 | ||||
-rw-r--r-- | system/libraries/Trackback.php | 5 | ||||
-rw-r--r-- | system/libraries/Unit_test.php | 5 | ||||
-rw-r--r-- | system/libraries/Upload.php | 11 | ||||
-rw-r--r-- | system/libraries/Validation.php | 5 | ||||
-rw-r--r-- | system/libraries/Xmlrpc.php | 13 | ||||
-rw-r--r-- | system/libraries/Xmlrpcs.php | 33 |
16 files changed, 151 insertions, 41 deletions
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index b77dd1b6f..a3c070390 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -13,6 +13,11 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$obj =& get_instance(); +$obj->calendar =& new CI_Calendar(); + // ------------------------------------------------------------------------ /** @@ -25,7 +30,7 @@ * @category Libraries * @author Rick Ellis * @link http://www.codeigniter.com/user_guide/libraries/calendar.html - */ + */ class CI_Calendar { var $lang; diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php index afd963a7a..97aa4b789 100644 --- a/system/libraries/Controller.php +++ b/system/libraries/Controller.php @@ -29,7 +29,6 @@ */ class Controller extends CI_Base { - var $ci_is_loaded = array(); var $_ci_models = array(); var $_ci_scaffolding = FALSE; var $_ci_scaff_table = FALSE; @@ -54,15 +53,18 @@ class Controller extends CI_Base { // This allows anything loaded using $this->load (viwes, files, etc.) // to become accessible from within the Controller class functions. - foreach ($this->ci_is_loaded as $val) + foreach (get_object_vars($this) as $key => $var) { - $this->load->$val =& $this->$val; + if (is_object($var)) + { + $this->load->$key =& $this->$key; + } } - + log_message('debug', "Controller Class Initialized"); } // END Controller() - + // -------------------------------------------------------------------- /** @@ -75,27 +77,28 @@ class Controller extends CI_Base { * @param mixed any additional parameters * @return void */ - function _ci_initialize($what, $params = FALSE) + function _ci_initialize($class, $params = FALSE) { - $method = '_ci_init_'.strtolower(str_replace(EXT, '', $what)); + $class = strtolower(str_replace(EXT, '', $class)); + $method = '_ci_init_'.$class; if ( ! method_exists($this, $method)) - { - $method = substr($method, 4); + { + $class = ucfirst($class); - if ( ! file_exists(APPPATH.'init/'.$method.EXT)) + if ( ! file_exists(APPPATH.'libraries/'.$class.EXT)) { - if ( ! file_exists(BASEPATH.'init/'.$method.EXT)) + if ( ! file_exists(BASEPATH.'libraries/'.$class.EXT)) { - log_message('error', "Unable to load the requested class: ".$what); - show_error("Unable to load the class: ".$what); + log_message('error', "Unable to load the requested class: ".$class); + show_error("Unable to load the class: ".$class); } - include(BASEPATH.'init/'.$method.EXT); + include_once(BASEPATH.'libraries/'.$class.EXT); } else { - include(APPPATH.'init/'.$method.EXT); + include_once(APPPATH.'libraries/'.$class.EXT); } } else @@ -268,11 +271,9 @@ class Controller extends CI_Base { { $class = strtolower($val); $this->$class =& _load_class('CI_'.$val); - $this->ci_is_loaded[] = $class; } $this->lang =& _load_class('CI_Language'); - $this->ci_is_loaded[] = 'lang'; // In PHP 4 the Controller class is a child of CI_Loader. // In PHP 5 we run it as its own class. @@ -280,8 +281,6 @@ class Controller extends CI_Base { { $this->load = new CI_Loader(); } - - $this->ci_is_loaded[] = 'load'; } // END _ci_assign_core() @@ -393,7 +392,6 @@ class Controller extends CI_Base { } $obj =& get_instance(); - $obj->ci_is_loaded[] = 'db'; $obj->db =& $DB; } // END _ci_init_database() @@ -409,10 +407,10 @@ class Controller extends CI_Base { */ function _ci_is_loaded($class) { - return ( ! in_array($class, $this->ci_is_loaded)) ? FALSE : TRUE; + return ( ! isset($this->$class) OR ! is_object($this->$class)) ? FALSE : TRUE; } // END _ci_is_loaded() - + // -------------------------------------------------------------------- /** diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 5b991d1fa..c153043d9 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -13,6 +13,11 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$obj =& get_instance(); +$obj->email =& new CI_Email(); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index bcffdf1ab..446f64aa6 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -13,6 +13,11 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$obj =& get_instance(); +$obj->encrypt =& new CI_Encrypt(); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 18e3253f7..86ed05943 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -13,6 +13,17 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$config = array(); +if (file_exists(APPPATH.'config/image_lib'.EXT)) +{ + include_once(APPPATH.'config/image_lib'.EXT); +} + +$obj =& get_instance(); +$obj->image_lib =& new CI_Image_lib($config); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php index 833e37640..7449fa34a 100644 --- a/system/libraries/Loader.php +++ b/system/libraries/Loader.php @@ -136,15 +136,9 @@ class CI_Loader { * @param bool whether to return the DB object * @return object */ - function dbutil($db = '', $return = FALSE) + function dbutil() { $obj =& get_instance(); - - if ( ! is_bool($return)) - { - $return = FALSE; - } - return $obj->_ci_init_dbutil($db, $return); } // END dbutils() @@ -484,14 +478,14 @@ class CI_Loader { // This allows anything loaded using $this->load (viwes, files, etc.) // to become accessible from within the Controller and Model functions. $obj =& get_instance(); - foreach ($obj->ci_is_loaded as $val) + foreach (get_object_vars($obj) as $key => $var) { - if ( ! isset($this->$val)) + if (is_object($var)) { - $this->$val =& $obj->$val; - } - } - + $this->$key =& $obj->$key; + } + } + // Set the default data variables foreach (array('view', 'vars', 'path', 'return') as $val) { diff --git a/system/libraries/Model.php b/system/libraries/Model.php index 9834f8278..55c995636 100644 --- a/system/libraries/Model.php +++ b/system/libraries/Model.php @@ -50,20 +50,21 @@ class Model { function _assign_libraries($use_reference = TRUE) { $obj =& get_instance(); - foreach ($obj->ci_is_loaded as $val) + foreach (get_object_vars($obj) as $key => $var) { - if ( ! isset($this->$val)) + if (is_object($var) AND ! isset($this->$key)) { if ($use_reference === TRUE) { - $this->$val =& $obj->$val; + $this->$key =& $obj->$key; } else { - $this->$val = $obj->$val; + $this->$key = $obj->$key; } } } + } // END _assign_libraries() diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 9d558f00a..d83a2bd0f 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -13,6 +13,17 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$config = array(); +if (file_exists(APPPATH.'config/pagination'.EXT)) +{ + include_once(APPPATH.'config/pagination'.EXT); +} + +$obj =& get_instance(); +$obj->pagination =& new CI_Pagination($config); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index 63dc023a2..5bc2eb5a3 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -13,6 +13,11 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$obj =& get_instance(); +$obj->parser =& new CI_Parser(); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 94efee55c..bcd2e4d7e 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -13,6 +13,11 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$obj =& get_instance(); +$obj->session =& new CI_Session(); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 8f9680d44..9b6138453 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -13,6 +13,11 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$obj =& get_instance(); +$obj->trackback =& new CI_Trackback(); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index b2f4bf8cd..19fac79a7 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -13,6 +13,11 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$obj =& get_instance(); +$obj->unit =& new CI_Unit_test(); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 98edd654f..26f216544 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -13,6 +13,17 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$config = array(); +if (file_exists(APPPATH.'config/upload'.EXT)) +{ + include_once(APPPATH.'config/upload'.EXT); +} + +$obj =& get_instance(); +$obj->upload = new CI_Upload($config); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index b65b9be52..6c755a991 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -13,6 +13,11 @@ * @filesource */ +// INITIALIZE THE CLASS --------------------------------------------------- + +$obj =& get_instance(); +$obj->validation =& new CI_Validation(); + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 9eeb46a15..b470f720a 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -18,6 +18,19 @@ if ( ! function_exists('xml_parser_create')) show_error('Your PHP installation does not support XML'); } +// INITIALIZE THE CLASS --------------------------------------------------- + +$config = array(); +if (file_exists(APPPATH.'config/xmlrpc'.EXT)) +{ + include_once(APPPATH.'config/xmlrpc'.EXT); +} + +$obj =& get_instance(); +$obj->xmlrpc = new CI_XML_RPC($config); + +// ------------------------------------------------------------------------ + /** * XML-RPC request handler class * diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index 0543c3b78..4d50dfb96 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -12,7 +12,38 @@ * @since Version 1.0 * @filesource */ - + + +// INITIALIZE THE CLASS --------------------------------------------------- + +$config = array(); +if (file_exists(APPPATH.'config/xmlrpcs'.EXT)) +{ + include_once(APPPATH.'config/xmlrpcs'.EXT); +} + +if ( ! class_exists('CI_XML_RPC')) +{ + if ( ! file_exists(BASEPATH.'libraries/Xmlrpc'.EXT)) + { + if ( ! file_exists(APPPATH.'libraries/Xmlrpc'.EXT)) + { + show_error('Unable to locate the Xmlrpc class'); + } + else + { + require_once(APPPATH.'libraries/Xmlrpc'.EXT); + } + } + else + { + require_once(BASEPATH.'libraries/Xmlrpc'.EXT); + } +} + +$obj =& get_instance(); +$obj->xmlrpcs = new CI_XML_RPC_Server($config); + // ------------------------------------------------------------------------ /** |