mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-04-04 14:43:32 -04:00
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
This commit is contained in:
committed by
GitHub
parent
93f759fd4f
commit
ee2d2db780
@@ -470,10 +470,11 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
}
|
||||
|
||||
if ($simplePie != null) {
|
||||
if (trim($feed->name()) == '') {
|
||||
if ($feed->name(true) == '') {
|
||||
//HTML to HTML-PRE //ENT_COMPAT except '&'
|
||||
$name = strtr(html_only_entity_decode($simplePie->get_title()), array('<' => '<', '>' => '>', '"' => '"'));
|
||||
$feedProperties['name'] = $name == '' ? $feed->url() : $name;
|
||||
$feed->_name($name);
|
||||
$feedProperties['name'] = $feed->name(false);
|
||||
}
|
||||
if (trim($feed->website()) == '') {
|
||||
$website = html_only_entity_decode($simplePie->get_link());
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<div class="form-group">
|
||||
<label class="group-name" for="name"><?= _t('sub.feed.title') ?></label>
|
||||
<div class="group-controls">
|
||||
<input type="text" name="name" id="name" class="extend" value="<?= $this->feed->name() ?>" />
|
||||
<input type="text" name="name" id="name" class="extend" value="<?= $this->feed->name(true) ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
Reference in New Issue
Block a user