Update of /cvsroot/phpcvsview/phpcvsview
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18762
Modified Files:
func_FileView.php
Log Message:
- added numbered lines when viewing file contents
Index: func_FileView.php
===================================================================
RCS file: /cvsroot/phpcvsview/phpcvsview/func_FileView.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** func_FileView.php 6 Oct 2004 08:40:29 -0000 1.6
--- func_FileView.php 11 Oct 2004 05:27:57 -0000 1.7
***************
*** 53,58 ****
$search = array('<', '>', '\n', '\t');
$replace = array("<", ">", "", " ");
echo "<pre>\n";
! echo str_replace($search, $replace, $CVSServer->FILECONTENTS)."\n";
echo "</pre>\n";
--- 53,64 ----
$search = array('<', '>', '\n', '\t');
$replace = array("<", ">", "", " ");
+ $content = str_replace($search, $replace, $CVSServer->FILECONTENTS);
+ $source = explode("\n", $content);
+ $soure_size = sizeof($source);
+
echo "<pre>\n";
! for($i = 1; $i <= $soure_size; $i++) {
! echo '<a name="'.$i.'" class="numberedLine">'.str_repeat(' ', strlen($soure_size) - strlen($i)). $i.':</a> ' . $source[$i-1] . "\n";
! }
echo "</pre>\n";
|