You are here

function hacked_diff_changed in Hacked! 6.2

Same name and namespace in other branches
  1. 5 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 28

Code

function hacked_diff_changed($project, $file) {

  // Load up the two files and diff them:
  module_load_include('php', 'diff', 'DiffEngine');
  $formatter = new DrupalDiffFormatter();
  $original_file = $project
    ->file_get_location('remote', $file);
  $installed_file = $project
    ->file_get_location('local', $file);
  $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;
}