KumbiaPHP beta2-dev
Framework PHP en español
load.php
Ir a la documentación de este archivo.
00001 <?php
00022 class Load
00023 {
00030     public static function lib ($lib)
00031     {
00032                 $file = APP_PATH . "libs/$lib.php";
00033                 if (is_file($file)) {
00034                         return require_once $file;
00035                 } else {
00036             return self::coreLib($lib);
00037                 }
00038     }
00039 
00046     public static function coreLib ($lib)
00047     {
00048                 if (! include_once CORE_PATH . "libs/$lib/$lib.php") {
00049                         throw new KumbiaException("Librería: \"$lib\" no encontrada");
00050                 }
00051     }
00059     public static function model ($model, $params = NULL)
00060     {
00061         //Nombre de la clase
00062         $Model = Util::camelcase(basename($model));
00063         //Carga la clase
00064         if (! class_exists($Model, FALSE)) {
00065             //Carga la clase
00066             if (! include_once APP_PATH . "models/$model.php") {
00067                 throw new KumbiaException("No existe el modelo $model");
00068             }
00069         }
00070         return new $Model($params);
00071     }
00078     public static function models ($model)
00079     {
00080         if (is_array($model)) {
00081             $args = $model;
00082         } else {
00083             $args = func_get_args();
00084         }
00085         foreach ($args as $model) {
00086             $file = APP_PATH . "models/$model.php";
00087             if (is_file($file)) {
00088                 include_once $file;
00089             } else {
00090                 throw new KumbiaException("Modelo $model no encontrado");
00091             }
00092         }
00093     }
00094 }
 Todo Estructuras de Datos Namespaces Archivos Funciones Variables Enumeraciones