1 diff.inc BackdropDiffFormatter::changed($orig, $closing)

Parameters

$orig:

$closing:

Overrides DiffFormatter::changed

File

core/includes/diff.inc, line 1271
A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)

Class

BackdropDiffFormatter
Backdrop diff formatter which returns diffs as an array.

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), isset($aline) ? $this->addedLine($aline) : $this->emptyLine());
  }
  // If any leftovers.
  foreach ($add as $line) {
    $this->rows[] = array_merge($this->emptyLine(), $this->addedLine($line));
  }
}