Changeset 30452 for branches/3.9
- Timestamp:
- 11/20/2014 02:31:09 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.9/src/wp-includes/formatting.php
r27844 r30452 153 153 $no_texturize_shortcodes_stack = array(); 154 154 155 $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE); 155 // Look for shortcodes and HTML elements. 156 157 $shortcode_regex = 158 '\[' // Find start of shortcode. 159 . '[^\[\]<>]++' // Shortcodes do not contain other shortcodes. Possessive critical. 160 . '\]'; // Find end of shortcode. 161 162 $textarr = preg_split("/(<[^>]*>|$shortcode_regex)/s", $text, -1, PREG_SPLIT_DELIM_CAPTURE); 156 163 157 164 foreach ( $textarr as &$curl ) { … … 164 171 if ( '<' === $first ) { 165 172 _wptexturize_pushpop_element($curl, $no_texturize_tags_stack, $no_texturize_tags, '<', '>'); 166 } elseif ( '[' === $first ) {173 } elseif ( '[' === $first && 1 === preg_match( '/^' . $shortcode_regex . '$/', $curl ) ) { 167 174 _wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']'); 168 175 } elseif ( empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack) ) { … … 215 222 array_push($stack, $matches[1]); 216 223 } 224 } elseif ( 0 == count( $stack ) ) { 225 // Stack is empty. Just stop. 217 226 } else { 218 227 // Closing? Check $text+2 against disabled elements
Note: See TracChangeset
for help on using the changeset viewer.