| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?> |
| 2 |
<?php |
| 3 |
|
| 4 |
/** |
| 5 |
* Enable Query Log |
| 6 |
*/ |
| 7 |
if (!function_exists('fluentcart_eql')) { |
| 8 |
function fluentcart_eql() |
| 9 |
{ |
| 10 |
defined('SAVEQUERIES') || define('SAVEQUERIES', true); |
| 11 |
} |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Get Query Log |
| 16 |
*/ |
| 17 |
if (!function_exists('fluentcart_gql')) { |
| 18 |
function fluentcart_gql() |
| 19 |
{ |
| 20 |
$result = []; |
| 21 |
foreach ((array)$GLOBALS['wpdb']->queries as $key => $query) { |
| 22 |
$result[++$key] = array_combine([ |
| 23 |
'query', 'execution_time' |
| 24 |
], array_slice($query, 0, 2)); |
| 25 |
} |
| 26 |
return $result; |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
if (!function_exists('dd')) { |
| 31 |
|
| 32 |
function dd() |
| 33 |
{ |
| 34 |
|
| 35 |
foreach (func_get_args() as $arg) { |
| 36 |
echo "<pre>"; |
| 37 |
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r |
| 38 |
print_r($arg); |
| 39 |
echo "</pre>"; |
| 40 |
} |
| 41 |
die(); |
| 42 |
} |
| 43 |
} |
| 44 |
|