From: Mischa POSLAWSKY Date: Sat, 5 Dec 2020 08:15:51 +0000 (+0100) Subject: page: move showdate() into formatting include X-Git-Tag: v5.0~29 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/8fd22c9ade887e18e01dafd8a24842f6cfdc93ab page: move showdate() into formatting include Do not enforce presentation style in articles. Separate from class, allowing site override if wanted. --- diff --git a/article.inc.php b/article.inc.php index 47a08a7..2104ef9 100644 --- a/article.inc.php +++ b/article.inc.php @@ -1,19 +1,4 @@ 0 ? $monthname[intval($parts[1])] : '', $parts[0], - count($parts) > 5 ? "$parts[3]:$parts[4]" : '', - ])); -} - class ArchiveArticle { public $raw, $title, $body; # file contents @@ -114,10 +99,6 @@ class ArchiveArticle { return implode('-', $this->dateparts()) . 'T12:00:00+02:00'; } - function date() - { - return showdate($this->dateparts); - } function story() { diff --git a/format.inc.php b/format.inc.php new file mode 100644 index 0000000..10908f3 --- /dev/null +++ b/format.inc.php @@ -0,0 +1,16 @@ + 0 ? $monthname[intval($parts[1])] : '', $parts[0], + count($parts) > 5 ? "$parts[3]:$parts[4]" : '', + ])); +} + diff --git a/nieuws/index.php b/nieuws/index.php index 33b61fb..61ba993 100644 --- a/nieuws/index.php +++ b/nieuws/index.php @@ -13,7 +13,7 @@ if ($page and !is_numeric($page)) { $Page->title = $edit; } if ($Page->dateparts) { - $Page->place[1] = ' '.$Page->date.''; + $Page->place[1] = ' '.showdate($Page->dateparts).''; } else { $Page->place[1] = ''; diff --git a/page.php b/page.php index a4440cb..f493c7f 100644 --- a/page.php +++ b/page.php @@ -83,6 +83,8 @@ if (isset($Page->raw)) { # output dynamic and/or static html +include_once 'format.inc.php'; + ob_start(); if ($Page->handler and !require("./{$Page->handler}/index.php")) { # replace contents by code output on false return diff --git a/widget/nieuws.php b/widget/nieuws.php index 9cf427c..c12efc8 100644 --- a/widget/nieuws.php +++ b/widget/nieuws.php @@ -17,7 +17,7 @@ function shownews($input, $limit = 1000) print '
'; printf( '

%s %s

', - $article->link, $article->title, $article->date + $article->link, $article->title, showdate($article->dateparts) ); print $article->story; print '
';