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


PHP bp_is_single_activity函数代码示例

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


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

示例1: test_activity_permalink

 /**
  * Can't test using bp_activity_get_permalink(); see bp_activity_action_permalink_router().
  */
 function test_activity_permalink()
 {
     $a = $this->factory->activity->create();
     $activity = $this->factory->activity->get_object_by_id($a);
     $url = bp_core_get_user_domain($activity->user_id) . bp_get_activity_slug() . '/' . $activity->id . '/';
     $this->go_to($url);
     $this->assertTrue(bp_is_single_activity());
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:11,代码来源:activity.php

示例2: activity_loop_link

 function activity_loop_link()
 {
     $act_type = bp_get_activity_type();
     if (empty($this->types_map[$act_type])) {
         return;
     }
     $args = array('type' => $this->types_map[$act_type], 'id' => bp_get_activity_item_id(), 'id2' => bp_get_activity_secondary_item_id(), 'author_id' => bp_get_activity_user_id(), 'is_main_content' => bp_is_single_activity(), 'context' => 'activity-loop', 'custom_class' => 'button');
     $args = apply_filters("bp_moderation_activity_loop_link_args_{$act_type}", $args);
     if ($args) {
         echo $this->generate_link($args);
     }
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:12,代码来源:bpModFrontend.php

示例3: bp_activity_admin_menu

/**
 * Add the Activity top-level menu link when viewing single activity item.
 *
 * @since 2.6.0
 *
 * @return null Null if user does not have access to editing functionality.
 */
function bp_activity_admin_menu()
{
    global $wp_admin_bar;
    // Only show if viewing a single activity item.
    if (!bp_is_single_activity()) {
        return;
    }
    // Only show this menu to super admins
    if (!bp_current_user_can('bp_moderate')) {
        return;
    }
    $activity_edit_link = add_query_arg(array('page' => 'bp-activity', 'aid' => bp_current_action(), 'action' => 'edit'), bp_get_admin_url('admin.php'));
    // Add the top-level Edit Activity button.
    $wp_admin_bar->add_menu(array('id' => 'activity-admin', 'title' => __('Edit Activity', 'buddypress'), 'href' => esc_url($activity_edit_link)));
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:22,代码来源:bp-activity-adminbar.php

示例4: bp_activity_embed_add_inline_styles

/**
 * Add inline styles for BP activity embeds.
 *
 * @since  2.6.0
 */
function bp_activity_embed_add_inline_styles()
{
    if (false === bp_is_single_activity()) {
        return;
    }
    $min = bp_core_get_minified_asset_suffix();
    if (is_rtl()) {
        $css = bp_locate_template_asset("css/embeds-activity-rtl{$min}.css");
    } else {
        $css = bp_locate_template_asset("css/embeds-activity{$min}.css");
    }
    // Bail if file wasn't found.
    if (false === $css) {
        return;
    }
    // Grab contents of CSS file and do some rudimentary CSS protection.
    $css = file_get_contents($css['file']);
    $css = wp_kses($css, array("\\'", '\\"'));
    printf('<style type="text/css">%s</style>', $css);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:25,代码来源:bp-activity-embeds.php

示例5: is_activity

 /**
  * Set up the theme compatibility hooks, if we're looking at an activity page.
  *
  * @since 1.7.0
  */
 public function is_activity()
 {
     // Bail if not looking at a group.
     if (!bp_is_activity_component()) {
         return;
     }
     // Activity Directory.
     if (!bp_displayed_user_id() && !bp_current_action()) {
         bp_update_is_directory(true, 'activity');
         /** This action is documented in bp-activity/bp-activity-screens.php */
         do_action('bp_activity_screen_index');
         add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'directory_content'));
         // Single activity.
     } elseif (bp_is_single_activity()) {
         add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'single_dummy_content'));
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:26,代码来源:class-bp-activity-theme-compat.php

示例6: is_members

 /**
  * Are we looking at something that needs members theme compatibility?
  *
  * @since 1.7.0
  */
 public function is_members()
 {
     // Bail if not looking at the members component or a user's page.
     if (!bp_is_members_component() && !bp_is_user()) {
         return;
     }
     // Members Directory.
     if (!bp_current_action() && !bp_current_item()) {
         bp_update_is_directory(true, 'members');
         /**
          * Fires if looking at Members directory when needing theme compat.
          *
          * @since 1.5.0
          */
         do_action('bp_members_screen_index');
         add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'directory_content'));
         // User page.
     } elseif (bp_is_user()) {
         // If we're on a single activity permalink page, we shouldn't use the members
         // template, so stop here!
         if (bp_is_active('activity') && bp_is_single_activity()) {
             return;
         }
         /**
          * Fires if looking at Members user page when needing theme compat.
          *
          * @since 1.5.0
          */
         do_action('bp_members_screen_display_profile');
         add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'single_dummy_content'));
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:41,代码来源:class-bp-members-theme-compat.php

