WordPress.org

Make WordPress Core

Changeset 9255


Ignore:
Timestamp:
10/20/2008 07:25:02 PM (11 years ago)
Author:
ryan
Message:

Reduce backtracking in wpautop. fixes #6877

File:
1 edited

Legend:

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

    r9189 r9255  
    127127    }
    128128    $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
    129     $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
     129    // make paragraphs, including one at the end
     130    $pees = preg_split('/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY);
     131    $pee = '';
     132    foreach ( $pees as $tinkle )
     133        $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
    130134    $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
    131135    $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
Note: See TracChangeset for help on using the changeset viewer.