', $url, $parts)) return;
global $monthname;
return implode(' ', array_filter([
intval($parts[3]), $monthname[intval($parts[2])], $parts[1],
]));
}
function shownewsarticle($url, $link = TRUE, $title = NULL)
{
$html = ob_get_clean();
$date = shownewsdate($url);
ob_start();
print $title ?: '\1';
print '[[1]]';
$title = sprintf(
$link ? '
' : '%s
',
getoutput([1 => ' '.$date.'']),
preg_replace('/\.html$/', '', $url)
);
return preg_replace('{(.*?)
}', $title, $html);
}
function shownews($root, $limit = 5)
{
if (strpos($root, '/') === FALSE) $root .= '/*';
foreach (array_reverse(glob("$root/*.html")) as $url) {
print "";
ob_start();
include $url;
print shownewsarticle($url);
print "\n\n";
if (--$limit <= 0) break;
}
}
function printtoc($root)
{
print '';
foreach (array_reverse(glob("$root/*.html")) as $page) {
$title = fgets(fopen($page, 'r'));
$title = strip_tags($title);
$linkurl = preg_replace('/\.html$/', '', $page);
printf('- %s %s
',
$linkurl, $title, shownewsdate($linkurl));
}
print "
\n";
}