Changeset 5316
- Timestamp:
- 11/09/2011 05:43:09 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
bp-core/bp-core-catchuri.php (modified) (5 diffs)
-
bp-core/bp-core-loader.php (modified) (9 diffs)
-
bp-loader.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-catchuri.php
r5314 r5316 30 30 */ 31 31 function bp_core_set_uri_globals() { 32 global $bp, $bp_unfiltered_uri, $bp_unfiltered_uri_offset; 33 global $current_blog, $wpdb; 34 35 // Create global component, action, and item variables 36 $bp->current_component = $bp->current_item = ''; 37 $bp->current_action = $bp->action_variables = ''; 32 global $bp, $current_blog, $wpdb; 38 33 39 34 // Don't catch URIs on non-root blogs unless multiblog mode is on … … 121 116 122 117 // Keep the unfiltered URI safe 123 $bp _unfiltered_uri = $bp_uri;118 $bp->unfiltered_uri = $bp_uri; 124 119 125 120 // Get slugs of pages into array … … 223 218 // Global the unfiltered offset to use in bp_core_load_template(). 224 219 // To avoid PHP warnings in bp_core_load_template(), it must always be >= 0 225 $bp _unfiltered_uri_offset = $uri_offset >= 0 ? $uri_offset : 0;220 $bp->unfiltered_uri_offset = $uri_offset >= 0 ? $uri_offset : 0; 226 221 227 222 // We have an exact match … … 315 310 */ 316 311 function bp_core_load_template( $templates ) { 317 global $post, $bp, $wpdb, $wp_query , $bp_unfiltered_uri, $bp_unfiltered_uri_offset;312 global $post, $bp, $wpdb, $wp_query; 318 313 319 314 // Determine if the root object WP page exists for this request (TODO: is there an API function for this? 320 if ( !empty( $bp _unfiltered_uri_offset ) && !$page_exists = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_name = %s", $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) ) )315 if ( !empty( $bp->unfiltered_uri_offset ) && !$page_exists = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_name = %s", $bp->unfiltered_uri[$bp->unfiltered_uri_offset] ) ) ) 321 316 return false; 322 317 … … 324 319 $object_id = 0; 325 320 foreach ( (array)$bp->pages as $page ) { 326 if ( isset( $bp _unfiltered_uri[$bp_unfiltered_uri_offset] ) && $page->name == $bp_unfiltered_uri[$bp_unfiltered_uri_offset]) {321 if ( isset( $bp->unfiltered_uri[$bp->unfiltered_uri_offset] ) && ( $page->name == $bp->unfiltered_uri[$bp->unfiltered_uri_offset] ) ) { 327 322 $object_id = $page->id; 328 323 } -
trunk/bp-core/bp-core-loader.php
r5311 r5316 1 1 <?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 2 12 // Exit if accessed directly 3 13 if ( !defined( 'ABSPATH' ) ) exit; 4 14 5 // Require all of the BuddyPress core libraries6 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 functions22 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 necessary30 // Provides backpat with earlier versions of BP31 if ( is_multisite() && $active_components = get_site_option( 'bp-active-components' ) )32 bp_update_option( 'bp-active-components', $active_components );33 34 15 class BP_Core extends BP_Component { 35 16 17 /** 18 * Start the members component creation process 19 * 20 * @since BuddyPress (1.5) 21 * 22 * @uses BP_Core::bootstrap() 23 */ 36 24 function __construct() { 37 25 parent::start( … … 44 32 } 45 33 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 */ 46 44 private function bootstrap() { 47 45 global $bp; … … 58 56 /** Components ********************************************************/ 59 57 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 60 63 // Set the included and optional components. 61 64 $bp->optional_components = apply_filters( 'bp_optional_components', array( 'activity', 'blogs', 'forums', 'friends', 'groups', 'messages', 'settings', 'xprofile' ) ); … … 71 74 // Pre 1.5 Backwards compatibility 72 75 } elseif ( $deactivated_components = bp_get_option( 'bp-deactivated-components' ) ) { 76 73 77 // Trim off namespace and filename 74 78 foreach ( (array) $deactivated_components as $component => $value ) … … 89 93 // Default to all components active 90 94 } else { 95 91 96 // Set globals 92 97 $bp->deactivated_components = array(); … … 116 121 } 117 122 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 */ 118 131 function setup_globals() { 119 132 global $bp; … … 136 149 if ( empty( $bp->pages ) ) 137 150 $bp->pages = bp_core_get_directory_pages(); 138 139 /** Admin Bar *********************************************************/140 141 // Set the 'My Account' global to prevent debug notices142 $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 to147 // 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 rendered151 // by bp_get_nav()152 $bp->bp_nav = array();153 154 // Sets up the array container for the component options navigation155 // 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();161 151 162 152 /** Basic current user data *******************************************/ … … 194 184 } 195 185 186 /** 187 * Setup BuddyBar navigation 188 * 189 * @since BuddyPress (1.5) 190 * 191 * @global BuddyPress $bp 192 */ 196 193 function setup_nav() { 197 194 global $bp; 198 195 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 203 197 if ( !bp_is_active( 'xprofile' ) ) { 198 199 // Define local variable 200 $sub_nav = array(); 204 201 205 202 // Fallback values if xprofile is disabled … … 226 223 'screen_function' => 'bp_core_catch_profile_uri' 227 224 ); 225 226 parent::setup_nav( $main_nav, $sub_nav ); 228 227 } 229 228 } 230 229 } 231 230 231 /** 232 * Setup the BuddyPress Core component 233 * 234 * @since BuddyPress (1.6) 235 * 236 * @global BuddyPress $bp 237 */ 232 238 function bp_setup_core() { 233 239 global $bp; -
trunk/bp-loader.php
r5314 r5316 72 72 public $maintenance_mode = ''; 73 73 74 /** 75 * @var bool Include deprecated BuddyPress files or not 76 */ 77 public $load_deprecated = true; 78 74 79 /** Paths *****************************************************************/ 75 80 … … 117 122 */ 118 123 public $displayed_user = false; 124 125 /** Navigation ************************************************************/ 126 127 /** 128 * @var array Primary BuddyPress navigation 129 */ 130 public $bp_nav = array(); 131 132 /** 133 * @var array Secondary BuddyPress navigation to $bp_nav 134 */ 135 public $bp_options_nav = array(); 136 137 /** Toolbar ***************************************************************/ 138 139 /** 140 * @var string The primary toolbar ID 141 */ 142 public $my_account_menu_id = ''; 143 144 /** URI's *****************************************************************/ 145 146 /** 147 * @var array The unfiltered URI broken down into chunks 148 * @see bp_core_set_uri_globals() 149 */ 150 public $unfiltered_uri = array(); 151 152 /** 153 * @var int The current offset of the URI 154 * @see bp_core_set_uri_globals() 155 */ 156 public $unfiltered_uri_offset = 0; 157 158 /** Components ************************************************************/ 159 160 /** 161 * @var string Name of the current BuddyPress component (primary) 162 */ 163 public $current_component = ''; 164 165 /** 166 * @var string Name of the current BuddyPress item (secondary) 167 */ 168 public $current_item = ''; 169 170 /** 171 * @var string Name of the current BuddyPress action (tertiary) 172 */ 173 public $current_action = ''; 174 175 /** 176 * @var array() Additional navigation elements (supplemental) 177 */ 178 public $action_variables = array(); 179 180 /** 181 * @var bool Displaying custom 2nd level navigation menu (I.E a group) 182 */ 183 public $is_single_item = false; 119 184 120 185 /** Errors ****************************************************************/ … … 330 395 // Other identifiers 331 396 $this->user_id = apply_filters( 'bp_user_id', 'bp_user' ); 332 $this->edit_id = apply_filters( 'bp_edit_id', 'edit' );397 $this->edit_id = apply_filters( 'bp_edit_id', 'edit' ); 333 398 334 399 /** Users *************************************************************/ … … 386 451 register_theme_directory( $this->themes_dir ); 387 452 388 // Load core 389 require( $this->plugin_dir . '/bp-core/bp-core-loader.php' ); 453 // Require all of the BuddyPress core libraries 454 require( $this->plugin_dir . '/bp-core/bp-core-caps.php' ); 455 require( $this->plugin_dir . '/bp-core/bp-core-cache.php' ); 456 require( $this->plugin_dir . '/bp-core/bp-core-hooks.php' ); 457 require( $this->plugin_dir . '/bp-core/bp-core-cssjs.php' ); 458 require( $this->plugin_dir . '/bp-core/bp-core-update.php' ); 459 require( $this->plugin_dir . '/bp-core/bp-core-classes.php' ); 460 require( $this->plugin_dir . '/bp-core/bp-core-filters.php' ); 461 require( $this->plugin_dir . '/bp-core/bp-core-avatars.php' ); 462 require( $this->plugin_dir . '/bp-core/bp-core-widgets.php' ); 463 require( $this->plugin_dir . '/bp-core/bp-core-template.php' ); 464 require( $this->plugin_dir . '/bp-core/bp-core-buddybar.php' ); 465 require( $this->plugin_dir . '/bp-core/bp-core-catchuri.php' ); 466 require( $this->plugin_dir . '/bp-core/bp-core-component.php' ); 467 require( $this->plugin_dir . '/bp-core/bp-core-functions.php' ); 468 require( $this->plugin_dir . '/bp-core/bp-core-moderation.php' ); 469 require( $this->plugin_dir . '/bp-core/bp-core-adminbar.php' ); 470 require( $this->plugin_dir . '/bp-core/bp-core-loader.php' ); 471 472 // Skip or load deprecated content 473 if ( false === $this->load_deprecated ) { 474 require( $this->plugin_dir . '/bp-core/deprecated/1.5.php' ); 475 require( $this->plugin_dir . '/bp-core/deprecated/1.6.php' ); 476 } 390 477 391 478 // Check if an update is required 392 if ( (int) $this->db_version_raw < (int) $this->db_version || ( !empty( $this->is_network_activate ) ) ) { 479 if ( ( (int) $this->db_version_raw < (int) $this->db_version ) || ( !empty( $this->is_network_activate ) ) ) { 480 481 // BuddyPress needs an update 393 482 $this->maintenance_mode = 'update'; 394 require( $this->plugin_dir . '/bp-core/admin/bp-core-update.php' ); 483 484 // Only include core updater if in the admin area 485 if ( is_admin() ) { 486 require( $this->plugin_dir . '/bp-core/admin/bp-core-update.php' ); 487 } 395 488 } 396 489 }
Note: See TracChangeset
for help on using the changeset viewer.