mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Strip down admin-ajax.php to be a bare ajax handler. Move core ajax handlers to admin/includes/ajax-actions.php. props kurtpayne, ryan. see #15327. see [19738] for initial commit.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
61abfcd3c7
commit
ba2c3e345e
@ -4,6 +4,8 @@
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Administration
|
||||
*
|
||||
* @link http://codex.wordpress.org/AJAX_in_Plugins
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -18,10 +20,14 @@ define( 'WP_ADMIN', true );
|
||||
if ( empty( $_REQUEST['action'] ) )
|
||||
die( '-1' );
|
||||
|
||||
// Load libraries
|
||||
require_once('../wp-load.php');
|
||||
require_once('./includes/admin.php');
|
||||
require_once('./includes/ajax-actions.php');
|
||||
/** Load WordPress Bootstrap */
|
||||
require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
|
||||
|
||||
/** Load WordPress Administration APIs */
|
||||
require_once( ABSPATH . 'wp-admin/includes/admin.php' );
|
||||
|
||||
/** Load Ajax Handlers for WordPress Core */
|
||||
require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
|
||||
|
||||
@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
|
||||
send_nosniff_header();
|
||||
@ -42,6 +48,7 @@ $core_actions_post = array(
|
||||
'wp-remove-post-lock', 'dismiss-wp-pointer',
|
||||
);
|
||||
|
||||
// Register core Ajax calls.
|
||||
if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) )
|
||||
add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user