File tree Expand file tree Collapse file tree 1 file changed +19
-24
lines changed
Expand file tree Collapse file tree 1 file changed +19
-24
lines changed Original file line number Diff line number Diff line change 44
55header ('Content-type: text/plain ' );
66
7- $ file = file_get_contents ('index.php ' );
8-
97echo '<table border="0" cellpadding="0" cellspacing="0"> ' . "\n" ;
108echo '<tr><td valign="top" width="300"> ' . "\n" ;
119echo "<h3>demo/index.php</h3> \n" ;
1210
1311$ code = false ;
1412
15- foreach (explode ("\n" , $ file ) as $ line )
16- {
17- if (substr (ltrim ($ line ),0 ,2 ) == '## ' )
18- {
19- if ($ code )
20- {
21- echo "</pre> \n" ;
22- echo "</td></tr> " ;
23- echo '<tr><td valign="top"><br/> ' . "\n" ;
24- $ code = false ;
25- }
26- echo htmlspecialchars (rtrim (substr (ltrim ($ line ),3 ))) . "\n" ;
27- }
28- else // it's code
29- {
30- if (!$ code )
31- {
32- echo '</td><td valign="top"> ' ."\n" ;
33- echo "<pre> " ;
34- $ code = true ;
13+ foreach (file ('index.php ' ) as $ line ) {
14+ if (substr (ltrim ($ line ), 0 , 2 ) == '## ' ) {
15+ if ($ code ) {
16+ echo "</pre> \n" ;
17+ echo "</td></tr> " ;
18+ echo '<tr><td valign="top"><br/> ' . "\n" ;
19+ $ code = false ;
20+ }
21+
22+ echo htmlspecialchars (rtrim (substr (ltrim ($ line ), 3 ))) . "\n" ;
23+ } else {
24+ // it's code
25+ if (!$ code ) {
26+ echo '</td><td valign="top"> ' . "\n" ;
27+ echo "<pre> " ;
28+ $ code = true ;
29+ }
30+
31+ echo htmlspecialchars ($ line );
3532 }
36- echo htmlspecialchars ($ line );
37- }
3833}
3934
4035echo '</table> ' ;
You can’t perform that action at this time.
0 commit comments