PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.6
VikBooking Hotel Booking Engine & PMS v1.8.6
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 1.7.3 All 36 releases
vikbooking / libraries / html / rss / optin.php

optin.php in VikBooking Hotel Booking Engine & PMS 1.8.6, at libraries/html/rss/optin.php

91 lines 2.1 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.rss
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 // prepare modal to display opt-in
15 echo JHtml::fetch(
16 'bootstrap.renderModal',
17 'jmodal-rss-optin',
18 array(
19 'title' => '<i class="' . VikBookingIcons::i('rss-square') . '"></i> ' . __('Vik Booking - RSS Opt-in', 'vikbooking'),
20 'closeButton' => false,
21 'keyboard' => false,
22 'top' => true,
23 'width' => 70,
24 'height' => 80,
25 'footer' => '<button type="button" class="btn btn-success" id="rss-optin-save">' . __('Save') . '</button>',
26 ),
27 $this->sublayout('modal')
28 );
29
30 ?>
31
32 <script>
33
34 jQuery(function() {
35 var aborted = false;
36
37 if (typeof localStorage !== 'undefined') {
38 aborted = localStorage.getItem('vikbooking.rss.aborted') ? true : false;
39 }
40
41 if (!aborted) {
42 // open modal with a short delay
43 setTimeout(function() {
44 wpOpenJModal('rss-optin');
45 }, 1500);
46 }
47
48 jQuery('#rss-optin-save').on('click', function() {
49 if (jQuery(this).prop('disabled')) {
50 // already submitted
51 return false;
52 }
53
54 jQuery(this).prop('disabled', true);
55
56 // check opt-in status
57 var status = jQuery('input[name="rss_optin_status"]').is(':checked') ? 1 : 0;
58
59 // make AJAX request
60 doAjax(
61 'admin-ajax.php?action=vikbooking&task=rss.optin',
62 {
63 status: status,
64 },
65 function(resp) {
66 // auto-dismiss on save
67 wpCloseJModal('rss-optin');
68 },
69 function(error) {
70 if (!error.responseText) {
71 // use default connection lost error
72 error.responseText = Joomla.JText._('CONNECTION_LOST');
73 }
74
75 // alert error message
76 alert(error.responseText);
77
78 // avoid to spam the dialog again and again at every page load
79 if (typeof localStorage !== 'undefined') {
80 localStorage.setItem('vikbooking.rss.aborted', 1);
81 }
82
83 // auto-dismiss on failure
84 wpCloseJModal('rss-optin');
85 }
86 );
87 });
88 });
89
90 </script>
91