1 | <?php
|
---|
2 | if (!function_exists('xpress_debug')) {
|
---|
3 | function xpress_debug($title = '',$ditail_show = false)
|
---|
4 | {
|
---|
5 | $module_dirpath = dirname(dirname(__FILE__));
|
---|
6 | $root_path = dirname(dirname(dirname(dirname(__FILE__))));
|
---|
7 | $_debug_file = $module_dirpath . '/wp-content/xpress_debug.log';
|
---|
8 | $_fp = fopen($_debug_file, 'a');
|
---|
9 | $stamp = date("Y/m/d G:i:s" , time());
|
---|
10 | $backtraces = array_reverse(debug_backtrace());
|
---|
11 | fwrite($_fp, "\n*********************************************************************************************************\n");
|
---|
12 | fwrite($_fp, $title . '(' . $stamp . ")\n");
|
---|
13 | fwrite($_fp, '$_SERVER[]' . "\n");
|
---|
14 | $srerver = "\t" . str_replace("\n","\n\t",sprint_r($_SERVER));
|
---|
15 | fwrite($_fp, $srerver . "\n\n");
|
---|
16 |
|
---|
17 | fwrite($_fp, "BACK TRACE" . "\n");
|
---|
18 | foreach($backtraces as $backtrace){
|
---|
19 | $trace = $backtrace['file']. "\tLINE(" . $backtrace['line'] . ")\t" . $backtrace['function'] . "()\n";
|
---|
20 | $trace = str_replace($root_path,"",$trace);
|
---|
21 | $trace = str_replace("\\","/",$trace);
|
---|
22 | $trace = str_replace($root_path,"",$trace);
|
---|
23 | $trace = "\t" . $trace;
|
---|
24 |
|
---|
25 | $trace_ditail = "\t" . str_replace("\n","\n\t\t",sprint_r($backtrace));
|
---|
26 | if ($ditail_show)
|
---|
27 | fwrite($_fp, $trace . $trace_ditail . "\n");
|
---|
28 | else
|
---|
29 | fwrite($_fp, $trace . "\n");
|
---|
30 | }
|
---|
31 | fclose($_fp);
|
---|
32 | }
|
---|
33 | }
|
---|
34 |
|
---|
35 | if (!function_exists('xpress_debug_message')) {
|
---|
36 | function xpress_debug_message($message = '')
|
---|
37 | {
|
---|
38 | $module_dirpath = dirname(dirname(__FILE__));
|
---|
39 | $root_path = dirname(dirname(dirname(dirname(__FILE__))));
|
---|
40 | $_debug_file = $module_dirpath . '/wp-content/xpress_debug.log';
|
---|
41 | $_fp = fopen($_debug_file, 'a');
|
---|
42 | $stamp = date("Y/m/d G:i:s" , time());
|
---|
43 | fwrite($_fp, "\n*********************************************************************************************************\n");
|
---|
44 | fwrite($_fp, '(' . $stamp . ")\n");
|
---|
45 | fwrite($_fp, $message . "\n");
|
---|
46 | fclose($_fp);
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | if (!function_exists('sprint_r')) {
|
---|
51 | function sprint_r($var) {
|
---|
52 | ob_start();
|
---|
53 | print_r($var);
|
---|
54 | $ret = ob_get_contents();
|
---|
55 | ob_end_clean();
|
---|
56 | return $ret;
|
---|
57 | }
|
---|
58 | }
|
---|
59 | ?> |
---|