bbp_code_trick

Filter the topic or reply content and output code and pre tags.

Description

(string) bbp_code_trick( (string) $content = '' ); 

Returns (string)

Partially encodedd content

Parameters (1)

0. $content — Optional. (string) => ''
Topic and reply content

Usage

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

Defined (1)

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

/includes/common/formatting.php  
  1. function bbp_code_trick( $content = '' ) { 
  2. $content = str_replace( array( "\r\n", "\r" ), "\n", $content ); 
  3. $content = preg_replace_callback( "|(`)(.*?)`|", 'bbp_encode_callback', $content ); 
  4. $content = preg_replace_callback( "!(^|\n)`(.*?)`!s", 'bbp_encode_callback', $content ); 
  5.  
  6. return $content;