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


Generated: Wed Dec 19 01:01:54 2018 Cross-referenced by PHPXref 0.7.1