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


PHP CMbString::toDecaBinary方法代码示例

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


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

示例1: getValue

 /**
  * @see parent::getValue()
  */
 function getValue($object, $smarty = null, $params = array())
 {
     if (!isset($this->byteUnit)) {
         return parent::getValue($object, $smarty, $params);
     }
     $propValue = $object->{$this->fieldName};
     $ratio = 1;
     switch ($this->byteUnit) {
         case "GB":
             $ratio *= 1024;
         case "MB":
             $ratio *= 1024;
         case "KB":
             $ratio *= 1024;
         case "B":
         default:
     }
     return CMbString::toDecaBinary($propValue * $ratio);
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:22,代码来源:CNumSpec.class.php

示例2: updateFormFields

 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_file_size = CMbString::toDecaBinary($this->doc_size);
     $this->getSendProblem();
     $this->loadRefCategory();
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:10,代码来源:CDocumentItem.class.php

示例3: allInOne

 /**
  * Embed all the external resources of the current output buffer inside a single file and outputs it.
  *
  * @param string $path Path to save the files to
  * 
  * @return void|string
  */
 private static function allInOne($path = null, $options = array())
 {
     if ($path) {
         self::$_path = rtrim($path, "/\\") . "/";
     }
     CApp::setMemoryLimit("256M");
     self::$_fp_out = CMbPath::getTempFile();
     $re_img = "/<img([^>]*)src\\s*=\\s*[\"']([^\"']+)[\"']([^>]*)(>|\$)/i";
     $re_link = "/<link[^>]*rel=\"stylesheet\"[^>]*href\\s*=\\s*[\"']([^\"']+)[\"'][^>]*>/i";
     $re_script = "/<script[^>]*src\\s*=\\s*[\"']([^\"']+)[\"'][^>]*>\\s*<\\/script>/i";
     $re_a = "/<a([^>]*)href\\s*=\\s*[\"']embed:([^\"']+)[\"']([^>]*)>/i";
     $ignore_scripts = !empty($options["ignore_scripts"]);
     // End Output Buffering
     ob_end_clean();
     ob_start();
     rewind(self::$_fp_in);
     while (!feof(self::$_fp_in)) {
         $line = fgets(self::$_fp_in);
         $line = preg_replace_callback($re_img, array('self', 'replaceImgSrc'), $line);
         $line = preg_replace_callback($re_link, array('self', 'replaceStylesheet'), $line);
         if (!$ignore_scripts) {
             $line = preg_replace_callback($re_script, array('self', 'replaceScriptSrc'), $line);
         }
         if (self::$_path) {
             $line = preg_replace_callback($re_a, array('self', 'replaceAEmbed'), $line);
         }
         fwrite(self::$_fp_out, $line);
     }
     ob_end_clean();
     $length = 0;
     rewind(self::$_fp_out);
     $full_str = "";
     while (!feof(self::$_fp_out)) {
         $line = fgets(self::$_fp_out);
         $length += strlen($line);
         $line = str_replace("[[AIO-length]]", CMbString::toDecaBinary($length), $line);
         if (strpos($line, "[[AIO-memory]]") !== false) {
             $line = str_replace("[[AIO-memory]]", self::getOutputMemory(true), $line);
         }
         if ($path) {
             $full_str .= $line;
         } else {
             echo $line;
         }
     }
     return $full_str;
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:54,代码来源:CHTMLResourceLoader.class.php

示例4: getListFilesDetails

 function getListFilesDetails($current_directory)
 {
     $contain = scandir($current_directory);
     $fileInfo = array();
     foreach ($contain as $_contain) {
         $full_path = $current_directory . $_contain;
         if (!is_dir($full_path) && @filetype($full_path) && !is_link($full_path)) {
             $fileInfo[] = array("type" => "f", "user" => fileowner($full_path), "size" => CMbString::toDecaBinary(filesize($full_path)), "date" => strftime(CMbDT::ISO_DATETIME, filemtime($full_path)), "name" => $_contain, "relativeDate" => CMbDT::daysRelative(fileatime($full_path), CMbDT::date()));
         }
     }
     return $fileInfo;
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:12,代码来源:CSourceFileSystem.class.php

示例5: _getListFilesDetails

 private function _getListFilesDetails($folder = ".")
 {
     if (!$this->connexion) {
         throw new CMbException("CSourceFTP-connexion-failed", $this->hostname);
     }
     $files = ftp_rawlist($this->connexion, $folder);
     if ($files === false) {
         throw new CMbException("CSourceFTP-getlistfiles-failed", $this->hostname);
     }
     $system = $this->type_system;
     $limit = 9;
     if ($system && strpos($system, "Windows") !== false) {
         $limit = 4;
     }
     $fileInfo = array();
     foreach ($files as $_file) {
         $pregInfo = preg_split("/[\\s]+/", $_file, $limit);
         if ($system && strpos($system, "Windows") !== false) {
             $format = "m-d-y h:iA";
             $datetime = "{$pregInfo['0']} {$pregInfo['1']}";
             $type = strpos($pregInfo[2], "DIR") ? "d" : "f";
             $user = "";
             $size = $pregInfo[2];
             $name = $pregInfo[3];
         } else {
             $year = $pregInfo[7];
             if (strpos($year, ":")) {
                 $year = explode("-", CMbDT::date());
                 $year = $year[0] . " {$pregInfo['7']}";
             }
             $format = "M-d-Y H:i";
             $datetime = "{$pregInfo['5']}-{$pregInfo['6']}-{$year}";
             $type = $pregInfo[0];
             $user = "{$pregInfo['2']} {$pregInfo['3']}";
             $size = $pregInfo[4];
             $name = $pregInfo[8];
         }
         if (strpos($type, "d") !== false || $pregInfo[0] == "total") {
             continue;
         }
         $datetime = DateTime::createFromFormat($format, $datetime);
         $date = "";
         if ($datetime) {
             $date = $datetime->format("d-m-Y H:m");
         }
         $fileInfo[] = array("type" => $type, "user" => $user, "size" => CMbString::toDecaBinary($size), "date" => $date, "name" => $name, "relativeDate" => CMbDT::daysRelative($date, CMbDT::date()));
     }
     return $fileInfo;
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:49,代码来源:CFTP.class.php

示例6: decabinary

 /**
  * Converts a value to decabinary format
  * Example: {$value|decabinary}
  *
  * @param float $value The value to format
  *
  * @return string
  */
 function decabinary($value)
 {
     $decabinary = CMbString::toDecaBinary($value);
     return "<span title=\"{$value}\">{$decabinary}</span>";
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:13,代码来源:CSmartyMB.class.php

示例7: filesize

if (file_exists(CMbDebug::DEBUG_PATH)) {
    $debug_size = filesize(CMbDebug::DEBUG_PATH);
    $debug_size_limit = CMbDebug::DEBUG_SIZE_LIMIT;
    $offset = -1;
    if ($debug_size > $debug_size_limit) {
        $offset = $debug_size - $debug_size_limit;
    }
    $debug_content = file_get_contents(CMbDebug::DEBUG_PATH, false, null, $offset);
}
// Récupération de la liste des utilisateurs disponibles
$user = new CUser();
$user->template = "0";
$order = "user_last_name, user_first_name";
$list_users = $user->loadMatchingList($order);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("log", $log_content);
$smarty->assign("log_size", CMbString::toDecaBinary($log_size));
$smarty->assign("debug", $debug_content);
$smarty->assign("debug_size", CMbString::toDecaBinary($debug_size));
$smarty->assign("error_log", $error_log);
$smarty->assign("error_type", $error_type);
$smarty->assign("server_ip", $server_ip);
$smarty->assign("order_by", $order_by);
$smarty->assign("group_similar", $group_similar);
$smarty->assign("error_types", CError::getErrorTypesByCategory());
$smarty->assign("user_id", $user_id);
$smarty->assign("list_users", $list_users);
$smarty->assign("human", $human);
$smarty->assign("robot", $robot);
$smarty->display('view_logs.tpl');
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:31,代码来源:view_logs.php

示例8: unlink

if ($hash == 'clean') {
    unlink($filename);
    build_error_log();
}
if ($hash) {
    $doc = new DOMDocument();
    @$doc->loadHTMLFile($filename);
    $xpath = new DOMXPath($doc);
    $elements = $xpath->query("//div[@title='{$hash}']");
    foreach ($elements as $element) {
        $element->parentNode->removeChild($element);
    }
    $content = $doc->saveHTML();
    file_put_contents(CError::LOG_PATH, $content);
}
$log_content = null;
$log_size = 0;
if (file_exists($filename)) {
    $log_size = filesize($filename);
    $log_size_limit = CError::LOG_SIZE_LIMIT;
    $offset = -1;
    if ($log_size > $log_size_limit) {
        $offset = $log_size - $log_size_limit;
    }
    $log_content = file_get_contents($filename, false, null, $offset);
}
$log_size_deca = CMbString::toDecaBinary($log_size);
if (CAppUI::conf("error_logs_in_db")) {
    CAppUI::js("Control.Tabs.setTabCount('{$control_tabs_name}', '{$log_size_deca}')");
}
echo $log_content;
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:ajax_delete_logs.php

示例9: loadCartoInfos

 /**
  * Method to load cartos infos
  *
  * @param CSearch $c_search the csearch
  * @param array   $aggreg   the aggreg
  *
  * @return array
  */
 function loadCartoInfos($c_search, $aggreg)
 {
     $result = array();
     $search = new CSearchIndexing();
     // récupération de l'index, cluster
     $index = $c_search->loadIndex();
     $cluster = $c_search->_client->getCluster();
     // statistiques du cluster
     $path = '_cluster/stats';
     $response = $c_search->_client->request($path, Request::GET);
     $data = $response->getData();
     $result['stats']['cluster']["nbIndex"] = $data["indices"]["count"];
     $result['stats']['cluster']["nbDocsTotal"] = $data["indices"]["docs"]["count"];
     // récupération du mapping et du name_index
     $result['mapping'] = $index->getMapping();
     $result['mappingjson'] = json_encode($result['mapping']);
     $result['name_index'] = $index->getName();
     // récupération de la taille totale des indexes et de statistiques
     $stats = $index->getStats()->getData();
     $result['size'] = CMbString::toDecaBinary($stats["_all"]["primaries"]["store"]["size_in_bytes"]);
     // récupération de l'état des shards
     $result['stats']['shards']["total"] = $stats["_shards"]['total'];
     $result['stats']['shards']["successful"] = $stats["_shards"]['successful'];
     $result['stats']['shards']["failed"] = $stats["_shards"]['failed'];
     // récupération de statistiques
     $name = CAppUI::conf("search index_name");
     $result['stats']["search"]['total'] = $stats["indices"][$name]["primaries"]["search"]["query_total"];
     $result['stats']["search"]['average_time'] = $stats["indices"][$name]["primaries"]["search"]["query_time_in_millis"];
     // récupération du nombre de docs "indexés",  "à indexer" et récupération des types d'éléments restant à indexer.
     $result['nbDocs_indexed'] = $index->count();
     $result['nbdocs_to_index'] = $search->countList();
     $order = "`object_class`, COUNT(`object_class`) AS `total`";
     $result['nbdocs_to_index_by_type'] = $search->countMultipleList(null, null, "object_class", null, $order);
     // récupération du statut de la connexion et du cluster
     $result['status'] = $cluster->getHealth()->getStatus();
     $result['connexion'] = $c_search->_client->hasConnection();
     // récupération des données de l'agregation
     $aggreg = $aggreg->getAggregation("ref_type");
     $result["aggregation"] = $aggreg["buckets"];
     return $result;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:49,代码来源:CSearchQuery.class.php


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