diff options
author | Rick Ellis <rick.ellis@ellislab.com> | 2008-10-17 19:35:38 +0200 |
---|---|---|
committer | Rick Ellis <rick.ellis@ellislab.com> | 2008-10-17 19:35:38 +0200 |
commit | 56d7daa73b80359b26c878d341d90e8c2a36ec1e (patch) | |
tree | 45ebea2bbc04eaf785c5b6b12d82aa05bf392fe2 /system/libraries | |
parent | 344a34cd09f3d3153c6e7faec67ba443f5fa822d (diff) |
Finessed the SQL highlighting
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Profiler.php | 22 |
1 files changed, 13 insertions, 9 deletions
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 .= "</fieldset>";
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 .= "<tr><td width='100%' style='color:#0000FF;font-weight:normal;background-color:#eee;'>".$this->CI->lang->line('profiler_no_queries')."</td></tr>\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, '<strong>'.$bold.'</strong>', $val);
@@ -365,7 +369,7 @@ class CI_Profiler { */
function run()
{
- $output .= "<div id='codeigniter_profiler' style='clear:both;background-color:#fff;padding:10px;'>";
+ $output = "<div id='codeigniter_profiler' style='clear:both;background-color:#fff;padding:10px;'>";
$output .= $this->_compile_uri_string();
$output .= $this->_compile_controller_info();
|