From 696afa96d3a1eac80b030656a1aeb36fc20a22db Mon Sep 17 00:00:00 2001 From: fulmeek <36341513+fulmeek@users.noreply.github.com> Date: Thu, 14 Mar 2019 19:43:00 +0100 Subject: [PATCH] [BakaUpdatesMangaReleasesBridge] filter title and groups (#1058) Baka-Updates Manga uses an asterisk (*) to denote series information have been updated within the last 24 hours. This is not helpful in a feed. --- bridges/BakaUpdatesMangaReleasesBridge.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bridges/BakaUpdatesMangaReleasesBridge.php b/bridges/BakaUpdatesMangaReleasesBridge.php index eeeeb4d7..cde9be84 100644 --- a/bridges/BakaUpdatesMangaReleasesBridge.php +++ b/bridges/BakaUpdatesMangaReleasesBridge.php @@ -31,7 +31,7 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract { ); if (isset($rows[0][1])) { - $this->feedName = html_entity_decode($rows[0][1]->plaintext); + $this->feedName = $this->filterHTML($rows[0][1]->plaintext); } foreach($rows as $cols) { @@ -48,8 +48,8 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract { $objTitle = $cols[1]; if ($objTitle) { - $title[] = html_entity_decode($objTitle->plaintext); - $item['content'] .= '

Series: ' . $objTitle->innertext . '

'; + $title[] = $this->filterHTML($objTitle->plaintext); + $item['content'] .= '

Series: ' . $this->filterText($objTitle->innertext) . '

'; } $objVolume = $cols[2]; @@ -62,8 +62,8 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract { $objAuthor = $cols[4]; if ($objAuthor && !empty($objAuthor->plaintext)) { - $item['author'] = html_entity_decode($objAuthor->plaintext); - $item['content'] .= '

Groups: ' . $objAuthor->innertext . '

'; + $item['author'] = $this->filterHTML($objAuthor->plaintext); + $item['content'] .= '

Groups: ' . $this->filterText($objAuthor->innertext) . '

'; } $item['title'] = implode(' ', $title); @@ -88,4 +88,12 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract { } return parent::getName(); } + + private function filterText($text) { + return rtrim($text, '*'); + } + + private function filterHTML($text) { + return $this->filterText(html_entity_decode($text)); + } }