本文整理汇总了PHP中BP_Component::setup_globals方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Component::setup_globals方法的具体用法?PHP BP_Component::setup_globals怎么用?PHP BP_Component::setup_globals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Component
的用法示例。
在下文中一共展示了BP_Component::setup_globals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_globals
/**
* Set up global settings for the blogs component.
*
* The BP_BLOGS_SLUG constant is deprecated, and only used here for
* backwards compatibility.
*
* @since BuddyPress (1.5.0)
*
* @see BP_Component::setup_globals() for description of parameters.
*
* @param array $args See {@link BP_Component::setup_globals()}.
*/
public function setup_globals($args = array())
{
$bp = buddypress();
if (!defined('BP_BLOGS_SLUG')) {
define('BP_BLOGS_SLUG', $this->id);
}
// Global tables for messaging component
$global_tables = array('table_name' => $bp->table_prefix . 'bp_user_blogs', 'table_name_blogmeta' => $bp->table_prefix . 'bp_user_blogs_blogmeta');
$meta_tables = array('blog' => $bp->table_prefix . 'bp_user_blogs_blogmeta');
// All globals for blogs component.
$args = array('slug' => BP_BLOGS_SLUG, 'root_slug' => isset($bp->pages->blogs->slug) ? $bp->pages->blogs->slug : BP_BLOGS_SLUG, 'has_directory' => is_multisite(), 'notification_callback' => 'bp_blogs_format_notifications', 'search_string' => __('Search sites...', 'buddypress'), 'autocomplete_all' => defined('BP_MESSAGES_AUTOCOMPLETE_ALL'), 'global_tables' => $global_tables, 'meta_tables' => $meta_tables);
// Setup the globals
parent::setup_globals($args);
/*
* Set up the post post type to track.
*
* In case the config is not multisite, the blog_public option is ignored.
*/
if (0 !== apply_filters('bp_is_blog_public', (int) get_option('blog_public')) || !is_multisite()) {
/**
* Filters the post types to track for the Blog component.
*
* @since BuddyPress (1.5.0)
*
* @param array $value Array of post types to track.
*/
$post_types = apply_filters('bp_blogs_record_post_post_types', array('post'));
foreach ($post_types as $post_type) {
add_post_type_support($post_type, 'buddypress-activity');
}
}
// Filter the generic track parameters for the 'post' post type.
add_filter('bp_activity_get_post_type_tracking_args', array($this, 'post_tracking_args'), 10, 2);
}
示例2: setup_globals
/**
* Setup globals.
*
* @global obj $bp BuddyPress instance
*/
public function setup_globals($args = array())
{
global $bp;
if (!defined('BP_FOLLOWERS_SLUG')) {
define('BP_FOLLOWERS_SLUG', 'followers');
}
if (!defined('BP_FOLLOWING_SLUG')) {
define('BP_FOLLOWING_SLUG', 'following');
}
// Set up the $globals array
$globals = array('notification_callback' => 'bp_follow_format_notifications', 'global_tables' => array('table_name' => $bp->table_prefix . 'bp_follow'));
// Let BP_Component::setup_globals() do its work.
parent::setup_globals($globals);
// register other globals since BP isn't really flexible enough to add it
// in the setup_globals() method
//
// would rather do away with this, but keeping it for backpat
$bp->follow->followers = new stdClass();
$bp->follow->following = new stdClass();
$bp->follow->followers->slug = constant('BP_FOLLOWERS_SLUG');
$bp->follow->following->slug = constant('BP_FOLLOWING_SLUG');
// locally cache total count values for logged-in user
if (is_user_logged_in()) {
$bp->loggedin_user->total_follow_counts = bp_follow_total_follow_counts(array('user_id' => bp_loggedin_user_id()));
}
// locally cache total count values for displayed user
if (bp_is_user() && bp_loggedin_user_id() != bp_displayed_user_id()) {
$bp->displayed_user->total_follow_counts = bp_follow_total_follow_counts(array('user_id' => bp_displayed_user_id()));
}
}
示例3: setup_globals
/**
* Setting up buddypress component properties
* This is an override
* @return void
*/
public function setup_globals($args = array())
{
if (!defined('BP_SITE_SUBSCRIBER_SLUG')) {
define('BP_SITE_SUBSCRIBER_SLUG', $this->id);
}
$args = array('slug' => BP_SITE_SUBSCRIBER_SLUG, 'has_directory' => false, 'notification_callback' => 'bp_site_subscriber_notification_format');
parent::setup_globals($args);
}
示例4: setup_globals
/**
* Set up BuddyDrive globals
*
* @package BuddyDrive
* @since 1.0
*
* @global obj $bp BuddyPress's global object
* @uses buddypress() to get the instance data
* @uses buddydrive_get_slug() to get BuddyDrive root slug
*/
public function setup_globals($args = array())
{
$bp = buddypress();
// Set up the $globals array to be passed along to parent::setup_globals()
$globals = array('slug' => buddydrive_get_slug(), 'root_slug' => isset($bp->pages->{$this->id}->slug) ? $bp->pages->{$this->id}->slug : buddydrive_get_slug(), 'has_directory' => true, 'directory_title' => sprintf(__('%s download page', 'buddydrive'), buddydrive_get_name()), 'notification_callback' => 'buddydrive_format_notifications', 'search_string' => __('Search files...', 'buddydrive'));
// Let BP_Component::setup_globals() do its work.
parent::setup_globals($globals);
}
示例5: setup_globals
/**
* Set up bp-mutual-friends global settings.
* @since BuddyPress (1.5.0)
*
* @see BP_Component::setup_globals() for description of parameters.
*
* @param array $args See {@link BP_Component::setup_globals()}.
*/
public function setup_globals($args = array())
{
// Define a slug, if necessary
if (!defined('BP_MUTUAL_FRIENDS_SLUG')) {
define('BP_MUTUAL_FRIENDS_SLUG', $this->id);
}
parent::setup_globals($args);
}
示例6: array
/**
* Set up global data.
*
* @since 1.0.0
* @access public
*
* @param array $args See BP_Component::setup_globals().
*/
function setup_globals($args = array())
{
if (!defined('BP_MUTE_SLUG')) {
define('BP_MUTE_SLUG', 'mute');
}
$args = array('slug' => BP_MUTE_SLUG, 'global_tables' => array('table_name' => buddypress()->table_prefix . 'bp_mute'), 'notification_callback' => 'bp_mute_format_notifications');
parent::setup_globals($args);
}
示例7: setup_globals
/**
* Setup globals.
*
* The BP_SETTINGS_SLUG constant is deprecated, and only used here for
* backwards compatibility.
*
* @param array $args Array of arguments.
*
* @since 1.5.0
*/
public function setup_globals($args = array())
{
// Define a slug, if necessary
if (!defined('BP_SETTINGS_SLUG')) {
define('BP_SETTINGS_SLUG', $this->id);
}
// All globals for settings component.
parent::setup_globals(array('slug' => BP_SETTINGS_SLUG, 'has_directory' => false));
}
示例8: setup_globals
/**
* Setup globals
*/
public function setup_globals($globals = array())
{
// Define a slug, if necessary
if (!defined('BP_BUDDYBLOG_SLUG')) {
define('BP_BUDDYBLOG_SLUG', $this->id);
}
$globals = array('slug' => BP_BUDDYBLOG_SLUG, 'root_slug' => BP_BUDDYBLOG_SLUG, 'has_directory' => false, 'notification_callback' => 'buddyblog_format_notifications', 'search_string' => __('Search Posts...', 'buddyblog'), 'global_tables' => array());
parent::setup_globals($globals);
}
示例9: setup_globals
function setup_globals()
{
$bp = buddypress();
$global_tables = array('table_name' => $bp->table_prefix . 'bp_links', 'table_name_categories' => $bp->table_prefix . 'bp_links_categories', 'table_name_votes' => $bp->table_prefix . 'bp_links_votes', 'table_name_linkmeta' => $bp->table_prefix . 'bp_links_linkmeta');
// Set up the $globals array to be passed along to parent::setup_globals()
$globals = array('slug' => BP_LINKS_SLUG, 'root_slug' => isset($bp->pages->{$this->id}->slug) ? $bp->pages->{$this->id}->slug : BP_LINKS_SLUG, 'has_directory' => true, 'notification_callback' => 'bp_links_format_notifications', 'search_string' => __('Search Links...', 'buddypress-links'), 'global_tables' => $global_tables);
// Let BP_Component::setup_globals() do its work.
parent::setup_globals($globals);
$this->forbidden_names = apply_filters('bp_links_forbidden_names', array('add', 'admin', 'all', 'create', 'delete', 'feed', 'links', 'my-links', 'submit', 'active', 'high-votes', 'most-votes', 'newest', 'popular', BP_LINKS_CAT_URL_SLUG));
}
示例10: array
function setup_globals($args = array())
{
global $bp;
if (!defined('SA_SLUG')) {
define('SA_SLUG', $this->id);
}
$globals = array('slug' => SA_SLUG, 'root_slug' => isset($bp->pages->{$this->id}->slug) ? $bp->pages->{$this->id}->slug : SA_SLUG, 'has_directory' => false, 'notification_callback' => 'social_articles_format_notifications', 'search_string' => __('Search articles...', 'social-articles'));
if ($this->check_visibility()) {
parent::setup_globals($globals);
}
}
示例11: define
/**
* Setup globals
*
* The BP_SETTINGS_SLUG constant is deprecated, and only used here for
* backwards compatibility.
*
* @since 1.5
* @global obj $bp
*/
function setup_globals()
{
global $bp;
// Define a slug, if necessary
if (!defined('BP_SETTINGS_SLUG')) {
define('BP_SETTINGS_SLUG', $this->id);
}
// All globals for settings component.
$globals = array('slug' => BP_SETTINGS_SLUG, 'has_directory' => false);
parent::setup_globals($globals);
}
示例12: define
/**
* Setup globals
*
* The BP_MEMBERS_SLUG constant is deprecated, and only used here for
* backwards compatibility.
*
* @since 1.5
* @global obj $bp
*/
function setup_globals()
{
global $bp, $current_user, $displayed_user_id;
// Define a slug, if necessary
if (!defined('BP_MEMBERS_SLUG')) {
define('BP_MEMBERS_SLUG', $this->id);
}
$globals = array('path' => BP_PLUGIN_DIR, 'slug' => BP_MEMBERS_SLUG, 'root_slug' => isset($bp->pages->members->slug) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 'has_directory' => true, 'search_string' => __('Search Members...', 'buddypress'));
parent::setup_globals($globals);
/** Logged in user ****************************************************/
// Fetch the full name for the logged in user
$bp->loggedin_user->fullname = bp_core_get_user_displayname(bp_loggedin_user_id());
// Hits the DB on single WP installs so get this separately
$bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin(bp_loggedin_user_id());
// The domain for the user currently logged in. eg: http://domain.com/members/andy
$bp->loggedin_user->domain = bp_core_get_user_domain(bp_loggedin_user_id());
// The core userdata of the user who is currently logged in.
$bp->loggedin_user->userdata = bp_core_get_core_userdata(bp_loggedin_user_id());
/** Displayed user ****************************************************/
// The domain for the user currently being displayed
$bp->displayed_user->domain = bp_core_get_user_domain(bp_displayed_user_id());
// The core userdata of the user who is currently being displayed
$bp->displayed_user->userdata = bp_core_get_core_userdata(bp_displayed_user_id());
// Fetch the full name displayed user
$bp->displayed_user->fullname = bp_core_get_user_displayname(bp_displayed_user_id());
/** Profiles Fallback *************************************************/
if (!bp_is_active('xprofile')) {
$bp->profile->slug = 'profile';
$bp->profile->id = 'profile';
}
/** Default Profile Component *****************************************/
if (!defined('BP_DEFAULT_COMPONENT')) {
if (bp_is_active('activity') && isset($bp->pages->activity)) {
$bp->default_component = bp_get_activity_slug();
} else {
$bp->default_component = 'xprofile' == $bp->profile->id ? 'profile' : $bp->profile->id;
}
} else {
$bp->default_component = BP_DEFAULT_COMPONENT;
}
if (!bp_current_component() && bp_displayed_user_id()) {
/**
* BuddyPress will attempt to resolve to the most specific URL possible,
* to avoid search-engine-unfriendly content reduplication. Filter
* bp_guarantee_unique_uris (and return false) to avoid this behavior
*/
if (apply_filters('bp_guarantee_unique_uris', true)) {
bp_core_redirect(bp_displayed_user_domain() . $bp->default_component);
} else {
$bp->current_component = $bp->default_component;
}
}
}
示例13: setup_globals
function setup_globals()
{
global $bp;
// Defining the slug in this way makes it possible for site admins to override it
if (!defined('BUATP_SLUG')) {
define('BUATP_SLUG', $this->id);
}
// Set up the $globals array to be passed along to parent::setup_globals()
$globals = array('slug' => BUATP_SLUG, 'root_slug' => isset($bp->pages->{$this->id}->slug) ? $bp->pages->{$this->id}->slug : BUATP_SLUG, 'has_directory' => true, 'notification_callback' => 'buatp_format_notifications', 'search_string' => __('Search Members...', 'buddypress'));
// Let BP_Component::setup_globals() do its work.
parent::setup_globals($globals);
}
示例14: setup_globals
/**
* Set up component global data.
*
* @since BuddyPress (1.9.0)
*
* @see BP_Component::setup_globals() for a description of arguments.
*
* @param array $args See BP_Component::setup_globals() for a description.
*/
public function setup_globals($args = array())
{
// Define a slug, if necessary
if (!defined('BP_NOTIFICATIONS_SLUG')) {
define('BP_NOTIFICATIONS_SLUG', $this->id);
}
// Global tables for the notifications component
$global_tables = array('table_name' => bp_core_get_table_prefix() . 'bp_notifications');
// All globals for the notifications component.
// Note that global_tables is included in this array.
$args = array('slug' => BP_NOTIFICATIONS_SLUG, 'has_directory' => false, 'search_string' => __('Search Notifications...', 'buddypress'), 'global_tables' => $global_tables);
parent::setup_globals($args);
}
示例15: array
/**
* SETUP BUDDYPRESS GLOBAL OPTIONS
*
* @since BuddyBoss 2.0
*/
function setup_globals($args = array())
{
global $buddyboss_pics_defaults, $activity_template;
if (isset($options) && $options != null) {
$this->options = $options;
} else {
$this->options = $buddyboss_pics_defaults;
buddyboss_log("PICS Using default config");
}
// Log
buddyboss_log($this->options);
parent::setup_globals(array('has_directory' => false));
}