PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.6.4
VikBooking Hotel Booking Engine & PMS v1.6.4
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
vikbooking / libraries / html / feedback / thickbox.php

thickbox.php in VikBooking Hotel Booking Engine & PMS 1.6.4, at libraries/html/feedback/thickbox.php

305 lines 8.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package VikBooking - Libraries
4 * @subpackage html.feedback
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2018 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 $deactivate_url_js = !empty($displayData['url']) ? $displayData['url'] : '#';
15 $is_pro = isset($displayData['pro']) ? $displayData['pro'] : false;
16
17 $is_pro = false;
18
19 $plain_deactivation_url = JUri::getInstance();
20 $plain_deactivation_url->setVar('feedback', 0);
21
22 $doc_url = 'https://vikwp.com/support/documentation/vik-booking/';
23
24 $options = array();
25
26 $options[] = array(
27 'value' => '0',
28 'text' => __('No, thanks', 'vikbooking'),
29 'checked' => true,
30 );
31
32 $options[] = array(
33 'value' => 'The plugin is not working',
34 'text' => __('The plugin is not working', 'vikbooking'),
35 'notes' => true,
36 );
37
38 $options[] = array(
39 'value' => 'The plugin didn\'t work as expected',
40 'text' => __('The plugin didn\'t work as expected', 'vikbooking'),
41 'notes' => true,
42 );
43
44 if (!$is_pro)
45 {
46 $options[] = array(
47 'value' => 'The FREE version is too limited',
48 'text' => __('The FREE version is too limited', 'vikbooking'),
49 'notes' => array(
50 'required' => false,
51 'placeholder' => __('What features would you like to have?', 'vikbooking'),
52 ),
53 );
54 }
55
56 $options[] = array(
57 'value' => 'The plugin suddenly stopped working',
58 'text' => __('The plugin suddenly stopped working', 'vikbooking'),
59 'notes' => true,
60 );
61
62 $options[] = array(
63 'value' => 'The plugin broke my site',
64 'text' => __('The plugin broke my site', 'vikbooking'),
65 'notes' => array(
66 'placeholder' => __('Would you please explain what happened?', 'vikbooking'),
67 ),
68 );
69
70 $options[] = array(
71 'value' => 'I couldn\'t understand how to get it working',
72 'text' => __('I couldn\'t understand how to get it working', 'vikbooking'),
73 'help' => sprintf(__('Did you read the plugin documentation? You can find it <a href="%s" target="_blank">here</a>.', 'vikbooking'), $doc_url),
74 );
75
76 $options[] = array(
77 'value' => 'I no longer need the plugin',
78 'text' => __('I no longer need the plugin', 'vikbooking'),
79 );
80
81 $options[] = array(
82 'value' => 'I\'m just debugging an issue',
83 'text' => __('I\'m just debugging an issue', 'vikbooking'),
84 );
85
86 $options[] = array(
87 'value' => 'I\'m unable to deactivate this plugin!',
88 'text' => __('I\'m unable to deactivate this plugin!', 'vikbooking'),
89 'help' => sprintf(__('In case you are experiencing some issues with the deactivation of this plugin, try to relaunch the page by appending <code>&feedback=0</code> to the URL. Otherwise just click <a href="%s">HERE</a>.', 'vikbooking'), (string) $plain_deactivation_url),
90 );
91
92 $options[] = array(
93 'value' => 'Other',
94 'text' => __('Other', 'vikbooking'),
95 'notes' => array(
96 'required' => true,
97 'placeholder' => __('Please give us more information', 'vikbooking'),
98 ),
99 );
100
101 ?>
102
103 <style>
104 .thickbox-loading {
105 height: auto !important;
106 }
107
108 #TB_ajaxContent {
109 width: calc(100% - 30px) !important;
110 height: calc(100% - 45px) !important;
111 }
112
113 .th-box-body {
114 height: calc(100% - 45px);
115 }
116
117 .th-box-footer {
118 text-align: right;
119 }
120
121 .th-box-body div.form-field {
122 margin: 5px 0;
123 }
124
125 .th-box-body blockquote {
126 color: #7f8fa4;
127 font-size: inherit;
128 padding: 8px 24px;
129 border-left: 4px solid #eaeaea;
130 background: #fff;
131 }
132
133 .feedback-notes {
134 margin-top: 7px;
135 padding: 5px 10px;
136 }
137
138 textarea.invalid {
139 border: 1px solid #900;
140 }
141
142 #vikbooking-deactivate-uemail {
143 margin-bottom: 4px;
144 display: inline-block;
145 }
146 </style>
147
148 <div id="vikbooking-feedback" style="display: none;">
149
150 <div class="th-box-body">
151 <h2><?php echo __('Feedback', 'vikbooking'); ?></h2>
152 <h3><?php echo __('If you have a moment, please let us know why you are deactivating.', 'vikbooking'); ?></h3>
153
154 <form id="vikbooking-feedback-form">
155
156 <?php
157 foreach ($options as $i => $opt)
158 {
159 ?>
160 <div class="form-field">
161 <input
162 type="radio"
163 id="vbo-feed-opt-<?php echo $i; ?>"
164 name="feedback_type"
165 value="<?php echo esc_attr($opt['value']); ?>"
166 <?php echo !empty($opt['checked']) ? 'checked="checked"' : ''; ?>
167 />
168 <label for="vbo-feed-opt-<?php echo $i; ?>"><?php echo $opt['text']; ?></label>
169
170 <?php
171 if (!empty($opt['help']))
172 {
173 ?>
174 <blockquote
175 class="feedback-help"
176 style="<?php echo !empty($opt['checked']) ? '' : 'display:none;'; ?>"
177 >
178 <?php echo $opt['help']; ?>
179 </blockquote>
180 <?php
181 }
182
183 if (!empty($opt['notes']))
184 {
185 $opt['notes'] = (array) $opt['notes'];
186
187 $placeholder = !empty($opt['notes']['placeholder'])
188 ? $opt['notes']['placeholder']
189 : __('Could you please write some extra notes?', 'vikbooking');
190
191 ?>
192 <textarea
193 class="feedback-notes<?php echo !empty($opt['notes']['required']) ? ' required' : ''; ?>"
194 placeholder="<?php echo $placeholder; ?>"
195 style="<?php echo !empty($opt['checked']) ? '' : 'display:none;'; ?>"
196 ></textarea>
197 <?php
198 }
199 ?>
200
201 </div>
202 <?php
203 }
204 ?>
205
206 <div class="form-field">
207 <p style="margin-bottom: 2px;">
208 <strong>
209 <?php echo __('Would you like to be contacted by our team for a clarification?', 'vikbooking'); ?>
210 </strong>
211 </p>
212 <span>
213 <small>
214 <?php echo __('If you believe you could have missed a feature in the plugin, please drop us your email and we will get back to you with <u>one</u> message.', 'vikbooking'); ?>
215 </small>
216 </span>
217 <div>
218 <input type="email" value="" placeholder="[email protected]" id="vikbooking-deactivate-uemail" />
219 </div>
220 </div>
221
222 <p>
223 <small>
224 <span class="dashicons dashicons-editor-help"></span>&nbsp;
225 <?php echo __('In addition to the specified information, the feedback will contain your IP address (for security reasons), your PHP version, your WordPress version and the plugin version. If provided, we will not use your email address for any kind of newsletter, nor will we share it with anyone. We will only answer to your questions.', 'vikbooking'); ?>
226 </small>
227 </p>
228
229 </form>
230 </div>
231
232 <div class="th-box-footer">
233 <a href="javascript: void(0);" id="vikbooking-deactivate" class="button button-primary">
234 <?php echo __('Deactivate'); ?>
235 </a>
236 </div>
237
238 </div>
239
240 <script>
241 jQuery(document).ready(function() {
242
243 jQuery('#vikbooking-feedback-form .form-field input[name="feedback_type"]').on('change', function() {
244 var radio = jQuery('#vikbooking-feedback-form input[name="feedback_type"]:checked');
245
246 jQuery('.feedback-help,.feedback-notes').hide();
247 radio.siblings('.feedback-help,.feedback-notes').show().focus();
248 });
249
250 jQuery('#vikbooking-deactivate').on('click', function() {
251 var radio = jQuery('#vikbooking-feedback-form input[name="feedback_type"]:checked');
252
253 // get selected feedback type
254 var type = radio.val();
255
256 if (type == '0') {
257 // deactivate automatically
258 document.location.href = '<?php echo $deactivate_url_js; ?>';
259 return;
260 }
261
262 // get textarea
263 var textarea = radio.siblings('.feedback-notes');
264 var comment = textarea.length ? textarea.val() : null;
265
266 if (textarea.length && !textarea.val().length && textarea.hasClass('required')) {
267 textarea.addClass('invalid');
268 return;
269 }
270
271 // email address (optional)
272 var uemail = jQuery('#vikbooking-deactivate-uemail').val();
273
274 // disable button
275 jQuery(this).attr('disabled', true);
276
277 textarea.removeClass('invalid');
278
279 // do ajax and redirect on success/failure
280 jQuery.ajax({
281 url: 'admin-ajax.php?action=vikbooking&task=feedback.submit',
282 type: 'post',
283 data: {
284 type: type,
285 notes: comment,
286 email: uemail,
287 },
288 }).done(function(resp) {
289 // keep a cookie for 7 days in order to stop showing the feedback
290 // modal again and again
291 var date = new Date();
292 date.setDate(date.getDate() + 7);
293 document.cookie = 'vikbooking_feedback=1; expires=' + date.toUTCString() + '; path=/; SameSite=Lax';
294 // complete deactivation
295 document.location.href = '<?php echo $deactivate_url_js; ?>';
296 }).fail(function(err) {
297 console.log(err);
298 // complete deactivation
299 document.location.href = '<?php echo $deactivate_url_js; ?>';
300 });
301 });
302
303 });
304 </script>
305