예제 #1
0
 public function service($serviceName, $param, $response)
 {
     $this->serviceName = $serviceName;
     $this->param = $param;
     $this->response = $response;
     $this->digest = null;
     if (com_wiris_plugin_impl_TextServiceImpl::hasCache($serviceName)) {
         $this->digest = $this->plugin->newRender()->computeDigest(null, $param);
         $store = $this->plugin->getStorageAndCache();
         $ext = com_wiris_plugin_impl_TextServiceImpl::getDigestExtension($serviceName, $param);
         $s = $store->retreiveData($this->digest, $ext);
         if ($s !== null) {
             $response->returnString(com_wiris_system_Utf8::fromBytes($s));
             return;
         }
     }
     $url = $this->plugin->getImageServiceURL($serviceName, true);
     $h = new com_wiris_plugin_impl_HttpImpl($url, $this);
     $this->plugin->addReferer($h);
     $this->plugin->addProxy($h);
     if ($param !== null) {
         $ha = com_wiris_system_PropertiesTools::fromProperties($param);
         $iter = $ha->keys();
         while ($iter->hasNext()) {
             $k = $iter->next();
             $h->setParameter($k, $ha->get($k));
             unset($k);
         }
     }
     $h->request(true);
 }
 public function service($serviceName, $param)
 {
     $digest = null;
     if (com_wiris_plugin_impl_TextServiceImpl::hasCache($serviceName)) {
         $digest = $this->plugin->newRender()->computeDigest(null, $param);
         $store = $this->plugin->getStorageAndCache();
         $ext = com_wiris_plugin_impl_TextServiceImpl::getDigestExtension($serviceName, $param);
         $s = $store->retreiveData($digest, $ext);
         if ($s !== null) {
             return com_wiris_system_Utf8::fromBytes($s);
         }
     }
     $result = $this->serviceText($serviceName, $param);
     if ($digest !== null) {
         $store = $this->plugin->getStorageAndCache();
         $ext = com_wiris_plugin_impl_TextServiceImpl::getDigestExtension($serviceName, $param);
         $store->storeData($digest, $ext, com_wiris_system_Utf8::toBytes($result));
     }
     return $result;
 }