summaryrefslogtreecommitdiffstats
path: root/system/libraries/Profiler.php
diff options
context:
space:
mode:
authorRick Ellis <rick.ellis@ellislab.com>2008-10-17 19:35:38 +0200
committerRick Ellis <rick.ellis@ellislab.com>2008-10-17 19:35:38 +0200
commit56d7daa73b80359b26c878d341d90e8c2a36ec1e (patch)
tree45ebea2bbc04eaf785c5b6b12d82aa05bf392fe2 /system/libraries/Profiler.php
parent344a34cd09f3d3153c6e7faec67ba443f5fa822d (diff)
Finessed the SQL highlighting
Diffstat (limited to 'system/libraries/Profiler.php')
-rw-r--r--system/libraries/Profiler.php22
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&nbsp;JOIN', 'ORDER&nbsp;BY', 'GROUP&nbsp;BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR', 'HAVING', 'OFFSET', 'NOT&nbsp;IN', 'IN', 'LIKE', 'NOT&nbsp;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();