• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP foldersize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: foldersize

function foldersize($path)
{
    $size = 0;
    if ($handle = @opendir($path)) {
        while (($file = readdir($handle)) !== false) {
            if (is_file($path . "/" . $file)) {
                $size += filesize($path . "/" . $file);
            }
            if (is_dir($path . "/" . $file)) {
                if ($file != "." && $file != "..") {
                    $size += foldersize($path . "/" . $file);
                }
            }
        }
    }
    return $size;
}
开发者ID:stefanct,项目名称:lighttpd-dir-generator,代码行数:17,代码来源:dir-generator.php


示例2: foldersize

function foldersize($path)
{
    $total_size = 0;
    $files = scandir($path);
    $cleanPath = rtrim($path, '/') . '/';
    foreach ($files as $t) {
        if ($t != "." && $t != "..") {
            $currentFile = $cleanPath . $t;
            if (is_dir($currentFile)) {
                $size = foldersize($currentFile);
                $total_size += $size;
            } else {
                $size = filesize($currentFile);
                $total_size += $size;
            }
        }
    }
    return $total_size;
}
开发者ID:pimcore,项目名称:pimcore,代码行数:19,代码来源:helper.php


示例3: uploadFile

function uploadFile($file, $cattype, $cat)
{
    global $loguserid, $uploaddirs, $goodfiles, $badfiles, $userquota, $maxSize;
    $targetdir = $uploaddirs[$cattype];
    $totalsize = foldersize($targetdir);
    $filedata = $_FILES[$file];
    $c = FetchResult("SELECT COUNT(*) FROM {uploader} WHERE filename={0} AND cattype={1} AND user={2} AND deldate=0", $filedata['name'], $cattype, $loguserid);
    if ($c > 0) {
        return "You already have a file with this name. Please delete the old copy before uploading a new one.";
    }
    if ($filedata['size'] == 0) {
        if ($filedata['tmp_name'] == '') {
            return 'No file given.';
        } else {
            return 'File is empty.';
        }
    }
    if ($filedata['size'] > $maxSize) {
        return 'File is too large. Maximum size allowed is ' . BytesToSize($maxSize) . '.';
    }
    $randomid = Shake();
    $pname = $randomid . '_' . Shake();
    $fname = $_FILES['newfile']['name'];
    $temp = $_FILES['newfile']['tmp_name'];
    $size = $_FILES['size']['size'];
    $parts = explode(".", $fname);
    $extension = end($parts);
    if ($totalsize + $size > $quot) {
        Alert(format(__("Uploading \"{0}\" would break the quota."), $fname));
    } else {
        if (in_array(strtolower($extension), $badfiles) || is_array($goodfiles) && !in_array(strtolower($extension), $goodfiles)) {
            return 'Forbidden file type.';
        } else {
            $description = $_POST['description'];
            $big_descr = $cat['showindownloads'] ? $_POST['big_description'] : '';
            Query("insert into {uploader} (id, filename, description, big_description, date, user, private, category, deldate, physicalname) values ({7}, {0}, {1}, {6}, {2}, {3}, {4}, {5}, 0, {8})", $fname, $description, time(), $loguserid, $privateFlag, $_POST['cat'], $big_descr, $randomid, $pname);
            copy($temp, $targetdir . "/" . $pname);
            Report("[b]" . $loguser['name'] . "[/] uploaded file \"[b]" . $fname . "[/]\"" . ($privateFlag ? " (privately)" : ""), $privateFlag);
            die(header("Location: " . actionLink("uploaderlist", "", "cat=" . $_POST["cat"])));
        }
    }
}
开发者ID:Servault,项目名称:Blargboard,代码行数:42,代码来源:lib.php


示例4: folderSize

