PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.7.7
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.7.7
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 8.5.5 8.5.4 8.5.3 8.5.2 All 533 releases
chatbot / addons / automator / includes / triggers / trigger.php

trigger.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 8.7.7, at addons/automator/includes/triggers/trigger.php

81 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Abstract Trigger Class
4 *
5 * @package WPbot_Automator
6 */
7
8 namespace WPbot_Automator\Triggers;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 /**
15 * Abstract Class Trigger
16 */
17 abstract class Trigger {
18
19 /**
20 * Trigger ID
21 *
22 * @var string
23 */
24 protected $id;
25
26 /**
27 * Trigger Title
28 *
29 * @var string
30 */
31 protected $title;
32
33 /**
34 * Trigger Group (e.g., 'WordPress', 'WooCommerce')
35 *
36 * @var string
37 */
38 protected $group;
39
40 /**
41 * Get Trigger ID
42 */
43 public function get_id() {
44 return $this->id;
45 }
46
47 /**
48 * Get Trigger Title
49 */
50 public function get_title() {
51 return $this->title;
52 }
53
54 /**
55 * Get Trigger Group
56 */
57 public function get_group() {
58 return $this->group;
59 }
60
61 /**
62 * Register the trigger (hooks)
63 */
64 abstract public function register();
65
66 /**
67 * Process the trigger execution
68 *
69 * @param array $data Data passed from the hook.
70 */
71 protected function run( $data = array() ) {
72 // This will call the Workflow Engine to find and run matching workflows.
73 $full_trigger_id = $this->id;
74 if ( isset( $data['sub_id'] ) ) {
75 $full_trigger_id .= ':' . $data['sub_id'];
76 }
77
78 \WPbot_Automator\Engine\Workflow_Runner::run_workflows_for_trigger( $full_trigger_id, $data['data'] );
79 }
80 }
81