From 56d7daa73b80359b26c878d341d90e8c2a36ec1e Mon Sep 17 00:00:00 2001 From: Rick Ellis Date: Fri, 17 Oct 2008 17:35:38 +0000 Subject: Finessed the SQL highlighting --- system/libraries/Profiler.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index b0241b241..7f869f46f 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -126,7 +126,13 @@ class CI_Profiler { $output .= ""; return $output; - } + } + + // Load the text helper so we can highlight the SQL + $this->CI->load->helper('text'); + + // Key words we want bolded + $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')'); $output = "\n\n"; @@ -143,15 +149,13 @@ class CI_Profiler { $output .= "".$this->CI->lang->line('profiler_no_queries')."\n"; } else - { - $highlight = array('SELECT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR'); - + { foreach ($db->queries as $key => $val) - { - $val = htmlspecialchars($val, ENT_QUOTES); - + { $time = number_format($db->query_times[$key], 4); - + + $val = highlight_code($val, ENT_QUOTES); + foreach ($highlight as $bold) { $val = str_replace($bold, ''.$bold.'', $val); @@ -365,7 +369,7 @@ class CI_Profiler { */ function run() { - $output .= "
"; + $output = "
"; $output .= $this->_compile_uri_string(); $output .= $this->_compile_controller_info(); -- cgit v1.2.3-24-g4f1b