diff options
Diffstat (limited to 'app/fn')
-rw-r--r-- | app/fn/fn.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/fn/fn.php b/app/fn/fn.php index ccccfb9..af02202 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -1,5 +1,7 @@ <?php +use Wcms\Medialist; + function readablesize($bytes) { $format = ' %d %s'; @@ -207,6 +209,28 @@ function array_diff_assoc_recursive($array1, $array2) { } +/** + * Generate a folder tree based on reccurive array + */ +function treecount(array $dir, string $dirname, int $deepness, string $path, string $currentdir, Medialist $mediaopt) +{ + if ($path === $currentdir) { + $folder = '├─📂<strong>' . $dirname . '<strong>'; + } else { + $folder = '├─📁' . $dirname; + } + echo '<tr>'; + echo '<td><a href="' . $mediaopt->getpathadress($path) . '">' . str_repeat(' ', $deepness) . $folder . '</a></td>'; + echo '<td>' . $dir['dirfilecount'] . '</td>'; + echo '</tr>'; + foreach ($dir as $key => $value) { + if (is_array($value)) { + treecount($value, $key, $deepness + 1, $path . DIRECTORY_SEPARATOR . $key, $currentdir, $mediaopt); + } + } +} + + |