Ticket #1726: bp-core-catchuri.patch
File bp-core-catchuri.patch, 2.0 KB (added by , 15 years ago) |
---|
-
bp-core-catchuri.php
43 43 else 44 44 $path = clean_url( $_SERVER['REQUEST_URI'] ); 45 45 46 $path = apply_filters( 'bp_uri', $path ); 47 46 $path = apply_filters( 'bp_uri', $path ); 48 47 // Firstly, take GET variables off the URL to avoid problems, 49 48 // they are still registered in the global $_GET variable */ 50 49 $noget = substr( $path, 0, strpos( $path, '?' ) ); … … 52 51 53 52 /* Fetch the current URI and explode each part separated by '/' into an array */ 54 53 $bp_uri = explode( "/", $path ); 55 54 56 55 /* Loop and remove empties */ 57 56 foreach ( (array)$bp_uri as $key => $uri_chunk ) 58 57 if ( empty( $bp_uri[$key] ) ) unset( $bp_uri[$key] ); 59 58 60 59 if ( defined( 'BP_ENABLE_MULTIBLOG' ) || 1 != BP_ROOT_BLOG ) { 61 60 /* If we are running BuddyPress on any blog, not just a root blog, we need to first 62 61 shift off the blog name if we are running a subdirectory install of WPMU. */ … … 74 73 75 74 /* Get site path items */ 76 75 $paths = explode( '/', bp_core_get_site_path() ); 76 //strip off the empty elemnts which are generated because of slashes in the path 77 foreach ( (array)$paths as $key => $uri_chunk ) 78 if ( empty( $paths[$key] ) ) unset( $paths[$key] ); 77 79 78 /* Take empties off the end of path */ 79 if ( empty( $paths[count($paths) - 1] ) ) 80 array_pop( $paths ); 80 //so we have $paths and $bp_uri array on same level 81 $count=count($paths); 82 array_splice($bp_uri, 0, $count);//now remove the paths section from the bp_uri 81 83 82 /* Take empties off the start of path */83 if ( empty( $paths[0] ) )84 array_shift( $paths );85 84 86 foreach ( (array)$bp_uri as $key => $uri_chunk ) { 87 if ( in_array( $uri_chunk, $paths )) { 88 unset( $bp_uri[$key] ); 89 } 90 } 91 92 /* Reset the keys by merging with an empty array */ 85 /* Reset the keys by merging with an empty array */ 93 86 $bp_uri = array_merge( array(), $bp_uri ); 94 87 $bp_unfiltered_uri = $bp_uri; 95 88