bbp_decode_callback

Callback to decode the tags in topic or reply content.

Description

(string) bbp_decode_callback( (array) $matches = array() ); 

Returns (string)

Parameters (1)

0. $matches — Optional. (array) => array()
The matches.

Usage

  1. if ( !function_exists( 'bbp_decode_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/common/formatting.php'; 
  3.  
  4. // The matches. 
  5. $matches = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_decode_callback($matches); 
  9.  

Defined (1)

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

/includes/common/formatting.php  
  1. function bbp_decode_callback( $matches = array() ) { 
  2.  
  3. // Setup variables 
  4. $trans_table = array_flip( get_html_translation_table( HTML_ENTITIES ) ); 
  5. $amps = array( '&', '&', '&' ); 
  6. $single = array( ''', ''' ); 
  7. $content = $matches[2]; 
  8. $content = strtr( $content, $trans_table ); 
  9.  
  10. // Do the do 
  11. $content = str_replace( '<br />', '<coded_br />', $content ); 
  12. $content = str_replace( '<p>', '<coded_p>', $content ); 
  13. $content = str_replace( '</p>', '</coded_p>', $content ); 
  14. $content = str_replace( $amps, '&', $content ); 
  15. $content = str_replace( $single, "'", $content ); 
  16.  
  17. // Return content wrapped in code tags 
  18. return '`' . $content . '`';