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


PHP Gdn_Format::Bytes方法代码示例

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


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

示例1: htmlspecialchars

 echo $Img;
 ?>
               <div class="FileMeta">
                  <?php 
 echo '<div class="FileName">';
 if (isset($DownloadUrl)) {
     echo '<a href="' . $DownloadUrl . '">' . htmlspecialchars($Media->Name) . '</a>';
 } else {
     echo htmlspecialchars($Media->Name);
 }
 echo '</div>';
 echo '<div class="FileAttributes">';
 if ($Media->ImageWidth && $Media->ImageHeight) {
     echo ' <span class="FileSize">' . $Media->ImageWidth . '&#160;x&#160;' . $Media->ImageHeight . '</span> - ';
 }
 echo ' <span class="FileSize">', Gdn_Format::Bytes($Media->Size, 0), '</span>';
 echo '</div>';
 $Actions = '';
 if (StringBeginsWith($this->ControllerName, 'post', TRUE)) {
     $Actions = ConcatSep(' | ', $Actions, '<a class="InsertImage" href="' . Url(MediaModel::Url($Path)) . '">' . T('Insert Image') . '</a>');
 }
 if (GetValue('ForeignTable', $Media) == 'discussion') {
     $PermissionName = "Vanilla.Discussions.Edit";
 } else {
     $PermissionName = "Vanilla.Comments.Edit";
 }
 if ($IsOwner || Gdn::Session()->CheckPermission($PermissionName, TRUE, 'Category', $this->Data('Discussion.PermissionCategoryID'))) {
     $Actions = ConcatSep(' | ', $Actions, '<a class="DeleteFile" href="' . Url("/plugin/fileupload/delete/{$Media->MediaID}") . '"><span>' . T('Delete') . '</span></a>');
 }
 if ($Actions) {
     echo '<div>', $Actions, '</div>';
开发者ID:SatiricMan,项目名称:addons,代码行数:31,代码来源:link_files.php

示例2: PostController_Checkupload_Create

 /**
  * PostController_Checkupload_Create function.
  *
  * Controller method that allows an AJAX call to check the progress of a file
  * upload that is currently in progress.
  * 
  * @access public
  * @param mixed &$Sender
  * @return void
  */
 public function PostController_Checkupload_Create($Sender)
 {
     list($ApcKey) = $Sender->RequestArgs;
     $Sender->DeliveryMethod(DELIVERY_METHOD_JSON);
     $Sender->DeliveryType(DELIVERY_TYPE_VIEW);
     $KeyData = explode('_', $ApcKey);
     array_shift($KeyData);
     $UploaderID = implode('_', $KeyData);
     $ApcAvailable = self::ApcAvailable();
     $Progress = array('key' => $ApcKey, 'uploader' => $UploaderID, 'apc' => $ApcAvailable ? 'yes' : 'no');
     if ($ApcAvailable) {
         $UploadStatus = apc_fetch('upload_' . $ApcKey, $Success);
         if (!$Success) {
             $UploadStatus = array('current' => 0, 'total' => -1);
         }
         $Progress['progress'] = $UploadStatus['current'] / $UploadStatus['total'] * 100;
         $Progress['total'] = $UploadStatus['total'];
         $Progress['format_total'] = Gdn_Format::Bytes($Progress['total'], 1);
         $Progress['cache'] = $UploadStatus;
     }
     $Sender->SetJSON('Progress', $Progress);
     $Sender->Render($this->GetView('blank.php'));
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:33,代码来源:class.fileupload.plugin.php

示例3: htmlspecialchars

                <?php 
    if ($attachment['ImageHeight']) {
        echo 'data-width="' . $attachment['ImageWidth'] . '"';
        echo 'data-height="' . $attachment['ImageHeight'] . '"';
    } else {
        // Only add the download attribute if it's not an image.
        echo 'download="' . htmlspecialchars($attachment['Name']) . '"';
    }
    ?>
                >
                <?php 
    echo htmlspecialchars($attachment['Name']);
    ?>
            </a>
            <span class="meta"><?php 
    echo Gdn_Format::Bytes($attachment['Size'], 1);
    ?>
</span>
         </div>
         <span class="editor-file-remove" title="<?php 
    echo t('Remove');
    ?>
"></span>
         <span class="editor-file-reattach" title="<?php 
    echo t('Click to re-attach');
    ?>
"></span>
      </div>

   <?php 
}
开发者ID:R-J,项目名称:vanilla,代码行数:31,代码来源:attachments.php

示例4: Size

 function Size($Bytes, $Precision = 2)
 {
     return Gdn_Format::Bytes($Bytes, $Precision);
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:4,代码来源:functions.render.php


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