]> git.mxchange.org Git - friendica.git/commitdiff
Support for feeds that follow the ATOM 0.3 specification
authorMichael <heluecht@pirati.ca>
Sat, 6 May 2023 11:35:34 +0000 (11:35 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 6 May 2023 11:35:34 +0000 (11:35 +0000)
src/Protocol/ActivityNamespace.php
src/Protocol/Feed.php

index 2301d547fa24f8d9ffebf6a6d4087b47140a51aa..bcbf5b4035e2c87618b0ddf66b647981fe526080 100644 (file)
@@ -145,6 +145,12 @@ final class ActivityNamespace
         */
        const ATOM1           = 'http://www.w3.org/2005/Atom';
 
+       /**
+        * This namespace is used for the (deprecated) Atom 0.3 specification
+        * @var string
+        */
+       const ATOM03           = 'http://purl.org/atom/ns#';
+       
        /**
         * @var string
         */
index bfb74483820bab6508ba0b515f65143a692ed794..f31513b237767d3ea6107e67ab2be216fd7a07b6 100644 (file)
@@ -92,7 +92,12 @@ class Feed
                $doc = new DOMDocument();
                @$doc->loadXML($xml);
                $xpath = new DOMXPath($doc);
-               $xpath->registerNamespace('atom', ActivityNamespace::ATOM1);
+
+               if (strpos($xml, ActivityNamespace::ATOM03) && !strpos($xml, ActivityNamespace::ATOM1)) {
+                       $xpath->registerNamespace('atom', ActivityNamespace::ATOM03);
+               } else {
+                       $xpath->registerNamespace('atom', ActivityNamespace::ATOM1);
+               }
                $xpath->registerNamespace('dc', 'http://purl.org/dc/elements/1.1/');
                $xpath->registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/');
                $xpath->registerNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');