page: rename article method "body" to "story"
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 27 Jun 2019 21:42:53 +0000 (23:42 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 28 Jun 2019 01:20:30 +0000 (03:20 +0200)
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
nieuws.php
nieuws/feed/index.php

index c6f3be9680d34b5d331cbf1c52c0c2f342add3d1..5de149226130e35fff49633a3fcb3cda3d8f9e35 100644 (file)
@@ -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* )+ (<img\ [^>]*>) | \n <hr\ />
                }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('{<p>(.*?)</p>}s', $this->body, $bodyp)) {
+               if (preg_match('{<p>(.*?)</p>}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;
        }
 
index 15a0dfbc85d0a0ea0f006f01ece45c76b09a90e9..0dc8d7dcc56c52062f70ba40bb7de67748c3f8da 100644 (file)
@@ -18,7 +18,7 @@ function shownews($input, $limit = 1000)
                        '<h3><a href="/%s">%s <small class="date">%s</small></a></h3>',
                        $article->link, $article->title, $article->date
                );
-               print $article->body;
+               print $article->story;
                print '</div>';
                print "</article>\n\n";
 
index fdb91d5a66b77c0442d1ce9545c3d96f5239db02..72c22074c2af16b1649620522a3225ba26457fca 100644 (file)
@@ -30,7 +30,7 @@ foreach ($pages as $i => $page) {
                <title><?= $article->title ?></title>
                <published><?= $article->dateiso ?></published>
                <updated><?= $article->dateiso ?></updated>
-               <content type="html"><?= htmlspecialchars($article->body) ?>
+               <content type="html"><?= htmlspecialchars($article->story) ?>
                </content>
 <?php
        if ($article->thumb) {