public function __construct($directory)
 {
     if (!php_Boot::$skip_constructor) {
         if (StringTools::startsWith($directory, "/")) {
             $directory = _hx_substr($directory, 1, strlen($directory));
         }
         if (StringTools::endsWith($directory, "/")) {
             $directory = _hx_substr($directory, 0, strlen($directory) - 1);
         }
         $this->directory = $directory;
         if ($directory !== "") {
             $this->segments = _hx_explode("/", $directory);
         } else {
             $this->segments = new _hx_array(array());
         }
     }
 }
Exemplo n.º 2
0
 public function loadPropertiesLine($line, $count)
 {
     $line = trim($line);
     if (strlen($line) === 0) {
         return;
     }
     if (StringTools::startsWith($line, ";") || StringTools::startsWith($line, "#")) {
         return;
     }
     $equals = _hx_index_of($line, "=", null);
     if ($equals === -1) {
         throw new HException("Malformed INI file " . $this->filename . " in line " . _hx_string_rec($count, "") . " no equal sign found.");
     }
     $key = _hx_substr($line, 0, $equals);
     $key = trim($key);
     $value = _hx_substr($line, $equals + 1, null);
     $value = trim($value);
     if (StringTools::startsWith($value, "\"") && StringTools::endsWith($value, "\"")) {
         $value = _hx_substr($value, 1, strlen($value) - 2);
     }
     $backslash = 0;
     while (($backslash = _hx_index_of($value, "\\", $backslash)) !== -1) {
         if (strlen($value) <= $backslash + 1) {
             continue;
         }
         $letter = _hx_substr($value, $backslash + 1, 1);
         if ($letter === "n") {
             $letter = "\n";
         } else {
             if ($letter === "r") {
                 $letter = "\r";
             } else {
                 if ($letter === "t") {
                     $letter = "\t";
                 }
             }
         }
         $value = _hx_substr($value, 0, $backslash) . $letter . _hx_substr($value, $backslash + 2, null);
         $backslash++;
         unset($letter);
     }
     $this->props->set($key, $value);
 }
