bb_get_plugin_directory

The BuddyPress bb get plugin directory function.

Description

bb_get_plugin_directory( (constant) $plugin = false, (bool) $path = false ); 

Parameters (2)

0. $plugin — Optional. (constant) => false
The plugin.
1. $path — Optional. (bool) => false
The path.

Usage

  1. if ( !function_exists( 'bb_get_plugin_directory' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php'; 
  3.  
  4. // The plugin. 
  5. $plugin = false; 
  6.  
  7. // The path. 
  8. $path = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_get_plugin_directory($plugin, $path); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-core.php  
  1. function bb_get_plugin_directory( $plugin = false, $path = false ) 
  2. global $bb; 
  3. if ( preg_match( '/^([a-z0-9_-]+)#((?:[a-z0-9\/\\_-]+.)+)(php)$/i', $plugin, $_matches ) ) { 
  4. $plugin_directory = $bb->plugin_locations[$_matches[1]]['dir'] . $_matches[2] . $_matches[3]; 
  5. if ( !$path ) { 
  6. $plugin_directory = dirname( $plugin_directory ) . '/'; 
  7. } else { 
  8. $plugin_directory = $bb->plugin_locations['core']['dir']; 
  9. return apply_filters( 'bb_get_plugin_directory', $plugin_directory, $plugin, $path );