Ticket #28564: miqro-28564.3.patch
File miqro-28564.3.patch, 2.7 KB (added by , 10 years ago) |
---|
-
src/wp-includes/formatting.php
203 203 . '|' 204 204 . '\[' // Find start of shortcode. 205 205 . '\[?' // Shortcodes may begin with [[ 206 . '[^\[\]<>]+' // Shortcodes do not contain other shortcodes or HTML elements. 206 . '(?:' 207 . '[^\[\]<>]' // Shortcodes do not contain other shortcodes. 208 . '|' 209 . '<.+?>' // HTML elements permitted. Prevents matching ] before >. 210 . ')+' 207 211 . '\]' // Find end of shortcode. 208 212 . '\]?' // Shortcodes may end with ]] 209 213 . ')/s'; … … 220 224 _wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags, '<', '>' ); 221 225 } 222 226 223 } elseif ( '[' === $first && 1 === preg_match( '/^\[ [^\[\]<>]+\]$/', $curl ) ) {227 } elseif ( '[' === $first && 1 === preg_match( '/^\[(?:[^\[\]<>]|<.+?>)+\]$/', $curl ) ) { 224 228 // This is a shortcode delimeter. 225 229 226 230 _wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']' ); 227 231 228 } elseif ( '[' === $first && 1 === preg_match( '/^\[\[? [^\[\]<>]+\]\]?$/', $curl ) ) {232 } elseif ( '[' === $first && 1 === preg_match( '/^\[\[?(?:[^\[\]<>]|<.+?>)+\]\]?$/', $curl ) ) { 229 233 // This is an escaped shortcode delimeter. 230 234 231 235 // Do not texturize. -
tests/phpunit/tests/formatting/WPTexturize.php
1146 1146 function data_tag_avoidance() { 1147 1147 return array( 1148 1148 array( 1149 '[ is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]', 1150 '[ is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]', 1151 ), 1152 array( 1149 1153 '[ photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy </a> ]', 1150 1154 '[ photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy </a> ]', 1151 1155 ), … … 1194 1198 '[gallery …', 1195 1199 ), 1196 1200 array( 1201 '[gallery <br ... /> ...]', // This tag is still valid. Shortcode 'attributes' are not considered in the initial parsing of shortcodes, and HTML is allowed. 1197 1202 '[gallery <br ... /> ...]', 1198 '[gallery <br ... /> …]',1199 1203 ), 1200 1204 array( 1201 1205 '<br [gallery ...] ... />', … … 1234 1238 '[/gallery ...]]', 1235 1239 ), 1236 1240 array( 1241 '[[gallery <br ... /> ...]]', // This gets parsed as an escaped shortcode with embedded HTML. Brains may explode. 1237 1242 '[[gallery <br ... /> ...]]', 1238 '[[gallery <br ... /> …]]',1239 1243 ), 1240 1244 array( 1241 1245 '<br [[gallery ...]] ... />',