diff --git a/vendor/PicoFeed/Parser.php b/vendor/PicoFeed/Parser.php index 3af694e..8e8d89f 100644 --- a/vendor/PicoFeed/Parser.php +++ b/vendor/PicoFeed/Parser.php @@ -159,4 +159,17 @@ abstract class Parser return 0; } + + + // Hardcoded list of hostname/token to exclude from id generation + public function isExcludedFromId($url) + { + $exclude_list = array('ap.org'); + + foreach ($exclude_list as $token) { + if (strpos($url, $token) !== false) return true; + } + + return false; + } } diff --git a/vendor/PicoFeed/Parsers/Atom.php b/vendor/PicoFeed/Parsers/Atom.php index 59b3719..31583f5 100644 --- a/vendor/PicoFeed/Parsers/Atom.php +++ b/vendor/PicoFeed/Parsers/Atom.php @@ -26,7 +26,6 @@ class Atom extends \PicoFeed\Parser foreach ($xml->entry as $entry) { if (isset($entry->author->name)) { - $author = (string) $entry->author->name; } @@ -34,7 +33,7 @@ class Atom extends \PicoFeed\Parser $item = new \StdClass; $item->url = $this->getUrl($entry); - $item->id = $this->generateId($id !== $item->url ? $id : $item->url, $this->url); + $item->id = $this->generateId($id !== $item->url ? $id : $item->url, $this->isExcludedFromId($this->url) ? '' : $this->url); $item->title = $this->stripWhiteSpace((string) $entry->title); $item->updated = $this->parseDate((string) $entry->updated); $item->author = $author; diff --git a/vendor/PicoFeed/Parsers/Rss10.php b/vendor/PicoFeed/Parsers/Rss10.php index 43c0b3c..b6890e7 100644 --- a/vendor/PicoFeed/Parsers/Rss10.php +++ b/vendor/PicoFeed/Parsers/Rss10.php @@ -72,7 +72,7 @@ class Rss10 extends \PicoFeed\Parser if (empty($item->title)) $item->title = $item->url; - $item->id = $this->generateId($item->url, $this->url); + $item->id = $this->generateId($item->url, $this->isExcludedFromId($this->url) ? '' : $this->url); $item->content = $this->filterHtml($item->content, $item->url); $this->items[] = $item; } diff --git a/vendor/PicoFeed/Parsers/Rss20.php b/vendor/PicoFeed/Parsers/Rss20.php index 1a0f3f0..8196b30 100644 --- a/vendor/PicoFeed/Parsers/Rss20.php +++ b/vendor/PicoFeed/Parsers/Rss20.php @@ -98,11 +98,11 @@ class Rss20 extends \PicoFeed\Parser if (isset($entry->guid) && isset($entry->guid['isPermaLink']) && (string) $entry->guid['isPermaLink'] != 'false') { $id = (string) $entry->guid; - $item->id = $this->generateId($id !== '' && $id !== $item->url ? $id : $item->url, $this->url); + $item->id = $this->generateId($id !== '' && $id !== $item->url ? $id : $item->url, $this->isExcludedFromId($this->url) ? '' : $this->url); } else { - $item->id = $this->generateId($item->url, $this->url); + $item->id = $this->generateId($item->url, $this->isExcludedFromId($this->url) ? '' : $this->url); } if (empty($item->title)) $item->title = $item->url;