public function getMathML($digest, $latex) { if ($digest !== null) { $content = $this->plugin->getStorageAndCache()->decodeDigest($digest); if ($content !== null) { if (StringTools::startsWith($content, "<")) { $breakline = null; $breakline = _hx_index_of($content, "\n", 0); return _hx_substr($content, 0, $breakline); } else { $iniFile = com_wiris_util_sys_IniFile::newIniFileFromString($content); $mathml = $iniFile->getProperties()->get("mml"); if ($mathml !== null) { return $mathml; } else { return "Error: mathml not found."; } } } else { return "Error: formula not found."; } } else { if ($latex !== null) { return $this->latex2mathml($latex); } else { return "Error: no digest or latex has been sent."; } } }
public function toString() { if ($this->format === com_wiris_util_json_JSonIntegerFormat::$HEXADECIMAL) { return "0x" . StringTools::hex($this->n, 0); } return "" . _hx_string_rec($this->n, ""); }
/** * @param $name */ public function __unset($name) { if (method_exists($this, $func = 'set' . ucfirst($name))) { call_user_func([$this, $func], null); } elseif (method_exists($this, $func = 'set' . StringTools::underscoreToCamel($name))) { call_user_func([$this, $func], null); } }
/** * Displays an action * * @param string $context Context to display it in. */ public function display($context = 'boardloglist') { $context = StringTools::filterPath($context); $templateFilePath = __DIR__ . '/../templates/ActionLog/' . $this->type . '/' . $context . '.tpl'; if (file_exists($templateFilePath)) { include $templateFilePath; } }
/** * Wrapper for the filter_input php function which filter out any special character * so it can be used to specify paths * * @param int $type Type of input (see filter_input doc) * @param string $var Variable name (see filter_input doc) * @param int $filter Filter to use first (see filter_input doc) * @param array $options Filter options (see filter_input doc) * * @return string */ public static function noPathFilterInput($type, $var, $filter = FILTER_DEFAULT, $options = null) { $data = filter_input($type, $var, $filter, $options); if (!empty($data)) { $data = StringTools::filterPath($data); } return $data; }
/** * Displays an item's infos * * @param string $context Context to display it in. */ public function display($context = 'board') { $context = StringTools::filterPath($context); $templateFilePath = __DIR__ . '/../templates/' . get_called_class() . '/' . $context . '.tpl'; if (file_exists($templateFilePath)) { include $templateFilePath; } }
static function get_file_etag($fullpath) { if (file_exists($fullpath)) { $stats = sys_FileSystem::stat($fullpath); return _hx_string_or_null(StringTools::hex($stats->size, null)) . "-" . _hx_string_or_null(StringTools::hex($stats->ino, null)) . "-" . _hx_string_or_null(_hx_string_call(_hx_string_call($stats->mtime, "toString", array()), "substr", array(17, 2))); } else { return ""; } }
/** * Loads the language data for a controller * * @param string $controller Controller name */ public function load($controller) { $controller = StringTools::filterPath($controller); $path = __DIR__ . '/../lang/' . $this->_languageCode . '/' . $controller . '.lang.php'; if (!file_exists($path)) { throw new Exception('Language file not found (' . $path . ')'); } include $path; $this->_lines += $lines; }
public function flush() { if (!$this->_flushedStatus) { $this->_flushedStatus = true; php_Web::setReturnCode($this->status); } if (!$this->_flushedCookies) { $this->_flushedCookies = true; try { if (null == $this->_cookies) { throw new HException('null iterable'); } $__hx__it = $this->_cookies->iterator(); while ($__hx__it->hasNext()) { unset($cookie); $cookie = $__hx__it->next(); php_Web::setCookie($cookie->name, $cookie->value, $cookie->expires, $cookie->domain, $cookie->path, $cookie->secure, $cookie->httpOnly); } } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e = $_ex_; throw new HException(ufront_web_HttpError::internalServerError("Failed to set cookie on response", $e, _hx_anonymous(array("fileName" => "HttpResponse.hx", "lineNumber" => 34, "className" => "sys.ufront.web.context.HttpResponse", "methodName" => "flush")))); } } if (!$this->_flushedHeaders) { $this->_flushedHeaders = true; if (null == $this->_headers) { throw new HException('null iterable'); } $__hx__it = $this->_headers->keys(); while ($__hx__it->hasNext()) { unset($key); $key = $__hx__it->next(); $val = $this->_headers->get($key); if ($key === "Content-type" && null !== $this->charset && StringTools::startsWith($val, "text/")) { $val .= "; charset=" . _hx_string_or_null($this->charset); } try { header(_hx_string_or_null($key) . ": " . _hx_string_or_null($val)); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e1 = $_ex_; throw new HException(ufront_web_HttpError::internalServerError("Invalid header: \"" . _hx_string_or_null($key) . ": " . _hx_string_or_null($val) . "\", or output already sent", $e1, _hx_anonymous(array("fileName" => "HttpResponse.hx", "lineNumber" => 50, "className" => "sys.ufront.web.context.HttpResponse", "methodName" => "flush")))); } unset($val, $e1); } } if (!$this->_flushedContent) { $this->_flushedContent = true; Sys::hprint($this->_buff->b); } }
/** * Execute controller's specified action */ public function execute() { // Get action $action = StringTools::noPathFilterInput(INPUT_GET, 'action'); if (empty($action) || !method_exists($this, $action)) { if (method_exists($this, 'index')) { $action = 'index'; } else { return; } } $this->_action = $action; // Call the action's method $this->{$action}(); }
public function getImageServiceURL($service) { $protocol = null; $port = null; $url = null; $config = $this->getConfiguration(); $protocol = $config->getProperty(com_wiris_plugin_api_ConfigurationKeys::$SERVICE_PROTOCOL, null); $port = $config->getProperty(com_wiris_plugin_api_ConfigurationKeys::$SERVICE_PORT, null); $url = $config->getProperty(com_wiris_plugin_api_ConfigurationKeys::$INTEGRATION_PATH, null); if ($protocol === null && $url !== null) { if (StringTools::startsWith($url, "https")) { $protocol = "https"; } } if ($protocol === null) { $protocol = "http"; } if ($port !== null) { if ($protocol === "http") { if (!($port === "80")) { $port = ":" . $port; } else { $port = ""; } } if ($protocol === "https") { if (!($port === "443")) { $port = ":" . $port; } else { $port = ""; } } } else { $port = ""; } $domain = $config->getProperty(com_wiris_plugin_api_ConfigurationKeys::$SERVICE_HOST, null); $path = $config->getProperty(com_wiris_plugin_api_ConfigurationKeys::$SERVICE_PATH, null); if ($service !== null) { $end = _hx_last_index_of($path, "/", null); if ($end === -1) { $path = $service; } else { $path = _hx_substr($path, 0, $end) . "/" . $service; } } return $protocol . "://" . $domain . $port . $path; }
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()); } } }
public static function createTag($tagName, $attributes = null, $content = null, $quickClose = false, $escapeContent = true) { $tag = '<' . $tagName; if ($attributes) { foreach (array_keys($attributes) as $atb) { $tag .= ' ' . $atb . '="' . StringTools::escapeHtml($attributes[$atb]) . '"'; } } if (!$content && $quickClose) { $tag .= ' />'; return $tag; } $tag .= '>'; if ($content) { $tag .= $escapeContent ? StringTools::escapeHtml($content) : $content; } $tag .= '</' . $tagName . '>'; return $tag; }
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); }
static function _trace($v, $i = null) { if (me_cunity_debug_Out::$suspended) { return; } $warned = false; if ($i !== null && _hx_has_field($i, "customParams")) { $i = $i->customParams[0]; } $msg = null; if ($i !== null) { $msg = _hx_string_or_null($i->fileName) . ":" . _hx_string_or_null($i->methodName) . ":" . _hx_string_rec($i->lineNumber, "") . ":"; } else { $msg = ""; } $msg .= Std::string($v); if (me_cunity_debug_Out::$log !== null) { me_cunity_debug_Out::$log->writeString(_hx_string_or_null($msg) . "\n"); me_cunity_debug_Out::$log->flush(); } else { $_g = me_cunity_debug_Out::$traceTarget; switch ($_g->index) { case 2: error_log($msg); break; case 0: php_Lib::hprint(_hx_string_or_null($msg) . "\r\n"); break; case 1: php_Lib::hprint(_hx_string_or_null(StringTools::htmlEscape($msg, null)) . "<br/>"); break; case 3: break; } } if (me_cunity_debug_Out::$once) { me_cunity_debug_Out::$once = false; me_cunity_debug_Out::_trace("i:" . Std::string(Type::typeof($i)), _hx_anonymous(array("fileName" => "Out.hx", "lineNumber" => 130, "className" => "me.cunity.debug.Out", "methodName" => "_trace"))); me_cunity_debug_Out::dumpObject($i, _hx_anonymous(array("fileName" => "Out.hx", "lineNumber" => 131, "className" => "me.cunity.debug.Out", "methodName" => "_trace"))); } }
static function isInteger($str) { $str = trim($str); $i = 0; $n = strlen($str); if (StringTools::startsWith($str, "-")) { $i++; } if (StringTools::startsWith($str, "+")) { $i++; } $c = null; while ($i < $n) { $c = _hx_char_code_at($str, $i); if ($c < 48 || $c > 57) { return false; } $i++; } return true; }
public function injectConfig($context) { if ($context->injector->hasMappingForType("String", "sessionName")) { $this->sessionName = $context->injector->getValueForType("String", "sessionName"); } else { $this->sessionName = ufront_web_session_FileSession::$defaultSessionName; } if ($context->injector->hasMappingForType("Int", "sessionExpiry")) { $this->expiry = $context->injector->getValueForType("Int", "sessionExpiry"); } else { $this->expiry = ufront_web_session_FileSession::$defaultExpiry; } if ($context->injector->hasMappingForType("String", "sessionSavePath")) { $this->savePath = $context->injector->getValueForType("String", "sessionSavePath"); } else { $this->savePath = ufront_web_session_FileSession::$defaultSavePath; } $this->savePath = haxe_io_Path::addTrailingSlash($this->savePath); if (!StringTools::startsWith($this->savePath, "/")) { $this->savePath = _hx_string_or_null($context->get_contentDirectory()) . _hx_string_or_null($this->savePath); } }
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)); }
public function showImage($digest, $mml, $param) { if ($digest === null && $mml === null) { throw new HException("Missing parameters 'formula' or 'mml'."); } if ($digest !== null && $mml !== null) { throw new HException("Only one parameter 'formula' or 'mml' is valid."); } $atts = false; if ($digest === null && $mml !== null) { $digest = $this->computeDigest($mml, $param); } $formula = $this->plugin->getStorageAndCache()->decodeDigest($digest); if ($formula === null) { throw new HException("Formula associated to digest not found."); } if (StringTools::startsWith($formula, "<")) { throw new HException("Not implemented."); } $iniFile = com_wiris_util_sys_IniFile::newIniFileFromString($formula); $renderParams = $iniFile->getProperties(); $i = null; $ss = $this->getEditorParametersList(); if ($param !== null) { $_g1 = 0; $_g = $ss->length; while ($_g1 < $_g) { $i1 = $_g1++; $key = $ss[$i1]; $value = com_wiris_system_PropertiesTools::getProperty($param, $key, null); if ($value !== null) { $atts = true; $renderParams->set($key, $value); } unset($value, $key, $i1); } } if ($atts) { if ($mml !== null) { $digest = $this->computeDigest($mml, com_wiris_system_PropertiesTools::toProperties($renderParams)); } else { $digest = $this->computeDigest($renderParams->get("mml"), com_wiris_system_PropertiesTools::toProperties($renderParams)); } } $store = $this->plugin->getStorageAndCache(); $bs = null; $bs = $store->retreiveData($digest, "png"); if ($bs === null) { $_g1 = 0; $_g = $ss->length; while ($_g1 < $_g) { $i1 = $_g1++; $key = $ss[$i1]; if (!$renderParams->exists($key)) { $confKey = com_wiris_plugin_api_ConfigurationKeys::$imageConfigProperties->get($key); if ($confKey !== null) { $value = $this->plugin->getConfiguration()->getProperty($confKey, null); if ($value !== null) { $renderParams->set($key, $value); } unset($value); } unset($confKey); } unset($key, $i1); } $h = new com_wiris_plugin_impl_HttpImpl($this->plugin->getImageServiceURL(null), null); $this->plugin->addReferer($h); $this->plugin->addProxy($h); $iter = $renderParams->keys(); while ($iter->hasNext()) { $key = $iter->next(); $h->setParameter($key, $renderParams->get($key)); unset($key); } $h->request(true); $b = haxe_io_Bytes::ofString($h->getData()); $store->storeData($digest, "png", $b->b); $bs = $b->b; } return $bs; }
echo $css; ?> </style> </head> <body> <div id="page"> <div id="header"> Google-CMS Tester </div> <div id="menu"> <?php $chemin = explode('/', $_SERVER["SCRIPT_NAME"]); $currentPage = substr($chemin[count($chemin) - 1], 0, -4); $currentPageURLF = StringTools::urlFormat($currentPage); foreach ($MENU["pages"] as $page) { $pageURLF = StringTools::urlFormat($page); if ($pageURLF == $currentPageURLF) { echo "<ul><li class=\"on\">" . $page . "</li></ul>\n"; } else { echo "<ul><li class=\"off\"><a href=\"" . $pageURLF . '">' . $page . "</a></li></ul>\n"; } } ?> </div> <div id="corpus"> <?php echo $html; ?> <br><br> </div> <!-- corpus --> </div> <!-- page -->
static function htmlUnescape($input) { $output = ""; $start = 0; $position = _hx_index_of($input, "&", $start); while ($position !== -1) { $output .= _hx_substr($input, $start, $position - $start); if (_hx_char_at($input, $position + 1) === "#") { $startPosition = $position + 2; $endPosition = _hx_index_of($input, ";", $startPosition); if ($endPosition !== -1) { $number = _hx_substr($input, $startPosition, $endPosition - $startPosition); if (StringTools::startsWith($number, "x")) { $number = "0" . $number; } $charCode = Std::parseInt($number); $output .= com_wiris_util_xml_WXmlUtils_0($charCode, $endPosition, $input, $number, $output, $position, $start, $startPosition); $start = $endPosition + 1; unset($number, $charCode); } else { $output .= "&"; $start = $position + 1; } unset($startPosition, $endPosition); } else { $output .= "&"; $start = $position + 1; } $position = _hx_index_of($input, "&", $start); } $output .= _hx_substr($input, $start, strlen($input) - $start); $output = str_replace("<", "<", $output); $output = str_replace(">", ">", $output); $output = str_replace(""", "\"", $output); $output = str_replace("'", "'", $output); $output = str_replace("&", "&", $output); return $output; }
static function stripArrayFromName($this1, $name) { if (StringTools::endsWith($name, "[]")) { return _hx_substr($name, 0, strlen($name) - 2); } else { return $name; } }
public function showImage($digest, $mml, $param) { if ($digest === null && $mml === null) { throw new HException("Missing parameters 'formula' or 'mml'."); } if ($digest !== null && $mml !== null) { throw new HException("Only one parameter 'formula' or 'mml' is valid."); } $atts = false; if ($digest === null && $mml !== null) { $digest = $this->computeDigest($mml, $param); } $formula = $this->plugin->getStorageAndCache()->decodeDigest($digest); if ($formula === null) { throw new HException("Formula associated to digest not found."); } if (StringTools::startsWith($formula, "<")) { throw new HException("Not implemented."); } $iniFile = com_wiris_util_sys_IniFile::newIniFileFromString($formula); $renderParams = $iniFile->getProperties(); $i = null; $ss = $this->getEditorParametersList(); if ($param !== null) { $_g1 = 0; $_g = $ss->length; while ($_g1 < $_g) { $i1 = $_g1++; $key = $ss[$i1]; $value = com_wiris_system_PropertiesTools::getProperty($param, $key, null); if ($value !== null) { $atts = true; $renderParams->set($key, $value); } unset($value, $key, $i1); } } if ($atts) { if ($mml !== null) { $digest = $this->computeDigest($mml, com_wiris_system_PropertiesTools::toProperties($renderParams)); } else { $digest = $this->computeDigest($renderParams->get("mml"), com_wiris_system_PropertiesTools::toProperties($renderParams)); } } $store = $this->plugin->getStorageAndCache(); $bs = null; $bs = $store->retreiveData($digest, $this->plugin->getConfiguration()->getProperty("wirisimageformat", "png")); if ($bs === null) { if ($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMS, null) !== null) { $json = com_wiris_util_json_JSon::decode($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMS, null)); $decodedHash = $json; $keys = $decodedHash->keys(); $notAllowedParams = _hx_explode(",", com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMETERS_NOTRENDER_LIST); while ($keys->hasNext()) { $key = $keys->next(); if (!com_wiris_system_ArrayEx::contains($notAllowedParams, $key)) { $renderParams->set($key, $decodedHash->get($key)); } unset($key); } } else { $_g1 = 0; $_g = $ss->length; while ($_g1 < $_g) { $i1 = $_g1++; $key = $ss[$i1]; if (!$renderParams->exists($key)) { $confKey = com_wiris_plugin_api_ConfigurationKeys::$imageConfigProperties->get($key); if ($confKey !== null) { $value = $this->plugin->getConfiguration()->getProperty($confKey, null); if ($value !== null) { $renderParams->set($key, $value); } unset($value); } unset($confKey); } unset($key, $i1); } } $prop = com_wiris_system_PropertiesTools::toProperties($renderParams); $iter = $renderParams->keys(); $mml = $renderParams->get("mml"); $b = $this->render($this->plugin->getConfiguration()->getProperty("wirisimageformat", "png"), $mml, null, $prop, null); $store->storeData($digest, $this->plugin->getConfiguration()->getProperty("wirisimageformat", "png"), $b->b); $bs = $b->b; } return $bs; }
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); } }
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); } } }
public static function scan($url, $currentFolderDepth) { // debug : echo getRequest("https://docs.google.com/feeds/default/private/full?prettyprint=true"); $result = Connection::getRequest($url); //."?prettyprint=true" $folderContent = simplexml_load_string(str_replace('gd:etag', 'etag', $result)); $foldersArray = array(); $pagesArray = array(); // foldersArray: key:name => value:sub-folder // pagesArray: key:menu_position => value:name foreach ($folderContent->entry as $file) { $type = (string) $file->content['type']; $name = (string) $file->title; $name = str_replace('"', '\\"', str_replace('$', '\\$', $name)); $srcUrl = (string) $file->content['src']; $lastModified = (string) $file->updated; $etag = (string) $file['etag']; $path = $currentFolderDepth . ($currentFolderDepth == '' ? '' : '/') . StringTools::urlFormat(StringTools::indexClean($name)); $isNew = LAST_UPDATE_DATE < $lastModified; if ($type == 'application/atom+xml;type=feed') { if (!is_dir($path)) { Output::createFolder($path); Output::println("Folder: {$path}"); } $foldersArray[$name . '!$!'] = self::scan($srcUrl, $path); // Recursively store the sub folder. } else { if (substr($srcUrl, 0, strlen('https://docs.g')) == 'https://docs.g') { $pagesArray[] = $name . '!$!'; // !$! is a end of name protection. It's removed in StringTools::serializeForInclude() Output::println("Page: {$path}"); PageDownloader::download($srcUrl, $etag, $path . '.php'); } else { if ($isNew || !file_exists($path)) { Output::store(Connection::getRequest($srcUrl), $path); Output::println("File: {$path}"); } } } } // Sort folders and pages by name ksort($foldersArray); sort($pagesArray); // Remove indexes foreach ($foldersArray as $key => $value) { $cleanKey = StringTools::indexClean($key); if ($key != $cleanKey) { $foldersArray[$cleanKey] = $foldersArray[$key]; unset($foldersArray[$key]); } } foreach ($pagesArray as $key => $value) { $cleanValue = StringTools::indexClean($pagesArray[$key]); $pagesArray[$key] = $cleanValue; } return array('folders' => $foldersArray, 'pages' => $pagesArray); }
public function toString() { if (is_object($_t = $this->nodeType) && !$_t instanceof Enum ? $_t === Xml::$PCData : $_t == Xml::$PCData) { if ($this->_fromCustomParser) { return StringTools::htmlEscape($this->_nodeValue, null); } else { return $this->_nodeValue; } } $s = ""; if (is_object($_t2 = $this->nodeType) && !$_t2 instanceof Enum ? $_t2 === Xml::$Element : $_t2 == Xml::$Element) { $s .= "<"; $s .= _hx_string_or_null($this->_nodeName); if (null == $this->_attributes) { throw new HException('null iterable'); } $__hx__it = $this->_attributes->keys(); while ($__hx__it->hasNext()) { $k = $__hx__it->next(); $s .= " "; $s .= _hx_string_or_null($k); $s .= "=\""; $s .= _hx_string_or_null($this->_attributes->get($k)); $s .= "\""; } if ($this->_children->length === 0) { $s .= "/>"; return $s; } $s .= ">"; } else { if (is_object($_t3 = $this->nodeType) && !$_t3 instanceof Enum ? $_t3 === Xml::$CData : $_t3 == Xml::$CData) { return "<![CDATA[" . _hx_string_or_null($this->_nodeValue) . "]]>"; } else { if (is_object($_t4 = $this->nodeType) && !$_t4 instanceof Enum ? $_t4 === Xml::$Comment : $_t4 == Xml::$Comment) { return "<!--" . _hx_string_or_null($this->_nodeValue) . "-->"; } else { if (is_object($_t5 = $this->nodeType) && !$_t5 instanceof Enum ? $_t5 === Xml::$DocType : $_t5 == Xml::$DocType) { return "<!DOCTYPE " . _hx_string_or_null($this->_nodeValue) . ">"; } else { if (is_object($_t6 = $this->nodeType) && !$_t6 instanceof Enum ? $_t6 === Xml::$ProcessingInstruction : $_t6 == Xml::$ProcessingInstruction) { return "<?" . _hx_string_or_null($this->_nodeValue) . "?>"; } } } } } if (null == $this) { throw new HException('null iterable'); } $__hx__it = $this->iterator(); while ($__hx__it->hasNext()) { $x = $__hx__it->next(); $s .= _hx_string_or_null($x->toString()); } if (is_object($_t3 = $this->nodeType) && !$_t3 instanceof Enum ? $_t3 === Xml::$Element : $_t3 == Xml::$Element) { $s .= "</"; $s .= _hx_string_or_null($this->_nodeName); $s .= ">"; } return $s; }
public function get_isPathAbsolute() { return StringTools::startsWith($this->path, "/"); }
function ufront_remoting_RemotingHandler_2(&$apiNotFoundMessages, &$args, &$doneTrigger, &$e, &$error, &$httpContext, &$path, &$r, &$remotingResponse, $msg) { return StringTools::startsWith($error, $msg); }
function Index_0(&$base, &$cache, &$cl, &$params, &$profiler, &$route, &$user_class, &$user_method) { $router = null; if (system_base_Router::$instance === null) { system_base_Router::$instance = new system_base_Router(); } $router = system_base_Router::$instance; $hash = $router->query_hash; $fullpath = _hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_or_null($hash) . ".htm"; if (!file_exists($fullpath)) { return false; } else { $r_query = $router->query_string; $fin = sys_io_File::read($fullpath, false); $query = $fin->readLine(); if ($r_query === $query) { $etag = null; if (file_exists($fullpath)) { $stats = sys_FileSystem::stat($fullpath); $etag = _hx_string_or_null(StringTools::hex($stats->size, null)) . "-" . _hx_string_or_null(StringTools::hex($stats->ino, null)) . "-" . _hx_string_or_null(_hx_string_call(_hx_string_call($stats->mtime, "toString", array()), "substr", array(17, 2))); } else { $etag = ""; } if (php_Web::getClientHeader("If-none-match") === $etag) { php_Web::setReturnCode(304); $fin->close(); return true; } else { while (!system_base_Cache::$cookie_buffer->isEmpty()) { system_base_Wet_base::send_cookie(system_base_Cache::$cookie_buffer->pop()); } header("X-Powered-By" . ": " . "Webrathea/0.4 (PHP)"); $value = DateTools::format(Date::now(), "%a, %d %b %Y %X %Z"); header("Date" . ": " . _hx_string_or_null($value)); header("X-Frame-Options" . ": " . "sameorigin"); header("X-XSS-Protection" . ": " . "1; mode=block"); php_Web::setReturnCode(200); $value1 = Std::string(sys_FileSystem::stat($fullpath)->size); header("Content-Length" . ": " . _hx_string_or_null($value1)); header("ETag" . ": " . _hx_string_or_null($etag)); $m = null; $pos = strlen($query); $fin1 = sys_io_File::read($fullpath, false); $size = sys_FileSystem::stat($fullpath)->size; $fin1->seek($pos, sys_io_FileSeek::$SeekBegin); $output = $fin1->readString($size - $pos); $fin1->close(); $m = $output; $message = null; $message = Std::string($m); haxe_Log::trace("DEPRECATED FUNCTION: " . _hx_string_or_null($message), _hx_anonymous(array("fileName" => "Base.hx", "lineNumber" => 449, "className" => "system.base.Wet_base", "methodName" => "echo"))); $fin->close(); return true; } unset($etag); } else { $fin->close(); return false; } unset($r_query, $query, $fin); } unset($router, $hash, $fullpath); }