PluginProbe
Smart Grid-Layout Design for Contact Form 7 / 4.1.1
Smart Grid-Layout Design for Contact Form 7 v4.1.1
4.18.0 4.17.0 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 4.0.0 4.0.1 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10 4.11 4.12 4.13 4.14 All 119 releases
cf7-grid-layout / includes / wordpress-gurus-debug-api.php

wordpress-gurus-debug-api.php in Smart Grid-Layout Design for Contact Form 7 4.1.1, at includes/wordpress-gurus-debug-api.php

44 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Error logging and notices
4 * @since 1.0.0
5 * @var string $message to log if in debug mode
6 */
7 defined('WP_GURUS_DEBUG') || define('WP_GURUS_DEBUG', false);
8
9 if( !function_exists('debug_msg') ){
10 if (true === WP_GURUS_DEBUG) {
11 $debug_msg_last_line='';
12 $debug_msg_last_file='';
13 }
14 function debug_msg($message, $prefix='', $trace=0) {
15 if (true === WP_GURUS_DEBUG) {
16 global $debug_msg_last_line,$debug_msg_last_file;
17 $backtrace = debug_backtrace();
18 $file = $backtrace[0]['file'];
19 $files = explode('/',$file);
20 $dirs = explode('/',plugin_dir_path( __FILE__ ));
21 $files = array_diff($files,$dirs);
22 $file = implode('/',$files);
23 $line = $backtrace[0]['line'];
24 $msg='DEBUG_MSG: '.PHP_EOL;
25 if(true===$trace || ($file != $debug_msg_last_file && $line != $debug_msg_last_line)){
26 if($trace===true) $trace = sizeof($backtrace);
27 for($idx=$trace; $idx>0; $idx--){
28 $msg.=" [".$backtrace[$idx]['line']."]->/".$backtrace[$idx]['file'].PHP_EOL;
29 }
30 $msg.= " [".$line."]./".$file.PHP_EOL;
31 $debug_msg_last_file=$file;
32 $debug_msg_last_line=$line;
33 }
34
35 if (is_array($message) || is_object($message)) {
36 $msg.=" + ".$prefix.print_r($message, true);
37 } else {
38 $msg.=" + ".$prefix.$message;
39 }
40 error_log($msg);
41 }
42 }
43 } ?>
44