aboutsummaryrefslogtreecommitdiff
path: root/app/fn/fn.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/fn/fn.php')
-rw-r--r--app/fn/fn.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/fn/fn.php b/app/fn/fn.php
index ccccfb9..583227a 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 = '├─📂<span id="currentdir">' . $dirname . '<span>';
+ } else {
+ $folder = '├─📁' . $dirname;
+ }
+ echo '<tr>';
+ echo '<td><a href="' . $mediaopt->getpathadress($path) . '">' . str_repeat('&nbsp;&nbsp;', $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);
+ }
+ }
+}
+
+