WordPress.org

Make WordPress Core

Ticket #37422: 37422.patch

File 37422.patch, 5.5 KB (added by ljasinskipl, 4 years ago)
  • wp-admin/includes/ajax-actions.php

    diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
    index 6a197c7..b6bd757 100644
    a b function wp_ajax_parse_embed() { 
    29802980                        $styles .= sprintf( '<link rel="stylesheet" href="%s"/>', $style );
    29812981                }
    29822982
    2983                 $html = apply_shortcodes( $parsed );
     2983                $html = do_shortcode( $parsed );
    29842984
    29852985                global $wp_scripts;
    29862986                if ( ! empty( $wp_scripts ) ) {
    function wp_ajax_parse_media_shortcode() { 
    30373037                setup_postdata( $post );
    30383038        }
    30393039
    3040         $parsed = apply_shortcodes( $shortcode  );
     3040        $parsed = do_shortcode( $shortcode  );
    30413041
    30423042        if ( empty( $parsed ) ) {
    30433043                wp_send_json_error( array(
  • wp-includes/class-wp-embed.php

    diff --git a/wp-includes/class-wp-embed.php b/wp-includes/class-wp-embed.php
    index a20bb3a..a8ce4d6 100644
    a b class WP_Embed { 
    4848         *
    4949         * Since the [embed] shortcode needs to be run earlier than other shortcodes,
    5050         * this function removes all existing shortcodes, registers the [embed] shortcode,
    51          * calls apply_shortcodes(), and then re-registers the old shortcodes.
     51         * calls do_shortcode(), and then re-registers the old shortcodes.
    5252         *
    5353         * @global array $shortcode_tags
    5454         *
    class WP_Embed { 
    6565                add_shortcode( 'embed', array( $this, 'shortcode' ) );
    6666
    6767                // Do the shortcode (only the [embed] one is registered)
    68                 $content = apply_shortcodes( $content, true );
     68                $content = do_shortcode( $content, true );
    6969
    7070                // Put the original shortcodes back
    7171                $shortcode_tags = $orig_shortcode_tags;
    class WP_Embed { 
    124124        }
    125125
    126126        /**
    127          * The allby_shortcodes() callback function.
     127         * The do_shortcode() callback function.
    128128         *
    129129         * Attempts to convert a URL into embed HTML. Starts by checking the URL against the regex of
    130130         * the registered embed handlers. If none of the regex matches and it's enabled, then the URL
  • wp-includes/default-filters.php

    diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
    index 40ec96a..3402e48 100644
    a b add_action( 'template_redirect', 'redirect_canonical' ); 
    430430add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
    431431
    432432// Shortcodes
    433 add_filter( 'the_content', 'apply_shortcodes', 11 ); // AFTER wpautop()
     433add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop()
    434434
    435435// Media
    436436add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
  • wp-includes/deprecated.php

    diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php
    index 618e680..48f0173 100644
    a b function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { 
    37583758
    37593759        return '';
    37603760}
    3761 
    3762 /**
    3763  * Search content for shortcodes and filter shortcodes through their hooks.
    3764  *
    3765  * If there are no shortcode tags defined, then the content will be returned
    3766  * without any filtering. This might cause issues when plugins are disabled but
    3767  * the shortcode will still show up in the post or content.
    3768  *
    3769  * @since 2.5.0
    3770  *
    3771  * @global array $shortcode_tags List of shortcode tags and their callback hooks.
    3772  *
    3773  * @param string $content Content to search for shortcodes.
    3774  * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
    3775  * @return string Content with shortcodes filtered out.
    3776  */
    3777 function do_shortcode( $content, $ignore_html = false ) {
    3778         _deprecated_function( __FUNCTION__, '4.7.0', 'apply_shortcodes' );
    3779 
    3780         return apply_shortcodes( $content, $ignore_html );
    3781 }
    3782  No newline at end of file
  • wp-includes/media.php

    diff --git a/wp-includes/media.php b/wp-includes/media.php
    index 71fa14d..fd3bf43 100644
    a b function img_caption_shortcode( $attr, $content = null ) { 
    15711571
    15721572        if ( $html5 ) {
    15731573                $html = '<figure ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
    1574                 . apply_shortcodes( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
     1574                . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
    15751575        } else {
    15761576                $html = '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
    1577                 . apply_shortcodes( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
     1577                . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
    15781578        }
    15791579
    15801580        return $html;
  • wp-includes/shortcodes.php

    diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php
    index e6bd9c4..b2aad3d 100644
    a b  
    2121 *
    2222 * To apply shortcode tags to content:
    2323 *
    24  *     $out = apply_shortcodes( $content );
     24 *     $out = do_shortcode( $content );
    2525 *
    2626 * @link https://codex.wordpress.org/Shortcode_API
    2727 *
    function has_shortcode( $content, $tag ) { 
    199199 * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
    200200 * @return string Content with shortcodes filtered out.
    201201 */
    202 function apply_shortcodes( $content, $ignore_html = false ) {
     202function do_shortcode( $content, $ignore_html = false ) {
    203203        global $shortcode_tags;
    204204
    205205        if ( false === strpos( $content, '[' ) ) {
    function get_shortcode_regex( $tagnames = null ) { 
    292292}
    293293
    294294/**
    295  * Regular Expression callable for apply_shortcodes() for calling shortcode hook.
     295 * Regular Expression callable for do_shortcode() for calling shortcode hook.
    296296 * @see get_shortcode_regex for details of the match array contents.
    297297 *
    298298 * @since 2.5.0