diff options
Diffstat (limited to 'system/libraries/Profiler.php')
-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();
|