static function flexiHtmlDiff($old, $new, $mode = 0) { $t1 = explode(" ", $old); $t2 = explode(" ", $new); $out = flexicontent_html::PHPDiff($t1, $t2); $html1 = array(); $html2 = array(); foreach ($t1 as $k => $o) { if (in_array($k, $out[0])) { $html1[] = "<s>" . ($mode ? htmlspecialchars($o, ENT_QUOTES) : $o) . "</s>"; } else { $html1[] = $mode ? htmlspecialchars($o, ENT_QUOTES) . "<br/>" : $o; } } foreach ($t2 as $k => $n) { if (in_array($k, $out[1])) { $html2[] = "<u>" . ($mode ? htmlspecialchars($n, ENT_QUOTES) : $n) . "</u>"; } else { $html2[] = $mode ? htmlspecialchars($n, ENT_QUOTES) . "<br/>" : $n; } } $html1 = implode(" ", $html1); $html2 = implode(" ", $html2); return array($html1, $html2); }