| Nuno Lopes 2006-12-29, 7:02 pm |
| nlopess Fri Dec 29 20:53:17 2006 UTC
Modified files:
/php-gcov-web/www site.api.php tests.php valgrind.php
Log:
add a quick&dirty php highlighter with line numbering, which is very useful to us
# better approaches for the line numbering are welcome
http://cvs.php.net/viewvc.cgi/php-g...8&diff_format=u
Index: php-gcov-web/www/site.api.php
diff -u php-gcov-web/www/site.api.php:1.7 php-gcov-web/www/site.api.php:1.8
--- php-gcov-web/www/site.api.php:1.7 Fri Dec 29 20:18:44 2006
+++ php-gcov-web/www/site.api.php Fri Dec 29 20:53:17 2006
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: site.api.php,v 1.7 2006/12/29 20:18:44 nlopess Exp $ */
+/* $Id: site.api.php,v 1.8 2006/12/29 20:53:17 nlopess Exp $ */
// File: Core Site API File
// Desc: contains core display functions, it is essential for all pages to include this file.
@@ -327,3 +327,17 @@
if ($GLOBALS['version'] !== 'PHP_HEAD')
return '<p><strong>Note</strong>: the lxr links are made against the HEAD branch, and thus the line numbers may be incorrect.</p>';
}
+
+
+function highlight_php_numbered($code)
+{
+ $code = explode('<br />', highlight_string($code, true));
+
+ $ret = '';
+ $i = 0;
+ foreach ($code as $l) {
+ $ret .= '<span style="color: #000">' . ++$i . ':</span> ' . $l . '<br />';
+ }
+
+ return $ret;
+}
http://cvs.php.net/viewvc.cgi/php-g...5&diff_format=u
Index: php-gcov-web/www/tests.php
diff -u php-gcov-web/www/tests.php:1.4 php-gcov-web/www/tests.php:1.5
--- php-gcov-web/www/tests.php:1.4 Fri Dec 29 20:38:17 2006
+++ php-gcov-web/www/tests.php Fri Dec 29 20:53:17 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tests.php,v 1.4 2006/12/29 20:38:17 nlopess Exp $ */
+/* $Id: tests.php,v 1.5 2006/12/29 20:53:17 nlopess Exp $ */
if (!defined('IN_GCOV_CODE')) exit;
@@ -40,7 +40,7 @@
$diff = htmlspecialchars($data[2]);
$exp = htmlspecialchars($data[3]);
$output = htmlspecialchars($data[4]);
- $script = highlight_string($data[5], true);
+ $script = highlight_php_numbered($data[5]);
$appvars['page']['title'] = "PHP: $version Test Failure Report for $file";
$appvars['page']['head'] = "Test Failure Report for $file ('$title')";
http://cvs.php.net/viewvc.cgi/php-g...4&diff_format=u
Index: php-gcov-web/www/valgrind.php
diff -u php-gcov-web/www/valgrind.php:1.3 php-gcov-web/www/valgrind.php:1.4
--- php-gcov-web/www/valgrind.php:1.3 Fri Dec 29 20:38:17 2006
+++ php-gcov-web/www/valgrind.php Fri Dec 29 20:53:17 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: valgrind.php,v 1.3 2006/12/29 20:38:17 nlopess Exp $ */
+/* $Id: valgrind.php,v 1.4 2006/12/29 20:53:17 nlopess Exp $ */
if (!defined('IN_GCOV_CODE')) exit;
@@ -37,7 +37,7 @@
$data = $data[$file];
$file = htmlspecialchars($file);
$title = htmlspecialchars($data[0]);
- $script = highlight_string($data[2], true);
+ $script = highlight_php_numbered($data[2]);
$report = htmlspecialchars($data[3]);
$appvars['page']['title'] = "PHP: $version Valgrind Report for $file";
|