X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/087428a7f2e31e2d9269084ba2a2f3b114a8c8d7..a332183ffe74a1580779a5eeeeb7dbe02a398075:/nieuws.inc.php diff --git a/nieuws.inc.php b/nieuws.inc.php index f4d42d8..454c91c 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -7,13 +7,22 @@ $monthname = ['?', function shownewsdate($url) { - if (!preg_match('(\d{4})/(\d{2})/(\d{2})->', $url, $parts)) return; + if (!preg_match('(\d{4})/(\d{2})-(\d{2})->', $url, $parts)) return; global $monthname; return implode(' ', array_filter([ intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1], ])); } +function shownewsimage($url) +{ + foreach (['jpg', 'png'] as $ext) { + if (file_exists("$url.$ext")) { + return "$url.$ext"; + } + } +} + function shownewsarticle($url, $link = TRUE, $title = NULL) { $html = ob_get_clean(); @@ -25,19 +34,30 @@ function shownewsarticle($url, $link = TRUE, $title = NULL) $title = sprintf( $link ? '