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


PHP dmOs::humanizeSize方法代码示例

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


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

示例1: media_file_infos

function media_file_infos(DmMedia $object)
{
    $infos = array(__('Size') => dmOs::humanizeSize($object->get('size')), __('Type') => $object->get('mime'), __('Created at') => format_date($object->get('created_at'), 'f'), __('Updated at') => format_date($object->get('updated_at'), 'f'), __('Url') => $object->getFullWebPath());
    if ($object->isImage()) {
        $infos = array_merge(array(__('Dimensions') => $object->getDimensions()), $infos);
    }
    return $infos;
}
开发者ID:jdart,项目名称:diem,代码行数:8,代码来源:DmMediaHelper.php

示例2: process

 public function process(array $assets)
 {
     if (empty($assets)) {
         return array();
     }
     $timer = dmDebug::timerOrNull('dmAssetCompressor::process(' . $this->type . ')');
     $this->assets = $assets;
     $this->cachedAssets = array();
     $this->cachedAssetsPaths = array();
     $this->cdnAssets = array();
     $this->preservedAssets = array();
     $this->processedAssets = array();
     $this->cacheKeys = array('all' => '');
     $this->webDir = sfConfig::get('sf_web_dir');
     $this->preProcess();
     foreach ($this->assets as $webPath => $options) {
         if ($this->isOnFilesystem($webPath)) {
             if (!file_exists($this->webDir . $webPath)) {
                 $this->log('Missing ' . $this->type . ' : ' . $this->webDir . $webPath);
                 $this->cacheKeys['all'] .= $webPath;
             } elseif ($this->isCachable($webPath, $options)) {
                 $mediaType = isset($options['media']) ? $options['media'] : 'all';
                 $options['media'] = $mediaType;
                 $this->cachedAssets[$mediaType][$webPath] = $options;
                 if (!isset($this->cacheKeys[$mediaType])) {
                     $this->cacheKeys[$mediaType] = '';
                 }
                 $this->cacheKeys[$mediaType] .= $webPath . filemtime($this->webDir . $webPath);
             } else {
                 $this->preservedAssets[$webPath] = $options;
             }
         } else {
             $this->cdnAssets[$webPath] = $options;
         }
     }
     if (!empty($this->cachedAssets)) {
         $cachedAssetsPaths = array();
         foreach ($this->cachedAssets as $mediaType => $cachedAssets) {
             $this->cacheKeys[$mediaType] = md5($this->processCacheKey($this->cacheKeys[$mediaType]));
             $cacheWebPath = '/cache/' . $this->type;
             $cacheDirPath = $this->webDir . $cacheWebPath;
             $cacheFilePath = $cacheDirPath . '/' . $this->cacheKeys[$mediaType] . '.' . $this->type;
             $this->filesystem->mkdir($cacheDirPath);
             if (!file_exists($cacheFilePath)) {
                 $cacheContent = '';
                 foreach ($cachedAssets as $webPath => $options) {
                     $cacheContent .= $this->processAssetContent(file_get_contents($this->webDir . $webPath), $webPath);
                     $this->cachedAssetsPaths[$cacheWebPath . '/' . $this->cacheKeys[$mediaType] . '.' . $this->type] = $options;
                 }
                 $cacheContent = $this->processCacheContent($cacheContent);
                 file_put_contents($cacheFilePath, $cacheContent);
                 chmod($cacheFilePath, 0666);
                 if ($this->options['gz_compression']) {
                     file_put_contents($cacheFilePath . '.gz', gzencode($cacheContent));
                     chmod($cacheFilePath . '.gz', 0666);
                 }
                 $message = sprintf('%s : compressed %d assets ( %s )', get_class($this), count($cachedAssets), dmOs::humanizeSize($cacheFilePath));
                 $this->dispatcher->notify(new sfEvent($this, 'application.log', array($message, 'priority' => sfLogger::INFO)));
             } else {
                 $this->cachedAssetsPaths[$cacheWebPath . '/' . $this->cacheKeys[$mediaType] . '.' . $this->type] = array('media' => $mediaType);
             }
         }
         $this->processedAssets = array_merge($this->cdnAssets, $this->cachedAssetsPaths, $this->preservedAssets);
     } else {
         $this->processedAssets = array_merge($this->cdnAssets, $this->preservedAssets);
     }
     $this->postProcess();
     $timer && $timer->addTime();
     return $this->processedAssets;
 }
