Make WordPress Core

Ticket #25435: 25435.diff

File 25435.diff, 1002 bytes (added by jdgrimes, 13 years ago)

Introduces call_shortcode_func()

  • src/wp-includes/shortcodes.php

     
    386386}
    387387
    388388add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop()
     389
     390/**
     391 * Call a shortcode function by tag name.
     392 *
     393 * We can now avoid evil calls to do_shortcode( '[shortcode]' ).
     394 *
     395 * @since 3.8.0
     396 *
     397 * @param string $tag     The shortcode whose function to call.
     398 * @param array  $atts    The attributes to pass to the shortcode function. Optional.
     399 * @param array  $content The shortcode's content. Default is null.
     400 *
     401 * @return string|bool False on failure, the result of the shortcode on success.
     402 */
     403function call_shortcode_func( $tag, $atts = array(), $content = null ) {
     404
     405        global $shortcode_tags;
     406
     407        if ( ! isset( $shortcode_tags[ $tag ] ) )
     408                return false;
     409
     410        return call_user_func( $shortcode_tags[ $tag ], $atts, $content, $tag );
     411}