X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=fae57c5655a76352c0835204ca95961508ba6400;hb=bef8f95ef3e638cb843810ed68cd9617e6e2cc48;hp=9ac251e4607385d9030fe993d39926e155f98d87;hpb=ef8b5bc682b9d5b856f1d5b5ef3202ea95ed1780;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index 9ac251e460..fae57c5655 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -172,6 +172,7 @@ function conversation(&$a, $items, $mode, $update) { $cmnt_tpl = get_markup_template('comment_item.tpl'); $tpl = get_markup_template('wall_item.tpl'); $wallwall = get_markup_template('wallwall_item.tpl'); + $hide_comments_tpl = get_markup_template('hide_comments.tpl'); $alike = array(); $dlike = array(); @@ -207,8 +208,11 @@ function conversation(&$a, $items, $mode, $update) { } else $nickname = $a->user['nickname']; + $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']); + if($item['author-link'] && (! $item['author-name'])) + $profile_name = $item['author-link']; $sp = false; $profile_link = best_link_url($item,$sp); @@ -290,7 +294,8 @@ function conversation(&$a, $items, $mode, $update) { $arr = array('item' => $item, 'output' => $tmp_item); call_hooks('display_item', $arr); - $threads[$threadsid] .= $arr['output']; + $threads[$threadsid]['id'] = $item['item_id']; + $threads[$threadsid]['html'] .= $arr['output']; } @@ -373,7 +378,9 @@ function conversation(&$a, $items, $mode, $update) { $comments_collapsed = false; $threadsid++; - $threads[$threadsid] = ""; + $threads[$threadsid]['id'] = $item['item_id']; + $threads[$threadsid]['html'] = ""; + } else { // prevent private email from leaking into public conversation @@ -385,17 +392,25 @@ function conversation(&$a, $items, $mode, $update) { $override_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false); $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false); + if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) { if(! $comments_collapsed) { - $threads[$threadsid] .= '' - . ' in the hide_comments template + // is supplied below in code. + + $threads[$threadsid]['html'] .= replace_macros($hide_comments_tpl,array( + '$id' => $item['parent'], + '$num_comments' => sprintf( tt('%d comment','%d comments',$comments[$item['parent']]), + $comments[$item['parent']]), + '$display' => 'none', + '$hide_text' => t('show more') + )); $comments_collapsed = true; } } if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) { - $threads[$threadsid] .= ''; + $threads[$threadsid]['html'] .= ''; } $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; @@ -518,6 +533,10 @@ function conversation(&$a, $items, $mode, $update) { $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); + if($item['author-link'] && (! $item['author-name'])) + $profile_name = $item['author-link']; + + $sp = false; $profile_link = best_link_url($item,$sp); if($sp) @@ -612,17 +631,12 @@ function conversation(&$a, $items, $mode, $update) { $arr = array('item' => $item, 'output' => $tmp_item); call_hooks('display_item', $arr); - $threads[$threadsid] .= $arr['output']; + $threads[$threadsid]['html'] .= $arr['output']; } } } - // if author collapsing is in force but didn't get closed, close it off now. - - /*if($blowhard_count >= 3) - $threads[$threadsid] .= '';*/ - $page_template = get_markup_template("conversation.tpl"); $o .= replace_macros($page_template, array( '$threads' => $threads,