Make WordPress Core


Ignore:
Timestamp:
10/23/2008 08:03:16 PM (16 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r9255 r9302  
    21452145}
    21462146
     2147// normalize EOL characters and strip duplicate whitespace
     2148function normalize_whitespace( $str ) {
     2149    $str  = trim($str);
     2150    $str  = str_replace("\r", "\n", $str);
     2151    $str  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
     2152    return $str;
     2153}
     2154
    21472155?>
Note: See TracChangeset for help on using the changeset viewer.