當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SystemTextEncoding::toStorageEncoding方法代碼示例

本文整理匯總了PHP中SystemTextEncoding::toStorageEncoding方法的典型用法代碼示例。如果您正苦於以下問題:PHP SystemTextEncoding::toStorageEncoding方法的具體用法?PHP SystemTextEncoding::toStorageEncoding怎麽用?PHP SystemTextEncoding::toStorageEncoding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SystemTextEncoding的用法示例。


在下文中一共展示了SystemTextEncoding::toStorageEncoding方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initPath

 /**
  * Initialize the stream from the given path.
  *
  * @param string $path
  * @param $streamType
  * @param bool $storeOpenContext
  * @param bool $skipZip
  * @return mixed Real path or -1 if currentListing contains the listing : original path converted to real path
  * @throws AJXP_Exception
  * @throws Exception
  */
 protected static function initPath($path, $streamType, $storeOpenContext = false, $skipZip = false)
 {
     $path = self::unPatchPathForBaseDir($path);
     $url = AJXP_Utils::safeParseUrl($path);
     $repoId = $url["host"];
     $test = trim($url["path"], "/");
     $atRoot = empty($test);
     $repoObject = ConfService::getRepositoryById($repoId);
     if (!isset($repoObject)) {
         throw new Exception("Cannot find repository with id " . $repoId);
     }
     $split = UserSelection::detectZip($url["path"]);
     $insideZip = false;
     if ($split && $streamType == "file" && $split[1] != "/") {
         $insideZip = true;
     }
     if ($split && $streamType == "dir") {
         $insideZip = true;
     }
     if ($skipZip) {
         $insideZip = false;
     }
     $resolveUser = null;
     if (isset($url["user"]) && AuthService::usersEnabled()) {
         $resolveUser = ConfService::getConfStorageImpl()->createUserObject($url["user"]);
     }
     $resolvedPath = realpath(SystemTextEncoding::toStorageEncoding($repoObject->getOption("PATH", false, $resolveUser)));
     //var_dump($path);
     //var_dump($skipZip);
     // Inside a zip : copy the file to a tmp file and return a reference to it
     if ($insideZip) {
         $zipPath = $split[0];
         $localPath = $split[1];
         require_once AJXP_BIN_FOLDER . "/pclzip.lib.php";
         //print($streamType.$path);
         if ($streamType == "file") {
             if (self::$crtZip == null || !is_array(self::$currentListingKeys)) {
                 $tmpDir = AJXP_Utils::getAjxpTmpDir() . DIRECTORY_SEPARATOR . md5(time() - rand());
                 mkdir($tmpDir);
                 $tmpFileName = $tmpDir . DIRECTORY_SEPARATOR . basename($localPath);
                 AJXP_Logger::debug(__CLASS__, __FUNCTION__, "Tmp file {$tmpFileName}");
                 register_shutdown_function(array("fsAccessWrapper", "removeTmpFile"), $tmpDir, $tmpFileName);
                 $crtZip = new PclZip(AJXP_Utils::securePath($resolvedPath . $repoObject->resolveVirtualRoots($zipPath)));
                 $content = $crtZip->listContent();
                 if (is_array($content)) {
                     foreach ($content as $item) {
                         $fName = AJXP_Utils::securePath($item["stored_filename"]);
                         if ($fName == $localPath || "/" . $fName == $localPath) {
                             $localPath = $fName;
                             break;
                         }
                     }
                 }
                 $crtZip->extract(PCLZIP_OPT_BY_NAME, $localPath, PCLZIP_OPT_PATH, $tmpDir, PCLZIP_OPT_REMOVE_ALL_PATH);
                 AJXP_Logger::debug(__CLASS__, __FUNCTION__, "Extracted " . $path . " to " . dirname($localPath));
                 if ($storeOpenContext) {
                     self::$crtZip = $crtZip;
                 }
                 return $tmpFileName;
             } else {
                 $key = basename($localPath);
                 if (array_key_exists($key, self::$currentListing)) {
                     self::$currentFileKey = $key;
                     return -1;
                 } else {
                     throw new AJXP_Exception("Cannot find key");
                 }
             }
         } else {
             $crtZip = new PclZip(AJXP_Utils::securePath($resolvedPath . $repoObject->resolveVirtualRoots($zipPath)));
             $liste = $crtZip->listContent();
             if (!is_array($liste)) {
                 $liste = array();
             }
             if ($storeOpenContext) {
                 self::$crtZip = $crtZip;
             }
             $folders = array();
             $files = array();
             $builtFolders = array();
             if ($localPath[strlen($localPath) - 1] != "/") {
                 $localPath .= "/";
             }
             foreach ($liste as $item) {
                 $stored = $item["stored_filename"];
                 if ($stored[0] != "/") {
                     $stored = "/" . $stored;
                 }
                 $pathPos = strpos($stored, $localPath);
//.........這裏部分代碼省略.........
開發者ID:Nanomani,項目名稱:pydio-core,代碼行數:101,代碼來源:class.fsAccessWrapper.php

示例2: makeSharedRepositoryOptions

 public function makeSharedRepositoryOptions($httpVars, $repository)
 {
     $newOptions = array("PATH" => SystemTextEncoding::toStorageEncoding($repository->getOption("PATH")) . AJXP_Utils::decodeSecureMagic($httpVars["file"]), "CREATE" => isset($httpVars["inherit_recycle"]) ? $repository->getOption("CREATE") : false, "RECYCLE_BIN" => isset($httpVars["inherit_recycle"]) ? $repository->getOption("RECYCLE_BIN") : "", "DEFAULT_RIGHTS" => "");
     if ($repository->getOption("USE_SESSION_CREDENTIALS") === true) {
         $newOptions["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
     }
     return $newOptions;
 }
開發者ID:ad-m,項目名稱:pydio-core,代碼行數:8,代碼來源:class.fsAccessDriver.php

示例3: findMirrorNodesInShares

 /**
  * @param AJXP_Node $node
  * @param String|null $direction "UP", "DOWN"
  * @return array()
  */
 private function findMirrorNodesInShares($node, $direction)
 {
     $result = array();
     if ($direction !== "UP") {
         $upmetas = array();
         $this->getShareStore()->getMetaManager()->collectSharesInParent($node, $upmetas);
         foreach ($upmetas as $metadata) {
             if (is_array($metadata) && !empty($metadata["shares"])) {
                 foreach ($metadata["shares"] as $sId => $sData) {
                     $type = $sData["type"];
                     if ($type == "file") {
                         continue;
                     }
                     $wsId = $sId;
                     if ($type == "minisite") {
                         $minisiteData = $this->getShareStore()->loadShare($sId);
                         if (empty($minisiteData) || !isset($minisiteData["REPOSITORY"])) {
                             continue;
                         }
                         $wsId = $minisiteData["REPOSITORY"];
                     } else {
                         if ($type == "ocs_remote") {
                             continue;
                         }
                     }
                     $sharedNode = $metadata["SOURCE_NODE"];
                     $sharedPath = substr($node->getPath(), strlen($sharedNode->getPath()));
                     $sharedNodeUrl = $node->getScheme() . "://" . $wsId . $sharedPath;
                     $result[$wsId] = array(new AJXP_Node($sharedNodeUrl), "DOWN");
                     $this->logDebug('MIRROR NODES', 'Found shared in parent - register node ' . $sharedNodeUrl);
                 }
             }
         }
     }
     if ($direction !== "DOWN") {
         if ($node->getRepository()->hasParent()) {
             $parentRepoId = $node->getRepository()->getParentId();
             $parentRepository = ConfService::getRepositoryById($parentRepoId);
             if (!empty($parentRepository) && !$parentRepository->isTemplate) {
                 $currentRoot = $node->getRepository()->getOption("PATH");
                 $owner = $node->getRepository()->getOwner();
                 $resolveUser = null;
                 if ($owner != null) {
                     $resolveUser = ConfService::getConfStorageImpl()->createUserObject($owner);
                 }
                 $parentRoot = $parentRepository->getOption("PATH", false, $resolveUser);
                 $relative = substr($currentRoot, strlen($parentRoot));
                 $relative = SystemTextEncoding::toStorageEncoding($relative);
                 $parentNodeURL = $node->getScheme() . "://" . $parentRepoId . $relative . $node->getPath();
                 $this->logDebug("action.share", "Should trigger on " . $parentNodeURL);
                 $parentNode = new AJXP_Node($parentNodeURL);
                 if ($owner != null) {
                     $parentNode->setUser($owner);
                 }
                 $result[$parentRepoId] = array($parentNode, "UP");
             }
         }
     }
     return $result;
 }
開發者ID:Nanomani,項目名稱:pydio-core,代碼行數:65,代碼來源:class.ShareCenter.php

示例4: makeSharedRepositoryOptions

 public function makeSharedRepositoryOptions($httpVars, $repository)
 {
     $newOptions = array("PATH" => SystemTextEncoding::toStorageEncoding($repository->getOption("PATH")) . AJXP_Utils::decodeSecureMagic($httpVars["file"]), "CREATE" => $repository->getOption("CREATE"), "RECYCLE_BIN" => isset($httpVars["inherit_recycle"]) ? $repository->getOption("RECYCLE_BIN") : "", "DEFAULT_RIGHTS" => "", "DATA_TEMPLATE" => "");
     if ($repository->getOption("USE_SESSION_CREDENTIALS") === true) {
         $newOptions["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
     }
     $customData = array();
     foreach ($httpVars as $key => $value) {
         if (substr($key, 0, strlen("PLUGINS_DATA_")) == "PLUGINS_DATA_") {
             $customData[substr($key, strlen("PLUGINS_DATA_"))] = $value;
         }
     }
     if (count($customData)) {
         $newOptions["PLUGINS_DATA"] = $customData;
     }
     if ($repository->getOption("META_SOURCES")) {
         $newOptions["META_SOURCES"] = $repository->getOption("META_SOURCES");
         foreach ($newOptions["META_SOURCES"] as $index => &$data) {
             if (isset($data["USE_SESSION_CREDENTIALS"]) && $data["USE_SESSION_CREDENTIALS"] === true) {
                 $newOptions["META_SOURCES"][$index]["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
             }
         }
         AJXP_Controller::applyHook("workspace.share_metasources", array(&$newOptions["META_SOURCES"]));
     }
     return $newOptions;
 }
開發者ID:Nanomani,項目名稱:pydio-core,代碼行數:26,代碼來源:class.fsAccessDriver.php


注:本文中的SystemTextEncoding::toStorageEncoding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。