-
- if(intval(get_config('system','thread_allow')) && $a->theme_thread_allow) {
- $comments_threaded = true;
- }
- else {
- $comments_threaded = false;
- }
-
- if($page_writeable) {
- $buttons = array(
- 'like' => array( t("I like this \x28toggle\x29"), t("like")),
- 'dislike' => array( t("I don't like this \x28toggle\x29"), t("dislike")),
- );
- if ($shareable) $buttons['share'] = array( t('Share this'), t('share'));
-
-
- if($show_comment_box) {
- $qc = $qcomment = null;
-
- if(in_array('qcomment',$a->plugins)) {
- $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null);
- $qcomment = (($qc) ? explode("\n",$qc) : null);
- }
- $comment = replace_macros($cmnt_tpl,array(
- '$return_path' => '',
- '$threaded' => $comments_threaded,
- '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
- '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'),
- '$id' => $item['item_id'],
- '$parent' => $item['item_id'],
- '$qcomment' => $qcomment,
- '$profile_uid' => $profile_owner,
- '$mylink' => $a->contact['url'],
- '$mytitle' => t('This is you'),
- '$myphoto' => $a->contact['thumb'],
- '$comment' => t('Comment'),
- '$submit' => t('Submit'),
- '$edbold' => t('Bold'),
- '$editalic' => t('Italic'),
- '$eduline' => t('Underline'),
- '$edquote' => t('Quote'),
- '$edcode' => t('Code'),
- '$edimg' => t('Image'),
- '$edurl' => t('Link'),
- '$edvideo' => t('Video'),
- '$preview' => t('Preview'),
- '$indent' => $indent,
- '$sourceapp' => t($a->sourcename),
- '$ww' => (($mode === 'network') ? $commentww : '')
- ));
- }
- }
-
- if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
- $indent .= ' shiny';
-
- localize_item($item);
-
- $body = prepare_body($item,true);
-
- $tmp_item = array(
- // collapse comments in template. I don't like this much...
- 'comment_firstcollapsed' => $firstcollapsed,
- 'comment_lastcollapsed' => $lastcollapsed,
- // template to use to render item (wall, walltowall, search)
- 'template' => $template,
-
- 'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
- 'tags' => $tags,
- 'body' => template_escape($body),
- 'text' => strip_tags(template_escape($body)),
- 'id' => $item['item_id'],
- 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
- 'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $owner_name, ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
- 'to' => t('to'),
- 'wall' => t('Wall-to-Wall'),
- 'vwall' => t('via Wall-To-Wall:'),
- 'profile_url' => $profile_link,
- 'item_photo_menu' => item_photo_menu($item),
- 'name' => template_escape($profile_name),
- 'thumb' => $profile_avatar,
- 'osparkle' => $osparkle,
- 'sparkle' => $sparkle,
- 'title' => template_escape($item['title']),
- 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
-
- 'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
- 'lock' => $lock,
- 'location' => template_escape($location),
- 'indent' => $indent,
- 'owner_url' => $owner_url,
- 'owner_photo' => $owner_photo,
- 'owner_name' => template_escape($owner_name),
- 'plink' => get_plink($item),
- 'edpost' => $edpost,
- 'isstarred' => $isstarred,
- 'star' => $star,
- 'filer' => $filer,
- 'drop' => $drop,
- 'vote' => $buttons,
- 'like' => $like,
- 'dislike' => $dislike,
- 'comment' => $comment,
- 'previewing' => $previewing,
- 'wait' => t('Please wait'),
- 'thread_level' => $thread_level,
- );
-
- $arr = array('item' => $item, 'output' => $tmp_item);
- call_hooks('display_item', $arr);
-
- $item_result = $arr['output'];
- if($firstcollapsed) {
- $item_result['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
- $item_result['hide_text'] = t('show more');
- }
-
- $item_result['children'] = array();
- if(count($item['children'])) {
- $item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike, $previewing, ($thread_level + 1));
- }
- $item_result['private'] = $item['private'];
- $item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
-
- /*
- * I don't like this very much...
- */
- if(get_config('system','thread_allow') && $a->theme_thread_allow) {
- $item_result['flatten'] = false;
- $item_result['threaded'] = true;
- }
- else {
- $item_result['flatten'] = true;
- $item_result['threaded'] = false;
- if(!$toplevelpost) {
- $item_result['comment'] = false;
- }
- }
-
- $result[] = $item_result;