当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_activity_recurse_comment_count函数代码示例

本文整理汇总了PHP中bp_activity_recurse_comment_count函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_activity_recurse_comment_count函数的具体用法?PHP bp_activity_recurse_comment_count怎么用?PHP bp_activity_recurse_comment_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_activity_recurse_comment_count函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: column_response

 /**
  * "In response to" column markup.
  *
  * @since BuddyPress (1.6.0)
  *
  * @see WP_List_Table::single_row_columns()
  *
  * @param array $item A singular item (one full row).
  */
 function column_response($item)
 {
     // Is $item is a root activity?
     /**
      * Filters default list of default root activity types.
      *
      * @since BuddyPress (1.6.0)
      *
      * @param array $value Array of default activity types.
      * @param array $item  Current item being displayed.
      */
     if (empty($item['item_id']) || !in_array($item['type'], apply_filters('bp_activity_admin_root_activity_types', array('activity_comment'), $item))) {
         $comment_count = !empty($item['children']) ? bp_activity_recurse_comment_count((object) $item) : 0;
         $root_activity_url = bp_get_admin_url('admin.php?page=bp-activity&aid=' . $item['id']);
         // If the activity has comments, display a link to the activity's permalink, with its comment count in a speech bubble
         if ($comment_count) {
             $title_attr = sprintf(_n('%s related activity', '%s related activities', $comment_count, 'buddypress'), number_format_i18n($comment_count));
             printf('<a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$s</span></a>', esc_url($root_activity_url), esc_attr($title_attr), number_format_i18n($comment_count));
         }
         // For non-root activities, display a link to the replied-to activity's author's profile
     } else {
         echo '<strong>' . get_avatar($this->get_activity_user_id($item['item_id']), '32') . ' ' . bp_core_get_userlink($this->get_activity_user_id($item['item_id'])) . '</strong><br />';
     }
     // Activity permalink
     if (!$item['is_spam']) {
         printf(__('<a href="%1$s">View Activity</a>', 'buddypress'), bp_activity_get_permalink($item['id'], (object) $item));
     }
 }
开发者ID:un1coin,项目名称:ovn-space,代码行数:37,代码来源:bp-activity-admin.php

示例2: bp_activity_recurse_comment_count

/**
 * Gets the content of the activity comment currently being displayed
 *
 * The content is run through two filters. bp_get_activity_content will apply all filters
 * applied to activity items in general. Use bp_activity_comment_content to modify the
 * content of activity comments only.
 *
 * @since 1.2.0
 *
 * @todo investigate why bp_activity_recurse_comment_count() is used while being declared
 *
 * @param object $comment Activity comments object
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @global object $bp BuddyPress global settings
 * @uses bp_activity_recurse_comment_count()
 * @uses apply_filters() To call the 'bp_activity_get_comment_count' hook
 *
 * @return int $count The activity comment count.
 */
