threadednoticelistrepeatsitem.php 2.1 KB

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