You are here

function hacked_diff_changed in Hacked! 6

Same name and namespace in other branches
  1. 5 hacked.diff.inc \hacked_diff_changed()
  2. 6.2 hacked.diff.inc \hacked_diff_changed()
  3. 7.2 hacked.diff.inc \hacked_diff_changed()
1 call to hacked_diff_changed()
hacked_reports_hacked_diff in ./hacked.diff.inc

File

./hacked.diff.inc, line 42

Code

function hacked_diff_changed($installed_file, $original_file) {

  // Load up the two files and diff them:
  module_load_include('php', 'diff', 'DiffEngine');
  $formatter = new DrupalDiffFormatter();
  $original_array = file_exists($original_file) ? file($original_file) : array();
  $installed_array = file_exists($installed_file) ? file($installed_file) : array();
  $diff = new Diff($original_array, $installed_array);
  $output = theme('diff_table', array(
    t('Orignal'),
    '',
    t('Current'),
    '',
  ), $formatter
    ->format($diff), array(
    'class' => 'diff hacked-diff',
  ));
  return $output;
}