-
Notifications
You must be signed in to change notification settings - Fork 8
/
bp-loader.php
92 lines (80 loc) · 2.9 KB
/
bp-loader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* The BuddyPress Plugin.
*
* BuddyPress is social networking software with a twist from the creators of WordPress.
*
* @package BuddyPress
* @subpackage Main
* @since 1.0.0
*/
/**
* Plugin Name: BuddyPress
* Plugin URI: https://buddypress.org/
* Description: BuddyPress adds community features to WordPress. Member Profiles, Activity Streams, Direct Messaging, Notifications, and more!
* Author: The BuddyPress Community
* Author URI: https://buddypress.org/
* Version: 4.0.0
* Text Domain: buddypress
* Domain Path: /bp-languages/
* License: GPLv2 or later (license.txt)
*/
/**
* This files should always remain compatible with the minimum version of
* PHP supported by WordPress.
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
// Required PHP version.
define( 'BP_REQUIRED_PHP_VERSION', '5.3.0' );
/**
* The main function responsible for returning the one true BuddyPress Instance to functions everywhere.
*
* Use this function like you would a global variable, except without needing
* to declare the global.
*
* Example: <?php $bp = buddypress(); ?>
*
* @return BuddyPress|null The one true BuddyPress Instance.
*/
function buddypress() {
return BuddyPress::instance();
}
/**
* Adds an admin notice to installations that don't meet BP's minimum PHP requirement.
*
* @since 2.8.0
*/
function bp_php_requirements_notice() {
if ( ! current_user_can( 'update_core' ) ) {
return;
}
?>
<div id="message" class="error notice">
<p><strong><?php esc_html_e( 'Your site does not support BuddyPress.', 'buddypress' ); ?></strong></p>
<?php /* translators: 1: current PHP version, 2: required PHP version */ ?>
<p><?php printf( esc_html__( 'Your site is currently running PHP version %1$s, while BuddyPress requires version %2$s or greater.', 'buddypress' ), esc_html( phpversion() ), esc_html( BP_REQUIRED_PHP_VERSION ) ); ?> <?php printf( __( 'See <a href="%s">the Codex guide</a> for more information.', 'buddypress' ), 'https://codex.buddypress.org/getting-started/buddypress-2-8-will-require-php-5-3/' ); ?></p>
<p><?php esc_html_e( 'Please update your server or deactivate BuddyPress.', 'buddypress' ); ?></p>
</div>
<?php
}
if ( version_compare( phpversion(), BP_REQUIRED_PHP_VERSION, '<' ) ) {
add_action( 'admin_notices', 'bp_php_requirements_notice' );
add_action( 'network_admin_notices', 'bp_php_requirements_notice' );
return;
} else {
require dirname( __FILE__ ) . '/class-buddypress.php';
/*
* Hook BuddyPress early onto the 'plugins_loaded' action.
*
* This gives all other plugins the chance to load before BuddyPress,
* to get their actions, filters, and overrides setup without
* BuddyPress being in the way.
*/
if ( defined( 'BUDDYPRESS_LATE_LOAD' ) ) {
add_action( 'plugins_loaded', 'buddypress', (int) BUDDYPRESS_LATE_LOAD );
// "And now here's something we hope you'll really like!"
} else {
$GLOBALS['bp'] = buddypress();
}
}