Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/19/2017 07:25:11 PM (7 years ago)
Author:
boonebgorges
Message:

Prevent BuddyPress from loading when the minimum PHP version is not met.

When the server is running a version of PHP lower than 5.3.0, an
admin notice is thrown, and the rest of BuddyPress is not loaded.

The bp-loader.php file must remain compatible with WP's minimum PHP
version, to prevent fatal errors when activating BuddyPress. In order
to reduce the cognitive overhead involved in maintaining PHP compat
for this file, the BuddyPress class has been moved into its own
class-buddypress.php file.

Props r-a-y.
See #7277.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/class-buddypress.php

    r11388 r11389  
    11<?php
    2 /**
    3  * The BuddyPress Plugin.
    4  *
    5  * BuddyPress is social networking software with a twist from the creators of WordPress.
    6  *
    7  * @package BuddyPress
    8  * @subpackage Main
    9  * @since 1.0.0
    10  */
    11 
    12 /**
    13  * Plugin Name: BuddyPress
    14  * Plugin URI:  https://buddypress.org/
    15  * Description: BuddyPress helps site builders and WordPress developers add community features to their websites, with user profile fields, activity streams, messaging, and notifications.
    16  * Author:      The BuddyPress Community
    17  * Author URI:  https://buddypress.org/
    18  * Version:     2.8.0-alpha
    19  * Text Domain: buddypress
    20  * Domain Path: /bp-languages/
    21  * License:     GPLv2 or later (license.txt)
    22  */
    23 
    24 // Exit if accessed directly
     2
     3// Exit if accessed directly.
    254defined( 'ABSPATH' ) || exit;
    265
    27 /** Constants *****************************************************************/
    28 
    29 if ( !class_exists( 'BuddyPress' ) ) :
    306/**
    317 * Main BuddyPress Class.
     
    757733    }
    758734}
    759 
    760 /**
    761  * The main function responsible for returning the one true BuddyPress Instance to functions everywhere.
    762  *
    763  * Use this function like you would a global variable, except without needing
    764  * to declare the global.
    765  *
    766  * Example: <?php $bp = buddypress(); ?>
    767  *
    768  * @return BuddyPress The one true BuddyPress Instance.
    769  */
    770 function buddypress() {
    771     return BuddyPress::instance();
    772 }
    773 
    774 /**
    775  * Hook BuddyPress early onto the 'plugins_loaded' action.
    776  *
    777  * This gives all other plugins the chance to load before BuddyPress, to get
    778  * their actions, filters, and overrides setup without BuddyPress being in the
    779  * way.
    780  */
    781 if ( defined( 'BUDDYPRESS_LATE_LOAD' ) ) {
    782     add_action( 'plugins_loaded', 'buddypress', (int) BUDDYPRESS_LATE_LOAD );
    783 
    784 // "And now here's something we hope you'll really like!"
    785 } else {
    786     $GLOBALS['bp'] = buddypress();
    787 }
    788 
    789 endif;
Note: See TracChangeset for help on using the changeset viewer.