diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/shortcodes.php --- a/wp/wp-includes/shortcodes.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/shortcodes.php Tue Dec 15 13:49:49 2020 +0100 @@ -23,7 +23,7 @@ * * $out = do_shortcode( $content ); * - * @link https://codex.wordpress.org/Shortcode_API + * @link https://developer.wordpress.org/plugins/shortcodes/ * * @package WordPress * @subpackage Shortcodes @@ -63,14 +63,14 @@ function add_shortcode( $tag, $callback ) { global $shortcode_tags; - if ( '' == trim( $tag ) ) { + if ( '' === trim( $tag ) ) { $message = __( 'Invalid shortcode name: Empty name given.' ); _doing_it_wrong( __FUNCTION__, $message, '4.4.0' ); return; } if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) { - /* translators: 1: shortcode name, 2: space separated list of reserved characters */ + /* translators: 1: Shortcode name, 2: Space-separated list of reserved characters. */ $message = sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' ); _doing_it_wrong( __FUNCTION__, $message, '4.4.0' ); return; @@ -162,6 +162,24 @@ /** * Search content for shortcodes and filter shortcodes through their hooks. * + * This function is an alias for do_shortcode(). + * + * @since 5.4.0 + * + * @see do_shortcode() + * + * @param string $content Content to search for shortcodes. + * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped. + * Default false. + * @return string Content with shortcodes filtered out. + */ +function apply_shortcodes( $content, $ignore_html = false ) { + return do_shortcode( $content, $ignore_html ); +} + +/** + * Search content for shortcodes and filter shortcodes through their hooks. + * * If there are no shortcode tags defined, then the content will be returned * without any filtering. This might cause issues when plugins are disabled but * the shortcode will still show up in the post or content. @@ -170,8 +188,9 @@ * * @global array $shortcode_tags List of shortcode tags and their callback hooks. * - * @param string $content Content to search for shortcodes. - * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped. + * @param string $content Content to search for shortcodes. + * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped. + * Default false. * @return string Content with shortcodes filtered out. */ function do_shortcode( $content, $ignore_html = false ) { @@ -198,7 +217,7 @@ $pattern = get_shortcode_regex( $tagnames ); $content = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $content ); - // Always restore square braces so we don't break things like