KumbiaPHP  beta2
Framework PHP
 Todo Estructuras de Datos Namespaces Archivos Funciones Variables Páginas
load.php
Ir a la documentación de este archivo.
1 <?php
32 class Load
33 {
34 
41  public static function lib($lib)
42  {
43  $file = APP_PATH . "libs/$lib.php";
44  if (is_file($file)) {
45  return include $file;
46  } else {
47  return self::coreLib($lib);
48  }
49  }
50 
57  public static function coreLib($lib)
58  {
59  if (!include CORE_PATH . "libs/$lib/$lib.php") {
60  throw new KumbiaException("Librería: \"$lib\" no encontrada");
61  }
62  }
63 
71  public static function model($model, $params = NULL)
72  {
73  //Nombre de la clase
74  $Model = Util::camelcase(basename($model));
75  //Si no esta cargada la clase
76  if (!class_exists($Model, FALSE)) {
77  //Carga la clase
78  if (!include APP_PATH . "models/$model.php") {
79  throw new KumbiaException($model,'no_model');
80  }
81  }
82  return new $Model($params);
83  }
84 
91  public static function models($model)
92  {
93  $args = is_array($model) ? $model : func_get_args();
94  foreach ($args as $model) {
95  $Model = Util::camelcase(basename($model));
96  //Si esta cargada continua con la siguiente clase
97  if (class_exists($Model, FALSE)) continue;
98  if (!include APP_PATH . "models/$model.php") {
99  throw new KumbiaException($model,'no_model');
100  }
101  }
102  }
103 }