PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 5.8.5
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v5.8.5
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
automatorwp / classes / integration-action.php

integration-action.php in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 5.8.5, at classes/integration-action.php

122 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Integration Action
4 *
5 * @package AutomatorWP\Classes\Integration_Action
6 * @author AutomatorWP <[email protected]>, Ruben Garcia <[email protected]>
7 * @since 1.0.0
8 */
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 class AutomatorWP_Integration_Action {
13
14 /**
15 * Integration
16 *
17 * @since 1.0.0
18 *
19 * @var string $integration
20 */
21 public $integration = '';
22
23 /**
24 * Trigger
25 *
26 * @since 1.0.0
27 *
28 * @var string $action
29 */
30 public $action = '';
31
32 /**
33 * Filter result
34 *
35 * @since 1.0.0
36 *
37 * @var string $result
38 */
39 public $result = '';
40
41 public function __construct() {
42
43 $this->hooks();
44
45 }
46
47 /**
48 * Register required hooks
49 *
50 * @since 1.0.0
51 */
52 public function hooks() {
53
54 if ( ! did_action( 'automatorwp_init' ) ) {
55 // Default hook to register
56 add_action('automatorwp_init', array( $this, 'register' ) );
57 add_action('init', array( $this, 'register_labels' ) );
58 } else {
59 // Hook for triggers registered from the theme's functions
60 add_action( 'after_setup_theme', array( $this, 'register' ) );
61 }
62
63 // Execute action hook
64 add_action( 'automatorwp_execute_action', array( $this, 'maybe_execute' ), 10, 5 );
65
66 }
67
68 /**
69 * Register the action
70 *
71 * @since 1.0.0
72 */
73 public function register() {
74 // Override
75 }
76
77 /**
78 * Register again to update labels (due to textdomain init requirement)
79 *
80 * @since 1.0.0
81 */
82 public function register_labels() {
83 $this->register();
84 }
85
86 /**
87 * Checks if maybe should call or not to the execute() function
88 *
89 * @since 1.0.0
90 *
91 * @param stdClass $action The action object
92 * @param int $user_id The user ID
93 * @param array $event Event information
94 * @param array $action_options The action's stored options (with tags already passed)
95 * @param stdClass $automation The action's automation object
96 */
97 public function maybe_execute( $action, $user_id, $event, $action_options, $automation ) {
98
99 // Bail if action type don't match this action
100 if( $action->type !== $this->action ) {
101 return;
102 }
103
104 $this->execute( $action, $user_id, $action_options, $automation );
105
106 }
107
108 /**
109 * Action execution function
110 *
111 * @since 1.0.0
112 *
113 * @param stdClass $action The action object
114 * @param int $user_id The user ID
115 * @param array $action_options The action's stored options (with tags already passed)
116 * @param stdClass $automation The action's automation object
117 */
118 public function execute( $action, $user_id, $action_options, $automation ) {
119 // Override
120 }
121
122 }