Index: wp-includes/shortcodes.php =================================================================== --- wp-includes/shortcodes.php (revision 11744) +++ wp-includes/shortcodes.php (working copy) @@ -175,10 +175,40 @@ $tagnames = array_keys($shortcode_tags); $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); - return '(.?)\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)'; + return '(.?)\[('.$tagregexp.')\b([^\]]*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)'; } /** + * Retrieve the shortcode regular expression for searching for start tag only. + * + * @uses $shortcode_tags + * + * @return string The shortcode start tag search regular expression + */ +function get_shortcode_start_regex() { + global $shortcode_tags; + $tagnames = array_keys($shortcode_tags); + $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); + + return '\[('.$tagregexp.')\b([^\]]*?)(?:(\/))?\]'; +} + +/** + * Retrieve the shortcode regular expression for searching for end tag only. + * + * @uses $shortcode_tags + * + * @return string The shortcode end tag search regular expression + */ +function get_shortcode_end_regex() { + global $shortcode_tags; + $tagnames = array_keys($shortcode_tags); + $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); + + return '\[\/('.$tagregexp.')\]'; +} + +/** * Regular Expression callable for do_shortcode() for calling shortcode hook. * @see get_shortcode_regex for details of the match array contents. * Index: wp-includes/formatting.php =================================================================== --- wp-includes/formatting.php (revision 11744) +++ wp-includes/formatting.php (working copy) @@ -170,7 +170,8 @@ if (strpos($pee, ']*>)(.*?)!is', 'clean_pre', $pee ); $pee = preg_replace( "|\n

$|", '

', $pee ); - $pee = preg_replace('/

\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone + $pee = preg_replace('/

\s*?(' . get_shortcode_start_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone + $pee = preg_replace('/

\s*?(' . get_shortcode_end_regex() . ')\s*<\/p>/s', '$1', $pee); // check both start and end tags return $pee; }