]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add atom and RSS 2.0 link elements to head of profile page
authorEvan Prodromou <evan@controlyourself.ca>
Thu, 23 Oct 2008 21:26:59 +0000 (17:26 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Thu, 23 Oct 2008 21:26:59 +0000 (17:26 -0400)
darcs-hash:20081023212659-5ed1f-0efa86cf7fbcc7bae4cb468fc514f33adf15ba0d.gz

actions/showstream.php
lib/util.php

index 5650038b340f403137f70c1ce4e474e489966dbb..16bffa4ea7edeb1711ae92a8a7893e4a26492a4b 100644 (file)
@@ -75,11 +75,27 @@ class ShowstreamAction extends StreamAction {
        }
 
        function show_header($user) {
+               # Feeds
+               common_element('link', array('rel' => 'alternate',
+                                                                        'href' => common_local_url('api', 
+                                                                                                                               array('apiaction' => 'statuses',
+                                                                                                                                         'method' => 'user_timeline.rss',
+                                                                                                                                         'argument' => $user->nickname)),
+                                                                        'type' => 'application/rss+xml',
+                                                                        'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
+               common_element('link', array('rel' => 'alternate feed',
+                                                                        'href' => common_local_url('api', 
+                                                                                                                               array('apiaction' => 'statuses',
+                                                                                                                                         'method' => 'user_timeline.atom',
+                                                                                                                                         'argument' => $user->nickname)),
+                                                                        'type' => 'application/atom+xml',
+                                                                        'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
                common_element('link', array('rel' => 'alternate',
                                                                         'href' => common_local_url('userrss', array('nickname' =>
                                                                                                                                                           $user->nickname)),
-                                                                        'type' => 'application/rss+xml',
+                                                                        'type' => 'application/rdf+xml',
                                                                         'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
+               # FOAF
                common_element('link', array('rel' => 'meta',
                                                                         'href' => common_local_url('foaf', array('nickname' =>
                                                                                                                                                          $user->nickname)),
index 383bbe939a2e7b44e8e74ac85305913e8dd3d327..924625e02d5bc41933f2b13747c4ec0c338b82ff 100644 (file)
@@ -954,6 +954,23 @@ function common_fancy_url($action, $args=NULL) {
                return common_path('message/' . $args['message']);
         case 'newmessage':
                return common_path('message/new' . (($args) ? ('?' . http_build_query($args)) : ''));
+        case 'api':
+               # XXX: do fancy URLs for all the API methods
+               switch (strtolower($args['apiaction'])) {
+                case 'statuses':
+                       switch (strtolower($args['method'])) {
+                        case 'user_timeline.rss':
+                               return common_path('api/statuses/user_timeline/'.$args['argument'].'.rss');
+                        case 'user_timeline.atom':                             
+                               return common_path('api/statuses/user_timeline/'.$args['argument'].'.rss');
+                        case 'user_timeline.rss':
+                               return common_path('api/statuses/user_timeline/'.$args['argument'].'.rss');
+                        case 'user_timeline.atom':                             
+                               return common_path('api/statuses/user_timeline/'.$args['argument'].'.rss');
+                        default: return common_simple_url($action, $args);
+                       }
+                default: return common_simple_url($action, $args);
+               }
         default:
                return common_simple_url($action, $args);
        }