2008-07-11 16:24:35 -04:00
|
|
|
<?php
|
2008-08-11 16:26:31 -04:00
|
|
|
/**
|
2013-09-22 01:18:09 -04:00
|
|
|
* WordPress Generic Request (POST/GET) Handler
|
|
|
|
*
|
|
|
|
* Intended for form submission handling in themes and plugins.
|
2008-08-11 16:26:31 -04:00
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Administration
|
|
|
|
*/
|
|
|
|
|
2011-04-28 11:24:49 -04:00
|
|
|
/** We are located in WordPress Administration Screens */
|
2008-08-11 16:26:31 -04:00
|
|
|
define('WP_ADMIN', true);
|
2008-07-11 16:24:35 -04:00
|
|
|
|
|
|
|
if ( defined('ABSPATH') )
|
|
|
|
require_once(ABSPATH . 'wp-load.php');
|
|
|
|
else
|
|
|
|
require_once('../wp-load.php');
|
|
|
|
|
2013-08-16 15:59:08 -04:00
|
|
|
/** Allow for cross-domain requests (from the frontend). */
|
|
|
|
send_origin_headers();
|
|
|
|
|
2008-07-11 16:24:35 -04:00
|
|
|
require_once(ABSPATH . 'wp-admin/includes/admin.php');
|
|
|
|
|
|
|
|
nocache_headers();
|
|
|
|
|
2013-09-23 19:48:09 -04:00
|
|
|
//duplicate_hook
|
|
|
|
do_action( 'admin_init' );
|
2008-07-11 16:24:35 -04:00
|
|
|
|
|
|
|
$action = 'admin_post';
|
2009-03-05 16:43:35 -05:00
|
|
|
|
|
|
|
if ( !wp_validate_auth_cookie() )
|
|
|
|
$action .= '_nopriv';
|
|
|
|
|
2008-07-11 16:24:35 -04:00
|
|
|
if ( !empty($_REQUEST['action']) )
|
|
|
|
$action .= '_' . $_REQUEST['action'];
|
|
|
|
|
2013-09-23 19:48:09 -04:00
|
|
|
/**
|
|
|
|
* Fires the requested handler action.
|
|
|
|
*
|
|
|
|
* admin_post_nopriv_{$_REQUEST['action']} is called for not-logged-in users.
|
|
|
|
* admin_post_{$_REQUEST['action']} is called for logged-in users.
|
|
|
|
*
|
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
do_action( $action );
|