function folderSize($dir)
{
    $count_size = 0;
    $count = 0;
    $dir_array = scandir($dir);
    foreach ($dir_array as $key => $filename) {
        if ($filename != ".." && $filename != ".") {
            if (is_dir($dir . "/" . $filename)) {
                $new_foldersize = foldersize($dir . "/" . $filename);
                $count_size = $count_size + $new_foldersize;
            } else {
                if (is_file($dir . "/" . $filename)) {
                    $count_size = $count_size + filesize($dir . "/" . $filename);
                    $count++;
                }
            }
        }
    }
    return $count_size;
}
开发者ID:mackraja,项目名称:practise,代码行数:20,代码来源:duplicate4.php


示例5: getUsedSpace

 /**
  * Get used disk space by user_id
  *
  * @param int $user_id
  * @param int $except_size Mb
  * @return int used space in Mb or false if throw exception
  */
 public function getUsedSpace($user_id, $except_size = 0)
 {
     $directory = DIR_STORAGE . $user_id . DIR_SEPARATOR;
     if (is_dir($directory)) {
         $count_size = 0;
         $dir_array = scandir($directory);
         foreach ($dir_array as $key => $filename) {
             if ($filename != '..' && $filename != '.') {
                 if (is_dir($directory . DIR_SEPARATOR . $filename)) {
                     $new_foldersize = foldersize($directory . DIR_SEPARATOR . $filename);
                     $count_size = $count_size + $new_foldersize;
                 } else {
                     if (is_file($directory . DIR_SEPARATOR . $filename)) {
                         $count_size = $count_size + filesize($directory . DIR_SEPARATOR . $filename);
                     }
                 }
             }
         }
         return $count_size / 1000000 - $except_size;
     } else {
         return 0;
     }
 }
开发者ID:rmcdermott,项目名称:bitsybay,代码行数:30,代码来源:storage.php


示例6: foldersize

function foldersize($path)
{
    $total_size = 0;
    $files = scandir($path);
    if (!function_exists('scandir')) {
        function scandir($path, $sorting_order = 0)
        {
            $dh = opendir($path);
            while (false !== ($filename = readdir($dh))) {
                $files[] = $filename;
            }
            if ($sorting_order == 0) {
                sort($files);
            } else {
                rsort($files);
            }
            return $files;
        }
    }
    foreach ($files as $t) {
        if (is_dir($t)) {
            // In case of folder
            if ($t != "." && $t != "..") {
                // Exclude self and parent folder
                $size = foldersize($path . "/" . $t);
                // print("Dir - $path/$t = $size<br>\n");
                $total_size += $size;
            }
        } else {
            // In case of file
            $size = filesize($path . "/" . $t);
            // print("File - $path/$t = $size<br>\n");
            $total_size += $size;
        }
    }
    return $total_size;
}
开发者ID:tssgery,项目名称:phpmotion,代码行数:37,代码来源:functions.php


示例7: foldersize

function foldersize($path)
{
    $total_size = 0;
    $filesCount = 0;
    $foldersCount = 0;
    $files = scandir($path);
    $cleanPath = rtrim($path, '/') . '/';
    foreach ($files as $t) {
        if ($t != "." && $t != "..") {
            $currentFile = $cleanPath . $t;
            if (is_dir($currentFile)) {
                $size = foldersize($currentFile);
                $total_size += $size[0];
                $foldersCount += $size[2] + 1;
                $filesCount += $size[1];
            } else {
                $size2 = filesize($currentFile);
                $total_size += $size2;
                $filesCount++;
            }
        }
    }
    return array($total_size, $filesCount, $foldersCount);
}
开发者ID:kenichiii,项目名称:online-php-ide-pfc-editor,代码行数:24,代码来源:get-dir-size.php


