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->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->id = (string) $xml->id;
|
||||||
$this->updated = $this->parseDate((string) $xml->updated);
|
$this->updated = $this->parseDate((string) $xml->updated);
|
||||||
$author = (string) $xml->author->name;
|
$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) {
|
foreach ($xml->entry as $entry) {
|
||||||
|
|
||||||
if (isset($entry->author->name)) {
|
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);
|
$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->url = (string) $xml->channel->link;
|
||||||
$this->id = $this->url;
|
$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']);
|
$ns_dc = $xml->channel->children($namespaces['dc']);
|
||||||
$this->updated = isset($ns_dc->date) ? $this->parseDate($ns_dc->date) : time();
|
$this->updated = isset($ns_dc->date) ? $this->parseDate($ns_dc->date) : time();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
$this->updated = time();
|
$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->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->id = $this->url;
|
||||||
$this->updated = $this->parseDate(isset($xml->channel->pubDate) ? (string) $xml->channel->pubDate : (string) $xml->channel->lastBuildDate);
|
$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
|
// RSS feed might be empty
|
||||||
if (! $xml->channel->item) {
|
if (! $xml->channel->item) {
|
||||||
\PicoFeed\Logging::log(\get_called_class().': feed empty or malformed');
|
\PicoFeed\Logging::log(\get_called_class().': feed empty or malformed');
|
||||||
|
Loading…
Reference in New Issue
Block a user