Make WordPress Core

Changeset 8298


Ignore:
Timestamp:
07/09/2008 04:52:27 AM (18 years ago)
Author:
ryan
Message:

Hands off pre tags. Props nbachiyski. fixes #7056

File:
1 edited

Legend:

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

    r8290 r8298  
    44        global $wp_cockneyreplace;
    55        $next = true;
     6        $has_pre_parent = false;
    67        $output = '';
    78        $curl = '';
     
    2728                $curl = $textarr[$i];
    2829
    29                 if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag
     30                if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent) { // If it's not a tag
    3031                        // static strings
    3132                        $curl = str_replace($static_characters, $static_replacements, $curl);
    3233                        // regular expressions
    3334                        $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
    34                 } elseif (strpos($curl, '<code') !== false || strpos($curl, '<pre') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
     35                } elseif (strpos($curl, '<code') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
    3536                        $next = false;
     37                } elseif (strpos($curl, '<pre') !== false) {
     38                        $has_pre_parent = true;
     39                } elseif (strpos($curl, '</pre>') !== false) {
     40                        $has_pre_parent = false;
    3641                } else {
    3742                        $next = true;
Note: See TracChangeset for help on using the changeset viewer.