WordPress.org

Make WordPress Core

Ticket #4298: 4298.diff

File 4298.diff, 1.2 KB (added by Denis-de-Bernardy, 6 years ago)
  • Users/denis/Sites/sem-pro/wp-includes/formatting.php

     
    118118        $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee); 
    119119        // Space things out a little 
    120120        $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)'; 
     121        $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 
     122        while ( preg_match("/(<[^>\n]*)\n+/", $pee) ) 
     123                $pee = preg_replace("/(<[^>\n]*)\n+/", "$1 ", $pee); // eliminate carriage returns in tags 
    121124        $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); 
    122125        $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee); 
    123         $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 
    124126        if ( strpos($pee, '<object') !== false ) { 
    125127                $pee = preg_replace('|\s*<param([^>]*)>\s*|', "<param$1>", $pee); // no pee inside object/embed 
    126128                $pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee);