Changeset 648 for trunk/system/libraries/Loader.php
- Timestamp:
- 10/04/2007 03:32:31 PM (14 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/Loader.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Loader.php
r644 r648 35 35 public function library($name, $config = array()) 36 36 { 37 if (isset(Kohana::instance()->$name)) 38 return FALSE; 39 37 40 Kohana::instance()->$name = Kohana::load_class(ucfirst($name), $config); 38 41 } … … 40 43 public function database($group = 'default', $return = FALSE) 41 44 { 45 // Return the new database object 42 46 if ($return == TRUE) 43 47 { … … 46 50 else 47 51 { 52 // Set the database object to Controller->db 48 53 Kohana::instance()->db = new Database($group); 49 54 } … … 52 57 public function helper($name) 53 58 { 59 // Allow recursive loading 54 60 if (is_array($name)) 55 61 { … … 69 75 public function model($name, $alias = FALSE) 70 76 { 77 // The alias is used for Controller->alias 71 78 $alias = ($alias == FALSE) ? $name : $alias; 79 80 if (isset(Kohana::instance()->$alias)) 81 return FALSE; 82 83 // Load the model 72 84 Kohana::instance()->$alias = Kohana::load_class(ucfirst($name).'_Model'); 85 86 // Load Database into the DB 73 87 Kohana::instance()->$alias->db = (isset(Kohana::instance()->db)) ? Kohana::instance()->db : new Database('default'); 74 88 } … … 76 90 public function view($name, $data = array()) 77 91 { 92 // Fancy! *wink* 78 93 return new View($name, $data); 79 94 }
