bb_show_context

The BuddyPress bb show context function.

Description

bb_show_context( $term, $text ); 

Parameters (2)

0. $term
The term.
1. $text
The text.

Usage

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

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-formatting.php  
  1. function bb_show_context( $term, $text ) { 
  2. $text = strip_shortcodes( $text ); 
  3. $text = strip_tags( $text ); 
  4. $term = preg_quote( $term ); 
  5. $text = preg_replace( "|.*?(.{0, 80})$term(.{0, 80}).*|is", "... $1<strong>$term</strong>$2 ...", $text, 1 ); 
  6. $text = substr( $text, 0, 210 ); 
  7. return $text;