3 * @file include/conversation.php
6 use Friendica\Core\Config;
7 use Friendica\Core\Conversation;
8 use Friendica\Core\Item;
9 use Friendica\Core\PConfig;
10 use Friendica\Core\System;
11 use Friendica\Database\DBM;
13 require_once "include/bbcode.php";
14 require_once "include/acl_selectors.php";
17 * Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
18 * is identical to the code in mod/message.php for 'item_extract_images' and
19 * 'item_redir_and_replace_images'
21 if (! function_exists('item_extract_images')) {
22 function item_extract_images($body) {
24 $saved_image = array();
29 $img_start = strpos($orig_body, '[img');
30 $img_st_close = ($img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false);
31 $img_end = ($img_start !== false ? strpos(substr($orig_body, $img_start), '[/img]') : false);
32 while (($img_st_close !== false) && ($img_end !== false)) {
34 $img_st_close++; // make it point to AFTER the closing bracket
35 $img_end += $img_start;
37 if (! strcmp(substr($orig_body, $img_start + $img_st_close, 5), 'data:')) {
38 // This is an embedded image
40 $saved_image[$cnt] = substr($orig_body, $img_start + $img_st_close, $img_end - ($img_start + $img_st_close));
41 $new_body = $new_body . substr($orig_body, 0, $img_start) . '[!#saved_image' . $cnt . '#!]';
45 $new_body = $new_body . substr($orig_body, 0, $img_end + strlen('[/img]'));
48 $orig_body = substr($orig_body, $img_end + strlen('[/img]'));
50 if ($orig_body === false) {
51 // in case the body ends on a closing image tag
55 $img_start = strpos($orig_body, '[img');
56 $img_st_close = ($img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false);
57 $img_end = ($img_start !== false ? strpos(substr($orig_body, $img_start), '[/img]') : false);
60 $new_body = $new_body . $orig_body;
62 return array('body' => $new_body, 'images' => $saved_image);
65 if (! function_exists('item_redir_and_replace_images')) {
66 function item_redir_and_replace_images($body, $images, $cid) {
72 $pos = get_bb_tag_pos($origbody, 'url', 1);
73 while ($pos !== false && $cnt < 1000) {
75 $search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is';
76 $replace = '[url=' . System::baseUrl() . '/redir/' . $cid
77 . '?f=1&url=' . '$1' . '][!#saved_image' . '$2' .'#!][/url]';
79 $newbody .= substr($origbody, 0, $pos['start']['open']);
80 $subject = substr($origbody, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']);
81 $origbody = substr($origbody, $pos['end']['close']);
82 if ($origbody === false) {
86 $subject = preg_replace($search, $replace, $subject);
90 $pos = get_bb_tag_pos($origbody, 'url', 1);
92 $newbody .= $origbody;
95 foreach ($images as $image) {
97 * We're depending on the property of 'foreach' (specified on the PHP website) that
98 * it loops over the array starting from the first element and going sequentially
99 * to the last element.
101 $newbody = str_replace('[!#saved_image' . $cnt . '#!]', '[img]' . $image . '[/img]', $newbody);
108 * Render actions localized
110 function localize_item(&$item) {
112 $extracted = item_extract_images($item['body']);
113 if ($extracted['images']) {
114 $item['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $item['contact-id']);
118 $xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
119 if (activity_match($item['verb'], ACTIVITY_LIKE)
120 || activity_match($item['verb'], ACTIVITY_DISLIKE)
121 || activity_match($item['verb'], ACTIVITY_ATTEND)
122 || activity_match($item['verb'], ACTIVITY_ATTENDNO)
123 || activity_match($item['verb'], ACTIVITY_ATTENDMAYBE)) {
125 /// @TODO may hurt performance
126 $r = q("SELECT * FROM `item`, `contact`
127 WHERE `item`.`contact-id`=`contact`.`id`
128 AND `item`.`uri`='%s'",
129 dbesc($item['parent-uri']));
130 if (!DBM::is_result($r)) {
135 $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
136 $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
138 switch ($obj['verb']) {
140 switch ($obj['object-type']) {
141 case ACTIVITY_OBJ_EVENT:
142 $post_type = t('event');
145 $post_type = t('status');
149 if ($obj['resource-id']) {
150 $post_type = t('photo');
152 preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
153 $rr['plink'] = $m[1];
155 $post_type = t('status');
159 $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
161 if (activity_match($item['verb'], ACTIVITY_LIKE)) {
162 $bodyverb = t('%1$s likes %2$s\'s %3$s');
164 elseif (activity_match($item['verb'], ACTIVITY_DISLIKE)) {
165 $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
167 elseif (activity_match($item['verb'], ACTIVITY_ATTEND)) {
168 $bodyverb = t('%1$s attends %2$s\'s %3$s');
170 elseif (activity_match($item['verb'], ACTIVITY_ATTENDNO)) {
171 $bodyverb = t('%1$s doesn\'t attend %2$s\'s %3$s');
173 elseif (activity_match($item['verb'], ACTIVITY_ATTENDMAYBE)) {
174 $bodyverb = t('%1$s attends maybe %2$s\'s %3$s');
176 $item['body'] = sprintf($bodyverb, $author, $objauthor, $plink);
179 if (activity_match($item['verb'], ACTIVITY_FRIEND)) {
181 if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return;
183 $Aname = $item['author-name'];
184 $Alink = $item['author-link'];
186 $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
188 $obj = parse_xml_string($xmlhead.$item['object']);
189 $links = parse_xml_string($xmlhead."<links>".unxmlify($obj->link)."</links>");
191 $Bname = $obj->title;
192 $Blink = ""; $Bphoto = "";
193 foreach ($links->link as $l) {
194 $atts = $l->attributes();
195 switch ($atts['rel']) {
196 case "alternate": $Blink = $atts['href'];
197 case "photo": $Bphoto = $atts['href'];
201 $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
202 $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
204 $Bphoto = '[url=' . zrl($Blink) . '][img]' . $Bphoto . '[/img][/url]';
207 $item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
210 if (stristr($item['verb'], ACTIVITY_POKE)) {
211 $verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
215 if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) {
219 $Aname = $item['author-name'];
220 $Alink = $item['author-link'];
222 $xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
224 $obj = parse_xml_string($xmlhead.$item['object']);
225 $links = parse_xml_string($xmlhead."<links>".unxmlify($obj->link)."</links>");
227 $Bname = $obj->title;
230 foreach ($links->link as $l) {
231 $atts = $l->attributes();
232 switch ($atts['rel']) {
233 case "alternate": $Blink = $atts['href'];
234 case "photo": $Bphoto = $atts['href'];
238 $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
239 $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
241 $Bphoto = '[url=' . zrl($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]';
245 * we can't have a translation string with three positions but no distinguishable text
246 * So here is the translate string.
248 $txt = t('%1$s poked %2$s');
250 // now translate the verb
251 $poked_t = trim(sprintf($txt, "", ""));
252 $txt = str_replace( $poked_t, t($verb), $txt);
254 // then do the sprintf on the translation string
256 $item['body'] = sprintf($txt, $A, $B). "\n\n\n" . $Bphoto;
259 if (stristr($item['verb'], ACTIVITY_MOOD)) {
260 $verb = urldecode(substr($item['verb'], strpos($item['verb'], '#') + 1));
265 $Aname = $item['author-name'];
266 $Alink = $item['author-link'];
267 $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
269 $txt = t('%1$s is currently %2$s');
271 $item['body'] = sprintf($txt, $A, t($verb));
274 if (activity_match($item['verb'], ACTIVITY_TAG)) {
275 /// @TODO may hurt performance "joining" two tables + asterisk
276 $r = q("SELECT * FROM `item`, `contact`
277 WHERE `item`.`contact-id`=`contact`.`id`
278 AND `item`.`uri`='%s'",
279 dbesc($item['parent-uri']));
281 if (!DBM::is_result($r)) {
287 $author = '[url=' . zrl($item['author-link']) . ']' . $item['author-name'] . '[/url]';
288 $objauthor = '[url=' . zrl($obj['author-link']) . ']' . $obj['author-name'] . '[/url]';
290 switch ($obj['verb']) {
292 switch ($obj['object-type']) {
293 case ACTIVITY_OBJ_EVENT:
294 $post_type = t('event');
297 $post_type = t('status');
301 if ($obj['resource-id']) {
302 $post_type = t('photo');
303 $m=array(); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
304 $rr['plink'] = $m[1];
306 $post_type = t('status');
308 // Let's break everthing ... ;-)
311 $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
313 $parsedobj = parse_xml_string($xmlhead.$item['object']);
315 $tag = sprintf('#[url=%s]%s[/url]', $parsedobj->id, $parsedobj->content);
316 $item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag );
319 if (activity_match($item['verb'], ACTIVITY_FAVORITE)) {
321 if ($item['object-type'] == "") {
325 $Aname = $item['author-name'];
326 $Alink = $item['author-link'];
328 $xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
330 $obj = parse_xml_string($xmlhead.$item['object']);
331 if (strlen($obj->id)) {
332 $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
337 if (DBM::is_result($r) && $r[0]['plink']) {
339 $Bname = $target['author-name'];
340 $Blink = $target['author-link'];
341 $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
342 $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
343 $P = '[url=' . $target['plink'] . ']' . t('post/item') . '[/url]';
344 $item['body'] = sprintf( t('%1$s marked %2$s\'s %3$s as favorite'), $A, $B, $P)."\n";
349 if (preg_match_all('/@\[url=(.*?)\]/is', $item['body'], $matches, PREG_SET_ORDER)) {
350 foreach ($matches as $mtch) {
351 if (! strpos($mtch[1], 'zrl=')) {
352 $item['body'] = str_replace($mtch[0], '@[url=' . zrl($mtch[1]) . ']', $item['body']);
357 // add zrl's to public images
358 $photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is";
359 if (preg_match($photo_pattern, $item['body'])) {
360 $photo_replace = '[url=' . zrl('$1' . '/photos/' . '$2' . '/image/' . '$3' ,true) . '][img' . '$4' . ']h' . '$5' . '[/img][/url]';
361 $item['body'] = bb_tag_preg_replace($photo_pattern, $photo_replace, 'url', $item['body']);
364 // add sparkle links to appropriate permalinks
366 $x = stristr($item['plink'],'/display/');
369 $y = best_link_url($item, $sparkle);
371 if (strstr($y, '/redir/')) {
372 $item['plink'] = $y . '?f=&url=' . $item['plink'];
378 * Count the total of comments on this item and its desendants
379 * @TODO proper type-hint + doc-tag
381 function count_descendants($item) {
382 $total = count($item['children']);
385 foreach ($item['children'] as $child) {
386 if (! visible_activity($child)) {
389 $total += count_descendants($child);
396 function visible_activity($item) {
399 * likes (etc.) can apply to other things besides posts. Check if they are post children,
400 * in which case we handle them specially
402 $hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
403 foreach ($hidden_activities as $act) {
404 if (activity_match($item['verb'], $act)) {
409 if (activity_match($item['verb'], ACTIVITY_FOLLOW) && $item['object-type'] === ACTIVITY_OBJ_NOTE) {
410 if (! (($item['self']) && ($item['uid'] == local_user()))) {
419 * @brief SQL query for items
421 function item_query() {
422 return "SELECT " . item_fieldlists() . " FROM `item` " .
423 item_joins() . " WHERE " . item_condition();
427 * @brief List of all data fields that are needed for displaying items
429 function item_fieldlists() {
432 These Fields are not added below (yet). They are here to for bug search.
437 `item`.`target-type`,
439 `item`.`resource-id`,
453 `item`.`gcontact-id`,
457 return "`item`.`author-id`, `item`.`author-link`, `item`.`author-name`, `item`.`author-avatar`,
458 `item`.`owner-id`, `item`.`owner-link`, `item`.`owner-name`, `item`.`owner-avatar`,
459 `item`.`contact-id`, `item`.`uid`, `item`.`id`, `item`.`parent`,
460 `item`.`uri`, `item`.`thr-parent`, `item`.`parent-uri`,
461 `item`.`commented`, `item`.`created`, `item`.`edited`, `item`.`received`,
462 `item`.`verb`, `item`.`object-type`, `item`.`postopts`, `item`.`plink`,
463 `item`.`guid`, `item`.`wall`, `item`.`private`, `item`.`starred`,
464 `item`.`title`, `item`.`body`, `item`.`file`, `item`.`event-id`,
465 `item`.`location`, `item`.`coord`, `item`.`app`, `item`.`attach`,
466 `item`.`rendered-hash`, `item`.`rendered-html`, `item`.`object`,
467 `item`.`allow_cid`, `item`.`allow_gid`, `item`.`deny_cid`, `item`.`deny_gid`,
468 `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
470 `author`.`thumb` AS `author-thumb`, `owner`.`thumb` AS `owner-thumb`,
472 `contact`.`network`, `contact`.`url`, `contact`.`name`, `contact`.`writable`,
473 `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`alias`,
475 `event`.`created` AS `event-created`, `event`.`edited` AS `event-edited`,
476 `event`.`start` AS `event-start`,`event`.`finish` AS `event-finish`,
477 `event`.`summary` AS `event-summary`,`event`.`desc` AS `event-desc`,
478 `event`.`location` AS `event-location`, `event`.`type` AS `event-type`,
479 `event`.`nofinish` AS `event-nofinish`,`event`.`adjust` AS `event-adjust`,
480 `event`.`ignore` AS `event-ignore`, `event`.`id` AS `event-id`";
484 * @brief SQL join for contacts that are needed for displaying items
486 function item_joins() {
487 return "STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND
488 (NOT `contact`.`blocked` OR `contact`.`pending`)
489 LEFT JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
490 LEFT JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id`
491 LEFT JOIN `event` ON `event-id` = `event`.`id`";
495 * @brief SQL condition for items that are needed for displaying items
497 function item_condition() {
498 return "`item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`";
501 if (!function_exists('conversation')) {
503 * "Render" a conversation or list of items for HTML display.
504 * There are two major forms of display:
505 * - Sequential or unthreaded ("New Item View" or search results)
506 * - conversation view
507 * The $mode parameter decides between the various renderings and also
508 * figures out how to determine page owner and other contextual items
509 * that are based on unique features of the calling module.
512 function conversation(App $a, $items, $mode, $update, $preview = false) {
514 require_once 'include/bbcode.php';
515 require_once 'include/Contact.php';
516 require_once 'mod/proxy.php';
518 $ssl_state = ((local_user()) ? true : false);
521 $page_writeable = false;
522 $live_update_div = '';
527 $str_blocked = PConfig::get(local_user(), 'system', 'blocked');
529 $arr_blocked = explode(',', $str_blocked);
530 for ($x = 0; $x < count($arr_blocked); $x ++) {
531 $arr_blocked[$x] = trim($arr_blocked[$x]);
537 $previewing = (($preview) ? ' preview ' : '');
539 if ($mode === 'network') {
540 $profile_owner = local_user();
541 $page_writeable = true;
544 * The special div is needed for liveUpdate to kick in for this page.
545 * We only launch liveUpdate if you aren't filtering in some incompatible
546 * way and also you aren't writing a comment (discovered in javascript).
548 $live_update_div = '<div id="live-network"></div>' . "\r\n"
549 . "<script> var profile_uid = " . $_SESSION['uid']
550 . "; var netargs = '" . substr($a->cmd, 8)
552 . ((x($_GET, 'cid')) ? '&cid=' . $_GET['cid'] : '')
553 . ((x($_GET, 'search')) ? '&search=' . $_GET['search'] : '')
554 . ((x($_GET, 'star')) ? '&star=' . $_GET['star'] : '')
555 . ((x($_GET, 'order')) ? '&order=' . $_GET['order'] : '')
556 . ((x($_GET, 'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
557 . ((x($_GET, 'liked')) ? '&liked=' . $_GET['liked'] : '')
558 . ((x($_GET, 'conv')) ? '&conv=' . $_GET['conv'] : '')
559 . ((x($_GET, 'spam')) ? '&spam=' . $_GET['spam'] : '')
560 . ((x($_GET, 'nets')) ? '&nets=' . $_GET['nets'] : '')
561 . ((x($_GET, 'cmin')) ? '&cmin=' . $_GET['cmin'] : '')
562 . ((x($_GET, 'cmax')) ? '&cmax=' . $_GET['cmax'] : '')
563 . ((x($_GET, 'file')) ? '&file=' . $_GET['file'] : '')
565 . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
567 } elseif ($mode === 'profile') {
568 $profile_owner = $a->profile['profile_uid'];
569 $page_writeable = can_write_wall($a,$profile_owner);
572 $tab = notags(trim($_GET['tab']));
573 $tab = ( $tab ? $tab : 'posts' );
574 if ($tab === 'posts') {
576 * This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
577 * because browser prefetching might change it on us. We have to deliver it with the page.
580 $live_update_div = '<div id="live-profile"></div>' . "\r\n"
581 . "<script> var profile_uid = " . $a->profile['profile_uid']
582 . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
585 } elseif ($mode === 'notes') {
586 $profile_owner = local_user();
587 $page_writeable = true;
589 $live_update_div = '<div id="live-notes"></div>' . "\r\n"
590 . "<script> var profile_uid = " . local_user()
591 . "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
593 } elseif ($mode === 'display') {
594 $profile_owner = $a->profile['uid'];
595 $page_writeable = can_write_wall($a,$profile_owner);
597 $live_update_div = '<div id="live-display"></div>' . "\r\n"
598 . "<script> var profile_uid = " . $_SESSION['uid'] . ";"
599 . " var profile_page = 1; </script>";
601 } elseif ($mode === 'community') {
603 $page_writeable = false;
605 $live_update_div = '<div id="live-community"></div>' . "\r\n"
606 . "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
608 } elseif ($mode === 'search') {
609 $live_update_div = '<div id="live-search"></div>' . "\r\n";
612 $page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false);
616 $return_url = $_SESSION['return_url'];
618 $return_url = $_SESSION['return_url'] = $a->query_string;
621 $cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
622 call_hooks('conversation_start',$cb);
624 $items = $cb['items'];
626 $cmnt_tpl = get_markup_template('comment_item.tpl');
627 $hide_comments_tpl = get_markup_template('hide_comments.tpl');
629 $conv_responses = array(
630 'like' => array('title' => t('Likes','title')), 'dislike' => array('title' => t('Dislikes','title')),
631 'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title'))
634 // array with html for each thread (parent+comments)
638 $page_template = get_markup_template("conversation.tpl");
640 if ($items && count($items)) {
642 if ($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
645 * "New Item View" on network page or search page results
646 * - just loop through the items and format them minimally for display
649 /// @TODO old lost code?
650 // $tpl = get_markup_template('search_item.tpl');
651 $tpl = 'search_item.tpl';
653 foreach ($items as $item) {
657 foreach ($arr_blocked as $b) {
658 if ($b && link_compare($item['author-link'], $b)) {
676 if ($mode === 'search' || $mode === 'community') {
677 if (((activity_match($item['verb'], ACTIVITY_LIKE)) || (activity_match($item['verb'], ACTIVITY_DISLIKE)))
678 && ($item['id'] != $item['parent']))
680 $nickname = $item['nickname'];
682 $nickname = $a->user['nickname'];
685 // prevent private email from leaking.
686 if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
690 $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
691 if ($item['author-link'] && (! $item['author-name'])) {
692 $profile_name = $item['author-link'];
699 $searchpath = System::baseUrl()."/search?tag=";
701 $taglist = dba::select('term', array('type', 'term', 'url'),
702 array("`otype` = ? AND `oid` = ? AND `type` IN (?, ?)", TERM_OBJ_POST, $item['id'], TERM_HASHTAG, TERM_MENTION),
703 array('order' => array('tid')));
705 while ($tag = dba::fetch($taglist)) {
706 if ($tag["url"] == "") {
707 $tag["url"] = $searchpath . strtolower($tag["term"]);
710 $tag["url"] = best_link_url($item, $sp, $tag["url"]);
712 if ($tag["type"] == TERM_HASHTAG) {
713 $hashtags[] = "#<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
715 } elseif ($tag["type"] == TERM_MENTION) {
716 $mentions[] = "@<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
719 $tags[] = $prefix."<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
721 dba::close($taglist);
724 $profile_link = best_link_url($item, $sp);
725 if ($profile_link === 'mailbox') {
730 $sparkle = ' sparkle';
732 $profile_link = zrl($profile_link);
735 if (!x($item, 'author-thumb') || ($item['author-thumb'] == "")) {
736 $author_contact = get_contact_details_by_url($item['author-link'], $profile_owner);
737 if ($author_contact["thumb"]) {
738 $item['author-thumb'] = $author_contact["thumb"];
740 $item['author-thumb'] = $item['author-avatar'];
744 if (!isset($item['owner-thumb']) || ($item['owner-thumb'] == "")) {
745 $owner_contact = get_contact_details_by_url($item['owner-link'], $profile_owner);
746 if ($owner_contact["thumb"]) {
747 $item['owner-thumb'] = $owner_contact["thumb"];
749 $item['owner-thumb'] = $item['owner-avatar'];
753 $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
754 call_hooks('render_location',$locate);
756 $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));
758 localize_item($item);
759 if ($mode === 'network-new') {
766 'dropping' => $dropping,
767 'pagedrop' => $page_dropping,
768 'select' => t('Select'),
769 'delete' => t('Delete'),
773 $isstarred = "unstarred";
776 $likebuttons = false;
779 $body = prepare_body($item, true, $preview);
781 list($categories, $folders) = get_cats_and_terms($item);
783 if ($a->theme['template_engine'] === 'internal') {
784 $profile_name_e = template_escape($profile_name);
785 $item['title_e'] = template_escape($item['title']);
786 $body_e = template_escape($body);
787 $tags_e = template_escape($tags);
788 $hashtags_e = template_escape($hashtags);
789 $mentions_e = template_escape($mentions);
790 $location_e = template_escape($location);
791 $owner_name_e = template_escape($owner_name);
793 $profile_name_e = $profile_name;
794 $item['title_e'] = $item['title'];
797 $hashtags_e = $hashtags;
798 $mentions_e = $mentions;
799 $location_e = $location;
800 $owner_name_e = $owner_name;
803 if ($item['item_network'] == "") {
804 $item['item_network'] = $item['network'];
809 'id' => (($preview) ? 'P0' : $item['item_id']),
810 'guid' => (($preview) ? 'Q0' : $item['guid']),
811 'network' => $item['item_network'],
812 'network_name' => network_to_name($item['item_network'], $profile_link),
813 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
814 'profile_url' => $profile_link,
815 'item_photo_menu' => item_photo_menu($item),
816 'name' => $profile_name_e,
817 'sparkle' => $sparkle,
819 'thumb' => System::removedBaseUrl(proxy_url($item['author-thumb'], false, PROXY_SIZE_THUMB)),
820 'title' => $item['title_e'],
823 'hashtags' => $hashtags_e,
824 'mentions' => $mentions_e,
825 'txt_cats' => t('Categories:'),
826 'txt_folders' => t('Filed under:'),
827 'has_cats' => ((count($categories)) ? 'true' : ''),
828 'has_folders' => ((count($folders)) ? 'true' : ''),
829 'categories' => $categories,
830 'folders' => $folders,
831 'text' => strip_tags($body_e),
832 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
833 'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
834 'location' => $location_e,
836 'owner_name' => $owner_name_e,
837 'owner_url' => $owner_url,
838 'owner_photo' => System::removedBaseUrl(proxy_url($item['owner-thumb'], false, PROXY_SIZE_THUMB)),
839 'plink' => get_plink($item),
841 'isstarred' => $isstarred,
844 'vote' => $likebuttons,
848 //'conv' => (($preview) ? '' : array('href'=> 'display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
849 'conv' => (($preview) ? '' : array('href'=> 'display/'.$item['guid'], 'title'=> t('View in context'))),
850 'previewing' => $previewing,
851 'wait' => t('Please wait'),
855 $arr = array('item' => $item, 'output' => $tmp_item);
856 call_hooks('display_item', $arr);
858 $threads[$threadsid]['id'] = $item['item_id'];
859 $threads[$threadsid]['network'] = $item['item_network'];
860 $threads[$threadsid]['items'] = array($arr['output']);
865 $page_template = get_markup_template("threaded_conversation.tpl");
867 $conv = new Conversation($mode, $preview);
870 * get all the topmost parents
871 * this shouldn't be needed, as we should have only them in our array
872 * But for now, this array respects the old style, just in case
875 foreach ($items as $item) {
879 foreach ($arr_blocked as $b) {
880 if ($b && link_compare($item['author-link'], $b)) {
890 // Can we put this after the visibility check?
891 builtin_activity_puller($item, $conv_responses);
893 // Only add what is visible
894 if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
898 if (! visible_activity($item)) {
902 call_hooks('display_item', $arr);
904 $item['pagedrop'] = $page_dropping;
906 if ($item['id'] == $item['parent']) {
907 $item_object = new Item($item);
908 $conv->add_thread($item_object);
912 $threads = $conv->get_template_data($conv_responses);
915 logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
921 $o = replace_macros($page_template, array(
922 '$baseurl' => System::baseUrl($ssl_state),
923 '$return_path' => $a->query_string,
924 '$live_update' => $live_update_div,
925 '$remove' => t('remove'),
928 '$threads' => $threads,
929 '$dropping' => ($page_dropping && feature_enabled(local_user(), 'multi_delete') ? t('Delete Selected Items') : False),
935 function best_link_url($item, &$sparkle, $url = '') {
940 $clean_url = normalise_link($item['author-link']);
943 $r = dba::select('contact', array('id'),
944 array('network' => NETWORK_DFRN, 'uid' => local_user(), 'nurl' => normalise_link($clean_url), 'pending' => false),
945 array('limit' => 1));
946 if (DBM::is_result($r)) {
947 $best_url = 'redir/' . $r['id'];
950 $hostname = get_app()->get_hostname();
951 if (!strstr($url, $hostname)) {
952 $best_url .= "?url=".$url;
962 } elseif (strlen($item['author-link'])) {
963 $best_url = $item['author-link'];
965 $best_url = $item['url'];
973 function item_photo_menu($item) {
983 if ((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id'] && (! $item['self'])) {
984 $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
988 $profile_link = best_link_url($item, $sparkle);
989 if ($profile_link === 'mailbox') {
996 $r = dba::select('contact', array('id', 'network', 'rel'), array('uid' => local_user(), 'nurl' => normalise_link($item['author-link'])), array('limit' => 1));
997 if (DBM::is_result($r)) {
999 $network = $r['network'];
1004 $status_link = $profile_link . '?url=status';
1005 $photos_link = $profile_link . '?url=photos';
1006 $profile_link = $profile_link . '?url=profile';
1009 $profile_link = zrl($profile_link);
1012 if ($cid && !$item['self']) {
1013 $poke_link = 'poke/?f=&c=' . $cid;
1014 $contact_url = 'contacts/' . $cid;
1015 $posts_link = 'contacts/' . $cid . '/posts';
1017 if (in_array($network, array(NETWORK_DFRN, NETWORK_DIASPORA))) {
1018 $pm_url = 'message/new/' . $cid;
1024 t('Follow Thread') => $sub_link,
1025 t('View Status') => $status_link,
1026 t('View Profile') => $profile_link,
1027 t('View Photos') => $photos_link,
1028 t('Network Posts') => $posts_link,
1029 t('View Contact') => $contact_url,
1030 t('Send PM') => $pm_url
1033 if ($network == NETWORK_DFRN) {
1034 $menu[t("Poke")] = $poke_link;
1037 if ((($cid == 0) || ($rel == CONTACT_IS_FOLLOWER)) &&
1038 in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
1039 $menu[t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
1042 $menu = array(t('View Profile') => $item['author-link']);
1045 $args = array('item' => $item, 'menu' => $menu);
1047 call_hooks('item_photo_menu', $args);
1049 $menu = $args['menu'];
1052 foreach ($menu as $k => $v) {
1053 if (strpos($v, 'javascript:') === 0) {
1054 $v = substr($v, 11);
1055 $o .= '<li role="menuitem"><a onclick="' . $v . '">' . $k . '</a></li>' . PHP_EOL;
1057 $o .= '<li role="menuitem"><a href="' . $v . '">' . $k . '</a></li>' . PHP_EOL;
1063 if (! function_exists('builtin_activity_puller')) {
1065 * @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
1066 * Increments the count of each matching activity and adds a link to the author as needed.
1068 * @param array $item
1069 * @param array &$conv_responses (already created with builtin activity structure)
1072 function builtin_activity_puller($item, &$conv_responses) {
1073 foreach ($conv_responses as $mode => $v) {
1079 $verb = ACTIVITY_LIKE;
1082 $verb = ACTIVITY_DISLIKE;
1085 $verb = ACTIVITY_ATTEND;
1088 $verb = ACTIVITY_ATTENDNO;
1091 $verb = ACTIVITY_ATTENDMAYBE;
1098 if ((activity_match($item['verb'], $verb)) && ($item['id'] != $item['parent'])) {
1099 $url = $item['author-link'];
1100 if ((local_user()) && (local_user() == $item['uid']) && ($item['network'] === NETWORK_DFRN) && (! $item['self']) && (link_compare($item['author-link'], $item['url']))) {
1101 $url = 'redir/' . $item['contact-id'];
1102 $sparkle = ' class="sparkle" ';
1107 $url = '<a href="'. $url . '"'. $sparkle .'>' . htmlentities($item['author-name']) . '</a>';
1109 if (! $item['thr-parent']) {
1110 $item['thr-parent'] = $item['parent-uri'];
1113 if (! ((isset($conv_responses[$mode][$item['thr-parent'] . '-l']))
1114 && (is_array($conv_responses[$mode][$item['thr-parent'] . '-l'])))) {
1115 $conv_responses[$mode][$item['thr-parent'] . '-l'] = array();
1118 // only list each unique author once
1119 if (in_array($url,$conv_responses[$mode][$item['thr-parent'] . '-l'])) {
1123 if (! isset($conv_responses[$mode][$item['thr-parent']])) {
1124 $conv_responses[$mode][$item['thr-parent']] = 1;
1126 $conv_responses[$mode][$item['thr-parent']] ++;
1129 if (public_contact() == $item['author-id']) {
1130 $conv_responses[$mode][$item['thr-parent'] . '-self'] = 1;
1133 $conv_responses[$mode][$item['thr-parent'] . '-l'][] = $url;
1135 // there can only be one activity verb per item so if we found anything, we can stop looking
1141 if (! function_exists('format_like')) {
1143 * Format the vote text for a profile item
1144 * @param int $cnt = number of people who vote the item
1145 * @param array $arr = array of pre-linked names of likers/dislikers
1146 * @param string $type = one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe'
1147 * @param int $id = item id
1148 * @return formatted text
1150 function format_like($cnt, array $arr, $type, $id) {
1157 // Phrase if there is only one liker. In other cases it will be uses for the expanded
1158 // list which show all likers
1161 $phrase = sprintf( t('%s likes this.'), $likers);
1164 $phrase = sprintf( t('%s doesn\'t like this.'), $likers);
1167 $phrase = sprintf( t('%s attends.'), $likers);
1170 $phrase = sprintf( t('%s doesn\'t attend.'), $likers);
1172 case 'attendmaybe' :
1173 $phrase = sprintf( t('%s attends maybe.'), $likers);
1179 $total = count($arr);
1180 if ($total >= MAX_LIKERS) {
1181 $arr = array_slice($arr, 0, MAX_LIKERS - 1);
1183 if ($total < MAX_LIKERS) {
1184 $last = t('and') . ' ' . $arr[count($arr)-1];
1185 $arr2 = array_slice($arr, 0, -1);
1186 $str = implode(', ', $arr2) . ' ' . $last;
1188 if ($total >= MAX_LIKERS) {
1189 $str = implode(', ', $arr);
1190 $str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS );
1195 $spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
1199 $phrase = sprintf( t('<span %1$s>%2$d people</span> like this'), $spanatts, $cnt);
1200 $explikers = sprintf( t('%s like this.'), $likers);
1203 $phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t like this'), $spanatts, $cnt);
1204 $explikers = sprintf( t('%s don\'t like this.'), $likers);
1207 $phrase = sprintf( t('<span %1$s>%2$d people</span> attend'), $spanatts, $cnt);
1208 $explikers = sprintf( t('%s attend.'), $likers);
1211 $phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t attend'), $spanatts, $cnt);
1212 $explikers = sprintf( t('%s don\'t attend.'), $likers);
1215 $phrase = sprintf( t('<span %1$s>%2$d people</span> attend maybe'), $spanatts, $cnt);
1216 $explikers = sprintf( t('%s anttend maybe.'), $likers);
1220 $expanded .= "\t" . '<div class="wall-item-' . $type . '-expanded" id="' . $type . 'list-' . $id . '" style="display: none;" >' . $explikers . EOL . '</div>';
1224 $o .= replace_macros(get_markup_template('voting_fakelink.tpl'), array(
1225 '$phrase' => $phrase,
1234 function status_editor(App $a, $x, $notes_cid = 0, $popup = false) {
1237 $geotag = (x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
1239 $tpl = get_markup_template('jot-header.tpl');
1240 $a->page['htmlhead'] .= replace_macros($tpl, array(
1241 '$newpost' => 'true',
1242 '$baseurl' => System::baseUrl(true),
1243 '$geotag' => $geotag,
1244 '$nickname' => $x['nickname'],
1245 '$ispublic' => t('Visible to <strong>everybody</strong>'),
1246 '$linkurl' => t('Please enter a link URL:'),
1247 '$vidurl' => t("Please enter a video link/URL:"),
1248 '$audurl' => t("Please enter an audio link/URL:"),
1249 '$term' => t('Tag term:'),
1250 '$fileas' => t('Save to Folder:'),
1251 '$whereareu' => t('Where are you right now?'),
1252 '$delitems' => t('Delete item(s)?')
1255 $tpl = get_markup_template('jot-end.tpl');
1256 $a->page['end'] .= replace_macros($tpl, array(
1257 '$newpost' => 'true',
1258 '$baseurl' => System::baseUrl(true),
1259 '$geotag' => $geotag,
1260 '$nickname' => $x['nickname'],
1261 '$ispublic' => t('Visible to <strong>everybody</strong>'),
1262 '$linkurl' => t('Please enter a link URL:'),
1263 '$vidurl' => t("Please enter a video link/URL:"),
1264 '$audurl' => t("Please enter an audio link/URL:"),
1265 '$term' => t('Tag term:'),
1266 '$fileas' => t('Save to Folder:'),
1267 '$whereareu' => t('Where are you right now?')
1271 call_hooks('jot_tool', $jotplugins);
1273 // Private/public post links for the non-JS ACL form
1275 if (x($_REQUEST, 'public')) {
1279 $query_str = $a->query_string;
1280 if (strpos($query_str, 'public=1') !== false) {
1281 $query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str);
1285 * I think $a->query_string may never have ? in it, but I could be wrong
1286 * It looks like it's from the index.php?q=[etc] rewrite that the web
1287 * server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61
1289 if (strpos($query_str, '?') === false) {
1290 $public_post_link = '?public=1';
1292 $public_post_link = '&public=1';
1295 // $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
1296 $tpl = get_markup_template("jot.tpl");
1298 $o .= replace_macros($tpl,array(
1299 '$return_path' => $query_str,
1300 '$action' => 'item',
1301 '$share' => (x($x,'button') ? $x['button'] : t('Share')),
1302 '$upload' => t('Upload photo'),
1303 '$shortupload' => t('upload photo'),
1304 '$attach' => t('Attach file'),
1305 '$shortattach' => t('attach file'),
1306 '$weblink' => t('Insert web link'),
1307 '$shortweblink' => t('web link'),
1308 '$video' => t('Insert video link'),
1309 '$shortvideo' => t('video link'),
1310 '$audio' => t('Insert audio link'),
1311 '$shortaudio' => t('audio link'),
1312 '$setloc' => t('Set your location'),
1313 '$shortsetloc' => t('set location'),
1314 '$noloc' => t('Clear browser location'),
1315 '$shortnoloc' => t('clear location'),
1316 '$title' => $x['title'],
1317 '$placeholdertitle' => t('Set title'),
1318 '$category' => $x['category'],
1319 '$placeholdercategory' => (feature_enabled(local_user(), 'categories') ? t('Categories (comma-separated list)') : ''),
1320 '$wait' => t('Please wait'),
1321 '$permset' => t('Permission settings'),
1322 '$shortpermset' => t('permissions'),
1323 '$ptyp' => (($notes_cid) ? 'note' : 'wall'),
1324 '$content' => $x['content'],
1325 '$post_id' => $x['post_id'],
1326 '$baseurl' => System::baseUrl(true),
1327 '$defloc' => $x['default_location'],
1328 '$visitor' => $x['visitor'],
1329 '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),
1330 '$public' => t('Public post'),
1331 '$jotnets' => $jotnets,
1332 '$lockstate' => $x['lockstate'],
1333 '$bang' => $x['bang'],
1334 '$profile_uid' => $x['profile_uid'],
1335 '$preview' => ((feature_enabled($x['profile_uid'],'preview')) ? t('Preview') : ''),
1336 '$jotplugins' => $jotplugins,
1337 '$notes_cid' => $notes_cid,
1338 '$sourceapp' => t($a->sourcename),
1339 '$cancel' => t('Cancel'),
1340 '$rand_num' => random_digits(12),
1342 // ACL permissions box
1343 '$acl' => $x['acl'],
1344 '$acl_data' => $x['acl_data'],
1345 '$group_perms' => t('Post to Groups'),
1346 '$contact_perms' => t('Post to Contacts'),
1347 '$private' => t('Private post'),
1348 '$is_private' => $private_post,
1349 '$public_link' => $public_post_link,
1351 //jot nav tab (used in some themes)
1352 '$message' => t('Message'),
1353 '$browser' => t('Browser'),
1357 if ($popup == true) {
1358 $o = '<div id="jot-popup" style="display: none;">'.$o.'</div>';
1365 function get_item_children($arr, $parent) {
1366 $children = array();
1368 foreach ($arr as $item) {
1369 if ($item['id'] != $item['parent']) {
1370 if (Config::get('system', 'thread_allow') && $a->theme_thread_allow) {
1371 // Fallback to parent-uri if thr-parent is not set
1372 $thr_parent = $item['thr-parent'];
1373 if ($thr_parent == '') {
1374 $thr_parent = $item['parent-uri'];
1377 if ($thr_parent == $parent['uri']) {
1378 $item['children'] = get_item_children($arr, $item);
1379 $children[] = $item;
1381 } elseif ($item['parent'] == $parent['id']) {
1382 $children[] = $item;
1389 /// @TODO Add type-hint
1390 function sort_item_children($items) {
1392 usort($result, 'sort_thr_created_rev');
1393 foreach ($result as $k => $i) {
1394 if (count($result[$k]['children'])) {
1395 $result[$k]['children'] = sort_item_children($result[$k]['children']);
1401 /// @TODO Add type-hint
1402 function add_children_to_list($children, &$arr) {
1403 foreach ($children as $y) {
1405 if (count($y['children'])) {
1406 add_children_to_list($y['children'], $arr);
1411 /// @TODO Add type-hint
1412 function conv_sort($arr, $order) {
1414 if ((!(is_array($arr) && count($arr)))) {
1419 $children = array();
1423 * This is a preparation for having two different items with the same uri in one thread
1424 * This will otherwise lead to an endless loop.
1426 foreach ($arr as $x) {
1427 if (!isset($newarr[$x['uri']])) {
1428 $newarr[$x['uri']] = $x;
1434 foreach ($arr as $x) {
1435 if ($x['id'] == $x['parent']) {
1440 if (stristr($order, 'created')) {
1441 usort($parents, 'sort_thr_created');
1442 } elseif (stristr($order, 'commented')) {
1443 usort($parents, 'sort_thr_commented');
1446 if (count($parents)) {
1447 foreach ($parents as $i => $_x) {
1448 $parents[$i]['children'] = get_item_children($arr, $_x);
1452 /// @TODO Old-lost code?
1453 /*foreach ($arr as $x) {
1454 if ($x['id'] != $x['parent']) {
1455 $p = find_thread_parent_index($parents,$x);
1457 $parents[$p]['children'][] = $x;
1460 if (count($parents)) {
1461 foreach ($parents as $k => $v) {
1462 if (count($parents[$k]['children'])) {
1463 $parents[$k]['children'] = sort_item_children($parents[$k]['children']);
1464 /// @TODO Old-lost code?
1465 /*$y = $parents[$k]['children'];
1466 usort($y,'sort_thr_created_rev');
1467 $parents[$k]['children'] = $y;*/
1473 if (count($parents)) {
1474 foreach ($parents as $x) {
1476 if (count($x['children'])) {
1477 add_children_to_list($x['children'], $ret);
1478 /// @TODO Old-lost code?
1479 /*foreach ($x['children'] as $y)
1488 /// @TODO Add type-hint
1489 function sort_thr_created($a, $b) {
1490 return strcmp($b['created'], $a['created']);
1493 /// @TODO Add type-hint
1494 function sort_thr_created_rev($a, $b) {
1495 return strcmp($a['created'], $b['created']);
1498 /// @TODO Add type-hint
1499 function sort_thr_commented($a, $b) {
1500 return strcmp($b['commented'], $a['commented']);
1503 /// @TODO Add type-hint
1504 function find_thread_parent_index($arr, $x) {
1505 foreach ($arr as $k => $v) {
1506 if ($v['id'] == $x['parent']) {
1513 /// @TODO Add type-hint
1514 function render_location_dummy($item) {
1515 if ($item['location'] != "") {
1516 return $item['location'];
1519 if ($item['coord'] != "") {
1520 return $item['coord'];
1524 /// @TODO Add type-hint
1525 function get_responses($conv_responses, $response_verbs, $ob, $item) {
1527 foreach ($response_verbs as $v) {
1529 $ret[$v]['count'] = ((x($conv_responses[$v], $item['uri'])) ? $conv_responses[$v][$item['uri']] : '');
1530 $ret[$v]['list'] = ((x($conv_responses[$v], $item['uri'])) ? $conv_responses[$v][$item['uri'] . '-l'] : '');
1531 $ret[$v]['self'] = ((x($conv_responses[$v], $item['uri'])) ? $conv_responses[$v][$item['uri'] . '-self'] : '0');
1532 if (count($ret[$v]['list']) > MAX_LIKERS) {
1533 $ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
1534 array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-'
1535 . (($ob) ? $ob->getId() : $item['id']) . '"><b>' . t('View all') . '</b></a>');
1537 $ret[$v]['list_part'] = '';
1539 $ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count']);
1540 $ret[$v]['title'] = $conv_responses[$v]['title'];
1544 foreach ($ret as $key) {
1545 if ($key['count'] == true) {
1549 $ret['count'] = $count;
1554 function get_response_button_text($v, $count) {
1557 return tt('Like', 'Likes', $count, 'noun');
1560 return tt('Dislike', 'Dislikes', $count, 'noun');
1563 return tt('Attending', 'Attending', $count, 'noun');
1566 return tt('Not Attending', 'Not Attending', $count, 'noun');
1569 return tt('Undecided', 'Undecided', $count, 'noun');