]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/threadednoticelist.php
Leding tabs to spaces.
[quix0rs-gnu-social.git] / lib / threadednoticelist.php
index 1a20075cceb417ccd39e38865e69e7985b71789c..c5cd2d308156034005a1e90fad6a6c03165717af 100644 (file)
@@ -185,33 +185,40 @@ class ThreadedNoticeListItem extends NoticeListItem
                 $notices[] = clone($notice); // *grumble* inefficient as hell
             }
 
-            $this->out->elementStart('ul', 'notices threaded-replies xoxo');
-
-            $item = new ThreadedNoticeListFavesItem($this->notice, $this->out);
-            $hasFaves = $item->show();
-
-            $item = new ThreadedNoticeListRepeatsItem($this->notice, $this->out);
-            $hasRepeats = $item->show();
-
-            if ($notices) {
-                if ($moreCutoff) {
-                    $item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out);
-                    $item->show();
-                }
-                foreach (array_reverse($notices) as $notice) {
-                    $item = new ThreadedNoticeListSubItem($notice, $this->out);
-                    $item->show();
+            if (Event::handle('StartShowThreadedNoticeTail', array($this, $this->notice, &$notices))) {
+                $this->out->elementStart('ul', 'notices threaded-replies xoxo');
+
+                $item = new ThreadedNoticeListFavesItem($this->notice, $this->out);
+                $hasFaves = $item->show();
+
+                $item = new ThreadedNoticeListRepeatsItem($this->notice, $this->out);
+                $hasRepeats = $item->show();
+
+                if ($notices) {
+                    if ($moreCutoff) {
+                        $item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out);
+                        $item->show();
+                    }
+                    foreach (array_reverse($notices) as $notice) {
+                        if (Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice))) {
+                            $item = new ThreadedNoticeListSubItem($notice, $this->out);
+                            $item->show();
+                            Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice));
+                        }
+                    }
                 }
-            }
-            if ($notices || $hasFaves || $hasRepeats) {
-                // @fixme do a proper can-post check that's consistent
-                // with the JS side
-                if (common_current_user()) {
-                    $item = new ThreadedNoticeListReplyItem($this->notice, $this->out);
-                    $item->show();
+
+                if ($notices || $hasFaves || $hasRepeats) {
+                    // @fixme do a proper can-post check that's consistent
+                    // with the JS side
+                    if (common_current_user()) {
+                        $item = new ThreadedNoticeListReplyItem($this->notice, $this->out);
+                        $item->show();
+                    }
                 }
+                $this->out->elementEnd('ul');
+                Event::handle('EndShowThreadedNoticeTail', array($this, $this->notice, $notices));
             }
-            $this->out->elementEnd('ul');
         }
 
         parent::showEnd();
@@ -284,9 +291,8 @@ class ThreadedNoticeListMoreItem extends NoticeListItem
         $id = $this->notice->conversation;
         $url = common_local_url('conversationreplies', array('id' => $id));
 
-        $notice = new Notice();
-        $notice->conversation = $id;
-        $n = $notice->count() - 1;
+        $n = Conversation::noticeCount($id) - 1;
+
         // TRANS: Link to show replies for a notice.
         // TRANS: %d is the number of replies to a notice and used for plural.
         $msg = sprintf(_m('Show reply', 'Show all %d replies', $n), $n);
@@ -329,7 +335,7 @@ class ThreadedNoticeListReplyItem extends NoticeListItem
     function showMiniForm()
     {
         $this->out->element('input', array('class' => 'placeholder',
-                                            // TRANS: Field label for reply mini form.
+                                           // TRANS: Field label for reply mini form.
                                            'value' => _('Write a reply...')));
     }
 }
@@ -423,9 +429,7 @@ class ThreadedNoticeListFavesItem extends NoticeListActorsItem
         } else {
             // TRANS: List message for favoured notices.
             // TRANS: %d is the number of users that have favoured a notice.
-            return sprintf(_m(
-                              'FAVELIST',
-                              'One person has favored this notice.',
+            return sprintf(_m('One person has favored this notice.',
                               '%d people have favored this notice.',
                               $count),
                            $count);
@@ -483,9 +487,7 @@ class ThreadedNoticeListRepeatsItem extends NoticeListActorsItem
         } else {
             // TRANS: List message for repeated notices.
             // TRANS: %d is the number of users that have repeated a notice.
-            return sprintf(_m(
-                              'REPEATLIST',
-                              'One person has repeated this notice.',
+            return sprintf(_m('One person has repeated this notice.',
                               '%d people have repeated this notice.',
                               $count),
                            $count);