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


PHP bp_activity_get_permalink函数代码示例

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


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

示例1: bp_like_post_to_stream

/**
 * bp_like_post_to_stream()
 * 
 * Posts to stream, depending on settings
 * 
 * TODO, Should we be posted that people like comments to the feed? This can get messy..
 * Also no point having 20 posts saying people liked the same status..
 * 
 */
function bp_like_post_to_stream($item_id, $user_id)
{
    if (bp_like_get_settings('post_to_activity_stream') == 1) {
        $activity = bp_activity_get_specific(array('activity_ids' => $item_id, 'component' => 'buddypress-like'));
        $author_id = $activity['activities'][0]->user_id;
        if ($user_id == $author_id) {
            $action = bp_like_get_text('record_activity_likes_own');
        } elseif ($user_id == 0) {
            $action = bp_like_get_text('record_activity_likes_an');
        } else {
            $action = bp_like_get_text('record_activity_likes_users');
        }
        $liker = bp_core_get_userlink($user_id);
        $author = bp_core_get_userlink($author_id);
        $activity_url = bp_activity_get_permalink($item_id);
        $content = '';
        //content must be defined...
        /* Grab the content and make it into an excerpt of 140 chars if we're allowed */
        if (bp_like_get_settings('show_excerpt') == 1) {
            $content = $activity['activities'][0]->content;
            if (strlen($content) > bp_like_get_settings('excerpt_length')) {
                $content = substr($content, 0, bp_like_get_settings('excerpt_length'));
                $content = strip_tags($content);
                $content = $content . '...';
            }
        }
        /* Filter out the placeholders */
        $action = str_replace('%user%', $liker, $action);
        $action = str_replace('%permalink%', $activity_url, $action);
        $action = str_replace('%author%', $author, $action);
        bp_activity_add(array('action' => $action, 'content' => $content, 'primary_link' => $activity_url, 'component' => 'bp-like', 'type' => 'activity_liked', 'user_id' => $user_id, 'item_id' => $item_id));
    }
}
开发者ID:pausaura,项目名称:agora_nodes,代码行数:42,代码来源:activity-functions.php

示例2: bp_links_at_message_notification

