WordPress.org

Make WordPress Core

Changeset 10527


Ignore:
Timestamp:
02/08/2009 04:08:02 PM (11 years ago)
Author:
azaozz
Message:

Reduce backtracking in autop, fixes #6877, see #8553

File:
1 edited

Legend:

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

    r10523 r10527  
    132132    foreach ( $pees as $tinkle )
    133133        $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
    134     $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
    135     $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
    136     $pee = preg_replace( '|<p>|', "$1<p>", $pee );
     134    $pee = preg_replace('|<p>\s*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
     135    $pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);
    137136    $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
    138137    $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
     
    149148    $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
    150149    if (strpos($pee, '<pre') !== false)
    151         $pee = preg_replace_callback('!(<pre.*?>)(.*?)</pre>!is', 'clean_pre', $pee );
     150        $pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
    152151    $pee = preg_replace( "|\n</p>$|", '</p>', $pee );
    153152    $pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone
Note: See TracChangeset for help on using the changeset viewer.