Make WordPress Core


Ignore:
Timestamp:
04/16/2008 09:09:22 PM (18 years ago)
Author:
markjaquith
Message:

Allow shortcodes to run before or after wpautop()/texturize() formatting. Default to before for WP 2.5 compat. Props AaronCampbell. fixes #6444 for 2.5.1

File:
1 edited

Legend:

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

    r7594 r7700  
    2727        $curl = $textarr[$i];
    2828
    29         if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag
     29        if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag or shortcode
    3030            // static strings
    3131            $curl = str_replace($static_characters, $static_replacements, $curl);
     
    7575    $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
    7676    $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
     77    $pee = preg_replace('/<p>(\s*?' . get_shortcode_regex(true) . '\s*)<\/p>/s', '$1', $pee); // don't auto-p wrap post-formatting shortcodes
    7778    $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
    7879    $pee = preg_replace( '|<p>|', "$1<p>", $pee );
     
    841842        $text = apply_filters('the_content', $text);
    842843        $text = str_replace(']]>', ']]&gt;', $text);
     844        $text = preg_replace('|//\s*<!\[CDATA\[|', '<![CDATA[', $text);
    843845        $text = strip_tags($text);
    844846        $excerpt_length = 55;
Note: See TracChangeset for help on using the changeset viewer.