Exemplo n.º 3
0
 static function main()
 {
     $files = sys_FileSystem::readDirectory("../images");
     $validimages = new _hx_array(array());
     $_g = 0;
     while ($_g < $files->length) {
         $it = $files[$_g];
         ++$_g;
         if (StringTools::endsWith($it, ".jpg") === true) {
             $validimages->push($it);
         } else {
             if (StringTools::endsWith($it, ".png") === true) {
                 $validimages->push($it);
             } else {
                 if (StringTools::endsWith($it, ".gif") === true) {
                     $validimages->push($it);
                 }
             }
         }
         unset($it);
     }
     php_Lib::println(haxe_Json::stringify($validimages, null));
 }
 static function stripArrayFromName($this1, $name)
 {
     if (StringTools::endsWith($name, "[]")) {
         return _hx_substr($name, 0, strlen($name) - 2);
     } else {
         return $name;
     }
 }
 public function __construct($optionsIn = null)
 {
     if (!php_Boot::$skip_constructor) {
         $this->appTemplatingEngines = new HList();
         $this->firstRun = true;
         parent::__construct();
         $this->configuration = ufront_app_DefaultUfrontConfiguration::get();
         $_g = 0;
         $_g1 = Reflect::fields($optionsIn);
         while ($_g < $_g1->length) {
             $field = $_g1[$_g];
             ++$_g;
             $value = Reflect::field($optionsIn, $field);
             $this->configuration->{$field} = $value;
             unset($value, $field);
         }
         $this->mvcHandler = new ufront_web_MVCHandler($this->configuration->indexController);
         $this->remotingHandler = new ufront_remoting_RemotingHandler();
         if ($this->configuration->remotingApi !== null) {
             $_this = $this->remotingHandler;
             $apiContext = $this->configuration->remotingApi;
             $_this->apiContexts->push($apiContext);
             $newAPIs = ufront_api_UFApiContext::getApisInContext($apiContext);
             if (null == $newAPIs) {
                 throw new HException('null iterable');
             }
             $__hx__it = $newAPIs->iterator();
             while ($__hx__it->hasNext()) {
                 unset($api);
                 $api = $__hx__it->next();
                 $_this->apis->push($api);
             }
         }
         if (null == $this->configuration->controllers) {
             throw new HException('null iterable');
         }
         $__hx__it = $this->configuration->controllers->iterator();
         while ($__hx__it->hasNext()) {
             unset($controller);
             $controller = $__hx__it->next();
             $this->injector->mapRuntimeTypeOf($controller, null)->_toClass($controller);
         }
         $this->addModule($this->requestMiddleware, null, $this->configuration->requestMiddleware, false);
         $this->addModule($this->requestHandlers, null, new _hx_array(array($this->remotingHandler, $this->mvcHandler)), false);
         $this->addModule($this->responseMiddleware, null, $this->configuration->responseMiddleware, true);
         $this->addModule($this->errorHandlers, null, $this->configuration->errorHandlers, false);
         if (!$this->configuration->disableServerTrace) {
             $logger = new ufront_log_ServerConsoleLogger();
             $this->addModule($this->logHandlers, $logger, null, false);
         }
         if (!$this->configuration->disableBrowserTrace) {
             $logger1 = new ufront_log_BrowserConsoleLogger();
             $this->addModule($this->logHandlers, $logger1, null, false);
             $logger2 = new ufront_log_RemotingLogger();
             $this->addModule($this->logHandlers, $logger2, null, false);
         }
         if (null !== $this->configuration->logFile) {
             $logger3 = new ufront_log_FileLogger($this->configuration->logFile);
             $this->addModule($this->logHandlers, $logger3, null, false);
         }
         $path = $this->configuration->basePath;
         if (StringTools::endsWith($path, "/")) {
             $path = _hx_substr($path, 0, strlen($path) - 1);
         }
         if (StringTools::startsWith($path, "/")) {
             $path = _hx_substr($path, 1, null);
         }
         if (strlen($path) > 0) {
             parent::addUrlFilter(new ufront_web_url_filter_DirectoryUrlFilter($path));
         }
         if ($this->configuration->urlRewrite !== true) {
             parent::addUrlFilter(new ufront_web_url_filter_PathInfoUrlFilter(null, null));
         }
         if ($this->configuration->sessionImplementation !== null) {
             $this->injector->mapType("ufront.web.session.UFHttpSession", null, null)->_toClass($this->configuration->sessionImplementation);
             $this->injector->mapRuntimeTypeOf($this->configuration->sessionImplementation, null)->_toClass($this->configuration->sessionImplementation);
         }
         if ($this->configuration->authImplementation !== null) {
             $this->injector->mapType("ufront.auth.UFAuthHandler", null, null)->_toClass($this->configuration->authImplementation);
             $this->injector->mapRuntimeTypeOf($this->configuration->authImplementation, null)->_toClass($this->configuration->authImplementation);
         }
         if ($this->configuration->viewEngine !== null) {
             $this->injector->mapType("String", "viewPath", null)->toValue($this->configuration->viewPath);
             $this->injector->mapType("ufront.view.UFViewEngine", null, null)->_toSingleton($this->configuration->viewEngine);
         }
         if ($this->configuration->contentDirectory !== null) {
             $this->setContentDirectory($this->configuration->contentDirectory);
         }
         if ($this->configuration->defaultLayout !== null) {
             $this->injector->mapType("String", "defaultLayout", null)->toValue($this->configuration->defaultLayout);
         }
         $_g2 = 0;
         $_g11 = $this->configuration->templatingEngines;
         while ($_g2 < $_g11->length) {
             $te = $_g11[$_g2];
             ++$_g2;
             $this->addTemplatingEngine($te);
             unset($te);
         }
     }
 }
Exemplo n.º 6
0
 static function deleteDirectory($folder, $included)
 {
     if ($folder === null || !file_exists($folder)) {
         return;
     }
     $path = com_wiris_util_sys_Store_2($folder, $included);
     $files = sys_FileSystem::readDirectory($folder);
     $i = 0;
     $_g1 = 0;
     $_g = $files->length;
     while ($_g1 < $_g) {
         $i1 = $_g1++;
         $file = $files[$i1];
         $file = $path . "/" . $file;
         if (is_dir($file)) {
             com_wiris_util_sys_Store::deleteDirectory($file, $included);
         } else {
             $includedIterator = $included->iterator();
             if ($included !== null) {
                 while ($includedIterator->hasNext()) {
                     if (StringTools::endsWith($file, $includedIterator->next())) {
                         @unlink($file);
                     }
                 }
             } else {
                 @unlink($file);
             }
             unset($includedIterator);
         }
         unset($i1, $file);
     }
     $files = sys_FileSystem::readDirectory($folder);
     if ($files->length === 0) {
         @rmdir($folder);
     }
 }
Exemplo n.º 7
0
 public function showCasImage($f, $outProp)
 {
     $formula = $f;
     if (StringTools::endsWith($formula, ".png")) {
         $formula = _hx_substr($formula, 0, strlen($formula) - 4);
     }
     $store = $this->plugin->getStorageAndCache();
     $data = $store->retreiveData($formula, "png");
     if ($data === null) {
         $data = com_wiris_system_Storage::newResourceStorage("cas.png")->readBinary();
         if ($data === null) {
             throw new HException("Missing resource cas.png");
         }
     }
     return $data;
 }