[eluser]kirrie[/eluser]
Code: Index: Profiler.php
===================================================================
--- Profiler.php (revision 1)
+++ Profiler.php (working copy)
@@ -132,7 +132,7 @@
// 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', '(', ')');
+ $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'JOIN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '\(', '\)');
@@ -158,7 +158,7 @@
foreach ($highlight as $bold)
{
- $val = str_replace($bold, '<strong>'.$bold.'</strong>', $val);
+ $val = preg_replace("/\b(".$bold.")\b/", "<strong>$1</strong>", $val);
}
"JOIN" keyword has no bold because of it looks like conflicting with "IN" keyword.
[eluser]Unknown[/eluser]
THANKS FOR SHARING IT
[eluser]John_Betong[/eluser]
[quote author="kirrie" date="1228447297"] Code: Index: Profiler.php
===================================================================
--- Profiler.php (revision 1)
+++ Profiler.php (working copy)
@@ -132,7 +132,7 @@
// 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', '(', ')');
+ $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'JOIN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '\(', '\)');
@@ -158,7 +158,7 @@
foreach ($highlight as $bold)
{
- $val = str_replace($bold, '<strong>'.$bold.'</strong>', $val);
+ $val = preg_replace("/\b(".$bold.")\b/", "<strong>$1</strong>", $val);
}
"JOIN" keyword has no bold because of it looks like conflicting with "IN" keyword.[/quote]
BUMP
I have tried this code in the SVN Revision: 1721 and it works fine. Is it possible to include this revision?
I did find another bug which occurs when the Profile is activated. The "</body></html>" did not get moved to the end of the Profiler output and results in umpteen HTML/CSS warnings.
My quick KLUDGE for this is NOT to display "</body></html>" if the Profiler is activated.
When the profiler is activated then it automatically appends the "</body></html>" to the end of the output.
In case it makes any difference I am using Windows XP, WAMP and PHP Version 5.30.
|