Restaurant Reservations - Version 2.1.0

Version Description

(2020-03-17) = - Added in options to set custom redirect pages for both pending and automatically-confirmed bookings - Added in a new option to allow people to cancel their reservations on your site - Added in the post ID as a column option in the admin bookings table - Added in the ability to send an admin notification for bookings that are automatically confirmed - Added in an option to include reCAPTCHA in your booking form - Added in a past bookings view to the admin bookings table - Fixed styling issue with the Contemporary and Columns layouts - Fixed issue where styling for Contemporary and Columns layouts was being applied to the admin create/edit booking form - Fixed issue causing JSON error when adding Gutenberg block to a page - Fixed issue with header bar not displaying in other languages - Fixed an issue with the plugin submenus that could cause debug warnings - Fixed an issue with the "view bookings" functionality that was causing it to show bookings from the same day of the month, but from other months - Added pagination to the "view bookings" functionality to fix issue that was limiting it to 10 reservations - Updated styling for the "view bookings" lightbox - Updated the TCPDF library to the newest version - Updates to the admin dashboard area - Removing unused files

Download this release

Release Info

Developer Rustaurius
Plugin Icon 128x128 Restaurant Reservations
Version 2.1.0
Comparing to
See all releases

Code changes from version 2.0.15 to 2.1.0

Files changed (188) hide show
  1. assets/css/admin.css +33 -2
  2. assets/css/booking-form.css +142 -9
  3. assets/css/columns.css +13 -17
  4. assets/css/contemporary.css +59 -8
  5. assets/css/dashboard-review-ask.css +61 -0
  6. assets/css/plugin-deactivation.css +68 -0
  7. assets/img/rtb-dashboard-banner.png +0 -0
  8. assets/img/rtb-icon.png +0 -0
  9. assets/js/admin.js +17 -0
  10. assets/js/booking-form.js +57 -3
  11. assets/js/columns.js +2 -8
  12. assets/js/contemporary.js +0 -26
  13. assets/js/dashboard-review-ask.js +64 -0
  14. assets/js/plugin-deactivation.js +53 -0
  15. assets/js/rtb-recaptcha.js +5 -0
  16. assets/js/stripe-payment.js +37 -0
  17. assets/js/stripe.js +3 -0
  18. includes/Ajax.class.php +129 -3
  19. includes/Booking.class.php +63 -5
  20. includes/Cron.class.php +24 -12
  21. includes/CustomPostTypes.class.php +27 -0
  22. includes/Dashboard.class.php +28 -10
  23. includes/DeactivationSurvey.class.php +84 -0
  24. includes/Editor.class.php +2 -2
  25. includes/Export.PDF.class.php +2 -1
  26. includes/InstallationWalkthrough.class.php +1 -1
  27. includes/Notification.Email.class.php +23 -3
  28. includes/Notification.SMS.class.php +149 -0
  29. includes/Notification.class.php +14 -0
  30. includes/Notifications.class.php +52 -5
  31. includes/Permissions.class.php +4 -3
  32. includes/Query.class.php +8 -1
  33. includes/ReviewAsk.class.php +98 -0
  34. includes/Settings.class.php +968 -120
  35. includes/WP_List_Table.BookingsTable.class.php +24 -3
  36. includes/template-functions.php +396 -37
  37. lib/simple-admin-pages/classes/AdminPageSection.class.php +5 -8
  38. lib/stripe/.coveralls.yml +4 -0
  39. lib/stripe/.gitignore +14 -0
  40. lib/stripe/.travis.yml +17 -0
  41. lib/stripe/CHANGELOG.md +364 -0
  42. lib/stripe/LICENSE +21 -0
  43. lib/stripe/README.md +129 -0
  44. lib/stripe/VERSION +1 -0
  45. lib/stripe/build.php +36 -0
  46. lib/stripe/composer.json +36 -0
  47. lib/stripe/data/ca-certificates.crt +3919 -0
  48. lib/stripe/data/test.png +0 -0
  49. lib/stripe/init.php +67 -0
  50. lib/stripe/lib/Account.php +131 -0
  51. lib/stripe/lib/AlipayAccount.php +13 -0
  52. lib/stripe/lib/ApiRequestor.php +244 -0
  53. lib/stripe/lib/ApiResource.php +205 -0
  54. lib/stripe/lib/ApiResponse.php +32 -0
  55. lib/stripe/lib/ApplicationFee.php +69 -0
  56. lib/stripe/lib/ApplicationFeeRefund.php +44 -0
  57. lib/stripe/lib/AttachedObject.php +31 -0
  58. lib/stripe/lib/Balance.php +26 -0
  59. lib/stripe/lib/BalanceTransaction.php +57 -0
  60. lib/stripe/lib/BankAccount.php +25 -0
  61. lib/stripe/lib/BitcoinReceiver.php +85 -0
  62. lib/stripe/lib/BitcoinTransaction.php +13 -0
  63. lib/stripe/lib/Card.php +13 -0
  64. lib/stripe/lib/Charge.php +184 -0
  65. lib/stripe/lib/Collection.php +87 -0
  66. lib/stripe/lib/CountrySpec.php +44 -0
  67. lib/stripe/lib/Coupon.php +77 -0
  68. lib/stripe/lib/Customer.php +190 -0
  69. lib/stripe/lib/Dispute.php +83 -0
  70. lib/stripe/lib/Error/Api.php +7 -0
  71. lib/stripe/lib/Error/ApiConnection.php +7 -0
  72. lib/stripe/lib/Error/Authentication.php +7 -0
  73. lib/stripe/lib/Error/Base.php +60 -0
  74. lib/stripe/lib/Error/Card.php +41 -0
  75. lib/stripe/lib/Error/InvalidRequest.php +23 -0
  76. lib/stripe/lib/Error/RateLimit.php +7 -0
  77. lib/stripe/lib/Event.php +43 -0
  78. lib/stripe/lib/ExternalAccount.php +89 -0
  79. lib/stripe/lib/FileUpload.php +61 -0
  80. lib/stripe/lib/HttpClient/ClientInterface.php +18 -0
  81. lib/stripe/lib/HttpClient/CurlClient.php +298 -0
  82. lib/stripe/lib/Invoice.php +92 -0
  83. lib/stripe/lib/InvoiceItem.php +77 -0
  84. lib/stripe/lib/JsonSerializable.php +18 -0
  85. lib/stripe/lib/Order.php +87 -0
  86. lib/stripe/lib/OrderReturn.php +33 -0
  87. lib/stripe/lib/Plan.php +77 -0
  88. lib/stripe/lib/Product.php +77 -0
  89. lib/stripe/lib/Recipient.php +92 -0
  90. lib/stripe/lib/Refund.php +79 -0
  91. lib/stripe/lib/SKU.php +77 -0
  92. lib/stripe/lib/SingletonApiResource.php +36 -0
  93. lib/stripe/lib/Stripe.php +100 -0
  94. lib/stripe/lib/StripeObject.php +293 -0
  95. lib/stripe/lib/Subscription.php +97 -0
  96. lib/stripe/lib/ThreeDSecure.php +25 -0
  97. lib/stripe/lib/Token.php +43 -0
  98. lib/stripe/lib/Transfer.php +115 -0
  99. lib/stripe/lib/TransferReversal.php +53 -0
  100. lib/stripe/lib/Util/AutoPagingIterator.php +61 -0
  101. lib/stripe/lib/Util/RequestOptions.php +79 -0
  102. lib/stripe/lib/Util/Set.php +44 -0
  103. lib/stripe/lib/Util/Util.php +140 -0
  104. lib/stripe/phpunit.no_autoload.xml +15 -0
  105. lib/stripe/phpunit.xml +15 -0
  106. lib/stripe/tests/AccountTest.php +300 -0
  107. lib/stripe/tests/ApiRequestorTest.php +43 -0
  108. lib/stripe/tests/ApplicationFeeRefundTest.php +18 -0
  109. lib/stripe/tests/ApplicationFeeTest.php +22 -0
  110. lib/stripe/tests/AuthenticationErrorTest.php +16 -0
  111. lib/stripe/tests/BalanceTest.php +15 -0
  112. lib/stripe/tests/BalanceTransactionTest.php +13 -0
  113. lib/stripe/tests/BankAccountTest.php +32 -0
  114. lib/stripe/tests/BitcoinReceiverTest.php +120 -0
  115. lib/stripe/tests/CardErrorTest.php +40 -0
  116. lib/stripe/tests/ChargeTest.php +204 -0
  117. lib/stripe/tests/CollectionTest.php +105 -0
  118. lib/stripe/tests/CountrySpecTest.php +31 -0
  119. lib/stripe/tests/CouponTest.php +29 -0
  120. lib/stripe/tests/CurlClientTest.php +92 -0
  121. lib/stripe/tests/CustomerTest.php +278 -0
  122. lib/stripe/tests/DiscountTest.php +31 -0
  123. lib/stripe/tests/DisputeTest.php +91 -0
  124. lib/stripe/tests/ErrorTest.php +61 -0
  125. lib/stripe/tests/ExternalAccountTest.php +30 -0
  126. lib/stripe/tests/FileUploadTest.php +44 -0
  127. lib/stripe/tests/InvalidRequestErrorTest.php +26 -0
  128. lib/stripe/tests/InvoiceTest.php +56 -0
  129. lib/stripe/tests/PlanTest.php +51 -0
  130. lib/stripe/tests/ProductTest.php +158 -0
  131. lib/stripe/tests/RateLimitErrorTest.php +22 -0
  132. lib/stripe/tests/RecipientTest.php +112 -0
  133. lib/stripe/tests/RefundTest.php +131 -0
  134. lib/stripe/tests/RequestOptionsTest.php +69 -0
  135. lib/stripe/tests/StripeObjectTest.php +108 -0
  136. lib/stripe/tests/SubscriptionTest.php +101 -0
  137. lib/stripe/tests/TestCase.php +224 -0
  138. lib/stripe/tests/ThreeDSecureTest.php +31 -0
  139. lib/stripe/tests/TokenTest.php +13 -0
  140. lib/stripe/tests/TransferReversalTest.php +15 -0
  141. lib/stripe/tests/TransferTest.php +110 -0
  142. lib/stripe/tests/UtilTest.php +45 -0
  143. lib/stripe/tests/bootstrap.no_autoload.php +4 -0
  144. lib/stripe/tests/bootstrap.php +3 -0
  145. lib/tcpdf/CHANGELOG.TXT +39 -0
  146. lib/tcpdf/LICENSE.TXT +2 -0
  147. lib/tcpdf/README.TXT +0 -115
  148. lib/tcpdf/README.md +84 -0
  149. lib/tcpdf/VERSION +1 -0
  150. lib/tcpdf/composer.json +45 -38
  151. lib/tcpdf/config/tcpdf_config.php +2 -2
  152. lib/tcpdf/fonts/dejavu-fonts-ttf-2.34/AUTHORS +0 -54
  153. lib/tcpdf/fonts/dejavu-fonts-ttf-2.34/BUGS +0 -3
  154. lib/tcpdf/fonts/dejavu-fonts-ttf-2.34/LICENSE +0 -99
  155. lib/tcpdf/fonts/dejavu-fonts-ttf-2.34/NEWS +0 -1373
  156. lib/tcpdf/fonts/dejavu-fonts-ttf-2.34/README +0 -59
  157. lib/tcpdf/fonts/dejavu-fonts-ttf-2.34/langcover.txt +0 -249
  158. lib/tcpdf/fonts/dejavu-fonts-ttf-2.34/status.txt +0 -6766
  159. lib/tcpdf/fonts/dejavu-fonts-ttf-2.34/unicover.txt +0 -226
  160. lib/tcpdf/fonts/dejavusans.ctg.z +0 -0
  161. lib/tcpdf/fonts/dejavusans.php +0 -16
  162. lib/tcpdf/fonts/dejavusans.z +0 -0
  163. lib/tcpdf/fonts/dejavusansb.ctg.z +0 -0
  164. lib/tcpdf/fonts/dejavusansb.php +0 -16
  165. lib/tcpdf/fonts/dejavusansb.z +0 -0
  166. lib/tcpdf/fonts/dejavusansbi.ctg.z +0 -0
  167. lib/tcpdf/fonts/dejavusansbi.php +0 -16
  168. lib/tcpdf/fonts/dejavusansbi.z +0 -0
  169. lib/tcpdf/fonts/helvetica.php +13 -0
  170. lib/tcpdf/fonts/helveticab.php +12 -0
  171. lib/tcpdf/fonts/helveticabi.php +12 -0
  172. lib/tcpdf/fonts/helveticai.php +12 -0
  173. lib/tcpdf/include/barcodes/datamatrix.php +1 -1
  174. lib/tcpdf/include/barcodes/pdf417.php +13 -13
  175. lib/tcpdf/include/barcodes/qrcode.php +1 -0
  176. lib/tcpdf/include/tcpdf_colors.php +1 -1
  177. lib/tcpdf/include/tcpdf_filters.php +3 -3
  178. lib/tcpdf/include/tcpdf_fonts.php +175 -112
  179. lib/tcpdf/include/tcpdf_images.php +7 -2
  180. lib/tcpdf/include/tcpdf_static.php +930 -820
  181. lib/tcpdf/tcpdf.php +315 -215
  182. lib/tcpdf/tcpdf_barcodes_1d.php +54 -54
  183. lib/tcpdf/tcpdf_parser.php +8 -5
  184. lib/tcpdf/tools/.htaccess +1 -0
  185. lib/tcpdf/tools/convert_fonts_examples.txt +28 -0
  186. lib/tcpdf/tools/tcpdf_addfont.php +269 -0
  187. readme.txt +19 -0
  188. restaurant-reservations.php +26 -2
