]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/rssaction.php
don't hide unsub button for remote users
[quix0rs-gnu-social.git] / lib / rssaction.php
index 66c2d9e8cd2399adf22a6311a044ae604fadf458..0c8188e88021a8aca153d0eefb09ecf2b5805861 100644 (file)
@@ -94,11 +94,15 @@ class Rss10Action extends Action
 
     function handle($args)
     {
-        // Get the list of notices
-        $this->notices = $this->getNotices();
         // Parent handling, including cache check
         parent::handle($args);
-        $this->showRss($this->limit);
+        // Get the list of notices
+        if (empty($this->tag)) {
+            $this->notices = $this->getNotices($this->limit);
+        } else {
+            $this->notices = $this->getTaggedNotices($this->tag, $this->limit);
+        }
+        $this->showRss();
     }
 
     /**
@@ -132,15 +136,13 @@ class Rss10Action extends Action
         return null;
     }
 
-    function showRss($limit=0)
+    function showRss()
     {
-        $notices = $this->getNotices($limit);
-
         $this->initRss();
-        $this->showChannel($notices);
+        $this->showChannel();
         $this->showImage();
 
-        foreach ($notices as $n) {
+        foreach ($this->notices as $n) {
             $this->showItem($n);
         }
 
@@ -148,7 +150,7 @@ class Rss10Action extends Action
         $this->endRss();
     }
 
-    function showChannel($notices)
+    function showChannel()
     {
 
         $channel = $this->getChannel();
@@ -167,8 +169,8 @@ class Rss10Action extends Action
         $this->elementStart('items');
         $this->elementStart('rdf:Seq');
 
-        foreach ($notices as $notice) {
-            $this->element('sioct:MicroblogPost', array('rdf:resource' => $notice->uri));
+        foreach ($this->notices as $notice) {
+            $this->element('rdf:li', array('rdf:resource' => $notice->uri));
         }
 
         $this->elementEnd('rdf:Seq');
@@ -195,16 +197,25 @@ class Rss10Action extends Action
         $profile = Profile::staticGet($notice->profile_id);
         $nurl = common_local_url('shownotice', array('notice' => $notice->id));
         $creator_uri = common_profile_uri($profile);
-        $this->elementStart('item', array('rdf:about' => $notice->uri));
+        $this->elementStart('item', array('rdf:about' => $notice->uri,
+                            'rdf:type' => 'http://rdfs.org/sioc/types#MicroblogPost'));
         $title = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
         $this->element('title', null, $title);
         $this->element('link', null, $nurl);
         $this->element('description', null, $profile->nickname."'s status on ".common_exact_date($notice->created));
+        if ($notice->rendered) {
+            $this->element('content:encoded', null, common_xml_safe_str($notice->rendered));
+        }
         $this->element('dc:date', null, common_date_w3dtf($notice->created));
         $this->element('dc:creator', null, ($profile->fullname) ? $profile->fullname : $profile->nickname);
-        $this->element('sioc:has_creator', array('rdf:resource' => $creator_uri));
+        $this->element('foaf:maker', array('rdf:resource' => $creator_uri));
+        $this->element('sioc:has_creator', array('rdf:resource' => $creator_uri.'#acct'));
         $this->element('laconica:postIcon', array('rdf:resource' => $profile->avatarUrl()));
         $this->element('cc:licence', array('rdf:resource' => common_config('license', 'url')));
+        if ($notice->reply_to) {
+            $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
+            $this->element('sioc:reply_of', array('rdf:resource' => $replyurl));
+        }
         $this->elementEnd('item');
         $this->creators[$creator_uri] = $profile;
     }
@@ -214,15 +225,15 @@ class Rss10Action extends Action
         foreach ($this->creators as $uri => $profile) {
             $id = $profile->id;
             $nickname = $profile->nickname;
-            $this->elementStart('sioc:User', array('rdf:about' => $uri));
+            $this->elementStart('foaf:Agent', array('rdf:about' => $uri));
             $this->element('foaf:nick', null, $nickname);
             if ($profile->fullname) {
                 $this->element('foaf:name', null, $profile->fullname);
             }
-            $this->element('sioc:id', null, $id);
+            $this->element('foaf:holdsAccount', array('rdf:resource' => $uri.'#acct'));
             $avatar = $profile->avatarUrl();
-            $this->element('sioc:avatar', array('rdf:resource' => $avatar));
-            $this->elementEnd('sioc:User');
+            $this->element('foaf:depiction', array('rdf:resource' => $avatar));
+            $this->elementEnd('foaf:Agent');
         }
     }
 
@@ -237,7 +248,7 @@ class Rss10Action extends Action
                                               'xmlns:dc' =>
                                               'http://purl.org/dc/elements/1.1/',
                                               'xmlns:cc' =>
-                                              'http://web.resource.org/cc/',
+                                              'http://creativecommons.org/ns#',
                                               'xmlns:content' =>
                                               'http://purl.org/rss/1.0/modules/content/',
                                               'xmlns:foaf' =>
@@ -251,10 +262,10 @@ class Rss10Action extends Action
                                               'xmlns' => 'http://purl.org/rss/1.0/'));
         $this->elementStart('sioc:Site', array('rdf:about' => common_root_url()));
         $this->element('sioc:name', null, common_config('site', 'name'));
-        $this->elementStart('sioc:container_of');
+        $this->elementStart('sioc:space_of');
         $this->element('sioc:Container', array('rdf:about' =>
                                                $channel['url']));
-        $this->elementEnd('sioc:container_of');
+        $this->elementEnd('sioc:space_of');
         $this->elementEnd('sioc:Site');
     }