PluginProbe
OttoKit: All-in-One Automation Platform / 1.1.38
OttoKit: All-in-One Automation Platform v1.1.38
1.1.38 1.1.37 1.1.36 1.1.35 1.1.34 1.1.33 1.1.32 1.1.31 1.1.30 1.1.29 1.1.28 1.1.27 1.1.9 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 All 124 releases
suretriggers / src / Integrations / fluentcommunity / triggers / course-updated.php
course-updated.php
86 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * CourseUpdated.
4 * php version 5.6
5 *
6 * @category CourseUpdated
7 * @package SureTriggers
8 * @author BSF
9 * @license https://www.gnu.org/licenses/gpl-3.0.html GPLv3
10 * @link https://www.brainstormforce.com/
11 * @since 1.0.0
12 */
13
14 namespace SureTriggers\Integrations\FluentCommunity\Triggers;
15
16 use SureTriggers\Controllers\AutomationController;
17 use SureTriggers\Traits\SingletonLoader;
18
19 if ( ! class_exists( 'CourseUpdated' ) ) :
20
21 /**
22 * CourseUpdated
23 *
24 * @category CourseUpdated
25 * @package SureTriggers
26 * @since 1.0.0
27 */
28 class CourseUpdated {
29
30 /**
31 * Integration type.
32 *
33 * @var string
34 */
35 public $integration = 'FluentCommunity';
36
37 /**
38 * Trigger name.
39 *
40 * @var string
41 */
42 public $trigger = 'fc_course_updated';
43
44 use SingletonLoader;
45
46 /**
47 * Constructor
48 *
49 * @since 1.0.0
50 */
51 public function __construct() {
52 add_action( 'fluent_community/course/updated', [ $this, 'trigger_listener' ], 10, 2 );
53 }
54
55 /**
56 * Trigger listener.
57 *
58 * @param object $course The newly created course object.
59 * @param object $update_data The updated course object.
60 * @return void
61 */
62 public function trigger_listener( $course, $update_data ) {
63
64 if ( empty( $course ) || empty( $update_data ) ) {
65 return;
66 }
67
68 // Prepare context with the course object.
69 $context = [
70 'course' => $course,
71 ];
72
73 AutomationController::sure_trigger_handle_trigger(
74 [
75 'trigger' => $this->trigger,
76 'context' => $context,
77 ]
78 );
79 }
80 }
81
82 // Initialize the class.
83 CourseUpdated::get_instance();
84
85 endif;
86