yit_plugin_string

Simple echo a string, with a before and after string, only if the main string is not empty.

Description

(string) yit_plugin_string( (string) $before = '', (string) $string = '', (string) $after = '', (bool) $echo = true ); 

Returns (string)

The complete string, if the main string is not empty or null

Parameters (4)

0. $before — Optional. (string) => ''
What there is before the main string
1. $string — Optional. (string) => ''
The main string. If it is empty or null, the functions return null.
2. $after — Optional. (string) => ''
What there is after the main string
3. $echo — Optional. (bool) => true
If echo or only return it

Usage

  1. if ( !function_exists( 'yit_plugin_string' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yith-woocommerce-wishlist/plugin-fw/yit-functions.php'; 
  3.  
  4. // What there is before the main string 
  5. $before = ''; 
  6.  
  7. // The main string. If it is empty or null, the functions return null. 
  8. $string = ''; 
  9.  
  10. // What there is after the main string 
  11. $after = ''; 
  12.  
  13. // If echo or only return it 
  14. $echo = true; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = yit_plugin_string($before, $string, $after, $echo); 
  18.  

Defined (1)

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

/plugin-fw/yit-functions.php  
  1. function yit_plugin_string ( $before = '', $string = '', $after = '', $echo = true ) { 
  2. $html = ''; 
  3.  
  4. if ( $string != '' AND ! is_null ( $string ) ) { 
  5. $html = $before . $string . $after; 
  6.  
  7. if ( $echo ) { 
  8. echo $html; 
  9.  
  10. return $html;