bb_convert_path_base

The BuddyPress bb convert path base function.

Description

bb_convert_path_base( $path, $from_base, $to_base ); 

Parameters (3)

0. $path
The path.
1. $from_base
The from base.
2. $to_base
The to base.

Usage

  1. if ( !function_exists( 'bb_convert_path_base' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-deprecated.php'; 
  3.  
  4. // The path. 
  5. $path = null; 
  6.  
  7. // The from base. 
  8. $from_base = null; 
  9.  
  10. // The to base. 
  11. $to_base = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bb_convert_path_base($path, $from_base, $to_base); 
  15.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-deprecated.php  
  1. function bb_convert_path_base( $path, $from_base, $to_base ) { 
  2. bb_log_deprecated('function', __FUNCTION__, 'no alternative'); 
  3. $last_char = $path{strlen($path)-1}; 
  4. if ( '/' != $last_char && '\\' != $last_char ) 
  5. $last_char = ''; 
  6.  
  7. list($from_base, $to_base) = bb_trim_common_path_right($from_base, $to_base); 
  8.  
  9. if ( 0 === strpos( $path, $from_base ) ) 
  10. $r = $to_base . substr($path, strlen($from_base)) . $last_char; 
  11. else 
  12. return false; 
  13.  
  14. $r = str_replace(array('//', '\\\\'), array('/', '\\'), $r); 
  15. $r = preg_replace('|:/([^/])|', '://$1', $r); 
  16.  
  17. return $r;