Custom.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. /**
  3. * Class NF_Action_Custom
  4. */
  5. final class NF_Actions_Custom extends NF_Abstracts_Action
  6. {
  7. /**
  8. * @var string
  9. */
  10. protected $_name = 'custom';
  11. /**
  12. * @var array
  13. */
  14. protected $_tags = array();
  15. /**
  16. * @var string
  17. */
  18. protected $_timing = 'normal';
  19. /**
  20. * @var int
  21. */
  22. protected $_priority = 10;
  23. /**
  24. * Constructor
  25. */
  26. public function __construct()
  27. {
  28. parent::__construct();
  29. $this->_nicename = __( 'WP Hook', 'ninja-forms' );
  30. $settings = Ninja_Forms::config( 'ActionCustomSettings' );
  31. $this->_settings = array_merge( $this->_settings, $settings );
  32. }
  33. /*
  34. * PUBLIC METHODS
  35. */
  36. public function save( $action_settings )
  37. {
  38. }
  39. public function process( $action_settings, $form_id, $data )
  40. {
  41. if( isset( $action_settings[ 'tag' ] ) ) {
  42. ob_start(); // Use the Output Buffer to suppress output
  43. do_action($action_settings[ 'tag' ], $data);
  44. ob_end_clean();
  45. }
  46. return $data;
  47. }
  48. }