Introduce normalize_whitespace(). Use it instead of wp_text_diff() when checking for identical autosave revisions. Props tellyworth. fixes #7691

git-svn-id: https://develop.svn.wordpress.org/trunk@9302 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-10-23 20:03:16 +00:00
parent fde3dc72bd
commit 06c6a7d153
3 changed files with 11 additions and 8 deletions
+2 -7
View File
@@ -1663,13 +1663,8 @@ function wp_text_diff( $left_string, $right_string, $args = null ) {
if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) )
require( ABSPATH . WPINC . '/wp-diff.php' );
// Normalize whitespace
$left_string = trim($left_string);
$right_string = trim($right_string);
$left_string = str_replace("\r", "\n", $left_string);
$right_string = str_replace("\r", "\n", $right_string);
$left_string = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $left_string );
$right_string = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $right_string );
$left_string = normalize_whitespace($left_string);
$right_string = normalize_whitespace($right_string);
$left_lines = split("\n", $left_string);
$right_lines = split("\n", $right_string);