list
($orig_matches,
$final_matches,
$orig_rows,
$final_rows) =
$this->
interleave_changed_lines( $orig,
$final );
// These will hold the word changes as determined by an inline diff.
$orig_diffs = array
();
$final_diffs = array
();
// Compute word diffs for each matched pair using the inline diff.
foreach ( $orig_matches as $o =>
$f ) { if ( is_numeric( $o ) &&
is_numeric( $f ) ) { $text_diff =
new Text_Diff( 'auto', array
( array
( $orig[ $o ] ), array
( $final[ $f ] ) ) );
$renderer =
new $this->
inline_diff_renderer();
$diff =
$renderer->
render( $text_diff );
// If they're too different, don't include any <ins> or <del>'s.
if ( preg_match_all( '!(<ins>.*?</ins>|<del>.*?</del>)!',
$diff,
$diff_matches ) ) { // Length of all text between <ins> or <del>.
$stripped_matches =
strlen( strip_tags( implode( ' ',
$diff_matches[0
] ) ) );
/*
* Since we count length of text between <ins> or <del> (instead of picking just one),
* we double the length of chars not in those tags.
*/
$stripped_diff =
strlen( strip_tags( $diff ) ) * 2 -
$stripped_matches;