Ticket #6444: 6444.006.diff
| File 6444.006.diff, 1.4 KB (added by , 18 years ago) |
|---|
-
wp-includes/shortcodes.php
72 72 if (empty($shortcode_tags) || !is_array($shortcode_tags)) 73 73 return $content; 74 74 75 $pattern = get_shortcode_regex(); 76 return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content); 77 } 78 79 function get_shortcode_regex() { 80 global $shortcode_tags; 75 81 $tagnames = array_keys($shortcode_tags); 76 82 $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); 77 83 78 $pattern = '/\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\1\])?/s'; 79 80 return preg_replace_callback($pattern, 'do_shortcode_tag', $content); 84 return '\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\1\])?'; 81 85 } 82 86 83 87 function do_shortcode_tag($m) { -
wp-includes/formatting.php
92 92 if (strpos($pee, '<pre') !== false) 93 93 $pee = preg_replace_callback('!(<pre.*?>)(.*?)</pre>!is', 'clean_pre', $pee ); 94 94 $pee = preg_replace( "|\n</p>$|", '</p>', $pee ); 95 $pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone 95 96 96 97 return $pee; 97 98 }