static function initialise() { CompileTimeClassList::$lists = new haxe_ds_StringMap(); $m = haxe_rtti_Meta::getType(_hx_qtype("CompileTimeClassList")); if ($m->classLists !== null) { $_g = 0; $_g1 = $m->classLists; while ($_g < $_g1->length) { $item = $_g1[$_g]; ++$_g; $array = $item; $listID = $array[0]; $list = new HList(); $_g2 = 0; $_g3 = _hx_explode(",", $array[1]); while ($_g2 < $_g3->length) { $typeName = $_g3[$_g2]; ++$_g2; $type = Type::resolveClass($typeName); if ($type !== null) { $list->push($type); } unset($typeName, $type); } unset($_g3, $_g2); CompileTimeClassList::$lists->set($listID, $list); unset($listID, $list, $item, $array); } } }
public function render($format, $mml, $latex, $properties, $outProperties) { $servicesClass = Type::resolveClass("com.wiris.editor.services.PublicServices"); $getInstance = Reflect::field($servicesClass, "getInstance"); $publicServices = Reflect::callMethod($servicesClass, $getInstance, null); $args = new _hx_array(array()); $args->push($mml); $args->push($latex); $args->push($properties); $args->push($outProperties); try { if (_hx_index_of($format, "png", null) !== -1) { $renderPngMethod = Reflect::field($publicServices, "renderPng"); $pngObject = Reflect::callMethod($publicServices, $renderPngMethod, $args); $pngBytes = $pngObject; return haxe_io_Bytes::ofData($pngBytes); } else { if (_hx_index_of($format, "svg", null) !== -1) { $renderSvgMethod = Reflect::field($publicServices, "renderSvg"); $svgObject = Reflect::callMethod($publicServices, $renderSvgMethod, $args); $svgString = $svgObject; return haxe_io_Bytes::ofString($svgString); } else { throw new HException("Unexpected image format."); } } } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; $e = $_ex_; throw new HException($e->getMessage()); } }
public function executeModule($classPath) { $cls = Type::resolveClass($classPath); if (is_object($_t = Type::typeof($cls)) && !$_t instanceof Enum ? $_t !== ValueType::$TNull : $_t != ValueType::$TNull) { try { Reflect::callMethod($cls, Reflect::field($cls, "main"), new _hx_array(array())); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $error = $_ex_; } zcale_core_web_ModuleLoader::$loadedModules->push($classPath); $this->loadNextModule(); } else { $this->event->dispatchError($this->eventData, $this, "executeModule", "Class not found: " . _hx_string_or_null($classPath)); } }
static function main() { $user_method = null; $params = null; $route = null; $user_class = null; $base = system_base_Wet_base::get_instance(); $cache = system_base_Cache::get_instance(); $profiler = system_base_Profiler::get_instance(); $cl = null; try { if (system_base_Router::$instance === null) { system_base_Router::$instance = new system_base_Router(); } $route = system_base_Router::$instance; if (!$route->decode_route()) { if ($route->controller === "_load") { system_base_Cache::load_asset($route->method); } return; } if (Index_0($base, $cache, $cl, $params, $profiler, $route, $user_class, $user_method)) { return; } $cl = Type::resolveClass("system.application.controllers." . _hx_string_or_null($route->controller)); if ($cl === null) { throw new HException(new system_base_Http_exception(_hx_string_or_null($route->controller) . " " . "Not found", 404, _hx_anonymous(array("fileName" => "Index.hx", "lineNumber" => 81, "className" => "Index", "methodName" => "main")))); } else { $user_class = Type::createInstance($cl, new _hx_array(array())); $user_method = Reflect::field($user_class, $route->method); if ($user_method === null) { throw new HException(new system_base_Http_exception(_hx_string_or_null($route->method) . " " . "Not found", 404, _hx_anonymous(array("fileName" => "Index.hx", "lineNumber" => 89, "className" => "Index", "methodName" => "main")))); } else { $user_class->set_params($route->params); Reflect::callMethod($user_class, $user_method, new _hx_array(array())); Reflect::callMethod($user_class, Reflect::field($user_class, "flush"), new _hx_array(array())); } } } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; if (($e = $_ex_) instanceof system_base_Error) { } else { throw $__hx__e; } } system_base_Database::close(); }
public function updateConfiguration(&$configuration) { $configuration = $configuration; $confClass = com_wiris_system_PropertiesTools::getProperty($configuration, com_wiris_plugin_api_ConfigurationKeys::$CONFIGURATION_CLASS, null); if ($confClass !== null && _hx_index_of($confClass, "com.wiris.plugin.servlets.configuration.ParameterServletConfigurationUpdater", null) !== -1) { return; } if ($confClass !== null) { $cls = Type::resolveClass($confClass); if ($cls === null) { throw new HException("Class " . $confClass . " not found."); } $obj = Type::createInstance($cls, new _hx_array(array())); if ($obj === null) { throw new HException("Instance from " . Std::string($cls) . " cannot be created."); } $cu = $obj; $this->config->initialize($cu); $cu->updateConfiguration($configuration); } }
static function getApisInContext($context) { if (!php_Boot::$skip_constructor) { $apis = new _hx_array(array()); $meta = haxe_rtti_Meta::getType($context); if ($meta->apiList !== null) { $_g = 0; $_g1 = $meta->apiList; while ($_g < $_g1->length) { $apiName = $_g1[$_g]; ++$_g; $api = Type::resolveClass($apiName); if ($api !== null) { $apis->push($api); } unset($apiName, $api); } } return $apis; } }
public function load($filePath) { if (Lambda::has(zcale_core_web_scriptLoader_targets_SystemScriptLoader::$loadedScripts, $filePath) === false) { $classPath = null; $s = zcale_PathTools::removeLastElement($filePath, null); $classPath = str_replace("/", ".", $s); $cls = Type::resolveClass($classPath); if (is_object($_t = Type::typeof($cls)) && !$_t instanceof Enum ? $_t !== ValueType::$TNull : $_t != ValueType::$TNull) { try { Reflect::callMethod($cls, Reflect::field($cls, "main"), new _hx_array(array())); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $error = $_ex_; } zcale_core_web_scriptLoader_targets_SystemScriptLoader::$loadedScripts->push($filePath); $this->event->dispatch($this->eventKeys->complete); } else { $this->event->dispatchError($this->eventData, $this, "load", "Class not found: " . _hx_string_or_null($classPath)); } } else { $this->event->dispatch($this->eventKeys->complete); } }
public function call($classPath, $methodName, $args) { $cls = null; $errorMessage = ""; try { $cls = Type::createInstance(Type::resolveClass($classPath), new _hx_array(array())); $cls->event->addListener($cls->eventKeys->complete, isset($this->onCallComplete) ? $this->onCallComplete : array($this, "onCallComplete")); $cls->event->addListener($cls->eventKeys->error, isset($this->onCallError) ? $this->onCallError : array($this, "onCallError")); try { Reflect::callMethod($cls, Reflect::field($cls, $methodName), $args); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $error = $_ex_; $errorMessage = "Call method " . _hx_string_or_null($methodName) . " failed in " . _hx_string_or_null($classPath); } } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $error1 = $_ex_; $errorMessage = "Not found class " . _hx_string_or_null($classPath); } if (strlen($errorMessage) > 0) { $this->event->dispatchError($this->eventData, $this, "call", $errorMessage); } }
public function serviceText($serviceName, $param) { $servicesClass = Type::resolveClass("com.wiris.editor.services.PublicServices"); $getInstance = Reflect::field($servicesClass, "getInstance"); $publicServices = Reflect::callMethod($servicesClass, $getInstance, null); $serviceMethod = Reflect::field($publicServices, $serviceName); $args = new _hx_array(array()); try { if (_hx_index_of($serviceName, "mathml2accessible", null) !== -1) { $mml = com_wiris_system_PropertiesTools::getProperty($param, "mml", null); if ($mml === null) { throw new HException("Missing mml"); } else { $args->push($mml); } $lang = com_wiris_system_PropertiesTools::getProperty($param, "lang", "en"); $args->push($lang); $args->push($param); $serviceText = Reflect::callMethod($publicServices, $serviceMethod, $args); return $serviceText; } else { if (_hx_index_of($serviceName, "mathml2latex", null) !== -1) { $mml = com_wiris_system_PropertiesTools::getProperty($param, "mml", null); if ($mml === null) { throw new HException("Missing mml"); } else { $args->push($mml); } $keepMathml = com_wiris_system_PropertiesTools::getProperty($param, "keepMathml", "false"); if (_hx_index_of($keepMathml, "true", null) !== -1) { $args->push(true); } else { $args->push(false); } $args->push($param); $serviceText = Reflect::callMethod($publicServices, $serviceMethod, $args); return $serviceText; } else { if (_hx_index_of($serviceName, "latex2mathml", null) !== -1) { $latex = com_wiris_system_PropertiesTools::getProperty($param, "latex", null); if ($latex === null) { throw new HException("Missing LaTeX"); } else { $args->push($latex); } $keepLatex = com_wiris_system_PropertiesTools::getProperty($param, "saveLatex", "false"); if (_hx_index_of($keepLatex, "false", null) !== -1) { $args->push(false); } else { $args->push(true); } $args->push($param); $serviceText = Reflect::callMethod($publicServices, $serviceMethod, $args); return $serviceText; } else { throw new HException("Unknow service " . $serviceName); } } } } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; $e = $_ex_; throw new HException($e->getMessage()); } }
static function dispatch($param) { $cl = Type::resolveClass("model." . Std::string($param->get("className"))); if ($cl === null) { haxe_Log::trace("model." . Std::string($param->get("className")) . " ???", _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 66, "className" => "Model", "methodName" => "dispatch"))); return false; } $fl = Reflect::field($cl, "create"); if ($fl === null) { haxe_Log::trace(Std::string($cl) . "create is null", _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 73, "className" => "Model", "methodName" => "dispatch"))); return false; } $iFields = Type::getInstanceFields($cl); if (Lambda::has($iFields, $param->get("action"))) { haxe_Log::trace("calling create " . Std::string($cl), _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 80, "className" => "Model", "methodName" => "dispatch"))); return Reflect::callMethod($cl, $fl, new _hx_array(array($param))); } else { haxe_Log::trace("not calling create ", _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 85, "className" => "Model", "methodName" => "dispatch"))); return false; } }
public function getTestPage() { $random = "" . _hx_string_rec(Math::floor(Math::random() * 9999), ""); $mml = "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><msqrt><mn>" . $random . "</mn></msqrt></mrow></math>"; $testName = null; $reportText = null; $solutionLink = null; $condition = null; $output = ""; $output .= "<html><head>\r\n"; $output .= "<title>WIRIS plugin test page</title><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" /><style type=\"text/css\">/*<!--*/html {font-family: sans-serif;}h2 {margin-left: 1em;}h3 {margin-left: 2em;}p {margin-left: 3em;}p.concrete {margin-left: 4em;}.ok {font-weight: bold;color: #0c0;}.error {font-weight: bold;color: #f00;}/*-->*/</style><style type=\"text/css\">body{font-family: Arial;}span{font-weight: bold;}span.ok {color: #009900;}span.error {color: #dd0000;}table, th, td, tr {border: solid 1px #000000;border-collapse:collapse;padding: 5px;}th{background-color: #eeeeee;}img{border:none;}</style>\r\n"; $output .= "<script src=\"../core/WIRISplugins.js?viewer=image\" ></script>\r\n"; $output .= "</head><body><h1>WIRIS plugin test page</h1>\r\n"; $output .= "<table><tr><th>Test</th><th>Report</th><th>Status</th></tr>\r\n"; $testName = "WIRIS plugin version"; try { $s = com_wiris_system_Storage::newResourceStorage("VERSION")->read(); $reportText = "<b>" . $s . "</b>"; $solutionLink = ""; $condition = true; } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; $ex = $_ex_; $reportText = "Missing version"; $solutionLink = ""; $condition = false; } $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Creating and storing data"; $solutionLink = ""; $param = array(); $outp = array(); $imageUrl = $this->plugin->newRender()->createImage($mml, $param, $outp); $reportText = "<a href=\"" . $imageUrl . "\" />" . $imageUrl . "</a>"; $condition = true; $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Retrieving data"; $solutionLink = ""; $reportText = "<img src=\"" . $imageUrl . "\" />"; $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "JavaScript MathML filter"; $solutionLink = ""; $reportText = $mml; $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Host platform"; $solutionLink = ""; $platform = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$HOST_PLATFORM, "failed"); $reportText = $platform; $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Filter test"; $solutionLink = ""; $condition = true; $p = null; $p = array(); $p["savemode"] = "safeXml"; $s2 = str_replace("<", com_wiris_plugin_impl_TestImpl_0($this, $condition, $ex, $imageUrl, $mml, $outp, $output, $p, $param, $platform, $random, $reportText, $solutionLink, $testName), $mml); $s2 = str_replace(">", com_wiris_plugin_impl_TestImpl_1($this, $condition, $ex, $imageUrl, $mml, $outp, $output, $p, $param, $platform, $random, $reportText, $s2, $solutionLink, $testName), $s2); $s2 = str_replace("\"", com_wiris_plugin_impl_TestImpl_2($this, $condition, $ex, $imageUrl, $mml, $outp, $output, $p, $param, $platform, $random, $reportText, $s2, $solutionLink, $testName), $s2); $reportText = $this->plugin->newTextService()->filter("square root: " . $s2, $p); $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Connecting to www.wiris.net"; $solutionLink = ""; $condition = true; try { $h = new com_wiris_plugin_impl_HttpImpl("http://www.wiris.net", null); $h->request(true); } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; $ex2 = $_ex_; $condition = false; } $reportText = "Checking if WIRIS server is reachable"; $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); if (Type::resolveClass("com.wiris.editor.services.PublicServices") !== null) { $condition = true; $testName = "Testing integrated services"; $reportText = "WIRIS Services installed"; $solutionLink = ""; $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $isLicensed = $this->plugin->isEditorLicensed(); $condition = false; $testName = "WIRIS editor license"; $reportText = "Checking WIRIS editor valid license"; $output .= $this->createTableRow($testName, $reportText, $solutionLink, $isLicensed); } else { $reportText = "WIRIS Services not installed"; } $debug = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$DEBUG, "false") === "true"; if ($debug) { $testName = "Font family"; $solutionLink = ""; $condition = true; $reportText = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$FONT_FAMILY, ""); $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Configuration file"; $solutionLink = ""; $condition = true; $reportText = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$CONFIGURATION_PATH, "") . "\\configuration.ini"; $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Cache path"; $solutionLink = ""; $condition = true; $reportText = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$CACHE_FOLDER, ""); $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Formula path"; $solutionLink = ""; $condition = true; $reportText = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$FORMULA_FOLDER, ""); $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Integration path"; $solutionLink = ""; $condition = true; $reportText = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$INTEGRATION_PATH, ""); $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "Context path"; $solutionLink = ""; $condition = true; $reportText = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$CONTEXT_PATH, ""); $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "default-configuration.ini load"; $solutionLink = ""; $defaultConfiguration = com_wiris_system_Storage::newResourceStorage("default-configuration.ini")->read(); $condition = $defaultConfiguration !== null && strlen($defaultConfiguration) > 0; if ($condition) { $reportText = "Length: " . _hx_string_rec(strlen($defaultConfiguration), ""); } else { $reportText = "Not found!"; } $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); $testName = "cas.png load"; $solutionLink = ""; $casPng = com_wiris_system_Storage::newResourceStorage("cas.png")->readBinary(); $casPngLength = 0; if ($casPng !== null) { $casPngLength = haxe_io_Bytes::ofData($casPng)->length; $condition = $casPngLength > 0; } else { $condition = false; } if ($condition) { $reportText = "Length: " . _hx_string_rec($casPngLength, ""); } else { $reportText = "Not found!"; } $output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition); } $output .= "<div id=\"haxe:trace\"></div>"; return $output; }
public function getStorageAndCache() { if ($this->store === null) { $className = $this->configuration->getProperty(com_wiris_plugin_api_ConfigurationKeys::$STORAGE_CLASS, null); if ($className === null || $className === "FolderTreeStorageAndCache") { $this->store = new com_wiris_plugin_impl_FolderTreeStorageAndCache(); } else { if ($className === "FileStorageAndCache") { $this->store = new com_wiris_plugin_impl_FileStorageAndCache(); } else { $cls = Type::resolveClass($className); if ($cls === null) { throw new HException("Class " . $className . " not found."); } $this->store = Type::createInstance($cls, new _hx_array(array())); if ($this->store === null) { throw new HException("Instance from " . Std::string($cls) . " cannot be created."); } } } $this->initialize($this->store, $this->configuration->getFullConfiguration()); } return $this->store; }
public function newRender() { if (Type::resolveClass("com.wiris.editor.services.PublicServices") !== null && $this->isEditorLicensed()) { return new com_wiris_plugin_impl_RenderImplIntegratedServices($this); } return new com_wiris_plugin_impl_RenderImpl($this); }
static function getAsyncApi($syncApi) { $meta = haxe_rtti_Meta::getType($syncApi); if ($meta->asyncApi !== null) { $asyncApiName = $meta->asyncApi[0]; if ($asyncApiName !== null) { return Type::resolveClass($asyncApiName); } } return null; }
public function asSingleton() { return $this->_toSingleton(Type::resolveClass($this->type)); }