4 'januari', 'februari', 'maart', 'april', 'mei', 'juni',
5 'juli', 'augustus', 'september', 'oktober', 'november', 'december',
8 function shownewsdate($url)
10 if (!preg_match('</(\d{4})/(\d{2})-(\d{2})->', $url, $parts)) return;
12 return implode(' ', array_filter([
13 intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1],
17 function shownewsimage($url)
19 foreach (['jpg', 'png'] as $ext) {
20 if (file_exists("$url.$ext")) {
26 function shownewsarticle($url, $link = TRUE, $title = NULL)
28 $html = ob_get_clean();
29 $date = shownewsdate($url);
35 $link ? '<h3><a href="/%2$s">%s</a></h3>' : '<h2>%s</h2>',
36 getoutput([1 => ' <small class="date">'.$date.'</small>']),
40 if (!$link and $image = shownewsimage($url)) {
42 $Place['image'] = "https://lijtweg.nl/thumb/600x/".$image;
46 1 => sprintf("\n".'<p><img src="%s" /></p>', "/thumb/640x/".$image),
50 return preg_replace('{<h2>(.*?)</h2>}', $title, $html);
53 function shownews($input, $limit = 1000)
55 if (!is_array($input)) $input = glob("$input/*.html");
56 foreach (array_reverse($input) as $url) {
60 print shownewsarticle(preg_replace('/\.html$/', '', $url));
61 print "</article>\n\n";
63 if (--$limit <= 0) break;
67 function printtoc($input)
69 if (!is_array($input)) $input = glob("$input/*.html");
71 foreach (array_reverse($input) as $page) {
72 $title = fgets(fopen($page, 'r'));
73 $title = strip_tags($title);
74 $linkurl = preg_replace('/\.html$/', '', $page);
75 printf('<li><a href="/%s">%s <small class="date">%s</small></a></li>',
76 $linkurl, $title, shownewsdate($linkurl));