WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/25/2008 12:46:17 AM (14 years ago)
Author:
markjaquith
Message:

Don't wpautop()-wrap shortcodes that stand alone. fixes #6444 for 2.5.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/wp-includes/shortcodes.php

    r7811 r7816  
    7373        return $content;
    7474
     75    $pattern = get_shortcode_regex();
     76    return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content);
     77}
     78
     79function get_shortcode_regex() {
     80    global $shortcode_tags;
    7581    $tagnames = array_keys($shortcode_tags);
    7682    $tagregexp = join( '|', array_map('preg_quote', $tagnames) );
    7783
    78     $pattern = '/\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\1\])?/s';
    79 
    80     return preg_replace_callback($pattern, 'do_shortcode_tag', $content);
     84    return '\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\1\])?';
    8185}
    8286
Note: See TracChangeset for help on using the changeset viewer.