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 request($post) { $proxy = $this->getProxy(); if ($proxy !== null && $proxy->host !== null && strlen($proxy->host) > 0) { $hpa = $proxy->auth; if ($hpa->user !== null && strlen($hpa->user) > 0) { $data = _hx_deref(new com_wiris_system_Base64())->encodeBytes(haxe_io_Bytes::ofString($hpa->user . ":" . $hpa->pass))->toString(); $this->setHeader("Proxy-Authorization", "Basic " . $data); } } parent::request($post); }
public function readBytes($s, $p, $l) { if (feof($this->__f)) { throw new HException(new haxe_io_Eof()); } $r = fread($this->__f, $l); if ($r === false) { throw new HException(haxe_io_Error::Custom("An error occurred")); } $b = haxe_io_Bytes::ofString($r); $s->blit($p, $b, 0, strlen($r)); return strlen($r); }
public function readBytes($s, $p, $l) { if (feof($this->__f)) { php_io_FileInput_2($this, $l, $p, $s); } $r = fread($this->__f, $l); if ($r === false) { php_io_FileInput_3($this, $l, $p, $r, $s); } $b = haxe_io_Bytes::ofString($r); $s->blit($p, $b, 0, strlen($r)); return strlen($r); }
public function readBytes($s, $p, $l) { if (feof($this->__f)) { return eval("if(isset(\$this)) \$»this =& \$this;throw new HException(new haxe_io_Eof());\n\t\t\t\treturn \$»r;\n\t\t\t"); } $r = fread($this->__f, $l); if ($r === false) { return eval("if(isset(\$this)) \$»this =& \$this;throw new HException(haxe_io_Error::Custom(\"An error occurred\"));\n\t\t\t\treturn \$»r2;\n\t\t\t"); } $b = haxe_io_Bytes::ofString($r); $s->blit($p, $b, 0, strlen($r)); return strlen($r); }
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; }
public function writeString($s) { $b = haxe_io_Bytes::ofString($s); $this->writeFullBytes($b, 0, $b->length); }
static function string2ByteData_iso8859_1($str) { return haxe_io_Bytes::ofString($str); }
static function getBytes($path) { return haxe_io_Bytes::ofString(sys_io_File::getContent($path)); }
public function decodeBytes($bytes) { return haxe_io_Bytes::ofString(base64_decode($bytes->b)); }
static function decode($s, $base) { $b = new haxe_BaseCode(haxe_io_Bytes::ofString($base)); return $b->decodeString($s); }
static function parseMultipart($onPart, $onData) { $a = $_POST; if (get_magic_quotes_gpc()) { reset($a); while (list($k, $v) = each($a)) { $a[$k] = stripslashes((string) $v); } } $post = php_Lib::hashOfAssociativeArray($a); if (null == $post) { throw new HException('null iterable'); } $__hx__it = $post->keys(); while ($__hx__it->hasNext()) { unset($key); $key = $__hx__it->next(); call_user_func_array($onPart, array($key, "")); $v = $post->get($key); if (is_array($v)) { $map = php_Lib::hashOfAssociativeArray($v); $first = true; if (null == $map) { throw new HException('null iterable'); } $__hx__it2 = $map->iterator(); while ($__hx__it2->hasNext()) { unset($val); $val = $__hx__it2->next(); if (!$first) { call_user_func_array($onPart, array($key, "")); } call_user_func_array($onData, array(haxe_io_Bytes::ofString($val), 0, strlen($val))); $first = false; } unset($map, $first); } else { call_user_func_array($onData, array(haxe_io_Bytes::ofString($v), 0, strlen($v))); } unset($v); } if (!isset($_FILES)) { return; } $parts = new _hx_array(array_keys($_FILES)); $_g = 0; while ($_g < $parts->length) { $part = $parts[$_g]; ++$_g; $info = $_FILES[$part]; $tmp = $info["tmp_name"]; $file = $info["name"]; $err = $info["error"]; if ($err > 0) { switch ($err) { case 1: throw new HException("The uploaded file exceeds the max size of " . _hx_string_or_null(ini_get("upload_max_filesize"))); break; case 2: throw new HException("The uploaded file exceeds the max file size directive specified in the HTML form (max is" . _hx_string_or_null(_hx_string_or_null(ini_get("post_max_size")) . ")")); break; case 3: throw new HException("The uploaded file was only partially uploaded"); break; case 4: continue 2; break; case 6: throw new HException("Missing a temporary folder"); break; case 7: throw new HException("Failed to write file to disk"); break; case 8: throw new HException("File upload stopped by extension"); break; } } call_user_func_array($onPart, array($part, $file)); if ("" !== $file) { $h = fopen($tmp, "r"); $bsize = 8192; while (!feof($h)) { $buf = fread($h, $bsize); $size = strlen($buf); call_user_func_array($onData, array(haxe_io_Bytes::ofString($buf), 0, $size)); unset($size, $buf); } fclose($h); unset($h, $bsize); } unset($tmp, $part, $info, $file, $err); } }
public function write($s) { $this->writeBinary(haxe_io_Bytes::ofString($s)->b); }
static function decodeBase64($imageParameter) { $b = new com_wiris_system_Base64(); $dataDecoded = $b->decodeBytes(haxe_io_Bytes::ofString($imageParameter)); return $dataDecoded; }
public function writeFloat($x) { $this->write(haxe_io_Bytes::ofString(pack("f", $x))); }
static function toBytes($s) { return haxe_io_Bytes::ofString($s)->b; }