Make WordPress Core

Ticket #14050: t14050-shortcode-unautop-upgrade.diff

File t14050-shortcode-unautop-upgrade.diff, 4.6 KB (added by lkraav, 11 years ago)
  • wp-includes/formatting.php

    commit e18aa9ff399aa2053e63cc78a130737b6311f606
    Author: Leho Kraav <leho@kraav.com>
    Date:   Thu Nov 21 04:54:40 2013 +0200
    
        Formatting: shortcode_unautop() should support shortcode attributes, see #14050
    
    diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
    index 09f3b47..a13b612 100644
    a b function shortcode_unautop( $pee ) { 
    303303                .         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
    304304                .         '[^\\]\\/]*'               // Not a closing bracket or forward slash
    305305                .     ')*?'
     306                .     '[\\w\\s="\']*'                // Shortcode attributes
    306307                .     '(?:'
    307308                .         '\\s*+'                    // Optional leading whitespace, supports [footag /]
    308309                .         '\\/\\]'                   // Self closing tag and closing bracket
  • wp-includes/formatting.php

    commit f05a03e149de3d1a9deb9b94d772dc8a3a9e813a
    Author: Leho Kraav <leho@kraav.com>
    Date:   Thu Nov 21 04:30:53 2013 +0200
    
        Formatting: shortcode_unautop() clarifying comment, see #14050
    
    diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
    index edbfb37..09f3b47 100644
    a b function shortcode_unautop( $pee ) { 
    310310                .         '\\]'                      // Closing bracket
    311311                .         '(?:'                      // Unroll the loop: Optionally, anything between the opening and closing shortcode tags
    312312                .             '(?!<\/p>)'            // Not followed by closing paragraph
    313                 .             '[^\\[]*+'             // Not an opening bracket
     313                .             '[^\\[]*+'             // Not an opening bracket, matches all content between closing bracket and closing shortcode tag
    314314                .             '(?:'
    315315                .                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
    316316                .                 '[^\\[]*+'         // Not an opening bracket
  • wp-includes/formatting.php

    commit 2bddf791741216b214b6d01a2bf2943de8cb1899
    Author: Leho Kraav <leho@kraav.com>
    Date:   Thu Nov 21 04:30:21 2013 +0200
    
        Formatting: shortcode_unautop() should support shortcodes on separate lines, see #14050
        
        Handles scenarios like
        
        {{{
        <p>[footag]</p>
        <p>Enjoy guided day walks in extraordinary natural areas. Return to
        comfortable accommodation and delicious meals each evening. No heavy
        backpack, no camping.</p>
        <p>[/footag]</p>
        }}}
    
    diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
    index 542ae0c..edbfb37 100644
    a b function shortcode_unautop( $pee ) { 
    294294                . '<p>'                              // Opening paragraph
    295295                . '\\s*+'                            // Optional leading whitespace
    296296                . '('                                // 1: The shortcode
    297                 .     '\\['                          // Opening bracket
     297                .     '\\[\\/?'                      // Opening bracket for opening or closing shortcode tag
    298298                .     "($tagregexp)"                 // 2: Shortcode name
    299299                .     '(?![\\w-])'                   // Not followed by word character or hyphen
    300300                                                     // Unroll the loop: Inside the opening shortcode tag
    function shortcode_unautop( $pee ) { 
    309309                .     '|'
    310310                .         '\\]'                      // Closing bracket
    311311                .         '(?:'                      // Unroll the loop: Optionally, anything between the opening and closing shortcode tags
     312                .             '(?!<\/p>)'            // Not followed by closing paragraph
    312313                .             '[^\\[]*+'             // Not an opening bracket
    313314                .             '(?:'
    314315                .                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
  • wp-includes/formatting.php

    commit 2ac5bcdad72b369e227e353dffe7d68b493ea53d
    Author: Leho Kraav <leho@kraav.com>
    Date:   Thu Nov 21 03:36:22 2013 +0200
    
        Formatting: shortcode_unautop should support [footag /], see #14050
        
        current version only supports [footag/].
        https://codex.wordpress.org/Shortcode_API#Other_features_in_brief says
        otherwise.
    
    diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
    index 56aac4c..542ae0c 100644
    a b function shortcode_unautop( $pee ) { 
    304304                .         '[^\\]\\/]*'               // Not a closing bracket or forward slash
    305305                .     ')*?'
    306306                .     '(?:'
     307                .         '\\s*+'                    // Optional leading whitespace, supports [footag /]
    307308                .         '\\/\\]'                   // Self closing tag and closing bracket
    308309                .     '|'
    309310                .         '\\]'                      // Closing bracket