static function create() { $s = new _hx_array(array()); $_g = 0; while ($_g < 8) { $i = $_g++; $s[$i] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16)); unset($i); } $s[8] = "-"; $_g1 = 9; while ($_g1 < 13) { $i1 = $_g1++; $s[$i1] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16)); unset($i1); } $s[13] = "-"; $s[14] = "4"; $_g2 = 15; while ($_g2 < 18) { $i2 = $_g2++; $s[$i2] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16)); unset($i2); } $s[18] = "-"; $s[19] = "" . _hx_string_or_null(_hx_char_at("89AB", Math::floor(Math::random() * 4))); $_g3 = 20; while ($_g3 < 23) { $i3 = $_g3++; $s[$i3] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16)); unset($i3); } $s[23] = "-"; $_g4 = 24; while ($_g4 < 36) { $i4 = $_g4++; $s[$i4] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16)); unset($i4); } return $s->join(""); }
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; }
} } $books = new Books(array("PHP5", "JS")); $users = new Users(array("Вася", "Петя")); $books->showList(); $users->showList(); final class Math { static $about = "Математика"; static function random() { return rand() / getrandmax(); } } echo Math::$about; echo Math::random(), "<br>"; echo "<hr>"; if ($car1 instanceof Car) { echo "car1 cоздан Car"; } else { echo "car1 не cоздан Car"; } echo "<hr>"; if ($car1 instanceof SuperCar) { echo "car1 cоздан Car"; } else { echo "car1 не cоздан Car"; } echo "<hr>"; function __autoload($classname) {