From 2477e787850b513cde668b6ba91297466ff31a54 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 29 Nov 2019 22:19:34 +0100 Subject: [PATCH] doclist: code cleanup and preparation --- widget/doclist.php | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/widget/doclist.php b/widget/doclist.php index 2d85884..a465768 100644 --- a/widget/doclist.php +++ b/widget/doclist.php @@ -6,37 +6,40 @@ foreach (glob("$Page$Args/2*") as $url) { $link = preg_replace('/\.html$/', '', $url); $name = pathinfo($link, PATHINFO_BASENAME); @list ($date, $suffix) = explode('.', $name, 2); - if (!filesize($url)) { + if (!isset($cal[$date])) { $cal[$date] = []; } - else { + if (!is_dir($url) and filesize($url)) { $cal[$date][$suffix] = $link; } } -$mindate = strtotime($date); +$year = 3600 * 24 * 365; # seconds per year +$scale = 8; # em width per year +$mindate = strtotime($date) + ($year / $scale * 3); # first point plus about 3em for centered text print '\n\n"; -- 2.30.0