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('{(?:/index)?\.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 trim(strip_tags($this->title));
48 return $this->safetitle ?: $this->link;
53 return filemtime($this->page);
58 return date(DATE_ATOM, $this->last);
63 preg_match('< / (\d{4}) [/-] (\d{2}) (?:- (\d{2}) )? - >x', $this->page, $ymd);
69 return implode('-', $this->dateparts());
74 return showdate($this->dateparts);
80 $rest = fread($this->file, filesize($this->page));
81 if ( preg_match('{\n<p>(<img [^>]*>)</p>}', $rest, $img, PREG_OFFSET_CAPTURE) ) {
82 $this->img = $img[1][0];
83 return substr($rest, 0, $img[0][1]);
97 if ( preg_match('/\bsrc="([^"]*)"/', $this->img, $src) ) {
102 function thumb($size = '300x')
104 if (!$this->image or $this->image[0] !== '/') return;
105 return preg_replace('{^(?:/thumb/[^/]*)?}', "thumb/$size", $this->image);
109 function shownews($input, $limit = 1000)
111 if (!is_array($input)) $input = glob("$input/*.html");
112 print '<ul class="left">'."\n\n";
113 foreach (array_reverse($input) as $filename) {
114 $article = new ArchiveArticle($filename);
116 if ($article->thumb) {
117 $img = preg_replace('{(?<= \b src="/) [^"]* }x', $article->thumb, $article->img);
118 $img = preg_replace('{(?= />$)}', ' class="left"', $img);
123 '<h3><a href="/%s">%s <small class="date">%s</small></a></h3>',
124 $article->link, $article->title, $article->date
126 print $article->body;
127 print "</article></li>\n\n";
129 if (--$limit <= 0) break;
134 function printtoc($input)
136 if (!is_array($input)) $input = glob("$input/*.html");
138 foreach (array_reverse($input) as $page) {
139 $article = new ArchiveArticle($page);
140 printf('<li><a href="/%s">%s <small class="date">%s</small></a></li>',
141 $article->link, $article->safetitle, $article->date);