From 022d44c8ddf33f855e6ed33cae6ad9ae103e074d Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 27 Jun 2019 23:42:53 +0200 Subject: [PATCH] page: rename article method "body" to "story" Free "body" name to represent all contents as implied, instead of the more appropriately named main "story" part until the first separator. --- article.inc.php | 7 ++++--- nieuws.php | 2 +- nieuws/feed/index.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/article.inc.php b/article.inc.php index c6f3be9..5de1492 100644 --- a/article.inc.php +++ b/article.inc.php @@ -75,13 +75,14 @@ class ArchiveArticle return showdate($this->dateparts); } - function body() + function story() { $this->title; $rest = fread($this->file, filesize($this->page)); if ( preg_match('{ \n (?: < (?: p | figure [^>]* ) >\s* )+ (]*>) | \n }x', $rest, $img, PREG_OFFSET_CAPTURE) ) { + # strip part after matching divider (image) if (isset($img[1])) { $this->img = $img[1][0]; } @@ -92,7 +93,7 @@ class ArchiveArticle function teaser() { - if (preg_match('{

(.*?)

}s', $this->body, $bodyp)) { + if (preg_match('{

(.*?)

}s', $this->story, $bodyp)) { return $bodyp[1]; } } @@ -100,7 +101,7 @@ class ArchiveArticle function img() { $this->img = NULL; - $this->body; + $this->story; return $this->img; } diff --git a/nieuws.php b/nieuws.php index 15a0dfb..0dc8d7d 100644 --- a/nieuws.php +++ b/nieuws.php @@ -18,7 +18,7 @@ function shownews($input, $limit = 1000) '

%s %s

', $article->link, $article->title, $article->date ); - print $article->body; + print $article->story; print ''; print "\n\n"; diff --git a/nieuws/feed/index.php b/nieuws/feed/index.php index fdb91d5..72c2207 100644 --- a/nieuws/feed/index.php +++ b/nieuws/feed/index.php @@ -30,7 +30,7 @@ foreach ($pages as $i => $page) { <?= $article->title ?> dateiso ?> dateiso ?> - body) ?> + story) ?> thumb) { -- 2.30.0