bb_encodeit

The BuddyPress bb encodeit function.

Description

bb_encodeit( $matches ); 

Parameters (1)

0. $matches
The matches.

Usage

  1. if ( !function_exists( 'bb_encodeit' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-formatting.php'; 
  3.  
  4. // The matches. 
  5. $matches = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_encodeit($matches); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-formatting.php  
  1. function bb_encodeit( $matches ) { 
  2. $text = trim($matches[2]); 
  3. $text = htmlspecialchars($text, ENT_QUOTES); 
  4. $text = str_replace(array("\r\n", "\r"), "\n", $text); 
  5. $text = preg_replace("|\n\n\n+|", "\n\n", $text); 
  6. $text = str_replace('&', '&', $text); 
  7. $text = str_replace('&lt;', '<', $text); 
  8. $text = str_replace('&gt;', '>', $text); 
  9. $text = "<code>$text</code>"; 
  10. if ( "`" != $matches[1] ) 
  11. $text = "<pre>$text</pre>"; 
  12. return $text;