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

git-svn-id: http://svn.automattic.com/wordpress/trunk@9302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2008-10-23 20:03:16 +00:00
parent 77f5447071
commit 33f8a5e080
3 changed files with 11 additions and 8 deletions

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);