PluginProbe
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more / 1.1
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more v1.1
2.0.2 trunk 0.2 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 2.0.0 2.0.1
texty / includes / Dispatcher.php

Dispatcher.php in Texty – SMS Notification for WordPress, WooCommerce, Dokan and more 1.1, at includes/Dispatcher.php

57 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Texty;
4
5 use Texty\Integrations\Dokan;
6 use Texty\Integrations\WooCommerce;
7
8 /**
9 * Dispatcher Class
10 */
11 class Dispatcher {
12
13 /**
14 * Initialize
15 */
16 public function __construct() {
17
18 // WordPress Events
19 add_action( 'user_register', [ $this, 'user_register' ] );
20 add_action( 'comment_post', [ $this, 'new_comment' ] );
21
22 // WooCommerce
23 new WooCommerce();
24 new Dokan();
25 }
26
27 /**
28 * Send message upon user registration
29 *
30 * @param int $user_id
31 *
32 * @return void
33 */
34 public function user_register( $user_id ) {
35 $class = texty()->notifications()->get( 'registration' );
36 $notifier = new $class();
37
38 $notifier->set_user( $user_id );
39 $notifier->send();
40 }
41
42 /**
43 * Send message upon a new comment
44 *
45 * @param int $comment_id
46 *
47 * @return void
48 */
49 public function new_comment( $comment_id ) {
50 $class = texty()->notifications()->get( 'comment' );
51 $notifier = new $class();
52
53 $notifier->set_comment( $comment_id );
54 $notifier->send();
55 }
56 }
57