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


PHP is_buddypress函数代码示例

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


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

示例1: has_access

 /**
  * Verify access to the current content.
  *
  * Related:
  * A reference of available BuddyPress template tags
  * https://codex.buddypress.org/developer/template-tag-reference/
  *
  * @since  1.0.0
  *
  * @param int $id The content post ID to verify access.
  * @return bool|null True if has access, false otherwise.
  *     Null means: Rule not relevant for current page.
  */
 public function has_access($id, $admin_has_access = true)
 {
     global $bp;
     $has_access = null;
     if (!function_exists('bp_current_component')) {
         return null;
     }
     if (is_buddypress()) {
         // Check if access to *all* BuddyPress pages is restricted
         $has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_ALL, $admin_has_access);
     }
     if ($has_access) {
         // General BuddyPress access is either *allowed* or *not denied*
         $component = bp_current_component();
         if (!empty($component)) {
             if ('members' == $component || bp_is_user()) {
                 // Member listing or member profile access.
                 $has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_MEMBERS, $admin_has_access);
             } elseif ('messages' == $component) {
                 // Private messaging direct access.
                 if ('compose' == $bp->current_action) {
                     $has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_PRIVATE_MSG, $admin_has_access);
                 }
             } elseif ('messages' == $component) {
                 // Don't modify, handled by MS_Addon_Buddypress_Rule_Group
             } else {
                 // Other BP pages can be handled by other rules.
                 $has_access = null;
             }
         }
     }
     return apply_filters('ms_rule_buddypress_has_access', $has_access, $id, $this);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:46,代码来源:class-ms-addon-buddypress-rule-model.php

示例2: wff_base_wordpress_page

 /**
  * Add class when it's not a BuddyPress page
  *
  * @since 1.0.0
  */
 function wff_base_wordpress_page($classes)
 {
     if (!is_buddypress() && !is_front_page()) {
         // *append* class to the array
         $classes[] = 'wordpress-page';
     }
     // return it!
     return $classes;
 }
开发者ID:WeFoster,项目名称:wefoster,代码行数:14,代码来源:bp-general.php

示例3: has_cell

 /**
  * Checks if template has BP cell and add filters.
  * 
  * @param type $layout_id
  * @param type $args
  * @return type
  */
 function has_cell($layout_id, $args)
 {
     $layout_settings = WPDD_Layouts::get_layout_settings($layout_id, true);
     $layout_instance = new WPDD_json2layout();
     $layout = $layout_instance->json_decode(wp_json_encode($layout_settings));
     if ($layout->has_cell_of_type('buddypress') && is_buddypress()) {
         // Do something
     }
     return $layout_id;
 }
开发者ID:javierdlahoz,项目名称:paella-development,代码行数:17,代码来源:buddypress.php

示例4: myfossil_plugins_nav_below_fix

function myfossil_plugins_nav_below_fix($nav_below)
{
    if (class_exists('bbPress') && is_bbpress()) {
        return;
    }
    if (class_exists('BuddyPress') && is_buddypress()) {
        return;
    }
    return $nav_below;
}
开发者ID:par-orillonsoft,项目名称:myfossil-theme,代码行数:10,代码来源:plugins.php

示例5: firmasite_buddypress_wpadminbar_fix

