summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-04-02 10:20:02 +0300
committerAndrew Dolgov <[email protected]>2021-04-02 10:20:47 +0300
commit57b22ce4b10c6d2e36acb4e33f6bfcb6789bb8a3 (patch)
treee6225e7c902ad56e9b1707c39405c1aed5a7cf9c
parent244704bafd114963a9c7960d8a192e9af187998b (diff)
add missing namespaces to local xpath object
cause: reddit is using an invalid timestamp element (pubDate) in their atom feeds which made FeedItem_Atom try dc:date as a fallback.
-rwxr-xr-xinit.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/init.php b/init.php
index ed71492..0414623 100755
--- a/init.php
+++ b/init.php
@@ -171,7 +171,17 @@ class Reddit_Delay extends Plugin {
if ($doc->loadXML($feed_data)) {
$xpath = new DOMXPath($doc);
+
+ // refs. FeedParser->init()
+ // some of those like dc: are needed for timestamps
$xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
+ $xpath->registerNamespace('atom03', 'http://purl.org/atom/ns#');
+ $xpath->registerNamespace('media', 'http://search.yahoo.com/mrss/');
+ $xpath->registerNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
+ $xpath->registerNamespace('slash', 'http://purl.org/rss/1.0/modules/slash/');
+ $xpath->registerNamespace('dc', 'http://purl.org/dc/elements/1.1/');
+ $xpath->registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/');
+ $xpath->registerNamespace('thread', 'http://purl.org/syndication/thread/1.0');
$entries = $xpath->query("//atom:entry|//channel/item");