+ public function twitterRssEntryArray($notice)
+ {
+ $entry = array();
+
+ if (Event::handle('StartRssEntryArray', array($notice, &$entry))) {
+ $profile = $notice->getProfile();
+
+ // We trim() to avoid extraneous whitespace in the output
+
+ $entry['content'] = common_xml_safe_str(trim($notice->getRendered()));
+ $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
+ $entry['link'] = common_local_url('shownotice', array('notice' => $notice->id));
+ $entry['published'] = common_date_iso8601($notice->created);
+
+ $taguribase = TagURI::base();
+ $entry['id'] = "tag:$taguribase:$entry[link]";
+
+ $entry['updated'] = $entry['published'];
+ $entry['author'] = $profile->getBestName();
+
+ // Enclosures
+ $attachments = $notice->attachments();
+ $enclosures = array();
+
+ foreach ($attachments as $attachment) {
+ try {
+ $enclosure_o = $attachment->getEnclosure();
+ $enclosure = array();
+ $enclosure['url'] = $enclosure_o->url;
+ $enclosure['mimetype'] = $enclosure_o->mimetype;
+ $enclosure['size'] = $enclosure_o->size;
+ $enclosures[] = $enclosure;
+ } catch (ServerException $e) {
+ // There was not enough metadata available
+ }
+ }
+
+ if (!empty($enclosures)) {
+ $entry['enclosures'] = $enclosures;
+ }
+
+ // Tags/Categories
+ $tag = new Notice_tag();
+ $tag->notice_id = $notice->id;
+ if ($tag->find()) {
+ $entry['tags'] = array();
+ while ($tag->fetch()) {
+ $entry['tags'][] = $tag->tag;
+ }
+ }
+ $tag->free();
+
+ // RSS Item specific
+ $entry['description'] = $entry['content'];
+ $entry['pubDate'] = common_date_rfc2822($notice->created);
+ $entry['guid'] = $entry['link'];
+
+ try {
+ $notloc = Notice_location::locFromStored($notice);
+ // This is the format that GeoJSON expects stuff to be in.
+ // showGeoRSS() below uses it for XML output, so we reuse it
+ $entry['geo'] = array('type' => 'Point',
+ 'coordinates' => array((float)$notloc->lat,
+ (float)$notloc->lon));
+ } catch (ServerException $e) {
+ $entry['geo'] = null;
+ }
+
+ Event::handle('EndRssEntryArray', array($notice, &$entry));
+ }
+
+ return $entry;
+ }
+
+ public function showTwitterRssItem($entry)
+ {
+ $this->elementStart('item');
+ $this->element('title', null, $entry['title']);
+ $this->element('description', null, $entry['description']);
+ $this->element('pubDate', null, $entry['pubDate']);
+ $this->element('guid', null, $entry['guid']);
+ $this->element('link', null, $entry['link']);
+
+ // RSS only supports 1 enclosure per item
+ if (array_key_exists('enclosures', $entry) and !empty($entry['enclosures'])) {
+ $enclosure = $entry['enclosures'][0];
+ $this->element('enclosure', array('url' => $enclosure['url'], 'type' => $enclosure['mimetype'], 'length' => $enclosure['size']), null);
+ }
+
+ if (array_key_exists('tags', $entry)) {
+ foreach ($entry['tags'] as $tag) {
+ $this->element('category', null, $tag);
+ }
+ }
+
+ $this->showGeoRSS($entry['geo']);
+ $this->elementEnd('item');
+ }
+
+ public function showGeoRSS($geo)
+ {
+ if (!empty($geo)) {
+ $this->element(
+ 'georss:point',
+ null,
+ $geo['coordinates'][0] . ' ' . $geo['coordinates'][1]
+ );
+ }
+ }
+
+ public function showAtomTimeline($notice, $title, $id, $link, $subtitle = null, $suplink = null, $selfuri = null, $logo = null)