Make WordPress Core

Ticket #43159: 43159.3.diff

File 43159.3.diff, 4.4 KB (added by NathanAtmoz, 8 months ago)
  • wp-includes/admin-bar.php

     
    13481348        global $show_admin_bar, $pagenow;
    13491349
    13501350        // For all these types of requests, we never want an admin bar.
    1351         if ( defined( 'XMLRPC_REQUEST' ) || defined( 'DOING_AJAX' ) || defined( 'IFRAME_REQUEST' ) || wp_is_json_request() ) {
     1351        if ( wp_doing_xmlrpc() || defined( 'DOING_AJAX' ) || defined( 'IFRAME_REQUEST' ) || wp_is_json_request() ) {
    13521352                return false;
    13531353        }
    13541354
  • wp-includes/cron.php

     
    887887        }
    888888
    889889        if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
    890                 if ( 'GET' !== $_SERVER['REQUEST_METHOD'] || defined( 'DOING_AJAX' ) || defined( 'XMLRPC_REQUEST' ) ) {
     890                if ( 'GET' !== $_SERVER['REQUEST_METHOD'] || defined( 'DOING_AJAX' ) || wp_doing_xmlrpc() ) {
    891891                        return false;
    892892                }
    893893
  • wp-includes/functions.php

     
    37613761                 * @param callable $callback Callback function name.
    37623762                 */
    37633763                $callback = apply_filters( 'wp_die_jsonp_handler', '_jsonp_wp_die_handler' );
    3764         } elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
     3764        } elseif ( wp_doing_xmlrpc() ) {
    37653765                /**
    37663766                 * Filters the callback for killing WordPress execution for XML-RPC requests.
    37673767                 *
  • wp-includes/load.php

     
    610610         * The 'REST_REQUEST' check here is optimistic as the constant is most
    611611         * likely not set at this point even if it is in fact a REST request.
    612612         */
    613         if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || defined( 'MS_FILES_REQUEST' )
     613        if ( wp_doing_xmlrpc() || defined( 'REST_REQUEST' ) || defined( 'MS_FILES_REQUEST' )
    614614                || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING )
    615615                || wp_doing_ajax() || wp_is_json_request()
    616616        ) {
     
    17471747        return apply_filters( 'wp_doing_cron', defined( 'DOING_CRON' ) && DOING_CRON );
    17481748}
    17491749
     1750 /**
     1751  * Determines whether the current request is a WordPress XML-RPC request.
     1752  *
     1753  * @since 6.7.0
     1754  *
     1755  * @return bool True if it's a WordPress XML-RPC request, false otherwise.
     1756  */
     1757function wp_doing_xmlrpc() {
     1758        /**
     1759         * Filters whether the current request is a WordPress XML-RPC request.
     1760         *
     1761         * @since 6.7.0
     1762         *
     1763         * @param bool $wp_doing_cron Whether the current request is a WordPress XML-RPC request.
     1764         */
     1765        return apply_filters( 'wp_doing_xmlrpc', defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST );
     1766}
     1767
    17501768/**
    17511769 * Checks whether the given variable is a WordPress Error.
    17521770 *
  • wp-includes/post.php

     
    76757675/**
    76767676 * Hook to schedule pings and enclosures when a post is published.
    76777677 *
    7678  * Uses XMLRPC_REQUEST and WP_IMPORTING constants.
     7678 * Uses WP_IMPORTING constants.
    76797679 *
    76807680 * @since 2.3.0
    76817681 * @access private
     
    76837683 * @param int $post_id The ID of the post being published.
    76847684 */
    76857685function _publish_post_hook( $post_id ) {
    7686         if ( defined( 'XMLRPC_REQUEST' ) ) {
     7686        if ( wp_doing_xmlrpc() ) {
    76877687                /**
    76887688                 * Fires when _publish_post_hook() is called during an XML-RPC request.
    76897689                 *
  • wp-includes/user.php

     
    352352        }
    353353
    354354        // The 'REST_REQUEST' check here may happen too early for the constant to be available.
    355         $is_api_request = ( ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) );
     355        $is_api_request = ( wp_doing_xmlrpc() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) );
    356356
    357357        /**
    358358         * Filters whether this is an API request that Application Passwords can be used on.
     
    36543654                return $current_user;
    36553655        }
    36563656
    3657         if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
     3657        if ( wp_doing_xmlrpc() ) {
    36583658                wp_set_current_user( 0 );
    36593659                return $current_user;
    36603660        }