function bp_links_at_message_notification($content, $poster_user_id, $link_id, $activity_id)
{
    global $bp;
    /* Scan for @username strings in an activity update. Notify each user. */
    $pattern = '/[@]+([A-Za-z0-9-_]+)/';
    preg_match_all($pattern, $content, $usernames);
    /* Make sure there's only one instance of each username */
    if (!($usernames = array_unique($usernames[1]))) {
        return false;
    }
    $link = new BP_Links_Link($link_id);
    foreach ((array) $usernames as $username) {
        if (!($receiver_user_id = bp_core_get_userid($username))) {
            continue;
        }
        if (!bp_links_is_link_visibile($link, $receiver_user_id)) {
            continue;
        }
        // Now email the user with the contents of the message (if they have enabled email notifications)
        if ('no' != get_usermeta($user_id, 'notification_activity_new_mention')) {
            $poster_name = bp_core_get_user_displayname($poster_user_id);
            $message_link = bp_activity_get_permalink($activity_id);
            $settings_link = bp_core_get_user_domain($receiver_user_id) . 'settings/notifications/';
            // Set up and send the message
            $ud = bp_core_get_core_userdata($receiver_user_id);
            $to = $ud->user_email;
            $subject = '[' . get_blog_option(BP_ROOT_BLOG, 'blogname') . '] ' . sprintf(__('%s mentioned you in the link "%s"', 'buddypress-links'), stripslashes($poster_name), wp_filter_kses(stripslashes($link->name)));
            $message = sprintf(__('%s mentioned you in the link "%s":

"%s"

To view and respond to the message, log in and visit: %s

---------------------
', 'buddypress-links'), $poster_name, wp_filter_kses(stripslashes_deep($link->name)), wp_filter_kses(stripslashes_deep($content)), $message_link);
            $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
            // Send it
            wp_mail($to, $subject, $message);
        }
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:41,代码来源:bp-links-notifications.php

示例3: 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

示例4: bp_activity_screen_single_activity_permalink

/**
 * Load the page for a single activity item.
 *
 * @since 1.2.0
 *
 * @uses bp_is_activity_component()
 * @uses bp_activity_get_specific()
 * @uses bp_current_action()
 * @uses bp_action_variables()
 * @uses bp_do_404()
 * @uses bp_is_active()
 * @uses groups_get_group()
 * @uses groups_is_user_member()
 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_access' hook.
 * @uses do_action() To call the 'bp_activity_screen_single_activity_permalink' hook.
 * @uses bp_core_add_message()
 * @uses is_user_logged_in()
 * @uses bp_core_redirect()
 * @uses site_url()
 * @uses esc_url()
 * @uses bp_get_root_domain()
 * @uses bp_get_activity_root_slug()
 * @uses bp_core_load_template()
 * @uses apply_filters() To call the 'bp_activity_template_profile_activity_permalink' hook.
 */
function bp_activity_screen_single_activity_permalink()
{
    $bp = buddypress();
    // No displayed user or not viewing activity component.
    if (!bp_is_activity_component()) {
        return false;
    }
    if (!bp_current_action() || !is_numeric(bp_current_action())) {
        return false;
    }
    // Get the activity details.
    $activity = bp_activity_get_specific(array('activity_ids' => bp_current_action(), 'show_hidden' => true, 'spam' => 'ham_only'));
    // 404 if activity does not exist
    if (empty($activity['activities'][0]) || bp_action_variables()) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Default access is true.
    $has_access = true;
    // If activity is from a group, do an extra cap check.
    if (isset($bp->groups->id) && $activity->component == $bp->groups->id) {
        // Activity is from a group, but groups is currently disabled.
        if (!bp_is_active('groups')) {
            bp_do_404();
            return;
        }
        // Check to see if the group is not public, if so, check the
        // user has access to see this activity.
        if ($group = groups_get_group(array('group_id' => $activity->item_id))) {
            // Group is not public.
            if ('public' != $group->status) {
                // User is not a member of group.
                if (!groups_is_user_member(bp_loggedin_user_id(), $group->id)) {
                    $has_access = false;
                }
            }
        }
    }
    /**
     * Filters the access permission for a single activity view.
     *
     * @since 1.2.0
     *
     * @param array $access Array holding the current $has_access value and current activity item instance.
     */
    $has_access = apply_filters_ref_array('bp_activity_permalink_access', array($has_access, &$activity));
    /**
     * Fires before the loading of a single activity template file.
     *
     * @since 1.2.0
     *
     * @param BP_Activity_Activity $activity   Object representing the current activity item being displayed.
     * @param bool                 $has_access Whether or not the current user has access to view activity.
     */
    do_action('bp_activity_screen_single_activity_permalink', $activity, $has_access);
    // Access is specifically disallowed.
    if (false === $has_access) {
        // User feedback.
        bp_core_add_message(__('You do not have access to this activity.', 'buddypress'), 'error');
        // Redirect based on logged in status.
        if (is_user_logged_in()) {
            $url = bp_loggedin_user_domain();
        } else {
            $url = sprintf(site_url('wp-login.php?redirect_to=%s'), urlencode(esc_url_raw(bp_activity_get_permalink((int) bp_current_action()))));
        }
        bp_core_redirect($url);
    }
    /**
     * Filters the template to load for a single activity screen.
     *
     * @since 1.0.0
     *
     * @param string $template Path to the activity template to load.
//.........这里部分代码省略.........
开发者ID:dcavins,项目名称:buddypress-svn,代码行数:101,代码来源:bp-activity-screens.php

示例5: do_search


//.........这里部分代码省略.........
               }*/
             $relevance_parts[] = "(case when\r\n                    (lower(" . $wpdb->prefix . "bp_groups.description) REGEXP '{$regexp_words}')\r\n                     then {$searchData['contentweight']} else 0 end)";
             $relevance_parts[] = "(case when\r\n                    (lower(" . $wpdb->prefix . "bp_groups.description) = '{$s}')\r\n                     then {$searchData['econtentweight']} else 0 end)";
             /*---------------------------------------------------------------*/
             /*------------------------- Build like --------------------------*/
             $like_query = implode(' OR ', $parts);
             if ($like_query == "") {
                 $like_query = "(1)";
             } else {
                 $like_query = "({$like_query})";
             }
             /*---------------------------------------------------------------*/
             /*---------------------- Build relevance ------------------------*/
             $relevance = implode(' + ', $relevance_parts);
             if ($searchData['userelevance'] != 1 || $relevance == "") {
                 $relevance = "(1)";
             } else {
                 $relevance = "({$relevance})";
             }
             /*---------------------------------------------------------------*/
             $querystr = "\r\n             SELECT\r\n               " . $wpdb->prefix . "bp_groups.id as id,\r\n               " . $wpdb->prefix . "bp_groups.name as title,\r\n               " . $wpdb->prefix . "bp_groups.description as content,\r\n               " . $wpdb->prefix . "bp_groups.date_created as date,\r\n               {$wpdb->users}.user_nicename as author,\r\n               'bp_group' as content_type,\r\n               {$relevance} as relevance\r\n             FROM\r\n               " . $wpdb->prefix . "bp_groups\r\n             LEFT JOIN {$wpdb->users} ON {$wpdb->users}.ID = " . $wpdb->prefix . "bp_groups.creator_id\r\n             WHERE\r\n                  {$group_statuses}\r\n              AND {$like_query}\r\n              ORDER BY relevance DESC, title ASC";
             $groupresults = $wpdb->get_results($querystr, OBJECT);
             foreach ($groupresults as $k => $v) {
                 $group = new BP_Groups_Group($v->id);
                 $groupresults[$k]->link = bp_get_group_permalink($group);
                 if ($searchData['image_options']['show_images'] == 1) {
                     $avatar_options = array('item_id' => $v->id, 'object' => 'group', 'type' => 'full', 'html' => false);
                     $im = bp_core_fetch_avatar($avatar_options);
                     if ($im != '') {
                         $groupresults[$k]->image = $im;
                     }
                 }
                 if ($groupresults[$k]->content != '') {
                     $groupresults[$k]->content = wd_substr_at_word(strip_tags($groupresults[$k]->content), $searchData['descriptionlength']) . "...";
                 }
             }
         }
         /*---------------------------------------------------------------*/
         /*----------------------- Activity query ------------------------*/
         if ($searchData['search_in_bp_activities'] && bp_is_active('groups')) {
             $parts = array();
             $relevance_parts = array();
             /*---------------------- Description query ----------------------*/
             if ($kw_logic == 'or' || $kw_logic == 'and') {
                 $op = strtoupper($kw_logic);
                 if (count($_s) > 0) {
                     $_like = implode("%' " . $op . " lower(" . $wpdb->prefix . "bp_activity.content) LIKE '%", $words);
                 } else {
                     $_like = $s;
                 }
                 $parts[] = "( lower(" . $wpdb->prefix . "bp_activity.content) LIKE '%" . $_like . "%' )";
             } else {
                 $_like = array();
                 $op = $kw_logic == 'andex' ? 'AND' : 'OR';
                 foreach ($words as $word) {
                     $_like[] = "\r\n                           (lower(" . $wpdb->prefix . "bp_activity.content) LIKE '% " . $word . " %'\r\n                        OR  lower(" . $wpdb->prefix . "bp_activity.content) LIKE '" . $word . " %'\r\n                        OR  lower(" . $wpdb->prefix . "bp_activity.content) LIKE '% " . $word . "'\r\n                        OR  lower(" . $wpdb->prefix . "bp_activity.content) = '" . $word . "')";
                 }
                 $parts[] = "(" . implode(' ' . $op . ' ', $_like) . ")";
             }
             /*$words = $options['set_exactonly'] == 1 ? $s : $_si;
               if ($kw_logic == 'or' || $kw_logic == 'orex') {
                   $parts[] = "(lower(" . $wpdb->prefix . "bp_activity.content) REGEXP '$words')";
               } else {
                   if (count($_s) > 0)
                       $and_like = implode("$r_sign' AND lower(" . $wpdb->prefix . "bp_activity.content) RLIKE '$l_sign", $_s);
                   else
                       $and_like = $s;
                   $parts[] = "lower(" . $wpdb->prefix . "bp_activity.content) RLIKE '$l_sign" . $and_like . "$r_sign'";
               }*/
             $relevance_parts[] = "(case when\r\n                    (lower(" . $wpdb->prefix . "bp_activity.content) REGEXP '{$regexp_words}')\r\n                     then {$searchData['contentweight']} else 0 end)";
             $relevance_parts[] = "(case when\r\n                    (lower(" . $wpdb->prefix . "bp_activity.content) = '{$s}')\r\n                     then {$searchData['econtentweight']} else 0 end)";
             /*---------------------------------------------------------------*/
             /*------------------------- Build like --------------------------*/
             $like_query = implode(' OR ', $parts);
             if ($like_query == "") {
                 $like_query = "(1)";
             } else {
                 $like_query = "({$like_query})";
             }
             /*---------------------------------------------------------------*/
             /*---------------------- Build relevance ------------------------*/
             $relevance = implode(' + ', $relevance_parts);
             if ($searchData['userelevance'] != 1 || $relevance == "") {
                 $relevance = "(1)";
             } else {
                 $relevance = "({$relevance})";
             }
             /*---------------------------------------------------------------*/
             $querystr = "\r\n                 SELECT\r\n                   " . $wpdb->prefix . "bp_activity.id as id,\r\n                   " . $wpdb->prefix . "bp_activity.content as title,\r\n                   " . $wpdb->prefix . "bp_activity.content as content,\r\n                   " . $wpdb->prefix . "bp_activity.date_recorded as date,\r\n                   {$wpdb->users}.user_nicename as author,\r\n                   " . $wpdb->prefix . "bp_activity.user_id as author_id,\r\n                   'bp_activity' as content_type,\r\n                   {$relevance} as relevance\r\n                 FROM\r\n                   " . $wpdb->prefix . "bp_activity\r\n                 LEFT JOIN {$wpdb->users} ON {$wpdb->users}.ID = " . $wpdb->prefix . "bp_activity.user_id\r\n                 WHERE\r\n                   (" . $wpdb->prefix . "bp_activity.component = 'activity' AND " . $wpdb->prefix . "bp_activity.is_spam = 0)\r\n                   AND {$like_query}\r\n                   ORDER BY relevance DESC, title ASC";
             $activityresults = $wpdb->get_results($querystr, OBJECT);
             foreach ($activityresults as $k => $v) {
                 $activityresults[$k]->link = bp_activity_get_permalink($v->id);
                 $activityresults[$k]->image = bp_core_fetch_avatar(array('item_id' => $v->author_id, 'html' => false));
             }
         }
         do_action('bbpress_init');
     }
     $this->results = array('repliesresults' => $repliesresults, 'groupresults' => $groupresults, 'activityresults' => $activityresults);
     return $this->results;
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:101,代码来源:search_buddypress.class.php

示例6: bp_get_member_latest_update

/**
 * Get the latest update from the current member in the loop.
 *
 * @param array|string $args {
 *     Array of optional arguments.
 *     @type int  $length    Truncation length. Default: 225.
 *     @type bool $view_link Whether to provide a 'View' link for
 *                           truncated entries. Default: false.
 * }
 * @return string
 */
function bp_get_member_latest_update($args = '')
{
    global $members_template;
    $defaults = array('length' => 225, 'view_link' => true);
    $r = wp_parse_args($args, $defaults);
    extract($r);
    if (!bp_is_active('activity') || empty($members_template->member->latest_update) || !($update = maybe_unserialize($members_template->member->latest_update))) {
        return false;
    }
    /**
     * Filters the excerpt of the latest update for current member in the loop.
     *
     * @since 1.2.5
     *
     * @param string $value Excerpt of the latest update for current member in the loop.
     */
    $update_content = apply_filters('bp_get_activity_latest_update_excerpt', trim(strip_tags(bp_create_excerpt($update['content'], $length))));
    $update_content = sprintf(_x('- &quot;%s&quot;', 'member latest update in member directory', 'buddypress'), $update_content);
    // If $view_link is true and the text returned by bp_create_excerpt() is different from the original text (ie it's
    // been truncated), add the "View" link.
    if ($view_link && $update_content != $update['content']) {
        $view = __('View', 'buddypress');
        $update_content .= '<span class="activity-read-more"><a href="' . bp_activity_get_permalink($update['id']) . '" rel="nofollow">' . $view . '</a></span>';
    }
    /**
     * Filters the latest update from the current member in the loop.
     *
     * @since 1.2.0
     *
     * @param string $update_content Formatted latest update for current member.
     */
    return apply_filters('bp_get_member_latest_update', $update_content);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:44,代码来源:bp-members-template.php

示例7: widget


//.........这里部分代码省略.........
                                        }
                                    }
                                    $comment = @get_comment($id);
                                    $title = trim(strip_tags($comment->comment_content));
                                    $permalink = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;
                                } else {
                                    if ('activity_updates' === $type || 'activity_comments' === $type) {
                                        $id = RatingWidgetPlugin::Urid2ActivityId($urid);
                                        $activity = new bp_activity_activity($id);
                                        if (!is_object($activity)) {
                                            if (RWLogger::IsOn()) {
                                                RWLogger::Log('BP_ACTIVITY_NOT_EXIST', $id);
                                            }
                                            // Activity not exist.
                                            continue;
                                        } else {
                                            if (!empty($activity->is_spam)) {
                                                if (RWLogger::IsOn()) {
                                                    RWLogger::Log('BP_ACTIVITY_NOT_VISIBLE (SPAM or TRASH)');
                                                }
                                                // Activity marked as SPAM or TRASH.
                                                continue;
                                            } else {
                                                if (!empty($activity->hide_sitewide)) {
                                                    if (RWLogger::IsOn()) {
                                                        RWLogger::Log('BP_ACTIVITY_HIDE_SITEWIDE');
                                                    }
                                                    // Activity marked as hidden in site.
                                                    continue;
                                                }
                                            }
                                        }
                                        $title = trim(strip_tags($activity->content));
                                        $permalink = bp_activity_get_permalink($id);
                                    } else {
                                        if ('users' === $type) {
                                            $id = RatingWidgetPlugin::Urid2UserId($urid);
                                            if ($bpInstalled) {
                                                $title = trim(strip_tags(bp_core_get_user_displayname($id)));
                                                $permalink = bp_core_get_user_domain($id);
                                            } else {
                                                if ($bbInstalled) {
                                                    $title = trim(strip_tags(bbp_get_user_display_name($id)));
                                                    $permalink = bbp_get_user_profile_url($id);
                                                } else {
                                                    continue;
                                                }
                                            }
                                        } else {
                                            if ('forum_posts' === $type || 'forum_replies' === $type) {
                                                $id = RatingWidgetPlugin::Urid2ForumPostId($urid);
                                                if (function_exists('bp_forums_get_post')) {
                                                    $forum_post = @bp_forums_get_post($id);
                                                    if (!is_object($forum_post)) {
                                                        continue;
                                                    }
                                                    $title = trim(strip_tags($forum_post->post_text));
                                                    $page = bb_get_page_number($forum_post->post_position);
                                                    $permalink = get_topic_link($id, $page) . "#post-{$id}";
                                                } else {
                                                    if (function_exists('bbp_get_reply_id')) {
                                                        $forum_item = bbp_get_topic();
                                                        if (is_object($forum_item)) {
                                                            $is_topic = true;
                                                        } else {
                                                            $is_topic = false;
开发者ID:AlexOreshkevich,项目名称:velomode.by,代码行数:67,代码来源:rw-top-rated-widget.php

示例8: rw_display_activity_comment_rating

 public function rw_display_activity_comment_rating($comment_content)
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence('rw_display_activity_comment_rating', $params);
     }
     // If this is a newly inserted comment, assign it to $this->current_comment
     if (isset($_POST['action']) && 'new_activity_comment' == $_POST['action']) {
         global $activities_template;
         $current_comment = $activities_template->activity->current_comment;
         $parent_comment = $activities_template->activity_parents[$current_comment->item_id];
         $current_comment->parent = $parent_comment;
         $this->current_comment = $parent_comment;
         $this->current_comment->children = array($current_comment->id => $current_comment);
     }
     if (!isset($this->current_comment) || null === $this->current_comment) {
         if (RWLogger::IsOn()) {
             RWLogger::Log('rw_display_activity_comment_rating', 'Current comment is not set.');
         }
         return $comment_content;
     }
     // Find current comment.
     while (!$this->current_comment->children || false === current($this->current_comment->children)) {
         $this->current_comment = $this->current_comment->parent;
         next($this->current_comment->children);
     }
     $parent = $this->current_comment;
     $this->current_comment = current($this->current_comment->children);
     $this->current_comment->parent = $parent;
     /*
     // Check if comment rating isn't specifically excluded.
     if (false === $this->rw_validate_visibility($this->current_comment->id, "activity-comment"))
         return $comment_content;
     
     // Get activity comment user-rating-id.
     $comment_urid = $this->_getActivityRatingGuid($this->current_comment->id);
     
     // Queue activity-comment rating.
     $this->QueueRatingData($comment_urid, strip_tags($this->current_comment->content), bp_activity_get_permalink($this->current_comment->id), "activity-comment");
     
     $rw = '<div class="rw-' . $this->activity_align["activity-comment"]->hor . '"><div class="rw-ui-container rw-class-activity-comment rw-urid-' . $comment_urid . '"></div></div><p></p>';
     */
     $options = array();
     // Add accumulator id if user accumulated rating.
     if ($this->IsUserAccumulatedRating()) {
         $options['uarid'] = $this->_getUserRatingGuid($this->current_comment->user_id);
     }
     $rw = $this->EmbedRatingIfVisible($this->current_comment->id, $this->current_comment->user_id, strip_tags($this->current_comment->content), bp_activity_get_permalink($this->current_comment->id), 'activity-comment', false, $this->activity_align['activity-comment']->hor, false, $options, false);
     // Attach rating html container.
     return $this->activity_align['activity-comment']->ver == 'top' ? $rw . $comment_content : $comment_content . $rw;
 }
开发者ID:robertoAg,项目名称:wordpress_humor,代码行数:51,代码来源:rating-widget.php

示例9: bp_get_activity_latest_update

/**
 * Return the activity latest update link.
 *
 * @since BuddyPress (1.2.0)
 *
 * @uses bp_is_user_inactive()
 * @uses bp_core_is_user_deleted()
 * @uses bp_get_user_meta()
 * @uses apply_filters() To call the 'bp_get_activity_latest_update_excerpt' hook
 * @uses bp_create_excerpt()
 * @uses bp_get_root_domain()
 * @uses bp_get_activity_root_slug()
 * @uses apply_filters() To call the 'bp_get_activity_latest_update' hook
 *
 * @param int $user_id If empty, will fall back on displayed user.
 * @return string|bool $latest_update The activity latest update link.
 *         False on failure
 */
function bp_get_activity_latest_update($user_id = 0)
{
    if (empty($user_id)) {
        $user_id = bp_displayed_user_id();
    }
    if (bp_is_user_inactive($user_id)) {
        return false;
    }
    if (!($update = bp_get_user_meta($user_id, 'bp_latest_update', true))) {
        return false;
    }
    /**
     * Filters the latest update excerpt.
     *
     * @since BuddyPress (1.2.10)
     *
     * @param string $value The excerpt for the latest update.
     */
    $latest_update = apply_filters('bp_get_activity_latest_update_excerpt', trim(strip_tags(bp_create_excerpt($update['content'], 358))));
    $latest_update = sprintf('%s <a href="%s">%s</a>', $latest_update, esc_url_raw(bp_activity_get_permalink($update['id'])), esc_attr__('View', 'buddypress'));
    /**
     * Filters the latest update excerpt with view link appended to the end.
     *
     * @since BuddyPress (1.2.0)
     *
     * @param string $latest_update The latest update with "view" link appended to it.
     */
    return apply_filters('bp_get_activity_latest_update', $latest_update);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:47,代码来源:bp-activity-template.php

示例10: bp_like_add_user_like

/**
 * bp_like_add_user_like()
 *
 * Registers that the user likes a given item.
 *
 */
function bp_like_add_user_like($item_id = '', $type = 'activity')
{
    global $bp;
    if (!$item_id) {
        return false;
    }
    if (!$user_id) {
        $user_id = $bp->loggedin_user->id;
    }
    if ($user_id == 0) {
        echo bp_like_get_text('must_be_logged_in');
        return false;
    }
    if ($type == 'activity') {
        /* Add to the users liked activities. */
        $user_likes = get_user_meta($user_id, 'bp_liked_activities', true);
        $user_likes[$item_id] = 'activity_liked';
        update_user_meta($user_id, 'bp_liked_activities', $user_likes);
        /* Add to the total likes for this activity. */
        $users_who_like = bp_activity_get_meta($item_id, 'liked_count', true);
        $users_who_like[$user_id] = 'user_likes';
        bp_activity_update_meta($item_id, 'liked_count', $users_who_like);
        $liked_count = count($users_who_like);
        /* Publish to the activity stream if we're allowed to. */
        if (bp_like_get_settings('post_to_activity_stream') == 1) {
            $activity = bp_activity_get_specific(array('activity_ids' => $item_id, 'component' => 'bp-like'));
            $author_id = $activity['activities'][0]->user_id;
            if ($user_id == $author_id) {
                $action = bp_like_get_text('record_activity_likes_own');
            } elseif ($user_id == 0) {
                $action = bp_like_get_text('record_activity_likes_an');
            } else {
                $action = bp_like_get_text('record_activity_likes_users');
            }
            $liker = bp_core_get_userlink($user_id);
            $author = bp_core_get_userlink($author_id);
            $activity_url = bp_activity_get_permalink($item_id);
            /* Grab the content and make it into an excerpt of 140 chars if we're allowed */
            if (bp_like_get_settings('show_excerpt') == 1) {
                $content = $activity['activities'][0]->content;
                if (strlen($content) > bp_like_get_settings('excerpt_length')) {
                    $content = substr($content, 0, bp_like_get_settings('excerpt_length'));
                    $content = $content . '...';
                }
            }
            /* Filter out the placeholders */
            $action = str_replace('%user%', $liker, $action);
            $action = str_replace('%permalink%', $activity_url, $action);
            $action = str_replace('%author%', $author, $action);
            bp_activity_add(array('action' => $action, 'content' => $content, 'primary_link' => $activity_url, 'component' => 'bp-like', 'type' => 'activity_liked', 'user_id' => $user_id, 'item_id' => $item_id));
        }
    } elseif ($type == 'blogpost') {
        /* Add to the users liked blog posts. */
        $user_likes = get_user_meta($user_id, 'bp_liked_blogposts', true);
        $user_likes[$item_id] = 'blogpost_liked';
        update_user_meta($user_id, 'bp_liked_blogposts', $user_likes);
        /* Add to the total likes for this blog post. */
        $users_who_like = get_post_meta($item_id, 'liked_count', true);
        $users_who_like[$user_id] = 'user_likes';
        update_post_meta($item_id, 'liked_count', $users_who_like);
        $liked_count = count($users_who_like);
        if (bp_like_get_settings('post_to_activity_stream') == 1) {
            $post = get_post($item_id);
            $author_id = $post->post_author;
            $liker = bp_core_get_userlink($user_id);
            $permalink = get_permalink($item_id);
            $title = $post->post_title;
            $author = bp_core_get_userlink($post->post_author);
            if ($user_id == $author_id) {
                $action = bp_like_get_text('record_activity_likes_own_blogpost');
            } elseif ($user_id == 0) {
                $action = bp_like_get_text('record_activity_likes_a_blogpost');
            } else {
                $action = bp_like_get_text('record_activity_likes_users_blogpost');
            }
            /* Filter out the placeholders */
            $action = str_replace('%user%', $liker, $action);
            $action = str_replace('%permalink%', $permalink, $action);
            $action = str_replace('%title%', $title, $action);
            $action = str_replace('%author%', $author, $action);
            /* Grab the content and make it into an excerpt of 140 chars if we're allowed */
            if (bp_like_get_settings('show_excerpt') == 1) {
                $content = $post->post_content;
                if (strlen($content) > bp_like_get_settings('excerpt_length')) {
                    $content = substr($content, 0, bp_like_get_settings('excerpt_length'));
                    $content = $content . '...';
                }
            }
            bp_activity_add(array('action' => $action, 'content' => $content, 'component' => 'bp-like', 'type' => 'blogpost_liked', 'user_id' => $user_id, 'item_id' => $item_id, 'primary_link' => $permalink));
        }
    }
    echo bp_like_get_text('unlike');
    if ($liked_count) {
        echo ' (' . $liked_count . ')';
//.........这里部分代码省略.........
开发者ID:Nightgunner5,项目名称:Pubcomp-CMS,代码行数:101,代码来源:bp-like.php

示例11: bp_get_activity_comment_permalink

/**
 * Return the activity comment permalink.
 *
 * @since BuddyPress (1.8)
 *
 * @uses bp_activity_get_permalink()
 * @uses apply_filters() To call the 'bp_get_activity_comment_permalink' hook.
 *
 * @return string $link The activity comment permalink.
 */
function bp_get_activity_comment_permalink()
{
    global $activities_template;
    // Check that comment exists
    $comment_id = isset($activities_template->activity->current_comment->id) ? $activities_template->activity->current_comment->id : 0;
    // Setup the comment link
    $comment_link = !empty($comment_id) ? '#acomment-' . $comment_id : false;
    // Append comment ID to end of activity permalink
    $link = bp_activity_get_permalink($activities_template->activity->id, $activities_template->activity) . $comment_link;
    return apply_filters('bp_get_activity_comment_permalink', $link, $comment_id);
}
开发者ID:eresyyl,项目名称:mk,代码行数:21,代码来源:bp-activity-template.php

示例12: bp_get_activity_comment_permalink

/**
 * Return the activity comment permalink.
 *
 * @since BuddyPress (1.8)
 *
 * @uses bp_activity_get_permalink()
 * @uses apply_filters() To call the 'bp_get_activity_comment_permalink' hook.
 *
 * @return string $link The activity comment permalink.
 */
function bp_get_activity_comment_permalink()
{
    global $activities_template;
    $link = bp_activity_get_permalink($activities_template->activity->id, $activities_template->activity) . '#acomment-' . $activities_template->activity->current_comment->id;
    return apply_filters('bp_get_activity_comment_permalink', $link);
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:16,代码来源:bp-activity-template.php

示例13: process_like_button_code

 function process_like_button_code($atts, $content = '')
 {
     global $wp_current_filter;
     // Check allowed
     $allow = $this->data->get_option('wdfb_button', 'allow_facebook_button');
     if (!apply_filters('wdfb-show_facebook_button', $allow)) {
         return '';
     }
     // Check nesting (i.e. posts within post, reformatted with apply_filters)
     $filters = array_count_values($wp_current_filter);
     if (isset($filters['the_content']) && $filters['the_content'] > 1) {
         return '';
     }
     $atts = shortcode_atts(array('forced' => false), $atts);
     $forced = $atts['forced'] && 'no' != $atts['forced'] ? true : false;
     $in_types = $this->data->get_option('wdfb_button', 'not_in_post_types');
     $in_types = is_array($in_types) ? $in_types : array();
     $post_type = get_post_type();
     if ($post_type && in_array(get_post_type(), $in_types) && !$forced) {
         return '';
     }
     $is_activity = defined('BP_VERSION') && isset($filters['bp_get_activity_content_body']);
     if ($is_activity && !@in_array('_buddypress_activity', $in_types)) {
         return '';
     }
     // Reverse logic for BuddyPress Activity check.
     $send = $this->data->get_option('wdfb_button', 'show_send_button');
     $layout = $this->data->get_option('wdfb_button', 'button_appearance');
     $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     /*
     		$width = ("standard" == $layout) ? 300 : (
     			("button_count" == $layout) ? 150 : 60
     		);
     */
     $width = 450;
     $width = apply_filters('wdfb-like_button-width', $width);
     $scheme = $this->data->get_option('wdfb_button', 'color_scheme');
     $scheme = $scheme ? $scheme : 'light';
     if (is_home() && $this->data->get_option('wdfb_button', 'show_on_front_page') || is_archive() && $this->data->get_option('wdfb_button', 'show_on_archive_page') || defined('BP_VERSION') && $is_activity && !wdfb_is_single_bp_activity()) {
         $tmp_url = $is_activity && function_exists('bp_activity_get_permalink') ? bp_activity_get_permalink(bp_get_activity_id()) : (in_the_loop() ? get_permalink() : false);
         $href = !empty($tmp_url) ? $tmp_url : $url;
         $locale = wdfb_get_locale();
         $height = "box_count" == $layout ? 60 : 25;
         $height = apply_filters('wdfb-like_button-height', $height);
         $use_xfbml = false;
         if (defined('BP_VERSION') && $is_activity && !wdfb_is_single_bp_activity() && $this->data->get_option('wdfb_button', 'bp_activity_xfbml') || is_home() && $this->data->get_option('wdfb_button', 'show_on_front_page') && $this->data->get_option('wdfb_button', 'shared_pages_use_xfbml') || is_archive() && $this->data->get_option('wdfb_button', 'show_on_archive_page') && $this->data->get_option('wdfb_button', 'shared_pages_use_xfbml')) {
             $use_xfbml = true;
         }
         $href = apply_filters('wdfb-like_button-href_attribute', WDFB_PROTOCOL . preg_replace('/^https?:\\/\\//', '', $href));
         return $use_xfbml ? '<div class="wdfb_like_button">' . wdfb_get_fb_plugin_markup('like', compact(array('href', 'send', 'layout', 'width', 'scheme'))) . '</div>' : "<div class='wdfb_like_button'><iframe src='http://www.facebook.com/plugins/like.php?&amp;href=" . rawurlencode($href) . "&amp;send=false&amp;layout={$layout}&amp;show_faces=false&amp;action=like&amp;colorscheme={$scheme}&amp;font&amp;height={$height}&amp;width={$width}&amp;locale={$locale}' scrolling='no' frameborder='0' style='border:none; overflow:hidden; height:{$height}px; width:{$width}px;' allowTransparency='true'></iframe></div>";
     }
     $href = apply_filters('wdfb-like_button-href_attribute', WDFB_PROTOCOL . preg_replace('/^https?:\\/\\//', '', $url));
     return '<div class="wdfb_like_button">' . wdfb_get_fb_plugin_markup('like', compact(array('href', 'send', 'layout', 'width', 'scheme'))) . '</div>';
 }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:54,代码来源:class_wdfb_marker_replacer.php

示例14: bp_rbe_activity_comment_view_link

/**
 * Adds anchor to an activity comment's "View" link.
 *
 * Who likes scrolling all the way down the page to find their comment!
 *
 * @since 1.0-beta
 */
function bp_rbe_activity_comment_view_link($link, $activity)
{
    if ($activity->type == 'activity_comment') {
        $action = apply_filters_ref_array('bp_get_activity_action_pre_meta', array($activity->action, &$activity, array('no_timestamp' => false)));
        $time_since = apply_filters_ref_array('bp_activity_time_since', array('<span class="time-since">' . bp_core_time_since($activity->date_recorded) . '</span>', &$activity));
        return $action . ' <a href="' . bp_activity_get_permalink($activity->id) . '#acomment-' . $activity->id . '" class="view activity-time-since" title="' . __('View Discussion', 'buddypress') . '">' . $time_since . '</a>';
    }
    return $link;
}
开发者ID:r-a-y,项目名称:bp-reply-by-email,代码行数:16,代码来源:bp-rbe-functions.php

示例15: bp_activity_new_comment_notification

/**
 * Sends an email notification and a BP notification when someone mentions you in an update
 *
 * @since BuddyPress (1.2)
 *
 * @param int $comment_id The comment id
 * @param int $commenter_id The unique user_id of the user who posted the comment
 * @param array $params {@link bp_activity_new_comment()}
 *
 * @uses bp_get_user_meta()
 * @uses bp_core_get_user_displayname()
 * @uses bp_activity_get_permalink()
 * @uses bp_core_get_user_domain()
 * @uses bp_get_settings_slug()
 * @uses bp_activity_filter_kses()
 * @uses bp_core_get_core_userdata()
 * @uses wp_specialchars_decode()
 * @uses get_blog_option()
 * @uses bp_get_root_blog_id()
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_to' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_subject' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_message' hook
 * @uses wp_mail()
 * @uses do_action() To call the 'bp_activity_sent_reply_to_update_email' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_to' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_subject' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_message' hook
 * @uses do_action() To call the 'bp_activity_sent_reply_to_reply_email' hook
 */
function bp_activity_new_comment_notification($comment_id, $commenter_id, $params)
{
    // Set some default parameters
    $activity_id = 0;
    $parent_id = 0;
    extract($params);
    $original_activity = new BP_Activity_Activity($activity_id);
    if ($original_activity->user_id != $commenter_id && 'no' != bp_get_user_meta($original_activity->user_id, 'notification_activity_new_reply', true)) {
        $poster_name = bp_core_get_user_displayname($commenter_id);
        $thread_link = bp_activity_get_permalink($activity_id);
        $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
        $settings_link = bp_core_get_user_domain($original_activity->user_id) . $settings_slug . '/notifications/';
        $poster_name = stripslashes($poster_name);
        $content = bp_activity_filter_kses(stripslashes($content));
        // Set up and send the message
        $ud = bp_core_get_core_userdata($original_activity->user_id);
        $to = $ud->user_email;
        $subject = bp_get_email_subject(array('text' => sprintf(__('%s replied to one of your updates', 'buddypress'), $poster_name)));
        $message = sprintf(__('%1$s replied to one of your updates:

"%2$s"

To view your original update and all comments, log in and visit: %3$s

---------------------
', 'buddypress'), $poster_name, $content, $thread_link);
        // Only show the disable notifications line if the settings component is enabled
        if (bp_is_active('settings')) {
            $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        }
        /* Send the message */
        $to = apply_filters('bp_activity_new_comment_notification_to', $to);
        $subject = apply_filters('bp_activity_new_comment_notification_subject', $subject, $poster_name);
        $message = apply_filters('bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link);
        wp_mail($to, $subject, $message);
        do_action('bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params);
    }
    /***
     * If this is a reply to another comment, send an email notification to the
     * author of the immediate parent comment.
     */
    if (empty($parent_id) || $activity_id == $parent_id) {
        return false;
    }
    $parent_comment = new BP_Activity_Activity($parent_id);
    if ($parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != bp_get_user_meta($parent_comment->user_id, 'notification_activity_new_reply', true)) {
        $poster_name = bp_core_get_user_displayname($commenter_id);
        $thread_link = bp_activity_get_permalink($activity_id);
        $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
        $settings_link = bp_core_get_user_domain($parent_comment->user_id) . $settings_slug . '/notifications/';
        // Set up and send the message
        $ud = bp_core_get_core_userdata($parent_comment->user_id);
        $to = $ud->user_email;
        $subject = bp_get_email_subject(array('text' => sprintf(__('%s replied to one of your comments', 'buddypress'), $poster_name)));
        $poster_name = stripslashes($poster_name);
        $content = bp_activity_filter_kses(stripslashes($content));
        $message = sprintf(__('%1$s replied to one of your comments:

"%2$s"

To view the original activity, your comment and all replies, log in and visit: %3$s

---------------------
', 'buddypress'), $poster_name, $content, $thread_link);
        // Only show the disable notifications line if the settings component is enabled
        if (bp_is_active('settings')) {
            $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        }
        /* Send the message */
        $to = apply_filters('bp_activity_new_comment_notification_comment_author_to', $to);
        $subject = apply_filters('bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name);
//.........这里部分代码省略.........
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:101,代码来源:bp-activity-notifications.php


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