You are here

function DrupalDiffFormatter::_changed in Diff 6.2

Same name and namespace in other branches
  1. 5.2 DiffEngine.php \DrupalDiffFormatter::_changed()
  2. 6 DiffEngine.php \DrupalDiffFormatter::_changed()
  3. 7.3 DiffEngine.php \DrupalDiffFormatter::_changed()
  4. 7.2 DiffEngine.php \DrupalDiffFormatter::_changed()

Overrides DiffFormatter::_changed

File

./DiffEngine.php, line 1189
A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)

Class

DrupalDiffFormatter
Diff formatter which uses Drupal theme functions. @private @subpackage DifferenceEngine

Code

function _changed($orig, $closing) {
  $diff = new WordLevelDiff($orig, $closing);
  $del = $diff
    ->orig();
  $add = $diff
    ->closing();

  // Notice that WordLevelDiff returns HTML-escaped output.
  // Hence, we will be calling addedLine/deletedLine without HTML-escaping.
  while ($line = array_shift($del)) {
    $aline = array_shift($add);
    $this->rows[] = array_merge($this
      ->deletedLine($line), $this
      ->addedLine($aline));
  }
  foreach ($add as $line) {

    // If any leftovers
    $this->rows[] = array_merge($this
      ->emptyLine(), $this
      ->addedLine($line));
  }
}