Make WordPress Core

Ticket #25229: admin-ajax.diff

File admin-ajax.diff, 1.3 KB (added by nullvariable, 11 years ago)

inline documentation for admin-ajax.php.

  • wp-admin/admin-ajax.php

     
    3838send_nosniff_header();
    3939nocache_headers();
    4040
     41//duplicate_hook
     42//since @15632
     43//admin.php rev @1818
    4144do_action( 'admin_init' );
    4245
    4346$core_actions_get = array(
     
    6871
    6972add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );
    7073
    71 if ( is_user_logged_in() )
    72         do_action( 'wp_ajax_' . $_REQUEST['action'] ); // Authenticated actions
    73 else
    74         do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] ); // Non-admin actions
    75 
     74if ( is_user_logged_in() ) {
     75    /**
     76     * calls AJAX hooks for authenticated users
     77     *
     78     * wp_ajax_<my_action_here> is called with all authenticated ajax queries.
     79     * @link http://codex.wordpress.org/AJAX_in_Plugins
     80     *
     81     * @since 2.1
     82     */
     83    do_action( 'wp_ajax_' . $_REQUEST['action'] ); // Authenticated actions
     84} else {
     85    /**
     86     * calls AJAX hooks for non-authenticated users
     87     *
     88     * wp_ajax_nopriv_<my_action_here> is called for all non-authenticated queries
     89     * @link http://codex.wordpress.org/AJAX_in_Plugins
     90     *
     91     * @since 2.8
     92     */
     93    do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] ); // Non-admin actions
     94}
    7695// Default status
    7796die( '0' );