function bp_activity_recurse_comment_count($comment, $count = 0)
{
    global $activities_template, $bp;
    if (!$comment->children) {
        return $count;
    }
    foreach ((array) $comment->children as $comment) {
        $count++;
        $count = bp_activity_recurse_comment_count($comment, $count);
    }
    return $count;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:32,代码来源:bp-activity-template.php

示例3: bp_activity_recurse_comment_count

/**
 * Return the total number of comments to the current comment.
 *
 * This function recursively adds the total number of comments each
 * activity child has, and returns them.
 *
 * @since BuddyPress (1.2.0)
 *
 * @uses bp_activity_recurse_comment_count()
 * @uses apply_filters() To call the 'bp_activity_recurse_comment_count' hook
 *
 * @param object $comment Activity comment object.
 * @param int $count The current iteration count.
 *
 * @return int $count The activity comment count.
 */
function bp_activity_recurse_comment_count($comment, $count = 0)
{
    // Copy the count
    $new_count = $count;
    // Loop through children and recursively count comments
    if (!empty($comment->children)) {
        foreach ((array) $comment->children as $comment) {
            $new_count++;
            $new_count = bp_activity_recurse_comment_count($comment, $new_count);
        }
    }
    /**
     * Filters the total number of comments for the current comment.
     *
     * @since BuddyPress (2.1.0)
     *
     * @param int    $new_count New total count for the current comment.
     * @param object $comment Activity comment object.
     * @param int    $count Current iteration count for the current comment.
     */
    return apply_filters('bp_activity_recurse_comment_count', $new_count, $comment, $count);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:38,代码来源:bp-activity-template.php

示例4: bp_activity_recurse_comment_count

/**
 * Return the total number of comments to the current comment.
 *
 * This function recursively adds the total number of comments each
 * activity child has, and returns them.
 *
 * @since BuddyPress (1.2)
 *
 * @uses bp_activity_recurse_comment_count()
 * @uses apply_filters() To call the 'bp_activity_recurse_comment_count' hook
 *
 * @param object $comment Activity comment object.
 * @param int $count The current iteration count.
 *
 * @return int $count The activity comment count.
 */
function bp_activity_recurse_comment_count($comment, $count = 0)
{
    // Copy the count
    $new_count = $count;
    // Loop through children and recursively count comments
    if (!empty($comment->children)) {
        foreach ((array) $comment->children as $comment) {
            $new_count++;
            $new_count = bp_activity_recurse_comment_count($comment, $new_count);
        }
    }
    // Filter and return
    return apply_filters('bp_activity_recurse_comment_count', $new_count, $comment, $count);
}
开发者ID:eresyyl,项目名称:mk,代码行数:30,代码来源:bp-activity-template.php

示例5: bp_activity_recurse_comment_count

/**
 * Return the content of the activity comment currently being displayed.
 *
 * The content is run through two filters. 'bp_get_activity_content'
 * will apply all filters applied to activity items in general.
 * Use bp_activity_comment_content to modify the content of
 * activity comments only.
 *
 * @since BuddyPress (1.2)
 *
 * @uses bp_activity_recurse_comment_count()
 * @uses apply_filters() To call the 'bp_activity_get_comment_count' hook
 * @todo investigate why bp_activity_recurse_comment_count() is used while being declared
 *
 * @param object $comment Activity comment object.
 * @param int $count The current iteration count.
 * @return int $count The activity comment count.
 */
function bp_activity_recurse_comment_count($comment, $count = 0)
{
    if (empty($comment->children)) {
        return $count;
    }
    foreach ((array) $comment->children as $comment) {
        $count++;
        $count = bp_activity_recurse_comment_count($comment, $count);
    }
    return $count;
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:29,代码来源:bp-activity-template.php

示例6: column_response

 /**
  * "In response to" column
  *
  * @param array $item A singular item (one full row)
  * @see WP_List_Table::single_row_columns()
  * @since 1.6
  */
 function column_response($item)
 {
     // Display link to user's profile
     echo bp_core_get_userlink($item['user_id']);
     // Get activity permalink
     $activity_link = bp_activity_get_permalink($item['id'], (object) $item);
     // Get the root activity ID by parsing the permalink; this may be not be the same as $item['id'] for nested items (e.g. activity_comments)
     $root_activity_id = array();
     preg_match('/\\/p\\/(\\d+)\\/*$/i', $activity_link, $root_activity_id);
     if (empty($root_activity_id[1])) {
         return;
     }
     $root_activity_id = (int) $root_activity_id[1];
     // Is $item the root activity?
     if ((int) $item['id'] == $root_activity_id) {
         $root_activity = (object) $item;
         // Get root activity comment count
         $comment_count = !empty($root_activity->children) ? bp_activity_recurse_comment_count($root_activity) : 0;
         // Display a link to the root activity's permalink, with its comment count in a speech bubble
         printf('<br /><a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$d</span></a>', network_admin_url('admin.php?page=bp-activity&amp;aid=' . $root_activity_id), esc_attr(sprintf(__('%d related activities', 'buddypress'), $comment_count)), $comment_count);
         // $item is not the root activity (it is probably an activity_comment).
     } else {
         echo '<br />';
         // @todo Get comment count from a specific node ($root_activity_id) in the tree, not $root_activity_id's root.
     }
     // Link to the activity permalink
     printf(__('<a href="%1$s">View Activity</a>', 'buddypress'), bp_activity_get_permalink($item['id'], (object) $item));
 }
开发者ID:newington,项目名称:buddypress,代码行数:35,代码来源:bp-activity-admin.php


注:本文中的bp_activity_recurse_comment_count函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。