Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/09/2011 05:43:09 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Move simple global variable assignments from BP_Core into BuddyPress class as default assignments. Move core component includes into BuddyPress::includes().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-loader.php

    r5311 r5316  
    11<?php
     2
     3/**
     4 * BuddyPress Core Loader
     5 *
     6 * Core contains the commonly used functions, classes, and API's
     7 *
     8 * @package BuddyPress
     9 * @subpackage Core
     10 */
     11
    212// Exit if accessed directly
    313if ( !defined( 'ABSPATH' ) ) exit;
    414
    5 // Require all of the BuddyPress core libraries
    6 require( BP_PLUGIN_DIR . '/bp-core/bp-core-cache.php'      );
    7 require( BP_PLUGIN_DIR . '/bp-core/bp-core-hooks.php'      );
    8 require( BP_PLUGIN_DIR . '/bp-core/bp-core-cssjs.php'      );
    9 require( BP_PLUGIN_DIR . '/bp-core/bp-core-update.php'     );
    10 require( BP_PLUGIN_DIR . '/bp-core/bp-core-classes.php'    );
    11 require( BP_PLUGIN_DIR . '/bp-core/bp-core-filters.php'    );
    12 require( BP_PLUGIN_DIR . '/bp-core/bp-core-avatars.php'    );
    13 require( BP_PLUGIN_DIR . '/bp-core/bp-core-widgets.php'    );
    14 require( BP_PLUGIN_DIR . '/bp-core/bp-core-template.php'   );
    15 require( BP_PLUGIN_DIR . '/bp-core/bp-core-buddybar.php'   );
    16 require( BP_PLUGIN_DIR . '/bp-core/bp-core-catchuri.php'   );
    17 require( BP_PLUGIN_DIR . '/bp-core/bp-core-component.php'  );
    18 require( BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php'  );
    19 require( BP_PLUGIN_DIR . '/bp-core/bp-core-moderation.php' );
    20 
    21 // Load deprecated functions
    22 require( BP_PLUGIN_DIR . '/bp-core/deprecated/1.5.php' );
    23 //require( BP_PLUGIN_DIR . '/bp-core/deprecated/1.6.php' );
    24 
    25 // Load the WP admin bar.
    26 if ( !defined( 'BP_DISABLE_ADMIN_BAR' ) )
    27     require( BP_PLUGIN_DIR . '/bp-core/bp-core-adminbar.php'  );
    28 
    29 // Move active components from sitemeta, if necessary
    30 // Provides backpat with earlier versions of BP
    31 if ( is_multisite() && $active_components = get_site_option( 'bp-active-components' ) )
    32     bp_update_option( 'bp-active-components', $active_components );
    33 
    3415class BP_Core extends BP_Component {
    3516
     17    /**
     18     * Start the members component creation process
     19     *
     20     * @since BuddyPress (1.5)
     21     *
     22     * @uses BP_Core::bootstrap()
     23     */
    3624    function __construct() {
    3725        parent::start(
     
    4432    }
    4533
     34    /**
     35     * Populate the global data needed before BuddyPress can continue
     36     *
     37     * This involves figuring out the currently required, active, deactive,
     38     * and optional components.
     39     *
     40     * @since BuddyPress (1.5)
     41     *
     42     * @global BuddyPress $bp
     43     */
    4644    private function bootstrap() {
    4745        global $bp;
     
    5856        /** Components ********************************************************/
    5957
     58        // Move active components from sitemeta, if necessary
     59        // Provides backpat with earlier versions of BP
     60        if ( is_multisite() && $active_components = get_site_option( 'bp-active-components' ) )
     61            bp_update_option( 'bp-active-components', $active_components );
     62
    6063        // Set the included and optional components.
    6164        $bp->optional_components = apply_filters( 'bp_optional_components', array( 'activity', 'blogs', 'forums', 'friends', 'groups', 'messages', 'settings', 'xprofile' ) );
     
    7174        // Pre 1.5 Backwards compatibility
    7275        } elseif ( $deactivated_components = bp_get_option( 'bp-deactivated-components' ) ) {
     76
    7377            // Trim off namespace and filename
    7478            foreach ( (array) $deactivated_components as $component => $value )
     
    8993        // Default to all components active
    9094        } else {
     95
    9196            // Set globals
    9297            $bp->deactivated_components = array();
     
    116121    }
    117122
     123    /**
     124     * Sets up a majority of the BuddyPress globals that require a minimal
     125     * amount of processing, meaning they cannot be set in the BuddyPress class.
     126     *
     127     * @since BuddyPress (1.5)
     128     *
     129     * @global BuddyPress $bp
     130     */
    118131    function setup_globals() {
    119132        global $bp;
     
    136149        if ( empty( $bp->pages ) )
    137150            $bp->pages = bp_core_get_directory_pages();
    138 
    139         /** Admin Bar *********************************************************/
    140 
    141         // Set the 'My Account' global to prevent debug notices
    142         $bp->my_account_menu_id = false;
    143 
    144         /** Component and Action **********************************************/
    145 
    146         // Used for overriding the 2nd level navigation menu so it can be used to
    147         // display custom navigation for an item (for example a group)
    148         $bp->is_single_item = false;
    149 
    150         // Sets up the array container for the component navigation rendered
    151         // by bp_get_nav()
    152         $bp->bp_nav            = array();
    153 
    154         // Sets up the array container for the component options navigation
    155         // rendered by bp_get_options_nav()
    156         $bp->bp_options_nav    = array();
    157 
    158         // Contains an array of all the active components. The key is the slug,
    159         // value the internal ID of the component.
    160         //$bp->active_components = array();
    161151
    162152        /** Basic current user data *******************************************/
     
    194184    }
    195185
     186    /**
     187     * Setup BuddyBar navigation
     188     *
     189     * @since BuddyPress (1.5)
     190     *
     191     * @global BuddyPress $bp
     192     */
    196193    function setup_nav() {
    197194        global $bp;
    198195
    199         /***
    200          * If the extended profiles component is disabled, we need to revert to using the
    201          * built in WordPress profile information
    202          */
     196         // If xprofile component is disabled, revert to WordPress profile
    203197        if ( !bp_is_active( 'xprofile' ) ) {
     198
     199            // Define local variable
     200            $sub_nav = array();
    204201
    205202            // Fallback values if xprofile is disabled
     
    226223                'screen_function' => 'bp_core_catch_profile_uri'
    227224            );
     225
     226            parent::setup_nav( $main_nav, $sub_nav );
    228227        }
    229228    }
    230229}
    231230
     231/**
     232 * Setup the BuddyPress Core component
     233 *
     234 * @since BuddyPress (1.6)
     235 *
     236 * @global BuddyPress $bp
     237 */
    232238function bp_setup_core() {
    233239    global $bp;
Note: See TracChangeset for help on using the changeset viewer.