public function codeDigest($content)
 {
     $formula = $this->getAndCheckFolder(com_wiris_plugin_api_ConfigurationKeys::$FORMULA_FOLDER);
     $digest = com_wiris_system_Md5Tools::encodeString($content);
     $store = com_wiris_util_sys_Store::newStoreWithParent(com_wiris_util_sys_Store::newStore($formula), $digest . ".ini");
     $store->write($content);
     return $digest;
 }
 public function decodeDigest($digest)
 {
     $formula = $this->getAndCheckFolder(com_wiris_plugin_api_ConfigurationKeys::$FORMULA_FOLDER);
     $store = $this->getFileStore($formula, $digest, "ini");
     if (com_wiris_plugin_impl_FolderTreeStorageAndCache::$backwards_compat) {
         if (!$store->exists()) {
             $oldstore = com_wiris_util_sys_Store::newStore($formula . "/" . $digest . ".ini");
             $parent = $store->getParent();
             $parent->mkdirs();
             $oldstore->moveTo($store);
         }
     }
     return $store->read();
 }
示例#3
0
 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);
     }
 }
示例#4
0
 static function newStoreWithParent($store, $str)
 {
     return com_wiris_util_sys_Store::newStore($store->getFile() . "/" . $str);
 }