WordPress.org

Make WordPress Core

Ticket #22589: 22589.3.diff

File 22589.3.diff, 2.7 KB (added by jeremyfelt, 4 years ago)
  • src/wp-admin/admin-header.php

     
    7272<script type="text/javascript">
    7373addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    7474var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
     75<?php if ( is_network_admin() ) : ?>
     76        networkajaxurl = '<?php echo network_admin_url( 'admin-ajax.php', 'relative' ); ?>',
     77<?php endif; ?>
    7578        pagenow = '<?php echo $current_screen->id; ?>',
    7679        typenow = '<?php echo $current_screen->post_type; ?>',
    7780        adminpage = '<?php echo $admin_body_class; ?>',
  • src/wp-admin/network/admin-ajax.php

     
     1<?php
     2/**
     3 * WordPress Network AJAX Process Execution.
     4 *
     5 * @package WordPress
     6 * @subpackage Multisite
     7 *
     8 * @link https://codex.wordpress.org/AJAX_in_Plugins
     9 */
     10
     11/**
     12 * Executing network AJAX process.
     13 *
     14 * @since 4.6.0
     15 */
     16define( 'DOING_AJAX', true );
     17if ( ! defined( 'WP_NETWORK_ADMIN' ) ) {
     18        define( 'WP_NETWORK_ADMIN', true );
     19}
     20
     21// Load WordPress Bootstrap.
     22require_once( dirname( dirname( dirname( __FILE__ ) ) ) . '/wp-load.php' );
     23
     24// Allow for cross-domain requests (from the front end).
     25send_origin_headers();
     26
     27if ( ! is_multisite() ) {
     28        die( '0' );
     29}
     30
     31// Require an action parameter.
     32if ( empty( $_REQUEST['action'] ) ) {
     33        die( '0' );
     34}
     35
     36// Load WordPress Administration APIs.
     37require_once( ABSPATH . 'wp-admin/includes/admin.php' );
     38
     39@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
     40@header( 'X-Robots-Tag: noindex' );
     41
     42send_nosniff_header();
     43nocache_headers();
     44
     45/** This action is documented in wp-admin/admin.php */
     46do_action( 'admin_init' );
     47
     48if ( is_user_logged_in() ) {
     49        /**
     50         * Fires authenticated network AJAX actions for logged-in users.
     51         *
     52         * The dynamic portion of the hook name, `$_REQUEST['action']`,
     53         * refers to the name of the AJAX action callback being fired.
     54         *
     55         * @since 4.6.0
     56         */
     57        do_action( 'wp_network_ajax_' . $_REQUEST['action'] );
     58} else {
     59        /**
     60         * Fires non-authenticated network AJAX actions for logged-out users.
     61         *
     62         * The dynamic portion of the hook name, `$_REQUEST['action']`,
     63         * refers to the name of the AJAX action callback being fired.
     64         *
     65         * @since 4.6.0
     66         */
     67        do_action( 'wp_network_ajax_nopriv_' . $_REQUEST['action'] );
     68}
     69// Default status.
     70die( '0' );