bb_get_location

The BuddyPress bb get location function.

Description

bb_get_location(); 

Usage

  1. if ( !function_exists( 'bb_get_location' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bb_get_location(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/functions.bb-template.php  
  1. function bb_get_location() { // Not for display. Do not internationalize. 
  2. static $file; 
  3. static $filename; 
  4.  
  5. if ( !isset( $file ) ) { 
  6. $path = ''; 
  7. foreach ( array( $_SERVER['SCRIPT_NAME'], $_SERVER['SCRIPT_FILENAME'], $_SERVER['PHP_SELF'] ) as $_path ) { 
  8. if ( false !== strpos( $_path, '.php' ) ) { 
  9. $path = $_path; 
  10. break; 
  11.  
  12. $filename = bb_find_filename( $path ); 
  13. // Make $file relative to bbPress root directory 
  14. $file = str_replace( bb_get_option( 'path' ), '', $path ); 
  15.  
  16. switch ( $filename ) { 
  17. case 'index.php': 
  18. case 'page.php': 
  19. $location = 'front-page'; 
  20. break; 
  21. case 'forum.php': 
  22. $location = 'forum-page'; 
  23. break; 
  24. case 'tags.php': 
  25. $location = 'tag-page'; 
  26. break; 
  27. case 'edit.php': 
  28. $location = 'topic-edit-page'; 
  29. break; 
  30. case 'topic.php': 
  31. $location = 'topic-page'; 
  32. break; 
  33. case 'rss.php': 
  34. $location = 'feed-page'; 
  35. break; 
  36. case 'search.php': 
  37. $location = 'search-page'; 
  38. break; 
  39. case 'profile.php': 
  40. $location = 'profile-page'; 
  41. break; 
  42. case 'favorites.php': 
  43. $location = 'favorites-page'; 
  44. break; 
  45. case 'view.php': 
  46. $location = 'view-page'; 
  47. break; 
  48. case 'statistics.php': 
  49. $location = 'stats-page'; 
  50. break; 
  51. case 'bb-login.php': 
  52. $location = 'login-page'; 
  53. break; 
  54. case 'register.php': 
  55. $location = 'register-page'; 
  56. break; 
  57. default: 
  58. $location = apply_filters( 'bb_get_location', '', $file ); 
  59. break; 
  60.  
  61. return $location;