]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/rssaction.php
Initial user role controls on profile pages, for owner to add/remove administrator...
[quix0rs-gnu-social.git] / lib / rssaction.php
index cd4c8b51c4810894ffaa3f675c3a94ca66b20fef..62e3f21b61dc1f074547666cb3edbba681b1990d 100644 (file)
@@ -52,7 +52,7 @@ class Rss10Action extends Action
      * @see Action::__construct
      */
 
-    function __construct($output='php://output', $indent=true)
+    function __construct($output='php://output', $indent=null)
     {
         parent::__construct($output, $indent);
     }
@@ -176,8 +176,10 @@ class Rss10Action extends Action
         $this->showChannel();
         $this->showImage();
 
-        foreach ($this->notices as $n) {
-            $this->showItem($n);
+        if (count($this->notices)) {
+            foreach ($this->notices as $n) {
+                $this->showItem($n);
+            }
         }
 
         $this->showCreators();
@@ -203,8 +205,10 @@ class Rss10Action extends Action
         $this->elementStart('items');
         $this->elementStart('rdf:Seq');
 
-        foreach ($this->notices as $notice) {
-            $this->element('rdf:li', array('rdf:resource' => $notice->uri));
+        if (count($this->notices)) {
+            foreach ($this->notices as $notice) {
+                $this->element('rdf:li', array('rdf:resource' => $notice->uri));
+            }
         }
 
         $this->elementEnd('rdf:Seq');
@@ -270,14 +274,7 @@ class Rss10Action extends Action
             foreach($attachments as $attachment){
                 $enclosure=$attachment->getEnclosure();
                 if ($enclosure) {
-                    // DO NOT move xmlns declaration to root element. Making it
-                    // the default namespace here improves compatibility with
-                    // real-world feed readers.
-                    $attribs = array(
-                        'rdf:resource' => $enclosure->url,
-                        'url' => $enclosure->url,
-                        'xmlns' => 'http://purl.oclc.org/net/rss_2.0/enc#'
-                        );
+                    $attribs = array('rdf:resource' => $enclosure->url);
                     if ($enclosure->title) {
                         $attribs['dc:title'] = $enclosure->title;
                     }
@@ -285,12 +282,12 @@ class Rss10Action extends Action
                         $attribs['dc:date'] = common_date_w3dtf($enclosure->modified);
                     }
                     if ($enclosure->size) {
-                        $attribs['length'] = $enclosure->size;
+                        $attribs['enc:length'] = $enclosure->size;
                     }
                     if ($enclosure->mimetype) {
-                        $attribs['type'] = $enclosure->mimetype;
+                        $attribs['enc:type'] = $enclosure->mimetype;
                     }
-                    $this->element('enclosure', $attribs);
+                    $this->element('enc:enclosure', $attribs);
                 }
                 $this->element('sioc:links_to', array('rdf:resource'=>$attachment->url));
             }
@@ -358,6 +355,8 @@ class Rss10Action extends Action
                                               'http://commontag.org/ns#',
                                               'xmlns:foaf' =>
                                               'http://xmlns.com/foaf/0.1/',
+                                              'xmlns:enc' =>
+                                              'http://purl.oclc.org/net/rss_2.0/enc#',
                                               'xmlns:sioc' =>
                                               'http://rdfs.org/sioc/ns#',
                                               'xmlns:sioct' =>