示例8: getUsedSpace

 /**
  * Get used disk space by user_id
  *
  * @param int $user_id
  * @param int $except_size Mb
  * @return int used space in Mb or false if throw exception
  */
 public function getUsedSpace($user_id, $except_size = 0)
 {
     $directory = DIR_STORAGE . $user_id . DIR_SEPARATOR;
     if (is_dir($directory)) {
         $count_size = 0;
         $dir_array = scandir($directory);
         foreach ($dir_array as $key => $filename) {
             // Images and temporary files will be ignored
             if ($filename != '..' && $filename != '.' && false === strpos($filename, '_') && false === strpos($filename, '.' . STORAGE_IMAGE_EXTENSION)) {
                 if (is_dir($directory . DIR_SEPARATOR . $filename)) {
                     $new_foldersize = foldersize($directory . DIR_SEPARATOR . $filename);
                     $count_size = $count_size + $new_foldersize;
                 } else {
                     if (is_file($directory . DIR_SEPARATOR . $filename)) {
                         $count_size = $count_size + filesize($directory . DIR_SEPARATOR . $filename);
                     }
                 }
             }
         }
         return $count_size / 1000000 - $except_size;
     } else {
         return 0;
     }
 }
开发者ID:babilavena,项目名称:bitsybay,代码行数:31,代码来源:storage.php


示例9: foldersize

function foldersize($path)
{
    $total_size = 0;
    if (!function_exists('scandir')) {
        function scandir($path)
        {
            $dh = opendir($path);
            while (false !== ($filename = readdir($dh))) {
                $files[] = $filename;
            }
            sort($files);
            //print_r($files);
            rsort($files);
            //print_r($files);
            return $files;
        }
        $files = scandir($path);
        foreach ($files as $t) {
            if (is_dir($t)) {
                // In case of folder
                if ($t != "." && $t != "..") {
                    // Exclude self and parent folder
                    $size = foldersize($path . "/" . $t);
                    //print("Dir - $path/$t = $size<br>\n");
                    $total_size += $size;
                }
            } else {
                // In case of file
                $size = @filesize($path . "/" . $t);
                //print("File - $path/$t = $size<br>\n");
                $total_size += $size;
            }
        }
        $bytes = array('B', 'KB', 'MB', 'GB', 'TB');
        foreach ($bytes as $val) {
            if ($total_size > 1024) {
                $total_size = $total_size / 1024;
            } else {
                break;
            }
        }
        return @round($total_size, 2) . " " . $val;
    } else {
        $files = @scandir($path);
        foreach ($files as $t) {
            if (is_dir($t)) {
                // In case of folder
                if ($t != "." && $t != "..") {
                    // Exclude self and parent folder
                    $size = foldersize($path . "/" . $t);
                    $total_size += $size;
                }
            } else {
                $size = @filesize($path . "/" . $t);
                $total_size += $size;
            }
        }
        $bytes = array('B', 'KB', 'MB', 'GB', 'TB');
        foreach ($bytes as $val) {
            if ($total_size > 1024) {
                $total_size = $total_size / 1024;
            } else {
                break;
            }
        }
        return @round($total_size, 2) . " " . $val;
    }
}
开发者ID:tssgery,项目名称:phpmotion,代码行数:68,代码来源:inc.stats.php


示例10: sizecount

		<tr class="band">
			<td>清除RSS缓存</td>
			<td>cache/rss/</td>
			<td class="text-key"><?php 
    echo sizecount(foldersize(VI_ROOT . 'cache/rss/'));
    ?>
