WordPress.org

Make WordPress Core

Ticket #12400: wp-ajax.diff

File wp-ajax.diff, 944 bytes (added by Denis-de-Bernardy, 8 years ago)

wp-ajax.php file

  • wp-ajax.php

     
     1<?php
     2/**
     3 * Executing AJAX process.
     4 *
     5 * @since 3.0
     6 */
     7
     8define('DOING_AJAX', true);
     9define('WP_ADMIN', false);
     10define('ABSPATH', dirname(__FILE__) . '/');
     11
     12require_once(ABSPATH . 'wp-load.php');
     13require_once(ABSPATH . 'includes/admin.php'); // ensure backwards compat
     14
     15@header('Content-Type: text/html; charset=' . get_option('blog_charset'));
     16
     17do_action('ajax_init');
     18
     19if ( !empty($_REQUEST['action']) ) {
     20        if ( ! is_user_logged_in() ) {
     21                do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] );
     22                die('-1');
     23        } else {
     24                do_action( 'wp_ajax_' . $_REQUEST['action'] );
     25                die('0');
     26        }
     27}
     28?>
     29 No newline at end of file