Exemplo n.º 1
0
 /**
  * faz a importacao automatica de classes (autoload)
  *
  * @see http://br2.php.net/manual/pt_BR/function.spl-autoload-register.php
  * @param string $clname
  */
 public static function autoload($clname)
 {
     $args = func_get_args();
     $cn = Lumine_ConnectionManager::getInstance();
     $list = $cn->getConfigurationList();
     foreach ($list as $cfg) {
         $sufix = $cfg->getOption('class_sufix');
         $pacote = $cfg->getProperty('package');
         $path = $cfg->getProperty('class_path');
         $ext = (empty($sufix) ? '' : '.' . $sufix) . '.php';
         if (!empty($pacote)) {
             $pacote .= '.';
         }
         $fullpath = str_replace('.', '/', $path . '/' . $pacote . $clname);
         $fullpath .= $ext;
         if (file_exists($fullpath)) {
             Lumine_Util::import($pacote . $clname);
             return;
         }
     }
 }