if (count($log['updates']) == 1 && isset($log['updates']['multiverseid'])) { echo ' <td>only multiverseID</td>' . "\n"; } else { echo ' <td><img src="' . $card->images[0] . '"></td>' . "\n"; } echo ' <td>' . "\n"; foreach ($log['updates'] as $field => $upd) { $diff = new HtmlDiff($upd, $card->{$field}); echo ' <strong title="' . $card->{$field} . '">' . $field . ' : </strong><div style="white-space:pre-wrap">' . $diff->build() . '</div>' . "\n"; } foreach ($log['langs'] as $code => $lang) { if (!isset($lang['from'])) { continue; } $diff = new HtmlDiff($lang['from'], $lang['to']); echo ' <strong>' . $code . ' name : </strong><div style="white-space:pre-wrap">' . $diff->build() . '</div>' . "\n"; echo strdebug($lang['from']) . strdebug($lang['to']); } echo ' </td>' . "\n"; echo ' </tr>' . "\n"; } if (isset($actions[$log['action']])) { $actions[$log['action']][] = $card; } else { $actions[$log['action']] = array($card); } } ?> </tbody> <caption><?php echo $updates;
public static function compare($html1, $html2) { $diff = new HtmlDiff($html1, $html2); $diff->build(); return $diff->getDifference(); }
if (!isset($_GET['toid']) || $_GET['toid'] == null || $_GET['toid'] == "" || $_GET['toid'] == 0) { $db->where('id', $history['contract_id']); $contracts = $db->getOne('contracts'); $index = $history['doc_id']; $contract_content = json_decode($contracts['content']); $to_text = $contract_content[$index]->content; } else { $db->where('id', $_GET['toid']); $to_history = $db->getOne('history'); $to_text = $to_history['content']; } $from_text = $history['content']; // $opcodes = FineDiff::getDiffOpcodes($from_text, $to_text); // echo FineDiff::renderDiffToHTMLFromOpcodes($from_text, $opcodes); $diff = new HtmlDiff($from_text, $to_text); $diff->build(); ?> <html> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <script type="text/javascript" src="../assets/js/jquery/jquery-1.7.1.min.js"></script> <style> ins.diffins,ins.diffmod {color:green;background:#dfd;text-decoration:none} del.diffmod,del.diffdel {color:red;background:#fdd;text-decoration:none} .panel { margin-bottom: 0px; } .panel-heading { padding: 5px 10px; background-color: #E8E8E8!important; font-weight: bold;