</td>
			<td>删除RSS内容读取缓存,RSS缓存可能在部分功能模块中有涉及和使用</td>						
			<td><input name="" type="button" class="button" value="立即使用" onclick="location.href='?action=clean&file=rss';" /></td>
		</tr>
		
		<tr class="line">
			<td>清除模板缓存</td>
			<td>static/*/*.htm.php</td>
			<td class="text-key"><?php 
    echo sizecount(foldersize(VI_ROOT . 'cache/compile/'));
    ?>
</td>
			<td>删除各前台页面由 Smarty 产生的缓存,当页面没有正常刷新时使用</td>						
			<td><input name="" type="button" class="button" value="立即使用" onclick="location.href='?action=clean&file=static';" /></td>
		</tr>
		
		</table>
        
	<?php 
}
?>
    
    <div class="item">文件对比器</div>

    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
开发者ID:a195474368,项目名称:ejw,代码行数:31,代码来源:system.secure.php


示例11: strtoupper

        <tr class="line">
        	<td>VeryIDE 版本</td>
			<td class="text-yes"><?php 
echo $_G['product']['version'] . ' - ' . strtoupper($_G['product']['charset']) . ' - ' . $_G['product']['build'] . " <span class='text-key'>(" . $_G['version'][$_G['licence']['type']]["name"] . ')</span>';
?>
</td>
			<td>安装时间</td>
			<td class="text-yes"><?php 
echo date("Y-m-d", VI_START);
?>
</td>
        </tr>
        <tr class="band">
        	<td>空间占用</td>
			<td class="text-yes"><?php 
echo sizecount(foldersize(VI_ROOT));
?>
</td>
			<td>基准目录</td>
			<td class="text-yes"><?php 
echo VI_BASE;
?>
</td>
        </tr>
        <tr class="line">
        	<td>绝对地址</td>
			<td class="text-yes"><?php 
echo VI_HOST;
?>
</td>
			<td>本地目录</td>
开发者ID:a195474368,项目名称:ejw,代码行数:31,代码来源:system.server.php


示例12: foldersize

function foldersize($d)
{
    $dir = dir($d);
    $size = 0;
    if ($dir) {
        while (false !== ($e = $dir->read())) {
            if ($e[0] == '.') {
                continue;
            }
            $c_dir = $d . '/' . $e;
            if (is_dir($c_dir)) {
                $size = $size + foldersize($c_dir);
            } else {
                $size = $size + filesize($c_dir);
            }
        }
        $dir->close();
    }
    return $size;
}
开发者ID:a195474368,项目名称:ejw,代码行数:20,代码来源:library.php


示例13: scandir

 }
 $files = scandir($current_path . $rfm_subfolder . $subdir);
 $n_files = count($files);
 //php sorting
 $sorted = array();
 $current_folder = array();
 $prev_folder = array();
 foreach ($files as $k => $file) {
     if ($file == ".") {
         $current_folder = array('file' => $file);
     } elseif ($file == "..") {
         $prev_folder = array('file' => $file);
     } elseif (is_dir($current_path . $rfm_subfolder . $subdir . $file)) {
         $date = filemtime($current_path . $rfm_subfolder . $subdir . $file);
         if ($show_folder_size) {
             $size = foldersize($current_path . $rfm_subfolder . $subdir . $file);
         } else {
             $size = 0;
         }
         $file_ext = lang_Type_dir;
         $sorted[$k] = array('file' => $file, 'file_lcase' => strtolower($file), 'date' => $date, 'size' => $size, 'extension' => $file_ext, 'extension_lcase' => strtolower($file_ext));
     } else {
         $file_path = $current_path . $rfm_subfolder . $subdir . $file;
         $date = filemtime($file_path);
         $size = filesize($file_path);
         $file_ext = substr(strrchr($file, '.'), 1);
         $sorted[$k] = array('file' => $file, 'file_lcase' => strtolower($file), 'date' => $date, 'size' => $size, 'extension' => $file_ext, 'extension_lcase' => strtolower($file_ext));
     }
 }
 function filenameSort($x, $y)
 {
开发者ID:PotsonHumer,项目名称:OGS_V2,代码行数:31,代码来源:dialog.php


示例14: response

     exit;
 }
 if (trim($_POST['path']) == '') {
     response('no path', 400)->send();
     exit;
 }
 $path = $current_path . $_POST['path'];
 if (is_dir($path)) {
     // can't copy/cut dirs
     if ($copy_cut_dirs === false) {
         response(sprintf(trans('Copy_Cut_Not_Allowed'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), trans('Folders')), 403)->send();
         exit;
     }
     // size over limit
     if ($copy_cut_max_size !== false && is_int($copy_cut_max_size)) {
         if ($copy_cut_max_size * 1024 * 1024 < foldersize($path)) {
             response(sprintf(trans('Copy_Cut_Size_Limit'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), $copy_cut_max_size), 400)->send();
             exit;
         }
     }
     // file count over limit
     if ($copy_cut_max_count !== false && is_int($copy_cut_max_count)) {
         if ($copy_cut_max_count < filescount($path)) {
             response(sprintf(trans('Copy_Cut_Count_Limit'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), $copy_cut_max_count), 400)->send();
             exit;
         }
     }
 } else {
     // can't copy/cut files
     if ($copy_cut_files === false) {
         response(sprintf(trans('Copy_Cut_Not_Allowed'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), trans('Files')), 403)->send();
开发者ID:kipps,项目名称:sri-lanka,代码行数:31,代码来源:ajax_calls.php


示例15: foldersize

function foldersize($path)
{
    $total_size = 0;
    $files = scandir($path);
    $files = array_slice($files, 2);
    foreach ($files as $t) {
        if (is_dir($t)) {
            //Recurse here
            $size = foldersize($path . "/" . $t);
            $total_size += $size;
        } else {
            $size = filesize($path . "/" . $t);
            $total_size += $size;
        }
    }
    return $total_size;
}
开发者ID:RoadrunnerWMC,项目名称:ABXD-legacy,代码行数:17,代码来源:editsettings.php


示例16: dashboard_developer_info

    function dashboard_developer_info()
    {
        do_action('nebula_developer_info');
        $domain_exp_detected = whois_info('expiration');
        $domain_exp_unix = strtotime(trim($domain_exp_detected));
        $domain_exp = date("F j, Y", $domain_exp_unix);
        $domain_exp_style = $domain_exp_unix < strtotime('+1 month') ? 'color: red; font-weight: bold;' : 'color: inherit;';
        $domain_exp_html = $domain_exp_unix > strtotime('March 27, 1986') ? ' <small style="' . $domain_exp_style . '">(Expires: ' . $domain_exp . ')</small>' : '';
        $domain_registrar_url = whois_info('registrar_url');
        $domain_registrar = whois_info('registrar');
        $domain_reseller = whois_info('reseller');
        //Construct Registrar info to be echoed
        if ($domain_registrar_url && strlen($domain_registrar_url) < 70) {
            $domain_registrar_html = $domain_registrar && strlen($domain_registrar) < 70 ? '<li><i class="fa fa-info-circle fa-fw"></i> Registrar: <strong><a href="//' . trim($domain_registrar_url) . '" target="_blank">' . $domain_registrar . '</a></strong>' : '';
        } else {
            $domain_registrar_html = $domain_registrar && strlen($domain_registrar) < 70 ? '<li><i class="fa fa-info-circle fa-fw"></i> Registrar: <strong>' . trim($domain_registrar) . '</strong>' : '';
        }
        if (trim($domain_registrar_html) != '' && $domain_reseller && strlen($domain_reseller) < 70) {
            $domain_registrar_html .= ' <small>(via ' . trim($domain_reseller) . ')</small></li>';
        } else {
            $domain_registrar_html .= '</li>';
        }
        if (nebula_option('nebula_domain_exp', 'enabled')) {
            if (get_option('nebula_domain_expiration_last') == 'Never' || get_option('nebula_domain_expiration_last') < strtotime('-2 weeks')) {
                if ($domain_exp != 'December 31, 1969' && $domain_exp_unix > strtotime("3/27/1986")) {
                    if ($domain_exp_unix < strtotime('+1 week')) {
                        //If domain is expiring within a week, email all admin users.
                        $adminUsers = get_users(array('role' => 'Administrator'));
                        $exp_notice_to = '';
                        $i = 0;
                        $exp_notice_to = array();
                        foreach ($adminUsers as $adminUser) {
                            array_push($exp_notice_to, $adminUsers[$i]->user_email);
                            $i++;
                        }
                        $exp_notice_subject = 'Domain expiration detection of ' . $domain_exp . ' for ' . nebula_url_components('domain') . ' (via ' . get_bloginfo('name') . ')!';
                        $exp_notice_message = "Your domain " . nebula_url_components('domain') . " expires on " . $domain_exp . "! The detected registrar is: " . $domain_registrar . "(" . $domain_registrar_url . ") (However, the actual reseller may be different). This notice was triggered because the expiration date is within 1 week. It has been sent to all administrators of " . get_bloginfo('name') . " (" . home_url('/') . "), and will only be sent once!";
                        wp_mail($exp_notice_to, $exp_notice_subject, $exp_notice_message);
                        update_option('nebula_domain_expiration_last', date('U'));
                    }
                }
            }
        }
        //Get last modified filename and date
        $dir = glob_r(get_template_directory() . '/*');
        $last_date = 0;
        $skip_files = array('dev.css', 'dev.scss', '/cache/', '/includes/data/', 'manifest.json');
        //Files or directories to skip. Be specific!
        foreach ($dir as $file) {
            if (is_file($file)) {
                $mod_date = filemtime($file);
                if ($mod_date > $last_date && !contains($file, $skip_files)) {
                    $last_date = $mod_date;
                    $last_filename = basename($file);
                    $last_file_path = str_replace(get_template_directory(), '', dirname($file)) . '/' . $last_filename;
                }
            }
        }
        $nebula_size = foldersize(get_template_directory());
        $upload_dir = wp_upload_dir();
        $uploads_size = foldersize($upload_dir['basedir']);
        $secureServer = '';
        if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
            $secureServer = '<small class="secured-connection"><i class="fa fa-lock fa-fw"></i>Secured Connection</small>';
        }
        function top_domain_name($url)
        {
            $alldomains = explode(".", $url);
            return $alldomains[count($alldomains) - 2] . "." . $alldomains[count($alldomains) - 1];
        }
        if (function_exists('gethostname')) {
            set_error_handler(function () {
                /* ignore errors */
            });
            $dnsrecord = dns_get_record(top_domain_name(gethostname()), DNS_NS) ? dns_get_record(top_domain_name(gethostname()), DNS_NS) : '';
            restore_error_handler();
        }
        function initial_install_date()
        {
            $nebula_initialized = get_option('nebula_initialized');
            if (!empty($nebula_initialized) && $nebula_initialized < getlastmod()) {
                $install_date = '<strong>' . date('F j, Y', $nebula_initialized) . '</strong> <small>@</small> <strong>' . date('g:ia', $nebula_initialized) . '</strong> <small>(Nebula Init)</small>';
            } else {
                //Use the last modified time of the admin page itself
                $install_date = '<strong>' . date("F j, Y", getlastmod()) . '</strong> <small>@</small> <strong>' . date("g:ia", getlastmod()) . '</strong> <small>(WP Detect)</small>';
            }
            return $install_date;
        }
        if (strpos(strtolower(PHP_OS), 'linux') !== false) {
            $php_os_icon = 'fa-linux';
        } else {
            if (strpos(strtolower(PHP_OS), 'windows') !== false) {
                $php_os_icon = 'fa-windows';
            } else {
                $php_os_icon = 'fa-upload';
            }
        }
        if (function_exists('wp_max_upload_size')) {
            $upload_max = '<small>(Max upload: <strong>' . strval(round((int) wp_max_upload_size() / (1024 * 1024))) . 'mb</strong>)</small>';
        } else {
//.........这里部分代码省略.........
开发者ID:CloouCom,项目名称:Nebula,代码行数:101,代码来源:nebula_admin.php


示例17: foldersize

 private function foldersize($path)
 {
     $total_size = 0;
     $files = scandir($path);
     foreach ($files as $t) {
         if (is_dir(rtrim($path, '/') . '/' . $t)) {
             if ($t != "." && $t != "..") {
                 $size = foldersize(rtrim($path, '/') . '/' . $t);
                 $total_size += $size;
             }
         } else {
             $size = filesize(rtrim($path, '/') . '/' . $t);
             $total_size += $size;
         }
     }
     return $total_size;
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:17,代码来源:class.QuotaComputer.php


示例18: foldersize

/**
 *  The basic php way to go through all directories and adding the file sizes.
 *  It does also check the parameters $exclude_directories and $hide_hidden_files
 */
function foldersize($p)
{
    global $exclude_directories, $hide_hidden_files;
    $size = 0;
    $fs = scandir($p);
    foreach ($fs as $f) {
        if (is_dir(rtrim($p, '/') . '/' . $f)) {
            if ($f != '.' && $f != '..') {
                $size += foldersize(rtrim($p, '/') . '/' . $f);
            }
        } else {
            if ($f != '.' && $f != '..' && !in_array($f, $exclude_directories) && !($hide_hidden_files && strpos($f, '.') === 0)) {
                $size += filesize(rtrim($p, '/') . '/' . $f);
            }
        }
    }
    return $size;
}
开发者ID:xenten,项目名称:swift-kanban,代码行数:22,代码来源:tfu_helper.php


示例19: format

        }
        if ($width > 90) {
            $color = "orange";
        }
        if ($width > 100) {
            $width = 100;
            $color = "red;";
        }
        $alt = format("{0}&nbsp;of&nbsp;{1},&nbsp;{2}%", BytesToSize($totalsize), BytesToSize($quota), $width);
        $bar = format("<div class=\"pollbar\" style=\"width: {0}%; background: {2}\" title=\"{1}\">&nbsp;{$width}%</div>", $width, $alt, $color);
    }
}
write("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"2\">" . __("Status") . "</th>\n\t\t</tr>\n\t\t<tr class=\"cell2\">\n\t\t\t<td style=\"width:40%\">\n\t\t\t\t" . __("Public space usage: {0} of {1}") . "\n\t\t\t</td><td>\n\t\t\t\t<div class=\"pollbarContainer\" style=\"width: 90%;\">\n\t\t\t\t\t{2}\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n", BytesToSize($totalsize), BytesToSize($quota), $bar);
$bar = "&nbsp;0%";
if ($loguserid && is_dir($rootdir . "/" . $loguserid)) {
    $personalsize = foldersize($rootdir . "/" . $loguserid);
    if ($personalsize > 0) {
        $width = floor(100 * ($personalsize / $pQuota));
        if ($width > 0) {
            $color = "green";
            if ($width > 75) {
                $color = "yellow";
            }
            if ($width > 90) {
                $color = "orange";
            }
            if ($width > 100) {
                $width = 100;
                $color = "red;";
            }
            $alt = format("{0}&nbsp;of&nbsp;{1},&nbsp;{2}%", BytesToSize($personalsize), BytesToSize($pQuota), $width);
开发者ID:RoadrunnerWMC,项目名称:ABXD-plugins,代码行数:31,代码来源:page_uploader.php


示例20: foldersize

/**
 * Calculate the size of a folder and its files
 *
 * @author: Toni Widodo ([email protected])
 *
 * @param string $dirname
 * @return int Size of the folder in bytes
 */
function foldersize($dirname)
{
    $folderSize = 0;
    // open the directory, if the script cannot open the directory then return folderSize = 0
    $dir_handle = opendir($dirname);
    if (!$dir_handle) {
        return 0;
    }
    // traversal for every entry in the directory
    while ($file = readdir($dir_handle)) {
        // ignore '.' and '..' directory
        if ($file != "." && $file != "..") {
            // if entry is directory then go recursive !
            if (is_dir($dirname . "/" . $file)) {
                $folderSize += foldersize($dirname . '/' . $file);
            } else {
                $folderSize += filesize($dirname . "/" . $file);
            }
        }
    }
    // chose the directory
    closedir($dir_handle);
    // return $dirname folder size
    return $folderSize;
}
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:33,代码来源:misc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP foo函数代码示例发布时间:2022-05-15
下一篇:
PHP folder_info函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap