Ticket #29557: 29557-idea-2.diff
File 29557-idea-2.diff, 3.0 KB (added by , 10 years ago) |
---|
-
src/wp-includes/formatting.php
28 28 * @return string The string replaced with html entities 29 29 */ 30 30 function wptexturize($text, $reset = false) { 31 global $wp_cockneyreplace ;31 global $wp_cockneyreplace, $shortcode_tags; 32 32 static $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements, 33 33 $default_no_texturize_tags, $default_no_texturize_shortcodes, $run_texturize = true; 34 34 … … 205 205 206 206 // Look for shortcodes and HTML elements. 207 207 208 $tagnames = array_keys( $shortcode_tags ); 209 $tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) ); 210 $tagregexp = "(?:$tagregexp)(?![\\w-])"; // Excerpt of get_shortcode_regex(). 211 208 212 $comment_regex = 209 213 '!' // Start of comment, after the <. 210 214 . '(?:' // Unroll the loop: Consume everything until --> is found. … … 216 220 $shortcode_regex = 217 221 '\[' // Find start of shortcode. 218 222 . '[\/\[]?' // Shortcodes may begin with [/ or [[ 219 . '[^\s\/\[\]]' // No whitespace before name.223 . $tagregexp // Only match registered shortcodes. 220 224 . '[^\[\]]*+' // Shortcodes do not contain other shortcodes. Possessive critical. 221 225 . '\]' // Find end of shortcode. 222 226 . '\]?'; // Shortcodes may end with ]] -
tests/phpunit/tests/formatting/WPTexturize.php
1197 1197 ), 1198 1198 array( 1199 1199 '[is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]', // HTML corruption is a known bug. See tickets #12690 and #29557. 1200 '[is it wise to <a title="allow user content ] here? hmm ”> maybe </a> ]',1200 '[is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]', 1201 1201 ), 1202 1202 array( 1203 1203 '[caption - is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]', … … 1767 1767 ), 1768 1768 array( 1769 1769 '[code ...]...[/code]', // code is not a registered shortcode. 1770 '[code ...]...[/code]',1770 '[code …]…[/code]', 1771 1771 ), 1772 1772 array( 1773 1773 '[hello ...]...[/hello]', // hello is not a registered shortcode. 1774 '[hello ...]…[/hello]',1774 '[hello …]…[/hello]', 1775 1775 ), 1776 1776 array( 1777 1777 '[...]...[/...]', // These are potentially usable shortcodes. 1778 '[ ...]…[/...]',1778 '[…]…[/…]', 1779 1779 ), 1780 1780 array( 1781 1781 '[gal>ery ...]', 1782 '[gal>ery ...]',1782 '[gal>ery …]', 1783 1783 ), 1784 1784 array( 1785 1785 '[randomthing param="test"]', 1786 '[randomthing param= "test"]',1786 '[randomthing param=”test”]', 1787 1787 ), 1788 1788 array( 1789 1789 '[[audio]...[/audio]...', // These are potentially usable shortcodes. Unfortunately, the meaning of [[audio] is ambiguous unless we run the entire shortcode regexp.