]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Share/lib/threadednoticelistrepeatsitem.php
Repeats shown in threaded noticelist now handled by plugin
[quix0rs-gnu-social.git] / plugins / Share / lib / threadednoticelistrepeatsitem.php
1 <?php
2
3 if (!defined('GNUSOCIAL')) { exit(1); }
4
5 /**
6  * Placeholder for showing repeats...
7  */
8 class ThreadedNoticeListRepeatsItem extends NoticeListActorsItem
9 {
10     function getProfiles()
11     {
12         $repeats = Notice::listGet('repeat_of', array($this->notice->getID()));
13
14         $profiles = array();
15         foreach ($repeats[$this->notice->getID()] as $rep) {
16             $profiles[] = $rep->profile_id;
17         }
18
19         return $profiles;
20     }
21
22     function magicList($items)
23     {
24         if (count($items) > 4) {
25             return parent::magicList(array_slice($items, 0, 3));
26         } else {
27             return parent::magicList($items);
28         }
29     }
30
31     function getListMessage($count, $you)
32     {
33         if ($count == 1 && $you) {
34             // darn first person being different from third person!
35             // TRANS: List message for notice repeated by logged in user.
36             return _m('REPEATLIST', 'You repeated this.');
37         } else if ($count > 4) {
38             // TRANS: List message for when more than 4 people repeat something.
39             // TRANS: %%s is a list of users liking a notice, %d is the number over 4 that like the notice.
40             // TRANS: Plural is decided on the total number of users liking the notice (count of %%s + %d).
41             return sprintf(_m('%%s and %d other repeated this.',
42                               '%%s and %d others repeated this.',
43                               $count - 3),
44                            $count - 3);
45         } else {
46             // TRANS: List message for repeated notices.
47             // TRANS: %%s is a list of users who have repeated a notice.
48             // TRANS: Plural is based on the number of of users that have repeated a notice.
49             return sprintf(_m('%%s repeated this.',
50                               '%%s repeated this.',
51                               $count),
52                            $count);
53         }
54     }
55
56     function showStart()
57     {
58         $this->out->elementStart('li', array('class' => 'notice-data notice-repeats'));
59     }
60
61     function showEnd()
62     {
63         $this->out->elementEnd('li');
64     }
65 }