Ticket #16684: 16684.diff
| File 16684.diff, 1.7 KB (added by solarissmoke, 2 years ago) |
|---|
-
wp-includes/formatting.php
29 29 function wptexturize($text) { 30 30 global $wp_cockneyreplace; 31 31 static $static_setup = false, $opening_quote, $closing_quote, $default_no_texturize_tags, $default_no_texturize_shortcodes, $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements; 32 $output = ''; 33 $curl = ''; 32 34 33 $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE); 35 $stop = count($textarr);36 34 37 35 // No need to set up these variables more than once 38 36 if (!$static_setup) { … … 70 68 $no_texturize_tags_stack = array(); 71 69 $no_texturize_shortcodes_stack = array(); 72 70 73 for ( $i = 0; $i < $stop; $i++ ) { 74 $curl = $textarr[$i]; 75 76 if ( !empty($curl) && '<' != $curl[0] && '[' != $curl[0] 71 foreach( $textarr as &$curl ) { 72 if ( !empty( $curl ) && '<' != $curl[0] && '[' != $curl[0] 77 73 && empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack)) { 78 74 // This is not a tag, nor is the texturization disabled 79 75 // static strings 80 76 $curl = str_replace($static_characters, $static_replacements, $curl); 81 77 // regular expressions 82 78 $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); 83 } elseif ( !empty($curl)) {79 } elseif ( !empty( $curl ) ) { 84 80 /* 85 81 * Only call _wptexturize_pushpop_element if first char is correct 86 82 * tag opening … … 92 88 } 93 89 94 90 $curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&$1', $curl); 95 $output .= $curl;96 91 } 97 92 98 return $output;93 return implode( '', $textarr ); 99 94 } 100 95 101 96 /**