Mercurial > dirlist-php
changeset 43:54c13838f8bb
Add spacing to before/after hidden data part.
And extract the generation to separate function.
author | nanaya <me@myconan.net> |
---|---|
date | Sun, 24 May 2015 18:17:21 +0900 |
parents | ddb5458658d2 |
children | 2ec27751645e |
files | index.php |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/index.php Sun May 24 18:03:52 2015 +0900 +++ b/index.php Sun May 24 18:17:21 2015 +0900 @@ -61,6 +61,10 @@ } return sprintf($return_format, $size, $return_unit); } + + function hidden_data($data) { + return "<i> " . $data . " </i>"; + } // END UTILITY function tree_link() { @@ -96,9 +100,9 @@ if ($is_dir) { $file_suffix = "/"; - $list_file_prefix = "<i>0</i>"; + $list_file_prefix = hidden_data(0); } else { - $list_file_prefix = "<i>1</i>"; + $list_file_prefix = hidden_data(1); } foreach($files as $file) { @@ -108,8 +112,8 @@ $file_rows .= "<td>". $list_file_prefix . link_to($file . $file_suffix, $file . $file_suffix)."</td>"; $file_rows .= "<td>"; - if ($is_dir) { $file_rows .= "<i>0</i>[dir]"; } - else { $file_rows .= "<i>" . $file_stat["size"] . "</i>" . human_size($file_stat['size']); } + if ($is_dir) { $file_rows .= hidden_data(0) . "[dir]"; } + else { $file_rows .= hidden_data($file_stat["size"]) . human_size($file_stat['size']); } $file_rows .= "</td>"; $file_rows .= "<td>".h(strftime("%Y-%m-%d %H:%M %Z", $file_stat['mtime']))."</td>";