/wp-admin/admin-post.php

  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. if ( ! defined( 'WP_ADMIN' ) ) { 
  13. define( 'WP_ADMIN', true ); 
  14.  
  15. if ( defined('ABSPATH') ) 
  16. require_once(ABSPATH . 'wp-load.php'); 
  17. else 
  18. require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); 
  19.  
  20. /** Allow for cross-domain requests (from the front end). */ 
  21. send_origin_headers(); 
  22.  
  23. require_once(ABSPATH . 'wp-admin/includes/admin.php'); 
  24.  
  25. nocache_headers(); 
  26.  
  27. /** This action is documented in wp-admin/admin.php */ 
  28. do_action( 'admin_init' ); 
  29.  
  30. $action = empty( $_REQUEST['action'] ) ? '' : $_REQUEST['action']; 
  31.  
  32. if ( ! wp_validate_auth_cookie() ) { 
  33. if ( empty( $action ) ) { 
  34. /** 
  35. * Fires on a non-authenticated admin post request where no action was supplied. 
  36. * 
  37. * @since 2.6.0 
  38. */ 
  39. do_action( 'admin_post_nopriv' ); 
  40. } else { 
  41. /** 
  42. * Fires on a non-authenticated admin post request for the given action. 
  43. * 
  44. * The dynamic portion of the hook name, `$action`, refers to the given 
  45. * request action. 
  46. * 
  47. * @since 2.6.0 
  48. */ 
  49. do_action( "admin_post_nopriv_{$action}" ); 
  50. } else { 
  51. if ( empty( $action ) ) { 
  52. /** 
  53. * Fires on an authenticated admin post request where no action was supplied. 
  54. * 
  55. * @since 2.6.0 
  56. */ 
  57. do_action( 'admin_post' ); 
  58. } else { 
  59. /** 
  60. * Fires on an authenticated admin post request for the given action. 
  61. * 
  62. * The dynamic portion of the hook name, `$action`, refers to the given 
  63. * request action. 
  64. * 
  65. * @since 2.6.0 
  66. */ 
  67. do_action( "admin_post_{$action}" ); 
.