t_diff = new Text_Diff( $left_lines, $right_lines );
$renderer = new WP_Text_Diff_Renderer_Table( $args );
$diff = $renderer->render( $text_diff );
if ( ! $diff ) {
return '';
}
$is_split_view = ! empty( $args['show_split_view'] );
$is_split_view_class = $is_split_view ? ' is-split-view' : '';
$r = "
\n";
if ( $args['title'] ) {
$r .= "$args[title]\n";
}
if ( $args['title_left'] || $args['title_right'] ) {
$r .= '';
}
if ( $args['title_left'] || $args['title_right'] ) {
$th_or_td_left = empty( $args['title_left'] ) ? 'td' : 'th';
$th_or_td_right = empty( $args['title_right'] ) ? 'td' : 'th';
$r .= "\n";
$r .= "\t<$th_or_td_left>$args[title_left]$th_or_td_left>\n";
if ( $is_split_view ) {
$r .= "\t<$th_or_td_right>$args[title_right]$th_or_td_right>\n";
}
$r .= "
\n";
}
if ( $args['title_left'] || $args['title_right'] ) {
$r .= "\n";
}
$r .= "\n$diff\n\n";
$r .= '
';
return $r;
}
endif;