开发者ID:ru-santer,项目名称:diem,代码行数:70,代码来源:dmAssetCompressor.php

示例3: describe

 public function describe()
 {
     return array('Documents' => $this->luceneIndex->numDocs(), 'Size' => dmOs::humanizeSize($this->getByteSize()));
 }
开发者ID:eXtreme,项目名称:diem,代码行数:4,代码来源:dmSearchIndex.php

示例4: renderValue

 protected function renderValue($value)
 {
     switch ($this->getType()) {
         case self::TYPE_BOOL:
             $response = $value ? 'ON' : 'OFF';
             break;
         case self::TYPE_BYTE:
             $response = dmOs::humanizeSize($this->realSize($value));
             break;
         default:
             $response = $value ? $value : '-';
     }
     return $response;
 }
开发者ID:jdart,项目名称:diem,代码行数:14,代码来源:dmServerCheck.php

示例5: use_helper

<?php

if (!$object || $object->isNew()) {
    return;
}
use_helper('I18N', 'Date', 'DmAdminMedia');
echo _open('div.dm_media_file');
echo _tag('h3.title.none', $object->getFile());
echo _open('div.clearfix');
echo _tag('div.view', $object->isImage() ? _media($object)->size(200, 200) : media_file_image_tag($object));
echo _tag('div.content', _tag('div.infos', definition_list(array(__('Size') => dmOs::humanizeSize($object->getSize()), __('Type') => $object->getType(), __('Created at') => format_date($object->get('created_at'), 'f'), __('Updated at') => format_date($object->get('created_at'), 'f'), __('Url') => $object->getFullWebPath()), '.clearfix.dm_little_dl')));
echo _close('div');
echo _close('div');
开发者ID:jdart,项目名称:diem,代码行数:13,代码来源:_viewMedium.php

示例6: use_helper

<?php

use_helper('Date', 'DmMedia');
echo _open('div.dm_media_file');
echo _tag('h1.title.none', $file->file);
echo _open('div.clearfix');
echo _tag('div.view', _link('/' . $file->getWebPath())->text($file->isImage() ? _media($file)->size(300, 300) : media_file_image_tag($file))->target('blank')->set('.fancybox'));
echo _tag('div.content', _tag('div.infos', definition_list(array(__('Size') => dmOs::humanizeSize($file->size), __('Type') => $file->mime, __('Created at') => format_datetime($file->createdAt), __('Updated at') => format_datetime($file->updatedAt), __('Url') => $file->getFullWebPath()), '.clearfix') . _link($file->getFullWebPath())->text(__('Download'))->target('blank')->set('.block.s16.s16_download')) . get_partial('dmInterface/flash') . _tag('div.form', $form->render('.dm_form.list.little action=dmMediaLibrary/saveFile')) . _tag('div.actions.clearfix', _tag('a.close_dialog.button.fright', __('Close')) . _link('dmMediaLibrary/deleteFile?media_id=' . $file->id)->text(__('Delete'))->set('.button.red.dm_js_confirm.fleft')->title(__('Delete this file')) . (false && $file->isImage() ? _link('dmMediaLibrary/editImage?media_id=' . $file->id)->text(__('Edit image'))->set('.button.edit_image') : '')));
echo _close('div');
echo _close('div');
开发者ID:runopencode,项目名称:diem-extended,代码行数:10,代码来源:_file.php


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