コード例 #1
0
 private static function _stGetConfigPath($class)
 {
     foreach (LoadInit::stPackagesLoad() as $package) {
         if (preg_match("/" . $package . "[[:alnum:]]{0,}/", $class, $match)) {
             $path = $GLOBALS["path"] . $package . "/conf/config.inc";
             if (is_file($path)) {
                 return $path;
             }
         }
     }
     return false;
 }
コード例 #2
0
ファイル: Core.php プロジェクト: jilgue/ownWebAppServices
 static function stGetClassesList($type)
 {
     $packageList = LoadInit::stPackagesLoad();
     $raidPath = $GLOBALS["path"];
     $ret = array();
     foreach ($packageList as $package) {
         $path = $raidPath . $package . "/" . $type . "/";
         if (!file_exists($path)) {
             continue;
         }
         $cmd = "ls " . $path . $package . "*";
         // $out no se borra se mantiene en el entorno de la función
         exec($cmd, $out);
     }
     foreach ($out as $scriptPath) {
         preg_match("#.*/([A-z]{1,})#", $scriptPath, $match);
         $ret[] = $match[1];
     }
     return $ret;
 }
コード例 #3
0
 private function _getConfigClasses()
 {
     if ($this->classes !== array()) {
         if (is_array($this->classes)) {
             $mainClasses = $this->classes;
         } else {
             // Esperemos que sea solo uno y que el resto de cosas hayan funcionado bien
             $mainClasses = (array) $this->classes;
         }
     } else {
         $classes = Core::stGetClassesList("classes");
         $packages = LoadInit::stPackagesLoad();
         $mainClasses = array_intersect($classes, $packages);
     }
     $ret = array();
     foreach ($mainClasses as $mainClass) {
         if (!method_exists($mainClass, "stGetFieldsConfig")) {
             continue;
         }
         $ret[$mainClass] = $mainClass::stGetFieldsConfig();
     }
     return $ret;
 }
コード例 #4
0
ファイル: LoadInit.php プロジェクト: jilgue/ownWebAppServices
    static function stAutoload($class)
    {
        $classPath = static::stGetClassPath($class);
        if ($classPath !== false) {
            require_once $classPath;
        }
    }
    static function stPackagesLoad()
    {
        static $stCache = array();
        if (isset($stCache["packageList"])) {
            return $stCache["packageList"];
        }
        // Trapi autoload del config de Load
        require_once dirname(__FILE__) . '/../conf/config.inc';
        $cmd = "ls -d " . $config["path"] . "*/";
        exec($cmd, $out);
        $ret = array();
        foreach ($out as $path) {
            preg_match("#.*/([A-z]{1,}[^/])#", $path, $match);
            $ret[] = $match[1];
        }
        // Guardamos en "cache" la lista de paquetes y el path
        $GLOBALS["path"] = $config["path"];
        $stCache["packageList"] = $ret;
        return $ret;
    }
}
spl_autoload_register(array("LoadInit", "stAutoload"));
LoadInit::stPackagesLoad();