本文整理汇总了PHP中bp_get_activity_content_body函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_activity_content_body函数的具体用法?PHP bp_get_activity_content_body怎么用?PHP bp_get_activity_content_body使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_activity_content_body函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buddyboss_global_search_activity_intro
/**
* Returns a trimmed activity content string.
* Must be used while inside activity loop
*/
function buddyboss_global_search_activity_intro($character_limit = 50)
{
$content = '';
if (bp_activity_has_content()) {
$content = bp_get_activity_content_body();
if ($content) {
$content = wp_strip_all_tags($content, true);
$shortened_content = substr($content, 0, $character_limit);
if (strlen($content) > $character_limit) {
$shortened_content .= '...';
}
$content = $shortened_content;
}
}
return apply_filters('buddyboss_global_search_activity_intro', $content);
}
示例2: widget
function widget($args, $instance) {
global $bp;
extract( $args );
echo $before_widget;
echo $before_title . $widget_name . $after_title;
if ( empty( $instance['max_posts'] ) || !$instance['max_posts'] )
$instance['max_posts'] = 10; ?>
<?php if ( bp_has_activities( 'action=new_blog_post&max=' . $instance['max_posts'] . '&per_page=' . $instance['max_posts'] ) ) : ?>
<ul id="blog-post-list" class="activity-list item-list">
<?php while ( bp_activities() ) : bp_the_activity(); ?>
<li>
<div class="activity-content" style="margin: 0">
<div class="activity-header">
<?php bp_activity_action() ?>
</div>
<?php if ( bp_get_activity_content_body() ) : ?>
<div class="activity-inner">
<?php bp_activity_content_body() ?>
</div>
<?php endif; ?>
</div>
</li>
<?php endwhile; ?>
</ul>
<?php else : ?>
<div id="message" class="info">
<p><?php _e( 'Sorry, there were no blog posts found. Why not write one?', 'buddypress' ) ?></p>
</div>
<?php endif; ?>
<?php echo $after_widget; ?>
<?php
}
示例3: get_activity
/**
* get_activity function.
*
* @access public
* @param mixed $filter
* @return void
*/
public function get_activity($filter)
{
$args = $filter;
if (bp_has_activities($args)) {
while (bp_activities()) {
bp_the_activity();
$activity = array('avatar' => bp_core_fetch_avatar(array('html' => false, 'item_id' => bp_get_activity_id())), 'action' => bp_get_activity_action(), 'content' => bp_get_activity_content_body(), 'activity_id' => bp_get_activity_id(), 'activity_username' => bp_core_get_username(bp_get_activity_user_id()), 'user_id' => bp_get_activity_user_id(), 'comment_count' => bp_activity_get_comment_count(), 'can_comment' => bp_activity_can_comment(), 'can_favorite' => bp_activity_can_favorite(), 'is_favorite' => bp_get_activity_is_favorite(), 'can_delete' => bp_activity_user_can_delete());
$activity = apply_filters('bp_json_prepare_activity', $activity);
$activities[] = $activity;
}
$data = array('activity' => $activities, 'has_more_items' => bp_activity_has_more_items());
$data = apply_filters('bp_json_prepare_activities', $data);
} else {
return new WP_Error('bp_json_activity', __('No Activity Found.', 'buddypress'), array('status' => 200));
}
$response = new WP_REST_Response();
$response->set_data($data);
$response = rest_ensure_response($response);
return $response;
}
示例4: bp_get_activity_pagination_links
if (bp_get_activity_pagination_links()) {
?>
<div class="buddystream_album_navigation">
<?php
echo bp_get_activity_pagination_links();
?>
</div>
<?php
}
?>
<div class="buddystream_album">
<?php
while (bp_activities()) {
bp_the_activity();
$content = strip_tags(bp_get_activity_content_body(), "<a><img>");
echo $content;
}
?>
</div>
<?php
if (bp_get_activity_pagination_links()) {
?>
<div class="buddystream_album_navigation">
<?php
echo bp_get_activity_pagination_links();
?>
</div>
<?php
}
示例5: bp_activity_avatar
<?php
bp_activity_avatar('type=full&width=100&height=100');
?>
</a>
</div>
<div class="activity-content">
<div class="activity-header">
<?php
bp_activity_action();
?>
</div>
<?php
if (bp_get_activity_content_body()) {
?>
<div class="activity-inner">
<?php
bp_activity_content_body();
?>
</div>
<?php
}
?>
<?php
do_action('bp_activity_entry_content');
?>
<div class="activity-meta">
示例6: widget
/**
* Display the networkwide posts widget.
*
* @see WP_Widget::widget() for description of parameters.
*
* @param array $args Widget arguments.
* @param array $instance Widget settings, as saved by the user.
*/
public function widget($args, $instance)
{
$title = !empty($instance['title']) ? esc_html($instance['title']) : __('Recent Networkwide Posts', 'buddypress');
if (!empty($instance['link_title'])) {
$title = '<a href="' . bp_get_blogs_directory_permalink() . '">' . esc_html($title) . '</a>';
}
/**
* Filters the Blogs Recent Posts widget title.
*
* @since BuddyPress (2.2.0)
* @since BuddyPress (2.3.0) Added 'instance' and 'id_base' to arguments passed to filter.
*
* @param string $title The widget title.
* @param array $instance The settings for the particular instance of the widget.
* @param string $id_base Root ID for all widgets of this type.
*/
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
echo $args['before_widget'];
echo $args['before_title'] . $title . $args['after_title'];
if (empty($instance['max_posts']) || empty($instance['max_posts'])) {
$instance['max_posts'] = 10;
}
// Override some of the contextually set parameters for bp_has_activities()
$args = array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false);
?>
<?php
if (bp_has_activities($args)) {
?>
<ul id="blog-post-list" class="activity-list item-list">
<?php
while (bp_activities()) {
bp_the_activity();
?>
<li>
<div class="activity-content" style="margin: 0">
<div class="activity-header"><?php
bp_activity_action();
?>
</div>
<?php
if (bp_get_activity_content_body()) {
?>
<div class="activity-inner"><?php
bp_activity_content_body();
?>
</div>
<?php
}
?>
</div>
</li>
<?php
}
?>
</ul>
<?php
} else {
?>
<div id="message" class="info">
<p><?php
_e('Sorry, there were no posts found. Why not write one?', 'buddypress');
?>
</p>
</div>
<?php
}
?>
<?php
echo $args['after_widget'];
?>
<?php
}
示例7: while
while (bp_activities()) {
bp_the_activity();
$output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">';
$output .= '<div class="activity-avatar rounded">';
$output .= '<a class="kleo-activity-avatar" title="' . __('View Profile', 'kleo_framework') . '" href="' . bp_get_activity_user_link() . '">';
$output .= bp_get_activity_avatar();
$output .= '</a>';
$output .= '</div>';
// activity content
$output .= '<div class="activity-content">';
$output .= '<div class="activity-header">';
$output .= bp_get_activity_action();
$output .= '</div>';
$output .= '<div class="activity-inner">';
if (bp_activity_has_content()) {
$output .= bp_get_activity_content_body();
}
$output .= '</div>';
$output .= '<div class="activity-meta">';
if (bp_get_activity_type() == 'activity_comment') {
$output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'buddypress') . '">' . __('View Conversation', 'buddypress') . '</a>';
}
if (is_user_logged_in()) {
if (bp_activity_can_favorite()) {
if (!bp_get_activity_is_favorite()) {
$output .= '<a href="' . bp_get_activity_favorite_link() . '" class="fav bp-secondary-action" title="' . esc_attr(__('Mark as Favorite', 'buddypress')) . '"></a>';
} else {
$output .= '<a href="' . bp_get_activity_unfavorite_link() . '" class="unfav bp-secondary-action" title="' . esc_attr(__('Remove Favorite', 'buddypress')) . '"></a>';
}
}
if (bp_activity_user_can_delete()) {
示例8: GetBuddyPressRating
private function GetBuddyPressRating($ver, $horAlign = true)
{
RWLogger::LogEnterence('GetBuddyPressRating');
global $activities_template;
// Set current activity-comment to current activity update (recursive comments).
$this->current_comment = $activities_template->activity;
$rclass = str_replace('_', '-', bp_get_activity_type());
$is_forum_topic = $rclass === 'new-forum-topic';
if ($is_forum_topic && !$this->IsBBPressInstalled()) {
return false;
}
if (!in_array($rclass, array('forum-post', 'forum-reply', 'new-forum-post', 'user-forum-post', 'user', 'activity-update', 'user-activity-update', 'activity-comment', 'user-activity-comment'))) {
// If unknown activity type, change it to activity update.
$rclass = 'activity-update';
}
if ($is_forum_topic) {
$rclass = 'new-forum-post';
}
// Check if item rating is top positioned.
if (!isset($this->activity_align[$rclass]) || $ver !== $this->activity_align[$rclass]->ver) {
return false;
}
// Get item id.
$item_id = 'activity-update' === $rclass || 'activity-comment' === $rclass ? bp_get_activity_id() : bp_get_activity_secondary_item_id();
if ($is_forum_topic) {
// If forum topic, then we must extract post id
// from forum posts table, because secondary_item_id holds
// topic id.
if (function_exists('bb_get_first_post')) {
$post = bb_get_first_post($item_id);
} else {
// Extract post id straight from the BB DB.
global $bb_table_prefix;
// Load bbPress config file.
@(include_once WP_RW__BBP_CONFIG_LOCATION);
// Failed loading config file.
if (!defined('BBDB_NAME')) {
return false;
}
$connection = null;
if (!($connection = mysql_connect(BBDB_HOST, BBDB_USER, BBDB_PASSWORD, true))) {
return false;
}
if (!mysql_selectdb(BBDB_NAME, $connection)) {
return false;
}
$results = mysql_query("SELECT * FROM {$bb_table_prefix}posts WHERE topic_id={$item_id} AND post_position=1", $connection);
$post = mysql_fetch_object($results);
}
if (!isset($post->post_id) && empty($post->post_id)) {
return false;
}
$item_id = $post->post_id;
}
// If the item is post, queue rating with post title.
$title = 'new-blog-post' === $rclass ? get_the_title($item_id) : bp_get_activity_content_body();
// $activities_template->activity->content;
$options = array();
$owner_id = bp_get_activity_user_id();
// Add accumulator id if user accumulated rating.
if ($this->IsUserAccumulatedRating()) {
$options['uarid'] = $this->_getUserRatingGuid($owner_id);
}
return $this->EmbedRatingIfVisible($item_id, $owner_id, strip_tags($title), bp_activity_get_permalink(bp_get_activity_id()), $rclass, false, $horAlign ? $this->activity_align[$rclass]->hor : false, false, $options, false);
}
示例9: while
<?php
if (bp_has_activities(bpgr_user_previous_review_args())) {
while (bp_activities()) {
bp_the_activity();
?>
<div class="already-rated">
<h5><?php
printf(__("You rated %s on %s.", 'bpgr'), bp_get_group_name(), bpgr_get_activity_date_recorded());
?>
</h5>
<blockquote>
<?php
echo bp_get_activity_content_body();
?>
<div class="rest-stars">
<?php
echo bpgr_get_review_rating_html(bpgr_get_review_rating());
?>
</div>
</blockquote>
<p><?php
_e("To leave another review, you must delete your existing review.", 'bpgr');
?>
<?php
bp_activity_delete_link();
示例10: bp_get_activity_content
/**
* Return the activity content
*
* @since 1.0.0
* @deprecated 1.5.0
*
* @todo properly deprecate this function
*
* @global object $activities_template {@link BP_Activity_Template}
* @uses bp_get_activity_action()
* @uses bp_get_activity_content_body()
* @uses apply_filters() To call the 'bp_get_activity_content' hook
*
* @return string The activity content
*/
function bp_get_activity_content()
{
global $activities_template;
/**
* If you want to filter activity update content, please use
* the filter 'bp_get_activity_content_body'
*
* This function is mainly for backwards comptibility.
*/
$content = bp_get_activity_action() . ' ' . bp_get_activity_content_body();
return apply_filters('bp_get_activity_content', $content);
}
示例11: widget
function widget($args, $instance)
{
extract($args);
echo $before_widget;
echo $before_title . $widget_name . $after_title;
if (empty($instance['max_posts']) || !$instance['max_posts']) {
$instance['max_posts'] = 10;
}
?>
<?php
/* Override some of the contextually set parameters for bp_has_activities() */
?>
<?php
if (bp_has_activities(array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false))) {
?>
<ul id="blog-post-list" class="activity-list item-list">
<?php
while (bp_activities()) {
bp_the_activity();
?>
<li>
<div class="activity-content" style="margin: 0">
<div class="activity-header">
<?php
bp_activity_action();
?>
</div>
<?php
if (bp_get_activity_content_body()) {
?>
<div class="activity-inner">
<?php
bp_activity_content_body();
?>
</div>
<?php
}
?>
</div>
</li>
<?php
}
?>
</ul>
<?php
} else {
?>
<div id="message" class="info">
<p><?php
_e('Sorry, there were no posts found. Why not write one?', 'buddypress');
?>
</p>
</div>
<?php
}
?>
<?php
echo $after_widget;
?>
<?php
}
示例12: widget
/**
* Display the networkwide posts widget.
*
* @see WP_Widget::widget() for description of parameters.
*
* @param array $args Widget arguments.
* @param array $instance Widget settings, as saved by the user.
*/
function widget($args, $instance)
{
$title = !empty($instance['title']) ? esc_html($instance['title']) : __('Recent Networkwide Posts', 'buddypress');
if (!empty($instance['link_title'])) {
$title = '<a href="' . trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug()) . '">' . esc_html($title) . '</a>';
}
echo $args['before_widget'];
echo $args['before_title'] . $title . $args['after_title'];
if (empty($instance['max_posts']) || !$instance['max_posts']) {
$instance['max_posts'] = 10;
}
?>
<?php
// Override some of the contextually set parameters for bp_has_activities()
?>
<?php
if (bp_has_activities(array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false))) {
?>
<ul id="blog-post-list" class="activity-list item-list">
<?php
while (bp_activities()) {
bp_the_activity();
?>
<li>
<div class="activity-content" style="margin: 0">
<div class="activity-header">
<?php
bp_activity_action();
?>
</div>
<?php
if (bp_get_activity_content_body()) {
?>
<div class="activity-inner">
<?php
bp_activity_content_body();
?>
</div>
<?php
}
?>
</div>
</li>
<?php
}
?>
</ul>
<?php
} else {
?>
<div id="message" class="info">
<p><?php
_e('Sorry, there were no posts found. Why not write one?', 'buddypress');
?>
</p>
</div>
<?php
}
?>
<?php
echo $args['after_widget'];
?>
<?php
}
示例13: gears_get_activity_stream
/**
* @deprecated gears_get_activity_stream
*/
function gears_get_activity_stream()
{
$output = '';
$output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">';
$output .= '<div class="activity-avatar">';
$output .= '<a class="gears-activity-avatar" title="' . __('View Profile', 'gears') . '" href="' . bp_get_activity_user_link() . '">';
$output .= bp_get_activity_avatar();
$output .= '</a>';
$output .= '</div>';
// activity content
$output .= '<div class="activity-content">';
$output .= '<div class="activity-header">';
$output .= bp_get_activity_action();
$output .= '</div>';
$output .= '<div class="activity-inner">';
if (bp_activity_has_content()) {
$output .= bp_get_activity_content_body();
}
$output .= '</div>';
do_action('bp_activity_entry_content');
$output .= '<div class="activity-meta">';
if (bp_get_activity_type() == 'activity_comment') {
$output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears') . '</a>';
}
if (is_user_logged_in()) {
if (bp_activity_can_favorite()) {
if (!bp_get_activity_is_favorite()) {
$output .= '<a href="' . bp_get_activity_favorite_link() . '" class="fav bp-secondary-action" title="' . esc_attr(__('Mark as Favorite', 'gears')) . '">' . __('Favorite', 'gears') . '</a>';
} else {
$output .= '<a href="' . bp_get_activity_unfavorite_link() . '" class="unfav bp-secondary-action" title="' . esc_attr(__('Remove Favorite', 'gears')) . '">' . __('Remove Favorite', 'gears') . '</a>';
}
}
if (bp_activity_user_can_delete()) {
$output .= bp_get_activity_delete_link();
}
do_action('bp_activity_entry_meta');
}
$output .= '</div>';
if (bp_get_activity_type() == 'activity_comment') {
$output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears');
}
// end bp_get_activity_type()
$output .= '</div>';
// end activity content
$output .= '</li>';
return $output;
}
示例14: BuddystreamShareButton
function BuddystreamShareButton()
{
$buddyStreamExtensions = new BuddyStreamExtensions();
$shares = array();
foreach ($buddyStreamExtensions->getExtensionsConfigs() as $extension) {
if (get_site_option("buddystream_" . $extension['name'] . "_share") == "on") {
$shares[] = $extension['name'];
}
}
$shares = implode(',', $shares);
echo '<a href="' . BP_BUDDYSTREAM_URL . '/extensions/default/templates/ShareBox.php?content=' . urlencode(strip_tags(bp_get_activity_content_body())) . '&link=' . urlencode(bp_get_activity_thread_permalink()) . '&shares=' . $shares . ' " class="bs_lightbox button item-button">Sharebox!</a>';
}
示例15: GetBuddyPressRating
private function GetBuddyPressRating($ver, $horAlign = true)
{
if (RWLogger::IsOn()) {
$params = func_get_args();
RWLogger::LogEnterence("GetBuddyPressRating", $params);
}
global $activities_template;
// Set current activity-comment to current activity update (recursive comments).
$this->current_comment = $activities_template->activity;
$rclass = str_replace("_", "-", bp_get_activity_type());
$is_forum_topic = $rclass === "new-forum-topic";
if ($is_forum_topic && !$this->IsBBPressInstalled()) {
return false;
}
if ($is_forum_topic) {
$rclass = "new-forum-post";
}
// Check if item rating is top positioned.
if (!isset($this->activity_align[$rclass]) || $ver !== $this->activity_align[$rclass]->ver) {
return false;
}
// Get item id.
$item_id = "activity-update" === $rclass || "activity-comment" === $rclass ? bp_get_activity_id() : bp_get_activity_secondary_item_id();
if ($is_forum_topic) {
// If forum topic, then we must extract post id
// from forum posts table, because secondary_item_id holds
// topic id.
if (function_exists("bb_get_first_post")) {
$post = bb_get_first_post($item_id);
} else {
// Extract post id straight from the BB DB.
global $bb_table_prefix;
// Load bbPress config file.
@(include_once WP_RW__BBP_CONFIG_LOCATION);
// Failed loading config file.
if (!defined("BBDB_NAME")) {
return false;
}
$connection = null;
if (!($connection = mysql_connect(BBDB_HOST, BBDB_USER, BBDB_PASSWORD, true))) {
return false;
}
if (!mysql_selectdb(BBDB_NAME, $connection)) {
return false;
}
$results = mysql_query("SELECT * FROM {$bb_table_prefix}posts WHERE topic_id={$item_id} AND post_position=1", $connection);
$post = mysql_fetch_object($results);
}
if (!isset($post->post_id) && empty($post->post_id)) {
return false;
}
$item_id = $post->post_id;
}
// If the item is post, queue rating with post title.
$title = "new-blog-post" === $rclass ? get_the_title($item_id) : bp_get_activity_content_body();
// $activities_template->activity->content;
$options = array();
$owner_id = bp_get_activity_user_id();
// Add accumulator id if user accumulated rating.
if ($this->IsUserAccumulatedRating()) {
$options['uarid'] = $this->_getUserRatingGuid($owner_id);
}
return $this->EmbedRatingIfVisible($item_id, $owner_id, strip_tags($title), bp_activity_get_permalink(bp_get_activity_id()), $rclass, false, $horAlign ? $this->activity_align[$rclass]->hor : false, false, $options, false);
/*
// Queue activity rating.
$this->QueueRatingData($urid, strip_tags($title), bp_activity_get_permalink($activities_template->activity->id), $rclass);
// Return rating html container.
return '<div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $urid . '"></div>';*/
}