0
|
1 |
<?php |
|
2 |
/** |
|
3 |
* WordPress Generic Request (POST/GET) Handler |
|
4 |
* |
|
5 |
* Intended for form submission handling in themes and plugins. |
|
6 |
* |
|
7 |
* @package WordPress |
|
8 |
* @subpackage Administration |
|
9 |
*/ |
|
10 |
|
|
11 |
/** We are located in WordPress Administration Screens */ |
5
|
12 |
if ( ! defined( 'WP_ADMIN' ) ) { |
|
13 |
define( 'WP_ADMIN', true ); |
|
14 |
} |
0
|
15 |
|
|
16 |
if ( defined('ABSPATH') ) |
|
17 |
require_once(ABSPATH . 'wp-load.php'); |
|
18 |
else |
|
19 |
require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); |
|
20 |
|
|
21 |
/** Allow for cross-domain requests (from the frontend). */ |
|
22 |
send_origin_headers(); |
|
23 |
|
|
24 |
require_once(ABSPATH . 'wp-admin/includes/admin.php'); |
|
25 |
|
|
26 |
nocache_headers(); |
|
27 |
|
|
28 |
/** This action is documented in wp-admin/admin.php */ |
|
29 |
do_action( 'admin_init' ); |
|
30 |
|
5
|
31 |
$action = empty( $_REQUEST['action'] ) ? '' : $_REQUEST['action']; |
0
|
32 |
|
5
|
33 |
if ( ! wp_validate_auth_cookie() ) { |
|
34 |
if ( empty( $action ) ) { |
|
35 |
/** |
|
36 |
* Fires on a non-authenticated admin post request where no action was supplied. |
|
37 |
* |
|
38 |
* @since 2.6.0 |
|
39 |
*/ |
|
40 |
do_action( 'admin_post_nopriv' ); |
|
41 |
} else { |
|
42 |
/** |
|
43 |
* Fires on a non-authenticated admin post request for the given action. |
|
44 |
* |
|
45 |
* The dynamic portion of the hook name, `$action`, refers to the given |
|
46 |
* request action. |
|
47 |
* |
|
48 |
* @since 2.6.0 |
|
49 |
*/ |
|
50 |
do_action( "admin_post_nopriv_{$action}" ); |
|
51 |
} |
|
52 |
} else { |
|
53 |
if ( empty( $action ) ) { |
|
54 |
/** |
|
55 |
* Fires on an authenticated admin post request where no action was supplied. |
|
56 |
* |
|
57 |
* @since 2.6.0 |
|
58 |
*/ |
|
59 |
do_action( 'admin_post' ); |
|
60 |
} else { |
|
61 |
/** |
|
62 |
* Fires on an authenticated admin post request for the given action. |
|
63 |
* |
|
64 |
* The dynamic portion of the hook name, `$action`, refers to the given |
|
65 |
* request action. |
|
66 |
* |
|
67 |
* @since 2.6.0 |
|
68 |
*/ |
|
69 |
do_action( "admin_post_{$action}" ); |
|
70 |
} |
|
71 |
} |