From ee2d2db7807065587664d75de2c617f06c8ee568 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 22 Aug 2021 13:33:58 +0200 Subject: Fallback for feeds with empty title (#3787) * Fallback for feeds with empty title Address a part of https://github.com/FreshRSS/FreshRSS/issues/3776 for existing feeds * Also strip www prefix * Reuse fallback logic --- app/Models/Feed.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/Models') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index e3d8f253e..012bdced8 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -75,8 +75,8 @@ class FreshRSS_Feed extends Minz_Model { $simplePie = $this->load(false, true); return $simplePie == null ? [] : iterator_to_array($this->loadEntries($simplePie)); } - public function name() { - return $this->name; + public function name($raw = false) { + return $raw || $this->name != '' ? $this->name : preg_replace('%^https?://(www[.])?%i', '', $this->url); } public function website() { return $this->website; @@ -198,7 +198,7 @@ class FreshRSS_Feed extends Minz_Model { $this->category = $value >= 0 ? $value : 0; } public function _name($value) { - $this->name = $value === null ? '' : $value; + $this->name = $value === null ? '' : trim($value); } public function _website($value, $validate = true) { if ($validate) { -- cgit v1.2.3