DispatchPoints.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. class NF_AJAX_Controllers_DispatchPoints
  3. {
  4. /*
  5. * Constructor method
  6. */
  7. public function __construct()
  8. {
  9. // Add out ajax end points.
  10. add_action( 'wp_ajax_nf_undo_click', array( $this, 'undo_click' ) );
  11. add_action( 'wp_ajax_nf_form_telemetry', array( $this, 'form_telemetry' ) );
  12. }
  13. /*
  14. * Function called when the undo manager is used in the builder.
  15. *
  16. * @since 3.2
  17. */
  18. public function undo_click() {
  19. // Make sure we have a valid nonce.
  20. check_ajax_referer( 'ninja_forms_builder_nonce', 'security' );
  21. // Send the action to our dispatcher.
  22. Ninja_Forms()->dispatcher()->send( 'undo_click' );
  23. // Exit.
  24. die( 1 );
  25. }
  26. /*
  27. * Function to startup our form data telemtry.
  28. *
  29. * @since 3.2
  30. */
  31. public function form_telemetry() {
  32. // Make sure we have a valid nonce.
  33. check_ajax_referer( 'ninja_forms_dashboard_nonce', 'security' );
  34. // Send the action to our dispatcher.
  35. Ninja_Forms()->dispatcher()->form_data();
  36. // Exit.
  37. die( 1 );
  38. }
  39. }