本文整理汇总了PHP中bp_core_add_page_mappings函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_add_page_mappings函数的具体用法?PHP bp_core_add_page_mappings怎么用?PHP bp_core_add_page_mappings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_add_page_mappings函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
/*
* WP's test suite wipes out BP's directory page mappings with `_delete_all_posts()`.
* We must reestablish them before our tests can be successfully run.
*/
bp_core_add_page_mappings(bp_get_option('bp-active-components'), 'delete');
// Fake WP mail globals, to avoid errors
add_filter('wp_mail', array('BP_UnitTestCase', 'setUp_wp_mail'));
add_filter('wp_mail_from', array('BP_UnitTestCase', 'tearDown_wp_mail'));
}
示例2: setUp
public function setUp()
{
parent::setUp();
/*
* WP's test suite wipes out BP's directory page mappings with `_delete_all_posts()`.
* We must reestablish them before our tests can be successfully run.
*/
bp_core_add_page_mappings(bp_get_option('bp-active-components'), 'delete');
$this->factory = new BP_UnitTest_Factory();
// Fixes warnings in multisite functions
$_SERVER['REMOTE_ADDR'] = '';
global $wpdb;
// Clean up after autocommits.
add_action('bp_blogs_recorded_existing_blogs', array($this, 'set_autocommit_flag'));
// Make sure Activity actions are reset before each test
$this->reset_bp_activity_actions();
// Make sure all Post types activities globals are reset before each test
$this->reset_bp_activity_post_types_globals();
}
示例3: single_site_registration_on
/**
* Create registration pages when single site registration is turned on.
*
* @since 2.7.0
*
* @param string $old_value
* @param string $value
*/
public function single_site_registration_on($old_value, $value)
{
// Single site.
if (!is_multisite() && !empty($value)) {
bp_core_add_page_mappings(array('register' => 1, 'activate' => 1));
}
}
示例4: bp_core_admin_components_settings_handler
/**
* Handle saving the Component settings.
*
* @since 1.6.0
*
* @todo Use settings API when it supports saving network settings
*/
function bp_core_admin_components_settings_handler()
{
// Bail if not saving settings.
if (!isset($_POST['bp-admin-component-submit'])) {
return;
}
// Bail if nonce fails.
if (!check_admin_referer('bp-admin-component-setup')) {
return;
}
// Settings form submitted, now save the settings. First, set active components.
if (isset($_POST['bp_components'])) {
// Load up BuddyPress.
$bp = buddypress();
// Save settings and upgrade schema.
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
require_once $bp->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php';
$submitted = stripslashes_deep($_POST['bp_components']);
$bp->active_components = bp_core_admin_get_active_components_from_submitted_settings($submitted);
bp_core_install($bp->active_components);
bp_core_add_page_mappings($bp->active_components);
bp_update_option('bp-active-components', $bp->active_components);
}
// Where are we redirecting to?
$base_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-components', 'updated' => 'true'), 'admin.php'));
// Redirect.
wp_redirect($base_url);
die;
}
示例5: test_bp_core_activation_notice_register_activate_pages_created_signup_allowed
/**
* @group bp_core_activation_notice
*/
public function test_bp_core_activation_notice_register_activate_pages_created_signup_allowed()
{
$bp = buddypress();
$reset_bp_pages = $bp->pages;
$reset_admin_notices = $bp->admin->notices;
add_filter('bp_get_signup_allowed', '__return_true', 999);
$ac = buddypress()->active_components;
bp_core_add_page_mappings(array_keys($ac));
// Reset pages
$bp->pages = bp_core_get_directory_pages();
bp_core_activation_notice();
remove_filter('bp_get_signup_allowed', '__return_true', 999);
$missing_pages = array();
foreach (buddypress()->admin->notices as $notice) {
preg_match_all('/<strong>(.+?)<\\/strong>/', $notice['message'], $missing_pages);
}
$this->assertNotContains('Register', $missing_pages[1]);
$this->assertNotContains('Activate', $missing_pages[1]);
// Reset buddypress() vars
$bp->pages = $reset_bp_pages;
$bp->admin->notices = $reset_admin_notices;
}
示例6: test_bp_core_get_directory_pages_register_activate_page_notcreated_signups_notallowed
public function test_bp_core_get_directory_pages_register_activate_page_notcreated_signups_notallowed()
{
add_filter('bp_get_signup_allowed', '__return_false', 999);
$ac = buddypress()->active_components;
bp_core_add_page_mappings(array_keys($ac));
$directory_pages = bp_core_get_directory_pages();
remove_filter('bp_get_signup_allowed', '__return_false', 999);
$this->assertFalse(isset($directory_pages->register));
$this->assertFalse(isset($directory_pages->activate));
}
示例7: bp_version_updater
/**
* BuddyPress's version updater looks at what the current database version is,
* and runs whatever other code is needed.
*
* This is most-often used when the data schema changes, but should also be used
* to correct issues with BuddyPress metadata silently on software update.
*
* @since BuddyPress (1.7)
*/
function bp_version_updater()
{
// Get the raw database version
$raw_db_version = (int) bp_get_db_version_raw();
$default_components = apply_filters('bp_new_install_default_components', array('activity' => 1, 'members' => 1, 'xprofile' => 1));
require_once BP_PLUGIN_DIR . '/bp-core/admin/bp-core-schema.php';
// Install BP schema and activate only Activity and XProfile
if (bp_is_install()) {
// Apply schema and set Activity and XProfile components as active
bp_core_install($default_components);
bp_update_option('bp-active-components', $default_components);
bp_core_add_page_mappings($default_components, 'delete');
// Upgrades
} else {
// Run the schema install to update tables
bp_core_install();
// 1.5
if ($raw_db_version < 1801) {
bp_update_to_1_5();
bp_core_add_page_mappings($default_components, 'delete');
}
// 1.6
if ($raw_db_version < 6067) {
bp_update_to_1_6();
}
}
/** All done! *************************************************************/
// Bump the version
bp_version_bump();
}
示例8: bp_version_updater
/**
* Initialize an update or installation of BuddyPress.
*
* BuddyPress's version updater looks at what the current database version is,
* and runs whatever other code is needed - either the "update" or "install"
* code.
*
* This is most often used when the data schema changes, but should also be used
* to correct issues with BuddyPress metadata silently on software update.
*
* @since 1.7.0
*/
function bp_version_updater()
{
// Get the raw database version
$raw_db_version = (int) bp_get_db_version_raw();
/**
* Filters the default components to activate for a new install.
*
* @since 1.7.0
*
* @param array $value Array of default components to activate.
*/
$default_components = apply_filters('bp_new_install_default_components', array('activity' => 1, 'members' => 1, 'settings' => 1, 'xprofile' => 1, 'notifications' => 1));
require_once buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php';
// Install BP schema and activate only Activity and XProfile
if (bp_is_install()) {
// Apply schema and set Activity and XProfile components as active
bp_core_install($default_components);
bp_update_option('bp-active-components', $default_components);
bp_core_add_page_mappings($default_components, 'delete');
// Upgrades
} else {
// Run the schema install to update tables
bp_core_install();
// 1.5.0
if ($raw_db_version < 1801) {
bp_update_to_1_5();
bp_core_add_page_mappings($default_components, 'delete');
}
// 1.6.0
if ($raw_db_version < 6067) {
bp_update_to_1_6();
}
// 1.9.0
if ($raw_db_version < 7553) {
bp_update_to_1_9();
}
// 1.9.2
if ($raw_db_version < 7731) {
bp_update_to_1_9_2();
}
// 2.0.0
if ($raw_db_version < 7892) {
bp_update_to_2_0();
}
// 2.0.1
if ($raw_db_version < 8311) {
bp_update_to_2_0_1();
}
// 2.2.0
if ($raw_db_version < 9181) {
bp_update_to_2_2();
}
// 2.3.0
if ($raw_db_version < 9615) {
bp_update_to_2_3();
}
}
/** All done! *************************************************************/
// Bump the version
bp_version_bump();
}
示例9: bp_version_updater
/**
* Initialize an update or installation of BuddyPress.
*
* BuddyPress's version updater looks at what the current database version is,
* and runs whatever other code is needed - either the "update" or "install"
* code.
*
* This is most often used when the data schema changes, but should also be used
* to correct issues with BuddyPress metadata silently on software update.
*
* @since 1.7.0
*/
function bp_version_updater()
{
// Get the raw database version.
$raw_db_version = (int) bp_get_db_version_raw();
/**
* Filters the default components to activate for a new install.
*
* @since 1.7.0
*
* @param array $value Array of default components to activate.
*/
$default_components = apply_filters('bp_new_install_default_components', array('activity' => 1, 'members' => 1, 'settings' => 1, 'xprofile' => 1, 'notifications' => 1));
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
require_once buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php';
$switched_to_root_blog = false;
// Make sure the current blog is set to the root blog.
if (!bp_is_root_blog()) {
switch_to_blog(bp_get_root_blog_id());
bp_register_taxonomies();
$switched_to_root_blog = true;
}
// Install BP schema and activate only Activity and XProfile.
if (bp_is_install()) {
// Apply schema and set Activity and XProfile components as active.
bp_core_install($default_components);
bp_update_option('bp-active-components', $default_components);
bp_core_add_page_mappings($default_components, 'delete');
bp_core_install_emails();
// Upgrades.
} else {
// Run the schema install to update tables.
bp_core_install();
// Version 1.5.0.
if ($raw_db_version < 1801) {
bp_update_to_1_5();
bp_core_add_page_mappings($default_components, 'delete');
}
// Version 1.6.0.
if ($raw_db_version < 6067) {
bp_update_to_1_6();
}
// Version 1.9.0.
if ($raw_db_version < 7553) {
bp_update_to_1_9();
}
// Version 1.9.2.
if ($raw_db_version < 7731) {
bp_update_to_1_9_2();
}
// Version 2.0.0.
if ($raw_db_version < 7892) {
bp_update_to_2_0();
}
// Version 2.0.1.
if ($raw_db_version < 8311) {
bp_update_to_2_0_1();
}
// Version 2.2.0.
if ($raw_db_version < 9181) {
bp_update_to_2_2();
}
// Version 2.3.0.
if ($raw_db_version < 9615) {
bp_update_to_2_3();
}
// Version 2.5.0.
if ($raw_db_version < 10440) {
bp_update_to_2_5();
}
// Version 2.7.0.
if ($raw_db_version < 11105) {
bp_update_to_2_7();
}
}
/* All done! *************************************************************/
// Bump the version.
bp_version_bump();
if ($switched_to_root_blog) {
restore_current_blog();
}
}
示例10: array
<?php
$GLOBALS['wp_tests_options'] = array('active_plugins' => array(basename(dirname(dirname(__FILE__))) . '/loader.php', 'buddypress/bp-loader.php'));
require getenv('WP_TESTS_DIR') . '/includes/bootstrap.php';
require_once BP_PLUGIN_DIR . 'bp-core/admin/bp-core-schema.php';
$components = array('groups' => 1, 'activity' => 1);
bp_core_install($components);
bp_update_option('bp-active-components', $components);
bp_core_add_page_mappings($components, 'delete');
示例11: test_bp_core_add_page_mappings
/**
* @group bp_core_add_page_mappings
*/
public function test_bp_core_add_page_mappings()
{
$bp = buddypress();
$reset_bp_pages = $bp->pages;
$expected = array('activity', 'groups', 'members');
if (is_multisite()) {
$expected = array('activity', 'blogs', 'groups', 'members');
}
bp_core_add_page_mappings($bp->active_components);
$bp_pages = array_keys(bp_get_option('bp-pages'));
sort($bp_pages);
$this->assertEquals($expected, $bp_pages);
$bp->pages = $reset_bp_pages;
}
示例12: test_bp_core_activation_notice_register_activate_pages_created_signup_allowed
/**
* @group bp_core_activation_notice
*/
public function test_bp_core_activation_notice_register_activate_pages_created_signup_allowed()
{
$bp = buddypress();
$reset_bp_pages = $bp->pages;
$reset_admin_notices = $bp->admin->notices;
add_filter('bp_get_signup_allowed', '__return_true', 999);
$ac = buddypress()->active_components;
bp_core_add_page_mappings(array_keys($ac));
// Reset pages
$bp->pages = bp_core_get_directory_pages();
bp_core_activation_notice();
remove_filter('bp_get_signup_allowed', '__return_true', 999);
$missing_pages = array();
foreach (buddypress()->admin->notices as $notice) {
if (false !== strpos($notice['message'], 'BuddyPress is almost ready')) {
continue;
}
preg_match_all('/<strong>(.+?)<\\/strong>/', $notice['message'], $missing_pages);
}
$this->assertEmpty($missing_pages);
// Reset buddypress() vars
$bp->pages = $reset_bp_pages;
$bp->admin->notices = $reset_admin_notices;
}