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 return fopen($this->page, 'r');
37 return preg_replace('{<h2>(.*)</h2>\s*}', '\1', fgets($this->file));
42 return strip_tags($this->title);
47 return filemtime($this->page);
52 return date(DATE_ATOM, $this->last);
57 preg_match('</(\d{4})/(\d{2})-(\d{2})->', $this->page, $ymd);
63 return implode('-', $this->dateparts());
68 return showdate($this->dateparts);
74 $rest = fread($this->file, filesize($this->page));
75 if ( preg_match('{\n<p>(<img [^>]*>)</p>\s*\z}', $rest, $img, PREG_OFFSET_CAPTURE) ) {
76 $this->img = $img[1][0];
77 return substr($rest, 0, $img[0][1]);
91 if ( preg_match('/\bsrc="([^"]*)"/', $this->img, $src) ) {
96 function thumb($size = '300x')
98 if (!$this->image or $this->image[0] !== '/') return;
99 return "thumb/$size{$this->image}";
103 function shownews($input, $limit = 1000)
105 if (!is_array($input)) $input = glob("$input/*.html");
106 print '<ul class="left">'."\n\n";
107 foreach (array_reverse($input) as $filename) {
108 $article = new ArchiveArticle($filename);
110 if ($article->thumb) {
111 printf('<img src="/%s" class="left" />', $article->thumb);
115 '<h3><a href="/%s">%s <small class="date">%s</small></a></h3>',
116 $article->link, $article->title, $article->date
118 print $article->body;
119 print "</article></li>\n\n";
121 if (--$limit <= 0) break;
126 function printtoc($input)
128 if (!is_array($input)) $input = glob("$input/*.html");
130 foreach (array_reverse($input) as $page) {
131 $article = new ArchiveArticle($page);
132 printf('<li><a href="/%s">%s <small class="date">%s</small></a></li>',
133 $article->link, $article->safetitle, $article->date);