[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/ -> bp-loader.php (source)

   1  <?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 adds community features to WordPress. Member Profiles, Activity Streams, Direct Messaging, Notifications, and more!
  16   * Author:            The BuddyPress Community
  17   * Author URI:        https://buddypress.org
  18   * License:           GNU General Public License v2 or later
  19   * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
  20   * Text Domain:       buddypress
  21   * Domain Path:       /bp-languages/
  22   * Requires PHP:      5.6
  23   * Requires at least: 5.4
  24   * Version:           11.0.0-alpha
  25   */
  26  
  27  /**
  28   * This files should always remain compatible with the minimum version of
  29   * PHP supported by WordPress.
  30   */
  31  
  32  // Exit if accessed directly.
  33  defined( 'ABSPATH' ) || exit;
  34  
  35  // Required PHP version.
  36  define( 'BP_REQUIRED_PHP_VERSION', '5.6.0' );
  37  
  38  /**
  39   * The main function responsible for returning the one true BuddyPress Instance to functions everywhere.
  40   *
  41   * Use this function like you would a global variable, except without needing
  42   * to declare the global.
  43   *
  44   * Example: <?php $bp = buddypress(); ?>
  45   *
  46   * @return BuddyPress|null The one true BuddyPress Instance.
  47   */
  48  function buddypress() {
  49      return BuddyPress::instance();
  50  }
  51  
  52  /**
  53   * Adds an admin notice to installations that don't meet BP's minimum PHP requirement.
  54   *
  55   * @since 2.8.0
  56   */
  57  function bp_php_requirements_notice() {
  58      if ( ! current_user_can( 'update_core' ) ) {
  59          return;
  60      }
  61  
  62      ?>
  63  
  64      <div id="message" class="error notice is-dismissible">
  65          <p><strong><?php esc_html_e( 'Your site does not support BuddyPress.', 'buddypress' ); ?></strong></p>
  66          <?php /* translators: 1: current PHP version, 2: required PHP version */ ?>
  67          <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>
  68          <p><?php esc_html_e( 'Please update your server or deactivate BuddyPress.', 'buddypress' ); ?></p>
  69      </div>
  70  
  71      <?php
  72  }
  73  
  74  if ( version_compare( phpversion(), BP_REQUIRED_PHP_VERSION, '<' ) ) {
  75      add_action( 'admin_notices', 'bp_php_requirements_notice' );
  76      add_action( 'network_admin_notices', 'bp_php_requirements_notice' );
  77      return;
  78  } else {
  79      require dirname( __FILE__ ) . '/class-buddypress.php';
  80  
  81      /*
  82       * Hook BuddyPress early onto the 'plugins_loaded' action.
  83       *
  84       * This gives all other plugins the chance to load before BuddyPress,
  85       * to get their actions, filters, and overrides setup without
  86       * BuddyPress being in the way.
  87       */
  88      if ( defined( 'BUDDYPRESS_LATE_LOAD' ) ) {
  89          add_action( 'plugins_loaded', 'buddypress', (int) BUDDYPRESS_LATE_LOAD );
  90  
  91      // "And now here's something we hope you'll really like!".
  92      } else {
  93          $GLOBALS['bp'] = buddypress();
  94      }
  95  }


Generated: Sat Dec 21 01:00:58 2024 Cross-referenced by PHPXref 0.7.1