4 'januari', 'februari', 'maart', 'april', 'mei', 'juni',
5 'juli', 'augustus', 'september', 'oktober', 'november', 'december',
8 function showdate($parts)
11 return implode(' ', array_filter([
12 intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1],
13 count($parts) > 6 ? "$parts[4]:$parts[5]" : '',
19 function __construct($path)
22 $this->link = preg_replace('/\.html$/', '', $path);
27 return $this->$col = $this->$col(); # run method and cache
32 if (!file_exists($this->page)) return;
33 return fopen($this->page, 'r');
38 return preg_replace('{<h2>(.*)</h2>\s*}', '\1', fgets($this->file));
43 return strip_tags($this->title);
48 return filemtime($this->page);
53 return date(DATE_ATOM, $this->last);
58 preg_match('</(\d{4})[/-](\d{2})-(\d{2})->', $this->page, $ymd);
64 return implode('-', $this->dateparts());
69 return showdate($this->dateparts);
75 $rest = fread($this->file, filesize($this->page));
76 if ( preg_match('{\n<p>(<img [^>]*>)</p>\s*\z}', $rest, $img, PREG_OFFSET_CAPTURE) ) {
77 $this->img = $img[1][0];
78 return substr($rest, 0, $img[0][1]);
92 if ( preg_match('/\bsrc="([^"]*)"/', $this->img, $src) ) {
97 function thumb($size = '300x')
99 if (!$this->image or $this->image[0] !== '/') return;
100 return preg_replace('{^(?:/thumb/[^/]*)?}', "thumb/$size", $this->image);
104 function shownews($input, $limit = 1000)
106 if (!is_array($input)) $input = glob("$input/*.html");
107 print '<ul class="left">'."\n\n";
108 foreach (array_reverse($input) as $filename) {
109 $article = new ArchiveArticle($filename);
111 if ($article->thumb) {
112 printf('<img src="/%s" class="left" />', $article->thumb);
116 '<h3><a href="/%s">%s <small class="date">%s</small></a></h3>',
117 $article->link, $article->title, $article->date
119 print $article->body;
120 print "</article></li>\n\n";
122 if (--$limit <= 0) break;
127 function printtoc($input)
129 if (!is_array($input)) $input = glob("$input/*.html");
131 foreach (array_reverse($input) as $page) {
132 $article = new ArchiveArticle($page);
133 printf('<li><a href="/%s">%s <small class="date">%s</small></a></li>',
134 $article->link, $article->safetitle, $article->date);