assets/css/admin.css CHANGED
@@ -1,5 +1,9 @@
1
/* CSS Stylesheet for the admin interface for Restaurant Reservations */
2
3
.clearfix:before,
4
.clearfix:after { /* thanks bootstrap */
5
content: " ";
@@ -782,7 +786,8 @@ NEW DASHBOARD
782
.rtb-dashboard-new-upgrade-banner {
783
position: relative;
784
float: left;
785
- width: 100%;
786
height: 256px;
787
background: url(../img/rtb-dashboard-banner.png) center no-repeat #1b0f49;
788
}
@@ -911,7 +916,33 @@ NEW DASHBOARD
911
}
912
}
913
914
-
915
916
917
1
/* CSS Stylesheet for the admin interface for Restaurant Reservations */
2
3
+ .rtb-hidden {
4
+ display: none;
5
+ }
6
+
7
.clearfix:before,
8
.clearfix:after { /* thanks bootstrap */
9
content: " ";
786
.rtb-dashboard-new-upgrade-banner {
787
position: relative;
788
float: left;
789
+ margin-left: -20px;
790
+ width: calc(100% + 20px);
791
height: 256px;
792
background: url(../img/rtb-dashboard-banner.png) center no-repeat #1b0f49;
793
}
916
}
917
}
918
919
+ .rtb-ultimate-upgrade-dismiss {
920
+ position: absolute;
921
+ top: 0;
922
+ right: 1px;
923
+ border: none;
924
+ margin: 0;
925
+ padding: 9px;
926
+ background: 0 0;
927
+ color: #72777c;
928
+ cursor: pointer;
929
+ }
930
+ .rtb-ultimate-upgrade-dismiss:before {
931
+ background: 0 0;
932
+ color: #72777c;
933
+ content: "\f153";
934
+ display: block;
935
+ font: normal 16px/20px dashicons;
936
+ speak: none;
937
+ height: 20px;
938
+ text-align: center;
939
+ width: 20px;
940
+ -webkit-font-smoothing: antialiased;
941
+ }
942
+ .rtb-ultimate-notification {
943
+ width: calc(100% - 25px);
944
+ float: left;
945
+ }
946
947
948
assets/css/booking-form.css CHANGED
@@ -1,5 +1,8 @@
1
/* Frontend CSS Stylesheet for Restaurant Reservations */
2
3
.rtb-hidden {
4
display: none;
5
}
@@ -88,15 +91,6 @@
88
89
90
/* ARRIVAL LIGHTBOX */
91
- .rtb-view-bookings-form-confirmation-div {
92
- position: fixed;
93
- top: 100px;
94
- z-index: 1000000;
95
- margin: 0 auto;
96
- background: #fff;
97
- width: 100%;
98
- max-width: 1080px;
99
- }
100
.rtb-view-bookings-form-confirmation-background-div {
101
position: fixed;
102
top: 0;
@@ -105,4 +99,143 @@
105
height: 100%;
106
z-index: 999999;
107
background: rgba(0,0,0,0.5);
108
}
1
/* Frontend CSS Stylesheet for Restaurant Reservations */
2
3
+ .rtb-clear {
4
+ clear: both;
5
+ }
6
.rtb-hidden {
7
display: none;
8
}
91
92
93
/* ARRIVAL LIGHTBOX */
94
.rtb-view-bookings-form-confirmation-background-div {
95
position: fixed;
96
top: 0;
99
height: 100%;
100
z-index: 999999;
101
background: rgba(0,0,0,0.5);
102
+ }
103
+ .rtb-view-bookings-form-confirmation-div {
104
+ position: fixed;
105
+ top: 200px;
106
+ width: 480px;
107
+ left: calc(50% - 240px);
108
+ z-index: 1000000;
109
+ margin: 0;
110
+ background: #fff;
111
+ font-size: 18px;
112
+ text-transform: uppercase;
113
+ font-weight: bold;
114
+ text-align: center;
115
+ }
116
+ .rtb-view-bookings-form-confirmation-div-inside {
117
+ position: relative;
118
+ float: left;
119
+ width: calc(100% - 6px);
120
+ height: calc(100% - 12px);
121
+ border: 3px solid #ddd;
122
+ margin: 3px;
123
+ }
124
+ .rtb-view-bookings-form-confirmation-div-title {
125
+ position: relative;
126
+ float: left;
127
+ width: 90%;
128
+ margin: 24px 5%;
129
+ color: #333;
130
+ }
131
+ .rtb-view-bookings-form-confirmation-accept {
132
+ position: relative;
133
+ float: left;
134
+ width: 32%;
135
+ margin: 24px 34% 0;
136
+ padding: 8px 0;
137
+ background: #444;
138
+ color: #fff;
139
+ cursor: pointer;
140
+ }
141
+ .rtb-view-bookings-form-confirmation-accept:hover {
142
+ background: #555;
143
+ }
144
+ .rtb-view-bookings-form-confirmation-decline {
145
+ position: relative;
146
+ float: left;
147
+ width: 32%;
148
+ margin: 8px 34% 24px;
149
+ padding: 8px 0;
150
+ background: #bbb;
151
+ color: #444;
152
+ cursor: pointer;
153
+ }
154
+ .rtb-view-bookings-form-confirmation-decline:hover {
155
+ background: #ccc;
156
+ }
157
+
158
+ #rtb-view-bookings-form-close {
159
+ position: absolute;
160
+ top: 0;
161
+ right: 0;
162
+ width: 24px;
163
+ height: 24px;
164
+ background: #ddd;
165
+ font-size: 15px;
166
+ cursor: pointer;
167
+ }
168
+
169
+ @media screen and (max-width: 568px) {
170
+ .rtb-view-bookings-form-confirmation-div {
171
+ top: 100px;
172
+ width: 300px;
173
+ left: calc(50% - 150px);
174
+ }
175
+ }
176
+
177
+
178
+ /*CANCEL LINK*/
179
+ .rtb-cancellation-toggle {
180
+ position: relative;
181
+ float: left;
182
+ padding: 10px 15px;
183
+ margin-bottom: 24px;
184
+ background: #444;
185
+ color: #fff;
186
+ border-radius: 3px;
187
+ cursor: pointer;
188
+ }
189
+ label[for="rtb-cancellation-email"],
190
+ input[name="rtb_cancellation_email"] {
191
+ float: left;
192
+ margin-top: 20px;
193
+ }
194
+ label[for="rtb-cancellation-email"] {
195
+ margin-right: 12px;
196
+ }
197
+ .rtb-cancel-button {
198
+ position: relative;
199
+ float: left;
200
+ padding: 10px 15px;
201
+ margin-top: 24px;
202
+ background: #444;
203
+ color: #fff;
204
+ border-radius: 3px;
205
+ cursor: pointer;
206
+ }
207
+
208
+ .rtb-bookings-results,
209
+ .rtb-cancel-booking-div {
210
+ position: relative;
211
+ float: left;
212
+ width: 100%;
213
+ margin-top: 16px;
214
+ }
215
+ .rtb-cancel-booking-div {
216
+ position: relative;
217
+ float: left;
218
+ width: calc(100% - 2px);
219
+ border: 1px solid #ddd;
220
+ }
221
+ .rtb-cancel-booking {
222
+ position: relative;
223
+ float: left;
224
+ width: 200px;
225
+ text-align: center;
226
+ padding: 10px 0;
227
+ background: #fe4e4e;
228
+ color: #fff;
229
+ cursor: pointer;
230
+ }
231
+ .rtb-cancel-booking:hover {
232
+ background: #ff6b6b;
233
+ color: #fff;
234
+ }
235
+ .rtb-booking-information {
236
+ position: relative;
237
+ float: left;
238
+ margin-left: 32px;
239
+ width: calc(100% - 232px);
240
+ padding: 10px 0;
241
}
assets/css/columns.css CHANGED
@@ -1,9 +1,3 @@
1
- .rtb-booking-form,
2
- .rtb-booking-form form {
3
- position: relative;
4
- float: left;
5
- width: 100%;
6
- }
7
.rtb-booking-form fieldset {
8
border: 0 solid #ccc;
9
margin: 0;
@@ -14,21 +8,17 @@
14
float: left;
15
margin-top: 32px;
16
}
17
- .rtb-booking-form fieldset.reservation {
18
- width: 45%;
19
margin-right: 5%;
20
}
21
- .rtb-booking-form fieldset.contact {
22
- width: 50%;
23
}
24
@media screen and (max-width: 768px) {
25
- .rtb-booking-form fieldset.reservation {
26
- width: 100%;
27
- margin-right: 0;
28
- margin-bottom: 28px;
29
- }
30
- .rtb-booking-form fieldset.contact {
31
width: 100%;
32
}
33
}
34
@@ -47,6 +37,7 @@
47
text-align: center;
48
color: #666;
49
font-weight: bold;
50
}
51
52
.rtb-booking-form fieldset.optin {
@@ -80,6 +71,7 @@
80
.rtb-booking-form form select,
81
.rtb-booking-form form input {
82
height: 48px;
83
}
84
.rtb-booking-form form input::webkit-input-placeholder,
85
.rtb-booking-form form input:ms--input-placeholder,
@@ -99,19 +91,23 @@
99
border: 1px solid #ddd;
100
background: white;
101
color: #888;
102
}
103
.rtb-booking-form .add-message a:hover {
104
background: #aaa;
105
border-color: #aaa;
106
color: white;
107
}
108
109
.rtb-booking-form button {
110
float: left;
111
- margin-top: 24px;
112
cursor: pointer;
113
display: block;
114
align-items: stretch;
115
}
116
117
.rtb-booking-form fieldset.optin input[type="checkbox"] {
1
.rtb-booking-form fieldset {
2
border: 0 solid #ccc;
3
margin: 0;
8
float: left;
9
margin-top: 32px;
10
}
11
+ .rtb-booking-form fieldset {
12
+ width: 47.5%;
13
margin-right: 5%;
14
}
15
+ .rtb-booking-form fieldset:nth-of-type(2n+2) {
16
+ margin-right: 0;
17
}
18
@media screen and (max-width: 768px) {
19
+ .rtb-booking-form fieldset {
20
width: 100%;
21
+ margin-right: 0 !important;
22
}
23
}
24
37
text-align: center;
38
color: #666;
39
font-weight: bold;
40
+ margin-bottom: 0 !important
41
}
42
43
.rtb-booking-form fieldset.optin {
71
.rtb-booking-form form select,
72
.rtb-booking-form form input {
73
height: 48px;
74
+ width: 100%;
75
}
76
.rtb-booking-form form input::webkit-input-placeholder,
77
.rtb-booking-form form input:ms--input-placeholder,
91
border: 1px solid #ddd;
92
background: white;
93
color: #888;
94
+ text-decoration: none;
95
}
96
.rtb-booking-form .add-message a:hover {
97
background: #aaa;
98
border-color: #aaa;
99
color: white;
100
+ text-decoration: none;
101
}
102
103
.rtb-booking-form button {
104
+ clear: both;
105
float: left;
106
+ margin-top: 36px;
107
cursor: pointer;
108
display: block;
109
align-items: stretch;
110
+ text-decoration: none;
111
}
112
113
.rtb-booking-form fieldset.optin input[type="checkbox"] {
assets/css/contemporary.css CHANGED
@@ -44,15 +44,39 @@
44
display: block;
45
width: 300px;
46
}
47
- .rtb-booking-form fieldset.reservation .rtb-text.time {
48
left: -1px;
49
}
50
.rtb-booking-form fieldset.reservation .rtb-select {
51
position: relative;
52
float: left;
53
display: block;
54
width: 300px;
55
- left: -2px;
56
}
57
58
.rtb-booking-form form fieldset.reservation select,
@@ -120,12 +144,6 @@
120
display: block;
121
width: 300px;
122
}
123
- .rtb-booking-form fieldset.contact .rtb-text.email {
124
- left: -1px;
125
- }
126
- .rtb-booking-form fieldset.contact .rtb-text.phone {
127
- left: -2px;
128
- }
129
130
.rtb-booking-form form fieldset.contact select,
131
.rtb-booking-form form fieldset.contact textarea,
@@ -145,10 +163,12 @@
145
border: 2px solid #777;
146
background: white;
147
color: #777;
148
}
149
.rtb-booking-form .add-message a:hover {
150
background: #777;
151
color: white;
152
}
153
154
.rtb-booking-form form fieldset .rtb-textarea {
@@ -156,3 +176,34 @@
156
position: relative;
157
float: left;
158
}
44
display: block;
45
width: 300px;
46
}
47
+
48
+ .rtb-booking-form fieldset > div:nth-of-type(2) {
49
left: -1px;
50
}
51
+ .rtb-booking-form fieldset > div:nth-of-type(3) {
52
+ left: -2px;
53
+ }
54
+ .rtb-booking-form fieldset > div:nth-of-type(4) {
55
+ left: -3px;
56
+ }
57
+ .rtb-booking-form fieldset > div:nth-of-type(5) {
58
+ left: -4px;
59
+ }
60
+ .rtb-booking-form fieldset > div:nth-of-type(6) {
61
+ left: -5px;
62
+ }
63
+ .rtb-booking-form fieldset > div:nth-of-type(7) {
64
+ left: -6px;
65
+ }
66
+ .rtb-booking-form fieldset > div:nth-of-type(8) {
67
+ left: -7px;
68
+ }
69
+ .rtb-booking-form fieldset > div:nth-of-type(9) {
70
+ left: -8px;
71
+ }
72
+ .rtb-booking-form fieldset > div:nth-of-type(10) {
73
+ left: -9px;
74
+ }
75
.rtb-booking-form fieldset.reservation .rtb-select {
76
position: relative;
77
float: left;
78
display: block;
79
width: 300px;
80
}
81
82
.rtb-booking-form form fieldset.reservation select,
144
display: block;
145
width: 300px;
146
}
147
148
.rtb-booking-form form fieldset.contact select,
149
.rtb-booking-form form fieldset.contact textarea,
163
border: 2px solid #777;
164
background: white;
165
color: #777;
166
+ text-decoration: none;
167
}
168
.rtb-booking-form .add-message a:hover {
169
background: #777;
170
color: white;
171
+ text-decoration: none;
172
}
173
174
.rtb-booking-form form fieldset .rtb-textarea {
176
position: relative;
177
float: left;
178
}
179
+
180
+
181
+ .rtb-textarea {
182
+ margin-bottom: 24px;
183
+ }
184
+ .rtb-checkbox {
185
+ clear: both;
186
+ margin-bottom: 24px;
187
+ }
188
+ .rtb-booking-form fieldset select,
189
+ .rtb-booking-form fieldset input {
190
+ margin-top: 0 !important;
191
+ }
192
+
193
+
194
+ @media screen and (max-width: 900px) {
195
+ .rtb-booking-form fieldset > div {
196
+ clear: both;
197
+ }
198
+ .rtb-booking-form fieldset > div:nth-of-type(2),
199
+ .rtb-booking-form fieldset > div:nth-of-type(3),
200
+ .rtb-booking-form fieldset > div:nth-of-type(4),
201
+ .rtb-booking-form fieldset > div:nth-of-type(5),
202
+ .rtb-booking-form fieldset > div:nth-of-type(6),
203
+ .rtb-booking-form fieldset > div:nth-of-type(7),
204
+ .rtb-booking-form fieldset > div:nth-of-type(8),
205
+ .rtb-booking-form fieldset > div:nth-of-type(9),
206
+ .rtb-booking-form fieldset > div:nth-of-type(10) {}
207
+ left: 0;
208
+ }
209
+ }
assets/css/dashboard-review-ask.css ADDED
@@ -0,0 +1,61 @@
1
+ .rtb-hidden {
2
+ display: none;
3
+ }
4
+ .rtb-clear {
5
+ clear: both;
6
+ }
7
+ .rtb-main-dashboard-review-ask {
8
+ border-left-color: #1b335f;
9
+ }
10
+ .rtb-review-ask-plugin-icon {
11
+ height: 100px;
12
+ width: 100px;
13
+ float: left;
14
+ margin: 12px 24px 16px 10px;
15
+ background-image: url(../img/rtb-icon.png);
16
+ background-size: contain;
17
+ }
18
+ .rtb-review-ask-text p {
19
+ padding: 10px 20px;
20
+ font-weight: 600;
21
+ font-size: 20px;
22
+ }
23
+ .rtb-review-ask-action {
24
+ width: 90px;
25
+ padding: 6px;
26
+ margin-right: 18px;
27
+ text-align: center;
28
+ float: left;
29
+ border-radius: 4px;
30
+ cursor: pointer;
31
+ }
32
+ .rtb-review-ask-white {
33
+ color: #999999;
34
+ border: 1px solid #bbbbbb;
35
+ }
36
+ .rtb-review-ask-green {
37
+ color: #ffffff;
38
+ background: #7CA3BF;
39
+ border: 1px solid #7CA3BF;
40
+ font-weight: 600;
41
+ }
42
+ .rtb-review-ask-green a {
43
+ color: #ffffff;
44
+ text-decoration: none;
45
+ }
46
+ .rtb-review-ask-feedback-form {
47
+ position: relative;
48
+ float: left;
49
+ }.rtb-review-ask-feedback-explanation textarea {
50
+ height: 70px;
51
+ width: 480px;
52
+ }
53
+ .rtb-review-ask-send-feedback {
54
+ margin: 10px 0px;
55
+ }
56
+
57
+
58
+ .rtb-review-ask-review-text span {
59
+ font-size: .8em;
60
+ font-weight: normal;
61
+ }
assets/css/plugin-deactivation.css ADDED
@@ -0,0 +1,68 @@
1
+ .rtb-deactivate-survey-modal {
2
+ display: none;
3
+ table-layout: fixed;
4
+ position: fixed;
5
+ z-index: 9999;
6
+ width: 100%;
7
+ height: 100%;
8
+ text-align: center;
9
+ font-size: 14px;
10
+ top: 0;
11
+ left: 0;
12
+ background: rgba(0,0,0,0.8);
13
+ }
14
+ .rtb-deactivate-survey-wrap {
15
+ display: table-cell;
16
+ vertical-align: middle;
17
+ }
18
+ .rtb-deactivate-survey {
19
+ background-color: #fff;
20
+ max-width: 550px;
21
+ margin: 0 auto;
22
+ padding: 30px;
23
+ text-align: left;
24
+ }
25
+ .rtb-deactivate-survey .error {
26
+ display: block;
27
+ color: red;
28
+ margin: 0 0 10px 0;
29
+ }
30
+ .rtb-deactivate-survey-title {
31
+ display: block;
32
+ font-size: 18px;
33
+ font-weight: 700;
34
+ text-transform: uppercase;
35
+ border-bottom: 1px solid #ddd;
36
+ padding: 0 0 18px 0;
37
+ margin: 0 0 18px 0;
38
+ }
39
+ .rtb-deactivate-survey-title span {
40
+ color: #999;
41
+ margin-right: 10px;
42
+ }
43
+ .rtb-deactivate-survey-desc {
44
+ display: block;
45
+ font-weight: 600;
46
+ margin: 0 0 18px 0;
47
+ }
48
+ .rtb-deactivate-survey-option {
49
+ margin: 0 0 10px 0;
50
+ }
51
+ .rtb-deactivate-survey-option-input {
52
+ margin-right: 10px !important;
53
+ }
54
+ .rtb-deactivate-survey-option-details {
55
+ display: none;
56
+ width: 90%;
57
+ margin: 10px 0 0 30px;
58
+ }
59
+ .rtb-deactivate-survey-footer {
60
+ margin-top: 18px;
61
+ }
62
+ .rtb-deactivate-survey-deactivate {
63
+ float: right;
64
+ font-size: 13px;
65
+ color: #ccc;
66
+ text-decoration: none;
67
+ padding-top: 7px;
68
+ }
assets/img/rtb-dashboard-banner.png ADDED
Binary file
assets/img/rtb-icon.png ADDED
Binary file
assets/js/admin.js CHANGED
@@ -979,6 +979,7 @@ jQuery(document).ready(function($){
979
$('#rtb-dash-mobile-menu-down-caret').toggle();
980
return false;
981
});
982
$(function(){
983
$(window).resize(function(){
984
if($(window).width() > 800){
@@ -991,16 +992,32 @@ jQuery(document).ready(function($){
991
}
992
}).resize();
993
});
994
$('#rtb-dashboard-support-widget-box .rtb-dashboard-new-widget-box-top').click(function(){
995
$('#rtb-dashboard-support-widget-box .rtb-dashboard-new-widget-box-bottom').toggle();
996
$('#rtb-dash-mobile-support-up-caret').toggle();
997
$('#rtb-dash-mobile-support-down-caret').toggle();
998
});
999
$('#rtb-dashboard-optional-table .rtb-dashboard-new-widget-box-top').click(function(){
1000
$('#rtb-dashboard-optional-table .rtb-dashboard-new-widget-box-bottom').toggle();
1001
$('#rtb-dash-optional-table-up-caret').toggle();
1002
$('#rtb-dash-optional-table-down-caret').toggle();
1003
});
1004
});
1005
1006
/*LOCK BOXES*/
979
$('#rtb-dash-mobile-menu-down-caret').toggle();
980
return false;
981
});
982
+
983
$(function(){
984
$(window).resize(function(){
985
if($(window).width() > 800){
992
}
993
}).resize();
994
});
995
+
996
$('#rtb-dashboard-support-widget-box .rtb-dashboard-new-widget-box-top').click(function(){
997
$('#rtb-dashboard-support-widget-box .rtb-dashboard-new-widget-box-bottom').toggle();
998
$('#rtb-dash-mobile-support-up-caret').toggle();
999
$('#rtb-dash-mobile-support-down-caret').toggle();
1000
});
1001
+
1002
$('#rtb-dashboard-optional-table .rtb-dashboard-new-widget-box-top').click(function(){
1003
$('#rtb-dashboard-optional-table .rtb-dashboard-new-widget-box-bottom').toggle();
1004
$('#rtb-dash-optional-table-up-caret').toggle();
1005
$('#rtb-dash-optional-table-down-caret').toggle();
1006
});
1007
+
1008
+ $('.rtb-ultimate-upgrade-dismiss').on('click', function() {
1009
+ $('#rtb-dashboard-upgrade-box').addClass('rtb-hidden');
1010
+ $('#rtb-dashboard-show-upgrade-box-link').removeClass('rtb-hidden');
1011
+
1012
+ $.post( ajaxurl, 'action=rtb_hide_upgrade_box' );
1013
+ });
1014
+
1015
+ $('#rtb-dashboard-show-upgrade-box-link').on('click', function() {
1016
+ $('#rtb-dashboard-show-upgrade-box-link').addClass('rtb-hidden');
1017
+ $('#rtb-dashboard-upgrade-box').removeClass('rtb-hidden');
1018
+
1019
+ $.post( ajaxurl, 'action=rtb_display_upgrade_box' );
1020
+ });
1021
});
1022
1023
/*LOCK BOXES*/
assets/js/booking-form.js CHANGED
@@ -204,8 +204,8 @@ jQuery(document).ready(function ($) {
204
return;
205
}
206
207
- var additional_valid_times = jQuery.parseJSON( response );
208
- var all_valid_times = valid_times.concat( additional_valid_times );
209
rtb_booking_form.timepicker.set( 'disable', all_valid_times );
210
});
211
}
@@ -422,6 +422,58 @@ jQuery(document).ready(function ($) {
422
rtb_booking_form.init();
423
});
424
425
// Functions for the 'View Bookings' shortcode
426
jQuery(document).ready(function ($) {
427
jQuery('.rtb-view-bookings-form-date-selector').on('change', function() {
@@ -450,10 +502,12 @@ jQuery(document).ready(function ($) {
450
jQuery('.rtb-view-bookings-form-confirmation-decline').on('click', function() {
451
jQuery('.rtb-view-bookings-form-confirmation-div, .rtb-view-bookings-form-confirmation-background-div').addClass('rtb-hidden');
452
});
453
-
454
jQuery('.rtb-view-bookings-form-confirmation-background-div').on('click', function() {
455
jQuery('.rtb-view-bookings-form-confirmation-div, .rtb-view-bookings-form-confirmation-background-div').addClass('rtb-hidden');
456
});
457
});
458
459
function replaceUrlParam(url, paramName, paramValue)
204
return;
205
}
206
207
+ var additional_valid_times = jQuery.parseJSON( response );
208
+ var all_valid_times = valid_times.concat( additional_valid_times );
209
rtb_booking_form.timepicker.set( 'disable', all_valid_times );
210
});
211
}
422
rtb_booking_form.init();
423
});
424
425
+ //Handle reservation cancellations
426
+ jQuery(document).ready(function() {
427
+ jQuery('.rtb-cancellation-toggle').on('click', function() {
428
+ jQuery('.rtb-cancellation-form, .rtb-booking-form-form').toggleClass('rtb-hidden');
429
+
430
+ if (jQuery('.rtb-cancellation-form').hasClass('rtb-hidden')) {
431
+ jQuery('.rtb-cancellation-toggle').html('Want to cancel your reservation?');
432
+ }
433
+ else {
434
+ jQuery('.rtb-cancellation-toggle').html('Make a reservation');
435
+ }
436
+ });
437
+
438
+ jQuery('.rtb-cancel-button').on('click', function() {
439
+ var booking_email = jQuery('input[name="rtb_cancellation_email"]').val();
440
+
441
+ var data = 'booking_email=' + booking_email + '&action=rtb_find_reservations';
442
+ jQuery.post(ajaxurl, data, function(response) { console.log(response);
443
+
444
+ if (response.success) {
445
+ var booking_html = '';
446
+
447
+ jQuery(response.data.bookings).each(function( index, val) {
448
+ booking_html += '<div class="rtb-cancel-booking-div">';
449
+ booking_html += '<div class="rtb-cancel-booking" data-bookingid="' + val.ID + '" data-bookingemail="' + val.email + '">Cancel</div>';
450
+ booking_html += '<div class="rtb-booking-information">' + val.datetime + ' - ' + val.party + ' guest' + (val.party > 1 ? 's' : '') + '</div>'
451
+ booking_html += '</div>';
452
+ });
453
+
454
+ jQuery('.rtb-bookings-results').html(booking_html);
455
+
456
+ cancellationHandler();
457
+ }
458
+ else {jQuery('.rtb-bookings-results').html(response.data.msg);}
459
+ });
460
+ });
461
+ });
462
+
463
+ function cancellationHandler() {
464
+ jQuery('.rtb-cancel-booking').off('click');
465
+ jQuery('.rtb-cancel-booking').on('click', function() {
466
+ var booking_id = jQuery(this).data('bookingid');
467
+ var booking_email = jQuery(this).data('bookingemail');
468
+
469
+ var data = 'booking_id=' + booking_id + '&booking_email=' + booking_email + '&action=rtb_cancel_reservations'; console.log(data);
470
+ jQuery.post(ajaxurl, data, function(response) { console.log(response);
471
+ if (response.success) {window.location.href = replaceUrlParam(window.location.href, 'bookingCancelled', 'success');}
472
+ else {jQuery('.rtb-bookings-results').html(response.data.msg);}
473
+ });
474
+ });
475
+ }
476
+
477
// Functions for the 'View Bookings' shortcode
478
jQuery(document).ready(function ($) {
479
jQuery('.rtb-view-bookings-form-date-selector').on('change', function() {
502
jQuery('.rtb-view-bookings-form-confirmation-decline').on('click', function() {
503
jQuery('.rtb-view-bookings-form-confirmation-div, .rtb-view-bookings-form-confirmation-background-div').addClass('rtb-hidden');
504
});
505
jQuery('.rtb-view-bookings-form-confirmation-background-div').on('click', function() {
506
jQuery('.rtb-view-bookings-form-confirmation-div, .rtb-view-bookings-form-confirmation-background-div').addClass('rtb-hidden');
507
});
508
+ jQuery('#rtb-view-bookings-form-close').on('click', function() {
509
+ jQuery('.rtb-view-bookings-form-confirmation-div, .rtb-view-bookings-form-confirmation-background-div').addClass('rtb-hidden');
510
+ });
511
});
512
513
function replaceUrlParam(url, paramName, paramValue)
assets/js/columns.js CHANGED
@@ -3,14 +3,8 @@ jQuery(document).ready(function($){
3
$(window).resize(function(){
4
$('.rtb-booking-form form button').each(function(){
5
var thisButton = $(this);
6
- var buttonHalfWidthBig = ( thisButton.width() / 2 ) + 56;
7
- var buttonHalfWidthSmall = ( thisButton.width() / 2 ) + 28;
8
- if( $(window).width() > 768 ){
9
- thisButton.css('margin-left', 'calc(50% - '+buttonHalfWidthBig+'px');
10
- }
11
- else{
12
- thisButton.css('margin-left', 'calc(50% - '+buttonHalfWidthSmall+'px');
13
- }
14
});
15
}).resize();
16
});
3
$(window).resize(function(){
4
$('.rtb-booking-form form button').each(function(){
5
var thisButton = $(this);
6
+ var buttonHalfWidth = ( thisButton.outerWidth() / 2 );
7
+ thisButton.css('margin-left', 'calc(50% - '+buttonHalfWidth+'px');
8
});
9
}).resize();
10
});
assets/js/contemporary.js DELETED
@@ -1,26 +0,0 @@
1
- jQuery(document).ready(function($){
2
- $(function(){
3
- $(window).resize(function(){
4
- $('.rtb-booking-form form').each(function(){
5
- var thisForm = $(this);
6
- var formWidth = thisForm.width();
7
- if(formWidth < 900){
8
- thisForm.find('fieldset.reservation .rtb-select').css('left', '0');
9
- thisForm.find('fieldset.contact .rtb-text.phone').css('left', '0');
10
- }
11
- if(formWidth < 600){
12
- thisForm.find('fieldset.reservation .rtb-text.time').css('left', '0');
13
- thisForm.find('fieldset.contact .rtb-text.email').css('left', '0');
14
- }
15
- if(formWidth > 599){
16
- thisForm.find('fieldset.reservation .rtb-text.time').css('left', '-1px');
17
- thisForm.find('fieldset.contact .rtb-text.email').css('left', '-1px');
18
- }
19
- if(formWidth > 899){
20
- thisForm.find('fieldset.reservation .rtb-select').css('left', '-2px');
21
- thisForm.find('fieldset.contact .rtb-text.phone').css('left', '-2px');
22
- }
23
- });
24
- }).resize();
25
- });
26
- });
assets/js/dashboard-review-ask.js ADDED
@@ -0,0 +1,64 @@
1
+ jQuery(document).ready(function($) {
2
+ jQuery('.rtb-main-dashboard-review-ask').css('display', 'block');
3
+
4
+ jQuery('.rtb-main-dashboard-review-ask').on('click', function(event) {
5
+ if (jQuery(event.srcElement).hasClass('notice-dismiss')) {
6
+ var data = 'ask_review_time=3&action=rtb_hide_review_ask';
7
+ jQuery.post(ajaxurl, data, function() {});
8
+ }
9
+ });
10
+
11
+ jQuery('.rtb-review-ask-yes').on('click', function() {
12
+ jQuery('.rtb-review-ask-feedback-text').removeClass('rtb-hidden');
13
+ jQuery('.rtb-review-ask-starting-text').addClass('rtb-hidden');
14
+
15
+ jQuery('.rtb-review-ask-no-thanks').removeClass('rtb-hidden');
16
+ jQuery('.rtb-review-ask-review').removeClass('rtb-hidden');
17
+
18
+ jQuery('.rtb-review-ask-not-really').addClass('rtb-hidden');
19
+ jQuery('.rtb-review-ask-yes').addClass('rtb-hidden');
20
+
21
+ var data = 'ask_review_time=7&action=rtb_hide_review_ask';
22
+ jQuery.post(ajaxurl, data, function() {});
23
+ });
24
+
25
+ jQuery('.rtb-review-ask-not-really').on('click', function() {
26
+ jQuery('.rtb-review-ask-review-text').removeClass('rtb-hidden');
27
+ jQuery('.rtb-review-ask-starting-text').addClass('rtb-hidden');
28
+
29
+ jQuery('.rtb-review-ask-feedback-form').removeClass('rtb-hidden');
30
+ jQuery('.rtb-review-ask-actions').addClass('rtb-hidden');
31
+
32
+ var data = 'ask_review_time=1000&action=rtb_hide_review_ask';
33
+ jQuery.post(ajaxurl, data, function() {});
34
+ });
35
+
36
+ jQuery('.rtb-review-ask-no-thanks').on('click', function() {
37
+ var data = 'ask_review_time=1000&action=rtb_hide_review_ask';
38
+ jQuery.post(ajaxurl, data, function() {});
39
+
40
+ jQuery('.rtb-main-dashboard-review-ask').css('display', 'none');
41
+ });
42
+
43
+ jQuery('.rtb-review-ask-review').on('click', function() {
44
+ jQuery('.rtb-review-ask-feedback-text').addClass('rtb-hidden');
45
+ jQuery('.rtb-review-ask-thank-you-text').removeClass('rtb-hidden');
46
+
47
+ var data = 'ask_review_time=1000&action=rtb_hide_review_ask';
48
+ jQuery.post(ajaxurl, data, function() {});
49
+ });
50
+
51
+ jQuery('.rtb-review-ask-send-feedback').on('click', function() {
52
+ var feedback = jQuery('.rtb-review-ask-feedback-explanation textarea').val();
53
+ var email_address = jQuery('.rtb-review-ask-feedback-explanation input[name="feedback_email_address"]').val();
54
+ var data = 'feedback=' + feedback + '&email_address=' + email_address + '&action=rtb_send_feedback';
55
+ jQuery.post(ajaxurl, data, function() {});
56
+
57
+ var data = 'ask_review_time=1000&action=rtb_hide_review_ask';
58
+ jQuery.post(ajaxurl, data, function() {});
59
+
60
+ jQuery('.rtb-review-ask-feedback-form').addClass('rtb-hidden');
61
+ jQuery('.rtb-review-ask-review-text').addClass('rtb-hidden');
62
+ jQuery('.rtb-review-ask-thank-you-text').removeClass('rtb-hidden');
63
+ });
64
+ });
assets/js/plugin-deactivation.js ADDED
@@ -0,0 +1,53 @@
1
+ jQuery(function($){
2
+ var $deactivateLink = $('#the-list').find('[data-slug="restaurant-reservations"] span.deactivate a'),
3
+ $overlay = $('#rtb-deactivate-survey-restaurant-reservations'),
4
+ $form = $overlay.find('form'),
5
+ formOpen = false;
6
+ // Plugin listing table deactivate link.
7
+ $deactivateLink.on('click', function(event) {
8
+ event.preventDefault();
9
+ $overlay.css('display', 'table');
10
+ formOpen = true;
11
+ $form.find('.rtb-deactivate-survey-option:first-of-type input[type=radio]').focus();
12
+ });
13
+ // Survey radio option selected.
14
+ $form.on('change', 'input[type=radio]', function(event) {
15
+ event.preventDefault();
16
+ $form.find('input[type=text], .error').hide();
17
+ $form.find('.rtb-deactivate-survey-option').removeClass('selected');
18
+ $(this).closest('.rtb-deactivate-survey-option').addClass('selected').find('input[type=text]').show();
19
+ });
20
+ // Survey Skip & Deactivate.
21
+ $form.on('click', '.rtb-deactivate-survey-deactivate', function(event) {
22
+ event.preventDefault();
23
+ location.href = $deactivateLink.attr('href');
24
+ });
25
+ // Survey submit.
26
+ $form.submit(function(event) {
27
+ event.preventDefault();
28
+ if (! $form.find('input[type=radio]:checked').val()) {
29
+ $form.find('.rtb-deactivate-survey-footer').prepend('<span class="error">Please select an option below</span>');
30
+ return;
31
+ }
32
+ var data = {
33
+ code: $form.find('.selected input[type=radio]').val(),
34
+ install_time: $form.data('installtime'),
35
+ reason: $form.find('.selected .rtb-deactivate-survey-option-reason').text(),
36
+ details: $form.find('.selected input[type=text]').val(),
37
+ site: grfwp_deactivation_data.site_url,
38
+ plugin: 'Five-Star Restaurant Reservations'
39
+ }
40
+ var submitSurvey = $.post('https://www.fivestarplugins.com/key-check/Deactivation_Surveys.php', data);
41
+ submitSurvey.always(function() {
42
+ location.href = $deactivateLink.attr('href');
43
+ });
44
+ });
45
+ // Exit key closes survey when open.
46
+ $(document).keyup(function(event) {
47
+ if (27 === event.keyCode && formOpen) {
48
+ $overlay.hide();
49
+ formOpen = false;
50
+ $deactivateLink.focus();
51
+ }
52
+ });
53
+ });
assets/js/rtb-recaptcha.js ADDED
@@ -0,0 +1,5 @@
1
+ var rtbLoadRecaptcha = function() {
2
+ grecaptcha.render('rtb_recaptcha', {
3
+ 'sitekey' : rtb_recaptcha.site_key
4
+ });
5
+ }
assets/js/stripe-payment.js ADDED
@@ -0,0 +1,37 @@
1
+ if ( rtb_stripe_payment.stripe_mode == 'test' ) { Stripe.setPublishableKey(rtb_stripe_payment.test_publishable_key); }
2
+ else { Stripe.setPublishableKey(rtb_stripe_payment.live_publishable_key); }
3
+
4
+ function stripeResponseHandler(status, response) {
5
+ if (response.error) {
6
+ // show errors returned by Stripe
7
+ jQuery(".payment-errors").html(response.error.message);
8
+ // re-enable the submit button
9
+ jQuery('#stripe-submit').attr("disabled", false);
10
+ } else {
11
+ var form$ = jQuery("#stripe-payment-form");
12
+ // token contains id, last4, and card type
13
+ var token = response['id'];
14
+ // insert the token into the form so it gets submitted to the server
15
+ form$.append("<input type='hidden' name='stripeToken' value='" + token + "'/>");
16
+ // and submit
17
+ form$.get(0).submit();
18
+ }
19
+ }
20
+ jQuery(document).ready(function($) {
21
+ $("#stripe-payment-form").submit(function(event) {
22
+ // disable the submit button to prevent repeated clicks
23
+ $('#stripe-submit').attr("disabled", "disabled");
24
+
25
+ // send the card details to Stripe
26
+ Stripe.createToken({
27
+ number: $('input[data-stripe="card_number"]').val(),
28
+ cvc: $('input[data-stripe="card_cvc"]').val(),
29
+ exp_month: $('input[data-stripe="exp_month"]').val(),
30
+ exp_year: $('input[data-stripe="exp_year"]').val(),
31
+ currency: $('input[data-stripe="currency"]').val()
32
+ }, stripeResponseHandler);
33
+
34
+ // prevent the form from submitting with the default action
35
+ return false;
36
+ });
37
+ });
assets/js/stripe.js ADDED
@@ -0,0 +1,3 @@
1
+ /*! stripe-js 17-08-2016 */
2
+ (function(){var a,b,c,d,e,f,g,h,i,j={}.hasOwnProperty,k=function(a,b){function c(){this.constructor=a}for(var d in b)j.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};if(g="https://js.stripe.com",c="https://js.stripe.com",d=!!/stripe\.com#x2F;.test("undefined"!=typeof window&&null!==window?window.location.host:void 0),b="console"in window&&"warn"in window.console,!d&&"querySelectorAll"in document&&b&&(f=document.querySelectorAll('script[src^="'+g+'"]'),f.length||console.warn("It looks like Stripe.js is not being loaded from https://js.stripe.com. Stripe does not support serving Stripe.js from your own domain.")),this.Stripe)return!b||this.Stripe.isDoubleLoaded||this.Stripe.earlyError||console.warn("It looks like Stripe.js was loaded more than one time. Please only load it once per page."),void(this.Stripe.isDoubleLoaded=!0);this.Stripe=function(){function a(){}return a.version=2,a.endpoint="https://api.stripe.com/v1",a.setPublishableKey=function(b){return a.key=b,a.utils.validateProtocol(a.key)},a._language="en-US",a.setLanguage=function(b){return a._language=b},a._allowedCustomHeaders=["X-Stripe-Livemode","Authorization"],a._customHeaders={},a._setCustomHeader=function(a,b){var c,d,e,f,g;for(d=!1,g=this._allowedCustomHeaders,e=0,f=g.length;e<f;e++)if(c=g[e],c===a){this._customHeaders[a]=b,d=!0;break}return d},a.trackPerf=!1,a._isChannel="#__stripe_transport__"===("undefined"!=typeof window&&null!==window?window.location.hash:void 0),a._isSafeStripeDomain=d,a._iframeOnAmount=1,a._isSafeDomain=function(){return"#__forcedss3__"!==window.location.hash&&(!(!a._isSafeStripeDomain&&!window.StripeTemporaryNoDSS3)||a._iframeOnAmount<Math.random())}(),a._finalTransport="undefined"!=typeof window&&null!==window&&"XMLHttpRequest"in window&&"withCredentials"in new XMLHttpRequest?"cors":"jsonp",a._transport=a._isChannel||a._isSafeDomain?a._finalTransport:"iframe",a._fallBackToOldStripeJsTechniques=function(){return this._transport="jsonp",this._finalTransport="jsonp",this._isSafeDomain="true"},a._iframeRequestQueue=[],a._iframePendingRequests={},a._iframeChannelStatus="pending",a._iframeChannelComplete=function(b){var c,d,e,f;for(this._iframeChannelStatus=b?"success":"failure","failure"===this._iframeChannelStatus&&this._fallBackToOldStripeJsTechniques(),d=this._iframeRequestQueue,delete this._iframeRequestQueue,this._iframeRequestQueue=[],e=0,f=d.length;e<f;e++)c=d[e],this.request(c,!0);this._iframeChannelComplete=function(){return a.reportError("CompleteDuplicationError")}},a.request=function(a,b){return this.trackPerf&&a.tokenType?this._instrumentedRequest(a,b):this._rawRequest(a,b)},a._rawRequest=function(b,c){var d,e,f;if(b.data||(b.data={}),e="POST"===b.method&&"object"==typeof(null!=(f=b.data)?f.card:void 0),c||(null!=b.data.payment_user_agent?this._isChannel||(b.data.payment_user_agent=""+b.data.payment_user_agent+" ("+a.stripejs_ua+")"):b.data.payment_user_agent=a.stripejs_ua),"iframe"===this._transport){if(e)return"pending"===this._iframeChannelStatus?this._iframeRequestQueue.push(b):"failure"===this._iframeChannelStatus?this.ajaxJSONP(b):this.iframe(b);if("cors"===this._finalTransport)try{return this.xhr(b)}catch(g){return d=g,this._transport="jsonp",this.request(b,!0)}return this.ajaxJSONP(b)}if("cors"===this._transport)try{return this.xhr(b)}catch(g){return d=g,a.reportError("XhrThrewError"),this._transport="jsonp",this.request(b,!0)}return this.ajaxJSONP(b)},a.reportError=function(b,c){var d;return"console"in window&&"warn"in window.console,1,d=Math.round((new Date).getTime()/1e3),(new Image).src="https://q.stripe.com?event=stripejs-error&type="+encodeURIComponent(b)+(c?"&timing="+c:"")+"&key="+a.key+"&timestamp="+d+"&payment_user_agent="+encodeURIComponent(a.stripejs_ua)},a._instrumentedRequest=function(b,c){var d,e;return d=(new Date).getTime(),e=function(c){return function(e,f){var g,h,i,j,k;return j=null!=(k=b.tokenType)?k:"unknown",g=(new Date).getTime(),h=c._getResourceTiming(null!=e?e.responseURL:void 0),i={event:"rum.stripejs",tokenType:j,url:b.url,status:f,start:d,end:g,resourceTiming:h},a.logRUM(i)}}(this),b.success=function(a){return function(b,c,d){return e(d,c),a.apply(this,arguments)}}(b.success),b.complete=function(a){return function(b,c,d){return"success"!==b&&e(c,b),a.apply(this,arguments)}}(b.complete),this._rawRequest(b,c)},a._getResourceTiming=function(a){var b;switch(b="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.getEntriesByName?performance.getEntriesByName(a):void 0,!1){case 1!==(null!=b?b.length:void 0):return this._sanitizeResourceTiming(b[0]);case 0!==(null!=b?b.length:void 0):return{errorMsg:"No resource timing entries found"};case null==(null!=b?b.length:void 0):return{errorMsg:"More than one resource timing entry"};default:return null}},a._resourceTimingWhitelist=["connectEnd","connectStart","domainLookupEnd","domainLookupStart","duration","fetchStart","redirectEnd","redirectStart","requestStart","responseEnd","responseStart","secureConnectionStart","startTime"],a._sanitizeResourceTiming=function(a){var b,c,d,e,f;for(c={},f=this._resourceTimingWhitelist,d=0,e=f.length;d<e;d++)b=f[d],a[b]&&(c[b]=a[b]);return c},a.logRUM=function(b){return(new Image).src="https://q.stripe.com/?"+a.utils.serialize(b)},a.complete=function(b,c){return function(d,e,f){if("success"!==d)return a.reportError("Complete500-"+d),"function"==typeof b?b(500,{error:{code:d,type:d,message:c}}):void 0}},a._iframeBaseUrl=c,a._stripejsBaseUrl=g,a._relayResponse=function(b,c,d){return a._socket.postMessage(a.JSON.stringify({code:c,resp:d,requestId:b}))},a._callCount=0,a._callCache={},a._receiveChannelRelay=function(b,c){var d,e,f,g;if(f=a._iframeBaseUrl.replace(/^https?:\/\//,"").replace(/\/.*#x2F;,""),g=c.replace(/^https?:\/\//,"").replace(/\/.*#x2F;,""),g===f&&"string"==typeof b){try{e=a.JSON.parse(b)}catch(h){throw d=h,a.reportError("InvalidJSON-ChannelRelay"),new Error("Stripe.js received invalid JSON")}if("function"==typeof a._callCache[e.requestId])return a._callCache[e.requestId](e.resp,e.code),delete a._callCache[e.requestId]}},a._channelListener=function(b,c){var d,e,f,g;if("string"==typeof b){try{g=a.JSON.parse(b)}catch(h){throw e=h,a.reportError("InvalidJSON-ChannelListener"),new Error("Stripe.js received invalid JSON")}if(d=g.data.card,delete g.data.card,f=g.headers["Accept-Language"],d)return a.setPublishableKey(g.data.key),f&&a.setLanguage(f),null!=g.endpoint&&(a.endpoint=g.endpoint),null!=g.trackPerf&&(a.trackPerf=g.trackPerf),a.card.createToken(d,g.data,function(b,c){return a._relayResponse(g.requestId,b,c)});throw a.reportError("InvalidChannelUse-NonCard"),new Error("Stripe.js iframe transport used for non-card request")}},a}(),this.Stripe.token=function(){function a(){}return a.validate=function(a,b){if(!a)throw b+" required";if("object"!=typeof a)throw b+" invalid"},a.formatData=function(a,b){var c,d,e;Stripe.utils.isElement(a)&&(a=Stripe.utils.paramsFromForm(a,b));for(c in a)d=a[c],null==d&&delete a[c];if(Stripe.utils.underscoreKeys(a),"string"==typeof a.exp){try{e=Stripe.utils.parseExpString(a.exp),a.exp_month=e[0],a.exp_year=e[1]}catch(f){a.exp_month=0,a.exp_year=0}delete a.exp}return a},a.create=function(a,b){var c,d;return a.key||(a.key=Stripe.key||Stripe.publishableKey),Stripe.utils.validateKey(a.key),d=function(){switch(!1){case null==a.card:return"card";case null==a.bank_account:return"bank_account";case null==a.pii:return"pii";case null==a.apple_pay:return"apple_pay";default:return"unknown"}}(),delete a.apple_pay,c={url:""+Stripe.endpoint+"/tokens",data:a,method:"POST",headers:{},success:function(a,c){return"function"==typeof b?b(c,a):void 0},complete:Stripe.complete(b,"A network error has occurred, and you have not been charged. Please try again."),timeout:4e4,tokenType:d},Stripe._language&&(c.headers["Accept-Language"]=Stripe._language),Stripe.request(c)},a.get=function(a,b){if(!a)throw new Error("token required");return Stripe.utils.validateKey(Stripe.key),Stripe.request({url:""+Stripe.endpoint+"/tokens/"+a,data:{key:Stripe.key},success:function(a,c){return"function"==typeof b?b(c,a):void 0},complete:Stripe.complete(b,"A network error has occurred loading data from Stripe. Please try again."),timeout:4e4})},a}(),this.Stripe.card=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return k(b,a),b.tokenName="card",b.whitelistedAttrs=["number","cvc","exp","exp_month","exp_year","name","address_line1","address_line2","address_city","address_state","address_zip","address_country","currency"],b.createToken=function(a,c,d){var e;return null==c&&(c={}),Stripe.token.validate(a,"card"),"function"==typeof c?(d=c,c={}):"object"!=typeof c&&(e=parseInt(c,10),c={},e>0&&(c.amount=e)),c[b.tokenName]=Stripe.token.formatData(a,b.whitelistedAttrs),Stripe.token.create(c,d)},b.getToken=function(a,b){return Stripe.token.get(a,b)},b.validateCardNumber=function(a){return a=(a+"").replace(/\s+|-/g,""),a.length>=10&&a.length<=16&&b.luhnCheck(a)},b.validateCVC=function(a){return a=Stripe.utils.trim(a),/^\d+#x2F;.test(a)&&a.length>=3&&a.length<=4},b.validateExpiry=function(a,b){var c,d,e,f;if(null!=b)e=Stripe.utils.trim(a),b=Stripe.utils.trim(b);else{try{f=Stripe.utils.parseExpString(a),e=f[0],b=f[1]}catch(g){return!1}e+="",b+=""}return!!/^\d+#x2F;.test(e)&&(!!/^\d+#x2F;.test(b)&&(1<=e&&e<=12&&(2===b.length&&(b=b<70?"20"+b:"19"+b),4===b.length&&(d=new Date(b,e),c=new Date,d.setMonth(d.getMonth()-1),d.setMonth(d.getMonth()+1,1),d>c))))},b.luhnCheck=function(a){var b,c,d,e,f,g;for(d=!0,e=0,c=(a+"").split("").reverse(),f=0,g=c.length;f<g;f++)b=c[f],b=parseInt(b,10),(d=!d)&&(b*=2),b>9&&(b-=9),e+=b;return e%10===0},b.cardType=function(a){return b.cardTypes[a.slice(0,2)]||"Unknown"},b.cardBrand=function(a){return b.cardType(a)},b.cardTypes=function(){var a,b,c,d;for(b={},a=c=40;c<=49;a=++c)b[a]="Visa";for(a=d=50;d<=59;a=++d)b[a]="MasterCard";return b[34]=b[37]="American Express",b[60]=b[62]=b[64]=b[65]="Discover",b[35]="JCB",b[30]=b[36]=b[38]=b[39]="Diners Club",b}(),b}(this.Stripe.token),this.Stripe.bankAccount=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return k(b,a),b.tokenName="bank_account",b.whitelistedAttrs=["country","currency","routing_number","account_number","name","account_holder_type","account_holder_name"],b.createToken=function(a,c,d){return null==c&&(c={}),Stripe.token.validate(a,"bank account"),"function"==typeof c&&(d=c,c={}),c[b.tokenName]=Stripe.token.formatData(a,b.whitelistedAttrs),Stripe.token.create(c,d)},b.getToken=function(a,b){return Stripe.token.get(a,b)},b.validateRoutingNumber=function(a,c){switch(a=Stripe.utils.trim(a),c){case"US":return/^\d+#x2F;.test(a)&&9===a.length&&b.routingChecksum(a);case"CA":return/\d{5}\-\d{3}/.test(a)&&9===a.length;default:return!0}},b.validateAccountNumber=function(a,b){switch(a=Stripe.utils.trim(a),b){case"US":return/^\d+#x2F;.test(a)&&a.length>=1&&a.length<=17;default:return!0}},b.routingChecksum=function(a){var b,c,d,e,f,g;for(d=0,b=(a+"").split(""),g=[0,3,6],e=0,f=g.length;e<f;e++)c=g[e],d+=3*parseInt(b[c]),d+=7*parseInt(b[c+1]),d+=parseInt(b[c+2]);return 0!==d&&d%10===0},b}(this.Stripe.token),this.Stripe.piiData=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return k(b,a),b.tokenName="pii",b.whitelistedAttrs=["personal_id_number"],b.createToken=function(a,c,d){return null==c&&(c={}),Stripe.token.validate(a,"pii data"),"function"==typeof c&&(d=c,c={}),c[b.tokenName]=Stripe.token.formatData(a,b.whitelistedAttrs),Stripe.token.create(c,d)},b.getToken=function(a,b){return Stripe.token.get(a,b)},b}(this.Stripe.token),this.Stripe._poller=function(){function a(){}return a._activePolls={},a._clearPoll=function(b){return delete a._activePolls[b]},a._defaultPollInterval=1500,a._maxPollInterval=24e3,a._initPoll=function(b){if(null!=a._activePolls[b])throw new Error("You are already polling "+b+". Please cancel that poll before polling it again.");return a._activePolls[b]={}},a._poll=function(b,c,d,e,f){c(b,function(g,h){var i;if(null!=a._activePolls[b])return g>=400&&g<500?(a._clearPoll(b),"function"==typeof f?f(g,h):void 0):200===g&&e(b,h)?(a._clearPoll(b),"function"==typeof f?f(g,h):void 0):(200===g&&d(b,h)&&"function"==typeof f&&f(g,h),500===g&&2*a._activePolls[b].interval<=a._maxPollInterval?a._activePolls[b].interval*=2:g>=200&&g<500&&(a._activePolls[b].interval=a._defaultPollInterval),i=setTimeout(function(){return a._poll(b,c,d,e,f)},a._activePolls[b].interval),a._activePolls[b].timeoutId=i)})},a._cancelPoll=function(b){var c;if(c=a._activePolls[b],null==c)throw new Error("You are not polling "+b+".");null!=c.timeoutId&&clearTimeout(c.timeoutId),a._clearPoll(b)},a}(),this.Stripe.bitcoinReceiver=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return k(b,a),b._whitelistedAttrs=["amount","currency","email","description"],b.createReceiver=function(a,b){var c;return Stripe.token.validate(a,"bitcoin_receiver data"),c=Stripe.token.formatData(a,this._whitelistedAttrs),c.key=Stripe.key||Stripe.publishableKey,Stripe.utils.validateKey(c.key),Stripe.request({url:""+Stripe.endpoint+"/bitcoin/receivers",data:c,method:"POST",success:function(a,c){return"function"==typeof b?b(c,a):void 0},complete:Stripe.complete(b,"A network error has occurred while creating a Bitcoin address. Please try again."),timeout:4e4})},b.getReceiver=function(a,b){var c;if(!a)throw new Error("receiver id required");return c=Stripe.key||Stripe.publishableKey,Stripe.utils.validateKey(c),Stripe.request({url:""+Stripe.endpoint+"/bitcoin/receivers/"+a,data:{key:c},success:function(a,c){return"function"==typeof b?b(c,a):void 0},complete:Stripe.complete(b,"A network error has occurred loading data from Stripe. Please try again."),timeout:4e4})},b.pollReceiver=function(a,b){return this._initPoll(a),this._poll(a,function(a){return function(b,c){return a.getReceiver(b,c)}}(this),function(a,b){return!1},function(a,b){return b.filled},b)},b.cancelReceiverPoll=function(a){return b._cancelPoll(a)},b}(this.Stripe._poller),this.Stripe.source=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return k(b,a),b.get=function(a,b,c){var d,e;if(!a)throw new Error("sourceId required");if(!b)throw new Error("clientSecret required");return d=Stripe.key||Stripe.publishableKey,Stripe.utils.validateKey(d),e={},e.key=d,e.client_secret=b,Stripe.request({url:""+Stripe.endpoint+"/sources/"+a,data:e,success:function(a,b){return"function"==typeof c?c(b,a):void 0},complete:Stripe.complete(c,"A network error has occurred loading data from Stripe. Please try again."),timeout:4e4})},b.poll=function(a,b,c){return this._initPoll(a),this._poll(a,function(a){return function(c,d){return a.get(c,b,d)}}(this),function(a){return function(b,c){return a._activePolls[b].source_status!==c.status&&(a._activePolls[b].source_status=c.status,!0)}}(this),function(a,b){return!1},c)},b.cancelPoll=function(a){return this._cancelPoll(a)},b}(this.Stripe._poller),this.Stripe.threeDSecure=function(){function a(){}return a.create=function(a,b){var c;if("object"!=typeof a)throw new Error("params must be an object.");if("function"!=typeof b)throw new Error("callback must be a function.");return a.key||(a.key=Stripe.key||Stripe.publishableKey),a.return_url||(a.return_url="_callback"),Stripe.utils.validateKey(a.key),c={url:""+Stripe.endpoint+"/3d_secure",data:a,method:"POST",headers:{},success:function(a,c){return"function"==typeof b?b(c,a):void 0},complete:Stripe.complete(b,"A network error has occurred, and you have not been charged. Please try again."),timeout:4e4,tokenType:"three_d_secure"},Stripe._language&&(c.headers["Accept-Language"]=Stripe._language),Stripe.request(c),null},a.createIframe=function(a,b,c){var d,e;if(e=null,!Stripe.validator.isUrl(a))throw new Error("redirectUrl must be a valid URL.");if(!Stripe.validator.isElementOrId(b))throw new Error("parentElement must be a DOM Element, or the ID of a DOM element.");if("function"!=typeof c)throw new Error("callback must be a function.");return d=function(a,b){var d,f;try{f=Stripe.JSON.parse(a)}catch(g){throw d=g,Stripe.reportError("InvalidJSON-3DSecureCallback"),new Error("Stripe.js received invalid JSON")}return e.destroy(),c(f)},e=new Stripe.easyXDM.Socket({swf:""+Stripe._iframeBaseUrl+"/v2/stripexdm.swf",remote:a,onMessage:d,container:b}),null},a}(),this.Stripe.applePay=function(){function a(){}return a.checkAvailability=function(a){var b;if(null==a)throw new Error("This function executes asynchronously; please pass it a callback function.");return(null!=(b=window.ApplePaySession)?b.canMakePayments():void 0)?ApplePaySession.canMakePaymentsWithActiveCard("merchant."+window.location.hostname+".stripe").then(function(b){return a(b)}):void a(!1)},a.buildSession=function(a,b,c){var d,e,f,g;if(null==window.ApplePaySession)throw new Error("Apple Pay is not supported in this browser. You should check the result of Stripe.applePay.checkAvailability before calling this method");return a.supportedNetworks=["amex","discover","masterCard","visa"],a.merchantCapabilities||(a.merchantCapabilities=["supports3DS"]),e=null!=(g=a.shippingMethods)?g[0]:void 0,f=new ApplePaySession(1,a),d=function(a){var b;return b=(null!=a?a.error:void 0)||{message:"Something went wrong validating your Apple Pay Session."},null!=b.message&&console.warn(b.message),f.abort(),"function"==typeof c?c(b):void 0},f.addEventListener("shippingmethodselected",function(a){return e=a.shippingMethod}),f.addEventListener("validatemerchant",function(b){var c;return c={method:"POST",url:""+Stripe.endpoint+"/apple_pay/sessions",data:{key:Stripe.key||Stripe.publishableKey,validation_url:b.validationURL,domain_name:window.location.hostname,display_name:a.total.label},success:function(a,b){var c;return null!=a.session?(c=Stripe.JSON.parse(a.session),f.completeMerchantValidation(c)):d(a)},complete:function(a,b,c){if("success"!==a)return d(b)},timeout:4e4},Stripe.request(c)}),f.addEventListener("paymentauthorized",function(a){return Stripe.applePay.createToken(a.payment,function(d,g){var h;return null!=g.error?(f.completePayment(ApplePaySession.STATUS_FAILURE),"function"==typeof c?c(g.error):void 0):(h={token:g},null!=e&&(h.shippingMethod=e),null!=a.payment.shippingContact&&(h.shippingContact=a.payment.shippingContact),b(h,function(a){return a?f.completePayment(ApplePaySession.STATUS_SUCCESS):f.completePayment(ApplePaySession.STATUS_FAILURE)}))})}),f},a.createToken=function(a,b){var c,d,e;return c={apple_pay:!0,pk_token:Stripe.JSON.stringify(a.token.paymentData),pk_token_transaction_id:a.token.transactionIdentifier,pk_token_payment_network:a.token.paymentMethod.network,pk_token_instrument_name:a.token.paymentMethod.displayName},null!=a.billingContact&&(c.card={name:[a.billingContact.givenName,a.billingContact.familyName].join(" ").trim(),address_line1:null!=(d=a.billingContact.addressLines)?d[0]:void 0,address_line2:null!=(e=a.billingContact.addressLines)?e[1]:void 0,address_city:a.billingContact.locality,address_state:a.billingContact.administrativeArea,address_zip:a.billingContact.postalCode,address_country:a.billingContact.countryCode}),Stripe.token.create(c,b)},a}(),a=["createToken","getToken","cardType","validateExpiry","validateCVC","validateCardNumber"];for(h=0,i=a.length;h<i;h++)e=a[h],this.Stripe[e]=this.Stripe.card[e];this.Stripe.stripejs_ua="stripe.js/47e2c03","undefined"!=typeof module&&null!==module&&(module.exports=this.Stripe),"function"==typeof define&&define("stripe",[],function(a){return function(){return a.Stripe}}(this))}).call(this),function(){this.Stripe.isDoubleLoaded||function(a){function b(a,e){function f(a){if(f[a]!==q)return f[a];var b;if("bug-string-char-index"==a)b="a"!="a"[0];else if("json"==a)b=f("json-stringify")&&f("json-parse");else{var c,d='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==a){var i=e.stringify,k="function"==typeof i&&t;if(k){(c=function(){return 1}).toJSON=c;try{k="0"===i(0)&&"0"===i(new g)&&'""'==i(new h)&&i(s)===q&&i(q)===q&&i()===q&&"1"===i(c)&&"[1]"==i([c])&&"[null]"==i([q])&&"null"==i(null)&&"[null,null,null]"==i([q,s,null])&&i({a:[c,!0,!1,null,"\0\b\n\f\r\t"]})==d&&"1"===i(null,c)&&"[\n 1,\n 2\n]"==i([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==i(new j((-864e13)))&&'"+275760-09-13T00:00:00.000Z"'==i(new j(864e13))&&'"-000001-01-01T00:00:00.000Z"'==i(new j((-621987552e5)))&&'"1969-12-31T23:59:59.999Z"'==i(new j((-1)))}catch(l){k=!1}}b=k}if("json-parse"==a){var m=e.parse;if("function"==typeof m)try{if(0===m("0")&&!m(!1)){c=m(d);var n=5==c.a.length&&1===c.a[0];if(n){try{n=!m('"\t"')}catch(l){}if(n)try{n=1!==m("01")}catch(l){}if(n)try{n=1!==m("1.")}catch(l){}}}}catch(l){n=!1}b=n}}return f[a]=!!b}a||(a=d.Object()),e||(e=d.Object());var g=a.Number||d.Number,h=a.String||d.String,i=a.Object||d.Object,j=a.Date||d.Date,k=a.SyntaxError||d.SyntaxError,l=a.TypeError||d.TypeError,m=a.Math||d.Math,n=a.JSON||d.JSON;"object"==typeof n&&n&&(e.stringify=n.stringify,e.parse=n.parse);var o,p,q,r=i.prototype,s=r.toString,t=new j((-0xc782b5b800cec));try{t=t.getUTCFullYear()==-109252&&0===t.getUTCMonth()&&1===t.getUTCDate()&&10==t.getUTCHours()&&37==t.getUTCMinutes()&&6==t.getUTCSeconds()&&708==t.getUTCMilliseconds()}catch(u){}if(!f("json")){var v="[object Function]",w="[object Date]",x="[object Number]",y="[object String]",z="[object Array]",A="[object Boolean]",B=f("bug-string-char-index");if(!t)var C=m.floor,D=[0,31,59,90,120,151,181,212,243,273,304,334],E=function(a,b){return D[b]+365*(a-1970)+C((a-1969+(b=+(b>1)))/4)-C((a-1901+b)/100)+C((a-1601+b)/400)};if((o=r.hasOwnProperty)||(o=function(a){var b,c={};return(c.__proto__=null,c.__proto__={toString:1},c).toString!=s?o=function(a){var b=this.__proto__,c=a in(this.__proto__=null,this);return this.__proto__=b,c}:(b=c.constructor,o=function(a){var c=(this.constructor||b).prototype;return a in this&&!(a in c&&this[a]===c[a])}),c=null,o.call(this,a)}),p=function(a,b){var d,e,f,g=0;(d=function(){this.valueOf=0}).prototype.valueOf=0,e=new d;for(f in e)o.call(e,f)&&g++;return d=e=null,g?p=2==g?function(a,b){var c,d={},e=s.call(a)==v;for(c in a)e&&"prototype"==c||o.call(d,c)||!(d[c]=1)||!o.call(a,c)||b(c)}:function(a,b){var c,d,e=s.call(a)==v;for(c in a)e&&"prototype"==c||!o.call(a,c)||(d="constructor"===c)||b(c);(d||o.call(a,c="constructor"))&&b(c)}:(e=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],p=function(a,b){var d,f,g=s.call(a)==v,h=!g&&"function"!=typeof a.constructor&&c[typeof a.hasOwnProperty]&&a.hasOwnProperty||o;for(d in a)g&&"prototype"==d||!h.call(a,d)||b(d);for(f=e.length;d=e[--f];h.call(a,d)&&b(d));}),p(a,b)},!f("json-stringify")){var F={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},G="000000",H=function(a,b){return(G+(b||0)).slice(-a)},I="\\u00",J=function(a){for(var b='"',c=0,d=a.length,e=!B||d>10,f=e&&(B?a.split(""):a);c<d;c++){var g=a.charCodeAt(c);switch(g){case 8:case 9:case 10:case 12:case 13:case 34:case 92:b+=F[g];break;default:if(g<32){b+=I+H(2,g.toString(16));break}b+=e?f[c]:a.charAt(c)}}return b+'"'},K=function(a,b,c,d,e,f,g){var h,i,j,k,m,n,r,t,u,v,B,D,F,G,I,L;try{h=b[a]}catch(M){}if("object"==typeof h&&h)if(i=s.call(h),i!=w||o.call(h,"toJSON"))"function"==typeof h.toJSON&&(i!=x&&i!=y&&i!=z||o.call(h,"toJSON"))&&(h=h.toJSON(a));else if(h>-1/0&&h<1/0){if(E){for(m=C(h/864e5),j=C(m/365.2425)+1970-1;E(j+1,0)<=m;j++);for(k=C((m-E(j,0))/30.42);E(j,k+1)<=m;k++);m=1+m-E(j,k),n=(h%864e5+864e5)%864e5,r=C(n/36e5)%24,t=C(n/6e4)%60,u=C(n/1e3)%60,v=n%1e3}else j=h.getUTCFullYear(),k=h.getUTCMonth(),m=h.getUTCDate(),r=h.getUTCHours(),t=h.getUTCMinutes(),u=h.getUTCSeconds(),v=h.getUTCMilliseconds();h=(j<=0||j>=1e4?(j<0?"-":"+")+H(6,j<0?-j:j):H(4,j))+"-"+H(2,k+1)+"-"+H(2,m)+"T"+H(2,r)+":"+H(2,t)+":"+H(2,u)+"."+H(3,v)+"Z"}else h=null;if(c&&(h=c.call(b,a,h)),null===h)return"null";if(i=s.call(h),i==A)return""+h;if(i==x)return h>-1/0&&h<1/0?""+h:"null";if(i==y)return J(""+h);if("object"==typeof h){for(G=g.length;G--;)if(g[G]===h)throw l();if(g.push(h),B=[],I=f,f+=e,i==z){for(F=0,G=h.length;F<G;F++)D=K(F,h,c,d,e,f,g),B.push(D===q?"null":D);L=B.length?e?"[\n"+f+B.join(",\n"+f)+"\n"+I+"]":"["+B.join(",")+"]":"[]"}else p(d||h,function(a){var b=K(a,h,c,d,e,f,g);b!==q&&B.push(J(a)+":"+(e?" ":"")+b)}),L=B.length?e?"{\n"+f+B.join(",\n"+f)+"\n"+I+"}":"{"+B.join(",")+"}":"{}";return g.pop(),L}};e.stringify=function(a,b,d){var e,f,g,h;if(c[typeof b]&&b)if((h=s.call(b))==v)f=b;else if(h==z){g={};for(var i,j=0,k=b.length;j<k;i=b[j++],h=s.call(i),(h==y||h==x)&&(g[i]=1));}if(d)if((h=s.call(d))==x){if((d-=d%1)>0)for(e="",d>10&&(d=10);e.length<d;e+=" ");}else h==y&&(e=d.length<=10?d:d.slice(0,10));return K("",(i={},i[""]=a,i),f,g,e,"",[])}}if(!f("json-parse")){var L,M,N=h.fromCharCode,O={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},P=function(){throw L=M=null,k()},Q=function(){for(var a,b,c,d,e,f=M,g=f.length;L<g;)switch(e=f.charCodeAt(L)){case 9:case 10:case 13:case 32:L++;break;case 123:case 125:case 91:case 93:case 58:case 44:return a=B?f.charAt(L):f[L],L++,a;case 34:for(a="@",L++;L<g;)if(e=f.charCodeAt(L),e<32)P();else if(92==e)switch(e=f.charCodeAt(++L)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:a+=O[e],L++;break;case 117:for(b=++L,c=L+4;L<c;L++)e=f.charCodeAt(L),e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70||P();a+=N("0x"+f.slice(b,L));break;default:P()}else{if(34==e)break;for(e=f.charCodeAt(L),b=L;e>=32&&92!=e&&34!=e;)e=f.charCodeAt(++L);a+=f.slice(b,L)}if(34==f.charCodeAt(L))return L++,a;P();default:if(b=L,45==e&&(d=!0,e=f.charCodeAt(++L)),e>=48&&e<=57){for(48==e&&(e=f.charCodeAt(L+1),e>=48&&e<=57)&&P(),d=!1;L<g&&(e=f.charCodeAt(L),e>=48&&e<=57);L++);if(46==f.charCodeAt(L)){for(c=++L;c<g&&(e=f.charCodeAt(c),e>=48&&e<=57);c++);c==L&&P(),L=c}if(e=f.charCodeAt(L),101==e||69==e){for(e=f.charCodeAt(++L),43!=e&&45!=e||L++,c=L;c<g&&(e=f.charCodeAt(c),e>=48&&e<=57);c++);c==L&&P(),L=c}return+f.slice(b,L)}if(d&&P(),"true"==f.slice(L,L+4))return L+=4,!0;if("false"==f.slice(L,L+5))return L+=5,!1;if("null"==f.slice(L,L+4))return L+=4,null;P()}return"quot;},R=function(a){var b,c;if("quot;==a&&P(),"string"==typeof a){if("@"==(B?a.charAt(0):a[0]))return a.slice(1);if("["==a){for(b=[];a=Q(),"]"!=a;c||(c=!0))c&&(","==a?(a=Q(),"]"==a&&P()):P()),","==a&&P(),b.push(R(a));return b}if("{"==a){for(b={};a=Q(),"}"!=a;c||(c=!0))c&&(","==a?(a=Q(),"}"==a&&P()):P()),","!=a&&"string"==typeof a&&"@"==(B?a.charAt(0):a[0])&&":"==Q()||P(),b[a.slice(1)]=R(Q());return b}P()}return a},S=function(a,b,c){var d=T(a,b,c);d===q?delete a[b]:a[b]=d},T=function(a,b,c){var d,e=a[b];if("object"==typeof e&&e)if(s.call(e)==z)for(d=e.length;d--;)S(e,d,c);else p(e,function(a){S(e,a,c)});return c.call(a,b,e)};e.parse=function(a,b){var c,d;return L=0,M=""+a,c=R(Q()),"quot;!=Q()&&P(),L=M=null,b&&s.call(b)==v?T((d={},d[""]=c,d),"",b):c}}}return e.runInContext=b,e}var c={"function":!0,object:!0},d=this,e=b(a,d);d.JSON={parse:e.parse,stringify:e.stringify}}.call(Stripe,this)}.call(this),function(){this.Stripe.isDoubleLoaded||!function(a,b,c,d,e,f){function g(a,b){var c=typeof a[b];return"function"==c||!("object"!=c||!a[b])||"unknown"==c}function h(){var a="Shockwave Flash",b="application/x-shockwave-flash";if(!p(navigator.plugins)&&"object"==typeof navigator.plugins[a]){var c=navigator.plugins[a].description;c&&!p(navigator.mimeTypes)&&navigator.mimeTypes[b]&&navigator.mimeTypes[b].enabledPlugin&&(x=c.match(/\d+/g))}if(!x){var d;try{d=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),x=Array.prototype.slice.call(d.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/),1),d=null}catch(e){}}if(!x)return!1;var f=parseInt(x[0],10),g=parseInt(x[1],10);return y=f>9&&g>0,!0}function i(){if(!L){L=!0;for(var a=0;a<M.length;a++)M[a]();M.length=0}}function j(a,b){return L?void a.call(b):void M.push(function(){a.call(b)})}function k(a){return a.match(D)[3]}function l(a){return a.match(D)[4]||""}function m(a){var b,c,d=a.toLowerCase().match(D),e="",f="";try{b=d[2],c=d[3],e=d[4]||"",("http:"==b&&":80"==e||"https:"==b&&":443"==e)&&(e=""),f=b+"//"+c+e}catch(g){f=a}return f}function n(a){if(a=a.replace(F,"$1/"),!a.match(/^(http||https):\/\//)){var b="/"===a.substring(0,1)?"":c.pathname;"/"!==b.substring(b.length-1)&&(b=b.substring(0,b.lastIndexOf("/")+1)),a=c.protocol+"//"+c.host+b+a}for(;E.test(a);)a=a.replace(E,"");return a}function o(a,b){var c="",d=a.indexOf("#");d!==-1&&(c=a.substring(d),a=a.substring(0,d));var e,g=[];for(var h in b)b.hasOwnProperty(h)&&(e="stripe_"+h,g.push(e+"="+f(b[h])));return a+(J?"#":a.indexOf("?")==-1?"?":"&")+g.join("&")+c}function p(a){return"undefined"==typeof a}function q(a,b,c){var d;for(var e in b)b.hasOwnProperty(e)&&(e in a?(d=b[e],"object"==typeof d?q(a[e],d,c):c||(a[e]=b[e])):a[e]=b[e]);return a}function r(){var a=b.body.appendChild(b.createElement("form")),c=a.appendChild(b.createElement("input"));c.name=I+"TEST"+C,w=c!==a.elements[c.name],b.body.removeChild(a)}function s(c){p(w)&&r();var e;w?e=b.createElement('<iframe name="'+c.props.name+'"/>'):(e=b.createElement("IFRAME"),e.name=c.props.name),e.id=e.name=c.props.name,delete c.props.name,"string"==typeof c.container&&(c.container=b.getElementById(c.container)),c.container||(q(e.style,{position:"absolute",top:"-2000px",left:"0px"}),c.container=b.body);var f=c.props.src;c.props.src="about:blank",q(e,c.props),e.border=e.frameBorder=0,e.allowTransparency=!0;var g=!1;return c.onFrameAck&&"postMessage"in a&&a.addEventListener?a.addEventListener("message",function(a){var b=Stripe._iframeBaseUrl.replace(/^https?:\/\//,"").replace(/\/.*#x2F;,""),d=a.origin.replace(/^https?:\/\//,"").replace(/\/.*#x2F;,"");b===d&&"stripe:ack"===a.data&&c.onFrameAck(!0)},!1):g=!0,c.container.appendChild(e),c.onLoad&&z(e,"load",function(){c.onLoad.apply(c,arguments),g&&c.onFrameAck(!1)}),c.onError&&z(e,"error",function(){c.onError.apply(c,arguments)}),e.src=f,c.onAsyncInject&&d(function(){c.onAsyncInject.call(c,e)},5e3),c.props.src=f,e}function t(c){var d,e=c.protocol;if(c.isHost=c.isHost||p(O.xdm_p),J=c.hash||!1,c.props||(c.props={}),c.isHost){if(c.remote=n(c.remote),c.channel=c.channel||"default"+C++,c.secret=Math.random().toString(16).substring(2),p(e))if(g(a,"postMessage")||g(b,"postMessage"))e="1";else{if(!(c.swf&&g(a,"ActiveXObject")&&h()))throw new Error("No suitable transport protocol for Stripe.js");e="6"}}else c.channel=O.xdm_c.replace(/["'<>\\]/g,""),c.secret=O.xdm_s,c.remote=O.xdm_e.replace(/["'<>\\]/g,""),e=O.xdm_p;switch(c.protocol=e,e){case"1":d=[new H.stack.PostMessageTransport(c)];break;case"6":x||h(),d=[new H.stack.FlashTransport(c)]}return d?(d.push(new H.stack.QueueBehavior({lazy:c.lazy,remove:!0})),d):void c.onInternalError.call(c,"BadXDMProtocol")}function u(a){for(var b,c={incoming:function(a,b){this.up.incoming(a,b)},outgoing:function(a,b){this.down.outgoing(a,b)},callback:function(a){this.up.callback(a)},init:function(){this.down.init()},destroy:function(){this.down.destroy()}},d=0,e=a.length;d<e;d++)b=a[d],q(b,c,!0),0!==d&&(b.down=a[d-1]),d!==e-1&&(b.up=a[d+1]);return b}function v(a){a.up.down=a.down,a.down.up=a.up,a.up=a.down=null}var w,x,y,z,A,B=this,C=Math.floor(1e6*Math.random()),D=(Function.prototype,/^((http:|https:|file:|chrome\-extension:|chrome:)\/\/([^:\/\s]+)(:\d+)*)/),E=/[\-\w]+\/\.\.\//,F=/([^:])\/\//g,G="Stripe",H={},I="stripeXDM_",J=!1;if(g(a,"addEventListener"))z=function(a,b,c){a.addEventListener(b,c,!1)},A=function(a,b,c){a.removeEventListener(b,c,!1)};else{if(!g(a,"attachEvent"))throw new Error("Browser not supported");z=function(a,b,c){a.attachEvent("on"+b,c)},A=function(a,b,c){a.detachEvent("on"+b,c)}}var K,L=!1,M=[];if("readyState"in b?(K=b.readyState,L="complete"==K||~navigator.userAgent.indexOf("AppleWebKit/")&&("loaded"==K||"interactive"==K)):L=!!b.body,!L){if(g(a,"addEventListener"))z(b,"DOMContentLoaded",i);else if(z(b,"readystatechange",function(){"complete"==b.readyState&&i()}),b.documentElement.doScroll&&a===top){var N=function(){if(!L){try{b.documentElement.doScroll("left");
3
+ }catch(a){return void d(N,1)}i()}};N()}z(a,"load",i)}var O=function(a){a=a.substring(1).split("&");for(var b,c={},d=a.length;d--;)b=a[d].split("="),c[b[0].replace(/^stripe_/,"")]=e(b[1]);return c}(/stripe_xdm_e=/.test(c.search)?c.search:c.hash),P=function(){return Stripe.JSON};q(H,{version:"2.4.19.3",query:O,stack:{},apply:q,getJSONObject:P,whenReady:j}),H.DomHelper={on:z,un:A},function(){var a={};H.Fn={set:function(b,c){a[b]=c},get:function(b,c){if(a.hasOwnProperty(b)){var d=a[b];return c&&delete a[b],d}}}}(),H.Socket=function(a){var b=u(t(a).concat([{incoming:function(b,c){a.onMessage(b,c)},callback:function(b){a.onReady&&a.onReady(b)}}])),c=m(a.remote);this.origin=m(a.remote),this.destroy=function(){b.destroy()},this.postMessage=function(a){b.outgoing(a,c)},b.init()},H.stack.FlashTransport=function(a){function e(a,b){d(function(){h.up.incoming(a,p)},0)}function g(c){var d=a.swf+"?host="+a.isHost,e="easyXDM_swf_"+Math.floor(1e4*Math.random());H.Fn.set("flash_loaded"+c.replace(/[\-.]/g,"_"),function(){H.stack.FlashTransport[c].swf=r=t.firstChild;for(var a=H.stack.FlashTransport[c].queue,b=0;b<a.length;b++)a[b]();a.length=0}),a.swfContainer?t="string"==typeof a.swfContainer?b.getElementById(a.swfContainer):a.swfContainer:(t=b.createElement("div"),q(t.style,y&&a.swfNoThrottle?{height:"20px",width:"20px",position:"fixed",right:0,top:0}:{height:"1px",width:"1px",position:"absolute",overflow:"hidden",right:0,top:0}),b.body.appendChild(t));var g="callback=flash_loaded"+f(c.replace(/[\-.]/g,"_"))+"&proto="+B.location.protocol+"&domain="+f(k(B.location.href))+"&port="+f(l(B.location.href))+"&ns="+f(G);t.innerHTML="<object height='20' width='20' type='application/x-shockwave-flash' id='"+e+"' data='"+d+"'><param name='allowScriptAccess' value='always'></param><param name='wmode' value='transparent'><param name='movie' value='"+d+"'></param><param name='flashvars' value='"+g+"'></param><embed type='application/x-shockwave-flash' FlashVars='"+g+"' allowScriptAccess='always' wmode='transparent' src='"+d+"' height='1' width='1'></embed></object>"}var h,i,p,r,t;return h={outgoing:function(b,c,d){r.postMessage(a.channel,b.toString()),d&&d()},destroy:function(){try{r.destroyChannel(a.channel)}catch(b){}r=null,i&&(i.parentNode.removeChild(i),i=null)},onDOMReady:function(){p=a.remote,H.Fn.set("flash_"+a.channel+"_init",function(){d(function(){h.up.callback(!0)})}),H.Fn.set("flash_"+a.channel+"_onMessage",e),a.swf=n(a.swf);var b=k(a.swf),f=function(){H.stack.FlashTransport[b].init=!0,r=H.stack.FlashTransport[b].swf,r.createChannel(a.channel,a.secret,m(a.remote),a.isHost),a.isHost&&(y&&a.swfNoThrottle&&q(a.props,{position:"fixed",right:0,top:0,height:"20px",width:"20px"}),q(a.props,{src:o(a.remote,{xdm_e:m(c.href),xdm_c:a.channel,xdm_p:6,xdm_s:a.secret}),name:I+a.channel+"_provider"}),i=s(a))};H.stack.FlashTransport[b]&&H.stack.FlashTransport[b].init?f():H.stack.FlashTransport[b]?H.stack.FlashTransport[b].queue.push(f):(H.stack.FlashTransport[b]={queue:[f]},g(b))},init:function(){j(h.onDOMReady,h)}}},H.stack.PostMessageTransport=function(b){function e(a){if(a.origin)return m(a.origin);if(a.uri)return m(a.uri);if(a.domain)return c.protocol+"//"+a.domain;throw new Error("Unable to retrieve the origin of the event")}function f(a){var c=e(a);c==k&&"string"==typeof a.data&&a.data.substring(0,b.channel.length+1)==b.channel+" "&&g.up.incoming(a.data.substring(b.channel.length+1),c)}var g,h,i,k;return g={outgoing:function(a,c,d){try{i.postMessage(b.channel+" "+a,c||k),d&&d()}catch(e){b.onInternalError&&b.onInternalError.call(b,"CallerWindowError")}},destroy:function(){A(a,"message",f),h&&(i=null,h.parentNode.removeChild(h),h=null)},onDOMReady:function(){if(k=m(b.remote),b.isHost){var e=function(c){c.data==b.channel+"-ready"&&(i="postMessage"in h.contentWindow?h.contentWindow:h.contentWindow.document,A(a,"message",e),z(a,"message",f),d(function(){g.up.callback(!0)},0))};z(a,"message",e),q(b.props,{src:o(b.remote,{xdm_e:m(c.href),xdm_c:b.channel,xdm_p:1}),name:I+b.channel+"_provider"}),h=s(b)}else z(a,"message",f),i="postMessage"in a.parent?a.parent:a.parent.document,i.postMessage(b.channel+"-ready",k),d(function(){g.up.callback(!0)},0)},init:function(){j(g.onDOMReady,g)}}},H.stack.QueueBehavior=function(a){function b(){if(a.remove&&0===h.length)return void v(c);if(!i&&0!==h.length&&!g){i=!0;var e=h.shift();c.down.outgoing(e.data,e.origin,function(a){i=!1,e.callback&&d(function(){e.callback(a)},0),b()})}}var c,g,h=[],i=!0,j="",k=0,l=!1,m=!1;return c={init:function(){p(a)&&(a={}),a.maxLength&&(k=a.maxLength,m=!0),a.lazy?l=!0:c.down.init()},callback:function(a){i=!1;var d=c.up;b(),d.callback(a)},incoming:function(b,d){if(m){var f=b.indexOf("_"),g=parseInt(b.substring(0,f),10);j+=b.substring(f+1),0===g&&(a.encode&&(j=e(j)),c.up.incoming(j,d),j="")}else c.up.incoming(b,d)},outgoing:function(d,e,g){a.encode&&(d=f(d));var i,j=[];if(m){for(;0!==d.length;)i=d.substring(0,k),d=d.substring(i.length),j.push(i);for(;i=j.shift();)h.push({data:j.length+"_"+i,origin:e,callback:0===j.length?g:null})}else h.push({data:d,origin:e,callback:g});l?c.down.init():b()},destroy:function(){g=!0,c.down.destroy()}}},Stripe.easyXDM=H}(window,document,location,window.setTimeout,decodeURIComponent,encodeURIComponent)}.call(this),function(){var a=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};this.Stripe.isDoubleLoaded||(this.Stripe.utils=function(){function b(){}var c;return c=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+#x2F;g,b.trim=function(a){return null===a?"":(a+"").replace(c,"")},b.serialize=function(a,b,c){var d,e,f;null==b&&(b=[]);try{for(e in a)f=a[e],c&&(e=""+c+"["+e+"]"),"object"==typeof f?this.serialize(f,b,e):b.push(""+e+"="+encodeURIComponent(f));return b.join("&").replace(/%20/g,"+")}catch(g){throw d=g,new Error("Unable to serialize: "+a)}},b.underscore=function(a){return(a+"").replace(/([A-Z])/g,function(a){return"_"+a.toLowerCase()}).replace(/-/g,"_")},b.underscoreKeys=function(a){var b,c,d;d=[];for(b in a)c=a[b],delete a[b],d.push(a[this.underscore(b)]=c);return d},b.isElement=function(a){return"object"==typeof a&&(!!a.jquery||1===a.nodeType)},b.paramsFromForm=function(b,c){var d,e,f,g,h,i,j,k,l,m;for(null==c&&(c=[]),b.jquery&&(b=b[0]),f=b.getElementsByTagName("input"),h=b.getElementsByTagName("select"),i={},j=0,l=f.length;j<l;j++)e=f[j],d=this.underscore(e.getAttribute("data-stripe")),a.call(c,d)<0||(i[d]=e.value);for(k=0,m=h.length;k<m;k++)g=h[k],d=this.underscore(g.getAttribute("data-stripe")),a.call(c,d)<0||null!=g.selectedIndex&&(i[d]=g.options[g.selectedIndex].value);return i},b.validateProtocol=function(a){var b;if(a&&"string"==typeof a)return/_live_/g.test(a)&&"https:"!==window.location.protocol&&null!=(null!=(b=window.console)?b.warn:void 0)?window.console.warn("You are using Stripe.js in live mode over an insecure connection. This is considered unsafe. Please conduct live requests only on sites served over https. For more info, see https://stripe.com/help/ssl"):void 0},b.validateKey=function(a){if(!a||"string"!=typeof a)throw new Error("You did not set a valid publishable key. Call Stripe.setPublishableKey() with your publishable key. For more info, see https://stripe.com/docs/stripe.js");if(/\s/g.test(a))throw new Error("Your key is invalid, as it contains whitespace. For more info, see https://stripe.com/docs/stripe.js");if(/^sk_/.test(a))throw new Error("You are using a secret key with Stripe.js, instead of the publishable one. For more info, see https://stripe.com/docs/stripe.js")},b.parseExpString=function(a){var b,c,d,e,f,g,h,i,j;for(g=function(b){throw new Error("You passed an invalid expiration date `"+a+"`. "+(b||"")+"Please pass a string containing a numeric month and year such as `01-17` or `2015 / 05` For more info, see https://stripe.com/docs/stripe.js")},"string"!=typeof a&&g(),f=a.split(/[\.\-\/\s]+/g),2!==f.length&&g(),b=i=0,j=f.length;i<j;b=++i)e=f[b],d=parseInt(e),isNaN(d)&&g(""+f+" is not a number. "),d<1&&g(""+d+" is less than one. "),f[b]=d;return f[0]>12?(h=f[0],c=f[1]):(c=f[0],h=f[1]),c>12&&g("Month must be a number 1-12, not "+c+". "),h<100&&(h+=2e3),[c,h]},b}())}.call(this),function(){var a,b=[].slice;a=(new Date).getTime(),this.Stripe.isDoubleLoaded||(this.Stripe.ajaxJSONP=function(c){var d,e,f,g,h,i,j;return null==c&&(c={}),f="sjsonp"+ ++a,i=document.createElement("script"),e=null,d=function(a){var b;return null==a&&(a="abort"),clearTimeout(e),null!=(b=i.parentNode)&&b.removeChild(i),f in window&&(window[f]=function(){}),"function"==typeof c.complete?c.complete(a,j,c):void 0},j={abort:d},i.onerror=function(){return j.abort(),"function"==typeof c.error?c.error(j,c):void 0},window[f]=function(){var a,d;a=1<=arguments.length?b.call(arguments,0):[],clearTimeout(e),i.parentNode.removeChild(i);try{delete window[f]}catch(g){d=g,window[f]=void 0}return"function"==typeof c.success&&c.success.apply(c,b.call(a).concat([j])),"function"==typeof c.complete?c.complete("success",j,c):void 0},h=(c.headers||{})["Accept-Language"],c.data||(c.data={}),c.data.callback=f,c.method&&(c.data._method=c.method),h&&(c.data._accept_language=h),i.src=c.url+"?"+Stripe.utils.serialize(c.data),g=document.getElementsByTagName("head")[0],g.appendChild(i),c.timeout>0&&(e=setTimeout(function(){return j.abort("timeout")},c.timeout)),j})}.call(this),function(){var a,b,c,d,e,f,g,h,i,j={}.hasOwnProperty;this.Stripe.isDoubleLoaded||(b={contentType:"application/x-www-form-urlencoded",accept:{json:"application/json"}},g=/^(20\d|1223)#x2F;,f="invalid_json_response",d=function(a,b,c){return function(){return a._aborted?c(a.request,"abort"):a.request&&4===a.request.readyState?(a.request.onreadystatechange=function(){},0===a.request.status?c(a.request,"empty_response"):g.test(a.request.status)?b(a.request,a.request.status):b(a.request,a.request.status)):void 0}},h=function(a,c){var d,e,f,g,h;f=c.headers||{},f.Accept||(f.Accept=b.accept.json),f["Content-Type"]||(f["Content-Type"]=b.contentType),g=c._globalCustomHeaders;for(d in g)j.call(g,d)&&"setRequestHeader"in a&&a.setRequestHeader(d,c._globalCustomHeaders[d]);h=[];for(e in f)j.call(f,e)&&("setRequestHeader"in a?h.push(a.setRequestHeader(e,f[e])):h.push(void 0));return h},i=function(a,b){return/\?/.test(a)?a+"&"+b:a+"?"+b},c=function(a,b){var c,e,f,g,j,k,l,m,n;k=this.o,j=(k.method||"GET").toUpperCase(),l=k.url,g=null!=(m=k.data)?m.key:void 0,c=Stripe.utils.serialize(k.data),f=void 0,"GET"===j&&c&&(l=i(l,c),c=null),n=new XMLHttpRequest,n.open(j,l,!0),h(n,k),n.onreadystatechange=d(this,a,b);try{n.send(c)}catch(o){e=o,Stripe.reportError("XHR-"+e.toString()),b(n,"xhr_send_failure")}return n},a=function(a){return this.o=a,e.apply(this,arguments)},e=function(a){var b,d,e;return this.url=a.url,this.timeout=null,this._successHandler=function(){},this._errorHandlers=[],this._completeHandlers=[],a.timeout&&(this.timeout=setTimeout(function(a){return function(){return a.abort()}}(this),a.timeout)),a.success&&(this._successHandler=function(){return a.success.apply(a,arguments)}),a.error&&this._errorHandlers.push(function(){return a.error.apply(a,arguments)}),a.complete&&this._completeHandlers.push(function(){return a.complete.apply(a,arguments)}),b=function(b){return function(c,d){var e;for(a.timeout&&clearTimeout(b.timeout),b.timeout=null,e=[];b._completeHandlers.length>0;)e.push(b._completeHandlers.shift()(d,c,a));return e}}(this),e=function(a){return function(c,e){var g,h,i;if(i=c.responseText,!i||!i.length)return d(c,"empty_response");try{return h=Stripe.JSON.parse(i),a._successHandler(h,e,c),b(h,"success")}catch(j){return g=j,d(c,f)}}}(this),d=function(a){return function(b,c){var d,e,g;if(g=b.responseText,e=void 0,g&&g.length&&c!==f)try{e=Stripe.JSON.parse(g)}catch(h){d=h,c=c+"_AND_"+f}for(;a._errorHandlers.length>0;)a._errorHandlers.shift()(e||b,c);return Stripe.reportError(c),Stripe._fallBackToOldStripeJsTechniques(),Stripe.request(a.o,!0)}}(this),this.request=c.call(this,e,d)},a.prototype={abort:function(){var a;return this._aborted=!0,null!=(a=this.request)?a.abort():void 0}},this.Stripe.xhr=function(b){return b._globalCustomHeaders=this._customHeaders,new a(b)})}.call(this),function(){var a,b,c,d={}.hasOwnProperty;this.Stripe.isDoubleLoaded||(a=function(a){return this.options=a,a.requestId=Stripe._callCount,a.endpoint=Stripe.endpoint,a.trackPerf=Stripe.trackPerf,this.iframeTimeout=setTimeout(function(){return Stripe._fallBackToOldStripeJsTechniques(),Stripe._iframePendingRequests[a.requestId]&&(Stripe.request(Stripe._iframePendingRequests[a.requestId],!0),delete Stripe._iframePendingRequests[a.requestId]),Stripe._callCache[a.requestId]=function(){return Stripe.reportError("TimeoutEventualReturnError")}},1e4),Stripe._iframePendingRequests[a.requestId]=a,Stripe._callCache[a.requestId]=function(b){return function(){return clearTimeout(b.iframeTimeout),delete Stripe._iframePendingRequests[a.requestId],a.success.apply(a,arguments),"function"==typeof a.complete?a.complete("success",null,a):void 0}}(this),Stripe._callCount+=1,Stripe._socket.postMessage(Stripe.JSON.stringify(a))},this.Stripe.iframe=function(b){return new a(b)},b=Stripe.easyXDM,this.Stripe._isChannel?Stripe._socket=new b.Socket({swf:""+Stripe._iframeBaseUrl+"/v2/stripexdm.swf",onMessage:Stripe._channelListener}):Stripe._isSafeDomain||(c=function(a){var b,d,e;"console"in window&&"warn"in window.console,1,Stripe._iframeChannelComplete.call(Stripe,!1),Stripe._callCache={},Stripe.reportError("FB-"+a),d=document.createElement("script"),e=Math.round((new Date).getTime()/1e3),d.src=""+Stripe._iframeBaseUrl+"/v2/cspblocked.js?domain="+encodeURIComponent(document.location.href)+"&timestamp="+e+"&info="+encodeURIComponent(a)+"&payment_user_agent="+encodeURIComponent(Stripe.stripejs_ua),b=document.getElementsByTagName("script")[0],b.parentNode.insertBefore(d,b),c=function(){}},Stripe._socket=new b.Socket({swf:""+Stripe._iframeBaseUrl+"/v2/stripexdm.swf",remote:""+Stripe._iframeBaseUrl+"/v2/channel"+(Stripe.accountDetails?"-provisioning":"")+".html#__stripe_transport__",onMessage:Stripe._receiveChannelRelay,ackTimeoutDuration:1e4,onLoad:function(){return this._socketLoadTime=+new Date,this.onError=function(){},this.onAsyncInject=function(){},clearTimeout(this.injectTimeout),this._socketAckTime?this.loadTimeout?(clearTimeout(this.loadTimeout),Stripe._iframeChannelComplete.call(Stripe,!0)):Stripe.reportError("LoadDelayError",this._socketLoadTime-this._socketAckTime):this.ackTimeout=setTimeout(function(a){return function(){return a.onFrameAck=function(){},clearTimeout(a.loadTimeout),c("AckTimeoutError")}}(this),this.ackTimeoutDuration)},onError:function(){return this.onLoad=function(){},this.onAsyncInject=function(){},this.onFrameAck=function(){},clearTimeout(this.ackTimeout),clearTimeout(this.injectTimeout),clearTimeout(this.loadTimeout),c("IframeOnError")},onInternalError:function(a){var b,c,e;this.onError=function(){},this.onLoad=function(){},this.onFrameAck=function(){},this.onAsyncInject=function(){},clearTimeout(this.ackTimeout),clearTimeout(this.loadTimeout),clearTimeout(this.injectTimeout),Stripe.reportError("FB-XDM-"+a),Stripe._fallBackToOldStripeJsTechniques(),e=Stripe._iframePendingRequests;for(b in e)d.call(e,b)&&(c=e[b],Stripe._callCache[c.requestId]=function(){},delete Stripe._iframePendingRequests[c.requestId],Stripe.request(c,!0))},onAsyncInject:function(a){return this.injectTimeout=setTimeout(function(a){return function(){return a.onError=function(){},a.onLoad=function(){},a.onFrameAck=function(){},clearTimeout(a.ackTimeout),clearTimeout(a.loadTimeout),c("InjectTimeoutError")}}(this),this.ackTimeoutDuration)},onFrameAck:function(a){return this._socketAckTime=+new Date,clearTimeout(this.ackTimeout),clearTimeout(this.injectTimeout),this.onAsyncInject=function(){},this.onError=function(){},this.ackTimeout?Stripe._iframeChannelComplete.call(Stripe,!0):this._socketLoadTime?(this.onLoad=function(){},Stripe.reportError("AckDelayError",this._socketAckTime-this._socketLoadTime)):this.loadTimeout=setTimeout(function(a){return function(){return c("LoadTimeoutError"),a.onLoad=function(){}}}(this),this.ackTimeoutDuration)}})))}.call(this),function(){var a=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};this.Stripe.isDoubleLoaded||(this.Stripe.validator={"boolean":function(a,b){if("true"!==b&&"false"!==b)return"Enter a boolean string (true or false)"},integer:function(a,b){if(!/^\d+#x2F;.test(b))return"Enter an integer"},positive:function(a,b){if(this.integer(a,b)||!(parseInt(b,10)>0))return"Enter a positive value"},range:function(b,c){var d;if(d=parseInt(c,10),a.call(b,d)<0)return"Needs to be between "+b[0]+" and "+b[b.length-1]},required:function(a,b){if(a&&(null==b||""===b))return"Required"},year:function(a,b){if(!/^\d{4}#x2F;.test(b))return"Enter a 4-digit year"},birthYear:function(a,b){var c;return c=this.year(a,b),c?c:parseInt(b,10)>2e3?"You must be over 18":parseInt(b,10)<1900?"Enter your birth year":void 0},month:function(a,b){return this.integer(a,b)?"Please enter a month":this.range([1,2,3,4,5,6,7,8,9,10,11,12],b)?"Needs to be between 1 and 12":void 0},choices:function(b,c){if(a.call(b,c)<0)return"Not an acceptable value for this field"},email:function(a,b){if(!/^[^@<\s>]+@[^@<\s>]+#x2F;.test(b))return"That doesn't look like an email address"},url:function(a,b){if(!/^https?:\/\/.+\..+/.test(b))return"Not a valid url"},usTaxID:function(a,b){if(!/^\d{2}-?\d{1}-?\d{2}-?\d{4}#x2F;.test(b))return"Not a valid tax ID"},ein:function(a,b){if(!/^\d{2}-?\d{7}#x2F;.test(b))return"Not a valid EIN"},ssnLast4:function(a,b){if(!/^\d{4}#x2F;.test(b))return"Not a valid last 4 digits for an SSN"},ownerPersonalID:function(a,b){var c;if(c=function(){switch(a){case"CA":return/^\d{3}-?\d{3}-?\d{3}#x2F;.test(b);case"US":return!0}}(),!c)return"Not a valid ID"},bizTaxID:function(a,b){var c,d,e,f,g,h,i,j;if(h={CA:["Tax ID",[/^\d{9}#x2F;]],US:["EIN",[/^\d{2}-?\d{7}#x2F;]]},g=h[a],null!=g){for(c=g[0],f=g[1],d=!1,i=0,j=f.length;i<j;i++)if(e=f[i],e.test(b)){d=!0;break}if(!d)return"Not a valid "+c}},zip:function(a,b){var c;if(c=function(){switch(a.toUpperCase()){case"CA":return/^[\d\w]{6}#x2F;.test(null!=b?b.replace(/\s+/g,""):void 0);case"US":return/^\d{5}#x2F;.test(b)||/^\d{9}#x2F;.test(b)}}(),!c)return"Not a valid zip"},bankAccountNumber:function(a,b){if(!/^\d{1,17}#x2F;.test(b))return"Invalid bank account number"},usRoutingNumber:function(a){var b,c,d,e,f,g,h;if(!/^\d{9}#x2F;.test(a))return"Routing number must have 9 digits";for(f=0,b=g=0,h=a.length-1;g<=h;b=g+=3)c=3*parseInt(a.charAt(b),10),d=7*parseInt(a.charAt(b+1),10),e=parseInt(a.charAt(b+2),10),f+=c+d+e;return 0===f||f%10!==0?"Invalid routing number":void 0},caRoutingNumber:function(a){if(!/^\d{5}\-\d{3}#x2F;.test(a))return"Invalid transit number"},routingNumber:function(a,b){switch(a.toUpperCase()){case"CA":return this.caRoutingNumber(b);case"US":return this.usRoutingNumber(b)}},phoneNumber:function(a,b){var c;if(c=b.replace(/[^0-9]/g,""),10!==c.length)return"Invalid phone number"},bizDBA:function(a,b){if(!/^.{1,23}#x2F;.test(b))return"Statement descriptors can only have up to 23 characters"},nameLength:function(a,b){if(1===b.length)return"Names need to be longer than one character"},isUrl:function(a){return"string"==typeof a&&!this.url(null,a)},isElementOrId:function(a){return"object"==typeof a&&null!=a.appendChild||"string"==typeof a}})}.call(this);
includes/Ajax.class.php CHANGED
@@ -31,10 +31,136 @@ class rtbAJAX {
31
32
add_action( 'wp_ajax_rtb_get_available_time_slots', array( $this, 'get_time_slots' ) );
33
add_action( 'wp_ajax_nopriv_rtb_get_available_time_slots', array( $this, 'get_time_slots' ) );
34
}
35
36
/**
37
- * Load the plugin's default settings
38
* @since 2.0.0
39
*/
40
public function get_time_slots() {
@@ -87,10 +213,10 @@ class rtbAJAX {
87
while ( sizeOf( $current_times ) > 0 and reset( $current_times ) < $time - $dining_block_seconds ) {
88
//save the time to know when the blocking potentially ends
89
$removed_time = reset( $current_times );
90
-
91
// remove the expired time
92
array_shift( $current_times );
93
-
94
// remove the block if we've dropped below the max reservation count
95
if ( $blocked and sizeOf( $current_times ) < $max_reservations ) {
96
$blocked = false;
31
32
add_action( 'wp_ajax_rtb_get_available_time_slots', array( $this, 'get_time_slots' ) );
33
add_action( 'wp_ajax_nopriv_rtb_get_available_time_slots', array( $this, 'get_time_slots' ) );
34
+
35
+ add_action( 'wp_ajax_rtb_find_reservations', array( $this, 'get_reservations' ) );
36
+ add_action( 'wp_ajax_nopriv_rtb_find_reservations', array( $this, 'get_reservations' ) );
37
+
38
+ add_action( 'wp_ajax_rtb_cancel_reservations', array( $this, 'cancel_reservation' ) );
39
+ add_action( 'wp_ajax_nopriv_rtb_cancel_reservations', array( $this, 'cancel_reservation' ) );
40
+ }
41
+
42
+ /**
43
+ * Get reservations that are associated with the email address that was sent
44
+ * @since 2.1.0
45
+ */
46
+ public function get_reservations() {
47
+ global $wpdb;
48
+
49
+ $email = isset($_POST['booking_email']) ? sanitize_email( $_POST['booking_email'] ) : '';
50
+
51
+ if ( ! $email ) {
52
+ wp_send_json_error(
53
+ array(
54
+ 'error' => 'noemail',
55
+ 'msg' => __( 'The email you entered is not valid.', 'restaurant-reservations' ),
56
+ )
57
+ );
58
+ }
59
+
60
+ require_once( RTB_PLUGIN_DIR . '/includes/Booking.class.php' );
61
+
62
+ $bookings = array();
63
+ $booking_ids = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key='rtb' AND meta_value LIKE %s", '%' . $email . '%'));
64
+ foreach ( $booking_ids as $booking_id ) {
65
+ $booking = new rtbBooking();
66
+ if ( $booking->load_post( $booking_id->post_id ) ) {
67
+ if ( ( $booking->post_status == 'pending' or $booking->post_status == 'confirmed' ) and time() < strtotime( $booking->date ) ) {
68
+ $bookings[] = array(
69
+ 'ID' => $booking->ID,
70
+ 'email' => $booking->email,
71
+ 'datetime' => $booking->format_date( $booking->date ),
72
+ 'party' => $booking->party
73
+ );
74
+ }
75
+ }
76
+ }
77
+
78
+ if ( ! empty($bookings) ) {
79
+ wp_send_json_success(
80
+ array(
81
+ 'bookings' => $bookings
82
+ )
83
+ );
84
+ }
85
+ else {
86
+ wp_send_json_error(
87
+ array(
88
+ 'error' => 'nobookings',
89
+ 'msg' => __( 'No bookings were found for the email address you entered.', 'restaurant-reservations' ),
90
+ )
91
+ );
92
+ }
93
+
94
+ die();
95
+ }
96
+
97
+ /**
98
+ * Cancel a reservation based on its ID, with the email address used for confirmation
99
+ * @since 2.1.0
100
+ */
101
+ public function cancel_reservation( $non_ajax = true ) {
102
+ global $rtb_controller;
103
+
104
+ $booking_id = isset($_REQUEST['booking_id']) ? absint( $_REQUEST['booking_id'] ) : '';
105
+ $booking_email = isset($_REQUEST['booking_email']) ? sanitize_email( $_REQUEST['booking_email'] ) : '';
106
+
107
+ require_once( RTB_PLUGIN_DIR . '/includes/Booking.class.php' );
108
+
109
+ $success = false;
110
+
111
+ $booking = new rtbBooking();
112
+ if ( $booking->load_post( $booking_id ) ) {
113
+ if ( $booking_email == $booking->email ) {
114
+ wp_update_post( array( 'ID' => $booking->ID, 'post_status' => 'cancelled' ) );
115
+
116
+ $success = true;
117
+ }
118
+ else {
119
+ wp_send_json_error(
120
+ array(
121
+ 'error' => 'invalidemail',
122
+ 'msg' => __( 'No booking matches the information that was sent.', 'restaurant-reservations' ),
123
+ )
124
+ );
125
+ }
126
+ }
127
+ else {
128
+ wp_send_json_error(
129
+ array(
130
+ 'error' => 'invalidid',
131
+ 'msg' => __( 'No booking matches the information that was sent.', 'restaurant-reservations' ),
132
+ )
133
+ );
134
+ }
135
+
136
+ if ( $ajax ) {
137
+ if ( $success ) {
138
+ wp_send_json_success(
139
+ array(
140
+ 'booking_id' => $booking_id
141
+ )
142
+ );
143
+ }
144
+
145
+ die();
146
+ }
147
+ elseif ( $success ) {
148
+ $booking_page_id = $rtb_controller->settings->get_setting( 'booking-page' );
149
+ $booking_page_url = get_permalink( $booking_page_id );
150
+
151
+ $cancelled_url = add_query_arg(
152
+ array(
153
+ 'bookingCancelled' => 'success'
154
+ ),
155
+ $booking_page_url
156
+ );
157
+
158
+ header( 'location:' . $cancelled_url );
159
+ }
160
}
161
162
/**
163
+ * Get available timeslots when "Max Reservations" is enabled
164
* @since 2.0.0
165
*/
166
public function get_time_slots() {
213
while ( sizeOf( $current_times ) > 0 and reset( $current_times ) < $time - $dining_block_seconds ) {
214
//save the time to know when the blocking potentially ends
215
$removed_time = reset( $current_times );
216
+
217
// remove the expired time
218
array_shift( $current_times );
219
+
220
// remove the block if we've dropped below the max reservation count
221
if ( $blocked and sizeOf( $current_times ) < $max_reservations ) {
222
$blocked = false;
includes/Booking.class.php CHANGED
@@ -82,7 +82,10 @@ class rtbBooking {
82
'logs' => array(),
83
'ip' => '',
84
'consent_acquired' => '',
85
'reminder_sent' => false,
86
);
87
88
$meta_defaults = apply_filters( 'rtb_booking_metadata_defaults', $meta_defaults );
@@ -100,6 +103,10 @@ class rtbBooking {
100
$this->logs = $meta['logs'];
101
$this->ip = $meta['ip'];
102
$this->consent_acquired = $meta['consent_acquired'];
103
}
104
105
/**
@@ -137,6 +144,22 @@ class rtbBooking {
137
return $time;
138
}
139
140
/**
141
* Insert a new booking submission into the database
142
*
@@ -165,7 +188,7 @@ class rtbBooking {
165
return false;
166
}
167
168
- if ( $this->insert_post_data() === false ) {
169
return false;
170
} else {
171
$this->request_inserted = true;
@@ -455,11 +478,38 @@ class rtbBooking {
455
);
456
}
457
458
// Message
459
$this->message = empty( $_POST['rtb-message'] ) ? '' : nl2br( wp_kses_post( stripslashes_deep( $_POST['rtb-message'] ) ) );
460
461
// Post Status (define a default post status if none passed)
462
- $this->determine_status();
463
464
// Consent
465
$require_consent = $rtb_controller->settings->get_setting( 'require-consent' );
@@ -734,11 +784,11 @@ class rtbBooking {
734
} elseif ( $rtb_controller->settings->get_setting( 'require-deposit' ) and ! $payment_made ) {
735
$this->post_status = 'draft';
736
} elseif ( $this->party < $rtb_controller->settings->get_setting( 'auto-confirm-max-party-size' ) ) {
737
- $this->post_status = 'confirmed';
738
} elseif ($rtb_controller->settings->get_setting( 'auto-confirm-max-reservations' ) and $this->under_max_confirm_reservations() ) {
739
- $this->post_status = 'confirmed';
740
} elseif ( $rtb_controller->settings->get_setting( 'auto-confirm-max-seats' ) and $this->under_max_confirm_seats() ) {
741
- $this->post_status = 'confirmed';
742
} else {
743
$this->post_status = 'pending';
744
}
@@ -827,6 +877,14 @@ class rtbBooking {
827
$meta['logs'] = $this->logs;
828
}
829
830
if ( !empty( $this->reminder_sent ) ) {
831
$meta['reminder_sent'] = $this->reminder_sent;
832
}
82
'logs' => array(),
83
'ip' => '',
84
'consent_acquired' => '',
85
+ 'deposit' => '0',
86
+ 'receipt_id' => '',
87
'reminder_sent' => false,
88
+ 'late_arrival_sent' => false,
89
);
90
91
$meta_defaults = apply_filters( 'rtb_booking_metadata_defaults', $meta_defaults );
103
$this->logs = $meta['logs'];
104
$this->ip = $meta['ip'];
105
$this->consent_acquired = $meta['consent_acquired'];
106
+ $this->deposit = $meta['deposit'];
107
+ $this->receipt_id = $meta['receipt_id'];
108
+ $this->late_arrival_sent = $meta['late_arrival_sent'];
109
+ $this->reminder_sent = $meta['reminder_sent'];
110
}
111
112
/**
144
return $time;
145
}
146
147
+ /**
148
+ * Calculates the deposit required for a reservation, if any
149
+ *
150
+ * @since 2.1.0
151
+ */
152
+ public function calculate_deposit( ) {
153
+ global $rtb_controller;
154
+
155
+ $deposit = $rtb_controller->settings->get_setting( 'rtb-deposit-amount' );
156
+
157
+ if ( $rtb_controller->settings->get_setting( 'rtb-deposit-type' == 'guest' ) ) { $deposit = $deposit * $this->party; }
158
+
159
+ return $deposit;
160
+ }
161
+
162
+
163
/**
164
* Insert a new booking submission into the database
165
*
188
return false;
189
}
190
191
+ if ( $this->insert_post_data() === false ) {
192
return false;
193
} else {
194
$this->request_inserted = true;
478
);
479
}
480
481
+ // reCAPTCHA
482
+ if ( $rtb_controller->settings->get_setting( 'enable-captcha' ) ) {
483
+ if ( ! isset($_POST['g-recaptcha-response']) ) {
484
+ $this->validation_errors[] = array(
485
+ 'field' => 'recaptcha',
486
+ 'error_msg' => 'No reCAPTCHA code',
487
+ 'message' => __( 'Please fill out the reCAPTCHA box before submitting.', 'restaurant-reservations' ),
488
+ );
489
+ }
490
+ else {
491
+ $secret_key = $rtb_controller->settings->get_setting( 'captcha-secret-key' );
492
+ $captcha = $_POST['g-recaptcha-response'];
493
+
494
+ $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secret_key) . '&response=' . urlencode($captcha);
495
+ $json_response = file_get_contents( $url );
496
+ $response = json_decode( $json_response ); update_option("EWD_Debugging", print_r($response, true));
497
+
498
+ if ( ! $response->success ) {
499
+ $this->validation_errors[] = array(
500
+ 'field' => 'recaptcha',
501
+ 'error_msg' => 'Invalid reCAPTCHA code',
502
+ 'message' => __( 'Please fill out the reCAPTCHA box again and re-submit.', 'restaurant-reservations' ),
503
+ );
504
+ }
505
+ }
506
+ }
507
+
508
// Message
509
$this->message = empty( $_POST['rtb-message'] ) ? '' : nl2br( wp_kses_post( stripslashes_deep( $_POST['rtb-message'] ) ) );
510
511
// Post Status (define a default post status if none passed)
512
+ $this->determine_status();
513
514
// Consent
515
$require_consent = $rtb_controller->settings->get_setting( 'require-consent' );
784
} elseif ( $rtb_controller->settings->get_setting( 'require-deposit' ) and ! $payment_made ) {
785
$this->post_status = 'draft';
786
} elseif ( $this->party < $rtb_controller->settings->get_setting( 'auto-confirm-max-party-size' ) ) {
787
+ $this->post_status = 'confirmed';
788
} elseif ($rtb_controller->settings->get_setting( 'auto-confirm-max-reservations' ) and $this->under_max_confirm_reservations() ) {
789
+ $this->post_status = 'confirmed';
790
} elseif ( $rtb_controller->settings->get_setting( 'auto-confirm-max-seats' ) and $this->under_max_confirm_seats() ) {
791
+ $this->post_status = 'confirmed';
792
} else {
793
$this->post_status = 'pending';
794
}
877
$meta['logs'] = $this->logs;
878
}
879
880
+ if ( !empty( $this->deposit ) ) {
881
+ $meta['deposit'] = $this->deposit;
882
+ }
883
+
884
+ if ( !empty( $this->receipt_id ) ) {
885
+ $meta['receipt_id'] = $this->receipt_id;
886
+ }
887
+
888
if ( !empty( $this->reminder_sent ) ) {
889
$meta['reminder_sent'] = $this->reminder_sent;
890
}
includes/Cron.class.php CHANGED
@@ -20,7 +20,7 @@ class rtbCron {
20
add_action( 'rtb_cron_jobs', array($this, 'handle_late_arrivals_task') );
21
add_action( 'rtb_cron_jobs', array($this, 'handle_reminder_task') );
22
23
- add_action('admin_init', array($this, 'handle_reminder_task') );
24
}
25
26
/**
@@ -69,15 +69,21 @@ class rtbCron {
69
70
if ( ! $rtb_controller->settings->get_setting( 'time-reminder-user' ) ) { return; }
71
72
$bookings = $this->get_late_arrival_posts();
73
74
foreach ($bookings as $booking) {
75
- $booking_data = get_post_meta( $booking->ID, 'rtb', true );
76
-
77
- $notifications_sent = (isset($booking_data['late_arrival_sent']) ? $booking_data['late_arrival_sent'] : false );
78
-
79
- if ( ! $notifications_sent ) {
80
- $notification = new rtbNotificationEmail( 'late_user', 'user' );
81
82
$notification->set_booking($booking);
83
@@ -107,15 +113,21 @@ class rtbCron {
107
108
if ( ! $rtb_controller->settings->get_setting( 'time-reminder-user' ) ) { return; }
109
110
$bookings = $this->get_reminder_posts();
111
112
foreach ($bookings as $booking) {
113
- $booking_data = get_post_meta( $booking->ID, 'rtb', true );
114
115
- $notifications_sent = (isset($booking_data['reminder_sent']) ? $booking_data['reminder_sent'] : false );
116
-
117
- if ( ! $notifications_sent ) {
118
- $notification = new rtbNotificationEmail( 'reminder', 'user' );
119
120
$notification->set_booking($booking);
121
20
add_action( 'rtb_cron_jobs', array($this, 'handle_late_arrivals_task') );
21
add_action( 'rtb_cron_jobs', array($this, 'handle_reminder_task') );
22
23
+ // add_action('admin_init', array($this, 'handle_reminder_task') ); // Used for testing
24
}
25
26
/**
69
70
if ( ! $rtb_controller->settings->get_setting( 'time-reminder-user' ) ) { return; }
71
72
+ require_once( RTB_PLUGIN_DIR . '/includes/Notification.class.php' );
73
+ require_once( RTB_PLUGIN_DIR . '/includes/Notification.Email.class.php' );
74
+ require_once( RTB_PLUGIN_DIR . '/includes/Notification.SMS.class.php' );
75
+
76
$bookings = $this->get_late_arrival_posts();
77
78
foreach ($bookings as $booking) {
79
+
80
+ if ( ! $booking->late_arrival_sent ) {
81
+ if ( $rtb_controller->settings->get_setting( 'late-notification-format' ) == 'text' ) {
82
+ $notification = new rtbNotificationSMS( 'late_user', 'user' );
83
+ }
84
+ else {
85
+ $notification = new rtbNotificationEmail( 'late_user', 'user' );
86
+ }
87
88
$notification->set_booking($booking);
89
113
114
if ( ! $rtb_controller->settings->get_setting( 'time-reminder-user' ) ) { return; }
115
116
+ require_once( RTB_PLUGIN_DIR . '/includes/Notification.class.php' );
117
+ require_once( RTB_PLUGIN_DIR . '/includes/Notification.Email.class.php' );
118
+ require_once( RTB_PLUGIN_DIR . '/includes/Notification.SMS.class.php' );
119
+
120
$bookings = $this->get_reminder_posts();
121
122
foreach ($bookings as $booking) {
123
124
+ if ( ! $booking->reminder_sent ) {
125
+ if ( $rtb_controller->settings->get_setting( 'reminder-notification-format' ) == 'text' ) {
126
+ $notification = new rtbNotificationSMS( 'reminder', 'user' );
127
+ }
128
+ else {
129
+ $notification = new rtbNotificationEmail( 'reminder', 'user' );
130
+ }
131
132
$notification->set_booking($booking);
133
includes/CustomPostTypes.class.php CHANGED
@@ -24,6 +24,7 @@ class rtbCustomPostTypes {
24
// Set up $booking_statuses array and register new post statuses
25
add_action( 'init', array( $this, 'set_booking_statuses' ) );
26
add_filter( 'rtb_post_statuses_args' , array( $this, 'add_arrived_status' ) );
27
28
// Display the count of pending bookings
29
add_action( 'admin_footer', array( $this, 'show_pending_count' ) );
@@ -152,6 +153,32 @@ class rtbCustomPostTypes {
152
153
}
154
155
/**
156
* @since 2.0.0
157
* Adds in an "Arrived" status if the option to check guests in on arrival
24
// Set up $booking_statuses array and register new post statuses
25
add_action( 'init', array( $this, 'set_booking_statuses' ) );
26
add_filter( 'rtb_post_statuses_args' , array( $this, 'add_arrived_status' ) );
27
+ add_filter( 'rtb_post_statuses_args' , array( $this, 'add_cancelled_status' ) );
28
29
// Display the count of pending bookings
30
add_action( 'admin_footer', array( $this, 'show_pending_count' ) );
153
154
}
155
156
+
157
+ /**
158
+ * @since 2.1.0
159
+ * Adds in a "Cancelled" status if the option to allow guest to cancel
160
+ * their reservation has been toggled on.
161
+ */
162
+ public function add_cancelled_status( $booking_statuses = array() ) {
163
+ global $rtb_controller;
164
+
165
+ if ( $rtb_controller->settings->get_setting( 'allow-cancellations' ) ) {
166
+ $booking_statuses['cancelled'] = array(
167
+ 'label' => _x( 'Cancelled', 'The guest has cancelled their reservation themselves.', 'restaurant-reservations' ),
168
+ 'default' => false, // Whether or not this status is part of WP Core
169
+ 'user_selectable' => false, // Whether or not a user can set a booking to this status
170
+ 'public' => false,
171
+ 'exclude_from_search' => true,
172
+ 'show_in_admin_all_list' => true,
173
+ 'show_in_admin_status_list' => true,
174
+ 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'restaurant-reservations' )
175
+ );
176
+ }
177
+
178
+ return $booking_statuses;
179
+ }
180
+
181
+
182
/**
183
* @since 2.0.0
184
* Adds in an "Arrived" status if the option to check guests in on arrival
includes/Dashboard.class.php CHANGED
@@ -20,6 +20,9 @@ class rtbDashboard {
20
}
21
22
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
23
}
24
25
public function add_dashboard_to_menu() {
@@ -38,7 +41,7 @@ class rtbDashboard {
38
$new_submenu = array();
39
$menu_item_count = 3;
40
41
- if ( ! is_array($submenu['rtb-bookings']) ) { $submenu['rtb-bookings'] = array(); }
42
43
foreach ( $submenu['rtb-bookings'] as $key => $sub_item ) {
44
if ( $sub_item[0] == 'Dashboard' ) { $new_submenu[0] = $sub_item; }
@@ -172,8 +175,14 @@ class rtbDashboard {
172
<div id="rtb-dashboard-content-left">
173
174
<?php if ( ! $permission or ! $ultimate or get_option("RTB_Trial_Happening") == "Yes") { ?>
175
- <div class="rtb-dashboard-new-widget-box ewd-widget-box-full">
176
<div class="rtb-dashboard-new-widget-box-top">
177
<form method="post" action="admin.php?page=rtb-dashboard" class="rtb-dashboard-key-widget">
178
<input class="rtb-dashboard-key-widget-input" name="Key" type="text" placeholder="<?php _e('Enter License Key Here', 'restaurant-reservations'); ?>">
179
<input class="rtb-dashboard-key-widget-submit" name="RTB_Upgrade_To_Full" type="submit" value="<?php echo ( ! $permission ? __('UNLOCK PREMIUM', 'restaurant-reservations') : __('UNLOCK ULTIMATE', 'restaurant-reservations') ) ?>">
@@ -200,15 +209,15 @@ class rtbDashboard {
200
</a>
201
</li>
202
<li>
203
- <a href="https://wordpress.org/support/plugin/restaurant-reservations" target="_blank">
204
- <img src="<?php echo plugins_url( '../assets/img/ewd-support-icon-forum.png', __FILE__ ); ?>">
205
- <div class="rtb-dashboard-support-widgets-text">Support Forum</div>
206
</a>
207
</li>
208
<li>
209
- <a href="https://www.fivestarplugins.com/support-center/?Plugin=RTB" target="_blank">
210
- <img src="<?php echo plugins_url( '../assets/img/ewd-support-icon-documentation.png', __FILE__ ); ?>">
211
- <div class="rtb-dashboard-support-widgets-text">Documentation</div>
212
</a>
213
</li>
214
</ul>
@@ -422,9 +431,10 @@ class rtbDashboard {
422
<ul class="rtb-dashboard-new-footer-two-menu">
423
<li>SUPPORT</li>
424
<li><a href="https://www.youtube.com/channel/UCZPuaoetCJB1vZOmpnMxJNw/featured" target="_blank">YouTube Tutorials</a></li>
425
- <li><a href="https://wordpress.org/support/plugin/restaurant-reservations" target="_blank">Forums</a></li>
426
- <li><a href="https://www.fivestarplugins.com/support-center/?Plugin=RTB" target="_blank">Documentation</a></li>
427
<li><a href="https://wordpress.org/plugins/restaurant-reservations/#faq" target="_blank">FAQs</a></li>
428
</ul>
429
</div>
430
</div> <!-- rtb-dashboard-new-footer-two -->
@@ -445,5 +455,13 @@ class rtbDashboard {
445
echo "<div class='error'><p>" . $this->message . "</p></div>";
446
}
447
}
448
}
449
} // endif
20
}
21
22
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
23
+
24
+ add_action( 'wp_ajax_rtb_hide_upgrade_box', array($this, 'hide_upgrade_box') );
25
+ add_action( 'wp_ajax_rtb_display_upgrade_box', array($this, 'display_upgrade_box') );
26
}
27
28
public function add_dashboard_to_menu() {
41
$new_submenu = array();
42
$menu_item_count = 3;
43
44
+ if ( ! isset( $submenu['rtb-bookings'] ) or ! is_array($submenu['rtb-bookings']) ) { return; }
45
46
foreach ( $submenu['rtb-bookings'] as $key => $sub_item ) {
47
if ( $sub_item[0] == 'Dashboard' ) { $new_submenu[0] = $sub_item; }
175
<div id="rtb-dashboard-content-left">
176
177
<?php if ( ! $permission or ! $ultimate or get_option("RTB_Trial_Happening") == "Yes") { ?>
178
+ <div id="rtb-dashboard-upgrade-box" class="rtb-dashboard-new-widget-box ewd-widget-box-full <?php echo ( get_option( 'rtb-hide-upgrade-box' ) ? 'rtb-hidden' : '' ); ?>">
179
<div class="rtb-dashboard-new-widget-box-top">
180
+ <?php if ( $permission ) { ?>
181
+ <div class="rtb-ultimate-notification">
182
+ <?php _e( 'Thanks for being a premium user! <strong>If you\'re looking to upgrade to our ultimate version, enter your new product key below.</strong>', 'restaurant-reservations' ); ?>
183
+ </div>
184
+ <div class="rtb-ultimate-upgrade-dismiss"></div>
185
+ <?php } ?>
186
<form method="post" action="admin.php?page=rtb-dashboard" class="rtb-dashboard-key-widget">
187
<input class="rtb-dashboard-key-widget-input" name="Key" type="text" placeholder="<?php _e('Enter License Key Here', 'restaurant-reservations'); ?>">
188
<input class="rtb-dashboard-key-widget-submit" name="RTB_Upgrade_To_Full" type="submit" value="<?php echo ( ! $permission ? __('UNLOCK PREMIUM', 'restaurant-reservations') : __('UNLOCK ULTIMATE', 'restaurant-reservations') ) ?>">
209
</a>
210
</li>
211
<li>
212
+ <a href="http://doc.fivestarplugins.com/plugins/restaurant-reservations/" target="_blank">
213
+ <img src="<?php echo plugins_url( '../assets/img/ewd-support-icon-documentation.png', __FILE__ ); ?>">
214
+ <div class="rtb-dashboard-support-widgets-text">Documentation</div>
215
</a>
216
</li>
217
<li>
218
+ <a href="https://www.fivestarplugins.com/support-center/" target="_blank">
219
+ <img src="<?php echo plugins_url( '../assets/img/ewd-support-icon-forum.png', __FILE__ ); ?>">
220
+ <div class="rtb-dashboard-support-widgets-text">Get Support</div>
221
</a>
222
</li>
223
</ul>
431
<ul class="rtb-dashboard-new-footer-two-menu">
432
<li>SUPPORT</li>
433
<li><a href="https://www.youtube.com/channel/UCZPuaoetCJB1vZOmpnMxJNw/featured" target="_blank">YouTube Tutorials</a></li>
434
+ <li><a href="http://doc.fivestarplugins.com/plugins/restaurant-reservations/" target="_blank">Documentation</a></li>
435
+ <li><a href="https://www.fivestarplugins.com/support-center/" target="_blank">Get Support</a></li>
436
<li><a href="https://wordpress.org/plugins/restaurant-reservations/#faq" target="_blank">FAQs</a></li>
437
+ <li><a id="rtb-dashboard-show-upgrade-box-link" href="#rtb-dashboard-upgrade-box">Ultimate Upgrade</a></li>
438
</ul>
439
</div>
440
</div> <!-- rtb-dashboard-new-footer-two -->
455
echo "<div class='error'><p>" . $this->message . "</p></div>";
456
}
457
}
458
+
459
+ public function hide_upgrade_box() {
460
+ update_option( 'rtb-hide-upgrade-box', true );
461
+ }
462
+
463
+ public function display_upgrade_box() {
464
+ update_option( 'rtb-hide-upgrade-box', false );
465
+ }
466
}
467
} // endif
includes/DeactivationSurvey.class.php ADDED
@@ -0,0 +1,84 @@
1
+ <?php
2
+ if ( !defined( 'ABSPATH' ) ) exit;
3
+
4
+ if ( !class_exists( 'rtbDeactivationSurvey' ) ) {
5
+ /**
6
+ * Class to handle plugin deactivation survey
7
+ *
8
+ * @since 2.0.15
9
+ */
10
+ class rtbDeactivationSurvey {
11
+
12
+ public function __construct() {
13
+ add_action( 'current_screen', array( $this, 'maybe_add_survey' ) );
14
+ }
15
+
16
+ public function maybe_add_survey() {
17
+ if ( in_array( get_current_screen()->id, array( 'plugins', 'plugins-network' ), true) ) {
18
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_deactivation_scripts') );
19
+ add_action( 'admin_footer', array( $this, 'add_deactivation_html') );
20
+ }
21
+ }
22
+
23
+ public function enqueue_deactivation_scripts() {
24
+ wp_enqueue_style( 'rtb-deactivation-css', RTB_PLUGIN_URL . '/assets/css/plugin-deactivation.css' );
25
+ wp_enqueue_script( 'rtb-deactivation-js', RTB_PLUGIN_URL . '/assets/js/plugin-deactivation.js', array( 'jquery' ) );
26
+
27
+ wp_localize_script( 'rtb-deactivation-js', 'rtb_deactivation_data', array( 'site_url' => site_url() ) );
28
+ }
29
+
30
+ public function add_deactivation_html() {
31
+
32
+ $install_time = get_option( 'rtb-installation-time' );
33
+
34
+ $options = array(
35
+ 1 => array(
36
+ 'title' => esc_html__( 'I no longer need the plugin', 'restaurant-reservations' ),
37
+ ),
38
+ 2 => array(
39
+ 'title' => esc_html__( 'I\'m switching to a different plugin', 'restaurant-reservations' ),
40
+ 'details' => esc_html__( 'Please share which plugin', 'restaurant-reservations' ),
41
+ ),
42
+ 3 => array(
43
+ 'title' => esc_html__( 'I couldn\'t get the plugin to work', 'restaurant-reservations' ),
44
+ 'details' => esc_html__( 'Please share what wasn\'t working', 'restaurant-reservations' ),
45
+ ),
46
+ 4 => array(
47
+ 'title' => esc_html__( 'It\'s a temporary deactivation', 'restaurant-reservations' ),
48
+ ),
49
+ 5 => array(
50
+ 'title' => esc_html__( 'Other', 'restaurant-reservations' ),
51
+ 'details' => esc_html__( 'Please share the reason', 'restaurant-reservations' ),
52
+ ),
53
+ );
54
+ ?>
55
+ <div class="rtb-deactivate-survey-modal" id="rtb-deactivate-survey-restaurant-reservations">
56
+ <div class="rtb-deactivate-survey-wrap">
57
+ <form class="rtb-deactivate-survey" method="post" data-installtime="<?php echo $install_time; ?>">
58
+ <span class="rtb-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . __( 'Quick Feedback', 'restaurant-reservations' ); ?></span>
59
+ <span class="rtb-deactivate-survey-desc"><?php echo __('If you have a moment, please share why you are deactivating Five-Star Restaurant Reservations:', 'restaurant-reservations' ); ?></span>
60
+ <div class="rtb-deactivate-survey-options">
61
+ <?php foreach ( $options as $id => $option ) : ?>
62
+ <div class="rtb-deactivate-survey-option">
63
+ <label for="rtb-deactivate-survey-option-restaurant-reservations-<?php echo $id; ?>" class="rtb-deactivate-survey-option-label">
64
+ <input id="rtb-deactivate-survey-option-restaurant-reservations-<?php echo $id; ?>" class="rtb-deactivate-survey-option-input" type="radio" name="code" value="<?php echo $id; ?>" />
65
+ <span class="rtb-deactivate-survey-option-reason"><?php echo $option['title']; ?></span>
66
+ </label>
67
+ <?php if ( ! empty( $option['details'] ) ) : ?>
68
+ <input class="rtb-deactivate-survey-option-details" type="text" placeholder="<?php echo $option['details']; ?>" />
69
+ <?php endif; ?>
70
+ </div>
71
+ <?php endforeach; ?>
72
+ </div>
73
+ <div class="rtb-deactivate-survey-footer">
74
+ <button type="submit" class="rtb-deactivate-survey-submit button button-primary button-large"><?php _e('Submit and Deactivate', 'restaurant-reservations' ); ?></button>
75
+ <a href="#" class="rtb-deactivate-survey-deactivate"><?php _e('Skip and Deactivate', 'restaurant-reservations' ); ?></a>
76
+ </div>
77
+ </form>
78
+ </div>
79
+ </div>
80
+ <?php
81
+ }
82
+ }
83
+
84
+ }
includes/Editor.class.php CHANGED
@@ -793,11 +793,11 @@ class cffrtbEditor {
793
*
794
* @since 0.1
795
*/
796
- public function ajax_reset_all() {
797
global $rtb_controller;
798
799
// Authenticate request
800
- if ( !check_ajax_referer( 'cffrtb-editor', 'nonce' ) || !current_user_can( 'manage_options' ) ) {
801
$this->nopriv_ajax();
802
}
803
793
*
794
* @since 0.1
795
*/
796
+ public function ajax_reset_all( $authorized = false) {
797
global $rtb_controller;
798
799
// Authenticate request
800
+ if ( ( !check_ajax_referer( 'cffrtb-editor', 'nonce' ) || !current_user_can( 'manage_options' ) ) and ! $authorized ) {
801
$this->nopriv_ajax();
802
}
803
includes/Export.PDF.class.php CHANGED
@@ -129,7 +129,8 @@ class ebfrtbExportPDF extends ebfrtbExport {
129
ob_get_clean();
130
131
if ( $this->lib === 'tcpdf' || $this->lib === 'mpdf' ) {
132
- $this->export->Output( $filename, 'I'); exit();
133
134
} else {
135
do_action( 'ebcfrtb_pdf_deliver_' . $this->lib, $this );
129
ob_get_clean();
130
131
if ( $this->lib === 'tcpdf' || $this->lib === 'mpdf' ) {
132
+ $this->export->Output( $filename, 'I');
133
+ exit();
134
135
} else {
136
do_action( 'ebcfrtb_pdf_deliver_' . $this->lib, $this );
includes/InstallationWalkthrough.class.php CHANGED
@@ -31,7 +31,7 @@ class rtbInstallationWalkthrough {
31
return;
32
33
$bookings = get_posts(array('post_type' => 'rtb-booking'));
34
- if (!empty($bookings)) {
35
set_transient('rtb-admin-install-notice', true, 5);
36
return;
37
}
31
return;
32
33
$bookings = get_posts(array('post_type' => 'rtb-booking'));
34
+ if ( ! empty($bookings)) {
35
set_transient('rtb-admin-install-notice', true, 5);
36
return;
37
}
includes/Notification.Email.class.php CHANGED
@@ -130,12 +130,22 @@ class rtbNotificationEmail extends rtbNotification {
130
$subject = $rtb_controller->settings->get_setting( 'subject-booking-user' );
131
}
132
133
- } elseif ( $this->event == 'pending_to_confirmed' ) {
134
$subject = $rtb_controller->settings->get_setting( 'subject-confirmed-user' );
135
136
} elseif ( $this->event == 'pending_to_closed' ) {
137
$subject = $rtb_controller->settings->get_setting( 'subject-rejected-user' );
138
139
} elseif ( $this->event == 'late_user' ) {
140
$subject = $rtb_controller->settings->get_setting( 'subject-late-user' );
141
@@ -175,8 +185,6 @@ class rtbNotificationEmail extends rtbNotification {
175
*/
176
public function set_message() {
177
178
- $settings = get_option( 'rtb-settings' );
179
-
180
if ( $this->event == 'new_submission' ) {
181
if ( $this->target == 'user' ) {
182
$template = $this->get_template( 'template-booking-user' );
@@ -184,6 +192,11 @@ class rtbNotificationEmail extends rtbNotification {
184
$template = $this->get_template( 'template-booking-admin' );
185
}
186
187
} elseif ( $this->event == 'pending_to_confirmed' ) {
188
if ( $this->target == 'user' ) {
189
$template = $this->get_template( 'template-confirmed-user' );
@@ -194,6 +207,13 @@ class rtbNotificationEmail extends rtbNotification {
194
$template = $this->get_template( 'template-rejected-user' );
195
}
196
197
} elseif ( $this->event == 'late_user' ) {
198
if ( $this->target == 'user' ) {
199
$template = $this->get_template( 'template-late-user' );
130
$subject = $rtb_controller->settings->get_setting( 'subject-booking-user' );
131
}
132
133
+ } elseif ( $this->event == 'rtb_confirmed_booking' ) {
134
+ $subject = $rtb_controller->settings->get_setting( 'subject-booking-confirmed-admin' );
135
+
136
+ }elseif ( $this->event == 'pending_to_confirmed' ) {
137
$subject = $rtb_controller->settings->get_setting( 'subject-confirmed-user' );
138
139
} elseif ( $this->event == 'pending_to_closed' ) {
140
$subject = $rtb_controller->settings->get_setting( 'subject-rejected-user' );
141
142
+ } elseif ( $this->event == 'booking_cancelled' ) {
143
+ if ( $this->target == 'admin' ) {
144
+ $subject = $rtb_controller->settings->get_setting( 'subject-booking-cancelled-admin' );
145
+ } elseif ( $this->target == 'user' ) {
146
+ $subject = $rtb_controller->settings->get_setting( 'subject-booking-cancelled-user' );
147
+ }
148
+
149
} elseif ( $this->event == 'late_user' ) {
150
$subject = $rtb_controller->settings->get_setting( 'subject-late-user' );
151
185
*/
186
public function set_message() {
187
188
if ( $this->event == 'new_submission' ) {
189
if ( $this->target == 'user' ) {
190
$template = $this->get_template( 'template-booking-user' );
192
$template = $this->get_template( 'template-booking-admin' );
193
}
194
195
+ } elseif ( $this->event == 'rtb_confirmed_booking' ) {
196
+ if ( $this->target == 'admin' ) {
197
+ $template = $this->get_template( 'template-booking-confirmed-admin' );
198
+ }
199
+
200
} elseif ( $this->event == 'pending_to_confirmed' ) {
201
if ( $this->target == 'user' ) {
202
$template = $this->get_template( 'template-confirmed-user' );
207
$template = $this->get_template( 'template-rejected-user' );
208
}
209
210
+ } elseif ( $this->event == 'booking_cancelled' ) {
211
+ if ( $this->target == 'user' ) {
212
+ $template = $this->get_template( 'template-booking-cancelled-user' );
213
+ } elseif ( $this->target == 'admin' ) {
214
+ $template = $this->get_template( 'template-booking-cancelled-admin' );
215
+ }
216
+
217
} elseif ( $this->event == 'late_user' ) {
218
if ( $this->target == 'user' ) {
219
$template = $this->get_template( 'template-late-user' );
includes/Notification.SMS.class.php ADDED
@@ -0,0 +1,149 @@