Passed
Push — dependabot/composer/phpunit/ph... ( 669c8c )
by
unknown
04:47
created
classes/class-lsx-wetu-importer-settings.php 2 patches
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -14,85 +14,85 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class LSX_WETU_Importer_Settings {
16 16
 
17
-	/**
18
-	 * Holds instance of the class
19
-	 *
20
-	 * @var object
21
-	 */
22
-	private static $instance;
17
+     /**
18
+      * Holds instance of the class
19
+      *
20
+      * @var object
21
+      */
22
+     private static $instance;
23 23
 
24
-	/**
25
-	 * Holds the default settings.
26
-	 *
27
-	 * @var array
28
-	 */
29
-	public $defaults = array();
24
+     /**
25
+      * Holds the default settings.
26
+      *
27
+      * @var array
28
+      */
29
+     public $defaults = array();
30 30
 
31
-	/**
32
-	 * Holds the settings fields available.
33
-	 *
34
-	 * @var array
35
-	 */
36
-	public $fields = array();
31
+     /**
32
+      * Holds the settings fields available.
33
+      *
34
+      * @var array
35
+      */
36
+     public $fields = array();
37 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() {
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
-	}
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() {
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
+     }
72 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 ) ) {
81
-			self::$instance = new self();
82
-		}
83
-		return self::$instance;
84
-	}
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 ) ) {
81
+               self::$instance = new self();
82
+          }
83
+          return self::$instance;
84
+     }
85 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 ) {
92
-			$value = trim( $value );
93
-		}
94
-		$options = wp_parse_args( $options, $this->defaults );
95
-		?>
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 ) {
92
+               $value = trim( $value );
93
+          }
94
+          $options = wp_parse_args( $options, $this->defaults );
95
+          ?>
96 96
 		<div class="wrap">
97 97
 			<form method="post" class="">
98 98
 				<?php wp_nonce_field( 'lsx_wetu_importer_save', 'lsx_wetu_importer_save_options' ); ?>
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 							<td>
108 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 109
 								<?php
110
-								if ( isset( $options['api_key'] ) ) {
111
-									echo esc_attr( $options['api_key'] );
112
-								}
113
-								?>
110
+                                        if ( isset( $options['api_key'] ) ) {
111
+                                             echo esc_attr( $options['api_key'] );
112
+                                        }
113
+                                        ?>
114 114
 								" name="api_key" />
115 115
 							</td>
116 116
 						</tr>
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 							<td>
128 128
 								<input type="checkbox"
129 129
 								<?php
130
-								if ( isset( $options['disable_tour_title'] ) && '' !== $options['disable_tour_title'] ) {
131
-									echo esc_attr( 'checked="checked"' );
132
-								}
133
-								?>
130
+                                        if ( isset( $options['disable_tour_title'] ) && '' !== $options['disable_tour_title'] ) {
131
+                                             echo esc_attr( 'checked="checked"' );
132
+                                        }
133
+                                        ?>
134 134
 								name="disable_tour_title" />
135 135
 
136 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>
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 							<td>
144 144
 								<input type="checkbox"
145 145
 								<?php
146
-								if ( isset( $options['disable_tour_descriptions'] ) && '' !== $options['disable_tour_descriptions'] ) {
147
-									echo esc_attr( 'checked="checked"' );
148
-								}
149
-								?>
146
+                                        if ( isset( $options['disable_tour_descriptions'] ) && '' !== $options['disable_tour_descriptions'] ) {
147
+                                             echo esc_attr( 'checked="checked"' );
148
+                                        }
149
+                                        ?>
150 150
 								name="disable_tour_descriptions" />
151 151
 
152 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>
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 							<td>
160 160
 								<input type="checkbox"
161 161
 								<?php
162
-								if ( isset( $options['disable_tour_tags'] ) && '' !== $options['disable_tour_tags'] ) {
163
-									echo esc_attr( 'checked="checked"' );
164
-								}
165
-								?>
162
+                                        if ( isset( $options['disable_tour_tags'] ) && '' !== $options['disable_tour_tags'] ) {
163
+                                             echo esc_attr( 'checked="checked"' );
164
+                                        }
165
+                                        ?>
166 166
 								name="disable_tour_tags" />
167 167
 
168 168
 								<small><?php esc_html_e( 'Disable this is you dont want the option available on the import screen.', 'lsx-wetu-importer' ); ?></small>
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 							<td>
177 177
 								<input type="checkbox"
178 178
 								<?php
179
-								if ( isset( $options['enable_tour_ref_column'] ) && '' !== $options['enable_tour_ref_column'] ) {
180
-									echo esc_attr( 'checked="checked"' );
181
-								}
182
-								?>
179
+                                        if ( isset( $options['enable_tour_ref_column'] ) && '' !== $options['enable_tour_ref_column'] ) {
180
+                                             echo esc_attr( 'checked="checked"' );
181
+                                        }
182
+                                        ?>
183 183
 								name="enable_tour_ref_column" />
184 184
 								<small><?php esc_html_e( 'Enables the use of the WETU Reference Column for better tours management.', 'lsx-wetu-importer' ); ?></small>
185 185
 							</td>
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 							<td>
193 193
 								<input type="checkbox"
194 194
 								<?php
195
-								if ( isset( $options['enable_tour_featured_random'] ) && '' !== $options['enable_tour_featured_random'] ) {
196
-									echo esc_attr( 'checked="checked"' );
197
-								}
198
-								?>
195
+                                        if ( isset( $options['enable_tour_featured_random'] ) && '' !== $options['enable_tour_featured_random'] ) {
196
+                                             echo esc_attr( 'checked="checked"' );
197
+                                        }
198
+                                        ?>
199 199
 								name="enable_tour_featured_random" />
200 200
 								<small><?php esc_html_e( 'This will randomize the featured image from the destination gallery.', 'lsx-wetu-importer' ); ?></small>
201 201
 							</td>
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 							<td>
215 215
 								<input type="checkbox"
216 216
 								<?php
