Make WordPress Core


Ignore:
Timestamp:
03/28/2012 03:43:31 PM (13 years ago)
Author:
azaozz
Message:

Do not process <pre> tags with wpautop, replace them with placeholders, process the rest of the content and then put them back. Part props kurtpayne, see #19855

File:
1 edited

Legend:

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

    r20281 r20307  
    29842984
    29852985/**
     2986 * Accepts matches array from preg_replace_callback in wpautop() or a string.
     2987 *
     2988 * Ensures that the contents of a <<pre>>...<</pre>> HTML block are not
     2989 * converted into paragraphs or line-breaks.
     2990 *
     2991 * @since 1.2.0
     2992 * @deprecated 3.4.0
     2993 *
     2994 * @param array|string $matches The array or string
     2995 * @return string The pre block without paragraph/line-break conversion.
     2996 */
     2997function clean_pre($matches) {
     2998    _deprecated_function( __FUNCTION__, '3.4' );
     2999   
     3000    if ( is_array($matches) )
     3001        $text = $matches[1] . $matches[2] . "</pre>";
     3002    else
     3003        $text = $matches;
     3004
     3005    $text = str_replace('<br />', '', $text);
     3006    $text = str_replace('<p>', "\n", $text);
     3007    $text = str_replace('</p>', '', $text);
     3008
     3009    return $text;
     3010}
     3011
     3012
     3013/**
    29863014 * Add callbacks for image header display.
    29873015 *
Note: See TracChangeset for help on using the changeset viewer.