/** * Task title */ function task_title_link($Item) { global $current_User; $col = ''; $Item->get_Blog(); if ($Item->Blog->allowcomments != 'never') { // The current blog can have comments: $nb_comments = generic_ctp_number($Item->ID, 'feedback'); $col .= '<a href="?ctrl=items&blog=' . $Item->blog_ID . '&p=' . $Item->ID . '" title="' . sprintf(T_('%d feedbacks'), $nb_comments) . '" class="">'; if ($nb_comments) { $col .= get_icon('comments'); } else { $col .= get_icon('nocomment'); } $col .= '</a> '; } $col .= '<a href="?ctrl=items&blog=' . $Item->blog_ID . '&p=' . $Item->ID . '" class="" title="' . T_('Edit this task...') . '">' . $Item->dget('title') . '</a></strong>'; return $col; }
/** * @deprecated deprecated by {@link Item::feedback_link()} */ function trackback_number($zero = '#', $one = '#', $more = '#', $post_ID = NULL) { if ($zero == '#') { $zero = T_('Trackback (0)'); } if ($one == '#') { $one = T_('Trackback (1)'); } if ($more == '#') { $more = T_('Trackbacks (%d)'); } if (empty($post_ID)) { global $id; $post_ID = $id; } $number = generic_ctp_number($post_ID, 'trackbacks'); if ($number == 0) { $blah = $zero; } elseif ($number == 1) { $blah = $one; } elseif ($number > 1) { $n = $number; $more = str_replace('%d', $n, $more); $blah = $more; } echo $blah; }
// Filter list: $CommentList->set_filters(array('types' => array('comment', 'trackback', 'pingback'), 'statuses' => $statuses, 'order' => 'ASC', 'post_ID' => $Item->ID, 'comments' => 20, 'expiry_statuses' => $expiry_statuses)); $CommentList->query(); // We do not want to comment actions use new redirect param('save_context', 'boolean', false); param('redirect_to', 'url', url_add_param($admin_url, 'ctrl=items&blog=' . $blog . '&p=' . $Item->ID, '&'), false, true); param('item_id', 'integer', $Item->ID); param('currentpage', 'integer', 1); param('show_comments', 'string', $show_comments, false, true); // display status filter ?> <div class="bFeedback"> <a id="comments"></a> <h4> <?php echo T_('Comments'), ', ', T_('Trackbacks'), ', ', T_('Pingbacks') . ' (' . generic_ctp_number($Item->ID, 'feedbacks', 'total') . ')'; $opentrash_link = get_opentrash_link(); $refresh_link = '<span class="floatright">' . action_icon(T_('Refresh comment list'), 'refresh', 'javascript:startRefreshComments(' . $Item->ID . ')') . '</span> '; echo $refresh_link . $opentrash_link; ?> :</h4> <?php if ($display_params['disp_rating_summary']) { // Display a ratings summary echo '<h3>' . $Item->get_feedback_title('comments', '#', '#', '#', 'total') . '</h3>'; echo $Item->get_rating_summary(); echo '<br />'; } ?> <div class="tile"><label><?php echo T_('Show') . ':';
/** * wp.getCommentCount * * @see http://codex.wordpress.org/XML-RPC_wp#wp.getCommentCount * * @param xmlrpcmsg XML-RPC Message * 0 blogid (int): Unique identifier of the blog. * 1 username (string): User login. * 2 password (string): Password for said username. * 3 post_id (int): The id of the post */ function wp_getcommentcount($m) { // CHECK LOGIN: /** * @var User */ if (!($current_User =& xmlrpcs_login($m, 1, 2))) { // Login failed, return (last) error: return xmlrpcs_resperror(); } // GET BLOG: /** * @var Blog */ if (!($Blog =& xmlrpcs_get_Blog($m, 0))) { // Login failed, return (last) error: return xmlrpcs_resperror(); } $approved = $awaiting = $spam = $total = 0; if ($Blog->get_setting('allow_comments') != 'never') { $item_ID = $m->getParam(3); $item_ID = $item_ID->scalarval(); $approved = generic_ctp_number($item_ID, 'feedbacks'); $awaiting = generic_ctp_number($item_ID, 'feedbacks', 'draft'); $spam = generic_ctp_number($item_ID, 'feedbacks', 'deprecated'); $total = generic_ctp_number($item_ID, 'feedbacks', 'total'); } // Maybe we should do a check_perm here? $data = array('approved' => new xmlrpcval($approved, 'int'), 'awaiting_moderation' => new xmlrpcval($awaiting, 'int'), 'spam' => new xmlrpcval($spam, 'int'), 'total_comment' => new xmlrpcval($total, 'int')); logIO("published: {$approved}, draft: {$awaiting}, deprecated: {$spam}, total: {$total}"); return new xmlrpcresp(new xmlrpcval($data, 'struct')); }
?> </span></label><br /> <input type="text" name="trackback_url" class="large form_text_input form-control" id="trackback_url" value="<?php echo format_to_output($trackback_url, 'formvalue'); ?> " /> </div> <?php $Form->end_fieldset(); } // ####################### PLUGIN FIELDSETS ######################### $Plugins->trigger_event('AdminDisplayItemFormFieldset', array('Form' => &$Form, 'Item' => &$edited_Item, 'edit_layout' => 'expert')); if ($current_User->check_perm('meta_comment', 'view', false, $edited_Item)) { // ####################### META COMMENTS ######################### $currentpage = param('currentpage', 'integer', 1); $total_comments_number = generic_ctp_number($edited_Item->ID, 'metas', 'total'); param('comments_number', 'integer', $total_comments_number); param('comment_type', 'string', 'meta'); $Form->begin_fieldset(T_('Meta comments') . get_manual_link('meta-comments-panel') . ($total_comments_number > 0 ? ' <span class="badge badge-important">' . $total_comments_number . '</span>' : ''), array('id' => 'itemform_meta_cmnt', 'fold' => true, 'deny_fold' => $total_comments_number > 0)); global $CommentList, $UserSettings; $CommentList = new CommentList2($Blog); // Filter list: $CommentList->set_filters(array('types' => array('meta'), 'statuses' => get_visibility_statuses('keys', array('redirected', 'trash')), 'order' => 'DESC', 'post_ID' => $edited_Item->ID, 'comments' => $UserSettings->get('results_per_page'), 'page' => $currentpage, 'expiry_statuses' => array('active'))); $CommentList->query(); // comments_container value shows, current Item ID echo '<div class="evo_content_block">'; echo '<div id="comments_container" value="' . $edited_Item->ID . '">'; // display comments $CommentList->display_if_empty(array('before' => '<div class="bComment"><p>', 'after' => '</p></div>', 'msg_empty' => T_('No feedback for this post yet...'))); require $inc_path . 'comments/views/_comment_list.inc.php'; echo '</div>';
/** * Get a link with task title * * @param object Item * @param boolean Display country flag * @param boolean Display status banner * @return string Link */ function task_title_link($Item, $display_flag = true, $display_status = false) { global $current_User, $admin_url; $col = ''; if ($display_status && is_logged_in()) { // Display status $col .= $Item->get_status(array('format' => 'styled')); } if ($display_flag) { // Display country flag $col .= locale_flag($Item->locale, 'w16px', 'flag', '', false) . ' '; } $Item->get_Blog(); if (is_admin_page()) { // Url to item page in backoffice $item_url = $admin_url . '?ctrl=items&blog=' . $Item->get_blog_ID() . '&p=' . $Item->ID; } else { // Url to item page in frontoffice $item_url = $Item->get_permanent_url(); } if ($Item->Blog->get_setting('allow_comments') != 'never') { // The current blog can have comments: $nb_comments = generic_ctp_number($Item->ID, 'feedback'); $comments_url = is_admin_page() ? $item_url : url_add_tail($item_url, '#comments'); $col .= '<a href="' . $comments_url . '" title="' . sprintf(T_('%d feedbacks'), $nb_comments) . '" class="">'; if ($nb_comments) { $col .= get_icon('comments'); } else { $col .= get_icon('nocomment'); } $col .= '</a> '; } $col .= '<a href="' . $item_url . '" class="" title="' . T_('View this post...') . '">' . $Item->dget('title') . '</a></strong>'; return $col; }
function pingback_number($zero = 'no pingback', $one = '1 pingback', $more = '% pingbacks') { global $id, $tablecomments, $tb, $querycount, $cache_pingbacknumber, $use_cache; $number = generic_ctp_number($id, 'pingbacks'); if ($number == 0) { $blah = $zero; } elseif ($number == 1) { $blah = $one; } elseif ($number > 1) { $n = $number; $more = str_replace('%', $n, $more); $blah = $more; } echo $blah; }
/** * comments_number(-) * * @deprecated deprecated by {@link Item::feedback_link()}, used in _edit_showposts.php */ function comments_number($zero = '#', $one = '#', $more = '#', $post_ID = NULL) { if ($zero == '#') { $zero = T_('Leave a comment'); } if ($one == '#') { $one = T_('1 comment'); } if ($more == '#') { $more = T_('%d comments'); } // original hack by dodo@regretless.com if (empty($post_ID)) { global $id; $post_ID = $id; } $number = generic_ctp_number($post_ID, 'comments'); if ($number == 0) { $blah = $zero; } elseif ($number == 1) { $blah = $one; } elseif ($number > 1) { $n = $number; $more = str_replace('%d', $n, $more); $blah = $more; } echo $blah; }
/** * comments_number(-) * * @deprecated deprecated by {@link Item::feedback_link()}, used in _edit_showposts.php */ function comments_number($zero = '#', $one = '#', $more = '#', $post_ID = NULL) { if ($zero == '#') { $zero = T_('Leave a comment'); } if ($one == '#') { $one = T_('1 comment'); } if ($more == '#') { $more = T_('%d comments'); } if (empty($post_ID)) { global $id; $post_ID = $id; } // attila> This function is called only from the backoffice ( _item_list_full.view.php ). // There we always have to show all comments. $number = generic_ctp_number($post_ID, 'comments', 'total'); if ($number == 0) { $blah = $zero; } elseif ($number == 1) { $blah = $one; } elseif ($number > 1) { $n = $number; $more = str_replace('%d', $n, $more); $blah = $more; } echo $blah; }
* * b2evolution - {@link http://b2evolution.net/} * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html} * @copyright (c)2003-2010 by Francois PLANQUE - {@link http://fplanque.net/} * * @package evoskins */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } global $Plugins, $Item, $Skin, $c, $tb, $pb; // Default params: $params = array_merge(array('<div class="post-content clear-block">', 'feature_block' => false, 'content_mode' => 'auto', 'item_class' => 'bPost', 'image_size' => 'fit-400x320', 'before_more_link' => '<span class="more-link">', 'after_more_link' => '</span>'), $params); load_funcs('comments/model/_comment.funcs.php'); // Comments counter $c_number = @generic_ctp_number($Item->ID); $post_class = $disp == 'posts' ? ' posts' : ' single'; if ($Item->is_featured()) { $post_class .= ' featured'; } ?> <div id="<?php $Item->anchor_id(); ?> " class="<?php $Item->div_classes($params); echo $post_class; ?> " lang="<?php $Item->lang();
/** * Get text depending on number of comments * * @param string Type of feedback to link to (feedbacks (all)/comments/trackbacks/pingbacks) * @param string Link text to display when there are 0 comments * @param string Link text to display when there is 1 comment * @param string Link text to display when there are >1 comments (include %d for # of comments) * @param string Status of feedbacks to count */ function get_feedback_title($type = 'feedbacks', $zero = '#', $one = '#', $more = '#', $status = 'published') { if (!$this->can_see_comments()) { // Comments disabled return NULL; } // dh> TODO: Add plugin hook, where a Pingback plugin could hook and provide "pingbacks" switch ($type) { case 'feedbacks': if ($zero == '#') { $zero = ''; } if ($one == '#') { $one = T_('1 feedback'); } if ($more == '#') { $more = T_('%d feedbacks'); } break; case 'comments': if ($zero == '#') { $zero = ''; } if ($one == '#') { $one = T_('1 comment'); } if ($more == '#') { $more = T_('%d comments'); } break; case 'trackbacks': if ($zero == '#') { $zero = ''; } if ($one == '#') { $one = T_('1 trackback'); } if ($more == '#') { $more = T_('%d trackbacks'); } break; case 'pingbacks': // Obsolete, but left for skin compatibility if ($zero == '#') { $zero = ''; } if ($one == '#') { $one = T_('1 pingback'); } if ($more == '#') { $more = T_('%d pingbacks'); } break; default: debug_die("Unknown feedback type [{$type}]"); } $number = generic_ctp_number($this->ID, $type, $status); if ($number == 0) { return $zero; } elseif ($number == 1) { return $one; } elseif ($number > 1) { return str_replace('%d', $number, $more); } }
$metas_count = generic_ctp_number($Item->ID, 'metas', 'total'); $switch_comment_type_tabs = array('feedback' => array('url' => $switch_comment_type_url . '&comment_type=feedback#comments', 'title' => T_('User comments') . ' <span class="badge">' . generic_ctp_number($Item->ID, 'feedbacks', 'total') . '</span>'), 'meta' => array('url' => $switch_comment_type_url . '&comment_type=meta#comments', 'title' => T_('Meta discussion') . ' <span class="badge' . ($metas_count > 0 ? ' badge-important' : '') . '">' . $metas_count . '</span>')); ?> <div class="feedback-tabs btn-group"> <?php foreach ($switch_comment_type_tabs as $comment_tab_type => $comment_tab) { echo '<a href="' . $comment_tab['url'] . '" class="btn' . ($comment_type == $comment_tab_type ? ' btn-primary' : ' btn-default') . '">' . $comment_tab['title'] . '</a>'; } ?> </div> <?php } echo '<div class="clear"></div>'; $currentpage = param('currentpage', 'integer', 1); $total_comments_number = generic_ctp_number($Item->ID, $comment_type == 'meta' ? 'metas' : 'total', 'total'); $draft_comments_number = generic_ctp_number($Item->ID, $comment_type == 'meta' ? 'metas' : 'total', 'draft'); // decide to show all comments, or only drafts if ($comment_type != 'meta' && ($total_comments_number > 5 && $draft_comments_number > 0)) { // show only drafts $statuses = array('draft'); $show_comments = 'draft'; param('comments_number', 'integer', $draft_comments_number); } else { // show all comments $statuses = get_visibility_statuses('keys', array('redirected', 'trash')); $show_comments = 'all'; param('comments_number', 'integer', $total_comments_number); } $show_comments_expiry = param('show_comments_expiry', 'string', 'active', false, true); $expiry_statuses = array('active'); if ($show_comments_expiry == 'all') {
} if (empty($disp_title)) { // Still no title $disp_title[] = T_('No feedback yet'); } if ($params['disp_section_title']) { // Display title echo $params['before_section_title']; echo implode(', ', $disp_title); echo $params['after_section_title']; } if (is_logged_in() && $current_User->check_perm('meta_comment', 'view', false, $Item)) { // Display the meta comments info if current user can edit this post: global $admin_url; echo '<div class="evo_comment__meta_info">'; $meta_comments_count = generic_ctp_number($Item->ID, 'metas', 'total'); $meta_comments_url = $admin_url . '?ctrl=items&p=' . $Item->ID . '&comment_type=meta&blog=' . $Blog->ID . '#comments'; if ($meta_comments_count > 0) { // Display a badge with meta comments count if at least one exists for this Item: echo '<a href="' . $meta_comments_url . '" class="badge badge-meta">' . sprintf(T_('%d meta comments'), $meta_comments_count) . '</a>'; } elseif ($current_User->check_perm('meta_comment', 'add', false, $Item)) { // No meta comments yet, Display a button to add new meta comment: echo '<a href="' . $meta_comments_url . '" class="btn btn-default btn-sm">' . T_('Add meta comment') . '</a>'; } echo '</div>'; } echo '<div class="clearfix"></div>'; // Display rating summary: echo $rating_summary; $comments_per_page = !$Blog->get_setting('threaded_comments') ? $Blog->get_setting('comments_per_page') : 1000; $CommentList = new CommentList2($Blog, $comments_per_page, 'CommentCache', 'c_');
} if ($attending == 'always' || $attending == 'enable_bypost' && $Item->get('attend_status')) { echo $params['before_section_title']; echo T_('Attending this event'); echo $params['after_section_title']; skin_include($params['attend_template'], array('Item' => &$Item, 'attending_start' => $params['attending_start'], 'attending_end' => $params['attending_end'], 'attend_list_start' => $params['attend_list_start'], 'attend_list_end' => $params['attend_list_end'], 'attend_line_start' => $params['attend_line_start'], 'attend_line_end' => $params['attend_line_end'], 'attend_start' => $params['attend_start'], 'attend_end' => $params['attend_end'], 'attend_user_field' => $params['attend_user_field'])); } // -------------------- END OF ATTENDING --------------------- } if (empty($c) && empty($tb) && empty($pb)) { return; } // Comments counter $c_number = @generic_ctp_number($Item->ID, 'comments'); $t_number = @generic_ctp_number($Item->ID, 'trackbacks'); $p_number = @generic_ctp_number($Item->ID, 'pingbacks'); global $disp; if ($disp == 'page') { $title_links = $Skin->T_('Related Links'); } else { $title_links = $Skin->T_('Related Posts'); } echo '<div class="tabbed-content post-tabs clearfix" id="post-tabs"><div class="tabs-wrap clearfix"><ul class="tabs"><li class="related-posts"><a href="#section-relatedPosts"><span>' . $title_links . '</span></a></li>'; if ($Item->can_see_comments()) { // Set redir=no in order to open comment pages memorize_param('redir', 'string', '', 'no'); if (empty($c)) { // Comments not requested $params['disp_comments'] = false; // DO NOT Display the comments if not requested $params['disp_comment_form'] = false;
/** * Get text depending on number of comments * * @param string Type of feedback to link to (feedbacks (all)/comments/trackbacks/pingbacks) * @param string Link text to display when there are 0 comments * @param string Link text to display when there is 1 comment * @param string Link text to display when there are >1 comments (include %d for # of comments) * @param string Status of feedbacks to count */ function get_feedback_title($type = 'feedbacks', $zero = '#', $one = '#', $more = '#', $status = 'published', $filter_by_perm = true) { if (!$this->can_see_comments()) { // Comments disabled return NULL; } // dh> TODO: Add plugin hook, where a Pingback plugin could hook and provide "pingbacks" switch ($type) { case 'feedbacks': if ($zero == '#') { $zero = ''; } if ($one == '#') { $one = T_('1 feedback'); } if ($more == '#') { $more = T_('%d feedbacks'); } break; case 'comments': if ($zero == '#') { $zero = ''; } if ($one == '#') { $one = T_('1 comment'); } if ($more == '#') { $more = T_('%d comments'); } break; case 'trackbacks': if ($zero == '#') { $zero = ''; } if ($one == '#') { $one = T_('1 trackback'); } if ($more == '#') { $more = T_('%d trackbacks'); } break; case 'pingbacks': // Obsolete, but left for skin compatibility if ($zero == '#') { $zero = ''; } if ($one == '#') { $one = T_('1 pingback'); } if ($more == '#') { $more = T_('%d pingbacks'); } break; case 'metas': if ($zero == '#') { $zero = ''; } if ($one == '#') { $one = T_('1 meta comment'); } if ($more == '#') { $more = T_('%d meta comments'); } break; default: debug_die("Unknown feedback type [{$type}]"); } $number = generic_ctp_number($this->ID, $type, $status, false, $filter_by_perm); if (!$filter_by_perm) { // This is the case when we are only counting comments awaiting moderation, return only not visible feedbacks number // count feedbacks with the same statuses where user has permission $visible_number = generic_ctp_number($this->ID, $type, $status, false, true); $number = $number - $visible_number; } if ($number == 0) { return $zero; } elseif ($number == 1) { return $one; } elseif ($number > 1) { return str_replace('%d', $number, $more); } }
$params = array_merge(array('post_navigation' => 'same_category'), $params); global $Item, $cat; /** * @var array Save all statuses that used on this page in order to show them in the footer legend */ global $legend_statuses, $legend_icons; if (!is_array($legend_statuses)) { // Init this array only first time $legend_statuses = array(); } if (!is_array($legend_icons)) { // Init this array only first time $legend_icons = array(); } // Calculate what comments has the Item: $comments_number = generic_ctp_number($Item->ID, 'comments', get_inskin_statuses($Item->get_blog_ID(), 'comment')); $status_icon = 'fa-comments'; $status_title = ''; $status_alt = T_('Discussion topic'); $legend_icons['topic_default'] = 1; if ($Item->is_featured() || $Item->is_intro()) { // Special icon for featured & intro posts $status_icon = 'fa-bullhorn'; $status_alt = T_('Sticky topic / Announcement'); $status_title = '<strong>' . T_('Sticky') . ':</strong> '; $legend_icons['topic_sticky'] = 1; } elseif ($Item->comment_status == 'closed' || $Item->comment_status == 'disabled' || $Item->is_locked()) { // The post is closed for comments $status_icon = 'fa-lock'; $status_alt = T_('This topic is locked: you cannot edit posts or make replies.'); $legend_icons['topic_locked'] = 1;
*/ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } // Default params: $params = array_merge(array('display_column_forum' => false, 'post_navigation' => 'same_category'), $params); global $Item; /** * @var array Save all statuses that used on this page in order to show them in the footer legend */ global $legend_statuses; if (!is_array($legend_statuses)) { // Init this array only first time $legend_statuses = array(); } $comments_number = generic_ctp_number($Item->ID, 'comments', get_inskin_statuses()); $status_icon = 'topic'; $status_title = ''; $status_alt = T_('No new posts'); if ($Item->is_featured() || $Item->is_intro()) { // Special icon for featured & intro posts $status_icon = 'topicSticky'; $status_title = '<strong>' . T_('Sticky') . ':</strong> '; } elseif ($Item->comment_status == 'closed' || $Item->comment_status == 'disabled' || $Item->is_locked()) { // The post is closed for comments $status_icon = 'topicLocked'; $status_alt = T_('This topic is locked: you cannot edit posts or make replies.'); } elseif ($comments_number > 25) { // Popular topic $status_icon = 'folder_hot.gif'; }