bb_log_deprecated

Marks things as deprecated and informs when they have been used.

Description

bb_log_deprecated( (string) $type, (string) $name, (string) $replacement = 'none' ); 

Parameters (3)

0. $type (string)
The type of thing that was attempted: function, class::function, constant, variable or page.
1. $name (string)
The thing that was called.
2. $replacement — Optional. (string) => 'none'
The thing that should have been called.

Usage

  1. if ( !function_exists( 'bb_log_deprecated' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php'; 
  3.  
  4. // The type of thing that was attempted: function, class::function, constant, variable or page. 
  5. $type = ''; 
  6.  
  7. // The thing that was called. 
  8. $name = ''; 
  9.  
  10. // Optional. The thing that should have been called. 
  11. $replacement = 'none'; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bb_log_deprecated($type, $name, $replacement); 
  15.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-core.php  
  1. function bb_log_deprecated( $type, $name, $replacement = 'none' ) { 
  2. global $bb_log; 
  3. $bb_log->notice( sprintf( __( 'Using deprecated bbPress %1$s - %2$s - replace with - %3$s' ), $type, $name, $replacement ) ); 
  4.  
  5. if ( $bb_log->level & BP_LOG_DEBUG && $bb_log->level & BP_LOG_NOTICE ) { // Only compute the location if we're going to log it. 
  6. $backtrace = debug_backtrace(); 
  7.  
  8. $file = $backtrace[2]['file']; 
  9.  
  10. if ( substr( $file, 0, strlen( BB_PATH ) - 1 ) == rtrim( BB_PATH, '\\/') ) 
  11. $file = substr( $file, strlen( BB_PATH ) ); 
  12.  
  13. $file = str_replace( '\\', '/', $file ); 
  14.  
  15. // 0 = this function, 1 = the deprecated function 
  16. $bb_log->notice( ' ' . sprintf( __( 'on line %1$d of file %2$s' ), $backtrace[2]['line'], $file ) );