217
-								if ( isset( $options['disable_accommodation_title'] ) && '' !== $options['disable_accommodation_title'] ) {
218
-									echo esc_attr( 'checked="checked"' );
219
-								}
220
-								?>
217
+                                        if ( isset( $options['disable_accommodation_title'] ) && '' !== $options['disable_accommodation_title'] ) {
218
+                                             echo esc_attr( 'checked="checked"' );
219
+                                        }
220
+                                        ?>
221 221
 								name="disable_accommodation_title" />
222 222
 
223 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>
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 							<td>
231 231
 								<input type="checkbox"
232 232
 								<?php
233
-								if ( isset( $options['disable_accommodation_descriptions'] ) && '' !== $options['disable_accommodation_descriptions'] ) {
234
-									echo esc_attr( 'checked="checked"' );
235
-								}
236
-								?>
233
+                                        if ( isset( $options['disable_accommodation_descriptions'] ) && '' !== $options['disable_accommodation_descriptions'] ) {
234
+                                             echo esc_attr( 'checked="checked"' );
235
+                                        }
236
+                                        ?>
237 237
 								name="disable_accommodation_descriptions" />
238 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 239
 							</td>
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 							<td>
246 246
 								<input type="checkbox"
247 247
 								<?php
248
-								if ( isset( $options['disable_accommodation_filtering'] ) && '' !== $options['disable_accommodation_filtering'] ) {
249
-									echo esc_attr( 'checked="checked"' );
250
-								}
251
-								?>
248
+                                        if ( isset( $options['disable_accommodation_filtering'] ) && '' !== $options['disable_accommodation_filtering'] ) {
249
+                                             echo esc_attr( 'checked="checked"' );
250
+                                        }
251
+                                        ?>
252 252
 								name="disable_accommodation_filtering" />
253 253
 								<small><?php esc_html_e( 'This will stop the HTML from being stripped out of the description.', 'lsx-wetu-importer' ); ?></small>
254 254
 							</td>
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 							<td>
262 262
 								<input type="checkbox"
263 263
 								<?php
264
-								if ( isset( $options['disable_accommodation_excerpts'] ) && '' !== $options['disable_accommodation_excerpts'] ) {
265
-									echo esc_attr( 'checked="checked"' );
266
-								}
267
-								?>
264
+                                        if ( isset( $options['disable_accommodation_excerpts'] ) && '' !== $options['disable_accommodation_excerpts'] ) {
265
+                                             echo esc_attr( 'checked="checked"' );
266
+                                        }
267
+                                        ?>
268 268
 								name="disable_accommodation_excerpts" />
269 269
 								<small><?php esc_html_e( 'If you are going to edit the accommodation excerpts then enable this setting.', 'lsx-wetu-importer' ); ?></small>
270 270
 							</td>
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
 							<td>
284 284
 								<input type="checkbox"
285 285
 								<?php
286
-								if ( isset( $options['disable_destination_title'] ) && '' !== $options['disable_destination_title'] ) {
287
-									echo esc_attr( 'checked="checked"' );
288
-								}
289
-								?>
286
+                                        if ( isset( $options['disable_destination_title'] ) && '' !== $options['disable_destination_title'] ) {
287
+                                             echo esc_attr( 'checked="checked"' );
288
+                                        }
289
+                                        ?>
290 290
 								name="disable_destination_title" />
291 291
 
292 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>
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 							<td>
300 300
 								<input type="checkbox"
301 301
 								<?php
302
-								if ( isset( $options['disable_destination_descriptions'] ) && '' !== $options['disable_destination_descriptions'] ) {
303
-									echo esc_attr( 'checked="checked"' );
304
-								}
305
-								?>
302
+                                        if ( isset( $options['disable_destination_descriptions'] ) && '' !== $options['disable_destination_descriptions'] ) {
303
+                                             echo esc_attr( 'checked="checked"' );
304
+                                        }
305
+                                        ?>
306 306
 								name="disable_destination_descriptions" />
307 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 308
 							</td>
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 							<td>
322 322
 								<input type="checkbox"
323 323
 								<?php
324
-								if ( isset( $options['image_replacing'] ) && '' !== $options['image_replacing'] ) {
325
-									echo esc_attr( 'checked="checked"' );
326
-								}
327
-								?>
324
+                                        if ( isset( $options['image_replacing'] ) && '' !== $options['image_replacing'] ) {
325
+                                             echo esc_attr( 'checked="checked"' );
326
+                                        }
327
+                                        ?>
328 328
 								name="image_replacing" />
329 329
 								<p><?php esc_html_e( 'Do you want your images to be replaced on each import.', 'lsx-wetu-importer' ); ?></p>
330 330
 							</td>
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 							<td>
337 337
 								<input placeholder="" type="text" value="
338 338
 								<?php
339
-								if ( isset( $options['image_limit'] ) && '' !== $options['image_limit'] ) {
340
-									echo esc_attr( $options['image_limit'] );
341
-								}
342
-								?>
339
+                                        if ( isset( $options['image_limit'] ) && '' !== $options['image_limit'] ) {
340
+                                             echo esc_attr( $options['image_limit'] );
341
+                                        }
342
+                                        ?>
343 343
 								"
344 344
 								name="image_limit" />
345 345
 							</td>
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 							<td>
353 353
 								<input type="checkbox"
354 354
 								<?php
355
-								if ( isset( $options['image_scaling'] ) && '' !== $options['image_scaling'] ) {
356
-									echo esc_attr( 'checked="checked"' );
357
-								}
358
-								?>
355
+                                        if ( isset( $options['image_scaling'] ) && '' !== $options['image_scaling'] ) {
356
+                                             echo esc_attr( 'checked="checked"' );
357
+                                        }
358
+                                        ?>
359 359
 								name="image_scaling" />
360 360
 							</td>
361 361
 						</tr>
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
 							<td>
367 367
 								<input placeholder="800" type="text" value="
368 368
 								<?php
369
-								if ( isset( $options['width'] ) && '' !== $options['width'] ) {
370
-									echo esc_attr( $options['width'] );
371
-								}
372
-								?>
369
+                                        if ( isset( $options['width'] ) && '' !== $options['width'] ) {
370
+                                             echo esc_attr( $options['width'] );
371
+                                        }
372
+                                        ?>
373 373
 								"
