PluginProbe
Yatra – Travel Booking & Tour Operator Software / 2.1.16
Yatra – Travel Booking & Tour Operator Software v2.1.16
3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 All 83 releases
yatra / core / Hooks / EmailHooks.php

EmailHooks.php in Yatra – Travel Booking & Tour Operator Software 2.1.16, at core/Hooks/EmailHooks.php

65 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yatra\Core\Hooks;
4
5 use Yatra\Core\Admin\Emails\AdminEmail;
6 use Yatra\Core\Admin\Emails\CustomerEmail;
7
8 class EmailHooks
9 {
10
11 public static function init()
12 {
13 $self = new self;
14
15 add_action('init', array($self, 'preview_email'));
16
17 }
18
19 public function preview_email()
20 {
21 if (!current_user_can('manage_yatra')) {
22 return;
23 }
24
25 $preview_action = isset($_GET['action']) ? sanitize_text_field($_GET['action']) : '';
26
27 $type = isset($_GET['email_type']) ? sanitize_text_field($_GET['email_type']) : '';
28
29 $to = isset($_GET['email_to']) ? sanitize_text_field($_GET['email_to']) : '';
30
31 if ($preview_action != 'yatra-email-preview' || $type === '' || $to === '') {
32 return;
33 }
34 $valid_to_array = array('admin', 'customer');
35
36 $valid_type_array = array('booking', 'booking_status_change', 'enquiry');
37
38 if (!in_array($to, $valid_to_array, true) || !in_array($type, $valid_type_array, true)) {
39 return;
40 }
41
42 if ($type === "booking" && $to === "admin") {
43
44 echo AdminEmail::get_booking_completed_message();
45
46 } else if ($type === "booking" && $to === "customer") {
47
48 echo CustomerEmail::get_booking_completed_message();
49
50 } else if ($type === "booking_status_change" && $to === "admin") {
51
52 echo AdminEmail::get_booking_status_change_message();
53
54 } else if ($type === "booking_status_change" && $to === "customer") {
55
56 echo CustomerEmail::get_booking_status_change_message();
57
58 } else if ($type === 'enquiry' && $to === 'admin') {
59
60 echo AdminEmail::get_enquiry_form_saved_message();
61 }
62
63 exit;
64 }
65 }