示例7: bp_core_filter_wp_query

/**
 * Stop WordPress performing a DB query for its main loop.
 *
 * As of WordPress 4.6, it is possible to bypass the main WP_Query entirely.
 * This saves us one unnecessary database query! :)
 *
 * @since 2.7.0
 *
 * @param  null     $retval Current return value for filter.
 * @param  WP_Query $query  Current WordPress query object.
 * @return null|array
 */
function bp_core_filter_wp_query($retval, $query)
{
    if (!$query->is_main_query()) {
        return $retval;
    }
    /*
     * If not on a BP single page, bail.
     * Too early to use bp_is_single_item(), so use BP conditionals.
     */
    if (false === (bp_is_group() || bp_is_user() || bp_is_single_activity())) {
        return $retval;
    }
    // Set default properties as recommended in the 'posts_pre_query' DocBlock.
    $query->found_posts = 0;
    $query->max_num_pages = 0;
    // Return something other than a null value to bypass WP_Query.
    return array();
}
开发者ID:buddypress,项目名称:BuddyPress-build,代码行数:30,代码来源:bp-core-catchuri.php

示例8: bp_get_the_post_class

/**
 * Customizes the post CSS class according to BuddyPress content.
 *
 * Hooked to the 'post_class' filter.
 *
 * @since BuddyPress (2.1.0)
 *
 * @param array $wp_classes The post classes coming from WordPress.
 * @return array
 */
