Ticket #7056: texturize-deep-code.diff
| File texturize-deep-code.diff, 1.6 KB (added by nbachiyski, 4 years ago) |
|---|
-
wp-includes/formatting.php
30 30 global $wp_cockneyreplace; 31 31 $next = true; 32 32 $has_pre_parent = false; 33 $has_code_parent = false; 33 34 $output = ''; 34 35 $curl = ''; 35 36 $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE); … … 53 54 for ( $i = 0; $i < $stop; $i++ ) { 54 55 $curl = $textarr[$i]; 55 56 56 if ( !empty($curl) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent ) { // If it's not a tag57 if ( !empty($curl) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent && !$has_code_parent) { // If it's not a tag 57 58 // static strings 58 59 $curl = str_replace($static_characters, $static_replacements, $curl); 59 60 // regular expressions 60 61 $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); 61 } elseif (strpos($curl, '< code') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {62 } elseif (strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) { 62 63 $next = false; 63 64 } elseif (strpos($curl, '<pre') !== false) { 64 65 $has_pre_parent = true; 65 66 } elseif (strpos($curl, '</pre>') !== false) { 66 67 $has_pre_parent = false; 68 } elseif (strpos($curl, '<code') !== false) { 69 $has_code_parent = true; 70 } elseif (strpos($curl, '</code>') !== false) { 71 $has_code_parent = false; 67 72 } else { 68 73 $next = true; 69 74 }