j_mail

Log reporting function: If enabled, email a detailed log to the site admin.

Description

j_mail( $subj, (string) $msg = '' ); 

Parameters (2)

0. $subj
The subj.
1. $msg — Optional. (string) => ''
The msg.

Usage

  1. if ( !function_exists( 'j_mail' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'wp-fb-autoconnect/__inc_opts.php'; 
  3.  
  4. // The subj. 
  5. $subj = null; 
  6.  
  7. // The msg. 
  8. $msg = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = j_mail($subj, $msg); 
  12.  

Defined (1)

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

/__inc_opts.php  
  1. function j_mail($subj, $msg='') 
  2. global $opt_jfb_email_to, $opt_jfb_email_logs, $jfb_log; 
  3. global $jfb_debug_array; 
  4. if( get_option($opt_jfb_email_logs) && get_option($opt_jfb_email_to) ) 
  5. if( $msg ) $msg .= "\n\n"; 
  6. if( isset($jfb_log) ) $msg .= "---LOG:---\n" . $jfb_log; 
  7.  
  8. $count = count($jfb_debug_array); 
  9. $keys = array_keys($jfb_debug_array); 
  10.  
  11. $msg .= "\n---TIME:---\n"; 
  12. for($i=0; $i<$count; $i++) 
  13. if($i==0) $msg .= sprintf("%-9s", $keys[$i]) . ") +0s\n"; 
  14. else $msg .= sprintf("%-9s", $keys[$i]) . ") +" . round($jfb_debug_array[$keys[$i]]['time']-$jfb_debug_array[$keys[$i-1]]['time'], 2) . "s\n"; 
  15. $msg .= "TOTAL ) " . round($jfb_debug_array[$keys[$count-1]]['time']-$jfb_debug_array[$keys[0]]['time'], 2) . "s\n"; 
  16.  
  17. $msg .= "\n---MEMORY:---\n"; 
  18. for($i=0; $i<$count; $i++) 
  19. $value = $jfb_debug_array[$keys[$i]]['mem']; 
  20. if($i==0) $msg .= sprintf("%-9s", $keys[$i]) . ") " . round( $value / (1024*1024), 2) . "M\n"; 
  21. else $msg .= sprintf("%-9s", $keys[$i]) . ") " . round( $value / (1024*1024), 2) . "M (+".round(($value-$jfb_debug_array[$keys[$i-1]]['mem'])/(1024*1024), 2)."M)\n"; 
  22. $msg .= "LIMIT ) " . ini_get('memory_limit') . "\n"; 
  23.  
  24. $msg .= "\n---USER AGENT:---\n" . $_SERVER['HTTP_USER_AGENT'] . "\n"; 
  25. $msg .= "\n---REQUEST:---\n" . print_r($_REQUEST, true); 
  26. wp_mail(get_option($opt_jfb_email_to), $subj, $msg);