1 | <?php |
||
2 | /** |
||
3 | * The Settings Screen for the Importer Plugin |
||
4 | * |
||
5 | * @package lsx_wetu_importer |
||
6 | * @author LightSpeed |
||
7 | * @license GPL-2.0+ |
||
8 | * @link |
||
9 | * @copyright 2019 LightSpeed |
||
10 | **/ |
||
11 | |||
12 | /** |
||
13 | * The Welcome Screen for the Importer Plugin |
||
14 | */ |
||
15 | class LSX_WETU_Importer_Settings { |
||
16 | |||
17 | /** |
||
18 | * Holds instance of the class |
||
19 | * |
||
20 | * @var object |
||
21 | */ |
||
22 | private static $instance; |
||
23 | |||
24 | /** |
||
25 | * Holds the default settings. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | public $defaults = array(); |
||
30 | |||
31 | /** |
||
32 | * Holds the settings fields available. |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | public $fields = array(); |
||
37 | |||
38 | /** |
||
39 | * Initialize the plugin by setting localization, filters, and administration functions. |
||
40 | * |
||
41 | * @since 1.0.0 |
||
42 | * |
||
43 | * @access private |
||
44 | */ |
||
45 | public function __construct() { |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
46 | $this->defaults = array( |
||
47 | 'api_key' => '', |
||
48 | 'disable_tour_title' => '', |
||
49 | 'disable_tour_descriptions' => '', |
||
50 | 'disable_tour_tags' => 'on', |
||
51 | 'enable_tour_featured_random' => '', |
||
52 | 'disable_accommodation_title' => '', |
||
53 | 'disable_accommodation_descriptions' => '', |
||
54 | 'disable_accommodation_filtering' => '', |
||
55 | 'disable_accommodation_excerpts' => '', |
||
56 | 'disable_destination_title' => '', |
||
57 | 'disable_destination_descriptions' => '', |
||
58 | 'image_replacing' => 'on', |
||
59 | 'image_limit' => '15', |
||
60 | 'image_scaling' => 'on', |
||
61 | 'width' => '800', |
||
62 | 'height' => '600', |
||
63 | 'scaling' => 'h', |
||
64 | 'enable_tour_ref_column' => '', |
||
65 | 'cron_schedule' => 'daily', |
||
66 | 'accommodation_images_cron' => '', |
||
67 | 'accommodation_images_cron_featured' => '', |
||
68 | ); |
||
69 | $this->fields = array_keys( $this->defaults ); |
||
70 | add_action( 'admin_init', array( $this, 'save_options' ) ); |
||
71 | } |
||
0 ignored issues
–
show
|
|||
72 | |||
73 | /** |
||
74 | * Return an instance of this class. |
||
75 | * |
||
76 | * @return object |
||
77 | */ |
||
78 | public static function get_instance() { |
||
79 | // If the single instance hasn't been set, set it now. |
||
80 | if ( ! isset( self::$instance ) ) { |
||
0 ignored issues
–
show
|
|||
81 | self::$instance = new self(); |
||
82 | } |
||
0 ignored issues
–
show
|
|||
83 | return self::$instance; |
||
84 | } |
||
0 ignored issues
–
show
|
|||
85 | |||
86 | /** |
||
87 | * Display the importer welcome screen |
||
88 | */ |
||
89 | public function display_page() { |
||
90 | $options = lsx_wetu_get_options(); |
||
91 | foreach ( $options as $key => $value ) { |
||
0 ignored issues
–
show
|
|||
92 | $value = trim( $value ); |
||
93 | } |
||
0 ignored issues
–
show
|
|||
94 | $options = wp_parse_args( $options, $this->defaults ); |
||
95 | ?> |
||
96 | <div class="wrap"> |
||
97 | <form method="post" class=""> |
||
98 | <?php wp_nonce_field( 'lsx_wetu_importer_save', 'lsx_wetu_importer_save_options' ); ?> |
||
99 | <?php do_action( 'lsx_wetu_importer_settings_before' ); ?> |
||
100 | <h1><?php esc_html_e( 'General', 'lsx-wetu-importer' ); ?></h1> |
||
101 | <table class="form-table"> |
||
102 | <tbody> |
||
103 | <tr class="form-field"> |
||
104 | <th scope="row"> |
||
105 | <label for="wetu_api_key"><span title="The API key can be found on your My Account page of your WETU account." id="doc-tooltip" class="dashicons dashicons-editor-help tooltip"></span> <?php esc_html_e( 'API Key', 'lsx-wetu-importer' ); ?></label> |
||
106 | </th> |
||
107 | <td> |
||
108 | <input data-toggle="tooltip" data-placement="top" title="The API key can be found on your My Account page of your WETU account." type="text" value=" |
||
109 | <?php |
||
110 | if ( isset( $options['api_key'] ) ) { |
||
0 ignored issues
–
show
|
|||
111 | echo esc_attr( $options['api_key'] ); |
||
112 | } |
||
113 | ?> |
||
114 | " name="api_key" /> |
||
115 | </td> |
||
116 | </tr> |
||
117 | </tbody> |
||
118 | </table> |
||
119 | |||
120 | <h1><?php esc_html_e( 'Tours', 'lsx-wetu-importer' ); ?></h1> |
||
121 | <table class="form-table"> |
||
122 | <tbody> |
||
123 | <tr class="form-field -wrap"> |
||
124 | <th scope="row"> |
||
125 | <label for="disable_tour_title"><?php esc_html_e( 'Enable Custom Titles', 'lsx-wetu-importer' ); ?></label> |
||
126 | </th> |
||
127 | <td> |
||
128 | <input type="checkbox" |
||
129 | <?php |
||
130 | if ( isset( $options['disable_tour_title'] ) && '' !== $options['disable_tour_title'] ) { |
||
0 ignored issues
–
show
|
|||
131 | echo esc_attr( 'checked="checked"' ); |
||
132 | } |
||
133 | ?> |
||
134 | name="disable_tour_title" /> |
||
135 | |||
136 | <small><?php esc_html_e( 'If you are going to manage your tour descriptions on this site and not on WETU then enable this setting.', 'lsx-wetu-importer' ); ?></small> |
||
137 | </td> |
||
138 | </tr> |
||
139 | <tr class="form-field -wrap"> |
||
140 | <th scope="row"> |
||
141 | <label for="disable_tour_descriptions"><?php esc_html_e( 'Disable Descriptions', 'lsx-wetu-importer' ); ?></label> |
||
142 | </th> |
||
143 | <td> |
||
144 | <input type="checkbox" |
||
145 | <?php |
||
146 | if ( isset( $options['disable_tour_descriptions'] ) && '' !== $options['disable_tour_descriptions'] ) { |
||
0 ignored issues
–
show
|
|||
147 | echo esc_attr( 'checked="checked"' ); |
||
148 | } |
||
149 | ?> |
||
150 | name="disable_tour_descriptions" /> |
||
151 | |||
152 | <small><?php esc_html_e( 'If you are going to manage your tour descriptions on this site and not on WETU then enable this setting.', 'lsx-wetu-importer' ); ?></small> |
||
153 | </td> |
||
154 | </tr> |
||
155 | <tr class="form-field -wrap"> |
||
156 | <th scope="row"> |
||
157 | <label for="disable_tour_tags"><?php esc_html_e( 'Disable Tags / Travel Styles', 'lsx-wetu-importer' ); ?></label> |
||
158 | </th> |
||
159 | <td> |
||
160 | <input type="checkbox" |
||
161 | <?php |
||
162 | if ( isset( $options['disable_tour_tags'] ) && '' !== $options['disable_tour_tags'] ) { |
||
0 ignored issues
–
show
|
|||
163 | echo esc_attr( 'checked="checked"' ); |
||
164 | } |
||
165 | ?> |
||
166 | name="disable_tour_tags" /> |
||
167 | |||
168 | <small><?php esc_html_e( 'Disable this is you dont want the option available on the import screen.', 'lsx-wetu-importer' ); ?></small> |
||
169 | </td> |
||
170 | </tr> |
||
171 | |||
172 | <tr class="form-field -wrap"> |
||
173 | <th scope="row"> |
||
174 | <label for="enable_tour_ref_column"><?php esc_html_e( 'Enable Reference Column', 'lsx-wetu-importer' ); ?></label> |
||
175 | </th> |
||
176 | <td> |
||
177 | <input type="checkbox" |
||
178 | <?php |
||
179 | if ( isset( $options['enable_tour_ref_column'] ) && '' !== $options['enable_tour_ref_column'] ) { |
||
0 ignored issues
–
show
|
|||
180 | echo esc_attr( 'checked="checked"' ); |
||
181 | } |
||
182 | ?> |
||
183 | name="enable_tour_ref_column" /> |
||
184 | <small><?php esc_html_e( 'Enables the use of the WETU Reference Column for better tours management.', 'lsx-wetu-importer' ); ?></small> |
||
185 | </td> |
||
186 | </tr> |
||
187 | |||
188 | <tr class="form-field -wrap"> |
||
189 | <th scope="row"> |
||
190 | <label for="enable_tour_featured_random"><?php esc_html_e( 'Randomize Featured Image', 'lsx-wetu-importer' ); ?></label> |
||
191 | </th> |
||
192 | <td> |
||
193 | <input type="checkbox" |
||
194 | <?php |
||
195 | if ( isset( $options['enable_tour_featured_random'] ) && '' !== $options['enable_tour_featured_random'] ) { |
||
0 ignored issues
–
show
|
|||
196 | echo esc_attr( 'checked="checked"' ); |
||
197 | } |
||
198 | ?> |
||
199 | name="enable_tour_featured_random" /> |
||
200 | <small><?php esc_html_e( 'This will randomize the featured image from the destination gallery.', 'lsx-wetu-importer' ); ?></small> |
||
201 | </td> |
||
202 | </tr> |
||
203 | </tbody> |
||
204 | </table> |
||
205 | |||
206 | <h1><?php esc_html_e( 'Accommodation', 'lsx-wetu-importer' ); ?></h1> |
||
207 | |||
208 | <table class="form-table"> |
||
209 | <tbody> |
||
210 | <tr class="form-field -wrap"> |
||
211 | <th scope="row"> |
||
212 | <label for="disable_accommodation_title"><?php esc_html_e( 'Enable Custom Titles', 'lsx-wetu-importer' ); ?></label> |
||
213 | </th> |
||
214 | <td> |
||
215 | <input type="checkbox" |
||
216 | <?php |
||
217 | if ( isset( $options['disable_accommodation_title'] ) && '' !== $options['disable_accommodation_title'] ) { |
||
0 ignored issues
–
show
|
|||
218 | echo esc_attr( 'checked="checked"' ); |
||
219 | } |
||
220 | ?> |
||
221 | name="disable_accommodation_title" /> |
||
222 | |||
223 | <small><?php esc_html_e( 'If you are going to manage your tour descriptions on this site and not on WETU then enable this setting.', 'lsx-wetu-importer' ); ?></small> |
||
224 | </td> |
||
225 | </tr> |
||
226 | <tr class="form-field -wrap"> |
||
227 | <th scope="row"> |
||
228 | <label for="disable_accommodation_descriptions"><?php esc_html_e( 'Disable Descriptions', 'lsx-wetu-importer' ); ?></label> |
||
229 | </th> |
||
230 | <td> |
||
231 | <input type="checkbox" |
||
232 | <?php |
||
233 | if ( isset( $options['disable_accommodation_descriptions'] ) && '' !== $options['disable_accommodation_descriptions'] ) { |
||
0 ignored issues
–
show
|
|||
234 | echo esc_attr( 'checked="checked"' ); |
||
235 | } |
||
236 | ?> |
||
237 | name="disable_accommodation_descriptions" /> |
||
238 | <small><?php esc_html_e( 'If you are going to edit the accommodation descriptions imported then enable this setting.', 'lsx-wetu-importer' ); ?></small> |
||
239 | </td> |
||
240 | </tr> |
||
241 | <tr class="form-field -wrap"> |
||
242 | <th scope="row"> |
||
243 | <label for="disable_accommodation_filtering"><?php esc_html_e( 'Disable Description Filtering', 'lsx-wetu-importer' ); ?></label> |
||
244 | </th> |
||
245 | <td> |
||
246 | <input type="checkbox" |
||
247 | <?php |
||
248 | if ( isset( $options['disable_accommodation_filtering'] ) && '' !== $options['disable_accommodation_filtering'] ) { |
||
0 ignored issues
–
show
|
|||
249 | echo esc_attr( 'checked="checked"' ); |
||
250 | } |
||
251 | ?> |
||
252 | name="disable_accommodation_filtering" /> |
||
253 | <small><?php esc_html_e( 'This will stop the HTML from being stripped out of the description.', 'lsx-wetu-importer' ); ?></small> |
||
254 | </td> |
||
255 | </tr> |
||
256 | |||
257 | <tr class="form-field -wrap"> |
||
258 | <th scope="row"> |
||
259 | <label for="disable_accommodation_excerpts"><?php esc_html_e( 'Disable Excerpts', 'lsx-wetu-importer' ); ?></label> |
||
260 | </th> |
||
261 | <td> |
||
262 | <input type="checkbox" |
||
263 | <?php |
||
264 | if ( isset( $options['disable_accommodation_excerpts'] ) && '' !== $options['disable_accommodation_excerpts'] ) { |
||
0 ignored issues
–
show
|
|||
265 | echo esc_attr( 'checked="checked"' ); |
||
266 | } |
||
267 | ?> |
||
268 | name="disable_accommodation_excerpts" /> |
||
269 | <small><?php esc_html_e( 'If you are going to edit the accommodation excerpts then enable this setting.', 'lsx-wetu-importer' ); ?></small> |
||
270 | </td> |
||
271 | </tr> |
||
272 | </tbody> |
||
273 | </table> |
||
274 | |||
275 | <h1><?php esc_html_e( 'Destinations', 'lsx-wetu-importer' ); ?></h1> |
||
276 | |||
277 | <table class="form-table"> |
||
278 | <tbody> |
||
279 | <tr class="form-field -wrap"> |
||
280 | <th scope="row"> |
||
281 | <label for="disable_destination_title"><?php esc_html_e( 'Enable Custom Titles', 'lsx-wetu-importer' ); ?></label> |
||
282 | </th> |
||
283 | <td> |
||
284 | <input type="checkbox" |
||
285 | <?php |
||
286 | if ( isset( $options['disable_destination_title'] ) && '' !== $options['disable_destination_title'] ) { |
||
0 ignored issues
–
show
|
|||
287 | echo esc_attr( 'checked="checked"' ); |
||
288 | } |
||
289 | ?> |
||
290 | name="disable_destination_title" /> |
||
291 | |||
292 | <small><?php esc_html_e( 'If you are going to manage your tour descriptions on this site and not on WETU then enable this setting.', 'lsx-wetu-importer' ); ?></small> |
||
293 | </td> |
||
294 | </tr> |
||
295 | <tr class="form-field -wrap"> |
||
296 | <th scope="row"> |
||
297 | <label for="disable_destination_descriptions"><?php esc_html_e( 'Disable Descriptions', 'lsx-wetu-importer' ); ?></label> |
||
298 | </th> |
||
299 | <td> |
||
300 | <input type="checkbox" |
||
301 | <?php |
||
302 | if ( isset( $options['disable_destination_descriptions'] ) && '' !== $options['disable_destination_descriptions'] ) { |
||
0 ignored issues
–
show
|
|||
303 | echo esc_attr( 'checked="checked"' ); |
||
304 | } |
||
305 | ?> |
||
306 | name="disable_destination_descriptions" /> |
||
307 | <small><?php esc_html_e( 'If you are going to edit the destination descriptions on this site then enable this setting.', 'lsx-wetu-importer' ); ?></small> |
||
308 | </td> |
||
309 | </tr> |
||
310 | </tbody> |
||
311 | </table> |
||
312 | |||
313 | <h1><?php esc_html_e( 'Images', 'lsx-wetu-importer' ); ?></h1> |
||
314 | |||
315 | <table class="form-table"> |
||
316 | <tbody> |
||
317 | <tr class="form-field -wrap"> |
||
318 | <th scope="row"> |
||
319 | <label for="image_replacing"><?php esc_html_e( 'Replace Images', 'lsx-wetu-importer' ); ?></label> |
||
320 | </th> |
||
321 | <td> |
||
322 | <input type="checkbox" |
||
323 | <?php |
||
324 | if ( isset( $options['image_replacing'] ) && '' !== $options['image_replacing'] ) { |
||
0 ignored issues
–
show
|
|||
325 | echo esc_attr( 'checked="checked"' ); |
||
326 | } |
||
327 | ?> |
||
328 | name="image_replacing" /> |
||
329 | <p><?php esc_html_e( 'Do you want your images to be replaced on each import.', 'lsx-wetu-importer' ); ?></p> |
||
330 | </td> |
||
331 | </tr> |
||
332 | <tr class="form-field -wrap"> |
||
333 | <th scope="row"> |
||
334 | <label for="image_limit"> <?php esc_html_e( 'Limit the amount of images imported to the gallery', 'lsx-wetu-importer' ); ?></label> |
||
335 | </th> |
||
336 | <td> |
||
337 | <input placeholder="" type="text" value=" |
||
338 | <?php |
||
339 | if ( isset( $options['image_limit'] ) && '' !== $options['image_limit'] ) { |
||
0 ignored issues
–
show
|
|||
340 | echo esc_attr( $options['image_limit'] ); |
||
341 | } |
||
342 | ?> |
||
343 | " |
||
344 | name="image_limit" /> |
||
345 | </td> |
||
346 | </tr> |
||
347 | |||
348 | <tr class="form-field -wrap"> |
||
349 | <th scope="row"> |
||
350 | <label for="image_scaling"><?php esc_html_e( 'Enable Image Scaling', 'lsx-wetu-importer' ); ?></label> |
||
351 | </th> |
||
352 | <td> |
||
353 | <input type="checkbox" |
||
354 | <?php |
||
355 | if ( isset( $options['image_scaling'] ) && '' !== $options['image_scaling'] ) { |
||
0 ignored issues
–
show
|
|||
356 | echo esc_attr( 'checked="checked"' ); |
||
357 | } |
||
358 | ?> |
||
359 | name="image_scaling" /> |
||
360 | </td> |
||
361 | </tr> |
||
362 | <tr class="form-field -wrap"> |
||
363 | <th scope="row"> |
||
364 | <label for="width"> <?php esc_html_e( 'Width (px)', 'lsx-wetu-importer' ); ?></label> |
||
365 | </th> |
||
366 | <td> |
||
367 | <input placeholder="800" type="text" value=" |
||
368 | <?php |
||
369 | if ( isset( $options['width'] ) && '' !== $options['width'] ) { |
||
0 ignored issues
–
show
|
|||
370 | echo esc_attr( $options['width'] ); |
||
371 | } |
||
372 | ?> |
||
373 | " |
||
374 | name="width" /> |
||
375 | </td> |
||
376 | </tr> |
||
377 | <tr class="form-field -wrap"> |
||
378 | <th scope="row"> |
||
379 | <label for="height"> <?php esc_html_e( 'Height (px)', 'lsx-wetu-importer' ); ?></label> |
||
380 | </th> |
||
381 | <td> |
||
382 | <input placeholder="600" type="text" value=" |
||
383 | <?php |
||
384 | if ( isset( $options['height'] ) && '' !== $options['height'] ) { |
||
0 ignored issues
–
show
|
|||
385 | echo esc_attr( $options['height'] ); |
||
386 | } |
||
387 | ?> |
||
388 | " |
||
389 | name="height" /> |
||
390 | </td> |
||
391 | </tr> |
||
392 | |||
393 | <tr class="form-field -wrap image-settings"> |
||
394 | <th scope="row"> |
||
395 | <label for="scaling"> <?php esc_html_e( 'Scaling', 'lsx-wetu-importer' ); ?></label> |
||
396 | </th> |
||
397 | <td> |
||
398 | <input type="radio" |
||
399 | <?php |
||
400 | if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'raw' === $options['scaling'] ) { |
||
0 ignored issues
–
show
|
|||
401 | echo esc_attr( 'checked="checked"' ); |
||
402 | } |
||
403 | ?> |
||
404 | name="scaling" value="raw" /> <?php esc_html_e( 'Get the Full size image, no cropping takes place.', 'lsx-wetu-importer' ); ?><br /> |
||
405 | <input type="radio" |
||
406 | <?php |
||
407 | if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'c' === $options['scaling'] ) { |
||
0 ignored issues
–
show
|
|||
408 | echo esc_attr( 'checked="checked"' ); |
||
409 | } |
||
410 | ?> |
||
411 | name="scaling" value="c" /> <?php esc_html_e( 'Crop image to fit fully into the frame, Crop is taken from middle, preserving as much of the image as possible.', 'lsx-wetu-importer' ); ?><br /> |
||
412 | <input type="radio" |
||
413 | <?php |
||
414 | if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'h' === $options['scaling'] ) { |
||
0 ignored issues
–
show
|
|||
415 | echo esc_attr( 'checked="checked"' ); |
||
416 | } |
||
417 | ?> |
||
418 | name="scaling" value="h" /> <?php esc_html_e( 'Crop image to fit fully into the frame, but resize to height first, then crop on width if needed', 'lsx-wetu-importer' ); ?><br /> |
||
419 | <input type="radio" |
||
420 | <?php |
||
421 | if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'w' === $options['scaling'] ) { |
||
0 ignored issues
–
show
|
|||
422 | echo esc_attr( 'checked="checked"' ); |
||
423 | } |
||
424 | ?> |
||
425 | name="scaling" value="w" /> <?php esc_html_e( 'Crop image to fit fully into the frame, but resize to width first, then crop on height if needed', 'lsx-wetu-importer' ); ?><br /> |
||
426 | <input type="radio" |
||
427 | <?php |
||
428 | if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'nf' === $options['scaling'] ) { |
||
0 ignored issues
–
show
|
|||
429 | echo esc_attr( 'checked="checked"' ); |
||
430 | } |
||
431 | ?> |
||
432 | name="scaling" value="nf" /> <?php esc_html_e( 'Resize the image to fit within the frame. but pad the image with white to ensure the resolution matches the frame', 'lsx-wetu-importer' ); ?><br /> |
||
433 | <input type="radio" |
||
434 | <?php |
||
435 | if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'n' === $options['scaling'] ) { |
||
0 ignored issues
–
show
|
|||
436 | echo esc_attr( 'checked="checked"' ); |
||
437 | } |
||
438 | ?> |
||
439 | name="scaling" value="n" /> <?php esc_html_e( 'Resize the image to fit within the frame. but do not upscale the image.', 'lsx-wetu-importer' ); ?><br /> |
||
440 | <input type="radio" |
||
441 | <?php |
||
442 | if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'W' === $options['scaling'] ) { |
||
0 ignored issues
–
show
|
|||
443 | echo esc_attr( 'checked="checked"' ); |
||
444 | } |
||
445 | ?> |
||
446 | name="scaling" value="W" /> <?php esc_html_e( 'Resize the image to fit within the frame. Image will not exceed specified dimensions', 'lsx-wetu-importer' ); ?> |
||
447 | </td> |
||
448 | </tr> |
||
449 | </tbody> |
||
450 | </table> |
||
451 | |||
452 | <h1><?php esc_html_e( 'Sync', 'lsx-wetu-importer' ); ?></h1> |
||
453 | |||
454 | <table class="form-table"> |
||
455 | <tbody> |
||
456 | <tr class="form-field -wrap"> |
||
457 | <th scope="row"> |
||
458 | <label for="cron_schedule"><?php esc_html_e( 'Schedule', 'lsx-wetu-importer' ); ?></label> |
||
459 | </th> |
||
460 | <td> |
||
461 | <select name="cron_schedule" id="cron_schedule" class="widefat layout"> |
||
462 | <?php |
||
463 | if ( isset( $options['cron_schedule'] ) && '' !== $options['cron_schedule'] ) { |
||
0 ignored issues
–
show
|
|||
464 | $schedule = $options['cron_schedule']; |
||
465 | } else { |
||
466 | $schedule = 'daily'; |
||
467 | } |
||
0 ignored issues
–
show
|
|||
468 | $timeslots = array( |
||
469 | 'daily' => __( 'Daily', 'lsx-wetu-importer' ), |
||
470 | 'weekly-mon' => __( 'Weekly (Monday)', 'lsx-wetu-importer' ), |
||
471 | 'weekly-tue' => __( 'Weekly (Tuesday)', 'lsx-wetu-importer' ), |
||
472 | 'weekly-wed' => __( 'Weekly (Wednesday)', 'lsx-wetu-importer' ), |
||
473 | 'weekly-thu' => __( 'Weekly (Thursday)', 'lsx-wetu-importer' ), |
||
474 | 'weekly-fri' => __( 'Weekly (Friday)', 'lsx-wetu-importer' ), |
||
475 | 'weekly-sat' => __( 'Weekly (Saturday)', 'lsx-wetu-importer' ), |
||
476 | 'weekly-sun' => __( 'Weekly (Sunday)', 'lsx-wetu-importer' ), |
||
477 | ); |
||
478 | foreach ( $timeslots as $key => $name ) { |
||
0 ignored issues
–
show
|
|||
479 | $selected = ( $schedule == $key ) ? ' selected="selected"' : ''; |
||
0 ignored issues
–
show
|
|||
480 | ?> |
||
481 | <option value="<?php echo wp_kses_post( $key ); ?>" id="<?php echo wp_kses_post( $key ); ?>" <?php echo wp_kses_post( $selected ); ?>><?php echo wp_kses_post( $name ); ?></option> |
||
482 | <?php |
||
483 | } |
||
484 | ?> |
||
485 | </select> |
||
486 | </td> |
||
487 | </tr> |
||
488 | <tr class="form-field -wrap"> |
||
489 | <th scope="row"> |
||
490 | <label for="accommodation_images_cron"><?php esc_html_e( 'Accommodation Images', 'lsx-wetu-importer' ); ?></label> |
||
491 | </th> |
||
492 | <td> |
||
493 | <input type="checkbox" |
||
494 | <?php |
||
495 | if ( isset( $options['accommodation_images_cron'] ) && '' !== $options['accommodation_images_cron'] ) { |
||
0 ignored issues
–
show
|
|||
496 | echo esc_attr( 'checked="checked"' ); |
||
497 | } |
||
498 | ?> |
||
499 | name="accommodation_images_cron" /> |
||
500 | <p><?php esc_html_e( 'Update the accommodation images accodring to the schedule above.', 'lsx-wetu-importer' ); ?></p> |
||
501 | </td> |
||
502 | </tr> |
||
503 | <tr class="form-field -wrap"> |
||
504 | <th scope="row"> |
||
505 | <label for="accommodation_images_cron_featured"><?php esc_html_e( 'Featured Images', 'lsx-wetu-importer' ); ?></label> |
||
506 | </th> |
||
507 | <td> |
||
508 | <input type="checkbox" |
||
509 | <?php |
||
510 | if ( isset( $options['accommodation_images_cron_featured'] ) && '' !== $options['accommodation_images_cron_featured'] ) { |
||
0 ignored issues
–
show
|
|||
511 | echo esc_attr( 'checked="checked"' ); |
||
512 | } |
||
513 | ?> |
||
514 | name="accommodation_images_cron_featured" /> |
||
515 | <p><?php esc_html_e( 'Set the featured image when the gallery is created.', 'lsx-wetu-importer' ); ?></p> |
||
516 | </td> |
||
517 | </tr> |
||
518 | </tbody> |
||
519 | </table> |
||
520 | |||
521 | <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_html_e( 'Save Changes', 'lsx-wetu-importer' ); ?>"></p> |
||
522 | </form> |
||
523 | </div> |
||
524 | <?php |
||
525 | } |
||
0 ignored issues
–
show
|
|||
526 | |||
527 | /** |
||
528 | * Save the options fields |
||
529 | * |
||
530 | * @return void |
||
531 | */ |
||
532 | public function save_options() { |
||
533 | if ( ! isset( $_POST['lsx_wetu_importer_save_options'] ) || ! wp_verify_nonce( $_POST['lsx_wetu_importer_save_options'], 'lsx_wetu_importer_save' ) ) { |
||
0 ignored issues
–
show
|
|||
534 | return; |
||
535 | } |
||
0 ignored issues
–
show
|
|||
536 | $data_to_save = array(); |
||
537 | foreach ( $this->defaults as $key => $field ) { |
||
0 ignored issues
–
show
|
|||
538 | if ( isset( $_POST[ $key ] ) ) { |
||
0 ignored issues
–
show
|
|||
539 | $data_to_save[ $key ] = sanitize_text_field( $_POST[ $key ] ); |
||
0 ignored issues
–
show
|
|||
540 | } else { |
||
541 | $data_to_save[ $key ] = ''; |
||
542 | } |
||
543 | } |
||
0 ignored issues
–
show
|
|||
544 | update_option( 'lsx_wetu_importer_settings', $data_to_save ); |
||
545 | } |
||
0 ignored issues
–
show
|
|||
546 | } |
||
547 |