]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelist.php
Merge branch '0.9.x' into twitstream
[quix0rs-gnu-social.git] / lib / noticelist.php
index 17adf3a49cdef86043c0c44b3970b9ed9143ecbc..df1533980a6ea32194bade727dc69fe74210c156 100644 (file)
@@ -226,24 +226,31 @@ class NoticeListItem extends Widget
     function showNoticeInfo()
     {
         $this->out->elementStart('div', 'entry-content');
-        $this->showNoticeLink();
-        $this->showNoticeSource();
-        $this->showNoticeLocation();
-        $this->showContext();
-        $this->showRepeat();
+        if (Event::handle('StartShowNoticeInfo', array($this))) {
+            $this->showNoticeLink();
+            $this->showNoticeSource();
+            $this->showNoticeLocation();
+            $this->showContext();
+            $this->showRepeat();
+            Event::handle('EndShowNoticeInfo', array($this));
+        }
+
         $this->out->elementEnd('div');
     }
 
     function showNoticeOptions()
     {
-        $user = common_current_user();
-        if ($user) {
-            $this->out->elementStart('div', 'notice-options');
-            $this->showFaveForm();
-            $this->showReplyLink();
-            $this->showRepeatForm();
-            $this->showDeleteLink();
-            $this->out->elementEnd('div');
+        if (Event::handle('StartShowNoticeOptions', array($this))) {
+            $user = common_current_user();
+            if ($user) {
+                $this->out->elementStart('div', 'notice-options');
+                $this->showFaveForm();
+                $this->showReplyLink();
+                $this->showRepeatForm();
+                $this->showDeleteLink();
+                $this->out->elementEnd('div');
+            }
+            Event::handle('EndShowNoticeOptions', array($this));
         }
     }
 
@@ -270,15 +277,18 @@ class NoticeListItem extends Widget
 
     function showFaveForm()
     {
-        $user = common_current_user();
-        if ($user) {
-            if ($user->hasFave($this->notice)) {
-                $disfavor = new DisfavorForm($this->out, $this->notice);
-                $disfavor->show();
-            } else {
-                $favor = new FavorForm($this->out, $this->notice);
-                $favor->show();
+        if (Event::handle('StartShowFaveForm', array($this))) {
+            $user = common_current_user();
+            if ($user) {
+                if ($user->hasFave($this->notice)) {
+                    $disfavor = new DisfavorForm($this->out, $this->notice);
+                    $disfavor->show();
+                } else {
+                    $favor = new FavorForm($this->out, $this->notice);
+                    $favor->show();
+                }
             }
+            Event::handle('EndShowFaveForm', array($this));
         }
     }
 
@@ -499,9 +509,10 @@ class NoticeListItem extends Widget
         $ns = $this->notice->getSource();
 
         if ($ns) {
-            $source_name = _($ns->code);
+            $source_name = (empty($ns->name)) ? ($ns->code ? _($ns->code) : _('web')) : _($ns->name);
             $this->out->text(' ');
             $this->out->elementStart('span', 'source');
+            // FIXME: probably i18n issue. If "from" is followed by text, that should be a parameter to "from" (from %s).
             $this->out->text(_('from'));
             $this->out->text(' ');