Make WordPress Core

Ticket #25820: 25820.diff

File 25820.diff, 1.5 KB (added by aaroncampbell, 10 years ago)
  • src/wp-includes/class-wp-embed.php

    diff --git src/wp-includes/class-wp-embed.php src/wp-includes/class-wp-embed.php
    index 23a8289..c0c8879 100644
    class WP_Embed { 
    5656
    5757                add_shortcode( 'embed', array( $this, 'shortcode' ) );
    5858
     59                add_filter( 'escaped_shortcode', array( $this, 'reescape' ) );
     60
    5961                // Do the shortcode (only the [embed] one is registered)
    6062                $content = do_shortcode( $content );
    6163
     64                remove_filter( 'escaped_shortcode', array( $this, 'reescape' ) );
     65
    6266                // Put the original shortcodes back
    6367                $shortcode_tags = $orig_shortcode_tags;
    6468
    class WP_Embed { 
    6670        }
    6771
    6872        /**
     73         * Processing the embed shortcode early causes escaped shortcodes to become
     74         * real shortcodes, so let's re-escape them
     75         */
     76        public function reescape( $shortcode ) {
     77                return "[$shortcode]";
     78        }
     79
     80        /**
    6981         * If a post/page was saved, then output JavaScript to make
    7082         * an AJAX request that will call WP_Embed::cache_oembed().
    7183         */
  • src/wp-includes/shortcodes.php

    diff --git src/wp-includes/shortcodes.php src/wp-includes/shortcodes.php
    index 9874785..e323871 100644
    function do_shortcode_tag( $m ) { 
    278278
    279279        // allow [[foo]] syntax for escaping a tag
    280280        if ( $m[1] == '[' && $m[6] == ']' ) {
    281                 return substr($m[0], 1, -1);
     281                /**
     282                 * Filter an escaped shortcode
     283                 *
     284                 * @since 4.1.0
     285                 *
     286                 * @param string $shortcode The now-unescaped shortode string
     287                 */
     288                return apply_filters( 'escaped_shortcode', substr($m[0], 1, -1) );
    282289        }
    283290
    284291        $tag = $m[2];