bb_encode_bad

The BuddyPress bb encode bad function.

Description

bb_encode_bad( $text ); 

Parameters (1)

0. $text
The text.

Usage

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

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-formatting.php  
  1. function bb_encode_bad( $text ) { 
  2. $text = wp_specialchars( $text, ENT_NOQUOTES ); 
  3.  
  4. $text = preg_split('@(`[^`]*`)@m', $text, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE); 
  5.  
  6. $allowed = bb_allowed_tags(); 
  7. $empty = array( 'br' => true, 'hr' => true, 'img' => true, 'input' => true, 'param' => true, 'area' => true, 'col' => true, 'embed' => true ); 
  8.  
  9. foreach ( $allowed as $tag => $args ) { 
  10. $preg = $args ? "$tag(?:\s.*?)?" : $tag; 
  11.  
  12. if ( isset( $empty[$tag] ) ) 
  13. array_walk($text, '_bb_encode_bad_empty', $preg); 
  14. else 
  15. array_walk($text, '_bb_encode_bad_normal', $preg); 
  16.  
  17. return join('', $text);