Etienne Kneuss

home » repository » php » sample » highlight_patch.php
Tree:
school
mp3
php
sample
sort.php
bitmask.php
disable_magic_quotes.php
BB.php
regex_urls.php
highlight_patch.php
publications
Math_Derivative
Math_Expression
ircbot
php.net
images
dump

Source code raw phps

    <html>   <head>     <title><?php echo $rfilepath ?></title>     <style type="text/css">       .header {         font-weight: bold;         color: #2E8B57;       }       .add {         color: #008080;       }       .rem {         color: #CC0000;       }       .break {         font-weight: bold;         color: #804040;       }     </style>   </head>   <body> <a href="http://patches.colder.ch/<?php echo $rfilepath ?>?raw">Raw version</a> <hr />     <pre> <?php $lines = file($filepath); $format = "<span class=\"%s\">%s</span>\n"; foreach ($lines as $n => $line) {     if (preg_match('/^(Index:|diff|---|\+\+\+)/', $line)) {         $class = 'header';     } else if ($line[0] == '+') {         $class = 'add';     } else if ($line[0] == '-') {         $class = 'rem';     } else if ($line[0] == '@' && $line[1] == '@') {         $class = 'break';     } else {         $class = 'text';     }          printf($format, $class, htmlentities(rtrim($line))); } ?>     </pre>   </body> </html>

Comments

There is currently no comment here.

Add a comment

Username:

Spam Challenge: 2+11=?

Comment: