You are here

function hacked_diff_changed in Hacked! 5

Same name and namespace in other branches
  1. 6.2 hacked.diff.inc \hacked_diff_changed()
  2. 6 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:
  require_once drupal_get_path('module', 'diff') . '/DiffEngine.php';
  $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;
}