Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/09/2011 05:43:09 AM (15 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-catchuri.php

    r5314 r5316  
    3030 */
    3131function 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;
    3833
    3934        // Don't catch URIs on non-root blogs unless multiblog mode is on
    … …  
    121116
    122117        // Keep the unfiltered URI safe
    123         $bp_unfiltered_uri = $bp_uri;
     118        $bp->unfiltered_uri = $bp_uri;
    124119
    125120        // Get slugs of pages into array
    … …  
    223218        // Global the unfiltered offset to use in bp_core_load_template().
    224219        // 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;
    226221
    227222        // We have an exact match
    … …  
    315310 */
    316311function 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;
    318313
    319314        // 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] ) ) )
    321316                return false;
    322317
    … …  
    324319        $object_id = 0;
    325320        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] ) ) {
    327322                        $object_id = $page->id;
    328323                }
Note: See TracChangeset for help on using the changeset viewer.