PluginProbe
Spoki – Chat Buttons and WooCommerce Notifications / 2.0.8
Spoki – Chat Buttons and WooCommerce Notifications v2.0.8
2.17.4 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.10.0 2.11.0 2.11.1 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.14.0 All 69 releases
spoki / views / html-settings.php

html-settings.php in Spoki – Chat Buttons and WooCommerce Notifications 2.0.8, at views/html-settings.php

319 lines 15.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $has_wc = is_plugin_active('woocommerce/woocommerce.php');
3 $is_current_tab = $GLOBALS['current_tab'] == 'Settings';
4 $has_valid_secret = isset($this->options['secret_status']['code']) && $this->options['secret_status']['code'] == 200;
5 $has_key = (isset($this->options['secret']) && trim($this->options['secret']) != '') || (isset($this->options['delivery_url']) && trim($this->options['delivery_url']) != '');
6 $has_spoki_keys = (isset($this->options['secret']) && trim($this->options['secret']) != '') && (isset($this->options['delivery_url']) && trim($this->options['delivery_url']) != '');
7
8 if ($is_current_tab) {
9 Spoki()->fetch_secret_status();
10
11 if ($has_wc && $has_spoki_keys && !isset($this->options['account_info']['plan']['name'])) {
12 Spoki()->fetch_account_info();
13 }
14 }
15
16 if ($has_wc && $has_key && !$has_valid_secret) { ?>
17 <div class="notice notice-error">
18 <p>
19 <b><?php _e('Your Spoki keys are not valid!', "spoki"); ?></b>
20 <a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=<?php echo urlencode('Settings') ?>">
21 <?php _e('Settings', "spoki") ?>
22 </a>
23 </p>
24 </div>
25 <?php } ?>
26
27 <div <?php if (!$is_current_tab) echo 'style="display:none"' ?>>
28 <h2><?php _e('Account info', "spoki") ?></h2>
29 <p><?php _e('This account info will be used to let WhatsApp buttons work.', "spoki") ?></p>
30 <table class="form-table">
31 <tr>
32 <th scope="row">
33 <label for="<?php echo SPOKI_OPTIONS ?>[telephone]">
34 <?php _e('Your WhatsApp Telephone', "spoki") ?> *
35 </label>
36 </th>
37 <td>
38 <input type="tel" class="regular-text"
39 name="<?php echo SPOKI_OPTIONS ?>[telephone]"
40 placeholder="+393331234567"
41 value="<?php if (isset($this->options['telephone']) && trim($this->options['telephone']) != '') echo $this->options['telephone'] ?>"
42 />
43 <p class="description">
44 * <?php _e("Your customers will send messages to this WhatsApp number", "spoki") ?>
45 </p>
46 </td>
47 </tr>
48 <tr>
49 <th scope="row">
50 <label for="<?php echo SPOKI_OPTIONS ?>[shop_name]">
51 <?php _e('Shop Name', "spoki") ?> *
52 </label>
53 </th>
54 <td>
55 <input type="text" class="regular-text" <?php if ($is_current_tab) echo 'required' ?>
56 name="<?php echo SPOKI_OPTIONS ?>[shop_name]"
57 placeholder="<?php echo Spoki()->shop['name'] ?>"
58 value="<?php if (isset($this->options['shop_name']) && trim($this->options['shop_name']) != '') echo $this->options['shop_name'] ?>"
59 />
60 </td>
61 </tr>
62 <tr>
63 <th scope="row">
64 <label for="<?php echo SPOKI_OPTIONS ?>[email]">
65 <?php _e('Email', "spoki") ?> *
66 </label>
67 </th>
68 <td>
69 <input type="email" class="regular-text" <?php if ($is_current_tab) echo 'required' ?>
70 name="<?php echo SPOKI_OPTIONS ?>[email]"
71 placeholder="<?php echo Spoki()->shop['email'] ?>"
72 value="<?php if (isset($this->options['email']) && trim($this->options['email']) != '') echo $this->options['email'] ?>"
73 />
74 </td>
75 </tr>
76 <?php if ($is_current_tab): ?>
77 <tr>
78 <th>
79 <label for="single_product_button_position">
80 <b><?php _e('Language', "spoki") ?></b>
81 </label>
82 </th>
83 <td>
84 <?php
85 $language = Spoki()->shop['language'];
86 $is_spanish = spoki_starts_with($language, 'es');
87 $is_italian = spoki_starts_with($language, 'it');
88 $is_portoguese = spoki_starts_with($language, 'pt');
89 $is_english = !$is_italian && !$is_spanish && !$is_portoguese;
90 ?>
91 <select name="<?php echo SPOKI_OPTIONS ?>[language]" id="language" class="regular-text">
92 <option value="en-EN" <?php echo $is_english ? 'selected' : '' ?>><?php echo __('English', "spoki") ?></option>
93 <option value="it-IT" <?php echo $is_italian ? 'selected' : '' ?>><?php echo __('Italian', "spoki") ?></option>
94 <option value="es-ES" <?php echo $is_spanish ? 'selected' : '' ?>><?php echo __('Spanish', "spoki") ?></option>
95 <option value="pt-PT" <?php echo $is_portoguese ? 'selected' : '' ?>><?php echo __('Portuguese', "spoki") ?></option>
96 </select>
97 <p class="description">
98 <?php _e('Your language is not in list?', "spoki") ?> <a target="_blank" href="<?php echo SPOKI_SUGGEST_TEMPLATES_URL ?>"><?php _e('Suggest messages', "spoki")?></a>
99 </p>
100 <p class="description">
101 * <?php _e('Choose the language of the WooCommerce messages to send to customers', "spoki"); ?>
102 </p>
103 </td>
104 </tr>
105 <?php endif; ?>
106 <tr>
107 <th scope="row">
108 <label for="<?php echo SPOKI_OPTIONS ?>[contact_link]">
109 <?php _e('Contact link', "spoki") ?>
110 </label>
111 </th>
112 <td>
113 <input type="text" class="regular-text"
114 name="<?php echo SPOKI_OPTIONS ?>[contact_link]"
115 placeholder="<?php _e('Reply to the WhatsApp telephone', 'spoki') ?>"
116 value="<?php if (isset($this->options['contact_link']) && trim($this->options['contact_link']) != '') echo $this->options['contact_link'] ?>"
117 />
118 <p class="description">
119 * <?php _e("Enter a link where your customers can contact you after receiving the notification message. This link will come at the end of each WooCommerce notification message", "spoki") ?>
120 </p>
121 </td>
122 </tr>
123 </table>
124 <br/>
125 <hr/>
126 <h2><?php _e('Spoki keys', "spoki") ?></h2>
127 <p class="description"><?php _e('Enter here the keys we emailed you to send automatic notifications with WooCommerce.', "spoki") ?></p>
128 <table class="form-table">
129 <tr>
130 <th scope="row"><?php _e('Current Spoki Plan', "spoki") ?></th>
131 <td>
132 <p>
133 <?php
134 if ($has_spoki_keys && isset($this->options['account_info']['plan']['name'])) {
135 echo "<b>" . $this->options['account_info']['plan']['name'] . "</b> ";
136 echo "<a href='" . $this->options['account_info']['upgrade_url'] . "' target='_blank'>" . __('Change plan', "spoki") . "</a>";
137 } else {
138 _e('There is no associated Spoki plan.<br/>If you already have a Spoki account insert your Spoki keys below, if not', "spoki");
139 echo " <a href='" . Spoki()->get_plan_link(false) . "' target='_blank'>" . __('enable Spoki Free', "spoki") . "</a>.";
140 }
141 ?>
142 </p>
143 </td>
144 </tr>
145 <tr>
146 <th scope="row"><?php _e('Spoki Delivery URL', "spoki") ?></th>
147 <td>
148 <input type="text" class="regular-text" name="<?php echo SPOKI_OPTIONS ?>[delivery_url]" value="<?php if (isset($this->options['delivery_url']) && trim($this->options['delivery_url']) != '') echo $this->options['delivery_url'] ?>">
149 </td>
150 </tr>
151 <tr>
152 <th scope="row"><?php _e('Spoki Secret', "spoki") ?></th>
153 <td>
154 <input type="text" class="regular-text" name="<?php echo SPOKI_OPTIONS ?>[secret]" value="<?php if (isset($this->options['secret']) && trim($this->options['secret']) != '') echo $this->options['secret'] ?>">
155 <?php if ($has_valid_secret):
156 echo "<p class='text-success'>" . __('Valid keys!', "spoki") . "</p>";
157 else:
158 echo "<p class='text-danger'>" . __('Invalid keys', "spoki") . "</p>";
159 endif; ?>
160 </td>
161 </tr>
162 </table>
163 <br/>
164 <hr/>
165 <h2><?php _e('Billing data', "spoki") ?></h2>
166 <p><?php _e('If you have a Spoki subscription plan we will send you an invoice with these billing data.', "spoki") ?></p>
167 <table class="form-table">
168 <tr>
169 <th scope="row">
170 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][vat_name]">
171 <?php _e('VAT Name', "spoki") ?>
172 </label>
173 </th>
174 <td>
175 <input type="text" class="regular-text"
176 name="<?php echo SPOKI_OPTIONS ?>[billing_data][vat_name]"
177 value="<?php if (isset($this->options['billing_data']['vat_name']) && trim($this->options['billing_data']['vat_name']) != '') echo $this->options['billing_data']['vat_name'] ?>"
178 />
179 </td>
180 </tr>
181 <tr>
182 <th scope="row">
183 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][route]">
184 <?php _e('Address', "spoki") ?>
185 </label>
186 </th>
187 <td>
188 <input type="text" class="regular-text"
189 name="<?php echo SPOKI_OPTIONS ?>[billing_data][route]"
190 value="<?php if (isset($this->options['billing_data']['route']) && trim($this->options['billing_data']['route']) != '') echo $this->options['billing_data']['route'] ?>"
191 />
192 </td>
193 </tr>
194 <tr>
195 <th scope="row">
196 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][zip_code]">
197 <?php _e('Zip Code', "spoki") ?>
198 </label>
199 </th>
200 <td>
201 <input type="text" class="regular-text"
202 name="<?php echo SPOKI_OPTIONS ?>[billing_data][zip_code]"
203 value="<?php if (isset($this->options['billing_data']['zip_code']) && trim($this->options['billing_data']['zip_code']) != '') echo $this->options['billing_data']['zip_code'] ?>"
204 />
205 </td>
206 </tr>
207 <tr>
208 <th scope="row">
209 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][city]">
210 <?php _e('City', "spoki") ?>
211 </label>
212 </th>
213 <td>
214 <input type="text" class="regular-text"
215 name="<?php echo SPOKI_OPTIONS ?>[billing_data][city]"
216 value="<?php if (isset($this->options['billing_data']['city']) && trim($this->options['billing_data']['city']) != '') echo $this->options['billing_data']['city'] ?>"
217 />
218 </td>
219 </tr>
220 <tr>
221 <th scope="row">
222 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][province]">
223 <?php _e('Province', "spoki") ?>
224 </label>
225 </th>
226 <td>
227 <input type="text" class="regular-text"
228 name="<?php echo SPOKI_OPTIONS ?>[billing_data][province]"
229 value="<?php if (isset($this->options['billing_data']['province']) && trim($this->options['billing_data']['province']) != '') echo $this->options['billing_data']['province'] ?>"
230 />
231 </td>
232 </tr>
233 <tr>
234 <th scope="row">
235 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][country]">
236 <?php _e('Country', "spoki") ?>
237 </label>
238 </th>
239 <td>
240 <input type="text" class="regular-text"
241 name="<?php echo SPOKI_OPTIONS ?>[billing_data][country]"
242 value="<?php if (isset($this->options['billing_data']['country']) && trim($this->options['billing_data']['country']) != '') echo $this->options['billing_data']['country'] ?>"
243 />
244 </td>
245 </tr>
246 <tr>
247 <th scope="row">
248 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][vat_number]">
249 <?php _e('VAT Number', "spoki") ?>
250 </label>
251 </th>
252 <td>
253 <input type="text" class="regular-text"
254 name="<?php echo SPOKI_OPTIONS ?>[billing_data][vat_number]"
255 value="<?php if (isset($this->options['billing_data']['vat_number']) && trim($this->options['billing_data']['vat_number']) != '') echo $this->options['billing_data']['vat_number'] ?>"
256 />
257 </td>
258 </tr>
259 <tr>
260 <th scope="row">
261 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][c_f]">
262 <?php _e('Fiscal Code', "spoki") ?>
263 </label>
264 </th>
265 <td>
266 <input type="text" class="regular-text"
267 name="<?php echo SPOKI_OPTIONS ?>[billing_data][c_f]"
268 value="<?php if (isset($this->options['billing_data']['c_f']) && trim($this->options['billing_data']['c_f']) != '') echo $this->options['billing_data']['c_f'] ?>"
269 />
270 </td>
271 </tr>
272 <tr>
273 <th scope="row">
274 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][pec]">
275 <?php _e('PEC', "spoki") ?>
276 </label>
277 </th>
278 <td>
279 <input type="email" class="regular-text"
280 name="<?php echo SPOKI_OPTIONS ?>[billing_data][pec]"
281 value="<?php if (isset($this->options['billing_data']['pec']) && trim($this->options['billing_data']['pec']) != '') echo $this->options['billing_data']['pec'] ?>"
282 />
283 </td>
284 </tr>
285 <tr>
286 <th scope="row">
287 <label for="<?php echo SPOKI_OPTIONS ?>[billing_data][pec]">
288 <?php _e('SID', "spoki") ?>
289 </label>
290 </th>
291 <td>
292 <input type="text" class="regular-text"
293 name="<?php echo SPOKI_OPTIONS ?>[billing_data][sid]"
294 value="<?php if (isset($this->options['billing_data']['sid']) && trim($this->options['billing_data']['sid']) != '') echo $this->options['billing_data']['sid'] ?>"
295 />
296 </td>
297 </tr>
298 </table>
299
300 <br/><br/><br/>
301 <div>
302 <input type="checkbox" id="terms_check" <?php if ($is_current_tab) echo 'required' ?>
303 name="<?php echo SPOKI_OPTIONS ?>[terms_check]"
304 value="1" <?php if (isset($this->options['terms_check'])) echo checked(1, $this->options['terms_check'], false) ?>>
305 <label for="terms_check">
306 <?php _e("I accept", "spoki") ?>
307 <a href="https://app.spoki.it/static/terms_conditions_spoki_flex.pdf" target="_blank"><?php _e('general terms and conditions', "spoki") ?></a>
308 <?php _e("for using the Spoki service and the", "spoki") ?>
309 <a href="https://app.spoki.it/static/attachment1_spoki_flex.pdf" target="_blank"><?php _e('privacy policy', "spoki") ?></a>.
310 </label>
311 </div>
312
313 <?php if ($is_current_tab) : ?>
314 <input type="hidden" name="<?php echo SPOKI_OPTIONS ?>[is_settings]" value="1">
315 <?php
316 endif;
317 submit_button(); ?>
318 </div>
319