本文整理汇总了PHP中bp_is_directory函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_is_directory函数的具体用法?PHP bp_is_directory怎么用?PHP bp_is_directory使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_is_directory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_legacy
public function check_legacy($tpl)
{
$status = function_exists('buddypress');
if (!$status) {
return $tpl;
}
$this->bp_plugin_name = bp_get_name_from_root_slug();
// This check fails for some plugins
// $status = $this->bp_plugin_name != false;
if ($status) {
$bp_defaults = array('members', 'xprofile', 'activity', 'blogs', 'messages', 'friends', 'groups', 'forums', 'settings');
foreach ($bp_defaults as $bp_default) {
if (bp_is_current_component($bp_default)) {
break;
}
}
}
if ($status && bp_is_directory()) {
$this->is_legacy = $status = false;
}
if ($status && false === (bool) locate_template(array('members/single/item-header.php'), false)) {
add_action('wp_footer', array($this, 'item_header'));
}
if ($status) {
add_action('wp_footer', array($this, 'page_title'));
add_action('wp_footer', array($this, 'echo_legacy_tpl'));
}
return $tpl;
}
示例2: transparent_header_title_background
function transparent_header_title_background()
{
$header_style = vibe_get_customizer('header_style');
if ($header_style == 'transparent') {
if (is_page() || is_single() || bp_is_directory() || is_archive()) {
global $post;
$title_bg = get_post_meta($post->ID, 'vibe_title_bg', true);
if (empty($title_bg)) {
$title_bg = vibe_get_option('title_bg');
if (empty($title_bg)) {
$title_bg = VIBE_URL . '/assets/images/title_bg.jpg';
}
}
if (is_numeric($title_bg)) {
$bg = wp_get_attachment_image_src($title_bg, 'full');
if (!empty($bg)) {
$title_bg = $bg[0];
}
}
if (!empty($title_bg)) {
?>
<style>.course_header,.group_header{background:url(<?php
echo $title_bg;
?>
) !important;}#title{background:url(<?php
echo $title_bg;
?>
) !important;padding-bottom:30px !important; background-size: cover;}#title h1,#title h5,#title a,#title,#breadcrumbs li+li:before{color:#fff !important;}</style>
<?php
}
}
}
}
示例3: bp_course_add_js
function bp_course_add_js()
{
global $bp;
if (!function_exists('vibe_logo_url')) {
return;
}
// Checks if WPLMS is active in current site in WP Multisite
wp_enqueue_script('bp-extras-js', plugins_url('/vibe-course-module/includes/js/course-module-js.min.js'), array('jquery'), bp_course_version(), true);
if (function_exists('vibe_get_option')) {
if (is_singular('unit') || is_singular('question') || is_singular('quiz') || is_singular('wplms-assignment') || is_page(vibe_get_option('take_course_page')) || is_page(vibe_get_option('create_course')) || isset($_GET['edit'])) {
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery-ui-droppable');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
}
}
if (function_exists('bp_is_directory')) {
if (bp_is_directory() && bp_current_component() == 'course') {
wp_enqueue_script('jquery-ui-datepicker');
}
}
$action = bp_current_action();
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if (in_array($action, array('admin', 'submissions', 'stats'))) {
wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
}
wp_enqueue_script('bp-course-js', plugins_url('/vibe-course-module/includes/js/course.js'), array('jquery', 'wp-mediaelement', 'buddypress-js'), bp_course_version(), true);
$color = bp_wplms_get_theme_color();
$single_dark_color = bp_wplms_get_theme_single_dark_color();
$translation_array = array('too_fast_answer' => _x('Too Fast or Answer not marked.', 'Quiz answer being marked very fast', 'vibe'), 'answer_saved' => _x('Answer Saved.', 'Save answer on every question, confirmation message', 'vibe'), 'processing' => _x('Processing...', 'Quiz question anwer save under progress', 'vibe'), 'saving_answer' => _x('Saving Answer...please wait', 'Saving quiz answers under progress', 'vibe'), 'remove_user_text' => __('This step is irreversible. Are you sure you want to remove the User from the course ?', 'vibe'), 'remove_user_button' => __('Confirm, Remove User from Course', 'vibe'), 'confirm' => _x('Confirm', 'Confirm button for various popup confirmation messages', 'vibe'), 'cancel' => _x('Cancel', 'Cancel button for various popup confirmation messages', 'vibe'), 'reset_user_text' => __('This step is irreversible. All Units, Quiz results would be reset for this user. Are you sure you want to Reset the Course for this User?', 'vibe'), 'reset_user_button' => __('Confirm, Reset Course for this User', 'vibe'), 'quiz_reset' => __('This step is irreversible. All Questions answers would be reset for this user. Are you sure you want to Reset the Quiz for this User? ', 'vibe'), 'quiz_reset_button' => __('Confirm, Reset Quiz for this User', 'vibe'), 'marks_saved' => __('Marks Saved', 'vibe'), 'quiz_marks_saved' => __('Quiz Marks Saved', 'vibe'), 'submit_quiz' => __('Submit Quiz', 'vibe'), 'sending_messages' => __('Sending Messages ...', 'vibe'), 'adding_students' => __('Adding Students to Course ...', 'vibe'), 'successfuly_added_students' => __('Students successfully added to Course', 'vibe'), 'unable_add_students' => __('Unable to Add students to Course', 'vibe'), 'select_fields' => __('Please select fields to download', 'vibe'), 'download' => __('Download', 'vibe'), 'timeout' => __('TIMEOUT', 'vibe'), 'theme_color' => $color, 'single_dark_color' => $single_dark_color, 'for_course' => __('for Course', 'vibe'), 'active_filters' => __('Active Filters', 'vibe'), 'clear_filters' => __('Clear all filters', 'vibe'), 'remove_comment' => __('Are you sure you want to remove this note?', 'vibe'), 'remove_comment_button' => __('Confirm, remove note', 'vibe'), 'private_comment' => __('Make Private', 'vibe'), 'add_comment' => __('Add your note', 'vibe'), 'submit_quiz_error' => __('Please add questions or retake the quiz !', 'vibe'), 'remove_announcement' => __('Are you sure you want to remove this Annoucement?', 'vibe'), 'start_quiz_notification' => __('You\'re about to start the Quiz. Please click confirm to begin the quiz.', 'vibe'), 'submit_quiz_notification' => __('Are you sure you want to submit the quiz. Submitting the quiz will freeze all your answers, you can not change them. Please confirm.', 'vibe'), 'check_results' => __('Check results', 'vibe'), 'correct' => __('Correct', 'vibe'), 'incorrect' => __('Incorrect', 'vibe'), 'confirm_apply' => _x('Are you sure you want to apply for this Course ?', 'confirmation message when user clicks on apply for course', 'vibe'), 'instructor_uncomplete_unit' => _x('Are you sure you want mark this unit "uncomplete" for the user ?', 'Popup confirmation message when instructor marks the unit uncomplete for the user.', 'vibe'), 'instructor_complete_unit' => _x('Are you sure you want to mark this unit "complete" for the user ?', 'Popup confirmation message ', 'vibe'), 'unanswered_questions' => __('You have few unanswered questions. Are you sure you want to continue ?', 'vibe'));
wp_localize_script('bp-course-js', 'vibe_course_module_strings', $translation_array);
}
示例4: remove_wpseo_from_buddypress
function remove_wpseo_from_buddypress($title)
{
global $bp, $post;
if (empty($this->bp_pages)) {
$this->bp_pages = get_option('bp-pages');
}
if (function_exists('bp_is_directory') && bp_is_directory() || in_array($post->ID, $this->bp_pages)) {
$title = sprintf(_x('%s Directory - %s', 'Directory Title format', 'vibe'), ucfirst(bp_current_component()), get_bloginfo('name'));
}
if (function_exists('bp_is_user') && bp_is_user()) {
//$title = sprintf(_x('%1s group - %2s','Member Name',ucfirst(bp_get_displayed_user_fullname()),get_bloginfo('name')));
$title = ucfirst(bp_get_displayed_user_fullname()) . ' - ' . get_bloginfo('name');
}
if (function_exists('bp_is_group') && bp_is_group()) {
//$title = sprintf(_x('%1s group - %2s','Group Name',ucfirst(bp_get_current_group_name()),get_bloginfo('name')));
$title = ucfirst(bp_get_current_group_name()) . ' - ' . get_bloginfo('name');
}
return $title;
}
示例5: output
/**
* Output the RSS feed.
*/
protected function output()
{
// set up some additional headers if not on a directory page
// this is done b/c BP uses pseudo-pages
if (!bp_is_directory()) {
global $wp_query;
$wp_query->is_404 = false;
status_header(200);
}
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
<?php
do_action('bp_activity_feed_rss_attributes');
?>
>
<channel>
<title><?php
echo $this->title;
?>
</title>
<link><?php
echo $this->link;
?>
</link>
<atom:link href="<?php
self_link();
?>
" rel="self" type="application/rss+xml" />
<description><?php
echo $this->description;
?>
</description>
<lastBuildDate><?php
echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
?>
</lastBuildDate>
<generator>http://buddypress.org/?v=<?php
bp_version();
?>
</generator>
<language><?php
bloginfo_rss('language');
?>
</language>
<ttl><?php
echo $this->ttl;
?>
</ttl>
<sy:updatePeriod><?php
echo $this->update_period;
?>
</sy:updatePeriod>
<sy:updateFrequency><?php
echo $this->update_frequency;
?>
</sy:updateFrequency>
<?php
do_action('bp_activity_feed_channel_elements');
?>
<?php
if (bp_has_activities($this->activity_args)) {
?>
<?php
while (bp_activities()) {
bp_the_activity();
?>
<item>
<guid isPermaLink="false"><?php
bp_activity_feed_item_guid();
?>
</guid>
<title><?php
echo stripslashes(bp_get_activity_feed_item_title());
?>
</title>
<link><?php
bp_activity_thread_permalink();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false);
?>
</pubDate>
<?php
if (bp_get_activity_feed_item_description()) {
?>
<content:encoded><![CDATA[<?php
//.........这里部分代码省略.........
示例6: load_template
/**
* load_template()
*
* Choose the best way to load your plugin's content
*
* @package BuddyDrive Component
* @subpackage Screens
* @since 1.2.0
*/
public static function load_template($template = '', $screen = '')
{
$buddydrive = buddydrive();
/****
* Displaying Content
*/
$buddydrive->screens->template = $template;
$buddydrive->screens->current_screen = $screen;
if (buddypress()->theme_compat->use_with_current_theme && !empty($template)) {
add_filter('bp_get_template_part', array(__CLASS__, 'template_part'), 10, 3);
} else {
// You can only use this method for users profile pages
if (!bp_is_directory()) {
$buddydrive->screens->template = 'members/single/plugins';
add_action('bp_template_title', "buddydrive_{$screen}_title");
add_action('bp_template_content', "buddydrive_{$screen}_content");
}
}
bp_core_load_template(apply_filters("buddydrive_template_{$screen}", $buddydrive->screens->template));
}
示例7:
/**
* Infinity Theme: Custom Activity Tabs Template
*
* @author Bowe Frankema <bowe@presscrew.com>
* @link http://infinity.presscrew.com/
* @copyright Copyright (C) 2010-2011 Bowe Frankema
* @license http://www.gnu.org/licenses/gpl.html GPLv2 or later
* @package Infinity
* @subpackage templates
* @since 1.0
*/
?>
<?php
if (bp_is_activity_component() && bp_is_directory()) {
?>
<div id="vertical-activity-tabs" class="item-list-tabs activity-type-tabs sidebar-activity-tabs" role="navigation">
<h4>Activity</h4>
<ul>
<?php
do_action('bp_before_activity_type_tab_all');
?>
<li class="selected" id="activity-all"><a href="<?php
echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/';
?>
" title="<?php
_e('The public activity for everyone on this site.', 'buddypress');
?>
"><?php
示例8: get_header
<?php
get_header();
$cb_user_page = $cb_group_creator = $cb_title_prefix = $cb_bp_class = $cb_breadcrumbs_override = NULL;
global $bb_current_user;
$cb_breadcrumbs = ot_get_option('cb_breadcrumbs', 'on');
$cb_theme_style = ot_get_option('cb_theme_style', 'cb_boxed');
$cb_buddypress_sidebar = ot_get_option('cb_buddypress_sidebar', 'sidebar');
$cb_buddypress_global_color = ot_get_option('cb_buddypress_global_color', '#eb9812');
$cb_current_user = bp_displayed_user_id();
$cb_title = get_the_title();
$cb_bp_current_component = bp_current_component();
$cb_bp_current_action = bp_current_action();
if (($cb_bp_current_component == 'activity' || $cb_bp_current_component == 'profile') && bp_is_directory() == false && $cb_bp_current_action != NULL) {
$cb_title_prefix = '<span>' . __('Member', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'groups' && $cb_bp_current_action != NULL) {
$cb_title_prefix = '<span>' . __('Group', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'groups' && ($cb_bp_current_action == 'my-groups' || $cb_bp_current_action == 'invites')) {
$cb_title_prefix = NULL;
$cb_title = __('Groups', 'cubell');
}
if ($cb_bp_current_component == 'settings') {
$cb_title_prefix = '<span>' . __('Settings', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'forums') {
$cb_title_prefix = '<span>' . __('Forums', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'activity' && $cb_bp_current_action == NULL) {
$cb_title = __('Latest Activity', 'cubell');
示例9: meso_schema_breadcrumbs
//.........这里部分代码省略.........
if ($taxlist) {
echo $taxlist;
}
}
echo ' ' . $delimiter . ' ' . __('You are reading »', 'mesocolumn');
} else {
$category = get_the_category();
if ($category) {
foreach ($category as $cat) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_category_link($cat->term_id) . '">' . '<span' . $schema_prop_title . '>' . $cat->name . '</span>' . '</a></span>' . $delimiter . ' ';
}
}
echo __('You are reading »', 'mesocolumn');
}
} elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
$post_type = get_post_type_object(get_post_type());
echo $before . $post_type->labels->singular_name . $after;
} elseif (is_attachment()) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID);
$cat = $cat[0];
if ($cat) {
echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
}
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink($parent) . '">' . '<span' . $schema_prop_title . '>' . $parent->post_title . '</span>' . '</a></span>';
if ($showCurrent == 1) {
echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
}
} elseif (is_page() && !$post->post_parent) {
if (class_exists('buddypress')) {
global $bp;
if (bp_is_groups_component()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('groups') . '</span>' . '</a></span>';
if (!bp_is_directory()) {
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '">' . '<span' . $schema_prop_title . '>' . bp_current_item() . '</span>' . '</a></span>';
if (bp_current_action()) {
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '/' . bp_current_action() . '">' . '<span' . $schema_prop_title . '>' . bp_current_action() . '</span>' . '</a></span>';
}
}
} else {
if (bp_is_members_directory()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
} else {
if (bp_is_user()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . '">' . '<span' . $schema_prop_title . '>' . bp_get_displayed_user_username() . '</span>' . '</a></span>';
if (bp_current_action()) {
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . bp_current_component() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
}
} else {
if (bp_is_directory()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
} else {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
}
}
}
}
} else {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
}
} elseif (is_page() && $post->post_parent) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
示例10: bp_modify_page_title
/**
* Filter the page title for BuddyPress pages.
*
* @since BuddyPress (1.5.0)
*
* @see wp_title()
* @global object $bp BuddyPress global settings.
*
* @param string $title Original page title.
* @param string $sep How to separate the various items within the page title.
* @param string $seplocation Direction to display title.
* @return string New page title.
*/
function bp_modify_page_title( $title, $sep = '', $seplocation = '' ) {
global $bp;
// If this is not a BP page, just return the title produced by WP
if ( bp_is_blog_page() ) {
return $title;
}
// If this is a 404, let WordPress handle it
if ( is_404() ) {
return $title;
}
// If this is the front page of the site, return WP's title
if ( is_front_page() || is_home() ) {
return $title;
}
$title = '';
// Displayed user
if ( bp_get_displayed_user_fullname() && ! is_404() ) {
// Get the component's ID to try and get its name
$component_id = $component_name = bp_current_component();
// Use the component nav name
if ( ! empty( $bp->bp_nav[$component_id] ) ) {
// Remove counts that are added by the nav item
$span = strpos( $bp->bp_nav[ $component_id ]['name'], '<span' );
if ( false !== $span ) {
$component_name = substr( $bp->bp_nav[ $component_id ]['name'], 0, $span - 1 );
} else {
$component_name = $bp->bp_nav[ $component_id ]['name'];
}
// Fall back on the component ID
} elseif ( ! empty( $bp->{$component_id}->id ) ) {
$component_name = ucwords( $bp->{$component_id}->id );
}
// Append action name if we're on a member component sub-page
if ( ! empty( $bp->bp_options_nav[ $component_id ] ) && ! empty( $bp->canonical_stack['action'] ) ) {
$component_subnav_name = wp_filter_object_list( $bp->bp_options_nav[ $component_id ], array( 'slug' => bp_current_action() ), 'and', 'name' );
if ( $component_subnav_name ) {
$component_subnav_name = array_shift( $component_subnav_name );
} else {
$component_subnav_name = '';
}
} else {
$component_subnav_name = '';
}
// If on the user profile's landing page, just use the fullname
if ( bp_is_current_component( $bp->default_component ) && bp_get_requested_url() === bp_displayed_user_domain() ) {
$title = bp_get_displayed_user_fullname();
// Use component name on member pages
} else {
// If we have a subnav name, add it separately for localization
if ( ! empty( $component_subnav_name ) ) {
// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator, 4 = component subnav name
$title = strip_tags( sprintf( __( '%1$s %3$s %2$s %3$s %4$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep, $component_subnav_name ) );
} else {
// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator
$title = strip_tags( sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep ) );
}
}
// A single group
} elseif ( bp_is_active( 'groups' ) && ! empty( $bp->groups->current_group ) && ! empty( $bp->bp_options_nav[ $bp->groups->current_group->slug ] ) ) {
$subnav = isset( $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] ) ? $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] : '';
// translators: 1 = group name, 2 = group nav section name, 3 = separator
$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $subnav, $sep );
// A single item from a component other than groups
} elseif ( bp_is_single_item() ) {
// translators: 1 = component item name, 2 = component nav section name, 3 = separator
$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[ bp_current_item() ][ bp_current_action() ]['name'], $sep );
// An index or directory
} elseif ( bp_is_directory() ) {
$current_component = bp_current_component();
//.........这里部分代码省略.........
示例11: bp_get_loggedin_user_nav
/**
* Render the navigation markup for the logged-in user.
*
* Each component adds to this navigation array within its own
* [component_name]setup_nav() function.
*
* This navigation array is the top level navigation, so it contains items such as:
* [Blog, Profile, Messages, Groups, Friends] ...
*
* The function will also analyze the current component the user is in, to
* determine whether or not to highlight a particular nav item.
*
* @todo Move to a back-compat file?
* @deprecated Does not seem to be called anywhere in BP core.
*/
function bp_get_loggedin_user_nav()
{
$bp = buddypress();
// Loop through each navigation item.
foreach ((array) $bp->bp_nav as $nav_item) {
$selected = '';
// If the current component matches the nav item id, then add a highlight CSS class.
if (!bp_is_directory() && !empty($bp->active_components[bp_current_component()]) && $bp->active_components[bp_current_component()] == $nav_item['css_id']) {
$selected = ' class="current selected"';
}
// If we are viewing another person (current_userid does not equal
// loggedin_user->id then check to see if the two users are friends.
// if they are, add a highlight CSS class to the friends nav item
// if it exists.
if (!bp_is_my_profile() && bp_displayed_user_id()) {
$selected = '';
if (bp_is_active('friends')) {
if ($nav_item['css_id'] == $bp->friends->id) {
if (friends_check_friendship(bp_loggedin_user_id(), bp_displayed_user_id())) {
$selected = ' class="current selected"';
}
}
}
}
// Echo out the final list item.
echo apply_filters_ref_array('bp_get_loggedin_user_nav_' . $nav_item['css_id'], array('<li id="li-nav-' . $nav_item['css_id'] . '" ' . $selected . '><a id="my-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a></li>', &$nav_item));
}
// Always add a log out list item to the end of the navigation.
$logout_link = '<li><a id="wp-logout" href="' . wp_logout_url(bp_get_root_domain()) . '">' . __('Log Out', 'buddypress') . '</a></li>';
echo apply_filters('bp_logout_nav_link', $logout_link);
}
示例12: widget
function widget($args, $instance)
{
global $bp, $wpdb;
extract($args);
extract($instance, EXTR_SKIP);
if (!is_post_type_archive('course') && !is_tax('course-cat') && !(function_exists('bp_is_directory') && bp_is_directory('course') && $bp->current_component == 'course')) {
return;
}
echo $before_widget . '<div class="course_filters">';
/* Exclude check */
$exclude_array = array();
if (isset($exclude) && $exclude) {
if (strpos($exclude, ',')) {
$exclude_array = explode(',', $exclude);
} else {
$exclude_array[] = $exclude;
}
}
if (isset($category) && $category) {
$cat_args = apply_filters('wplms_course_filters_course_cat', array('orderby' => 'count', 'order' => 'DESC', 'parent' => 0));
$categories = get_terms('course-cat', $cat_args);
if (isset($categories) && is_array($categories)) {
echo '<h4>' . $category_label . '</h4>';
echo '<ul class="category_filter">';
foreach ($categories as $category) {
if (!in_array($category->slug, $exclude_array)) {
$sub_args = array('orderby' => 'count', 'order' => 'DESC', 'child_of' => $category->term_id);
$sub_categories = get_terms('course-cat', $sub_args);
echo '<li>' . (isset($sub_categories) && is_Array($sub_categories) && count($sub_categories) ? '<span></span>' : '') . '
<div class="checkbox">
<input id="' . $category->slug . '" type="checkbox" class="bp-course-category-filter" name="bp-course-category-filter" value="' . $category->slug . '" />
<label for="' . $category->slug . '">' . $category->name . '</label>
</div>';
if (isset($sub_categories) && is_Array($sub_categories) && count($sub_categories)) {
echo '<ul class="sub_categories">';
foreach ($sub_categories as $sub_category) {
echo '<li>
<div class="checkbox">
<input id="' . $sub_category->slug . '" type="checkbox" class="bp-course-category-filter" name="bp-course-category-filter" value="' . $sub_category->slug . '" />
<label for="' . $sub_category->slug . '">' . $sub_category->name . '</label>
</div>';
}
echo '</ul>';
}
echo '</li>';
}
}
echo '</ul>';
}
}
if (isset($location) && $location) {
$args = apply_filters('wplms_course_filters_location', array('orderby' => 'count', 'order' => 'DESC'));
$categories = get_terms('location', $args);
if (isset($categories) && is_array($categories)) {
echo '<h4>' . $location_label . '</h4>';
echo '<ul class="location_filter">';
foreach ($categories as $category) {
if (!in_array($category->slug, $exclude_array)) {
echo '<li>
<div class="checkbox">
<input id="' . $category->slug . '" type="checkbox" class="bp-course-location-filter" name="bp-course-category-level" value="' . $category->slug . '" />
<label for="' . $category->slug . '">' . $category->name . '</label>
</div></li>';
}
}
echo '</ul>';
}
}
if (isset($level) && $level) {
$args = apply_filters('wplms_course_filters_level', array('orderby' => 'count', 'order' => 'DESC'));
$categories = get_terms('level', $args);
if (isset($categories) && is_array($categories)) {
echo '<h4>' . $level_label . '</h4>';
echo '<ul class="level_filter">';
foreach ($categories as $category) {
if (!in_array($category->slug, $exclude_array)) {
echo '<li>
<div class="checkbox">
<input id="' . $category->slug . '" type="checkbox" class="bp-course-level-filter" name="bp-course-category-level" value="' . $category->slug . '" />
<label for="' . $category->slug . '">' . $category->name . '</label>
</div></li>';
}
}
echo '</ul>';
}
}
if (isset($instructor) && $instructor) {
echo '<h4>' . $instructor_label . '</h4>';
echo '<ul class="instructor_filter">';
$flag = apply_filters('wplms_show_admin_in_instructors', 1);
if (isset($flag) && $flag) {
$instructor_args = apply_filters('wplms_course_filter_admin_args', array('role' => 'Administrator'));
$user_query = new WP_User_Query($instructor_args);
// User Loop
if (!empty($user_query->results)) {
foreach ($user_query->results as $user) {
echo '<li>
<div class="checkbox">
<input id="user' . $user->ID . '" type="checkbox" class="bp-course-instructor-filter" name="bp-course-instructor-filter" value="' . $user->ID . '" /> <label for="user' . $user->ID . '">' . $user->display_name . '</label>
</div></li>';
//.........这里部分代码省略.........
示例13: dpa_is_directory_page
/**
* Is this the Achievements Directory page?
*
* @global object $bp BuddyPress global settings
* @global bool $is_member_page If we are under anything with a members slug
* @return bool
* @since 2.0
*/
function dpa_is_directory_page()
{
global $bp, $is_member_page;
return apply_filters('dpa_is_directory_page', bp_is_current_component($bp->achievements->slug) && (bp_is_directory() || bp_is_current_component($bp->achievements->slug) && !$bp->current_action && !$bp->current_item && !$is_member_page));
}
示例14: miss_is_bp
/**
*
*/
function miss_is_bp()
{
if (function_exists('bp_is_group') && (bp_is_blog_page() || bp_is_my_profile() || bp_is_my_profile() || is_front_page() || bp_is_component_front_page('activity') || bp_is_directory() || bp_is_profile_component() || bp_is_activity_component() || bp_is_blogs_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_groups_component() || bp_is_settings_component() || bp_is_user_activity() || bp_is_user_friends_activity() || bp_is_activity_permalink() || bp_is_user_profile() || bp_is_profile_edit() || bp_is_change_avatar() || bp_is_user_groups() || bp_is_group() || bp_is_group_home() || bp_is_group_create() || bp_is_group_admin_page() || bp_is_group_forum() || bp_is_group_activity() || bp_is_group_forum_topic() || bp_is_group_forum_topic_edit() || bp_is_group_members() || bp_is_group_invites() || bp_is_group_membership_request() || bp_is_group_leave() || bp_is_group_single() || bp_is_user_blogs() || bp_is_user_recent_posts() || bp_is_user_recent_commments() || bp_is_create_blog() || bp_is_user_friends() || bp_is_friend_requests() || bp_is_user_messages() || bp_is_messages_inbox() || bp_is_messages_sentbox() || bp_is_notices() || bp_is_messages_compose_screen() || bp_is_activation_page() || bp_is_register_page())) {
return true;
}
return false;
}
示例15: 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));
}