WordPress.org

Make WordPress Core

Ticket #2239: 2239.patch

File 2239.patch, 1.4 KB (added by pishmishy, 6 years ago)

freshened patch (woops)

  • wp-includes/formatting.php

     
    6464        $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee); 
    6565        // Space things out a little 
    6666        $allblocks = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)'; 
    67         $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); 
    68         $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee); 
    6967        $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 
    7068        if ( strpos($pee, '<object') !== false ) { 
    7169                $pee = preg_replace('|\s*<param([^>]*)>\s*|', "<param$1>", $pee); // no pee inside object/embed 
     
    7371        } 
    7472        $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates 
    7573        $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 
     74        $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1",$pee); 
     75        $pee = preg_replace('!(</' . $allblocks . '>)!',"$1\n\n", $pee); 
    7676        $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 
    7777        $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee); 
    7878        $pee = preg_replace( '|<p>|', "$1<p>", $pee );