Changeset 877 for trunk/www/views/textblock_diff.php
- Timestamp:
- 12/26/07 04:28:00 (4 years ago)
- File:
-
- 1 edited
-
trunk/www/views/textblock_diff.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/views/textblock_diff.php
r852 r877 12 12 <?php 13 13 14 function diff_print_color_line($s) 15 { 16 if (preg_match("/^(---|\+\+\+)/", $s)) { 17 return; 14 function print_diff($diff) { 15 foreach ($diff as $block) { 16 echo '<div class="diff">'; 17 foreach ($block as $op) { 18 echo '<span class="'.$op['type'].'">'; 19 foreach ($op['lines'] as $line) { 20 echo str_replace(' ', ' ', htmlentities($line)); 21 echo '<br/>'; 22 } 23 echo '</span>'; 24 } 25 echo '</div>'; 18 26 } 19 if (preg_match("/^(@@)/", $s)) {20 echo "<hr />";21 return;22 }23 if (strlen($s) > 0 && $s[0] == '+') {24 $class = "added";25 } else if (strlen($s) > 0 && $s[0] == '-') {26 $class = "deleted";27 } else {28 $class = "normal";29 }30 echo "<span class=\"$class\">".htmlentities(substr($s, 1))."</span>";31 27 } 32 28 33 if ( count($view['diff_title']) <= 1) {29 if (empty($view['diff_title'])) { 34 30 echo "<h3>Nu exista diferente intre titluri.</h3>"; 35 31 } 36 32 else { 37 33 echo "<h3>Diferente intre titluri:</h3>"; 38 echo "<div class=\"diff\">"; 39 for ($i = 0; $i+1 < count($view['diff_title']); $i++) { 40 $s = $view['diff_title'][$i]; 41 $class = diff_print_color_line($s); 42 } 43 echo "</div>"; 34 print_diff($view['diff_title']); 44 35 } 45 36 ?> 46 37 47 38 <?php 48 if ( count($view['diff_content']) <= 1) {39 if (empty($view['diff_content'])) { 49 40 echo "<h3>Nu exista diferente intre continut.</h3>"; 50 41 } 51 42 else { 52 43 echo "<h3>Diferente intre continut:</h3>"; 53 echo '<div class="diff">'; 54 for ($i = 0; $i+1 < count($view['diff_content']); $i++) { 55 $s = $view['diff_content'][$i]; 56 $class = diff_print_color_line($s); 57 } 58 echo "</div>"; 44 print_diff($view['diff_content']); 59 45 } 60 46 ?>
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)