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 */
|
2014-05-18 16:42:16 -04:00
|
|
|
if ( ! defined( 'WP_ADMIN' ) ) {
|
|
|
|
define( 'WP_ADMIN', true );
|
|
|
|
}
|
2008-07-11 16:24:35 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( defined( 'ABSPATH' ) ) {
|
|
|
|
require_once( ABSPATH . 'wp-load.php' );
|
|
|
|
} else {
|
2013-09-24 20:18:11 -04:00
|
|
|
require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2008-07-11 16:24:35 -04:00
|
|
|
|
2016-02-25 07:53:27 -05:00
|
|
|
/** Allow for cross-domain requests (from the front end). */
|
2013-08-16 15:59:08 -04:00
|
|
|
send_origin_headers();
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
require_once( ABSPATH . 'wp-admin/includes/admin.php' );
|
2008-07-11 16:24:35 -04:00
|
|
|
|
|
|
|
nocache_headers();
|
|
|
|
|
2013-10-24 18:59:20 -04:00
|
|
|
/** This action is documented in wp-admin/admin.php */
|
2013-09-23 19:48:09 -04:00
|
|
|
do_action( 'admin_init' );
|
2008-07-11 16:24:35 -04:00
|
|
|
|
2015-09-17 08:33:26 -04:00
|
|
|
$action = empty( $_REQUEST['action'] ) ? '' : $_REQUEST['action'];
|
2014-05-08 06:47:15 -04:00
|
|
|
|
2019-01-16 00:41:50 -05:00
|
|
|
if ( ! is_user_logged_in() ) {
|
2014-05-13 03:24:15 -04:00
|
|
|
if ( empty( $action ) ) {
|
|
|
|
/**
|
2018-12-19 02:42:49 -05:00
|
|
|
* Fires on a non-authenticated admin post request where no action is supplied.
|
2014-05-13 03:24:15 -04:00
|
|
|
*
|
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
do_action( 'admin_post_nopriv' );
|
|
|
|
} else {
|
|
|
|
/**
|
|
|
|
* Fires on a non-authenticated admin post request for the given action.
|
|
|
|
*
|
2014-11-30 06:42:24 -05:00
|
|
|
* The dynamic portion of the hook name, `$action`, refers to the given
|
2014-05-13 03:24:15 -04:00
|
|
|
* request action.
|
|
|
|
*
|
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
do_action( "admin_post_nopriv_{$action}" );
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ( empty( $action ) ) {
|
|
|
|
/**
|
2018-12-19 02:42:49 -05:00
|
|
|
* Fires on an authenticated admin post request where no action is supplied.
|
2014-05-13 03:24:15 -04:00
|
|
|
*
|
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
do_action( 'admin_post' );
|
|
|
|
} else {
|
|
|
|
/**
|
|
|
|
* Fires on an authenticated admin post request for the given action.
|
|
|
|
*
|
2014-11-30 06:42:24 -05:00
|
|
|
* The dynamic portion of the hook name, `$action`, refers to the given
|
2014-05-13 03:24:15 -04:00
|
|
|
* request action.
|
|
|
|
*
|
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
do_action( "admin_post_{$action}" );
|
|
|
|
}
|
|
|
|
}
|