<?php 
foreach ($_['files'] as $file) {
    $simple_file_size = simple_file_size($file['size']);
    $simple_size_color = intval(200 - $file['size'] / (1024 * 1024) * 2);
    // the bigger the file, the darker the shade of grey; megabytes*2
    if ($simple_size_color < 0) {
        $simple_size_color = 0;
    }
    $relative_modified_date = relative_modified_date($file['mtime']);
    $relative_date_color = round((time() - $file['mtime']) / 60 / 60 / 24 * 14);
    // the older the file, the brighter the shade of grey; days*14
    if ($relative_date_color > 200) {
        $relative_date_color = 200;
    }
    ?>
			<tr data-file="<?php 
    echo $file['name'];
    ?>
" data-type="<?php 
    echo $file['type'] == 'dir' ? 'dir' : 'file';
    ?>
" data-mime="<?php 
    echo $file['mime'];
    ?>
" data-size='<?php 
    echo $file['size'];
    ?>
'>
				<td class="filename svg" style="background-image:url(<?php 
    if ($file['type'] == 'dir') {
        echo mimetype_icon('dir');
Exemplo n.º 2
0
/**
 * @brief Return a human readable outout for a file size.
 * @param $byte size of a file in byte
 * @returns human readable interpretation of a file size
 */
function simple_file_size($bytes)
{
    return \simple_file_size($bytes);
}