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


PHP human_filesize函数代码示例

本文整理汇总了PHP中human_filesize函数的典型用法代码示例。如果您正苦于以下问题:PHP human_filesize函数的具体用法?PHP human_filesize怎么用?PHP human_filesize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_list

 public function get_list()
 {
     $path = get_post('path');
     $path = rtrim($path, '/');
     $result = $this->baidu_pcs->get_list($path);
     $list = array();
     foreach ($result as $item) {
         $item['name'] = str_replace($path . '/', '', $item['name']);
         $item['size'] = human_filesize($item['size'], 0);
         $list[] = $item;
     }
     unset($result);
     if ($path != '/' && $path != '') {
         $parent_dir = array('name' => '..', 'size' => '0B', 'date' => max(array_column($list, 'date')), 'type' => 'd');
         array_unshift($list, $parent_dir);
     }
     return include BASE_PATH . '/templates/list.php';
 }
开发者ID:heweida,项目名称:baidu_pcs_ui,代码行数:18,代码来源:controller.php

示例2: display_wad_table

 function display_wad_table($limit = 0)
 {
     echo "\n<table>\n\t<tr>\n\t\t<th></th>\n\t\t<th>File</th>\n\t\t<th>Size</th>\n\t\t<th>Uploaded by</th>\n\t\t<th>Date and time</th>\n\t\t<th>MD5</th>\n\t</tr>\n";
     $db = getsql();
     $limitstring = '';
     if ($limit > 0) {
         $limitstring = " LIMIT {$limit}";
     }
     $q = $db->query("SELECT * FROM `wads` ORDER BY `time` DESC {$limitstring}");
     if ($q->num_rows < 1) {
         echo "\n<div id='serversbox'>\n\t<div style='width: 100%; text-align: center'>\n\t\tThere are no WADs uploaded yet.\n\t\t";
         if (is_authed()) {
             echo "\n\t\t<br />\n\t\tFeel free to upload one from the main WADs page.\n\t\t";
         }
         echo "\n\t</div>\n</div>\n\t\t\t\t\t";
     } elseif ($q->num_rows > 0) {
         while ($o = $q->fetch_object()) {
             $id = $o->id;
             $size = human_filesize(filesize(disciple_json()->serverdata . '/wads/' . $o->filename));
             $filename = $o->filename;
             $uploader = $o->uploader;
             $uploader_name = user_info($uploader)->username;
             $time = date('Y-m-d \\a\\t H:i:s', $o->time);
             echo "\n<tr id='wadrow-{$id}'>\n\t<td>\n";
             if (is_authed()) {
                 if (user_info()->userlevel >= UL_ADMINISTRATOR || $uploader == $_SESSION['id']) {
                     echo "<a href='javascript:deleteWad({$id});' title='Delete'><i class='material-icons'>delete</i></a>";
                 }
                 if (user_info()->userlevel >= UL_ADMINISTRATOR) {
                     if ($db->query("SELECT * FROM `wadbans` WHERE `md5`='" . $o->md5 . "'")->num_rows == 0) {
                         echo "<a href='javascript:banWad({$id});' title='Ban'><i class='material-icons'>not_interested</i></a>";
                     } else {
                         echo "<a href='javascript:unbanWad({$id});' title='Unban'><i class='material-icons'>done</i></a>";
                     }
                 }
             }
             echo "\n</td>\n<td><a href='/wads/{$filename}'>{$filename}</a></td>\n<td>{$size}</td>\n<td>{$uploader_name}</td>\n<td>{$time}</td>\n<td id='wadmd5-{$id}'><a href='javascript:wadMd5({$id});'>Show</a></td>\n</tr>\n";
         }
         echo "</table>";
     }
 }
开发者ID:csnxs,项目名称:disciple,代码行数:41,代码来源:wads.php

示例3: cache_get

