]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelist.php
nicknamize the requested nickname during autoregistration
[quix0rs-gnu-social.git] / lib / noticelist.php
index c05b990245f01acdce345b4866d94212367b9c46..28a563d875aff8c2e7ce621ba204ada667f9ee77 100644 (file)
@@ -380,12 +380,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));
@@ -438,14 +438,15 @@ 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),
+            $this->out->elementStart('a', array('href' => $url));
+            $this->out->element('abbr', array('class' => 'geo',
+                                              'title' => $latlon),
                                 $name);
+            $this->out->elementEnd('a');
         }
         $this->out->elementEnd('span');
     }
@@ -492,30 +493,34 @@ class NoticeListItem extends Widget
                 break;
              default:
 
-                $name = null;
+                $name = $source_name;
                 $url  = null;
 
-                $ns = Notice_source::staticGet($this->notice->source);
-
-                if ($ns) {
-                    $name = $ns->name;
-                    $url  = $ns->url;
-                } else {
-                    $app = Oauth_application::staticGet('name', $this->notice->source);
-                    if ($app) {
-                        $name = $app->name;
-                        $url  = $app->source_url;
+                if (Event::handle('StartNoticeSourceLink', array($this->notice, &$name, &$url, &$title))) {
+                    $ns = Notice_source::staticGet($this->notice->source);
+
+                    if ($ns) {
+                        $name = $ns->name;
+                        $url  = $ns->url;
+                    } else {
+                        $app = Oauth_application::staticGet('name', $this->notice->source);
+                        if ($app) {
+                            $name = $app->name;
+                            $url  = $app->source_url;
+                        }
                     }
                 }
+                Event::handle('EndNoticeSourceLink', array($this->notice, &$name, &$url, &$title));
 
                 if (!empty($name) && !empty($url)) {
                     $this->out->elementStart('span', 'device');
                     $this->out->element('a', array('href' => $url,
-                                                   'rel' => 'external'),
+                                                   'rel' => 'external',
+                                                   'title' => $title),
                                         $name);
                     $this->out->elementEnd('span');
                 } else {
-                    $this->out->element('span', 'device', $source_name);
+                    $this->out->element('span', 'device', $name);
                 }
                 break;
             }