Changeset 37
- Timestamp:
- Jun 16, 2009, 7:40:52 AM (15 years ago)
- Location:
- trunk/www
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/page.php
r34 r37 68 68 69 69 // Funkce formatovani vystupu 70 function FormatOutput($ s)70 function FormatOutput($Text) 71 71 { 72 $out = ''; 73 $nn = 0; 74 $n = 0; 75 while($s != '') 72 $Indentation = 2; 73 74 $Output = ''; 75 $Indent = 0; 76 $IndentNew = 0; 77 while($Text != '') 76 78 { 77 $ start = strpos($s, '<');78 $ end = strpos($s, '>');79 if($ start != 0)79 $Start = strpos($Text, '<'); 80 $End = strpos($Text, '>'); 81 if($Start != 0) 80 82 { 81 $ end = $start - 1;82 $ start = 0;83 $End = $Start - 1; 84 $Start = 0; 83 85 } 84 $ line = trim(substr($s, $start, $end + 1));85 if(strlen($ line) > 0)86 if($ line[0] == '<')86 $Line = trim(substr($Text, $Start, $End + 1)); 87 if(strlen($Line) > 0) 88 if($Line[0] == '<') 87 89 { 88 if($ s[$start + 1] == '/')90 if($Text[$Start + 1] == '/') 89 91 { 90 $ n = $n - 2;91 $ nn = $n;92 $IndentNew = $IndentNew - $Indentation; 93 $Indent = $IndentNew; 92 94 } else 93 95 { 94 if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1); 95 else $cmd = substr($line, 1, strlen($line) - 2); 96 //echo('['.$cmd.']'); 97 if(strpos($s, '</'.$cmd.'>')) $n = $n + 2; 96 if(strpos($Line, ' ')) $Command = substr($Line, 1, strpos($Line, ' ') - 1); 97 else $Command = substr($Line, 1, strlen($Line) - $Indentation); 98 if(strpos($Text, '</'.$Command.'>')) $IndentNew = $IndentNew + $Indentation; 98 99 } 99 }// else $line = '['.$line.']'; 100 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n")); 101 if($line != '') $out .= (str_repeat(' ', $nn).$line."\n"); 102 $s = substr($s, $end + 1, strlen($s)); 103 $nn = $n; 100 } 101 if($Line != '') $Output .= (str_repeat(' ', $Indent).$Line."\n"); 102 $Text = substr($Text, $End + 1, strlen($Text)); 103 $Indent = $IndentNew; 104 104 } 105 return($ out);105 return($Output); 106 106 } 107 107 }
Note:
See TracChangeset
for help on using the changeset viewer.