function cache_get($url, $cache_file, $verbose = true, $update = false, $cache_life = 43200)
{
    $message = '';
    $content = '';
    clearstatcache();
    if ($url == '') {
        $message .= '[empty url]';
    } else {
        if (file_exists($cache_file) && time() - filemtime($cache_file) <= $cache_life) {
            $message .= '[use cache]';
            $content = @file_get_contents($cache_file);
        } else {
            $message .= '[update cache : ';
            if ($update && file_exists($cache_file) && curl_get_file_size($url) <= filesize($cache_file)) {
                $message .= 'cache file is already bigger';
                $content = @file_get_contents($cache_file);
            } else {
                if (($content = curl_download($url)) !== false) {
                    // @file_get_contents($url)
                    rmkdir(dirname($cache_file));
                    if (($size = @file_put_contents($cache_file, $content)) === false) {
                        $message .= 'not updatable (' . $cache_file . ')';
                    } else {
                        $message .= 'updated (' . human_filesize($size) . ')';
                    }
                    if (strpos($url, 'http://www.magic-ville.com') !== false) {
                        time_nanosleep(0, 500000000);
                    }
                    // Avoid anti-leech mechanism on MV (30 queries every 15 sec)
                } else {
                    $message .= 'not downloadable (' . $url . ')';
                }
            }
            $message .= ']';
        }
    }
    if ($verbose) {
        echo $message;
    }
    return $content;
}
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:41,代码来源:lib.php

示例4: get_content

 /**
  * Takes a given path and prints the content in json format.
  */
 public static function get_content($app, $path)
 {
     $path = __DIR__ . '/../data/' . $path;
     $path = rtrim($path, '/');
     require_once __DIR__ . '/helper.php';
     // get dir content
     $files = array();
     $folders = array();
     list_dir($path, $files, $folders);
     $files = array_merge($folders, $files);
     // get info
     foreach ($files as $k => $v) {
         $i = get_file_info($v['path'], array('name', 'size', 'date', 'fileperms'));
         if ($v['folder']) {
             $files[$k] = array('name' => $i['name'], 'size' => '---', 'date' => date('Y-m-d H:i:s', $i['date']), 'perm' => unix_perm_string($i['fileperms']), 'folder' => True);
         } else {
             $files[$k] = array('name' => $i['name'], 'size' => human_filesize($i['size']), 'date' => date('Y-m-d H:i:s', $i['date']), 'perm' => unix_perm_string($i['fileperms']), 'folder' => False);
         }
         $files[$k]['link'] = str_replace(__DIR__ . '/../data/', '', $v['path']);
     }
     return json_encode(array('status' => 'ok', 'files' => $files));
 }
开发者ID:semplon,项目名称:MinimalFileManager,代码行数:25,代码来源:FileManager.php

示例5: generateHTMLTableFromFileSystem

/**
 * Generate HTML table given path
 */
function generateHTMLTableFromFileSystem($relative_path, $www_root, $file_extension = 'mp4')
{
    $relative_path = rtrim($relative_path, '\\/');
    echo "<table>\n";
    echo "<tr><th valign=\"top\"><img src=\"/icons/blank.gif\" alt=\"[ICO]\"></th><th> Name </th><th> Size <th> <tr>\n";
    //Show link to parent directory
    echo "<tr>\n";
    echo "<td valign=\"top\"><img src=\"/icons/back.gif\" alt=\"[PARENTDIR]\"></td>";
    echo "<td> <a href='index.html?relative_path=" . dirname($relative_path) . "'>Parent Directory</A> </td>\n";
    echo "<td align=\"right\">  - </td>\n";
    echo "</tr>\n";
    echo "<tr><th colspan=\"5\"><hr></th></tr>\n";
    if (is_dir("{$www_root}/{$relative_path}")) {
        foreach (scandir("{$www_root}/{$relative_path}") as $f) {
            if ($f !== '.' and $f !== '..' and $f !== '.AppleDouble') {
                if (is_dir("{$www_root}/{$relative_path}/{$f}")) {
                    //Show link to another directory
                    echo "<tr>\n";
                    echo "<td valign=\"top\"><img src=\"/icons/folder.gif\" alt=\"[DIR]\"></td>\n";
                    echo "<td> <a href='index.html?relative_path=" . "{$relative_path}/{$f}" . "'>{$f}</A> </td>\n";
                    echo "<td align=\"right\">  - </td>\n";
                    echo "</tr>\n";
                } else {
                    if (strcasecmp($file_extension, substr($f, -3)) == 0) {
                        //show player
                        echo "<tr>\n";
                        echo "<td valign=\"top\"><img src=\"/icons/movie.gif\" alt=\"[movie]\"></td>\n";
                        echo "<td> <a href='player.html?file=" . "{$relative_path}/{$f}" . "'>{$f}</A> </td>\n";
                        echo "<td align=\"right\">" . human_filesize(filesize("{$www_root}/{$relative_path}/{$f}")) . "</td>\n";
                        echo "</tr>\n";
                    }
                }
            }
        }
    }
    echo "<tr><th colspan=\"5\"><hr></th></tr>\n";
    echo "</table>\n";
}
开发者ID:rickyzhang82,项目名称:apple-juice,代码行数:41,代码来源:file_scan.php

示例6: makeImageBlock

 private static function makeImageBlock(Post $post, $display)
 {
     /**
      * The following block is only for posts with an image attached.
      */
     if ($post->hasImage() && !$post->imgbanned) {
         $md5Filename = str_replace('/', '-', $post->md5);
         $humanFilesize = $post->fsize > 0 ? human_filesize($post->fsize) . ", " : "";
         list($thumbW, $thumbH) = tn_Size($post->w, $post->h);
         if ($display == self::DISPLAY_OP && ($post->w > 125 || $post->h > 125)) {
             //OP thumbs are 250x250 rather than 125x125
             $thumbW *= 2;
             $thumbH *= 2;
         }
         $thumb = "<a class='fileThumb' href='{$post->getImgUrl()}' target='_blank'>" . "<img src='{$post->getThumbUrl()}' alt='' data-md5='{$post->md5}' data-md5-filename='{$md5Filename}' data-ext='{$post->ext}' data-full-img='{$post->getImgUrl()}' width='{$thumbW}' height='{$thumbH}' data-width='{$post->w}' data-height='{$post->h}' />" . "</a>";
         $chanMedia = $post->board == 'f' ? '//i.4cdn.org/f/src/' . $post->filename . $post->ext : '//i.4cdn.org/' . $post->board . '/src/' . $post->tim . $post->ext;
         $fullImgLink = $post->getExtension() == '.swf' ? $post->getSwfUrl() : $post->getImgUrl();
         $fileDiv = div('', 'file')->set('id', 'f' . $post->no);
         $fileInfo = div('', 'fileInfo');
         $fileText = span('', 'fileText')->set('id', 'fT' . $post->no)->set('data-filename', $post->filename . $post->ext);
         $fileText->append(a($post->filename . $post->ext, $chanMedia)->set("target", "_blank")->set("title", $post->filename . $post->ext)->set("class", 'imageLink')->set('rel', 'noreferrer'))->append('&nbsp;')->append("({$humanFilesize}{$post->w}x{$post->h}, " . ($post->board == 'f' ? $post->tag . ")" : "<span title='{$post->filename}{$post->ext}'>{$post->tim}{$post->ext}</span>)&nbsp;"));
         if ($post->getExtension() != '.swf') {
             $fileText->append(a('iqdb', "http://iqdb.org/?url={$post->getThumbUrl()}")->set("target", "_blank") . '&nbsp;' . a('google', "http://www.google.com/searchbyimage?image_url={$post->getThumbUrl()}")->set("target", "_blank"));
         }
         $fileText->append('&nbsp;' . a('reposts', "/{$post->board}/search/md5/{$post->getMD5Hex()}")->set("target", "_blank") . '&nbsp;' . a('full', $fullImgLink)->set("target", '_blank'));
         $fileInfo->append($fileText);
         $fileDiv->append($fileInfo);
         $fileDiv->append($thumb);
         return $fileDiv;
     } else {
         if ($post->imgbanned) {
             return Site::parseHtmlFragment("post/banned_image.html");
         } else {
             return "";
         }
     }
 }
开发者ID:bstats,项目名称:b-stats,代码行数:37,代码来源:PostRenderer.php

示例7: substr

     $item_elt = substr($item_elt, 0, -strlen($item_ext) - 1);
 }
 if ($is_dir) {
     $item_elt = $item_elt != '.' ? "{$item_elt}/" : '/';
 } elseif (isset($_ext) && (!$item_ext || $item_ext == 'sqlite')) {
     $item_elt = "{$item_elt}{$_ext}";
 }
 echo '<tr>';
 echo '<td class="filename"><a href="', $item_elt, '">', $item_elt, '</a>';
 if ($item_ext == 'sqlite') {
     echo ' (sqlite)';
 }
 echo '</td>';
 echo '<td>';
 if (!$is_dir) {
     echo human_filesize(filesize("{$_filename}/{$item}"));
 } else {
     echo '-';
 }
 echo '</td>';
 echo '<td>';
 if ($is_dir) {
     echo $item_elt != '/' ? 'Directory' : 'Root';
 } elseif (substr($item_elt, 0, 5) == '.meta' || substr($item_elt, 0, 4) == '.acl') {
     echo 'RDF';
 } elseif (isset($_RAW_EXT[$item_ext]['short'])) {
     if ($_RAW_EXT[$item_ext]['short'] != 'text') {
         $is_dir = true;
     }
     // fake a dir to disable the edit button
     echo $_RAW_EXT[$item_ext]['type'];
开发者ID:Sunnepah,项目名称:ldphp,代码行数:31,代码来源:index.html.php

示例8: display

    public function display()
    {
        if ($this->in->exists('mcsavevote')) {
            $this->saveRating();
        }
        $arrPathArray = registry::get_const('patharray');
        if (is_numeric($this->url_id)) {
            //For URL: index.php/MediaCenter/Downloads/MyFileName-17.html
            $arrMediaData = $this->pdh->get('mediacenter_media', 'data', array($this->url_id));
            if ($arrMediaData != false && count($arrMediaData)) {
                $strRef = $this->in->get('ref') != "" ? '&ref=' . $this->in->get('ref') : '';
                $intMediaID = $this->url_id;
                $intCategoryId = $this->pdh->get('mediacenter_media', 'category_id', array($this->url_id));
                $intAlbumID = $this->pdh->get('mediacenter_media', 'album_id', array($this->url_id));
                $blnShowUnpublished = $arrPermissions['change_state'] || $this->user->check_auth('a_mediacenter_manage', false);
                if (!$arrMediaData['published'] && !$blnShowUnpublished) {
                    message_die($this->user->lang('article_unpublished'));
                }
                $arrCategoryData = $this->pdh->get('mediacenter_categories', 'data', array($intCategoryId));
                $intPublished = $arrCategoryData['published'];
                if (!$intPublished && !$this->user->check_auth('a_mediacenter_manage', false)) {
                    message_die($this->user->lang('category_unpublished'));
                }
                //Check Permissions
                $arrPermissions = $this->pdh->get('mediacenter_categories', 'user_permissions', array($intCategoryId, $this->user->id));
                if (!$arrPermissions['read']) {
                    message_die($this->user->lang('category_noauth'), $this->user->lang('noauth_default_title'), 'access_denied', true);
                }
                $arrTags = $this->pdh->get('mediacenter_media', 'tags', array($intMediaID));
                //Create Maincontent
                $intType = $this->pdh->get('mediacenter_media', 'type', array($intMediaID));
                $strExtension = strtolower(pathinfo($arrMediaData['filename'], PATHINFO_EXTENSION));
                $arrPlayableVideos = array('mp4', 'webm', 'ogg');
                $arrAdditionalData = unserialize($arrMediaData['additionaldata']);
                $strPermalink = $this->user->removeSIDfromString($this->env->buildlink() . $this->controller_path_plain . $this->pdh->get('mediacenter_media', 'path', array($intMediaID, false, array(), false)));
                if ($intType === 0) {
                    $this->tpl->assign_vars(array('MC_MEDIA_DOWNLOADS' => $arrMediaData['downloads'], 'MC_MEDIA_FILENAME' => $arrMediaData['filename'], 'S_MC_EXTERNALFILEONLY' => $arrMediaData['filename'] == "" && $arrMediaData['externalfile'] != "" ? true : false, 'MC_MEDIA_EXTENSION' => pathinfo($arrMediaData['filename'], PATHINFO_EXTENSION), 'MC_MEDIA_SIZE' => human_filesize($arrAdditionalData['size']), 'MC_EMBEDD_HTML' => htmlspecialchars('<a href="' . $strPermalink . '">' . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . '</a>'), 'MC_EMBEDD_BBCODE' => htmlspecialchars("[url='" . $strPermalink . "']" . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . "[/url]")));
                } elseif ($intType === 1) {
                    //Video
                    $blnIsEmbedly = false;
                    if (isset($arrAdditionalData['html'])) {
                        //Is embedly Video
                        $strVideo = $arrAdditionalData['html'];
                        $blnIsEmbedly = true;
                    } else {
                        $strExternalExtension = strtolower(pathinfo($arrMediaData['externalfile'], PATHINFO_EXTENSION));
                        if (strlen($arrMediaData['externalfile']) && in_array($strExternalExtension, $arrPlayableVideos)) {
                            $this->tpl->css_file($this->root_path . 'plugins/mediacenter/includes/videojs/video-js.min.css');
                            $this->tpl->js_file($this->root_path . 'plugins/mediacenter/includes/videojs/video.js');
                            $this->tpl->add_js('videojs.options.flash.swf = "' . $this->server_path . 'plugins/mediacenter/includes/videojs/video-js.swf"; ', 'docready');
                            switch ($strExternalExtension) {
                                case 'mp4':
                                    $strSource = '  <source src="' . $arrMediaData['externalfile'] . '" type=\'video/mp4\' />';
                                    break;
                                case 'webm':
                                    $strSource = '  <source src="' . $arrMediaData['externalfile'] . '" type=\'video/webm\' />';
                                    break;
                                case 'ogg':
                                    $strSource = '   <source src="' . $arrMediaData['externalfile'] . '" type=\'video/ogg\' />';
                                    break;
                            }
                            $strVideo = '  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="364"
						      poster="" data-setup="{}">
						    ' . $strSource . '
						    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
						  </video>';
                        } elseif (in_array($strExtension, $arrPlayableVideos)) {
                            $this->tpl->css_file($this->root_path . 'plugins/mediacenter/includes/videojs/video-js.min.css');
                            $this->tpl->js_file($this->root_path . 'plugins/mediacenter/includes/videojs/video.js');
                            $this->tpl->add_js('videojs.options.flash.swf = "' . $this->server_path . 'plugins/mediacenter/includes/videojs/video-js.swf"; ', 'docready');
                            $strLocalFile = $this->pfh->FolderPath('files', 'mediacenter', 'absolute') . $arrMediaData['localfile'];
                            switch ($strExtension) {
                                case 'mp4':
                                    $strSource = '  <source src="' . $strLocalFile . '" type=\'video/mp4\' />';
                                    break;
                                case 'webm':
                                    $strSource = '  <source src="' . $strLocalFile . '" type=\'video/webm\' />';
                                    break;
                                case 'ogg':
                                    $strSource = '   <source src="' . $strLocalFile . '" type=\'video/ogg\' />';
                                    break;
                            }
                            $strVideo = '  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="364"
						      poster="" data-setup="{}">
						    ' . $strSource . '
						    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
						  </video>';
                        } else {
                            $strVideo = 'Cannot play this video type.';
                        }
                    }
                    $strEmbeddHTML = $blnIsEmbedly ? $arrAdditionalData['html'] : '<a href="' . $strPermalink . '">' . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . '</a>';
                    $this->tpl->assign_vars(array('MC_VIDEO' => $strVideo, 'MC_EMBEDD_HTML' => htmlspecialchars($strEmbeddHTML), 'MC_EMBEDD_BBCODE' => htmlspecialchars("[url='" . $strPermalink . "']" . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . "[/url]")));
                } else {
                    //Image
                    $strThumbfolder = $this->pfh->FolderPath('thumbs', 'mediacenter');
                    if (file_exists($strThumbfolder . $arrMediaData['localfile'] . '.' . $strExtension)) {
                        $strImage = $strThumbfolder . $arrMediaData['localfile'] . '.' . $strExtension;
                    } else {
                        $strImage = $this->pfh->FolderPath('files', 'mediacenter', 'relative') . $arrMediaData['localfile'];
//.........这里部分代码省略.........
开发者ID:ZerGabriel,项目名称:plugin-mediacenter,代码行数:101,代码来源:views_pageobject.class.php

示例9: array

$return = array();
include_once DOC_ROOT . '/include/classes/png_reader.class.php';
function human_filesize($bytes)
{
    $sz = 'BKMGTP';
    $factor = floor((strlen($bytes) - 1) / 3);
    $hrsize = $bytes / pow(1024, $factor);
    $decimals = 1;
    return sprintf("%.{$decimals}f", $hrsize) . @$sz[$factor];
}
$filename = IMAGEBASEDIR . safeFileName($_GET['img']);
$return['Name'] = pathinfo($filename, PATHINFO_BASENAME);
if (file_exists($filename)) {
    $size = getimagesize($filename);
    $return['Kind'] = $size['mime'];
    $return['Size'] = human_filesize(filesize($filename));
    $return['Created'] = date('Y-m-d H:i:s', filemtime($filename));
    $return['Dimensions'] = $size[0] . ' x ' . $size[1];
    //$return['Owner'] = $_SESSION['email'];
    if (exif_imagetype($filename) == IMAGETYPE_JPEG) {
        $exif = exif_read_data($filename);
        preg_match('/IMG_ID: (?P<id>\\d+)/', $exif['Copyright'], $img);
        $copyright = explode(":", $exif['Copyright']);
        $return['Owner'] = $copyright[1] . '&nbsp;';
        $return['Image ID'] = $copyright[3] . '&nbsp;';
        $origdesc = $exif['ImageDescription'];
        $desc = explode(';', trim($origdesc));
        if (is_array(json_decode($origdesc, true))) {
            // parse as JSON
            $json = json_decode($origdesc, true);
            $return['Description'] = $json;
开发者ID:debruine,项目名称:webmorph,代码行数:31,代码来源:imgReadExif.php

示例10: array

<?php

require_once 'fileNames.php';
if ($handle = opendir($logFilesDir)) {
    $files = array();
    /* This is the correct way to loop over the directory. */
    $fcounter = 0;
    while (false !== ($entry = readdir($handle))) {
        $logFileType = pathinfo($entry, PATHINFO_EXTENSION);
        //print_r($logFileType); echo "<br>";
        if ($logFileType == "txt" || $logFileType == "log") {
            $fPath = $logFilesDir . $entry;
            $created = filectime($fPath);
            $fSize = human_filesize(filesize($fPath));
            //$files[]=array($created, $entry);
            $files[$fcounter]["name"] = $entry;
            $files[$fcounter]["size"] = $fSize;
            $files[$fcounter]["time"] = $created;
            $files[$fcounter]["path"] = $fPath;
            $fcounter++;
        }
    }
    closedir($handle);
    if ($files) {
        $kiiis = array();
        if (isset($linedata)) {
            $kiis = array_keys($linedata);
            foreach ($kiis as $ck => $cpath) {
                $carr = explode("/", $cpath);
                $len = count($carr) - 1;
                $fnam = $carr[$len];
开发者ID:peepkungas,项目名称:EstNer,代码行数:31,代码来源:listUploadedFiles.php

示例11: htmlspecialchars

        ?>
                                        <span class="mailbox-attachment-icon"><i class="fa fa-file-o"></i></span>
                                        <div class="mailbox-attachment-info">
                                            <a href="../uploads/<?php 
        echo $data['up_file' . $i];
        ?>
"
                                               class="mailbox-attachment-name">
                                                <i class="fa fa-paperclip"></i>
                                                <?php 
        echo htmlspecialchars($data['file' . $i]);
        ?>
                                            </a>
                                            <span class="mailbox-attachment-size">
                                                <?php 
        echo human_filesize(UPLOAD_PATH . '/' . $data['up_file' . $i]);
        ?>
                                            </span>
                                        </div>
                                    <?php 
    }
    ?>
                                </li>
                            <?php 
}
?>
                        </ul>
                    </div>


                    <!-- 公開日 -->
开发者ID:vantuan113,项目名称:ec2-git-test,代码行数:31,代码来源:post-view.php

示例12: getErrorMessage

 /**
  * Prefilled error messages.
  *
  * @param int $status The $status var from FileUploader::uploadTo()
  * @return string The proper error message.
  */
 public function getErrorMessage($status)
 {
     switch ($status) {
         case UPLOAD_ERR_OK:
             // You should avoid this. Is not an error!
             return _("Upload completato con successo.");
         case UPLOAD_ERR_NO_FILE:
             return _("Non è stato selezionato alcun file.");
         case UPLOAD_ERR_INI_SIZE:
             return _("Il file eccede i limiti di sistema.");
         case UPLOAD_ERR_FORM_SIZE:
             DEBUG && error(_("Non affidarti a UPLOAD_ERR_FORM_SIZE!"));
             return _("Il file eccede i limiti imposti.");
         case UPLOAD_EXTRA_ERR_OVERSIZE:
             return sprintf(_("Il file pesa %s. Non può superare %s."), human_filesize($_FILES[$this->fileEntry]['size']), human_filesize($this->args['max-filesize']));
         case UPLOAD_EXTRA_ERR_CANT_SAVE_FILE:
             return _("Impossibile salvare il file.");
         case UPLOAD_EXTRA_ERR_CANT_READ_MIMETYPE:
             return _("Il MIME del file non è validabile.");
         case UPLOAD_EXTRA_ERR_UNALLOWED_MIMETYPE:
             $mime = get_mimetype($_FILES[$this->fileEntry]['tmp_name']);
             return sprintf(_("Il file é di un <em>MIME type</em> non concesso: <em>%s</em>."), esc_html($mime));
         case UPLOAD_EXTRA_ERR_UNALLOWED_FILE:
             $mime = get_mimetype($_FILES[$this->fileEntry]['tmp_name']);
             $allowed_filetypes = $this->mimeTypes->getFiletypes($this->args['category'], $mime);
             return multi_text(count($allowed_filetypes), sprintf(_("Il file ha un'estensione non valida. Estensioni attese: <em>%s</em>."), esc_html(implode(', ', $allowed_filetypes))), sprintf(_("Il file ha un'estensione non valida. Estensione attesa: <em>%s</em>."), esc_html($allowed_filetypes[0])));
         case UPLOAD_EXTRA_ERR_FILENAME_TOO_SHORT:
             return _("Il file ha un nome troppo breve.");
         case UPLOAD_EXTRA_ERR_FILENAME_TOO_LONG:
             return _("Il file ha un nome troppo lungo.");
         case UPLOAD_EXTRA_ERR_GENERIC_ERROR:
             return _("Errore di caricamento.");
         default:
             DEBUG && error(sprintf(_("Stato di errore non previsto: '%d'"), $status));
             return _("Errore durante l'upload.");
     }
 }
开发者ID:valerio-bozzolan,项目名称:boz-php-another-php-framework,代码行数:43,代码来源:class-FileUploader.php

示例13: explode

        if (!empty($path_parts['dirname'])) {
            $path_all_parts = explode('/', $path_parts['dirname']);
            $dirname = array_pop($path_all_parts);
            if (wp_all_import_isValidMd5($dirname)) {
                $path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $path));
            }
        }
    } else {
        $path = str_replace("\\", '/', preg_replace('%^(\\w+://[^:]+:)[^@]+@%', '$1*****@', $path));
    }
    if (in_array($import_type, array('upload', 'file'))) {
        $path = preg_replace('%.*wp-content/%', 'wp-content/', $path);
    }
    ?>
						<p><?php 
    printf(__('WP All Import will import the file <span style="color:#40acad;">%s</span>, which is <span style="color:#000; font-weight:bold;">%s</span>', 'wp_all_import_plugin'), $path, isset($locfilePath) ? human_filesize(filesize($locfilePath)) : __('undefined', 'wp_all_import_plugin'));
    ?>
</p>

						<?php 
    if (strpos($xpath, '[') !== false) {
        ?>
						<p><?php 
        printf(__('WP All Import will process the records matching the XPath expression: <span style="color:#46ba69; font-weight:bold;">%s</span>', 'wp_all_import_plugin'), $xpath);
        ?>
</p>
						<?php 
    } elseif ($post['delimiter'] and $isWizard) {
        ?>
						<p><?php 
        printf(__('WP All Import will process <span style="color:#46ba69; font-weight:bold;">%s</span> rows in your file', 'wp_all_import_plugin'), $count);
开发者ID:estrategasdigitales,项目名称:rufiatta,代码行数:31,代码来源:confirm.php

示例14: substr

            $i = $s_lenght + 1;
        }
    }
    if ($pos != 0) {
        return substr($string, $pos, $s_lenght - $pos);
    } else {
        return 0;
    }
}
function human_filesize($bytes, $decimals = 2)
{
    $sz = 'BKMGTP';
    $factor = floor((strlen($bytes) - 1) / 3);
    return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
}
//Inclusão do arquivo de conexão com o banco e instanciamento da conexao
include "../model/conecta-mi-db.php";
//**********RECEBIMENTO DAS VARIÁRVEIS**********/
$bdMi = new MYSQL_MIDB();
$numeroMemorando = remove_zeros($_GET['idMemorando']);
$usuario = $_SESSION["login"];
if (is_dir("server/php/files/{$usuario}/{$numeroMemorando}")) {
    if ($handle = opendir("server/php/files/{$usuario}/{$numeroMemorando}")) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                echo "{$file} ----------- " . human_filesize(filesize("server/php/files/{$usuario}/{$numeroMemorando}/{$file}"), 2) . "<br>";
            }
        }
        closedir($handle);
    }
}
开发者ID:Nucleoos,项目名称:memorando-interno,代码行数:31,代码来源:vLista-Anexos.php

示例15: Elasticsearch

<?php

namespace phinde;

require 'www-header.php';
$es = new Elasticsearch($GLOBALS['phinde']['elasticsearch']);
$esStatus = $es->getIndexStatus();
$queue = new Queue();
$gearStatus = $queue->getServerStatus();
/**
 * @link http://jeffreysambells.com/2012/10/25/human-readable-filesize-php
 */
function human_filesize($bytes, $decimals = 2)
{
    $size = array('B', 'kiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
    $factor = floor((strlen($bytes) - 1) / 3);
    return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . ' ' . @$size[$factor];
}
$esStatus['size_human'] = human_filesize($esStatus['size']);
$esStatus['documents_human'] = number_format($esStatus['documents'], 0, '.', ' ');
render('status', array('esStatus' => $esStatus, 'gearStatus' => $gearStatus));
开发者ID:cweiske,项目名称:phinde,代码行数:21,代码来源:status.php


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