本文整理汇总了PHP中bp_get_members_directory_permalink函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_members_directory_permalink函数的具体用法?PHP bp_get_members_directory_permalink怎么用?PHP bp_get_members_directory_permalink使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_members_directory_permalink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate_url_to_item_id
/**
* Validates the URL to determine if the activity item is valid.
*
* @since 2.6.0
*
* @param string $url The URL to check.
* @return int|bool Activity ID on success; boolean false on failure.
*/
protected function validate_url_to_item_id($url)
{
if (bp_core_enable_root_profiles()) {
$domain = bp_get_root_domain();
} else {
$domain = bp_get_members_directory_permalink();
}
// Check the URL to see if this is a single activity URL.
if (0 !== strpos($url, $domain)) {
return false;
}
// Check for activity slug.
if (false === strpos($url, '/' . bp_get_activity_slug() . '/')) {
return false;
}
// Do more checks.
$url = trim(untrailingslashit($url));
// Grab the activity ID.
$activity_id = (int) substr($url, strrpos($url, '/') + 1);
if (!empty($activity_id)) {
// Check if activity item still exists.
$activity = new BP_Activity_Activity($activity_id);
// Okay, we're good to go!
if (!empty($activity->component) && 0 === (int) $activity->is_spam) {
return $activity_id;
}
}
return false;
}
示例2: bpg_init
function bpg_init()
{
require_once dirname(__FILE__) . '/includes/functions.php';
if (defined('BP_VERSION') && defined('WPGLOBUS_VERSION')) {
$apply_filters = false;
//TOFIX
// Always on frontend
if (!is_admin() || $apply_filters) {
$optionLanguages = wpgl_get_option_language();
$defaultLanguage = wpgl_get_default_language($optionLanguages);
$currentLanguage = wpgl_get_current_language($optionLanguages);
if ($currentLanguage != $defaultLanguage) {
apply_filters('bp_get_groups_directory_permalink', trailingslashit(bp_get_groups_directory_permalink() . $currentLanguage . '/'));
apply_filters('bp_get_activity_directory_permalink', trailingslashit(bp_get_activity_directory_permalink() . $currentLanguage . '/'));
apply_filters('bp_get_blogs_directory_permalink', trailingslashit(bp_get_blogs_directory_permalink() . $currentLanguage . '/'));
apply_filters('bp_get_forum_directory_permalink', trailingslashit(bp_get_forum_directory_permalink() . $currentLanguage . '/'));
apply_filters('bp_get_members_directory_permalink', trailingslashit(bp_get_members_directory_permalink() . $currentLanguage . '/'));
}
}
} else {
if (is_admin()) {
add_action('admin_notices', 'bpgl_admin_notice_required_plugins');
}
}
}
示例3: kleo_bp_member_types_tabs
function kleo_bp_member_types_tabs()
{
if (!bp_get_current_member_type()) {
$member_types = bp_get_member_types(array(), 'objects');
if ($member_types) {
foreach ($member_types as $member_type) {
if ($member_type->has_directory == 1) {
echo '<li id="members-' . esc_attr($member_type->name) . '" class="bp-member-type-filter">';
echo '<a href="' . bp_get_members_directory_permalink() . 'type/' . $member_type->directory_slug . '/">' . sprintf('%s <span>%d</span>', $member_type->labels['name'], kleo_bp_count_member_types($member_type->name)) . '</a>';
echo '</li>';
}
}
}
}
}
示例4: bp_members_directory_permalink
/**
* Output member directory permalink
*
* @package BuddyPress
* @subpackage Members Template
* @since 1.5
* @uses bp_get_members_directory_permalink()
*/
function bp_members_directory_permalink()
{
echo bp_get_members_directory_permalink();
}
示例5: x_buddypress_navbar_menu
function x_buddypress_navbar_menu($items, $args)
{
if (X_BUDDYPRESS_IS_ACTIVE && x_get_option('x_buddypress_header_menu_enable', '') == '1') {
$top_level_link = is_user_logged_in() ? bp_loggedin_user_domain() : bp_get_activity_directory_permalink();
$submenu_items = '';
if (bp_is_active('activity')) {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activity_directory_permalink() . '" class="cf"><i class="x-icon-thumbs-up" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_activity_title', __('Activity', '__x__')) . '</span></a></li>';
}
if (bp_is_active('groups')) {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_groups_directory_permalink() . '" class="cf"><i class="x-icon-sitemap" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_groups_title', __('Groups', '__x__')) . '</span></a></li>';
}
if (is_multisite() && bp_is_active('blogs')) {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_blogs_directory_permalink() . '" class="cf"><i class="x-icon-file" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_blogs_title', __('Blogs', '__x__')) . '</span></a></li>';
}
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_members_directory_permalink() . '" class="cf"><i class="x-icon-male" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_members_title', __('Members', '__x__')) . '</span></a></li>';
if (!is_user_logged_in()) {
if (bp_get_signup_allowed()) {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_signup_page() . '" class="cf"><i class="x-icon-pencil" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_register_title', __('Create an Account', '__x__')) . '</span></a></li>';
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activation_page() . '" class="cf"><i class="x-icon-key" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_activate_title', __('Activate Your Account', '__x__')) . '</span></a></li>';
}
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . wp_login_url() . '" class="cf"><i class="x-icon-sign-in" data-x-icon=""></i> <span>' . __('Log in', '__x__') . '</span></a></li>';
} else {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_loggedin_user_domain() . '" class="cf"><i class="x-icon-cog" data-x-icon=""></i> <span>' . __('Profile', '__x__') . '</span></a></li>';
}
if ($args->theme_location == 'primary') {
$items .= '<li class="menu-item current-menu-parent menu-item-has-children x-menu-item x-menu-item-buddypress">' . '<a href="' . $top_level_link . '" class="x-btn-navbar-buddypress">' . '<span><i class="x-icon-user" data-x-icon=""></i><span class="x-hidden-desktop"> ' . __('Social', '__x__') . '</span></span>' . '</a>' . '<ul class="sub-menu">' . $submenu_items . '</ul>' . '</li>';
}
}
return $items;
}
示例6: do_trail_items
/**
* Runs through the various buddyPress conditional tags to check the current page being viewed. Once
* a condition is met, add items to the $items array.
*
* @since 0.6.0
* @access public
* @return void
*/
public function do_trail_items()
{
global $bp;
/* Add the network and site home links. */
$this->do_network_home_link();
$this->do_site_home_link();
$trail_end = '';
if (!empty($bp->displayed_user->fullname)) {
// looking at a user or self
$this->items[] = '<a href="' . bp_get_members_directory_permalink() . '">' . get_the_title($bp->pages->members->id) . '</a>';
$this->items[] = '<a href="' . $bp->displayed_user->domain . '" title="' . strip_tags($bp->displayed_user->userdata->display_name) . '">' . strip_tags($bp->displayed_user->userdata->display_name) . '</a>';
} else {
if ($bp->is_single_item) {
// we're on a single item page
$this->items[] = '<a href="' . get_permalink($bp->pages->{$bp->current_component}->id) . '" title="' . esc_attr(strip_tags(get_the_title($bp->pages->{$bp->current_component}->id))) . '">' . get_the_title($bp->pages->{$bp->current_component}->id) . '</a>';
$this->items[] = '<a href="' . get_permalink() . '" title="' . esc_attr($bp->bp_options_title) . '">' . $bp->bp_options_title . '</a>';
} else {
if ($bp->is_directory) {
// this is a top level directory page
$trail_end = get_the_title($bp->pages->{$bp->current_component}->id);
} else {
if (bp_is_register_page()) {
$trail_end = __('Create an Account', 'buddypress');
} else {
if (bp_is_activation_page()) {
$trail_end = __('Activate your Account', 'buddypress');
} else {
if (bp_is_group_create()) {
$this->items[] = '<a href="' . get_permalink($bp->pages->groups->id) . '" title="' . esc_attr(get_the_title($bp->pages->groups->id)) . '">' . get_the_title($bp->pages->groups->id) . '</a>';
$trail_end = __('Create a Group', 'buddypress');
} else {
if (bp_is_create_blog()) {
$this->items[] = '<a href="' . home_url() . '/' . $bp->current_component . '" title="' . ucwords($bp->current_component) . '">' . ucwords($bp->current_component) . '</a>';
$trail_end = __('Create a Blog', 'buddypress');
}
}
}
}
}
}
}
if ($trail_end) {
$this->items[] = $trail_end;
}
/* Return the bbPress breadcrumb trail items. */
$this->items = apply_filters('breadcrumb_trail_get_buddypress_items', $this->items, $this->args);
}
示例7: bp_get_the_topic_last_poster_name
/**
* Return the linked name of the user who last posted to the current topic in the loop.
*
* @since 1.0.0
*
* @return string HTML link to the profile of the user who last posted
* to the current topic.
*/
function bp_get_the_topic_last_poster_name()
{
global $forum_template;
$domain = bp_core_get_user_domain($forum_template->topic->topic_last_poster, $forum_template->topic->topic_last_poster_nicename, $forum_template->topic->topic_last_poster_login);
// In the case where no user is found, bp_core_get_user_domain() may return the URL
// of the Members directory.
if (empty($domain) || bp_get_members_directory_permalink() === $domain) {
return __('Deleted User', 'buddypress');
}
/**
* Filters the linked name of the user who last posted to the current topic in the loop.
*
* @since 1.0.0
*
* @param string $value HTML link to the profile of the user who last posted.
*/
return apply_filters('bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>');
}
示例8: widget
/**
* Display the Members widget.
*
* @since 1.0.3
*
* @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)
{
global $members_template;
// Get widget settings.
$settings = $this->parse_settings($instance);
/**
* Filters the title of the Members widget.
*
* @since 1.8.0
* @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter.
*
* @param string $title The widget title.
* @param array $settings 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', $settings['title'], $settings, $this->id_base);
$title = $settings['link_title'] ? '<a href="' . bp_get_members_directory_permalink() . '">' . $title . '</a>' : $title;
/**
* Filters the separator of the member widget links.
*
* @since 2.4.0
*
* @param string $separator Separator string. Default '|'.
*/
$separator = apply_filters('bp_members_widget_separator', '|');
// Output before widget HTMl, title (and maybe content before & after it).
echo $args['before_widget'] . $args['before_title'] . $title . $args['after_title'];
// Setup args for querying members.
$members_args = array('user_id' => 0, 'type' => $settings['member_default'], 'per_page' => $settings['max_members'], 'max' => $settings['max_members'], 'populate_extras' => true, 'search_terms' => false);
// Back up the global.
$old_members_template = $members_template;
?>
<?php
if (bp_has_members($members_args)) {
?>
<div class="item-options" id="members-list-options">
<a href="<?php
bp_members_directory_permalink();
?>
" id="newest-members" <?php
if ('newest' === $settings['member_default']) {
?>
class="selected"<?php
}
?>
><?php
esc_html_e('Newest', 'buddypress');
?>
</a>
<span class="bp-separator" role="separator"><?php
echo esc_html($separator);
?>
</span>
<a href="<?php
bp_members_directory_permalink();
?>
" id="recently-active-members" <?php
if ('active' === $settings['member_default']) {
?>
class="selected"<?php
}
?>
><?php
esc_html_e('Active', 'buddypress');
?>
</a>
<?php
if (bp_is_active('friends')) {
?>
<span class="bp-separator" role="separator"><?php
echo esc_html($separator);
?>
</span>
<a href="<?php
bp_members_directory_permalink();
?>
" id="popular-members" <?php
if ('popular' === $settings['member_default']) {
?>
class="selected"<?php
}
?>
><?php
esc_html_e('Popular', 'buddypress');
?>
</a>
//.........这里部分代码省略.........
示例9: bp_core_screen_activation
/**
* Handle the loading of the Activate screen.
*
* @todo Move the actual activation process into an action in bp-members-actions.php
*/
function bp_core_screen_activation()
{
// Bail if not viewing the activation page.
if (!bp_is_current_component('activate')) {
return false;
}
// If the user is already logged in, redirect away from here.
if (is_user_logged_in()) {
// If activation page is also front page, set to members directory to
// avoid an infinite loop. Otherwise, set to root domain.
$redirect_to = bp_is_component_front_page('activate') ? bp_get_members_directory_permalink() : bp_get_root_domain();
// Trailing slash it, as we expect these URL's to be.
$redirect_to = trailingslashit($redirect_to);
/**
* Filters the URL to redirect logged in users to when visiting activation page.
*
* @since 1.9.0
*
* @param string $redirect_to URL to redirect user to.
*/
$redirect_to = apply_filters('bp_loggedin_activate_page_redirect_to', $redirect_to);
// Redirect away from the activation page.
bp_core_redirect($redirect_to);
}
// Grab the key (the old way).
$key = isset($_GET['key']) ? $_GET['key'] : '';
// Grab the key (the new way).
if (empty($key)) {
$key = bp_current_action();
}
// Get BuddyPress.
$bp = buddypress();
// We've got a key; let's attempt to activate the signup.
if (!empty($key)) {
/**
* Filters the activation signup.
*
* @since 1.1.0
*
* @param bool|int $value Value returned by activation.
* Integer on success, boolean on failure.
*/
$user = apply_filters('bp_core_activate_account', bp_core_activate_signup($key));
// If there were errors, add a message and redirect.
if (!empty($user->errors)) {
bp_core_add_message($user->get_error_message(), 'error');
bp_core_redirect(trailingslashit(bp_get_root_domain() . '/' . $bp->pages->activate->slug));
}
$hashed_key = wp_hash($key);
// Check if the signup avatar folder exists. If it does, move the folder to
// the BP user avatars directory.
if (file_exists(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key)) {
@rename(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key, bp_core_avatar_upload_path() . '/avatars/' . $user);
}
bp_core_add_message(__('Your account is now active!', 'buddypress'));
$bp->activation_complete = true;
}
/**
* Filters the template to load for the Member activation page screen.
*
* @since 1.1.1
*
* @param string $value Path to the Member activation template to load.
*/
bp_core_load_template(apply_filters('bp_core_template_activate', array('activate', 'registration/activate')));
}
示例10: bp_aps_wrap_value_in_link
function bp_aps_wrap_value_in_link($value)
{
return '<a href="' . bp_get_members_directory_permalink() . '?s=' . urlencode($value) . '">' . $value . '</a>';
}
示例11: x_breadcrumbs
function x_breadcrumbs()
{
if (x_get_option('x_breadcrumb_display')) {
global $post;
$is_ltr = !is_rtl();
$stack = x_get_stack();
$delimiter = x_get_breadcrumb_delimiter();
$home_text = x_get_breadcrumb_home_text();
$home_link = home_url();
$current_before = x_get_breadcrumb_current_before();
$current_after = x_get_breadcrumb_current_after();
$page_title = get_the_title();
$blog_title = get_the_title(get_option('page_for_posts', true));
if (!is_404()) {
$post_parent = $post->post_parent;
} else {
$post_parent = '';
}
if (X_WOOCOMMERCE_IS_ACTIVE) {
$shop_url = x_get_shop_link();
$shop_title = x_get_option('x_' . $stack . '_shop_title');
$shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';
}
echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
if (is_home()) {
echo $current_before . $blog_title . $current_after;
} elseif (is_category()) {
$the_cat = get_category(get_query_var('cat'), false);
if ($the_cat->parent != 0) {
echo get_category_parents($the_cat->parent, TRUE, $delimiter);
}
echo $current_before . single_cat_title('', false) . $current_after;
} elseif (x_is_product_category()) {
if ($is_ltr) {
echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after;
} else {
echo $current_before . single_cat_title('', false) . $current_after . $delimiter . $shop_link;
}
} elseif (x_is_product_tag()) {
if ($is_ltr) {
echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after;
} else {
echo $current_before . single_tag_title('', false) . $current_after . $delimiter . $shop_link;
}
} elseif (is_search()) {
echo $current_before . __('Search Results for ', '__x__') . '“' . get_search_query() . '”' . $current_after;
} elseif (is_singular('post')) {
if (get_option('page_for_posts') == is_front_page()) {
echo $current_before . $page_title . $current_after;
} else {
if ($is_ltr) {
echo '<a href="' . get_permalink(get_option('page_for_posts')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . get_permalink(get_option('page_for_posts')) . '">' . $blog_title . '</a>';
}
}
} elseif (x_is_portfolio()) {
echo $current_before . get_the_title() . $current_after;
} elseif (x_is_portfolio_item()) {
$link = x_get_parent_portfolio_link();
$title = x_get_parent_portfolio_title();
if ($is_ltr) {
echo '<a href="' . $link . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . $link . '">' . $title . '</a>';
}
} elseif (x_is_product()) {
if ($is_ltr) {
echo $shop_link . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . $shop_link;
}
} elseif (x_is_buddypress()) {
if (bp_is_group()) {
echo '<a href="' . bp_get_groups_directory_permalink() . '">' . x_get_option('x_buddypress_groups_title') . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
} elseif (bp_is_user()) {
echo '<a href="' . bp_get_members_directory_permalink() . '">' . x_get_option('x_buddypress_members_title') . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
} else {
echo $current_before . x_buddypress_get_the_title() . $current_after;
}
} elseif (x_is_bbpress()) {
remove_filter('bbp_no_breadcrumb', '__return_true');
if (bbp_is_forum_archive()) {
echo $current_before . bbp_get_forum_archive_title() . $current_after;
} else {
echo bbp_get_breadcrumb();
}
add_filter('bbp_no_breadcrumb', '__return_true');
} elseif (is_page() && !$post_parent) {
echo $current_before . $page_title . $current_after;
} elseif (is_page() && $post_parent) {
$parent_id = $post_parent;
$breadcrumbs = array();
if (is_rtl()) {
echo $current_before . $page_title . $current_after . $delimiter;
}
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
$parent_id = $page->post_parent;
//.........这里部分代码省略.........
示例12: build_html
function build_html()
{
// Get the total member count
global $members_template;
$total = $members_template->total_member_count;
// Add everything to an array
$members = array();
while (bp_members()) {
bp_the_member();
$members[] = sprintf('<a href="%1$s" title="%2$s User Profile">%2$s</a>', bp_get_member_permalink(), bp_get_member_name());
}
if ($total > $this->number) {
$members[] = sprintf('<a href="%1$s" title="View all online members">%2$d More</a>', bp_get_members_directory_permalink(), $total - $this->number);
}
// Implode the members with separator
$members = implode(" | ", $members);
// Store everything in an output buffer
ob_start();
?>
<div id="sidebar-members-widget" class="widget">
<header class="widget-header">
<h3 class="widget-title">Online Members</h3>
</header>
<p class="online-members"><i class="fa fa-users"></i>
<?php
if ($total > 1) {
printf('There are currently <span class="activity-count">%d</span> members online:', $total);
} elseif ($total == 1) {
printf('There is currently <span class="activity-count">%d</span> member online:', $total);
} else {
echo 'There are currently no members online:';
}
?>
</p>
<p class="online-members"><?php
echo $members;
?>
</p>
</div><?php
// Get the contents of the buffer
$html = ob_get_contents();
ob_end_clean();
// Return the html to the class
return $html;
}
示例13: bp_forums_strip_mentions_on_post_edit
/**
* Remove the anchor tag autogenerated for at-mentions when forum topics and posts are edited.
*
* Prevents embedded anchor tags.
*
* @param string $content Edited post content.
* @return string $content Sanitized post content.
*/
function bp_forums_strip_mentions_on_post_edit($content)
{
$content = htmlspecialchars_decode($content);
$directory = bp_get_members_directory_permalink();
$pattern = "|<a href='{$directory}[A-Za-z0-9-_\\.]+/' rel='nofollow'>(@[A-Za-z0-9-_\\.@]+)</a>|";
$content = preg_replace($pattern, "\$1", $content);
return $content;
}
示例14: cb_breadcrumbs
function cb_breadcrumbs($cb_padding = 'padding-on')
{
$cb_breadcrumb = NULL;
$cb_post_type = get_post_type();
if ($cb_padding == 'padding-off') {
$cb_padding_type = ' cb-padding-off';
} else {
$cb_padding_type = NULL;
}
if (is_page() == false) {
$cb_breadcrumb = '<div class="cb-breadcrumbs wrap' . $cb_padding_type . '">';
$cb_icon = '<i class="icon-angle-right"></i>';
$cb_breadcrumb .= '<a href="' . home_url() . '">' . __("Home", "cubell") . '</a>' . $cb_icon;
if (is_category()) {
$cb_cat_id = get_query_var('cat');
$cb_current_category = get_category($cb_cat_id);
if ($cb_current_category->category_parent == '0') {
$cb_breadcrumb .= '<a href="' . get_category_link($cb_current_category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), $cb_current_category->name)) . '">' . $cb_current_category->name . '</a>';
} else {
$cb_breadcrumb .= '<a href="' . get_category_link($cb_current_category->category_parent) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), get_the_category_by_ID($cb_current_category->category_parent))) . '">' . get_the_category_by_ID($cb_current_category->category_parent) . '</a>' . $cb_icon;
$cb_breadcrumb .= '<a href="' . get_category_link($cb_current_category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), $cb_current_category->name)) . '">' . $cb_current_category->name . '</a>';
}
} elseif (function_exists('buddypress') && is_buddypress() == true) {
global $bp;
$cb_bp_output = NULL;
$cb_bp_current_component = bp_current_component();
$cb_bp_current_action = bp_current_action();
if ($cb_bp_current_action != 'my-groups' && $cb_bp_current_component == 'groups') {
$cb_bp_group = $bp->groups->current_group;
if (!is_numeric($cb_bp_group)) {
$cb_bp_group_id = $cb_bp_group->id;
$cb_bp_group_name = $cb_bp_group->name;
$cb_bp_group_link = bp_get_group_permalink($cb_bp_group);
$cb_bp_output = '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug()) . '">' . __('Groups', 'cubell') . '</a>' . $cb_icon . $cb_bp_group_name;
} else {
$cb_bp_output = __('Groups', 'cubell');
}
$cb_breadcrumb .= $cb_bp_output;
}
if ($cb_bp_current_component == 'activity' || $cb_bp_current_action == 'my-groups' || $cb_bp_current_action == 'public' || $cb_bp_current_component == 'settings' || $cb_bp_current_component == 'forums' || $cb_bp_current_component == 'friends') {
$cb_activity_title = get_the_title();
$cb_bp_activity = $bp->activity->current_id;
$cb_bp_activity_link = bp_get_members_directory_permalink();
$cb_bp_output .= '<a href="' . $cb_bp_activity_link . '">' . __('Members', 'cubell') . '</a>' . $cb_icon . $cb_activity_title;
if ($cb_bp_activity != NULL) {
$cb_bp_output .= __('Members', 'cubell');
}
$cb_breadcrumb .= $cb_bp_output;
}
if ($cb_bp_current_component == 'messages') {
$cb_breadcrumb .= __('Messages', 'cubell');
}
if (bp_is_directory() == true) {
$cb_breadcrumb = '<div>';
}
} elseif ($cb_post_type == 'post') {
$cb_categories = get_the_category();
if ($cb_categories[0]->category_parent == '0') {
$cb_breadcrumb .= '<a href="' . get_category_link($cb_categories[0]->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), $cb_categories[0]->name)) . '">' . $cb_categories[0]->name . '</a>';
} else {
$cb_breadcrumb .= '<a href="' . get_category_link($cb_categories[0]->category_parent) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), get_the_category_by_ID($cb_categories[0]->category_parent))) . '">' . get_the_category_by_ID($cb_categories[0]->category_parent) . '</a>' . $cb_icon;
$cb_breadcrumb .= '<a href="' . get_category_link($cb_categories[0]->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), $cb_categories[0]->name)) . '">' . $cb_categories[0]->name . '</a>';
}
}
$cb_breadcrumb .= '</div>';
}
return $cb_breadcrumb;
}
示例15: get_context
/**
* Get the page context
* @version 2.0
*/
function get_context()
{
// Setup placeholders
$title = SITENAME;
$desc = get_bloginfo('description');
$classes = get_body_class();
$crumbs = array();
// Get some data
$id = $this->queried_object_id;
$object = $this->queried_object;
$sep = " • ";
/*--------------------------------------------
DEFAULT CONTEXT
---------------------------------------------*/
$classes[] = 0 == get_current_user_id() ? 'logged-out' : 'logged-in';
$crumbs[] = '<a href="' . SITEURL . '" title="' . SITENAME . '" rel="home" class="trail-home">Home</a>';
// Homepage
if (is_home()) {
$title = SITENAME . $sep . 'Home';
$classes[] = 'home';
$classes[] = 'sidebar';
$classes[] = 'archive';
/*--------------------------------------------
BUDDYPRESS CONTEXT
---------------------------------------------*/
} elseif (class_exists('BuddyPress') && is_buddypress()) {
// BuddyPress Defaults
$title = "BuddyPress Page";
$desc = "This is a BuddyPress page.";
$classes[] = 'buddypress';
// User Profiles
if (bp_is_user()) {
$title = bp_get_displayed_user_fullname() . $sep . "User Profile";
$desc = SITENAME . " user profile for member " . bp_get_displayed_user_fullname();
// Your own profile
if (bp_is_my_profile()) {
$crumbs[] = 'Your Profile';
} else {
$crumbs[] = '<a href="' . bp_get_members_directory_permalink() . '" title="Members Directory">Members</a>';
$crumbs[] = '<a href="' . bp_displayed_user_domain() . '" title="' . bp_get_displayed_user_fullname() . '">' . bp_get_displayed_user_fullname() . '</a>';
}
// Display the profile component if it isnt the profile home
if (!bp_is_user_profile()) {
$crumbs[] = ucfirst(bp_current_component());
}
// Display the current action if it is not the default public profile
if (!in_array(bp_current_action(), array('public', 'just-me', 'my-friends'))) {
$crumbs[] = ucfirst(bp_current_action());
}
// Single Group
} elseif (bp_is_group() || bp_is_group_create()) {
// Group Creation
if (bp_is_group_create()) {
$title = 'Submit New Group';
$desc = 'Submit a new user group for listing on the ' . SITENAME . ' community groups directory.';
$crumbs[] = '<a href="' . SITEURL . '/' . bp_get_groups_root_slug() . '" title="Groups Directory">Groups</a>';
$crumbs[] = 'Create Group';
} elseif (bp_is_group()) {
// Default entries
$title = bp_get_group_name();
$desc = SITENAME . ' guild profile for ' . bp_get_group_name();
$classes = array_diff($classes, array('page', 'page-template-default'));
$crumbs[] = '<a href="' . bp_get_groups_directory_permalink() . '" title="Groups Directory">Groups</a>';
// Group Profile Home
if (bp_is_group_home()) {
$title = $title . $sep . 'Profile';
$crumbs[] = bp_get_group_name();
// Advanced Component
} else {
// Link back to group profile
$crumbs[] = '<a href="' . bp_get_group_permalink() . '" title="Return to Group Profile">' . bp_get_group_name() . '</a>';
// Members
if (bp_is_group_members()) {
$title = $title . $sep . 'Members';
$crumbs[] = 'Members';
// Activity
} elseif (bp_is_group_activity()) {
$title = $title . $sep . 'Activity';
$crumbs[] = 'Activity';
// Invites
} elseif (bp_is_group_invites()) {
$title = $title . $sep . 'Invitations';
$crumbs[] = 'Invitations';
// Admin
} elseif (bp_is_group_admin_page()) {
$title = $title . $sep . 'Admin';
$crumbs[] = 'Admin';
// Forum
} else {
// Forum Root
if (NULL == bp_action_variable()) {
$title = $title . $sep . 'Forum';
$crumbs[] = 'Forum';
// Sub-Component
} else {
$crumbs[] = '<a href="' . bp_get_group_permalink() . 'forum/" title="Group Forum">Forum</a>';
//.........这里部分代码省略.........