374 374
 								name="width" />
375 375
 							</td>
@@ -381,10 +381,10 @@  discard block
 block discarded – undo
381 381
 							<td>
382 382
 								<input placeholder="600" type="text" value="
383 383
 								<?php
384
-								if ( isset( $options['height'] ) && '' !== $options['height'] ) {
385
-									echo esc_attr( $options['height'] );
386
-								}
387
-								?>
384
+                                        if ( isset( $options['height'] ) && '' !== $options['height'] ) {
385
+                                             echo esc_attr( $options['height'] );
386
+                                        }
387
+                                        ?>
388 388
 								"
389 389
 								name="height" />
390 390
 							</td>
@@ -397,52 +397,52 @@  discard block
 block discarded – undo
397 397
 							<td>
398 398
 								<input type="radio"
399 399
 								<?php
400
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'raw' === $options['scaling'] ) {
401
-									echo esc_attr( 'checked="checked"' );
402
-								}
403
-								?>
400
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'raw' === $options['scaling'] ) {
401
+                                             echo esc_attr( 'checked="checked"' );
402
+                                        }
403
+                                        ?>
404 404
 								name="scaling" value="raw" /> <?php esc_html_e( 'Get the Full size image, no cropping takes place.', 'lsx-wetu-importer' ); ?><br />
405 405
 								<input type="radio"
406 406
 								<?php
407
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'c' === $options['scaling'] ) {
408
-									echo esc_attr( 'checked="checked"' );
409
-								}
410
-								?>
407
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'c' === $options['scaling'] ) {
408
+                                             echo esc_attr( 'checked="checked"' );
409
+                                        }
410
+                                        ?>
411 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 412
 								<input type="radio"
413 413
 								<?php
414
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'h' === $options['scaling'] ) {
415
-									echo esc_attr( 'checked="checked"' );
416
-								}
417
-								?>
414
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'h' === $options['scaling'] ) {
415
+                                             echo esc_attr( 'checked="checked"' );
416
+                                        }
417
+                                        ?>
418 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 419
 								<input type="radio"
420 420
 								<?php
421
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'w' === $options['scaling'] ) {
422
-									echo esc_attr( 'checked="checked"' );
423
-								}
424
-								?>
421
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'w' === $options['scaling'] ) {
422
+                                             echo esc_attr( 'checked="checked"' );
423
+                                        }
424
+                                        ?>
425 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 426
 								<input type="radio"
427 427
 								<?php
428
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'nf' === $options['scaling'] ) {
429
-									echo esc_attr( 'checked="checked"' );
430
-								}
431
-								?>
428
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'nf' === $options['scaling'] ) {
429
+                                             echo esc_attr( 'checked="checked"' );
430
+                                        }
431
+                                        ?>
432 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 433
 								<input type="radio"
434 434
 								<?php
435
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'n' === $options['scaling'] ) {
436
-									echo esc_attr( 'checked="checked"' );
437
-								}
438
-								?>
435
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'n' === $options['scaling'] ) {
436
+                                             echo esc_attr( 'checked="checked"' );
437
+                                        }
438
+                                        ?>
439 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 440
 								<input type="radio"
441 441
 								<?php
442
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'W' === $options['scaling'] ) {
443
-									echo esc_attr( 'checked="checked"' );
444
-								}
445
-								?>
442
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'W' === $options['scaling'] ) {
443
+                                             echo esc_attr( 'checked="checked"' );
444
+                                        }
445
+                                        ?>
446 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 447
 							</td>
448 448
 						</tr>
@@ -460,28 +460,28 @@  discard block
 block discarded – undo
460 460
 							<td>
461 461
 								<select name="cron_schedule" id="cron_schedule"	class="widefat layout">
462 462
 									<?php
463
-									if ( isset( $options['cron_schedule'] ) && '' !== $options['cron_schedule'] ) {
464
-										$schedule = $options['cron_schedule'];
465
-									} else {
466
-										$schedule = 'daily';
467
-									}
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 ) {
479
-										$selected = ( $schedule == $key ) ? ' selected="selected"' : '';
480
-										?>
463
+                                             if ( isset( $options['cron_schedule'] ) && '' !== $options['cron_schedule'] ) {
464
+                                                  $schedule = $options['cron_schedule'];
465
+                                             } else {
466
+                                                  $schedule = 'daily';
467
+                                             }
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 ) {
479
+                                                  $selected = ( $schedule == $key ) ? ' selected="selected"' : '';
480
+                                                  ?>
481 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 482
 										<?php
483
-									}
484
-									?>
483
+                                             }
484
+                                             ?>
485 485
 								</select>
486 486
 							</td>
487 487
 						</tr>
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 							<td>
493 493
 								<input type="checkbox"
494 494
 								<?php
495
-								if ( isset( $options['accommodation_images_cron'] ) && '' !== $options['accommodation_images_cron'] ) {
496
-									echo esc_attr( 'checked="checked"' );
497
-								}
498
-								?>
495
+                                        if ( isset( $options['accommodation_images_cron'] ) && '' !== $options['accommodation_images_cron'] ) {
496
+                                             echo esc_attr( 'checked="checked"' );
497
+                                        }
498
+                                        ?>
499 499
 								name="accommodation_images_cron" />
500 500
 								<p><?php esc_html_e( 'Update the accommodation images accodring to the schedule above.', 'lsx-wetu-importer' ); ?></p>
501 501
 							</td>
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
 							<td>
508 508
 								<input type="checkbox"
509 509
 								<?php
510
-								if ( isset( $options['accommodation_images_cron_featured'] ) && '' !== $options['accommodation_images_cron_featured'] ) {
511
-									echo esc_attr( 'checked="checked"' );
512
-								}
513
-								?>
510
+                                        if ( isset( $options['accommodation_images_cron_featured'] ) && '' !== $options['accommodation_images_cron_featured'] ) {
511
+                                             echo esc_attr( 'checked="checked"' );
512
+                                        }
513
+                                        ?>
514 514
 								name="accommodation_images_cron_featured" />
