actions.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. /**
  3. * Front-end Actions
  4. *
  5. * @package Ninja Forms
  6. * @subpackage Functions
  7. * @copyright Copyright (c) 2014, WP Ninjas
  8. * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
  9. * @since 2.7
  10. */
  11. // Exit if accessed directly
  12. if ( ! defined( 'ABSPATH' ) ) exit;
  13. /**
  14. * Hooks NF actions, when present in the $_GET superglobal. Every nf_action
  15. * present in $_GET is called using WordPress's do_action function. These
  16. * functions are called on init.
  17. *
  18. * @since 2.7
  19. * @return void
  20. */
  21. function nf_get_actions() {
  22. if ( isset( $_GET['nf_action'] ) ) {
  23. do_action( 'nf_' . $_GET['nf_action'], $_GET );
  24. }
  25. }
  26. add_action( 'init', 'nf_get_actions', 999 );
  27. /**
  28. * Hooks NF actions, when present in the $_POST superglobal. Every nf_action
  29. * present in $_POST is called using WordPress's do_action function. These
  30. * functions are called on init.
  31. *
  32. * @since 2.7
  33. * @return void
  34. */
  35. function nf_post_actions() {
  36. if ( isset( $_POST['nf_action'] ) ) {
  37. do_action( 'nf_' . $_POST['nf_action'], $_POST );
  38. }
  39. }
  40. add_action( 'init', 'nf_post_actions', 999 );