Bug fix: when the title is empty, use the url as title
This commit is contained in:
parent
b7999ebf5d
commit
ad75a71a51
5
vendor/PicoFeed/Parsers/Atom.php
vendored
5
vendor/PicoFeed/Parsers/Atom.php
vendored
@ -18,11 +18,14 @@ class Atom extends \PicoFeed\Parser
|
||||
}
|
||||
|
||||
$this->url = $this->getUrl($xml);
|
||||
$this->title = $this->stripWhiteSpace((string) $xml->title);
|
||||
$this->title = $this->stripWhiteSpace((string) $xml->title) ?: $this->url;
|
||||
$this->id = (string) $xml->id;
|
||||
$this->updated = $this->parseDate((string) $xml->updated);
|
||||
$author = (string) $xml->author->name;
|
||||
|
||||
\PicoFeed\Logging::log(\get_called_class().': Title => '.$this->title);
|
||||
\PicoFeed\Logging::log(\get_called_class().': Url => '.$this->url);
|
||||
|
||||
foreach ($xml->entry as $entry) {
|
||||
|
||||
if (isset($entry->author->name)) {
|
||||
|
7
vendor/PicoFeed/Parsers/Rss10.php
vendored
7
vendor/PicoFeed/Parsers/Rss10.php
vendored
@ -19,17 +19,18 @@ class Rss10 extends \PicoFeed\Parser
|
||||
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
$this->title = $this->stripWhiteSpace((string) $xml->channel->title);
|
||||
$this->title = $this->stripWhiteSpace((string) $xml->channel->title) ?: $this->url;
|
||||
$this->url = (string) $xml->channel->link;
|
||||
$this->id = $this->url;
|
||||
|
||||
if (isset($namespaces['dc'])) {
|
||||
\PicoFeed\Logging::log(\get_called_class().': Title => '.$this->title);
|
||||
\PicoFeed\Logging::log(\get_called_class().': Url => '.$this->url);
|
||||
|
||||
if (isset($namespaces['dc'])) {
|
||||
$ns_dc = $xml->channel->children($namespaces['dc']);
|
||||
$this->updated = isset($ns_dc->date) ? $this->parseDate($ns_dc->date) : time();
|
||||
}
|
||||
else {
|
||||
|
||||
$this->updated = time();
|
||||
}
|
||||
|
||||
|
5
vendor/PicoFeed/Parsers/Rss20.php
vendored
5
vendor/PicoFeed/Parsers/Rss20.php
vendored
@ -37,10 +37,13 @@ class Rss20 extends \PicoFeed\Parser
|
||||
$this->url = (string) $xml->channel->link;
|
||||
}
|
||||
|
||||
$this->title = $this->stripWhiteSpace((string) $xml->channel->title);
|
||||
$this->title = $this->stripWhiteSpace((string) $xml->channel->title) ?: $this->url;
|
||||
$this->id = $this->url;
|
||||
$this->updated = $this->parseDate(isset($xml->channel->pubDate) ? (string) $xml->channel->pubDate : (string) $xml->channel->lastBuildDate);
|
||||
|
||||
\PicoFeed\Logging::log(\get_called_class().': Title => '.$this->title);
|
||||
\PicoFeed\Logging::log(\get_called_class().': Url => '.$this->url);
|
||||
|
||||
// RSS feed might be empty
|
||||
if (! $xml->channel->item) {
|
||||
\PicoFeed\Logging::log(\get_called_class().': feed empty or malformed');
|
||||
|
Loading…
Reference in New Issue
Block a user