function firmasite_buddypress_wpadminbar_fix()
{
    if (is_buddypress() && is_admin_bar_showing()) {
        ?>
	<script>
	jQuery(document).ready(function() {
		jQuery("body").addClass("admin-bar");
	});
	</script>
	<?php 
    }
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:12,代码来源:buddypress.php

示例6: sidebar_options

 /**
  * Get sidebar settings based on the page type
  *
  * @return array
  */
 public function sidebar_options()
 {
     if (is_home()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('blog_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('blog_archive_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position'));
     } elseif (function_exists('is_bbpress') && is_bbpress()) {
         $sidebars = array('global' => Avada()->settings->get('bbpress_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position'));
         if (bbp_is_forum_archive() || bbp_is_topic_archive() || bbp_is_user_home() || bbp_is_search()) {
             $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position'));
         }
     } elseif (function_exists('is_buddypress') && is_buddypress()) {
         $sidebars = array('global' => Avada()->settings->get('bbpress_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position'));
     } elseif (class_exists('WooCommerce') && (is_product() || is_shop())) {
         $sidebars = array('global' => Avada()->settings->get('woo_global_sidebar'), 'sidebar_1' => Avada()->settings->get('woo_sidebar'), 'sidebar_2' => Avada()->settings->get('woo_sidebar_2'), 'position' => Avada()->settings->get('woo_sidebar_position'));
     } elseif (class_exists('WooCommerce') && (is_product_category() || is_product_tag())) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('woocommerce_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('woocommerce_archive_sidebar_2'), 'position' => Avada()->settings->get('woo_sidebar_position'));
     } elseif (is_page()) {
         $sidebars = array('global' => Avada()->settings->get('pages_global_sidebar'), 'sidebar_1' => Avada()->settings->get('pages_sidebar'), 'sidebar_2' => Avada()->settings->get('pages_sidebar_2'), 'position' => Avada()->settings->get('default_sidebar_pos'));
     } elseif (is_single()) {
         $sidebars = array('global' => Avada()->settings->get('posts_global_sidebar'), 'sidebar_1' => Avada()->settings->get('posts_sidebar'), 'sidebar_2' => Avada()->settings->get('posts_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position'));
         if (is_singular('avada_portfolio')) {
             $sidebars = array('global' => Avada()->settings->get('portfolio_global_sidebar'), 'sidebar_1' => Avada()->settings->get('portfolio_sidebar'), 'sidebar_2' => Avada()->settings->get('portfolio_sidebar_2'), 'position' => Avada()->settings->get('portfolio_sidebar_position'));
         } else {
             if (is_singular('tribe_events') || is_singular('tribe_organizer') || is_singular('tribe_venue')) {
                 $sidebars = array('global' => Avada()->settings->get('ec_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ec_sidebar'), 'sidebar_2' => Avada()->settings->get('ec_sidebar_2'), 'position' => Avada()->settings->get('ec_sidebar_pos'));
             }
         }
         if (is_singular('tribe_organizer') || is_singular('tribe_venue')) {
             $sidebars['global'] = 1;
         }
     } elseif (is_archive()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('blog_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('blog_archive_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position'));
         if (is_post_type_archive('avada_portfolio') || is_tax('portfolio_category') || is_tax('portfolio_skills') || is_tax('portfolio_tags')) {
             $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('portfolio_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('portfolio_archive_sidebar_2'), 'position' => Avada()->settings->get('portfolio_sidebar_position'));
         }
     } elseif (is_search()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('search_sidebar'), 'sidebar_2' => Avada()->settings->get('search_sidebar_2'), 'position' => Avada()->settings->get('search_sidebar_position'));
     } else {
         $sidebars = array('global' => Avada()->settings->get('pages_global_sidebar'), 'sidebar_1' => Avada()->settings->get('pages_sidebar'), 'sidebar_2' => Avada()->settings->get('pages_sidebar_2'), 'position' => Avada()->settings->get('default_sidebar_pos'));
     }
     if (class_exists('Tribe__Events__Main') && is_events_archive()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('ec_sidebar'), 'sidebar_2' => Avada()->settings->get('ec_sidebar_2'), 'position' => Avada()->settings->get('ec_sidebar_pos'));
     }
     // Remove sidebars from the certain woocommerce pages
     if (class_exists('WooCommerce')) {
         if (is_cart() || is_checkout() || is_account_page() || get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id'))) {
             $sidebars = array();
         }
     }
     return $sidebars;
 }
开发者ID:Aldebaran10,项目名称:avada,代码行数:55,代码来源:class-avada-layout.php

示例7: bp_admin_bar_my_account_root

/**
 * Add the secondary BuddyPress area to the my-account menu.
 *
 * @since BuddyPress (1.6.0)
 *
 * @global WP_Admin_Bar $wp_admin_bar
 */
function bp_admin_bar_my_account_root()
{
    global $wp_admin_bar;
    // Bail if this is an ajax request
    if (!bp_use_wp_admin_bar() || defined('DOING_AJAX')) {
        return;
    }
    // Only add menu for logged in user
    if (is_user_logged_in()) {
        // Add secondary parent item for all BuddyPress components
        $wp_admin_bar->add_menu(array('parent' => 'my-account', 'id' => 'my-account-buddypress', 'title' => __('My Account', 'buddypress'), 'group' => true, 'meta' => array('class' => 'ab-sub-secondary')));
        // Remove 'Edit' post link as it's not applicable to BP
        // Remove when https://core.trac.wordpress.org/ticket/29538 is addressed
        if (is_buddypress()) {
            $wp_admin_bar->remove_node('edit');
        }
    }
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:25,代码来源:bp-core-adminbar.php

示例8: bf_members_get_redirect_link

/**
 * Get the redirect link
 * 
 * @package BuddyForms
 * @since 0.3 beta
 */
function bf_members_get_redirect_link($id = false)
{
    global $bp, $buddyforms;
    if (!$id) {
        return false;
    }
    if (!is_buddypress()) {
        return false;
    }
    $link = '';
    if (isset($buddyforms) && is_array($buddyforms)) {
        foreach ($buddyforms as $key => $buddyform) {
            if (isset($buddyform['attached_page'])) {
                $attached_page_id = $buddyform['attached_page'];
            }
            if (isset($buddyform['profiles_integration']) && isset($attached_page_id) && $attached_page_id == $id) {
                // $link = bp_loggedin_user_domain() .$buddyform['slug'].'/';
                $link = bp_loggedin_user_domain() . $bp->current_component . '/';
                // fixed for child sub nav tab
                if (isset($bp->unfiltered_uri[1])) {
                    if ($bp->unfiltered_uri[1] == 'create') {
                        if ($bp->unfiltered_uri[2]) {
                            $link = bp_loggedin_user_domain() . $buddyform['slug'] . '/create/' . $bp->unfiltered_uri[2];
                        } else {
                            $link = bp_loggedin_user_domain() . $buddyform['slug'] . '/create/';
                        }
                    }
                    if ($bp->unfiltered_uri[1] == 'edit') {
                        $link = bp_loggedin_user_domain() . $buddyform['slug'] . '/edit/' . $bp->unfiltered_uri[2] . '/' . $bp->unfiltered_uri[3];
                    }
                    if ($bp->unfiltered_uri[1] == 'revision') {
                        $link = bp_loggedin_user_domain() . $buddyform['slug'] . '/revision/' . $bp->unfiltered_uri[2] . '/' . $bp->unfiltered_uri[3] . '/' . $bp->unfiltered_uri[4];
                    }
                    if ($bp->unfiltered_uri[1] == 'page') {
                        $link = bp_loggedin_user_domain() . $buddyform['slug'] . '/page/' . $bp->unfiltered_uri[2] . '/' . $bp->unfiltered_uri[3];
                    }
                }
            }
        }
    }
    return apply_filters('bf_members_get_redirect_link', $link);
}
开发者ID:kishoresahoo,项目名称:BuddyForms-Members,代码行数:48,代码来源:redirect.php

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

示例10: bp_comments_open

/**
 * Force comments_status to 'closed' for BuddyPress post types.
 *
 * @since 1.7.0
 *
 * @param bool $open    True if open, false if closed.
 * @param int  $post_id ID of the post to check.
 *
 * @return bool True if open, false if closed.
 */
function bp_comments_open($open, $post_id = 0)
{
    $retval = is_buddypress() ? false : $open;
    /**
     * Filters whether or not to force comments_status to closed for BuddyPress post types.
     *
     * @since 1.7.0
     *
     * @param bool $retval  Whether or not we are on a BuddyPress post type.
     * @param bool $open    True if comments open, false if closed.
     * @param int  $post_id Post ID for the checked post.
     */
    return apply_filters('bp_force_comment_status', $retval, $open, $post_id);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:24,代码来源:bp-core-theme-compatibility.php

示例11: mfn_sidebar_classes

 function mfn_sidebar_classes($has_both = false)
 {
     $classes = false;
     $both = false;
     if (mfn_ID()) {
         if (get_post_type() == 'page' && mfn_opts_get('single-page-layout')) {
             // Theme Options | Single - Page
             $layout = mfn_opts_get('single-page-layout');
         } elseif (get_post_type() == 'post' && is_single() && mfn_opts_get('single-layout')) {
             // Theme Options | Single - Post
             $layout = mfn_opts_get('single-layout');
         } elseif (get_post_type() == 'portfolio' && is_single() && mfn_opts_get('single-portfolio-layout')) {
             // Theme Options | Single - Portfolio
             $layout = mfn_opts_get('single-portfolio-layout');
         } else {
             // Post Meta
             $layout = get_post_meta(mfn_ID(), 'mfn-post-layout', true);
         }
         switch ($layout) {
             case 'left-sidebar':
                 $classes = ' with_aside aside_left';
                 break;
             case 'right-sidebar':
                 $classes = ' with_aside aside_right';
                 break;
             case 'both-sidebars':
                 $classes = ' with_aside aside_both';
                 $both = true;
                 break;
         }
         // demo
         if ($_GET && key_exists('mfn-s', $_GET)) {
             if ($_GET['mfn-s']) {
                 $classes = ' with_aside aside_right';
             } else {
                 $classes = false;
             }
         }
     }
     // WooCommerce
     if (function_exists('is_woocommerce')) {
         if (is_woocommerce()) {
             if ($layout == 'both-sidebars') {
                 // Only one sidebar for shop
                 $classes = ' with_aside aside_right';
             } elseif (!$layout) {
                 // BeTheme version < 6.4 | DO NOT DELETE
                 if (is_active_sidebar('shop')) {
                     $classes = ' with_aside aside_right';
                 }
             }
         }
         if (is_product() && mfn_opts_get('shop-sidebar') == 'shop') {
             $classes = false;
         }
     }
     // bbPress
     if (function_exists('is_bbpress') && is_bbpress() && is_active_sidebar('forum')) {
         $classes = ' with_aside aside_right';
     }
     // BuddyPress
     if (function_exists('is_buddypress') && is_buddypress() && is_active_sidebar('buddy')) {
         $classes = ' with_aside aside_right';
     }
     // Events Calendar
     if (function_exists('tribe_is_month') && is_active_sidebar('events')) {
         if (tribe_is_month() || tribe_is_day() || tribe_is_event() || tribe_is_event_query() || tribe_is_venue()) {
             $classes = ' with_aside aside_right';
         }
     }
     // check if has both sidebars
     if ($has_both) {
         return $both;
     }
     // Page Template: Blank Page, Under Construction
     if (is_page_template('template-blank.php') || is_page_template('under-construction.php')) {
         $classes = false;
     }
     return $classes;
 }
开发者ID:vinodhip,项目名称:Function-22-Website,代码行数:80,代码来源:theme-head.php

示例12: generate_get_layout

/**
 * Get the layout for the current page
 */
function generate_get_layout()
{
    // Get current post
    global $post;
    // Get Customizer options
    $generate_settings = wp_parse_args(get_option('generate_settings', array()), generate_get_defaults());
    // Set up the layout variable for pages
    $layout = $generate_settings['layout_setting'];
    // Get the individual page/post sidebar metabox value
    $layout_meta = isset($post) ? get_post_meta($post->ID, '_generate-sidebar-layout-meta', true) : '';
    // Set up BuddyPress variable
    $buddypress = false;
    if (function_exists('is_buddypress')) {
        $buddypress = is_buddypress() ? true : false;
    }
    // If we're on the single post page
    // And if we're not on a BuddyPress page - fixes a bug where BP thinks is_single() is true
    if (is_single() && !$buddypress) {
        $layout = null;
        $layout = $generate_settings['single_layout_setting'];
    }
    // If the metabox is set, use it instead of the global settings
    if ('' !== $layout_meta && false !== $layout_meta) {
        $layout = $layout_meta;
    }
    // If we're on the blog, archive, attachment etc..
    if (is_home() || is_archive() || is_search() || is_attachment() || is_tax()) {
        $layout = null;
        $layout = $generate_settings['blog_layout_setting'];
    }
    // Finally, return the layout
    return apply_filters('generate_sidebar_layout', $layout);
}
开发者ID:hoitomt,项目名称:shamrocks_wordpress_site,代码行数:36,代码来源:functions.php

示例13: barcelona_get_option

<?php

if (barcelona_get_option('sidebar_position') == 'none') {
    return;
}
$barcelona_sidebar = barcelona_get_option('default_sidebar');
if (function_exists('buddypress') && is_buddypress()) {
    $barcelona_sidebar = 'barcelona-buddypress-sidebar';
} else {
    if (function_exists('bbpress') && is_bbpress()) {
        $barcelona_sidebar = 'barcelona-bbpress-sidebar';
    }
}
?>
<aside id="sidebar" class="<?php 
echo esc_attr(barcelona_sidebar_class());
?>
">

	<div class="sidebar-inner">

		<?php 
dynamic_sidebar($barcelona_sidebar);
?>

	</div><!-- .sidebar-inner -->

</aside>
开发者ID:yalmaa,项目名称:little-magazine,代码行数:28,代码来源:sidebar.php

示例14: bp_core_load_template

/**
 * Load a specific template file with fallback support.
 *
 * Example:
 *   bp_core_load_template( 'members/index' );
 * Loads:
 *   wp-content/themes/[activated_theme]/members/index.php
 *
 * @param array $templates Array of templates to attempt to load.
 */
function bp_core_load_template($templates)
{
    global $wp_query;
    // Reset the post.
    bp_theme_compat_reset_post(array('ID' => 0, 'is_404' => true, 'post_status' => 'publish'));
    // Set theme compat to false since the reset post function automatically sets
    // theme compat to true.
    bp_set_theme_compat_active(false);
    // Fetch each template and add the php suffix.
    $filtered_templates = array();
    foreach ((array) $templates as $template) {
        $filtered_templates[] = $template . '.php';
    }
    // Only perform template lookup for bp-default themes.
    if (!bp_use_theme_compat_with_current_theme()) {
        $template = locate_template((array) $filtered_templates, false);
        // Theme compat doesn't require a template lookup.
    } else {
        $template = '';
    }
    /**
     * Filters the template locations.
     *
     * Allows plugins to alter where the template files are located.
     *
     * @since 1.1.0
     *
     * @param string $template           Located template path.
     * @param array  $filtered_templates Array of templates to attempt to load.
     */
    $located_template = apply_filters('bp_located_template', $template, $filtered_templates);
    if (!empty($located_template)) {
        // Template was located, lets set this as a valid page and not a 404.
        status_header(200);
        $wp_query->is_page = true;
        $wp_query->is_singular = true;
        $wp_query->is_404 = false;
        /**
         * Fires before the loading of a located template file.
         *
         * @since 1.6.0
         *
         * @param string $located_template Template found to be loaded.
         */
        do_action('bp_core_pre_load_template', $located_template);
        /**
         * Filters the selected template right before loading.
         *
         * @since 1.1.0
         *
         * @param string $located_template Template found to be loaded.
         */
        load_template(apply_filters('bp_load_template', $located_template));
        /**
         * Fires after the loading of a located template file.
         *
         * @since 1.6.0
         *
         * @param string $located_template Template found that was loaded.
         */
        do_action('bp_core_post_load_template', $located_template);
        // Kill any other output after this.
        exit;
        // No template found, so setup theme compatibility.
        // @todo Some other 404 handling if theme compat doesn't kick in.
    } else {
        // We know where we are, so reset important $wp_query bits here early.
        // The rest will be done by bp_theme_compat_reset_post() later.
        if (is_buddypress()) {
            status_header(200);
            $wp_query->is_page = true;
            $wp_query->is_singular = true;
            $wp_query->is_404 = false;
        }
        /**
         * Fires if there are no found templates to load and theme compat is needed.
         *
         * @since 1.7.0
         */
        do_action('bp_setup_theme_compat');
    }
}
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:92,代码来源:bp-core-catchuri.php

示例15: social_warfare_buttons

function social_warfare_buttons($array = array())
{
    // Setup the default Array parameters
    if (!isset($array['where'])) {
        $array['where'] = 'default';
    }
    if (!isset($array['echo'])) {
        $array['echo'] = true;
    }
    if (!isset($array['content'])) {
        $array['content'] = false;
    }
    // Get the options...or create them if they don't exist
    if (isset($array['post_id'])) {
        $postID = $array['post_id'];
    } else {
        $postID = get_the_ID();
    }
    $options = swp_get_user_options();
    // Check to see if display location was specifically defined for this post
    $specWhere = get_post_meta($postID, 'nc_postLocation', true);
    if (!$specWhere) {
        $specWhere = 'default';
    }
    if ($array['where'] == 'default') {
        // If we are on a single page or post
        if (is_singular() && !is_home() && !is_archive()) {
            // Make sure this is the main loop
            //if( get_permalink( $postID ) == swp_get_current_url() ) :
            // Check if a specific display value has not been set for this specific post
            if ($specWhere == 'default' || $specWhere == '') {
                $postType = get_post_type($postID);
                if (isset($options['location_' . $postType])) {
                    $array['where'] = $options['location_' . $postType];
                } else {
                    $array['where'] = 'none';
                }
            } else {
                $array['where'] = $specWhere;
            }
            // If it's not the main loop
            //else:
            //	$array['where'] = 'none';
            //endif;
            // If we are on an archive or home page
        } else {
            $array['where'] = $options['locationSite'];
        }
    }
    // Disable the buttons on Buddy Press pages
    if (function_exists('is_buddypress') && is_buddypress()) {
        return $array['content'];
        // Disable the buttons if the location is set to "None / Manual"
    } elseif ($array['where'] == 'none' && !isset($array['devs'])) {
        return $array['content'];
        // Disable the button if we're not in the loop, unless there is no content which means the function was called by a developer.
    } elseif ((!is_main_query() || !in_the_loop()) && !isset($array['devs'])) {
        return $array['content'];
        // Don't do anything if we're in the admin section
    } elseif (is_admin()) {
        return $array['content'];
        // If all the checks pass, let's make us some buttons!
    } else {
        // Set the options for the horizontal floating bar
        $postType = get_post_type($postID);
        $spec_float_where = get_post_meta($postID, 'nc_floatLocation', true);
        if (isset($array['float']) && $array['float'] == 'ignore') {
            $floatOption = 'float_ignore';
        } elseif ($spec_float_where == 'off' && $options['buttonFloat'] != 'float_ignore') {
            $floatOption = 'floatNone';
        } elseif ($options['float'] && is_singular() && $options['float_location_' . $postType] == 'on') {
            $floatOption = 'float' . ucfirst($options['floatOption']);
        } else {
            $floatOption = 'floatNone';
        }
        // Disable the plugin on feeds, search results, and non-published content
        if (!is_feed() && !is_search() && get_post_status($postID) == 'publish') {
            // Acquire the social stats from the networks
            if (isset($array['url'])) {
                $buttonsArray['url'] = $array['url'];
            } else {
                $buttonsArray['url'] = get_permalink($postID);
            }
            // Fetch the share counts
            $buttonsArray['shares'] = get_social_warfare_shares($postID);
            // Pass the swp_options into the array so we can pass it into the filter
            $buttonsArray['options'] = $options;
            // Customize which buttosn we're going to display
            if (isset($array['buttons'])) {
                // Fetch the global names and keys
                $swp_options = array();
                $swp_available_options = apply_filters('swp_options', $swp_options);
                $available_buttons = $swp_available_options['options']['swp_display']['buttons']['content'];
                // Split the comma separated list into an array
                $button_set_array = explode(',', $array['buttons']);
                // Match the names in the list to their appropriate system-wide keys
                foreach ($button_set_array as $button) {
                    // Trim the network name in case of white space
                    $button = trim($button);
                    // Convert the names to their systme-wide keys
//.........这里部分代码省略.........
开发者ID:warfare-plugins,项目名称:social-warfare,代码行数:101,代码来源:buttons-standard.php


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