mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Hands off pre tags. Props nbachiyski. fixes #7056
git-svn-id: http://svn.automattic.com/wordpress/trunk@8298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0283fc3717
commit
0cd103e2a2
@ -3,6 +3,7 @@
|
||||
function wptexturize($text) {
|
||||
global $wp_cockneyreplace;
|
||||
$next = true;
|
||||
$has_pre_parent = false;
|
||||
$output = '';
|
||||
$curl = '';
|
||||
$textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
@ -26,13 +27,17 @@ function wptexturize($text) {
|
||||
for ( $i = 0; $i < $stop; $i++ ) {
|
||||
$curl = $textarr[$i];
|
||||
|
||||
if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag
|
||||
if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent) { // If it's not a tag
|
||||
// static strings
|
||||
$curl = str_replace($static_characters, $static_replacements, $curl);
|
||||
// regular expressions
|
||||
$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
|
||||
} elseif (strpos($curl, '<code') !== false || strpos($curl, '<pre') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
|
||||
} elseif (strpos($curl, '<code') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
|
||||
$next = false;
|
||||
} elseif (strpos($curl, '<pre') !== false) {
|
||||
$has_pre_parent = true;
|
||||
} elseif (strpos($curl, '</pre>') !== false) {
|
||||
$has_pre_parent = false;
|
||||
} else {
|
||||
$next = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user