/** * Loads a class file from the libraries folder. * * Contrary to library(), it does not instantiate the class. * * @access public * @param string The file name ( + optional path) * @return void */ function class_file($file = '') { Finder::load_file($file, 'libraries'); }
/** * Static accessor for all models. * * @param string The path to the file relative to the models dir * @param string The database connection to use * @return object */ function &Model($model, $db_conn = '') { static $models = array(); // already loaded? if (isset($models[$model])) { return $models[$model]; } if (!class_exists('Model')) { load_class('Model', 'core'); } if (!Finder::load_file($model, 'models', false)) { show_error('Unable to locate the model you have specified: ' . $model); } if (($p = strrpos($model, '/')) !== false) { $model = substr($model, $p + 1); } // $model .= '_Model'; $models[$model] = new $model(); // load the database if ($db_conn !== false) { $models[$model]->db = Lib('loader')->database($db_conn === true ? '' : $db_conn, true); } // reference other libs // $models[$model]->_assign_libraries(); return $models[$model]; }