Changeset 3767 for trunk/bp-core/bp-core-catchuri.php
- Timestamp:
- 01/20/2011 01:30:01 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-catchuri.php
r3743 r3767 6 6 7 7 /** 8 * bp_core_set_uri_globals()9 *10 8 * Analyzes the URI structure and breaks it down into parts for use in code. 11 9 * The idea is that BuddyPress can use complete custom friendly URI's without the … … 13 11 * 14 12 * Future custom components would then be able to use their own custom URI structure. 13 * 14 * @package BuddyPress Core 15 * @since BuddyPress (r100) 15 16 * 16 17 * The URI's are broken down as follows: … … 24 25 * - $bp->action_variables: array ['group', 5] 25 26 * 26 * @package BuddyPress Core27 27 */ 28 28 function bp_core_set_uri_globals() { 29 global $current_component, $current_action, $action_variables; 30 global $displayed_user_id, $bp_pages; 31 global $is_member_page; 29 global $bp, $bp_pages; 32 30 global $bp_unfiltered_uri, $bp_unfiltered_uri_offset; 33 global $bp, $current_blog; 34 35 /* Fetch all the WP page names for each component */ 31 global $current_blog; 32 33 $current_component = ''; 34 35 if ( !defined( 'BP_ENABLE_MULTIBLOG' ) && is_multisite() ) { 36 // Only catch URI's on the root blog if we are not running 37 // on multiple blogs 38 if ( BP_ROOT_BLOG != (int) $current_blog->blog_id ) 39 return false; 40 } 41 42 // Fetch all the WP page names for each component 36 43 if ( empty( $bp_pages ) ) 37 44 $bp_pages = bp_core_get_page_names(); 38 39 if ( !defined( 'BP_ENABLE_MULTIBLOG' ) && is_multisite() ) {40 /* Only catch URI's on the root blog if we are not running BP on multiple blogs */41 if ( BP_ROOT_BLOG != (int) $current_blog->blog_id )42 return false;43 }44 45 45 46 // Ajax or not? … … 53 54 // Take GET variables off the URL to avoid problems, 54 55 // they are still registered in the global $_GET variable 55 $noget = substr( $path, 0, strpos( $path, '?' ) ); 56 if ( $noget != '' ) 56 if ( $noget = substr( $path, 0, strpos( $path, '?' ) ) ) 57 57 $path = $noget; 58 58 … … 84 84 85 85 // Set the indexes, these are incresed by one if we are not on a VHOST install 86 $component_index 87 $action_index 86 $component_index = 0; 87 $action_index = $component_index + 1; 88 88 89 89 // Get site path items … … 105 105 106 106 // Reset the keys by merging with an empty array 107 $bp_uri 107 $bp_uri = array_merge( array(), $bp_uri ); 108 108 109 109 // If a component is set to the front page, force its name into $bp_uri so that $current_component is populated … … 147 147 148 148 // This is not a BuddyPress page, so just return. 149 if ( !isset( $matches ) ) 149 if ( !isset( $matches ) ) { 150 $bp->current_component = $current_component; 151 $bp->current_action = ''; 152 $bp->action_variables = ''; 153 $bp->current_item = ''; 150 154 return false; 155 } 151 156 152 157 // Find the offset … … 166 171 if ( !empty( $bp_uri[$uri_offset + 1] ) ) { 167 172 if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) ) 168 $ displayed_user_id = (int) bp_core_get_userid( urldecode( $bp_uri[$uri_offset + 1] ) );173 $bp->displayed_user->id = (int) bp_core_get_userid( urldecode( $bp_uri[$uri_offset + 1] ) ); 169 174 else 170 $ displayed_user_id = (int) bp_core_get_userid_from_nicename( urldecode( $bp_uri[$uri_offset + 1] ) );175 $bp->displayed_user->id = (int) bp_core_get_userid_from_nicename( urldecode( $bp_uri[$uri_offset + 1] ) ); 171 176 172 177 $uri_offset = $uri_offset + 2; … … 193 198 } 194 199 } 195 } else 200 } else { 196 201 $i = 1; 202 } 203 204 // Set the current component in the global 205 $bp->current_component = $current_component; 197 206 198 207 // Set the current action 199 $ current_action= isset( $bp_uri[$i] ) ? $bp_uri[$i] : '';208 $bp->current_action = isset( $bp_uri[$i] ) ? $bp_uri[$i] : ''; 200 209 201 210 // Unset the current_component and action from action_variables … … 204 213 205 214 // Set the entire URI as the action variables, we will unset the current_component and action in a second 206 $ action_variables = $bp_uri;215 $bp->action_variables = $bp_uri; 207 216 208 217 // Remove the username from action variables if this is not a VHOST install 209 218 if ( defined( 'VHOST' ) && 'no' == VHOST && empty( $is_root_component ) ) 210 array_shift( $bp_uri);219 array_shift( $bp_uri ); 211 220 212 221 // Reset the keys by merging with an empty array 213 $action_variables = array_merge( array(), $action_variables ); 222 $bp->action_variables = array_merge( array(), $bp->action_variables ); 223 224 // Set the current item to empty 225 $bp->current_item = ''; 214 226 } 215 227 … … 244 256 // Make the queried/post object an actual valid page 245 257 if ( !empty( $object_id ) ) { 246 $wp_query->queried_object = &get_post( $object_id );258 $wp_query->queried_object = &get_post( $object_id ); 247 259 $wp_query->queried_object_id = $object_id; 248 249 $post = $wp_query->queried_object; 260 $post = $wp_query->queried_object; 250 261 } 251 262
Note: See TracChangeset
for help on using the changeset viewer.