function bp_get_the_post_class($wp_classes = array())
{
    // don't do anything if we're not on a BP page
    if (!is_buddypress()) {
        return $wp_classes;
    }
    $bp_classes = array();
    if (bp_is_user() || bp_is_single_activity()) {
        $bp_classes[] = 'bp_members';
    } elseif (bp_is_group()) {
        $bp_classes[] = 'bp_group';
    } elseif (bp_is_activity_component()) {
        $bp_classes[] = 'bp_activity';
    } elseif (bp_is_blogs_component()) {
        $bp_classes[] = 'bp_blogs';
    } elseif (bp_is_register_page()) {
        $bp_classes[] = 'bp_register';
    } elseif (bp_is_activation_page()) {
        $bp_classes[] = 'bp_activate';
    } elseif (bp_is_forums_component() && bp_is_directory()) {
        $bp_classes[] = 'bp_forum';
    }
    if (empty($bp_classes)) {
        return $wp_classes;
    }
    // emulate post type css class
    foreach ($bp_classes as $bp_class) {
        $bp_classes[] = "type-{$bp_class}";
    }
    // removes the 'page' and 'type-page' post classes
    // we need to remove these classes since they did not exist before we switched
    // theme compat to use the 'page' post type
    $page_key = array_search('page', $wp_classes);
    $page_type_key = array_search('type-page', $wp_classes);
    unset($wp_classes[$page_key], $wp_classes[$page_type_key]);
    // okay let's merge!
    return array_unique(array_merge($bp_classes, $wp_classes));
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:48,代码来源:bp-core-template.php

示例9: bp_activity_truncate_entry

/**
 * Truncate long activity entries when viewed in activity streams.
 *
 * This method can only be used inside the Activity loop.
 *
 * @since 1.5.0
 *
 * @uses bp_is_single_activity()
 * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook.
 * @uses apply_filters() To call the 'bp_activity_excerpt_length' hook.
 * @uses bp_create_excerpt()
 * @uses bp_get_activity_id()
 * @uses bp_get_activity_thread_permalink()
 * @uses apply_filters() To call the 'bp_activity_truncate_entry' hook.
 *
 * @param string $text The original activity entry text.
 * @return string $excerpt The truncated text.
 */
function bp_activity_truncate_entry($text)
{
    global $activities_template;
    /**
     * Provides a filter that lets you choose whether to skip this filter on a per-activity basis.
     *
     * @since 2.3.0
     *
     * @param bool $value If true, text should be checked to see if it needs truncating.
     */
    $maybe_truncate_text = apply_filters('bp_activity_maybe_truncate_entry', isset($activities_template->activity->type) && !in_array($activities_template->activity->type, array('new_blog_post'), true));
    // The full text of the activity update should always show on the single activity screen.
    if (!$maybe_truncate_text || bp_is_single_activity()) {
        return $text;
    }
    /**
     * Filters the appended text for the activity excerpt.
     *
     * @since 1.5.0
     *
     * @param string $value Internationalized "Read more" text.
     */
    $append_text = apply_filters('bp_activity_excerpt_append_text', __('[Read more]', 'buddypress'));
    /**
     * Filters the excerpt length for the activity excerpt.
     *
     * @since 1.5.0
     *
     * @param int $value Number indicating how many words to trim the excerpt down to.
     */
    $excerpt_length = apply_filters('bp_activity_excerpt_length', 358);
    // Run the text through the excerpt function. If it's too short, the original text will be returned.
    $excerpt = bp_create_excerpt($text, $excerpt_length, array('ending' => __('&hellip;', 'buddypress')));
    /*
     * If the text returned by bp_create_excerpt() is different from the original text (ie it's
     * been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping
     * shortcodes, so we have strip them from the $text before the comparison.
     */
    if ($excerpt != strip_shortcodes($text)) {
        $id = !empty($activities_template->activity->current_comment->id) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
        $excerpt = sprintf('%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text);
    }
    /**
     * Filters the composite activity excerpt entry.
     *
     * @since 1.5.0
     *
     * @param string $excerpt     Excerpt text and markup to be displayed.
     * @param string $text        The original activity entry text.
     * @param string $append_text The final append text applied.
     */
    return apply_filters('bp_activity_truncate_entry', $excerpt, $text, $append_text);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:71,代码来源:bp-activity-filters.php

示例10: bp_get_the_body_class


//.........这里部分代码省略.........
    }
    if (bp_is_user_recent_commments()) {
        $bp_classes[] = 'recent-comments';
    }
    if (bp_is_user_recent_posts()) {
        $bp_classes[] = 'recent-posts';
    }
    if (bp_is_user_change_avatar()) {
        $bp_classes[] = 'change-avatar';
    }
    if (bp_is_user_profile_edit()) {
        $bp_classes[] = 'profile-edit';
    }
    if (bp_is_user_friends_activity()) {
        $bp_classes[] = 'friends-activity';
    }
    if (bp_is_user_groups_activity()) {
        $bp_classes[] = 'groups-activity';
    }
    if (is_user_logged_in()) {
        $bp_classes[] = 'logged-in';
    }
    /** Messages **********************************************************/
    if (bp_is_messages_inbox()) {
        $bp_classes[] = 'inbox';
    }
    if (bp_is_messages_sentbox()) {
        $bp_classes[] = 'sentbox';
    }
    if (bp_is_messages_compose_screen()) {
        $bp_classes[] = 'compose';
    }
    if (bp_is_notices()) {
        $bp_classes[] = 'notices';
    }
    if (bp_is_user_friend_requests()) {
        $bp_classes[] = 'friend-requests';
    }
    if (bp_is_create_blog()) {
        $bp_classes[] = 'create-blog';
    }
    /** Groups ************************************************************/
    if (bp_is_group_leave()) {
        $bp_classes[] = 'leave-group';
    }
    if (bp_is_group_invites()) {
        $bp_classes[] = 'group-invites';
    }
    if (bp_is_group_members()) {
        $bp_classes[] = 'group-members';
    }
    if (bp_is_group_forum_topic()) {
        $bp_classes[] = 'group-forum-topic';
    }
    if (bp_is_group_forum_topic_edit()) {
        $bp_classes[] = 'group-forum-topic-edit';
    }
    if (bp_is_group_forum()) {
        $bp_classes[] = 'group-forum';
    }
    if (bp_is_group_admin_page()) {
        $bp_classes[] = 'group-admin';
    }
    if (bp_is_group_create()) {
        $bp_classes[] = 'group-create';
    }
    if (bp_is_group_home()) {
        $bp_classes[] = 'group-home';
    }
    if (bp_is_single_activity()) {
        $bp_classes[] = 'activity-permalink';
    }
    /** Registration ******************************************************/
    if (bp_is_register_page()) {
        $bp_classes[] = 'registration';
    }
    if (bp_is_activation_page()) {
        $bp_classes[] = 'activation';
    }
    /** Current Component & Action ****************************************/
    if (!bp_is_blog_page()) {
        $bp_classes[] = bp_current_component();
        $bp_classes[] = bp_current_action();
    }
    /** Clean up***********************************************************/
    // We don't want NXTClass blog classes to appear on non-blog pages.
    if (!bp_is_blog_page()) {
        // Preserve any custom classes already set
        if (!empty($custom_classes)) {
            $nxt_classes = (array) $custom_classes;
        } else {
            $nxt_classes = array();
        }
    }
    // Merge nxt classes with BP classes
    $classes = array_merge((array) $bp_classes, (array) $nxt_classes);
    // Remove any duplicates
    $classes = array_unique($classes);
    return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $nxt_classes, $custom_classes);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:101,代码来源:bp-core-template.php

示例11: bp_insert_activity_meta

/**
 * Insert activity meta
 *
 * @since 1.2.0
 *
 * @param string $content
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @global object $bp BuddyPress global settings
 * @uses bp_core_time_since()
 * @uses apply_filters_ref_array() To call the 'bp_activity_time_since' hook
 * @uses bp_is_single_activity()
 * @uses bp_activity_get_permalink()
 * @uses esc_attr__()
 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink' hook
 * @uses apply_filters() To call the 'bp_insert_activity_meta' hook
 *
 * @return string The activity content
 */
function bp_insert_activity_meta($content)
{
    global $activities_template, $bp;
    // Strip any legacy time since placeholders from BP 1.0-1.1
    $content = str_replace('<span class="time-since">%s</span>', '', $content);
    // Insert the time since.
    $time_since = apply_filters_ref_array('bp_activity_time_since', array('<span class="time-since">' . bp_core_time_since($activities_template->activity->date_recorded) . '</span>', &$activities_template->activity));
    // Insert the permalink
    if (!bp_is_single_activity()) {
        $content = apply_filters_ref_array('bp_activity_permalink', array(sprintf('%1$s <a href="%2$s" class="view activity-time-since" title="%3$s">%4$s</a>', $content, bp_activity_get_permalink($activities_template->activity->id, $activities_template->activity), esc_attr__('View Discussion', 'buddypress'), $time_since), &$activities_template->activity));
    } else {
        $content .= str_pad($time_since, strlen($time_since) + 2, ' ', STR_PAD_BOTH);
    }
    return apply_filters('bp_insert_activity_meta', $content);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:34,代码来源:bp-activity-template.php

示例12: bp_checkins_display_user_checkin

function bp_checkins_display_user_checkin()
{
    if ((int) bp_get_option('bp-checkins-disable-activity-checkins') && !bp_is_current_component('checkins') && !bp_is_current_action('checkins') && !bp_is_single_activity() || (int) bp_get_option('bp-checkins-disable-activity-checkins') && bp_is_single_activity() && (!(int) bp_get_option('bp-checkins-activate-component') || '' == bp_get_option('bp-checkins-activate-component'))) {
        return false;
    }
    $activity_id = bp_get_activity_id();
    $activity_permalink = bp_activity_get_permalink($activity_id) . '?map=1';
    $address = bp_activity_get_meta($activity_id, 'bpci_activity_address');
    if ($address) {
        ?>
		<div class="activity-checkin">
			<a href="<?php 
        echo $activity_permalink;
        ?>
" title="<?php 
        _e('Open the map for this update', 'bp-checkins');
        ?>
" class="link-checkin"><span class="update-checkin"><?php 
        echo stripslashes($address);
        ?>
</span></a>
		</div>
		<?php 
    }
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:25,代码来源:bp-checkins-shared.php

示例13: embed_comments_button

    /**
     * Prints the markup for the activity embed comments button.
     *
     * Basically a copy of {@link print_embed_comments_button()}, but modified for
     * the BP activity component.
     *
     * @since 2.6.0
     */
    public function embed_comments_button()
    {
        if (!did_action('bp_embed_content') || !bp_is_single_activity()) {
            return;
        }
        // Make sure our custom permalink shows up in the 'WordPress Embed' block.
        add_filter('the_permalink', array($this, 'filter_embed_url'));
        // Only show comment bubble if we have some activity comments.
        $count = bp_activity_get_comment_count();
        if (empty($count)) {
            return;
        }
        ?>

		<div class="wp-embed-comments">
			<a href="<?php 
        bp_activity_thread_permalink();
        ?>
">
				<span class="dashicons dashicons-admin-comments"></span>
				<?php 
        printf(_n('%s <span class="screen-reader-text">Comment</span>', '%s <span class="screen-reader-text">Comments</span>', $count, 'buddypress'), number_format_i18n($count));
        ?>
			</a>
		</div>

	<?php 
    }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:36,代码来源:class-bp-activity-oembed-extension.php

示例14: bp_activity_truncate_entry

/**
 * Truncates long activity entries when viewed in activity streams
 *
 * @since 1.5.0
 *
 * @param $text The original activity entry text
 *
 * @uses bp_is_single_activity()
 * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook
 * @uses apply_filters() To call the 'bp_activity_excerpt_length' hook
 * @uses bp_create_excerpt()
 * @uses bp_get_activity_id()
 * @uses bp_get_activity_thread_permalink()
 * @uses apply_filters() To call the 'bp_activity_truncate_entry' hook
 *
 * @return string $excerpt The truncated text
 */
function bp_activity_truncate_entry($text)
{
    global $activities_template;
    // The full text of the activity update should always show on the single activity screen
    if (bp_is_single_activity()) {
        return $text;
    }
    $append_text = apply_filters('bp_activity_excerpt_append_text', __('[Read more]', 'buddypress'));
    $excerpt_length = apply_filters('bp_activity_excerpt_length', 358);
    // Run the text through the excerpt function. If it's too short, the original text will be
    // returned.
    $excerpt = bp_create_excerpt($text, $excerpt_length, array('ending' => __('&hellip;', 'buddypress')));
    // If the text returned by bp_create_excerpt() is different from the original text (ie it's
    // been truncated), add the "Read More" link.
    if ($excerpt != $text) {
        $id = !empty($activities_template->activity->current_comment->id) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
        $excerpt = sprintf('%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text);
    }
    return apply_filters('bp_activity_truncate_entry', $excerpt, $text, $append_text);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:37,代码来源:bp-activity-filters.php

示例15: bp_get_the_post_class

/**
 * Customizes the post CSS class according to BuddyPress content.
 *
 * Hooked to the 'post_class' filter.
 *
 * @since 2.1.0
 *
 * @param array $wp_classes The post classes coming from WordPress.
 * @return array
 */
function bp_get_the_post_class($wp_classes = array())
{
    // Don't do anything if we're not on a BP page.
    if (!is_buddypress()) {
        return $wp_classes;
    }
    $bp_classes = array();
    if (bp_is_user() || bp_is_single_activity()) {
        $bp_classes[] = 'bp_members';
    } elseif (bp_is_group()) {
        $bp_classes[] = 'bp_group';
    } elseif (bp_is_activity_component()) {
        $bp_classes[] = 'bp_activity';
    } elseif (bp_is_blogs_component()) {
        $bp_classes[] = 'bp_blogs';
    } elseif (bp_is_register_page()) {
        $bp_classes[] = 'bp_register';
    } elseif (bp_is_activation_page()) {
        $bp_classes[] = 'bp_activate';
    } elseif (bp_is_forums_component() && bp_is_directory()) {
        $bp_classes[] = 'bp_forum';
    }
    if (empty($bp_classes)) {
        return $wp_classes;
    }
    // Emulate post type css class.
    foreach ($bp_classes as $bp_class) {
        $bp_classes[] = "type-{$bp_class}";
    }
    // Okay let's merge!
    return array_unique(array_merge($bp_classes, $wp_classes));
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:42,代码来源:bp-core-template.php


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