Sin descripción

admin-post.php 1.6KB

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