WordPress.org

Make WordPress Core

Changeset 4565


Ignore:
Timestamp:
12/01/2006 02:53:20 AM (13 years ago)
Author:
matt
Message:

Don't texturize things inside of script or style tags, fixes #2647

File:
1 edited

Legend:

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

    r4562 r4565  
    3333            // regular expressions
    3434            $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
    35         } elseif (strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd' || strstr($curl, '<style') || strstr($curl, '<script'))) {
     35        } elseif ( strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd') || strstr($curl, '<style') || strstr($curl, '<script') ) {
    3636            $next = false;
    3737        } else {
     
    6464    $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
    6565    $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
     66    $pee = preg_replace( '|<p>(<div[^>]*>\s*)|', "$1<p>", $pee );
     67    $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
     68    $pee = preg_replace( '|<p>|', "$1<p>", $pee );
    6669    $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
    6770    $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
     
    8083        $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '</pre>' ", $pee);
    8184    $pee = preg_replace( "|\n</p>$|", '</p>', $pee );
     85/**/
    8286    return $pee;
    8387}
Note: See TracChangeset for help on using the changeset viewer.