コード例 #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
 protected function _getCallableMethod()
 {
     $class = LoadInit::stGetClassCaseInsensitive($this->object);
     $func = $this->function;
     $obj = $class::stVirtualConstructor();
     // Permitimos que no pasen la funcion tan cual
     if (!method_exists($obj, $func)) {
         $func = "st" . ucfirst($this->function);
     }
     if (!method_exists($obj, $func)) {
         LogsErrors::stCreate(array("errorCode" => APIRESTResponseJSONPage::ERROR_CODE_INVALID_FUNCTION_PARAM, "function" => "_getFunctionParams"));
         return array();
     }
     return array($class, $func);
 }
コード例 #3
0
 private function _loadSearchParams($params)
 {
     $class = LoadInit::stGetClassCaseInsensitive($this->object);
     var_dump($class, $params);
     die;
     foreach ($params as $param => $value) {
         if (isset(EDISubscriptionLog::stObjToDBFields()[$param])) {
             $this->searchParams["filters"][$param] = $value;
             // Quitamos el parametro para que no lo carge el autoload del padre
             unset($params[$param]);
         }
         if ($param == "order") {
             $this->searchParams["order"][$param] = $value;
             // Quitamos el parametro para que no lo carge el autoload del padre
             unset($params[$param]);
         }
     }
     return $params;
 }
コード例 #4
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;
 }
コード例 #5
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;
 }
コード例 #6
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();