wp/wp-admin/admin-post.php
changeset 0 d970ebf37754
child 5 5e2f62d02dcd
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     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 */
       
    12 define('WP_ADMIN', true);
       
    13 
       
    14 if ( defined('ABSPATH') )
       
    15 	require_once(ABSPATH . 'wp-load.php');
       
    16 else
       
    17 	require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
       
    18 
       
    19 /** Allow for cross-domain requests (from the frontend). */
       
    20 send_origin_headers();
       
    21 
       
    22 require_once(ABSPATH . 'wp-admin/includes/admin.php');
       
    23 
       
    24 nocache_headers();
       
    25 
       
    26 /** This action is documented in wp-admin/admin.php */
       
    27 do_action( 'admin_init' );
       
    28 
       
    29 $action = 'admin_post';
       
    30 
       
    31 if ( !wp_validate_auth_cookie() )
       
    32 	$action .= '_nopriv';
       
    33 
       
    34 if ( !empty($_REQUEST['action']) )
       
    35 	$action .= '_' . $_REQUEST['action'];
       
    36 
       
    37 /**
       
    38  * Fires the requested handler action.
       
    39  *
       
    40  * admin_post_nopriv_{$_REQUEST['action']} is called for not-logged-in users.
       
    41  * admin_post_{$_REQUEST['action']} is called for logged-in users.
       
    42  *
       
    43  * @since 2.6.0
       
    44  */
       
    45 do_action( $action );