515 515
 								<p><?php esc_html_e( 'Set the featured image when the gallery is created.', 'lsx-wetu-importer' ); ?></p>
516 516
 							</td>
@@ -522,25 +522,25 @@  discard block
 block discarded – undo
522 522
 			</form>
523 523
 		</div>
524 524
 		<?php
525
-	}
525
+     }
526 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' ) ) {
534
-			return;
535
-		}
536
-		$data_to_save = array();
537
-		foreach ( $this->defaults as $key => $field ) {
538
-			if ( isset( $_POST[ $key ] ) ) {
539
-				$data_to_save[ $key ] = sanitize_text_field( $_POST[ $key ] );
540
-			} else {
541
-				$data_to_save[ $key ] = '';
542
-			}
543
-		}
544
-		update_option( 'lsx_wetu_importer_settings', $data_to_save );
545
-	}
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' ) ) {
534
+               return;
535
+          }
536
+          $data_to_save = array();
537
+          foreach ( $this->defaults as $key => $field ) {
538
+               if ( isset( $_POST[ $key ] ) ) {
539
+                    $data_to_save[ $key ] = sanitize_text_field( $_POST[ $key ] );
540
+               } else {
541
+                    $data_to_save[ $key ] = '';
542
+               }
543
+          }
544
+          update_option( 'lsx_wetu_importer_settings', $data_to_save );
545
+     }
546 546
 }
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 			'accommodation_images_cron'          => '',
67 67
 			'accommodation_images_cron_featured' => '',
68 68
 		);
