PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.8.1
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.8.1
8.8.1 8.8.0 8.7.9 8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 All 537 releases
← All changes | addons/automator/includes/core/registry.php +210 -210 8.7.9 → 8.8.1 View file →
@@ -1,210 +1,210 @@
1 -<?php
2 -/**
3 - * Registry for Triggers and Actions
4 - *
5 - * @package WPbot_Automator
6 - */
7 -
8 -namespace WPbot_Automator\Core;
9 -
10 -if (!defined('ABSPATH')) {
11 - exit;
12 -}
13 -
14 -/**
15 - * Registry class
16 - */
17 -class Registry
18 -{
19 -
20 - /**
21 - * Registered Triggers
22 - *
23 - * @var array
24 - */
25 - private static $triggers = array();
26 -
27 - /**
28 - * Registered Actions
29 - *
30 - * @var array
31 - */
32 - private static $actions = array();
33 -
34 - /**
35 - * Register a Trigger
36 - *
37 - * @param \WPbot_Automator\Triggers\Trigger $trigger Trigger instance.
38 - */
39 - public static function register_trigger($trigger)
40 - {
41 - self::$triggers[$trigger->get_id()] = $trigger;
42 - $trigger->register();
43 - }
44 -
45 - /**
46 - * Register an Action
47 - *
48 - * @param \WPbot_Automator\Actions\Action $action Action instance.
49 - */
50 - public static function register_action($action)
51 - {
52 - self::$actions[$action->get_id()] = $action;
53 - }
54 -
55 - /**
56 - * Get all Triggers
57 - *
58 - * @return array
59 - */
60 - public static function get_triggers()
61 - {
62 - return self::$triggers;
63 - }
64 -
65 - /**
66 - * Get all Actions
67 - *
68 - * @return array
69 - */
70 - public static function get_actions()
71 - {
72 - return self::$actions;
73 - }
74 -
75 - /**
76 - * Get Trigger by ID
77 - *
78 - * @param string $id Trigger ID.
79 - * @return \WPbot_Automator\Triggers\Trigger|null
80 - */
81 - public static function get_trigger($id)
82 - {
83 - return isset(self::$triggers[$id]) ? self::$triggers[$id] : null;
84 - }
85 -
86 - /**
87 - * Get Action by ID
88 - *
89 - * @param string $id Action ID.
90 - * @return \WPbot_Automator\Actions\Action|null
91 - */
92 - public static function get_action($id)
93 - {
94 - return isset(self::$actions[$id]) ? self::$actions[$id] : null;
95 - }
96 -
97 - /**
98 - * Initialize and register default triggers and actions
99 - */
100 - public static function init()
101 - {
102 - global $wpdb;
103 - //error_log( 'WPbot Automator - Registry::init() starting.' );
104 - //error_log( 'WPbot Automator - DB_NAME: ' . (defined('DB_NAME') ? DB_NAME : 'NOT DEFINED') );
105 - //error_log( 'WPbot Automator - DB_HOST: ' . (defined('DB_HOST') ? DB_HOST : 'NOT DEFINED') );
106 - //error_log( 'WPbot Automator - Table Prefix: ' . $wpdb->prefix );
107 -
108 - // Ensure database tables are created.
109 - $table_templates = Database::get_email_templates_table();
110 - if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$table_templates'" ) ) {
111 - //error_log( 'WPbot Automator - Email Templates table missing. Running Database::install().' );
112 - Database::install();
113 - }
114 - Database::maybe_upgrade();
115 -
116 - //error_log('WPbot Automator - Registry::init() starting.');
117 - //error_log('WPbot Automator - DB_NAME: ' . (defined('DB_NAME') ? DB_NAME : 'NOT DEFINED'));
118 - //error_log('WPbot Automator - DB_HOST: ' . (defined('DB_HOST') ? DB_HOST : 'NOT DEFINED'));
119 - //error_log('WPbot Automator - Table Prefix: ' . $wpdb->prefix);
120 -
121 - // Register WP Core Triggers.
122 - self::register_trigger(new \WPbot_Automator\Triggers\WordPress_Core());
123 - //error_log('WPbot Automator - WordPress_Core registered.');
124 -
125 - // Register WooCommerce Triggers.
126 - self::register_trigger(new \WPbot_Automator\Triggers\WooCommerce_Triggers());
127 - //error_log('WPbot Automator - WooCommerce_Triggers registered.');
128 -
129 - // Register Form Triggers.
130 - self::register_trigger(new \WPbot_Automator\Triggers\Form_Triggers());
131 - self::register_trigger(new \WPbot_Automator\Triggers\CF7_Triggers());
132 - self::register_trigger(new \WPbot_Automator\Triggers\Workflow_Triggers());
133 - //error_log('WPbot Automator - Form_Triggers registered.');
134 -
135 - // Register Webhook Trigger.
136 - self::register_trigger(new \WPbot_Automator\Triggers\Webhook());
137 - //error_log('WPbot Automator - Webhook registered.');
138 -
139 - // Register Facebook Lead Ads Trigger.
140 - self::register_trigger(new \WPbot_Automator\Triggers\Facebook_Lead_Ads_Triggers());
141 - //error_log('WPbot Automator - Facebook_Lead_Ads_Triggers registered.');
142 -
143 - // Register Tables Triggers.
144 - self::register_trigger(new \WPbot_Automator\Triggers\Tables_Triggers());
145 - //error_log('WPbot Automator - Tables_Triggers registered.');
146 -
147 - // Register WPBot Triggers.
148 - self::register_trigger(new \WPbot_Automator\Triggers\WPBot_Triggers());
149 - //error_log('WPbot Automator - WPBot_Triggers registered.');
150 -
151 - // Register Basic Actions.
152 - self::register_action(new \WPbot_Automator\Actions\Email_Actions());
153 - self::register_action(new \WPbot_Automator\Actions\Log());
154 - self::register_action(new \WPbot_Automator\Actions\WordPress_Actions());
155 - self::register_action(new \WPbot_Automator\Actions\WooCommerce_Actions());
156 - self::register_action(new \WPbot_Automator\Actions\Webhook_Actions());
157 - self::register_action(new \WPbot_Automator\Actions\API_Actions());
158 - self::register_action(new \WPbot_Automator\Actions\Google_Sheets_Actions());
159 - self::register_action(new \WPbot_Automator\Actions\MailboxLayer_Actions());
160 - self::register_action(new \WPbot_Automator\Actions\FluentCRM_Actions());
161 - self::register_action(new \WPbot_Automator\Actions\XML_Parser_Actions());
162 - self::register_action(new \WPbot_Automator\Actions\Text_Formatter_Actions());
163 - self::register_action(new \WPbot_Automator\Actions\Unit_Converter_Actions());
164 - self::register_action(new \WPbot_Automator\Actions\Workflow_Actions());
165 - self::register_action(new \WPbot_Automator\Actions\Filters_Actions());
166 - self::register_action(new \WPbot_Automator\Actions\WPBot_Actions());
167 - //error_log('WPbot Automator - Actions registered.');
168 -
169 - // Register Flow Control.
170 - self::register_action(new \WPbot_Automator\Actions\Iterator_Actions());
171 - self::register_action(new \WPbot_Automator\Actions\Delay_Actions());
172 -
173 -
174 - // Register Messaging Actions.
175 - self::register_action(new \WPbot_Automator\Actions\Telegram_Actions());
176 - self::register_action(new \WPbot_Automator\Actions\Facebook_Actions());
177 -
178 - // Register Tables Actions.
179 - self::register_action(new \WPbot_Automator\Actions\Tables_Actions());
180 - //error_log('WPbot Automator - Tables_Actions registered.');
181 -
182 - // Register CSV Creator Actions.
183 - self::register_action(new \WPbot_Automator\Actions\CSV_Creator_Actions());
184 - //error_log('WPbot Automator - CSV_Creator_Actions registered.');
185 -
186 - // Register AI Actions.
187 - self::register_action(new \WPbot_Automator\Actions\OpenAI_Actions());
188 - self::register_action(new \WPbot_Automator\Actions\Claude_Actions());
189 - self::register_action(new \WPbot_Automator\Actions\Gemini_Actions());
190 - self::register_action(new \WPbot_Automator\Actions\Mistral_Actions());
191 - self::register_action(new \WPbot_Automator\Actions\Groq_Actions());
192 - self::register_action(new \WPbot_Automator\Actions\Grok_Actions());
193 - self::register_action(new \WPbot_Automator\Actions\OpenRouter_Actions());
194 -
195 - // Diagnostic: Dump all workflows to log.
196 - \WPbot_Automator\Engine\Workflow_Runner::debug_dump_all_workflows();
197 -
198 - // TEMPORARY TEST TRIGGER for Workflow 16.
199 - if (defined('WPBOT_TEST_WF16') && WPBOT_TEST_WF16) {
200 - //error_log('WPbot Automator - FIRING TEST TRIGGER for Workflow 16');
201 - $fields = array(
202 - '1' => array('name' => 'Email', 'value' => '[email protected]', 'id' => 1, 'type' => 'email')
203 - );
204 - $form_data = array('id' => 37, 'settings' => array('form_title' => 'Test Form'));
205 - do_action('wpforms_process_complete', $fields, array(), $form_data, 12345);
206 - }
207 -
208 - //error_log('WPbot Automator - Registry::init() completed.');
209 - }
210 -}
1 +<?php
2 +/**
3 + * Registry for Triggers and Actions
4 + *
5 + * @package WPbot_Automator
6 + */
7 +
8 +namespace WPbot_Automator\Core;
9 +
10 +if (!defined('ABSPATH')) {
11 + exit;
12 +}
13 +
14 +/**
15 + * Registry class
16 + */
17 +class Registry
18 +{
19 +
20 + /**
21 + * Registered Triggers
22 + *
23 + * @var array
24 + */
25 + private static $triggers = array();
26 +
27 + /**
28 + * Registered Actions
29 + *
30 + * @var array
31 + */
32 + private static $actions = array();
33 +
34 + /**
35 + * Register a Trigger
36 + *
37 + * @param \WPbot_Automator\Triggers\Trigger $trigger Trigger instance.
38 + */
39 + public static function register_trigger($trigger)
40 + {
41 + self::$triggers[$trigger->get_id()] = $trigger;
42 + $trigger->register();
43 + }
44 +
45 + /**
46 + * Register an Action
47 + *
48 + * @param \WPbot_Automator\Actions\Action $action Action instance.
49 + */
50 + public static function register_action($action)
51 + {
52 + self::$actions[$action->get_id()] = $action;
53 + }
54 +
55 + /**
56 + * Get all Triggers
57 + *
58 + * @return array
59 + */
60 + public static function get_triggers()
61 + {
62 + return self::$triggers;
63 + }
64 +
65 + /**
66 + * Get all Actions
67 + *
68 + * @return array
69 + */
70 + public static function get_actions()
71 + {
72 + return self::$actions;
73 + }
74 +
75 + /**
76 + * Get Trigger by ID
77 + *
78 + * @param string $id Trigger ID.
79 + * @return \WPbot_Automator\Triggers\Trigger|null
80 + */
81 + public static function get_trigger($id)
82 + {
83 + return isset(self::$triggers[$id]) ? self::$triggers[$id] : null;
84 + }
85 +
86 + /**
87 + * Get Action by ID
88 + *
89 + * @param string $id Action ID.
90 + * @return \WPbot_Automator\Actions\Action|null
91 + */
92 + public static function get_action($id)
93 + {
94 + return isset(self::$actions[$id]) ? self::$actions[$id] : null;
95 + }
96 +
97 + /**
98 + * Initialize and register default triggers and actions
99 + */
100 + public static function init()
101 + {
102 + global $wpdb;
103 + //error_log( 'WPbot Automator - Registry::init() starting.' );
104 + //error_log( 'WPbot Automator - DB_NAME: ' . (defined('DB_NAME') ? DB_NAME : 'NOT DEFINED') );
105 + //error_log( 'WPbot Automator - DB_HOST: ' . (defined('DB_HOST') ? DB_HOST : 'NOT DEFINED') );
106 + //error_log( 'WPbot Automator - Table Prefix: ' . $wpdb->prefix );
107 +
108 + // Ensure database tables are created.
109 + $table_templates = Database::get_email_templates_table();
110 + if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$table_templates'" ) ) {
111 + //error_log( 'WPbot Automator - Email Templates table missing. Running Database::install().' );
112 + Database::install();
113 + }
114 + Database::maybe_upgrade();
115 +
116 + //error_log('WPbot Automator - Registry::init() starting.');
117 + //error_log('WPbot Automator - DB_NAME: ' . (defined('DB_NAME') ? DB_NAME : 'NOT DEFINED'));
118 + //error_log('WPbot Automator - DB_HOST: ' . (defined('DB_HOST') ? DB_HOST : 'NOT DEFINED'));
119 + //error_log('WPbot Automator - Table Prefix: ' . $wpdb->prefix);
120 +
121 + // Register WP Core Triggers.
122 + self::register_trigger(new \WPbot_Automator\Triggers\WordPress_Core());
123 + //error_log('WPbot Automator - WordPress_Core registered.');
124 +
125 + // Register WooCommerce Triggers.
126 + self::register_trigger(new \WPbot_Automator\Triggers\WooCommerce_Triggers());
127 + //error_log('WPbot Automator - WooCommerce_Triggers registered.');
128 +
129 + // Register Form Triggers.
130 + self::register_trigger(new \WPbot_Automator\Triggers\Form_Triggers());
131 + self::register_trigger(new \WPbot_Automator\Triggers\CF7_Triggers());
132 + self::register_trigger(new \WPbot_Automator\Triggers\Workflow_Triggers());
133 + //error_log('WPbot Automator - Form_Triggers registered.');
134 +
135 + // Register Webhook Trigger.
136 + self::register_trigger(new \WPbot_Automator\Triggers\Webhook());
137 + //error_log('WPbot Automator - Webhook registered.');
138 +
139 + // Register Facebook Lead Ads Trigger.
140 + self::register_trigger(new \WPbot_Automator\Triggers\Facebook_Lead_Ads_Triggers());
141 + //error_log('WPbot Automator - Facebook_Lead_Ads_Triggers registered.');
142 +
143 + // Register Tables Triggers.
144 + self::register_trigger(new \WPbot_Automator\Triggers\Tables_Triggers());
145 + //error_log('WPbot Automator - Tables_Triggers registered.');
146 +
147 + // Register WPBot Triggers.
148 + self::register_trigger(new \WPbot_Automator\Triggers\WPBot_Triggers());
149 + //error_log('WPbot Automator - WPBot_Triggers registered.');
150 +
151 + // Register Basic Actions.
152 + self::register_action(new \WPbot_Automator\Actions\Email_Actions());
153 + self::register_action(new \WPbot_Automator\Actions\Log());
154 + self::register_action(new \WPbot_Automator\Actions\WordPress_Actions());
155 + self::register_action(new \WPbot_Automator\Actions\WooCommerce_Actions());
156 + self::register_action(new \WPbot_Automator\Actions\Webhook_Actions());
157 + self::register_action(new \WPbot_Automator\Actions\API_Actions());
158 + self::register_action(new \WPbot_Automator\Actions\Google_Sheets_Actions());
159 + self::register_action(new \WPbot_Automator\Actions\MailboxLayer_Actions());
160 + self::register_action(new \WPbot_Automator\Actions\FluentCRM_Actions());
161 + self::register_action(new \WPbot_Automator\Actions\XML_Parser_Actions());
162 + self::register_action(new \WPbot_Automator\Actions\Text_Formatter_Actions());
163 + self::register_action(new \WPbot_Automator\Actions\Unit_Converter_Actions());
164 + self::register_action(new \WPbot_Automator\Actions\Workflow_Actions());
165 + self::register_action(new \WPbot_Automator\Actions\Filters_Actions());
166 + self::register_action(new \WPbot_Automator\Actions\WPBot_Actions());
167 + //error_log('WPbot Automator - Actions registered.');
168 +
169 + // Register Flow Control.
170 + self::register_action(new \WPbot_Automator\Actions\Iterator_Actions());
171 + self::register_action(new \WPbot_Automator\Actions\Delay_Actions());
172 +
173 +
174 + // Register Messaging Actions.
175 + self::register_action(new \WPbot_Automator\Actions\Telegram_Actions());
176 + self::register_action(new \WPbot_Automator\Actions\Facebook_Actions());
177 +
178 + // Register Tables Actions.
179 + self::register_action(new \WPbot_Automator\Actions\Tables_Actions());
180 + //error_log('WPbot Automator - Tables_Actions registered.');
181 +
182 + // Register CSV Creator Actions.
183 + self::register_action(new \WPbot_Automator\Actions\CSV_Creator_Actions());
184 + //error_log('WPbot Automator - CSV_Creator_Actions registered.');
185 +
186 + // Register AI Actions.
187 + self::register_action(new \WPbot_Automator\Actions\OpenAI_Actions());
188 + self::register_action(new \WPbot_Automator\Actions\Claude_Actions());
189 + self::register_action(new \WPbot_Automator\Actions\Gemini_Actions());
190 + self::register_action(new \WPbot_Automator\Actions\Mistral_Actions());
191 + self::register_action(new \WPbot_Automator\Actions\Groq_Actions());
192 + self::register_action(new \WPbot_Automator\Actions\Grok_Actions());
193 + self::register_action(new \WPbot_Automator\Actions\OpenRouter_Actions());
194 +
195 + // Diagnostic: Dump all workflows to log.
196 + \WPbot_Automator\Engine\Workflow_Runner::debug_dump_all_workflows();
197 +
198 + // TEMPORARY TEST TRIGGER for Workflow 16.
199 + if (defined('WPBOT_TEST_WF16') && WPBOT_TEST_WF16) {
200 + //error_log('WPbot Automator - FIRING TEST TRIGGER for Workflow 16');
201 + $fields = array(
202 + '1' => array('name' => 'Email', 'value' => '[email protected]', 'id' => 1, 'type' => 'email')
203 + );
204 + $form_data = array('id' => 37, 'settings' => array('form_title' => 'Test Form'));
205 + do_action('wpforms_process_complete', $fields, array(), $form_data, 12345);
206 + }
207 +
208 + //error_log('WPbot Automator - Registry::init() completed.');
209 + }
210 +}