当前位置: 首页>>代码示例>>PHP>>正文


PHP AJXP_Utils::roundSize方法代码示例

本文整理汇总了PHP中AJXP_Utils::roundSize方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Utils::roundSize方法的具体用法?PHP AJXP_Utils::roundSize怎么用?PHP AJXP_Utils::roundSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AJXP_Utils的用法示例。


在下文中一共展示了AJXP_Utils::roundSize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: precheckQuotaUsage

 /**
  * @param AJXP_Node $node
  * @param int $newSize
  * @return mixed
  * @throws Exception
  */
 public function precheckQuotaUsage($node, $newSize = 0)
 {
     // POSITIVE DELTA ?
     if ($newSize == 0) {
         return null;
     }
     $delta = $newSize;
     $quota = $this->getAuthorized();
     $path = $this->getWorkingPath();
     $q = $this->getUsage($path);
     AJXP_Logger::debug("QUOTA : Previous usage was {$q}");
     if ($q === false) {
         $q = $this->computeDirSpace($path);
     }
     if ($q + $delta >= $quota) {
         $mess = ConfService::getMessages();
         throw new Exception($mess["meta.quota.3"] . " (" . AJXP_Utils::roundSize($quota) . ")!");
     }
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:25,代码来源:class.QuotaComputer.php

示例2: precheckQuotaUsage

 /**
  * @param AJXP_Node $node
  * @param int $newSize
  * @return mixed
  * @throws Exception
  */
 public function precheckQuotaUsage($node, $newSize = 0)
 {
     // POSITIVE DELTA ?
     if ($newSize == 0) {
         return null;
     }
     $delta = $newSize;
     $quota = $this->getAuthorized();
     $soft = $this->getSoftLimit();
     $q = $this->getUsage();
     $this->logDebug("QUOTA : Previous usage was {$q}");
     if ($q + $delta >= $quota) {
         $mess = ConfService::getMessages();
         throw new Exception($mess["meta.quota.3"] . " (" . AJXP_Utils::roundSize($quota) . ")!");
     } else {
         if ($soft !== false && $q + $delta >= $soft && $q <= $soft) {
             $this->sendSoftLimitAlert();
         }
     }
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:26,代码来源:class.QuotaComputer.php

示例3: detectDLParts

 /**
  * @param AJXP_Node $ajxpNode
  */
 public function detectDLParts(&$ajxpNode)
 {
     if (!preg_match("/\\.dlpart\$/i", $ajxpNode->getUrl())) {
         return;
     }
     $basename = basename($ajxpNode->getUrl());
     $newName = "__" . str_replace(".dlpart", ".ser", $basename);
     $hidFile = str_replace($basename, $newName, $ajxpNode->getUrl());
     if (is_file($hidFile)) {
         $data = unserialize(file_get_contents($hidFile));
         if ($data["totalSize"] != -1) {
             $ajxpNode->target_bytesize = $data["totalSize"];
             $ajxpNode->target_filesize = AJXP_Utils::roundSize($data["totalSize"]);
             $ajxpNode->process_stoppable = isset($data["pid"]) ? "true" : "false";
         }
     }
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:20,代码来源:class.HttpDownloader.php

示例4: switchAction


//.........这里部分代码省略.........
                 // skip "complete" mode that was in fact quite the same as standard tree listing (dz)
             }
             if (!isset($dir) || $dir == "/") {
                 $dir = "";
             }
             $searchMode = $fileListMode = $completeMode = false;
             if (isset($mode)) {
                 if ($mode == "search") {
                     $searchMode = true;
                 } else {
                     if ($mode == "file_list") {
                         $fileListMode = true;
                     } else {
                         if ($mode == "complete") {
                             $completeMode = true;
                         }
                     }
                 }
             }
             $nom_rep = $dir;
             //AJXP_Exception::errorToXml($nom_rep);
             $result = $this->SSHOperation->listFilesIn($nom_rep);
             $metaData = array();
             if (RecycleBinManager::recycleEnabled() && RecycleBinManager::currentLocationIsRecycle($dir)) {
                 $metaData["ajxp_mime"] = "ajxp_recycle";
             }
             AJXP_XMLWriter::renderHeaderNode(AJXP_Utils::xmlEntities($dir, true), AJXP_Utils::xmlEntities(basename($dir), true), false, $metaData);
             foreach ($result as $file) {
                 $attributes = "";
                 $fileName = SystemTextEncoding::toUTF8($file["name"]);
                 $icon = AJXP_Utils::mimetype($fileName, "image", $file["isDir"] == 1);
                 if ($searchMode) {
                     if ($file["isDir"] == 0) {
                         $attributes = "is_file=\"true\" icon=\"" . SystemTextEncoding::toUTF8($icon) . "\"";
                     }
                 } else {
                     if ($fileListMode) {
                         $atts = array();
                         $atts[] = "is_file=\"" . (1 - $file["isDir"]) . "\"";
                         $atts[] = "is_image=\"" . AJXP_Utils::is_image($fileName) . "\"";
                         $atts[] = "mimestring=\"" . AJXP_Utils::mimetype($fileName, "type", $file["isDir"] == 1) . "\"";
                         $atts[] = "ajxp_modiftime=\"" . $this->dateModif($file["time"]) . "\"";
                         $atts[] = "filesize=\"" . AJXP_Utils::roundSize($file["size"]) . "\"";
                         $atts[] = "bytesize=\"" . $file["size"] . "\"";
                         $atts[] = "filename=\"" . str_replace("&", "&amp;", $dir . "/" . $fileName) . "\"";
                         $atts[] = "icon=\"" . ($file["isDir"] == 1 ? "folder.png" : SystemTextEncoding::toUTF8($icon)) . "\"";
                         $attributes = join(" ", $atts);
                     } else {
                         if ($file["isDir"] == 1) {
                             $link = SERVER_ACCESS . "?dir=" . $dir . "/" . $fileName;
                             $link = urlencode($link);
                             $folderBaseName = str_replace("&", "&amp;", $fileName);
                             $folderFullName = "{$dir}/" . $folderBaseName;
                             $parentFolderName = $dir;
                             if (!$completeMode) {
                                 $icon = "folder.png";
                                 $openicon = "folder_open.png";
                                 if (preg_match("/\\.zip\$/", $file["name"])) {
                                     $icon = $openicon = CLIENT_RESOURCES_FOLDER . "/images/actions/16/accessories-archiver.png";
                                 }
                                 $attributes = "icon=\"{$icon}\"  openicon=\"{$openicon}\" filename=\"" . $folderFullName . "\" src=\"{$link}\"";
                             }
                         }
                     }
                 }
                 if (strlen($attributes) > 0) {
                     print "<tree text=\"" . str_replace("&", "&amp;", SystemTextEncoding::toUTF8($this->SSHOperation->unescapeFileName($file["name"]))) . "\" {$attributes}>";
                     print "</tree>";
                 }
             }
             AJXP_XMLWriter::close();
             exit(1);
             break;
     }
     if (isset($logMessage) || isset($errorMessage)) {
         $xmlBuffer .= AJXP_XMLWriter::sendMessage(isset($logMessage) ? $logMessage : null, isset($errorMessage) ? $errorMessage : null, false);
     }
     if (isset($requireAuth)) {
         $xmlBuffer .= AJXP_XMLWriter::requireAuth(false);
     }
     if (isset($reloadContextNode)) {
         if (!isset($pendingSelection)) {
             $pendingSelection = "";
         }
         $xmlBuffer .= AJXP_XMLWriter::reloadDataNode("", $pendingSelection, false);
     }
     if (isset($reloadDataNode)) {
         $xmlBuffer .= AJXP_XMLWriter::reloadDataNode($reloadDataNode, "", false);
     }
     if (isset($reload_current_node) && $reload_current_node == "true") {
         $xmlBuffer .= AJXP_XMLWriter::reloadCurrentNode(false);
     }
     if (isset($reload_dest_node) && $reload_dest_node != "") {
         $xmlBuffer .= AJXP_XMLWriter::reloadNode($reload_dest_node, false);
     }
     if (isset($reload_file_list)) {
         $xmlBuffer .= AJXP_XMLWriter::reloadFileList($reload_file_list, false);
     }
     return $xmlBuffer;
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:101,代码来源:class.sshAccessDriver.php

示例5: loadNodeInfo

 /**
  * @param AJXP_Node $ajxpNode
  * @param bool $parentNode
  * @param bool $details
  * @return void
  */
 public function loadNodeInfo(&$ajxpNode, $parentNode = false, $details = false)
 {
     $nodeName = basename($ajxpNode->getPath());
     $metaData = $ajxpNode->metadata;
     if (!isset($metaData["is_file"])) {
         $isLeaf = is_file($ajxpNode->getUrl()) || AJXP_Utils::isBrowsableArchive($nodeName);
         $metaData["is_file"] = $isLeaf ? "1" : "0";
     } else {
         $isLeaf = $metaData["is_file"] == "1" ? true : false;
     }
     $metaData["filename"] = $ajxpNode->getPath();
     if (RecycleBinManager::recycleEnabled() && $ajxpNode->getPath() == RecycleBinManager::getRelativeRecycle()) {
         $mess = ConfService::getMessages();
         $recycleIcon = $this->countFiles($ajxpNode->getUrl(), false, true) > 0 ? "trashcan_full.png" : "trashcan.png";
         $metaData["icon"] = $recycleIcon;
         $metaData["mimestring"] = $mess[122];
         $ajxpNode->setLabel($mess[122]);
         $metaData["ajxp_mime"] = "ajxp_recycle";
     } else {
         $mimeData = AJXP_Utils::mimeData($ajxpNode->getUrl(), !$isLeaf);
         $metaData["mimestring_id"] = $mimeData[0];
         //AJXP_Utils::mimetype($ajxpNode->getUrl(), "type", !$isLeaf);
         $metaData["icon"] = $mimeData[1];
         //AJXP_Utils::mimetype($nodeName, "image", !$isLeaf);
         if ($metaData["icon"] == "folder.png") {
             $metaData["openicon"] = "folder_open.png";
         }
         if (!$isLeaf) {
             $metaData["ajxp_mime"] = "ajxp_folder";
         }
     }
     //if ($lsOptions["l"]) {
     $metaData["file_group"] = @filegroup($ajxpNode->getUrl()) || "unknown";
     $metaData["file_owner"] = @fileowner($ajxpNode->getUrl()) || "unknown";
     $crtPath = $ajxpNode->getPath();
     $vRoots = $this->repository->listVirtualRoots();
     if (!empty($crtPath)) {
         if (!@$this->isWriteable($ajxpNode->getUrl())) {
             $metaData["ajxp_readonly"] = "true";
         }
         if (isset($vRoots[ltrim($crtPath, "/")])) {
             $metaData["ajxp_readonly"] = $vRoots[ltrim($crtPath, "/")]["right"] == "r" ? "true" : "false";
         }
     } else {
         if (count($vRoots)) {
             $metaData["ajxp_readonly"] = "true";
         }
     }
     $fPerms = @fileperms($ajxpNode->getUrl());
     if ($fPerms !== false) {
         $fPerms = substr(decoct($fPerms), $isLeaf ? 2 : 1);
     } else {
         $fPerms = '0000';
     }
     $metaData["file_perms"] = $fPerms;
     $datemodif = $this->date_modif($ajxpNode->getUrl());
     $metaData["ajxp_modiftime"] = $datemodif ? $datemodif : "0";
     $metaData["bytesize"] = 0;
     if ($isLeaf) {
         $metaData["bytesize"] = $this->filesystemFileSize($ajxpNode->getUrl());
     }
     $metaData["filesize"] = AJXP_Utils::roundSize($metaData["bytesize"]);
     if (AJXP_Utils::isBrowsableArchive($nodeName)) {
         $metaData["ajxp_mime"] = "ajxp_browsable_archive";
     }
     if ($details == "minimal") {
         $miniMeta = array("is_file" => $metaData["is_file"], "filename" => $metaData["filename"], "bytesize" => $metaData["bytesize"], "ajxp_modiftime" => $metaData["ajxp_modiftime"]);
         $ajxpNode->mergeMetadata($miniMeta);
     } else {
         $ajxpNode->mergeMetadata($metaData);
     }
 }
开发者ID:biggtfish,项目名称:cms,代码行数:78,代码来源:class.fsAccessDriver.php

示例6: listingEndElement

 function listingEndElement($parser, $tag)
 {
     if ($tag == "ENTRY") {
         if ($this->crtListingMode == "file_list" || $this->crtListingMode == "search") {
             if (!$this->crtElement["is_file"]) {
                 $this->crtElement["filesize"] = "-";
             }
             $this->crtElement["mimestring"] = AJXP_Utils::mimetype($this->crtElement["filename"], "text", !$this->crtElement["is_file"]);
             $this->crtElement["icon"] = AJXP_Utils::mimetype($this->crtElement["filename"], "image", !$this->crtElement["is_file"]);
             $this->crtElement["is_file"] = $this->crtElement["is_file"] ? "1" : "0";
             $this->listElements[] = $this->crtElement;
         } else {
             if (!$this->crtElement["is_file"]) {
                 $this->crtElement["icon"] = CLIENT_RESOURCES_FOLDER . "/images/foldericon.png";
                 $this->crtElement["openicon"] = CLIENT_RESOURCES_FOLDER . "/images/openfoldericon.png";
                 $this->crtElement["src"] = SERVER_ACCESS . "?dir=" . $this->crtPath . "/" . $this->crtElement["text"];
                 $this->crtElement["parentname"] = $this->crtPath == "/" ? "" : $this->crtPath;
                 $this->crtElement["action"] = "javascript:ajaxplorer.getFoldersTree().clickNode(CURRENT_ID)";
                 $this->crtElement["is_file"] = $this->crtElement["is_file"] ? "1" : "0";
                 $this->listElements[] = $this->crtElement;
             }
         }
     } else {
         if ($tag == "NAME") {
             $this->crtElement["filename"] = $this->cdataBuffer;
             $this->crtElement["text"] = basename($this->cdataBuffer);
         } else {
             if ($tag == "AUTHOR" && $this->crtListingMode == "file_list") {
                 $this->crtElement["author"] = $this->cdataBuffer;
             } else {
                 if ($tag == "SIZE" && $this->crtListingMode == "file_list") {
                     $this->crtElement["filesize"] = AJXP_Utils::roundSize(intval($this->cdataBuffer));
                 } else {
                     if ($tag == "DATE" && $this->crtListingMode == "file_list") {
                         $date = $this->cdataBuffer;
                         $split = explode("T", $date);
                         $realDate = $split[0];
                         $split = explode("\\.", $split[1]);
                         $realTime = $split[0];
                         $this->crtElement["modiftime"] = date("d/m/Y H:i", strtotime($realDate . " " . $realTime));
                     }
                 }
             }
         }
     }
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:46,代码来源:class.svnAccessDriver.php

示例7: switchAction


//.........这里部分代码省略.........
                     if (AJXP_Utils::isBrowsableArchive($nodeName)) {
                         if ($lsOptions["f"] && $lsOptions["z"]) {
                             // See archives as files
                             $nodeType = "f";
                         } else {
                             $nodeType = "z";
                         }
                     } else {
                         $nodeType = "f";
                     }
                 }
                 if ($offset > 0 && $cursor < $offset) {
                     $cursor++;
                     continue;
                 }
                 if ($limitPerPage > 0 && $cursor - $offset >= $limitPerPage) {
                     break;
                 }
                 $metaData = array();
                 $currentFile = $path . "/" . $nodeName;
                 $metaData["is_file"] = $isLeaf ? "1" : "0";
                 $metaData["filename"] = AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($dir . "/" . $nodeName));
                 $metaData["icon"] = AJXP_Utils::mimetype($nodeName, "image", !$isLeaf);
                 if ($metaData["icon"] == "folder.png") {
                     $metaData["openicon"] = "folder_open.png";
                 }
                 if (!is_file($currentFile) || AJXP_Utils::isBrowsableArchive($nodeName)) {
                     $link = SystemTextEncoding::toUTF8(SERVER_ACCESS . "?get_action=ls&options=dz&dir=" . $dir . "/" . $nodeName);
                     $link = urlencode($link);
                     $metaData["src"] = $link;
                 }
                 if ($lsOptions["l"]) {
                     $metaData["file_group"] = @filegroup($currentFile) || "unknown";
                     $metaData["file_owner"] = @fileowner($currentFile) || "unknown";
                     $fPerms = @fileperms($currentFile);
                     if ($fPerms !== false) {
                         $fPerms = substr(decoct($fPerms), $isLeaf ? 2 : 1);
                     } else {
                         $fPerms = '0000';
                     }
                     $metaData["file_perms"] = $fPerms;
                     $metaData["mimestring"] = AJXP_Utils::mimetype($currentFile, "type", !$isLeaf);
                     $datemodif = $this->date_modif($currentFile);
                     $metaData["ajxp_modiftime"] = $datemodif ? $datemodif : "0";
                     $metaData["bytesize"] = 0;
                     if ($isLeaf) {
                         $metaData["bytesize"] = filesize($currentFile);
                     }
                     $metaData["filesize"] = AJXP_Utils::roundSize($metaData["bytesize"]);
                     if (AJXP_Utils::isBrowsableArchive($nodeName)) {
                         $metaData["ajxp_mime"] = "ajxp_browsable_archive";
                     }
                     $realFile = null;
                     // A reference to the real file.
                     AJXP_Controller::applyHook("ls.metadata", array($currentFile, &$metaData, $this->wrapperClassName, &$realFile));
                 }
                 $attributes = "";
                 foreach ($metaData as $key => $value) {
                     $attributes .= "{$key}=\"{$value}\" ";
                 }
                 $renderNodeData = array(AJXP_Utils::xmlEntities($dir . "/" . $nodeName, true), AJXP_Utils::xmlEntities($nodeName, true), $isLeaf, $metaData);
                 $fullList[$nodeType][$nodeName] = $renderNodeData;
                 $cursor++;
             }
             foreach ($fullList as $key => $list) {
                 uksort($list, 'strnatcasecmp');
                 $fullList[$key] = $list;
             }
             $allNodes = array_merge($fullList["d"], $fullList["z"], $fullList["f"]);
             array_map(array("AJXP_XMLWriter", "renderNodeArray"), $fullList["d"]);
             array_map(array("AJXP_XMLWriter", "renderNodeArray"), $fullList["z"]);
             array_map(array("AJXP_XMLWriter", "renderNodeArray"), $fullList["f"]);
             // ADD RECYCLE BIN TO THE LIST
             if ($dir == "" && RecycleBinManager::recycleEnabled()) {
                 $recycleBinOption = RecycleBinManager::getRelativeRecycle();
                 if (file_exists($this->urlBase . $recycleBinOption)) {
                     $recycleIcon = $this->countFiles($this->urlBase . $recycleBinOption, false, true) > 0 ? "trashcan_full.png" : "trashcan.png";
                     AJXP_XMLWriter::renderNode($recycleBinOption, AJXP_Utils::xmlEntities($mess[122]), false, array("ajxp_modiftime" => $this->date_modif($this->urlBase . $recycleBinOption), "mimestring" => AJXP_Utils::xmlEntities($mess[122]), "icon" => "{$recycleIcon}", "filesize" => "-", "ajxp_mime" => "ajxp_recycle"));
                 }
             }
             AJXP_Logger::debug("LS Time : " . intval((microtime() - $startTime) * 1000) . "ms");
             AJXP_XMLWriter::close();
             return;
             break;
     }
     $xmlBuffer = "";
     if (isset($logMessage) || isset($errorMessage)) {
         $xmlBuffer .= AJXP_XMLWriter::sendMessage(isset($logMessage) ? $logMessage : null, isset($errorMessage) ? $errorMessage : null, false);
     }
     if ($reloadContextNode) {
         if (!isset($pendingSelection)) {
             $pendingSelection = "";
         }
         $xmlBuffer .= AJXP_XMLWriter::reloadDataNode("", $pendingSelection, false);
     }
     if (isset($reloadDataNode)) {
         $xmlBuffer .= AJXP_XMLWriter::reloadDataNode($reloadDataNode, "", false);
     }
     return $xmlBuffer;
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:101,代码来源:class.fsAccessDriver.php

示例8: getSize

 public function getSize($tablename)
 {
     $repo = ConfService::getRepository();
     $dbname = $repo->getOption("DB_NAME");
     $like = "";
     $total = "";
     $t = 0;
     if ($tablename != "") {
         $like = " like '{$tablename}'";
     }
     $sql = "SHOW TABLE STATUS FROM `{$dbname}` {$like}";
     $result = $this->execQuery($sql);
     if ($result) {
         while ($rec = mysql_fetch_array($result)) {
             $t += $rec['Data_length'] + $rec['Index_length'];
         }
         $total = AJXP_Utils::roundSize($t);
     } else {
         $total = "Unknown";
     }
     return $total;
 }
开发者ID:biggtfish,项目名称:cms,代码行数:22,代码来源:class.mysqlAccessDriver.php


注:本文中的AJXP_Utils::roundSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。