69
-		$this->fields   = array_keys( $this->defaults );
70
-		add_action( 'admin_init', array( $this, 'save_options' ) );
69
+		$this->fields = array_keys($this->defaults);
70
+		add_action('admin_init', array($this, 'save_options'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public static function get_instance() {
79 79
 		// If the single instance hasn't been set, set it now.
80
-		if ( ! isset( self::$instance ) ) {
80
+		if (!isset(self::$instance)) {
81 81
 			self::$instance = new self();
82 82
 		}
83 83
 		return self::$instance;
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function display_page() {
90 90
 		$options = lsx_wetu_get_options();
91
-		foreach ( $options as $key => $value ) {
92
-			$value = trim( $value );
91
+		foreach ($options as $key => $value) {
92
+			$value = trim($value);
93 93
 		}
94
-		$options = wp_parse_args( $options, $this->defaults );
94
+		$options = wp_parse_args($options, $this->defaults);
95 95
 		?>
96 96
 		<div class="wrap">
97 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>
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 101
 				<table class="form-table">
102 102
 					<tbody>
103 103
 						<tr class="form-field">
104 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>
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 106
 							</th>
107 107
 							<td>
108 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 109
 								<?php
110
-								if ( isset( $options['api_key'] ) ) {
111
-									echo esc_attr( $options['api_key'] );
110
+								if (isset($options['api_key'])) {
111
+									echo esc_attr($options['api_key']);
112 112
 								}
113 113
 								?>
114 114
 								" name="api_key" />
@@ -117,227 +117,227 @@  discard block
 block discarded – undo
117 117
 					</tbody>
118 118
 				</table>
119 119
 
120
-				<h1><?php esc_html_e( 'Tours', 'lsx-wetu-importer' ); ?></h1>
120
+				<h1><?php esc_html_e('Tours', 'lsx-wetu-importer'); ?></h1>
121 121
 				<table class="form-table">
122 122
 					<tbody>
123 123
 						<tr class="form-field -wrap">
124 124
 							<th scope="row">
125
-								<label for="disable_tour_title"><?php esc_html_e( 'Enable Custom Titles', 'lsx-wetu-importer' ); ?></label>
125
+								<label for="disable_tour_title"><?php esc_html_e('Enable Custom Titles', 'lsx-wetu-importer'); ?></label>
126 126
 							</th>
127 127
 							<td>
128 128
 								<input type="checkbox"
129 129
 								<?php
130
-								if ( isset( $options['disable_tour_title'] ) && '' !== $options['disable_tour_title'] ) {
131
-									echo esc_attr( 'checked="checked"' );
130
+								if (isset($options['disable_tour_title']) && '' !== $options['disable_tour_title']) {
131
+									echo esc_attr('checked="checked"');
132 132
 								}
133 133
 								?>
134 134
 								name="disable_tour_title" />
135 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>
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 137
 							</td>
138 138
 						</tr>
139 139
 						<tr class="form-field -wrap">
140 140
 							<th scope="row">
141
-								<label for="disable_tour_descriptions"><?php esc_html_e( 'Disable Descriptions', 'lsx-wetu-importer' ); ?></label>
141
+								<label for="disable_tour_descriptions"><?php esc_html_e('Disable Descriptions', 'lsx-wetu-importer'); ?></label>
142 142
 							</th>
143 143
 							<td>
144 144
 								<input type="checkbox"
145 145
 								<?php
146
-								if ( isset( $options['disable_tour_descriptions'] ) && '' !== $options['disable_tour_descriptions'] ) {
147
-									echo esc_attr( 'checked="checked"' );
146
+								if (isset($options['disable_tour_descriptions']) && '' !== $options['disable_tour_descriptions']) {
147
+									echo esc_attr('checked="checked"');
148 148
 								}
149 149
 								?>
150 150
 								name="disable_tour_descriptions" />
151 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>
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 153
 							</td>
154 154
 						</tr>
155 155
 						<tr class="form-field -wrap">
156 156
 							<th scope="row">
157
-								<label for="disable_tour_tags"><?php esc_html_e( 'Disable Tags / Travel Styles', 'lsx-wetu-importer' ); ?></label>
157
+								<label for="disable_tour_tags"><?php esc_html_e('Disable Tags / Travel Styles', 'lsx-wetu-importer'); ?></label>
158 158
 							</th>
159 159
 							<td>
160 160
 								<input type="checkbox"
161 161
 								<?php
162
-								if ( isset( $options['disable_tour_tags'] ) && '' !== $options['disable_tour_tags'] ) {
163
-									echo esc_attr( 'checked="checked"' );
162
+								if (isset($options['disable_tour_tags']) && '' !== $options['disable_tour_tags']) {
163
+									echo esc_attr('checked="checked"');
164 164
 								}
165 165
 								?>
166 166
 								name="disable_tour_tags" />
167 167
 
168
-								<small><?php esc_html_e( 'Disable this is you dont want the option available on the import screen.', 'lsx-wetu-importer' ); ?></small>
168
+								<small><?php esc_html_e('Disable this is you dont want the option available on the import screen.', 'lsx-wetu-importer'); ?></small>
169 169
 							</td>
170 170
 						</tr>
171 171
 
172 172
 						<tr class="form-field -wrap">
173 173
 							<th scope="row">
174
-								<label for="enable_tour_ref_column"><?php esc_html_e( 'Enable Reference Column', 'lsx-wetu-importer' ); ?></label>
174
+								<label for="enable_tour_ref_column"><?php esc_html_e('Enable Reference Column', 'lsx-wetu-importer'); ?></label>
175 175
 							</th>
176 176
 							<td>
177 177
 								<input type="checkbox"
178 178
 								<?php
179
-								if ( isset( $options['enable_tour_ref_column'] ) && '' !== $options['enable_tour_ref_column'] ) {
180
-									echo esc_attr( 'checked="checked"' );
179
+								if (isset($options['enable_tour_ref_column']) && '' !== $options['enable_tour_ref_column']) {
180
+									echo esc_attr('checked="checked"');
181 181
 								}
182 182
 								?>
183 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>
184
+								<small><?php esc_html_e('Enables the use of the WETU Reference Column for better tours management.', 'lsx-wetu-importer'); ?></small>
185 185
 							</td>
186 186
 						</tr>
187 187
 
188 188
 						<tr class="form-field -wrap">
189 189
 							<th scope="row">
190
-								<label for="enable_tour_featured_random"><?php esc_html_e( 'Randomize Featured Image', 'lsx-wetu-importer' ); ?></label>
190
+								<label for="enable_tour_featured_random"><?php esc_html_e('Randomize Featured Image', 'lsx-wetu-importer'); ?></label>
191 191
 							</th>
192 192
 							<td>
193 193
 								<input type="checkbox"
194 194
 								<?php
195
-								if ( isset( $options['enable_tour_featured_random'] ) && '' !== $options['enable_tour_featured_random'] ) {
196
-									echo esc_attr( 'checked="checked"' );
195
+								if (isset($options['enable_tour_featured_random']) && '' !== $options['enable_tour_featured_random']) {
196
+									echo esc_attr('checked="checked"');
197 197
 								}
198 198
 								?>
199 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>
200
+								<small><?php esc_html_e('This will randomize the featured image from the destination gallery.', 'lsx-wetu-importer'); ?></small>
201 201
 							</td>
202 202
 						</tr>
203 203
 					</tbody>
204 204
 				</table>
205 205
 
206
-				<h1><?php esc_html_e( 'Accommodation', 'lsx-wetu-importer' ); ?></h1>
206
+				<h1><?php esc_html_e('Accommodation', 'lsx-wetu-importer'); ?></h1>
207 207
 
208 208
 				<table class="form-table">
209 209
 					<tbody>
210 210
 						<tr class="form-field -wrap">
211 211
 							<th scope="row">
212
-								<label for="disable_accommodation_title"><?php esc_html_e( 'Enable Custom Titles', 'lsx-wetu-importer' ); ?></label>
212
+								<label for="disable_accommodation_title"><?php esc_html_e('Enable Custom Titles', 'lsx-wetu-importer'); ?></label>
213 213
 							</th>
214 214
 							<td>
215 215
 								<input type="checkbox"
216 216
 								<?php
217
-								if ( isset( $options['disable_accommodation_title'] ) && '' !== $options['disable_accommodation_title'] ) {
218
-									echo esc_attr( 'checked="checked"' );
217
+								if (isset($options['disable_accommodation_title']) && '' !== $options['disable_accommodation_title']) {
218
+									echo esc_attr('checked="checked"');
219 219
 								}
220 220
 								?>
221 221
 								name="disable_accommodation_title" />
222 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>
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 224
 							</td>
225 225
 						</tr>
226 226
 						<tr class="form-field -wrap">
227 227
 							<th scope="row">
228
-								<label for="disable_accommodation_descriptions"><?php esc_html_e( 'Disable Descriptions', 'lsx-wetu-importer' ); ?></label>
228
+								<label for="disable_accommodation_descriptions"><?php esc_html_e('Disable Descriptions', 'lsx-wetu-importer'); ?></label>
229 229
 							</th>
230 230
 							<td>
231 231
 								<input type="checkbox"
232 232
 								<?php
233
-								if ( isset( $options['disable_accommodation_descriptions'] ) && '' !== $options['disable_accommodation_descriptions'] ) {
234
-									echo esc_attr( 'checked="checked"' );
233
+								if (isset($options['disable_accommodation_descriptions']) && '' !== $options['disable_accommodation_descriptions']) {
234
+									echo esc_attr('checked="checked"');
235 235
 								}
236 236
 								?>
237 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>
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 239
 							</td>
240 240
 						</tr>
241 241
 						<tr class="form-field -wrap">
242 242
 							<th scope="row">
243
-								<label for="disable_accommodation_filtering"><?php esc_html_e( 'Disable Description Filtering', 'lsx-wetu-importer' ); ?></label>
243
+								<label for="disable_accommodation_filtering"><?php esc_html_e('Disable Description Filtering', 'lsx-wetu-importer'); ?></label>
244 244
 							</th>
245 245
 							<td>
246 246
 								<input type="checkbox"
247 247
 								<?php
248
-								if ( isset( $options['disable_accommodation_filtering'] ) && '' !== $options['disable_accommodation_filtering'] ) {
249
-									echo esc_attr( 'checked="checked"' );
248
+								if (isset($options['disable_accommodation_filtering']) && '' !== $options['disable_accommodation_filtering']) {
249
+									echo esc_attr('checked="checked"');
250 250
 								}
251 251
 								?>
252 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>
253
+								<small><?php esc_html_e('This will stop the HTML from being stripped out of the description.', 'lsx-wetu-importer'); ?></small>
254 254
 							</td>
255 255
 						</tr>
256 256
 
257 257
 						<tr class="form-field -wrap">
258 258
 							<th scope="row">
259
-								<label for="disable_accommodation_excerpts"><?php esc_html_e( 'Disable Excerpts', 'lsx-wetu-importer' ); ?></label>
259
+								<label for="disable_accommodation_excerpts"><?php esc_html_e('Disable Excerpts', 'lsx-wetu-importer'); ?></label>
260 260
 							</th>
261 261
 							<td>
262 262
 								<input type="checkbox"
263 263
 								<?php
264
-								if ( isset( $options['disable_accommodation_excerpts'] ) && '' !== $options['disable_accommodation_excerpts'] ) {
265
-									echo esc_attr( 'checked="checked"' );
264
+								if (isset($options['disable_accommodation_excerpts']) && '' !== $options['disable_accommodation_excerpts']) {
265
+									echo esc_attr('checked="checked"');
266 266
 								}
267 267
 								?>
268 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>
269
+								<small><?php esc_html_e('If you are going to edit the accommodation excerpts then enable this setting.', 'lsx-wetu-importer'); ?></small>
270 270
 							</td>
271 271
 						</tr>
272 272
 					</tbody>
273 273
 				</table>
274 274
 
275
-				<h1><?php esc_html_e( 'Destinations', 'lsx-wetu-importer' ); ?></h1>
275
+				<h1><?php esc_html_e('Destinations', 'lsx-wetu-importer'); ?></h1>
276 276
 
277 277
 				<table class="form-table">
278 278
 					<tbody>
279 279
 						<tr class="form-field -wrap">
280 280
 							<th scope="row">
281
-								<label for="disable_destination_title"><?php esc_html_e( 'Enable Custom Titles', 'lsx-wetu-importer' ); ?></label>
281
+								<label for="disable_destination_title"><?php esc_html_e('Enable Custom Titles', 'lsx-wetu-importer'); ?></label>
282 282
 							</th>
283 283
 							<td>
284 284
 								<input type="checkbox"
285 285
 								<?php
286
-								if ( isset( $options['disable_destination_title'] ) && '' !== $options['disable_destination_title'] ) {
287
-									echo esc_attr( 'checked="checked"' );
286
+								if (isset($options['disable_destination_title']) && '' !== $options['disable_destination_title']) {
287
+									echo esc_attr('checked="checked"');
288 288
 								}
289 289
 								?>
290 290
 								name="disable_destination_title" />
291 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>
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 293
 							</td>
294 294
 						</tr>
295 295
 						<tr class="form-field -wrap">
296 296
 							<th scope="row">
297
-								<label for="disable_destination_descriptions"><?php esc_html_e( 'Disable Descriptions', 'lsx-wetu-importer' ); ?></label>
297
+								<label for="disable_destination_descriptions"><?php esc_html_e('Disable Descriptions', 'lsx-wetu-importer'); ?></label>
298 298
 							</th>
299 299
 							<td>
300 300
 								<input type="checkbox"
301 301
 								<?php
302
-								if ( isset( $options['disable_destination_descriptions'] ) && '' !== $options['disable_destination_descriptions'] ) {
303
-									echo esc_attr( 'checked="checked"' );
302
+								if (isset($options['disable_destination_descriptions']) && '' !== $options['disable_destination_descriptions']) {
303
+									echo esc_attr('checked="checked"');
304 304
 								}
305 305
 								?>
306 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>
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 308
 							</td>
309 309
 						</tr>
310 310
 					</tbody>
311 311
 				</table>
312 312
 
313
-				<h1><?php esc_html_e( 'Images', 'lsx-wetu-importer' ); ?></h1>
313
+				<h1><?php esc_html_e('Images', 'lsx-wetu-importer'); ?></h1>
314 314
 
315 315
 				<table class="form-table">
316 316
 					<tbody>
317 317
 						<tr class="form-field -wrap">
318 318
 							<th scope="row">
319
-								<label for="image_replacing"><?php esc_html_e( 'Replace Images', 'lsx-wetu-importer' ); ?></label>
319
+								<label for="image_replacing"><?php esc_html_e('Replace Images', 'lsx-wetu-importer'); ?></label>
320 320
 							</th>
321 321
 							<td>
322 322
 								<input type="checkbox"
323 323
 								<?php
324
-								if ( isset( $options['image_replacing'] ) && '' !== $options['image_replacing'] ) {
325
-									echo esc_attr( 'checked="checked"' );
324
+								if (isset($options['image_replacing']) && '' !== $options['image_replacing']) {
325
+									echo esc_attr('checked="checked"');
326 326
 								}
327 327
 								?>
328 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>
329
+								<p><?php esc_html_e('Do you want your images to be replaced on each import.', 'lsx-wetu-importer'); ?></p>
330 330
 							</td>
331 331
 						</tr>
332 332
 						<tr class="form-field -wrap">
333 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>
334
+								<label for="image_limit"> <?php esc_html_e('Limit the amount of images imported to the gallery', 'lsx-wetu-importer'); ?></label>
335 335
 							</th>
336 336
 							<td>
337 337
 								<input placeholder="" type="text" value="
338 338
 								<?php
339
-								if ( isset( $options['image_limit'] ) && '' !== $options['image_limit'] ) {
340
-									echo esc_attr( $options['image_limit'] );
339
+								if (isset($options['image_limit']) && '' !== $options['image_limit']) {
340
+									echo esc_attr($options['image_limit']);
341 341
 								}
342 342
 								?>
343 343
 								"
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
 
348 348
 						<tr class="form-field -wrap">
349 349
 							<th scope="row">
350
-								<label for="image_scaling"><?php esc_html_e( 'Enable Image Scaling', 'lsx-wetu-importer' ); ?></label>
350
+								<label for="image_scaling"><?php esc_html_e('Enable Image Scaling', 'lsx-wetu-importer'); ?></label>
351 351
 							</th>
352 352
 							<td>
353 353
 								<input type="checkbox"
354 354
 								<?php
355
-								if ( isset( $options['image_scaling'] ) && '' !== $options['image_scaling'] ) {
356
-									echo esc_attr( 'checked="checked"' );
355
+								if (isset($options['image_scaling']) && '' !== $options['image_scaling']) {
356
+									echo esc_attr('checked="checked"');
357 357
 								}
358 358
 								?>
359 359
 								name="image_scaling" />
@@ -361,13 +361,13 @@  discard block
 block discarded – undo
361 361
 						</tr>
362 362
 						<tr class="form-field -wrap">
363 363
 							<th scope="row">
364
-								<label for="width"> <?php esc_html_e( 'Width (px)', 'lsx-wetu-importer' ); ?></label>
364
+								<label for="width"> <?php esc_html_e('Width (px)', 'lsx-wetu-importer'); ?></label>
365 365
 							</th>
366 366
 							<td>
367 367
 								<input placeholder="800" type="text" value="
368 368
 								<?php
369
-								if ( isset( $options['width'] ) && '' !== $options['width'] ) {
370
-									echo esc_attr( $options['width'] );
369
+								if (isset($options['width']) && '' !== $options['width']) {
370
+									echo esc_attr($options['width']);
371 371
 								}
372 372
 								?>
373 373
 								"
@@ -376,13 +376,13 @@  discard block
 block discarded – undo
376 376
 						</tr>
377 377
 						<tr class="form-field -wrap">
378 378
 							<th scope="row">
379
-								<label for="height"> <?php esc_html_e( 'Height (px)', 'lsx-wetu-importer' ); ?></label>
379
+								<label for="height"> <?php esc_html_e('Height (px)', 'lsx-wetu-importer'); ?></label>
380 380
 							</th>
381 381
 							<td>
382 382
 								<input placeholder="600" type="text" value="
383 383
 								<?php
384
-								if ( isset( $options['height'] ) && '' !== $options['height'] ) {
385
-									echo esc_attr( $options['height'] );
384
+								if (isset($options['height']) && '' !== $options['height']) {
385
+									echo esc_attr($options['height']);
386 386
 								}
387 387
 								?>
388 388
 								"
@@ -392,93 +392,93 @@  discard block
 block discarded – undo
392 392
 
393 393
 						<tr class="form-field -wrap image-settings">
394 394
 							<th scope="row">
395
-								<label for="scaling"> <?php esc_html_e( 'Scaling', 'lsx-wetu-importer' ); ?></label>
395
+								<label for="scaling"> <?php esc_html_e('Scaling', 'lsx-wetu-importer'); ?></label>
396 396
 							</th>
397 397
 							<td>
398 398
 								<input type="radio"
399 399
 								<?php
400
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'raw' === $options['scaling'] ) {
401
-									echo esc_attr( 'checked="checked"' );
400
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'raw' === $options['scaling']) {
401
+									echo esc_attr('checked="checked"');
402 402
 								}
403 403
 								?>
404
-								name="scaling" value="raw" /> <?php esc_html_e( 'Get the Full size image, no cropping takes place.', 'lsx-wetu-importer' ); ?><br />
404
+								name="scaling" value="raw" /> <?php esc_html_e('Get the Full size image, no cropping takes place.', 'lsx-wetu-importer'); ?><br />
405 405
 								<input type="radio"
406 406
 								<?php
407
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'c' === $options['scaling'] ) {
408
-									echo esc_attr( 'checked="checked"' );
407
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'c' === $options['scaling']) {
408
+									echo esc_attr('checked="checked"');
409 409
 								}
410 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 />
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 412
 								<input type="radio"
413 413
 								<?php
414
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'h' === $options['scaling'] ) {
415
-									echo esc_attr( 'checked="checked"' );
414
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'h' === $options['scaling']) {
415
+									echo esc_attr('checked="checked"');
416 416
 								}
417 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 />
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 419
 								<input type="radio"
420 420
 								<?php
421
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'w' === $options['scaling'] ) {
422
-									echo esc_attr( 'checked="checked"' );
421
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'w' === $options['scaling']) {
422
+									echo esc_attr('checked="checked"');
423 423
 								}
424 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 />
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 426
 								<input type="radio"
427 427
 								<?php
428
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'nf' === $options['scaling'] ) {
429
-									echo esc_attr( 'checked="checked"' );
428
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'nf' === $options['scaling']) {
429
+									echo esc_attr('checked="checked"');
430 430
 								}
431 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 />
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 433
 								<input type="radio"
434 434
 								<?php
435
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'n' === $options['scaling'] ) {
436
-									echo esc_attr( 'checked="checked"' );
435
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'n' === $options['scaling']) {
436
+									echo esc_attr('checked="checked"');
437 437
 								}
438 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 />
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 440
 								<input type="radio"
441 441
 								<?php
442
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'W' === $options['scaling'] ) {
443
-									echo esc_attr( 'checked="checked"' );
442
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'W' === $options['scaling']) {
443
+									echo esc_attr('checked="checked"');
444 444
 								}
445 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' ); ?>
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 447
 							</td>
448 448
 						</tr>
449 449
 					</tbody>
450 450
 				</table>
451 451
 
452
-				<h1><?php esc_html_e( 'Sync', 'lsx-wetu-importer' ); ?></h1>
452
+				<h1><?php esc_html_e('Sync', 'lsx-wetu-importer'); ?></h1>
453 453
 
454 454
 				<table class="form-table">
455 455
 					<tbody>
456 456
 						<tr class="form-field -wrap">
457 457
 							<th scope="row">
458
-								<label for="cron_schedule"><?php esc_html_e( 'Schedule', 'lsx-wetu-importer' ); ?></label>
458
+								<label for="cron_schedule"><?php esc_html_e('Schedule', 'lsx-wetu-importer'); ?></label>
459 459
 							</th>
460 460
 							<td>
461 461
 								<select name="cron_schedule" id="cron_schedule"	class="widefat layout">
462 462
 									<?php
463
-									if ( isset( $options['cron_schedule'] ) && '' !== $options['cron_schedule'] ) {
463
+									if (isset($options['cron_schedule']) && '' !== $options['cron_schedule']) {
464 464
 										$schedule = $options['cron_schedule'];
465
-									} else {
465
+									}else {
466 466
 										$schedule = 'daily';
467 467
 									}
468 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' ),
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 477
 									);
478
-									foreach ( $timeslots as $key => $name ) {
479
-										$selected = ( $schedule == $key ) ? ' selected="selected"' : '';
478
+									foreach ($timeslots as $key => $name) {
479
+										$selected = ($schedule == $key) ? ' selected="selected"' : '';
480 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>
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 482
 										<?php
483 483
 									}
484 484
 									?>
@@ -487,38 +487,38 @@  discard block
 block discarded – undo
487 487
 						</tr>
488 488
 						<tr class="form-field -wrap">
489 489
 							<th scope="row">
490
-								<label for="accommodation_images_cron"><?php esc_html_e( 'Accommodation Images', 'lsx-wetu-importer' ); ?></label>
490
+								<label for="accommodation_images_cron"><?php esc_html_e('Accommodation Images', 'lsx-wetu-importer'); ?></label>
491 491
 							</th>
492 492
 							<td>
493 493
 								<input type="checkbox"
494 494
 								<?php
495
-								if ( isset( $options['accommodation_images_cron'] ) && '' !== $options['accommodation_images_cron'] ) {
496
-									echo esc_attr( 'checked="checked"' );
495
+								if (isset($options['accommodation_images_cron']) && '' !== $options['accommodation_images_cron']) {
496
+									echo esc_attr('checked="checked"');
497 497
 								}
498 498
 								?>
499 499
 								name="accommodation_images_cron" />
500
-								<p><?php esc_html_e( 'Update the accommodation images accodring to the schedule above.', 'lsx-wetu-importer' ); ?></p>
500
+								<p><?php esc_html_e('Update the accommodation images accodring to the schedule above.', 'lsx-wetu-importer'); ?></p>
501 501
 							</td>
502 502
 						</tr>
503 503
 						<tr class="form-field -wrap">
504 504
 							<th scope="row">
505
-								<label for="accommodation_images_cron_featured"><?php esc_html_e( 'Featured Images', 'lsx-wetu-importer' ); ?></label>
505
+								<label for="accommodation_images_cron_featured"><?php esc_html_e('Featured Images', 'lsx-wetu-importer'); ?></label>
506 506
 							</th>
507 507
 							<td>
508 508
 								<input type="checkbox"
509 509
 								<?php
510
-								if ( isset( $options['accommodation_images_cron_featured'] ) && '' !== $options['accommodation_images_cron_featured'] ) {
511
-									echo esc_attr( 'checked="checked"' );
510
+								if (isset($options['accommodation_images_cron_featured']) && '' !== $options['accommodation_images_cron_featured']) {
511
+									echo esc_attr('checked="checked"');
512 512
 								}
513 513
 								?>
514 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>
515
+								<p><?php esc_html_e('Set the featured image when the gallery is created.', 'lsx-wetu-importer'); ?></p>
516 516
 							</td>
517 517
 						</tr>
518 518
 					</tbody>
519 519
 				</table>
520 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>
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 522
 			</form>
523 523
 		</div>
524 524
 		<?php
@@ -530,17 +530,17 @@  discard block
 block discarded – undo
530 530
 	 * @return void
531 531
 	 */
532 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' ) ) {
533
+		if (!isset($_POST['lsx_wetu_importer_save_options']) || !wp_verify_nonce($_POST['lsx_wetu_importer_save_options'], 'lsx_wetu_importer_save')) {
534 534
 			return;
535 535
 		}
536 536
 		$data_to_save = array();
537
-		foreach ( $this->defaults as $key => $field ) {
538
-			if ( isset( $_POST[ $key ] ) ) {
539
-				$data_to_save[ $key ] = sanitize_text_field( $_POST[ $key ] );
540
-			} else {
541
-				$data_to_save[ $key ] = '';
537
+		foreach ($this->defaults as $key => $field) {
538
+			if (isset($_POST[$key])) {
539
+				$data_to_save[$key] = sanitize_text_field($_POST[$key]);
540
+			}else {
541
+				$data_to_save[$key] = '';
542 542
 			}
543 543
 		}
544
-		update_option( 'lsx_wetu_importer_settings', $data_to_save );
544
+		update_option('lsx_wetu_importer_settings', $data_to_save);
545 545
 	}
546 546
 }
Please login to merge, or discard this patch.
lsx-importer-for-wetu.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
  * Domain Path: /languages/
12 12
  */
13 13
 
14
-define( 'LSX_WETU_IMPORTER_PATH', plugin_dir_path( __FILE__ ) );
15
-define( 'LSX_WETU_IMPORTER_CORE', __FILE__ );
16
-define( 'LSX_WETU_IMPORTER_URL', plugin_dir_url( __FILE__ ) );
17
-define( 'LSX_WETU_IMPORTER_VER', '1.3.6' );
14
+define('LSX_WETU_IMPORTER_PATH', plugin_dir_path(__FILE__));
15
+define('LSX_WETU_IMPORTER_CORE', __FILE__);
16
+define('LSX_WETU_IMPORTER_URL', plugin_dir_url(__FILE__));
17
+define('LSX_WETU_IMPORTER_VER', '1.3.6');
18 18
 
19
-register_activation_hook( LSX_WETU_IMPORTER_CORE, array( 'LSX_WETU_Importer', 'register_activation_hook' ) );
19
+register_activation_hook(LSX_WETU_IMPORTER_CORE, array('LSX_WETU_Importer', 'register_activation_hook'));
20 20
 
21 21
 /* ======================= Below is the Plugin Class init ========================= */
22 22
 
23
-require_once LSX_WETU_IMPORTER_PATH . 'classes/class-lsx-wetu-importer.php';
23
+require_once LSX_WETU_IMPORTER_PATH.'classes/class-lsx-wetu-importer.php';
Please login to merge, or discard this patch.