]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
trim some output to avoid excessive whitespace
authorEvan Prodromou <evan@prodromou.name>
Sun, 14 Dec 2008 16:19:42 +0000 (11:19 -0500)
committerEvan Prodromou <evan@prodromou.name>
Sun, 14 Dec 2008 16:19:42 +0000 (11:19 -0500)
darcs-hash:20081214161942-84dde-bfb91a534eb01d3e16b364937dcf405277e75a6a.gz

lib/rssaction.php
lib/twitterapi.php

index e728715567986c6533df134ceac0860302faf5a5..777511506dff0bf8b710a77bcc7029e3344cab5e 100644 (file)
@@ -123,7 +123,7 @@ class Rss10Action extends Action {
                $nurl = common_local_url('shownotice', array('notice' => $notice->id));
                $creator_uri = common_profile_uri($profile);
                common_element_start('item', array('rdf:about' => $notice->uri));
-               $title = $profile->nickname . ': ' . common_xml_safe_str($notice->content);
+               $title = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
                common_element('title', NULL, $title);
                common_element('link', NULL, $nurl);
                common_element('description', NULL, $profile->nickname."'s status on ".common_exact_date($notice->created));
index 4346adcd1f68469018e8608855d0ed07134696b8..2083e8961760ad418e0fe56bf5a065af6b78ee6b 100644 (file)
@@ -90,8 +90,10 @@ class TwitterapiAction extends Action {
                $server = common_config('site', 'server');
                $entry = array();
 
-               $entry['content'] = common_xml_safe_str($notice->rendered);
-               $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str($notice->content);
+        # We trim() to avoid extraneous whitespace in the output
+
+               $entry['content'] = common_xml_safe_str(trim($notice->rendered));
+               $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);
                $entry['id'] = "tag:$server,2008:$entry[link]";
@@ -113,7 +115,7 @@ class TwitterapiAction extends Action {
                $entry['title'] = sprintf('Message from %s to %s',
                        $message->getFrom()->nickname, $message->getTo()->nickname);
 
-               $entry['content'] = common_xml_safe_str($message->content);
+               $entry['content'] = common_xml_safe_str(trim($message->content));
                $entry['link'] = common_local_url('showmessage', array('message' => $message->id));
                $entry['published'] = common_date_iso8601($message->created);
                $entry['id'] = "tag:$server,2008:$entry[link]";
@@ -136,7 +138,7 @@ class TwitterapiAction extends Action {
 
                $twitter_dm['id'] = $message->id;
                $twitter_dm['sender_id'] = $message->from_profile;
-               $twitter_dm['text'] = $message->content;
+               $twitter_dm['text'] = trim($message->content);
                $twitter_dm['recipient_id'] = $message->to_profile;
                $twitter_dm['created_at'] = $this->date_twitter($message->created);
                $twitter_dm['sender_screen_name'] = $from_profile->nickname;