bbp_encode_empty_callback

Callback to replace empty HTML tags in a content string.

Description

bbp_encode_empty_callback( (string) &$content = '', (string) $key = '', (string) $preg = '' ); 

Parameters (3)

0. $content — Optional. (string) => &$content = ''
The content.
1. $key — Optional. (string) => ''
The key.
2. $preg — Optional. (string) => ''
The preg.

Usage

  1. if ( !function_exists( 'bbp_encode_empty_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/common/formatting.php'; 
  3.  
  4. // The content. 
  5. $content = &$content = ''; 
  6.  
  7. // The key. 
  8. $key = ''; 
  9.  
  10. // The preg. 
  11. $preg = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bbp_encode_empty_callback($content, $key, $preg); 
  15.  

Defined (1)

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

/includes/common/formatting.php  
  1. function bbp_encode_empty_callback( &$content = '', $key = '', $preg = '' ) { 
  2. if ( strpos( $content, '`' ) !== 0 ) { 
  3. $content = preg_replace( "|<({$preg})\s*?/*?>|i", '<$1 />', $content );