]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelist.php
Document messages for which clarification was requested.
[quix0rs-gnu-social.git] / lib / noticelist.php
index 837cb90faa13bb29a9fdfe0f5734c569995c0650..b7855048768f294293573245e75204aecbd20e20 100644 (file)
@@ -340,8 +340,9 @@ class NoticeListItem extends Widget
 
     function showNickname()
     {
-        $this->out->element('span', array('class' => 'nickname fn'),
-                            $this->profile->nickname);
+        $this->out->raw('<span class="nickname fn">' .
+                        htmlspecialchars($this->profile->nickname) .
+                        '</span>');
     }
 
     /**
@@ -380,12 +381,12 @@ class NoticeListItem extends Widget
 
     function showNoticeLink()
     {
-        if($this->notice->is_local == Notice::LOCAL_PUBLIC || $this->notice->is_local == Notice::LOCAL_NONPUBLIC){
-            $noticeurl = common_local_url('shownotice',
-                                      array('notice' => $this->notice->id));
-        }else{
-            $noticeurl = $this->notice->uri;
-        }
+        $noticeurl = $this->notice->bestUrl();
+
+        // above should always return an URL
+
+        assert(!empty($noticeurl));
+
         $this->out->elementStart('a', array('rel' => 'bookmark',
                                             'class' => 'timestamp',
                                             'href' => $noticeurl));
@@ -425,10 +426,18 @@ class NoticeListItem extends Widget
         if (empty($name)) {
             $latdms = $this->decimalDegreesToDMS(abs($lat));
             $londms = $this->decimalDegreesToDMS(abs($lon));
+            // TRANS: Used in coordinates as abbreviation of north
+            $north = _('N')
+            // TRANS: Used in coordinates as abbreviation of south
+            $south = _('S')
+            // TRANS: Used in coordinates as abbreviation of east
+            $east = _('E')
+            // TRANS: Used in coordinates as abbreviation of west
+            $west = _('W')
             $name = sprintf(
                 _('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'),
-                $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0?_('N'):_('S')),
-                $londms['deg'],$londms['min'], $londms['sec'],($lon>0?_('E'):_('W')));
+                $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0? $north:$south)),
+                $londms['deg'],$londms['min'], $londms['sec'],($lon>0? $east:$west));
         }
 
         $url  = $location->getUrl();
@@ -438,14 +447,18 @@ class NoticeListItem extends Widget
         $this->out->text(_('at'));
         $this->out->text(' ');
         if (empty($url)) {
-            $this->out->element('span', array('class' => 'geo',
+            $this->out->element('abbr', array('class' => 'geo',
                                               'title' => $latlon),
                                 $name);
         } else {
-            $this->out->element('a', array('class' => 'geo',
-                                           'title' => $latlon,
-                                           'href' => $url),
-                                $name);
+            $xstr = new XMLStringer(false);
+            $xstr->elementStart('a', array('href' => $url,
+                                           'rel' => 'external'));
+            $xstr->element('abbr', array('class' => 'geo',
+                                         'title' => $latlon),
+                           $name);
+            $xstr->elementEnd('a');
+            $this->out->raw($xstr->getString());
         }
         $this->out->elementEnd('span');
     }
@@ -538,24 +551,31 @@ class NoticeListItem extends Widget
 
     function showContext()
     {
-        $hasConversation = false;
-        if( !empty($this->notice->conversation)
-            && $this->notice->conversation != $this->notice->id){
-            $hasConversation = true;
-        }else{
-            $conversation = Notice::conversationStream($this->notice->id, 1, 1);
-            if($conversation->N > 0){
-                $hasConversation = true;
+        if ($this->notice->hasConversation()) {
+            $conv = Conversation::staticGet(
+                'id',
+                $this->notice->conversation
+            );
+            $convurl = $conv->uri;
+            if (!empty($convurl)) {
+                $this->out->text(' ');
+                $this->out->element(
+                    'a',
+                    array(
+                    'href' => $convurl.'#notice-'.$this->notice->id,
+                    'class' => 'response'),
+                    _('in context')
+                );
+            } else {
+                $msg = sprintf(
+                    "Couldn't find Conversation ID %d to make 'in context'"
+                    . "link for Notice ID %d",
+                    $this->notice->conversation,
+                    $this->notice->id
+                );
+                common_log(LOG_WARNING, $msg);
             }
         }
-        if ($hasConversation){
-            $this->out->text(' ');
-            $convurl = common_local_url('conversation',
-                                         array('id' => $this->notice->conversation));
-            $this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id,
-                                           'class' => 'response'),
-                                _('in context'));
-        }
     }
 
     /**