]> git.mxchange.org Git - friendica.git/blob - include/conversation.php
multi-user, do not cache open mbox
[friendica.git] / include / conversation.php
1 <?php
2
3 /**
4  * "Render" a conversation or list of items for HTML display.
5  * There are two major forms of display:
6  *      - Sequential or unthreaded ("New Item View" or search results)
7  *      - conversation view
8  * The $mode parameter decides between the various renderings and also
9  * figures out how to determine page owner and other contextual items 
10  * that are based on unique features of the calling module.
11  *
12  */
13
14 function conversation(&$a, $items, $mode, $update) {
15
16         require_once('bbcode.php');
17
18         $profile_owner = 0;
19         $page_writeable      = false;
20
21         if($mode === 'network') {
22                 $profile_owner = local_user();
23                 $page_writeable = true;
24         }
25
26         if($mode === 'profile') {
27                 $profile_owner = $a->profile['profile_uid'];
28                 $page_writeable = can_write_wall($a,$profile_owner);
29         }
30
31         if($mode === 'display') {
32                 $profile_owner = $a->profile['uid'];
33                 $page_writeable = can_write_wall($a,$profile_owner);
34         }
35
36         if($update)
37                 $return_url = $_SESSION['return_url'];
38         else
39                 $return_url = $_SESSION['return_url'] = $a->cmd;
40
41
42         // find all the authors involved in remote conversations
43         // We will use a local profile photo if they are one of our contacts
44         // otherwise we have to get the photo from the item owner's site
45
46         $author_contacts = extract_item_authors($items,local_user());
47
48
49         $cmnt_tpl    = load_view_file('view/comment_item.tpl');
50         $like_tpl    = load_view_file('view/like.tpl');
51         $noshare_tpl = load_view_file('view/like_noshare.tpl');
52         $tpl         = load_view_file('view/wall_item.tpl');
53         $wallwall    = load_view_file('view/wallwall_item.tpl');
54
55         $alike = array();
56         $dlike = array();
57         
58         if(count($items)) {
59
60                 if($mode === 'network-new' || $mode === 'search') {
61
62                         // "New Item View" on network page or search page results 
63                         // - just loop through the items and format them minimally for display
64
65                         $tpl = load_view_file('view/search_item.tpl');
66                         $droptpl = load_view_file('view/wall_fake_drop.tpl');
67
68                         foreach($items as $item) {
69
70                                 $comment     = '';
71                                 $owner_url   = '';
72                                 $owner_photo = '';
73                                 $owner_name  = '';
74                                 $sparkle     = '';
75
76                                 if($mode === 'search') {
77                                         if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) 
78                                                 && ($item['id'] != $item['parent']))
79                                                 continue;
80                                         $nickname = $item['nickname'];
81                                 }
82                                 else
83                                         $nickname = $a->user['nickname'];
84                         
85                                 $profile_name   = ((strlen($item['author-name']))   ? $item['author-name']   : $item['name']);
86                                 $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
87                                 $profile_link   = ((strlen($item['author-link']))   ? $item['author-link']   : $item['url']);
88                                 if($profile_link === 'mailbox')
89                                         $profile_link = '';
90
91                                 $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
92
93                                 if(strlen($item['author-link'])) {
94                                         if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
95                                                 $profile_link = $redirect_url;
96                                                 $sparkle = ' sparkle';
97                                         }
98                                         elseif(isset($author_contacts[$item['author-link']])) {
99                                                 $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
100                                                 $sparkle = ' sparkle';
101                                         }
102                                 }
103
104                                 $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
105                                 $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
106                                 if($coord) {
107                                         if($location)
108                                                 $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
109                                         else
110                                                 $location = '<span class="smalltext">' . $coord . '</span>';
111                                 }
112
113                                 $drop = '';
114                                 $dropping = false;
115
116                                 if((intval($item['contact-id']) && $item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
117                                         $dropping = true;
118
119                     $drop = replace_macros((($dropping)? $droptpl : $fakedrop), array('$id' => $item['id'], '$delete' => t('Delete')));
120
121
122
123                                 $drop = replace_macros($droptpl,array('$id' => $item['id']));
124                                 $lock = '<div class="wall-item-lock"></div>';
125                                 
126                                 $o .= replace_macros($tpl,array(
127                                         '$id' => $item['item_id'],
128                                         '$linktitle' => sprintf( t('View %s\'s profile'), $profile_name),
129                                         '$profile_url' => $profile_link,
130                                         '$item_photo_menu' => item_photo_menu($item),
131                                         '$name' => $profile_name,
132                                         '$sparkle' => $sparkle,
133                                         '$lock' => $lock,
134                                         '$thumb' => $profile_avatar,
135                                         '$title' => $item['title'],
136                                         '$body' => smilies(bbcode($item['body'])),
137                                         '$ago' => relative_date($item['created']),
138                                         '$location' => $location,
139                                         '$indent' => '',
140                                         '$owner_url' => $owner_url,
141                                         '$owner_photo' => $owner_photo,
142                                         '$owner_name' => $owner_name,
143                                         '$drop' => $drop,
144                                         '$conv' => '<a href="' . $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'] . '">' . t('View in context') . '</a>'
145                                 ));
146
147                         }
148
149                         return $o;
150                 }
151
152
153
154
155                 // Normal View
156
157
158                 // Figure out how many comments each parent has
159                 // (Comments all have gravity of 6)
160                 // Store the result in the $comments array
161
162                 $comments = array();
163                 foreach($items as $item) {
164                         if(intval($item['gravity']) == 6) {
165                                 if(! x($comments,$item['parent']))
166                                         $comments[$item['parent']] = 1;
167                                 else
168                                         $comments[$item['parent']] += 1;
169                         }
170                 }
171
172                 // map all the like/dislike activities for each parent item 
173                 // Store these in the $alike and $dlike arrays
174
175                 foreach($items as $item) {
176                         like_puller($a,$item,$alike,'like');
177                         like_puller($a,$item,$dlike,'dislike');
178                 }
179
180                 $comments_collapsed = false;
181                 $blowhard = 0;
182                 $blowhard_count = 0;
183
184                 foreach($items as $item) {
185
186                         $comment = '';
187                         $template = $tpl;
188                         $commentww = '';
189                         $sparkle = '';
190                         $owner_url = $owner_photo = $owner_name = '';
191
192                         // We've already parsed out like/dislike for special treatment. We can ignore them now
193
194                         if(((activity_match($item['verb'],ACTIVITY_LIKE)) 
195                                 || (activity_match($item['verb'],ACTIVITY_DISLIKE))) 
196                                 && ($item['id'] != $item['parent']))
197                                 continue;
198
199                         $toplevelpost = (($item['id'] == $item['parent']) ? true : false);
200
201
202                         // Take care of author collapsing and comment collapsing
203                         // If a single author has more than 3 consecutive top-level posts, squash the remaining ones.
204                         // If there are more than two comments, squash all but the last 2.
205
206                         if($toplevelpost) {
207
208                                 $item_writeable = (($item['writable'] || $item['self']) ? true : false);
209
210                                 if($blowhard == $item['cid'] && (! $item['self']) && ($mode != 'profile')) {
211                                         $blowhard_count ++;
212                                         if($blowhard_count == 3) {
213                                                 $o .= '<div class="icollapse-wrapper fakelink" id="icollapse-wrapper-' . $item['parent'] 
214                                                         . '" onclick="openClose(' . '\'icollapse-' . $item['parent'] . '\');" >' 
215                                                         . t('See more posts like this') . '</div>' . '<div class="icollapse" id="icollapse-' 
216                                                         . $item['parent'] . '" style="display: none;" >';
217                                         }
218                                 }
219                                 else {
220                                         $blowhard = $item['cid'];                                       
221                                         if($blowhard_count >= 3)
222                                                 $o .= '</div>';
223                                         $blowhard_count = 0;
224                                 }
225
226                                 $comments_seen = 0;
227                                 $comments_collapsed = false;
228                         }
229                         else
230                                 $comments_seen ++;
231
232
233                         $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
234
235                         if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
236                                 if(! $comments_collapsed) {
237                                         $o .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent'] 
238                                                 . '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\');" >' 
239                                                 . sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>'
240                                                 . '<div class="ccollapse" id="ccollapse-' . $item['parent'] . '" style="display: none;" >';
241                                         $comments_collapsed = true;
242                                 }
243                         }
244                         if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) {
245                                 $o .= '</div>';
246                         }
247
248                         $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
249
250                         $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
251                                 || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
252                                 ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
253                                 : '<div class="wall-item-lock"></div>');
254
255
256                         // Top-level wall post not written by the wall owner (wall-to-wall)
257                         // First figure out who owns it. 
258
259                         $osparkle = '';
260
261                         if(($toplevelpost) && (! $item['self']) && ($mode !== 'profile')) {
262
263                                 if($item['type'] === 'wall') {
264
265                                         // On the network page, I am the owner. On the display page it will be the profile owner.
266                                         // This will have been stored in $a->page_contact by our calling page.
267                                         // Put this person on the left of the wall-to-wall notice.
268
269                                         $owner_url = $a->page_contact['url'];
270                                         $owner_photo = $a->page_contact['thumb'];
271                                         $owner_name = $a->page_contact['name'];
272                                         $template = $wallwall;
273                                         $commentww = 'ww';      
274                                 }
275                                 if(($item['type'] === 'remote') && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) {
276
277                                         // Could be anybody. 
278
279                                         $owner_url = $item['owner-link'];
280                                         $owner_photo = $item['owner-avatar'];
281                                         $owner_name = $item['owner-name'];
282                                         $template = $wallwall;
283                                         $commentww = 'ww';
284                                         // If it is our contact, use a friendly redirect link
285                                         if((link_compare($item['owner-link'],$item['url'])) 
286                                                 && ($item['network'] === 'dfrn')) {
287                                                 $owner_url = $redirect_url;
288                                                 $osparkle = ' sparkle';
289                                         }
290                                 }
291                         }
292
293
294                         $likebuttons = '';
295
296                         if($page_writeable) {
297                                 if($toplevelpost) {
298                                         $likebuttons = replace_macros((($item['private']) ? $noshare_tpl : $like_tpl),array(
299                                                 '$id' => $item['id'],
300                                                 '$likethis' => t("I like this \x28toggle\x29"),
301                                                 '$nolike' => t("I don't like this \x28toggle\x29"),
302                                                 '$share' => t('Share'),
303                                                 '$wait' => t('Please wait') 
304                                         ));
305                                 }
306
307                                 if(($show_comment_box) || (($show_comment_box == false) && ($item['last-child']))) {
308                                         $comment = replace_macros($cmnt_tpl,array(
309                                                 '$return_path' => '', 
310                                                 '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
311                                                 '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'),
312                                                 '$id' => $item['item_id'],
313                                                 '$parent' => $item['parent'],
314                                                 '$profile_uid' =>  $profile_owner,
315                                                 '$mylink' => $a->contact['url'],
316                                                 '$mytitle' => t('This is you'),
317                                                 '$myphoto' => $a->contact['thumb'],
318                                                 '$comment' => t('Comment'),
319                                                 '$submit' => t('Submit'),
320                                                 '$ww' => (($mode === 'network') ? $commentww : '')
321                                         ));
322                                 }
323                         }
324
325                         $edpost = ((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1))
326                                         ? '<a class="editpost" href="' . $a->get_baseurl() . '/editpost/' . $item['id'] 
327                                                 . '" title="' . t('Edit') . '"><img src="images/pencil.gif" /></a>'
328                                         : '');
329                         $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
330
331                         $photo = $item['photo'];
332                         $thumb = $item['thumb'];
333
334                         // Post was remotely authored.
335
336                         $diff_author    = ((link_compare($item['url'],$item['author-link'])) ? false : true);
337
338                         $profile_name   = (((strlen($item['author-name']))   && $diff_author) ? $item['author-name']   : $item['name']);
339                         $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
340
341                         if($mode === 'profile') {
342                                 if(local_user() && ($item['contact-uid'] == local_user()) && ($item['network'] === 'dfrn') && (! $item['self'] )) {
343                         $profile_link = $redirect_url;
344                     $sparkle = ' sparkle';
345                     }
346                                 else {
347                                         $profile_link = $item['url'];
348                                         $sparkle = '';
349                                 }
350                         }
351                         elseif(strlen($item['author-link'])) {
352                                 $profile_link = $item['author-link'];
353                                 if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
354                                         $profile_link = $redirect_url;
355                                         $sparkle = ' sparkle';
356                                 }
357                                 elseif(isset($author_contacts[$item['author-link']])) {
358                                         $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
359                                         $sparkle = ' sparkle';
360                                 }
361                         }
362                         else 
363                                 $profile_link = $item['url'];
364
365                         if($profile_link === 'mailbox')
366                                 $profile_link = '';
367
368                         $like    = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
369                         $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
370
371                         $location = (($item['location']) ? '<a target="map" title="' . $item['location'] 
372                                 . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
373                         $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] 
374                                 . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
375                         if($coord) {
376                                 if($location)
377                                         $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
378                                 else
379                                         $location = '<span class="smalltext">' . $coord . '</span>';
380                         }
381
382                         $indent = (($toplevelpost) ? '' : ' comment');
383
384                         if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
385                                 $indent .= ' shiny'; 
386
387                         // Build the HTML
388
389                         $tmp_item = replace_macros($template,array(
390                                 '$id' => $item['item_id'],
391                                 '$linktitle' => sprintf( t('View %s\'s profile'), $profile_name),
392                                 '$olinktitle' => sprintf( t('View %s\'s profile'), $owner_name),
393                                 '$to' => t('to'),
394                                 '$wall' => t('Wall-to-Wall'),
395                                 '$vwall' => t('via Wall-To-Wall:'),
396                                 '$profile_url' => $profile_link,
397                                 '$item_photo_menu' => item_photo_menu($item),
398                                 '$name' => $profile_name,
399                                 '$thumb' => $profile_avatar,
400                                 '$osparkle' => $osparkle,
401                                 '$sparkle' => $sparkle,
402                                 '$title' => $item['title'],
403                                 '$body' => smilies(bbcode($item['body'])),
404                                 '$ago' => relative_date($item['created']),
405                                 '$lock' => $lock,
406                                 '$location' => $location,
407                                 '$indent' => $indent,
408                                 '$owner_url' => $owner_url,
409                                 '$owner_photo' => $owner_photo,
410                                 '$owner_name' => $owner_name,
411                                 '$plink' => get_plink($item),
412                                 '$edpost' => $edpost,
413                                 '$drop' => $drop,
414                                 '$vote' => $likebuttons,
415                                 '$like' => $like,
416                                 '$dislike' => $dislike,
417                                 '$comment' => $comment
418                         ));
419
420                         $arr = array('item' => $item, 'output' => $tmp_item);
421                         call_hooks('display_item', $arr);
422
423                         $o .= $arr['output'];
424
425                 }
426         }
427
428
429         // if author collapsing is in force but didn't get closed, close it off now.
430
431         if($blowhard_count >= 3)
432                 $o .= '</div>';
433
434         return $o;
435
436
437
438
439
440 if(! function_exists('extract_item_authors')) {
441 function extract_item_authors($arr,$uid) {
442
443         if((! $uid) || (! is_array($arr)) || (! count($arr)))
444                 return array();
445         $urls = array();
446         foreach($arr as $rr) {
447                 if(! in_array("'" . dbesc($rr['author-link']) . "'",$urls))
448                         $urls[] = "'" . dbesc($rr['author-link']) . "'";
449         }
450
451         // pre-quoted, don't put quotes on %s
452         if(count($urls)) {
453                 $r = q("SELECT `id`,`network`,`url` FROM `contact` WHERE `uid` = %d AND `url` IN ( %s )  AND `self` = 0 AND `blocked` = 0 ",
454                         intval($uid),
455                         implode(',',$urls)
456                 );
457                 if(count($r)) {
458                         $ret = array();
459                         $authors = array();
460                         foreach($r as $rr){
461                                 if ($rr['network']=='dfrn')
462                                         $ret[$rr['url']] = $rr['id'];
463                                 $authors[$r['url']]= $rr;
464                         }
465                         $a->authors = $authors;
466                         return $ret;
467                 }
468         }
469         return array();         
470 }}
471
472 if(! function_exists('item_photo_menu')){
473 function item_photo_menu($item){
474         $a = get_app();
475         
476         if (!isset($a->authors)){
477                 $rr = q("SELECT `id`, `network`, `url` FROM `contact` WHERE `uid`=%d AND `self`=0 AND `blocked`=0 ", intval(local_user()));
478                 $authors = array();
479                 foreach($rr as $r) $authors[$r['url']]= $r;
480                 $a->authors = $authors;
481         }
482         
483         $contact_url="";
484         $pm_url="";
485
486         $status_link="";
487         $photo_link="";
488         $profile_link   = ((strlen($item['author-link']))   ? $item['author-link'] : $item['url']);
489         $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
490
491         if($profile_link === 'mailbox')
492                 $profile_link = '';
493
494         // $item['contact-uid'] is only set on profile page and indicates the uid of the user who owns the profile.
495
496         $profile_owner = ((x($item,'contact-uid')) && intval($item['contact-uid']) ? intval($item['contact-uid']) : 0); 
497
498         // So we are checking that this is a logged in user on some page that *isn't* a profile page
499         // OR a profile page where the viewer owns the profile. 
500         // Then check if we can use a sparkle (redirect) link to the profile by virtue of it being our contact
501         // or a friend's contact that we both have a connection to. 
502
503         if((local_user() && ($profile_owner == 0)) 
504                 || ($profile_owner && $profile_owner == local_user())) {
505
506                 if(strlen($item['author-link']) && link_compare($item['author-link'],$item['url'])) {
507                         $redir = $redirect_url;
508                         $cid = $item['cid'];
509                 }
510                 elseif(isset($a->authors[$item['author-link']])) {
511                         $redir = $a->get_baseurl() . '/redir/' . $a->authors[$item['author-link']]['id'];
512                         $cid = $a->authors[$item['author-link']]['id'];
513                 }
514                 if($item['author-link'] === 'mailbox')
515                         $cid = $item['cid'];
516
517                 if((isset($cid)) && (! $item['self'])) {
518                         $contact_url = $a->get_baseurl() . '/contacts/' . $cid;
519                         if($item['network'] === 'dfrn') {
520                                 $status_link = $redir . "?url=status";
521                                 $profile_link = $redir . "?url=profile";
522                                 $photos_link = $redir . "?url=photos";
523                                 $pm_url = $a->get_baseurl() . '/message/new/' . $cid;
524                         }
525                 }
526         }
527
528
529         $menu = Array(
530                 t("View status") => $status_link,
531                 t("View profile") => $profile_link,
532                 t("View photos") => $photos_link,               
533                 t("Edit contact") => $contact_url,
534                 t("Send PM") => $pm_url,
535         );
536         
537         
538         $args = array($item, &$menu);
539         
540         call_hooks('item_photo_menu', $args);
541         
542         $o = "";
543         foreach($menu as $k=>$v){
544                 if ($v!="") $o .= "<li><a href='$v'>$k</a></li>\n";
545         }
546         return $o;
547 }}
548
549 if(! function_exists('like_puller')) {
550 function like_puller($a,$item,&$arr,$mode) {
551
552         $url = '';
553         $sparkle = '';
554         $verb = (($mode === 'like') ? ACTIVITY_LIKE : ACTIVITY_DISLIKE);
555
556         if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
557                 $url = $item['author-link'];
558                 if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
559                         $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
560                         $sparkle = ' class="sparkle" ';
561                 }
562                 if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
563                         $arr[$item['parent'] . '-l'] = array();
564                 if(! isset($arr[$item['parent']]))
565                         $arr[$item['parent']] = 1;
566                 else    
567                         $arr[$item['parent']] ++;
568                 $arr[$item['parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
569         }
570         return;
571 }}
572
573 // Format the like/dislike text for a profile item
574 // $cnt = number of people who like/dislike the item
575 // $arr = array of pre-linked names of likers/dislikers
576 // $type = one of 'like, 'dislike'
577 // $id  = item id
578 // returns formatted text
579
580 if(! function_exists('format_like')) {
581 function format_like($cnt,$arr,$type,$id) {
582         $o = '';
583         if($cnt == 1)
584                 $o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ;
585         else {
586                 $spanatts = 'class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');"';
587                 $o .= (($type === 'like') ? 
588                                         sprintf( t('<span  %1$s>%2$d people</span> like this.'), $spanatts, $cnt)
589                                          : 
590                                         sprintf( t('<span  %1$s>%2$d people</span> don\'t like this.'), $spanatts, $cnt) ); 
591                 $o .= EOL ;
592                 $total = count($arr);
593                 if($total >= MAX_LIKERS)
594                         $arr = array_slice($arr, 0, MAX_LIKERS - 1);
595                 if($total < MAX_LIKERS)
596                         $arr[count($arr)-1] = t('and') . ' ' . $arr[count($arr)-1];
597                 $str = implode(', ', $arr);
598                 if($total >= MAX_LIKERS)
599                         $str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS );
600                 $str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str));
601                 $o .= "\t" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
602         }
603         return $o;
604 }}