Passed
Push — master ( 137d4f...a3ad7c )
by Chris
05:11 queued 02:24
created
classes/class-lsx-wetu-importer-settings.php 2 patches
Indentation   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -14,82 +14,82 @@  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
-		);
66
-		$this->fields   = array_keys( $this->defaults );
67
-		add_action( 'admin_init', array( $this, 'save_options' ) );
68
-	}
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
+          );
66
+          $this->fields   = array_keys( $this->defaults );
67
+          add_action( 'admin_init', array( $this, 'save_options' ) );
68
+     }
69 69
 
70
-	/**
71
-	 * Return an instance of this class.
72
-	 *
73
-	 * @return  object
74
-	 */
75
-	public static function get_instance() {
76
-		// If the single instance hasn't been set, set it now.
77
-		if ( ! isset( self::$instance ) ) {
78
-			self::$instance = new self();
79
-		}
80
-		return self::$instance;
81
-	}
70
+     /**
71
+      * Return an instance of this class.
72
+      *
73
+      * @return  object
74
+      */
75
+     public static function get_instance() {
76
+          // If the single instance hasn't been set, set it now.
77
+          if ( ! isset( self::$instance ) ) {
78
+               self::$instance = new self();
79
+          }
80
+          return self::$instance;
81
+     }
82 82
 
83
-	/**
84
-	 * Display the importer welcome screen
85
-	 */
86
-	public function display_page() {
87
-		$options = lsx_wetu_get_options();
88
-		foreach ( $options as $key => $value ) {
89
-			$value = trim( $value );
90
-		}
91
-		$options = wp_parse_args( $options, $this->defaults );
92
-		?>
83
+     /**
84
+      * Display the importer welcome screen
85
+      */
86
+     public function display_page() {
87
+          $options = lsx_wetu_get_options();
88
+          foreach ( $options as $key => $value ) {
89
+               $value = trim( $value );
90
+          }
91
+          $options = wp_parse_args( $options, $this->defaults );
92
+          ?>
93 93
 		<div class="wrap">
94 94
 			<form method="post" class="">
95 95
 				<?php wp_nonce_field( 'lsx_wetu_importer_save', 'lsx_wetu_importer_save_options' ); ?>
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 							<td>
104 104
 								<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="
105 105
                                 <?php
106
-								if ( isset( $options['api_key'] ) ) {
107
-									echo esc_attr( $options['api_key'] );
108
-								}
109
-								?>
106
+                                        if ( isset( $options['api_key'] ) ) {
107
+                                             echo esc_attr( $options['api_key'] );
108
+                                        }
109
+                                        ?>
110 110
                                 " name="api_key" />
111 111
 							</td>
112 112
 						</tr>
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 							<td>
124 124
 								<input type="checkbox"
125 125
 								<?php
126
-								if ( isset( $options['disable_tour_title'] ) && '' !== $options['disable_tour_title'] ) {
127
-									echo esc_attr( 'checked="checked"' );
128
-								}
129
-								?>
126
+                                        if ( isset( $options['disable_tour_title'] ) && '' !== $options['disable_tour_title'] ) {
127
+                                             echo esc_attr( 'checked="checked"' );
128
+                                        }
129
+                                        ?>
130 130
 								name="disable_tour_title" />
131 131
 
132 132
 								<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>
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 							<td>
140 140
 								<input type="checkbox"
141 141
 								<?php
142
-								if ( isset( $options['disable_tour_descriptions'] ) && '' !== $options['disable_tour_descriptions'] ) {
143
-									echo esc_attr( 'checked="checked"' );
144
-								}
145
-								?>
142
+                                        if ( isset( $options['disable_tour_descriptions'] ) && '' !== $options['disable_tour_descriptions'] ) {
143
+                                             echo esc_attr( 'checked="checked"' );
144
+                                        }
145
+                                        ?>
146 146
 								name="disable_tour_descriptions" />
147 147
 
148 148
 								<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>
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 							<td>
156 156
 								<input type="checkbox"
157 157
 								<?php
158
-								if ( isset( $options['disable_tour_tags'] ) && '' !== $options['disable_tour_tags'] ) {
159
-									echo esc_attr( 'checked="checked"' );
160
-								}
161
-								?>
158
+                                        if ( isset( $options['disable_tour_tags'] ) && '' !== $options['disable_tour_tags'] ) {
159
+                                             echo esc_attr( 'checked="checked"' );
160
+                                        }
161
+                                        ?>
162 162
 								name="disable_tour_tags" />
163 163
 
164 164
 								<small><?php esc_html_e( 'Disable this is you dont want the option available on the import screen.', 'lsx-wetu-importer' ); ?></small>
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 							<td>
173 173
 								<input type="checkbox"
174 174
 								<?php
175
-								if ( isset( $options['enable_tour_ref_column'] ) && '' !== $options['enable_tour_ref_column'] ) {
176
-									echo esc_attr( 'checked="checked"' );
177
-								}
178
-								?>
175
+                                        if ( isset( $options['enable_tour_ref_column'] ) && '' !== $options['enable_tour_ref_column'] ) {
176
+                                             echo esc_attr( 'checked="checked"' );
177
+                                        }
178
+                                        ?>
179 179
 								name="enable_tour_ref_column" />
180 180
 								<small><?php esc_html_e( 'Enables the use of the WETU Reference Column for better tours management.', 'lsx-wetu-importer' ); ?></small>
181 181
 							</td>
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 							<td>
189 189
 								<input type="checkbox"
190 190
 								<?php
191
-								if ( isset( $options['enable_tour_featured_random'] ) && '' !== $options['enable_tour_featured_random'] ) {
192
-									echo esc_attr( 'checked="checked"' );
193
-								}
194
-								?>
191
+                                        if ( isset( $options['enable_tour_featured_random'] ) && '' !== $options['enable_tour_featured_random'] ) {
192
+                                             echo esc_attr( 'checked="checked"' );
193
+                                        }
194
+                                        ?>
195 195
 								name="enable_tour_featured_random" />
196 196
 								<small><?php esc_html_e( 'This will randomize the featured image from the destination gallery.', 'lsx-wetu-importer' ); ?></small>
197 197
 							</td>
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
 							<td>
211 211
 								<input type="checkbox"
212 212
 								<?php
213
-								if ( isset( $options['disable_accommodation_title'] ) && '' !== $options['disable_accommodation_title'] ) {
214
-									echo esc_attr( 'checked="checked"' );
215
-								}
216
-								?>
213
+                                        if ( isset( $options['disable_accommodation_title'] ) && '' !== $options['disable_accommodation_title'] ) {
214
+                                             echo esc_attr( 'checked="checked"' );
215
+                                        }
216
+                                        ?>
217 217
 								name="disable_accommodation_title" />
218 218
 
219 219
 								<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>
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 							<td>
227 227
 								<input type="checkbox"
228 228
 								<?php
229
-								if ( isset( $options['disable_accommodation_descriptions'] ) && '' !== $options['disable_accommodation_descriptions'] ) {
230
-									echo esc_attr( 'checked="checked"' );
231
-								}
232
-								?>
229
+                                        if ( isset( $options['disable_accommodation_descriptions'] ) && '' !== $options['disable_accommodation_descriptions'] ) {
230
+                                             echo esc_attr( 'checked="checked"' );
231
+                                        }
232
+                                        ?>
233 233
 								name="disable_accommodation_descriptions" />
234 234
 								<small><?php esc_html_e( 'If you are going to edit the accommodation descriptions imported then enable this setting.', 'lsx-wetu-importer' ); ?></small>
235 235
 							</td>
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
 							<td>
242 242
 								<input type="checkbox"
243 243
 								<?php
244
-								if ( isset( $options['disable_accommodation_filtering'] ) && '' !== $options['disable_accommodation_filtering'] ) {
245
-									echo esc_attr( 'checked="checked"' );
246
-								}
247
-								?>
244
+                                        if ( isset( $options['disable_accommodation_filtering'] ) && '' !== $options['disable_accommodation_filtering'] ) {
245
+                                             echo esc_attr( 'checked="checked"' );
246
+                                        }
247
+                                        ?>
248 248
 								name="disable_accommodation_filtering" />
249 249
 								<small><?php esc_html_e( 'This will stop the HTML from being stripped out of the description.', 'lsx-wetu-importer' ); ?></small>
250 250
 							</td>
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 							<td>
258 258
 								<input type="checkbox"
259 259
 								<?php
260
-								if ( isset( $options['disable_accommodation_excerpts'] ) && '' !== $options['disable_accommodation_excerpts'] ) {
261
-									echo esc_attr( 'checked="checked"' );
262
-								}
263
-								?>
260
+                                        if ( isset( $options['disable_accommodation_excerpts'] ) && '' !== $options['disable_accommodation_excerpts'] ) {
261
+                                             echo esc_attr( 'checked="checked"' );
262
+                                        }
263
+                                        ?>
264 264
 								name="disable_accommodation_excerpts" />
265 265
 								<small><?php esc_html_e( 'If you are going to edit the accommodation excerpts then enable this setting.', 'lsx-wetu-importer' ); ?></small>
266 266
 							</td>
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 							<td>
280 280
 								<input type="checkbox"
281 281
 								<?php
282
-								if ( isset( $options['disable_destination_title'] ) && '' !== $options['disable_destination_title'] ) {
283
-									echo esc_attr( 'checked="checked"' );
284
-								}
285
-								?>
282
+                                        if ( isset( $options['disable_destination_title'] ) && '' !== $options['disable_destination_title'] ) {
283
+                                             echo esc_attr( 'checked="checked"' );
284
+                                        }
285
+                                        ?>
286 286
 								name="disable_destination_title" />
287 287
 
288 288
 								<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>
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 							<td>
296 296
 								<input type="checkbox"
297 297
 								<?php
298
-								if ( isset( $options['disable_destination_descriptions'] ) && '' !== $options['disable_destination_descriptions'] ) {
299
-									echo esc_attr( 'checked="checked"' );
300
-								}
301
-								?>
298
+                                        if ( isset( $options['disable_destination_descriptions'] ) && '' !== $options['disable_destination_descriptions'] ) {
299
+                                             echo esc_attr( 'checked="checked"' );
300
+                                        }
301
+                                        ?>
302 302
 								name="disable_destination_descriptions" />
303 303
 								<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>
304 304
 							</td>
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 							<td>
318 318
 								<input type="checkbox"
319 319
 								<?php
320
-								if ( isset( $options['image_replacing'] ) && '' !== $options['image_replacing'] ) {
321
-									echo esc_attr( 'checked="checked"' );
322
-								}
323
-								?>
320
+                                        if ( isset( $options['image_replacing'] ) && '' !== $options['image_replacing'] ) {
321
+                                             echo esc_attr( 'checked="checked"' );
322
+                                        }
323
+                                        ?>
324 324
 								name="image_replacing" />
325 325
 								<p><?php esc_html_e( 'Do you want your images to be replaced on each import.', 'lsx-wetu-importer' ); ?></p>
326 326
 							</td>
@@ -332,10 +332,10 @@  discard block
 block discarded – undo
332 332
 							<td>
333 333
 								<input placeholder="" type="text" value="
334 334
                                 <?php
335
-								if ( isset( $options['image_limit'] ) && '' !== $options['image_limit'] ) {
336
-									echo esc_attr( $options['image_limit'] );
337
-								}
338
-								?>
335
+                                        if ( isset( $options['image_limit'] ) && '' !== $options['image_limit'] ) {
336
+                                             echo esc_attr( $options['image_limit'] );
337
+                                        }
338
+                                        ?>
339 339
                                 "
340 340
 								name="image_limit" />
341 341
 							</td>
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 							<td>
349 349
 								<input type="checkbox"
350 350
 								<?php
351
-								if ( isset( $options['image_scaling'] ) && '' !== $options['image_scaling'] ) {
352
-									echo esc_attr( 'checked="checked"' );
353
-								}
354
-								?>
351
+                                        if ( isset( $options['image_scaling'] ) && '' !== $options['image_scaling'] ) {
352
+                                             echo esc_attr( 'checked="checked"' );
353
+                                        }
354
+                                        ?>
355 355
 								name="image_scaling" />
356 356
 							</td>
357 357
 						</tr>
@@ -362,10 +362,10 @@  discard block
 block discarded – undo
362 362
 							<td>
363 363
 								<input placeholder="800" type="text" value="
364 364
                                 <?php
365
-								if ( isset( $options['width'] ) && '' !== $options['width'] ) {
366
-									echo esc_attr( $options['width'] );
367
-								}
368
-								?>
365
+                                        if ( isset( $options['width'] ) && '' !== $options['width'] ) {
366
+                                             echo esc_attr( $options['width'] );
367
+                                        }
368
+                                        ?>
369 369
                                 "
370 370
 								name="width" />
371 371
 							</td>
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
 							<td>
378 378
 								<input placeholder="600" type="text" value="
379 379
                                 <?php
380
-								if ( isset( $options['height'] ) && '' !== $options['height'] ) {
381
-									echo esc_attr( $options['height'] );
382
-								}
383
-								?>
380
+                                        if ( isset( $options['height'] ) && '' !== $options['height'] ) {
381
+                                             echo esc_attr( $options['height'] );
382
+                                        }
383
+                                        ?>
384 384
                                 "
385 385
 								name="height" />
386 386
 							</td>
@@ -393,52 +393,52 @@  discard block
 block discarded – undo
393 393
 							<td>
394 394
 								<input type="radio"
395 395
 								<?php
396
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'raw' === $options['scaling'] ) {
397
-									echo esc_attr( 'checked="checked"' );
398
-								}
399
-								?>
396
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'raw' === $options['scaling'] ) {
397
+                                             echo esc_attr( 'checked="checked"' );
398
+                                        }
399
+                                        ?>
400 400
 								name="scaling" value="raw" /> <?php esc_html_e( 'Get the Full size image, no cropping takes place.', 'lsx-wetu-importer' ); ?><br />
401 401
 								<input type="radio"
402 402
 								<?php
403
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'c' === $options['scaling'] ) {
404
-									echo esc_attr( 'checked="checked"' );
405
-								}
406
-								?>
403
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'c' === $options['scaling'] ) {
404
+                                             echo esc_attr( 'checked="checked"' );
405
+                                        }
406
+                                        ?>
407 407
 								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 />
408 408
 								<input type="radio"
409 409
 								<?php
410
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'h' === $options['scaling'] ) {
411
-									echo esc_attr( 'checked="checked"' );
412
-								}
413
-								?>
410
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'h' === $options['scaling'] ) {
411
+                                             echo esc_attr( 'checked="checked"' );
412
+                                        }
413
+                                        ?>
414 414
 								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 />
415 415
 								<input type="radio"
416 416
 								<?php
417
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'w' === $options['scaling'] ) {
418
-									echo esc_attr( 'checked="checked"' );
419
-								}
420
-								?>
417
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'w' === $options['scaling'] ) {
418
+                                             echo esc_attr( 'checked="checked"' );
419
+                                        }
420
+                                        ?>
421 421
 								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 />
422 422
 								<input type="radio"
423 423
 								<?php
424
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'nf' === $options['scaling'] ) {
425
-									echo esc_attr( 'checked="checked"' );
426
-								}
427
-								?>
424
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'nf' === $options['scaling'] ) {
425
+                                             echo esc_attr( 'checked="checked"' );
426
+                                        }
427
+                                        ?>
428 428
 								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 />
429 429
 								<input type="radio"
430 430
 								<?php
431
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'n' === $options['scaling'] ) {
432
-									echo esc_attr( 'checked="checked"' );
433
-								}
434
-								?>
431
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'n' === $options['scaling'] ) {
432
+                                             echo esc_attr( 'checked="checked"' );
433
+                                        }
434
+                                        ?>
435 435
 								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 />
436 436
 								<input type="radio"
437 437
 								<?php
438
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'W' === $options['scaling'] ) {
439
-									echo esc_attr( 'checked="checked"' );
440
-								}
441
-								?>
438
+                                        if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'W' === $options['scaling'] ) {
439
+                                             echo esc_attr( 'checked="checked"' );
440
+                                        }
441
+                                        ?>
442 442
 								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' ); ?>
443 443
 							</td>
444 444
 						</tr>
@@ -448,25 +448,25 @@  discard block
 block discarded – undo
448 448
 			</form>
449 449
 		</div>
450 450
 		<?php
451
-	}
451
+     }
452 452
 
453
-	/**
454
-	 * Save the options fields
455
-	 *
456
-	 * @return void
457
-	 */
458
-	public function save_options() {
459
-		if ( ! isset( $_POST['lsx_wetu_importer_save_options'] ) || ! wp_verify_nonce( $_POST['lsx_wetu_importer_save_options'], 'lsx_wetu_importer_save' ) ) {
460
-			return;
461
-		}
462
-		$data_to_save = array();
463
-		foreach ( $this->defaults as $key => $field ) {
464
-			if ( isset( $_POST[ $key ] ) ) {
465
-				$data_to_save[ $key ] = sanitize_text_field( $_POST[ $key ] );
466
-			} else {
467
-				$data_to_save[ $key ] = '';
468
-			}
469
-		}
470
-		update_option( 'lsx_wetu_importer_settings', $data_to_save );
471
-	}
453
+     /**
454
+      * Save the options fields
455
+      *
456
+      * @return void
457
+      */
458
+     public function save_options() {
459
+          if ( ! isset( $_POST['lsx_wetu_importer_save_options'] ) || ! wp_verify_nonce( $_POST['lsx_wetu_importer_save_options'], 'lsx_wetu_importer_save' ) ) {
460
+               return;
461
+          }
462
+          $data_to_save = array();
463
+          foreach ( $this->defaults as $key => $field ) {
464
+               if ( isset( $_POST[ $key ] ) ) {
465
+                    $data_to_save[ $key ] = sanitize_text_field( $_POST[ $key ] );
466
+               } else {
467
+                    $data_to_save[ $key ] = '';
468
+               }
469
+          }
470
+          update_option( 'lsx_wetu_importer_settings', $data_to_save );
471
+     }
472 472
 }
Please login to merge, or discard this patch.
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 			'scaling'                            => 'h',
64 64
 			'enable_tour_ref_column'             => '',
65 65
 		);
66
-		$this->fields   = array_keys( $this->defaults );
67
-		add_action( 'admin_init', array( $this, 'save_options' ) );
66
+		$this->fields = array_keys($this->defaults);
67
+		add_action('admin_init', array($this, 'save_options'));
68 68
 	}
69 69
 
70 70
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public static function get_instance() {
76 76
 		// If the single instance hasn't been set, set it now.
77
-		if ( ! isset( self::$instance ) ) {
77
+		if (!isset(self::$instance)) {
78 78
 			self::$instance = new self();
79 79
 		}
80 80
 		return self::$instance;
@@ -85,26 +85,26 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function display_page() {
87 87
 		$options = lsx_wetu_get_options();
88
-		foreach ( $options as $key => $value ) {
89
-			$value = trim( $value );
88
+		foreach ($options as $key => $value) {
89
+			$value = trim($value);
90 90
 		}
91
-		$options = wp_parse_args( $options, $this->defaults );
91
+		$options = wp_parse_args($options, $this->defaults);
92 92
 		?>
93 93
 		<div class="wrap">
94 94
 			<form method="post" class="">
95
-				<?php wp_nonce_field( 'lsx_wetu_importer_save', 'lsx_wetu_importer_save_options' ); ?>
96
-				<h1><?php esc_html_e( 'General', 'lsx-wetu-importer' ); ?></h1>
95
+				<?php wp_nonce_field('lsx_wetu_importer_save', 'lsx_wetu_importer_save_options'); ?>
96
+				<h1><?php esc_html_e('General', 'lsx-wetu-importer'); ?></h1>
97 97
 				<table class="form-table">
98 98
 					<tbody>
99 99
 						<tr class="form-field">
100 100
 							<th scope="row">
101
-								<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>
101
+								<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>
102 102
 							</th>
103 103
 							<td>
104 104
 								<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="
105 105
                                 <?php
106
-								if ( isset( $options['api_key'] ) ) {
107
-									echo esc_attr( $options['api_key'] );
106
+								if (isset($options['api_key'])) {
107
+									echo esc_attr($options['api_key']);
108 108
 								}
109 109
 								?>
110 110
                                 " name="api_key" />
@@ -113,227 +113,227 @@  discard block
 block discarded – undo
113 113
 					</tbody>
114 114
 				</table>
115 115
 
116
-				<h1><?php esc_html_e( 'Tours', 'lsx-wetu-importer' ); ?></h1>
116
+				<h1><?php esc_html_e('Tours', 'lsx-wetu-importer'); ?></h1>
117 117
 				<table class="form-table">
118 118
 					<tbody>
119 119
 						<tr class="form-field -wrap">
120 120
 							<th scope="row">
121
-								<label for="disable_tour_title"><?php esc_html_e( 'Enable Custom Titles', 'lsx-wetu-importer' ); ?></label>
121
+								<label for="disable_tour_title"><?php esc_html_e('Enable Custom Titles', 'lsx-wetu-importer'); ?></label>
122 122
 							</th>
123 123
 							<td>
124 124
 								<input type="checkbox"
125 125
 								<?php
126
-								if ( isset( $options['disable_tour_title'] ) && '' !== $options['disable_tour_title'] ) {
127
-									echo esc_attr( 'checked="checked"' );
126
+								if (isset($options['disable_tour_title']) && '' !== $options['disable_tour_title']) {
127
+									echo esc_attr('checked="checked"');
128 128
 								}
129 129
 								?>
130 130
 								name="disable_tour_title" />
131 131
 
132
-								<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>
132
+								<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>
133 133
 							</td>
134 134
 						</tr>
135 135
 						<tr class="form-field -wrap">
136 136
 							<th scope="row">
137
-								<label for="disable_tour_descriptions"><?php esc_html_e( 'Disable Descriptions', 'lsx-wetu-importer' ); ?></label>
137
+								<label for="disable_tour_descriptions"><?php esc_html_e('Disable Descriptions', 'lsx-wetu-importer'); ?></label>
138 138
 							</th>
139 139
 							<td>
140 140
 								<input type="checkbox"
141 141
 								<?php
142
-								if ( isset( $options['disable_tour_descriptions'] ) && '' !== $options['disable_tour_descriptions'] ) {
143
-									echo esc_attr( 'checked="checked"' );
142
+								if (isset($options['disable_tour_descriptions']) && '' !== $options['disable_tour_descriptions']) {
143
+									echo esc_attr('checked="checked"');
144 144
 								}
145 145
 								?>
146 146
 								name="disable_tour_descriptions" />
147 147
 
148
-								<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>
148
+								<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>
149 149
 							</td>
150 150
 						</tr>
151 151
 						<tr class="form-field -wrap">
152 152
 							<th scope="row">
153
-								<label for="disable_tour_tags"><?php esc_html_e( 'Disable Tags / Travel Styles', 'lsx-wetu-importer' ); ?></label>
153
+								<label for="disable_tour_tags"><?php esc_html_e('Disable Tags / Travel Styles', 'lsx-wetu-importer'); ?></label>
154 154
 							</th>
155 155
 							<td>
156 156
 								<input type="checkbox"
157 157
 								<?php
158
-								if ( isset( $options['disable_tour_tags'] ) && '' !== $options['disable_tour_tags'] ) {
159
-									echo esc_attr( 'checked="checked"' );
158
+								if (isset($options['disable_tour_tags']) && '' !== $options['disable_tour_tags']) {
159
+									echo esc_attr('checked="checked"');
160 160
 								}
161 161
 								?>
162 162
 								name="disable_tour_tags" />
163 163
 
164
-								<small><?php esc_html_e( 'Disable this is you dont want the option available on the import screen.', 'lsx-wetu-importer' ); ?></small>
164
+								<small><?php esc_html_e('Disable this is you dont want the option available on the import screen.', 'lsx-wetu-importer'); ?></small>
165 165
 							</td>
166 166
 						</tr>
167 167
 
168 168
 						<tr class="form-field -wrap">
169 169
 							<th scope="row">
170
-								<label for="enable_tour_ref_column"><?php esc_html_e( 'Enable Reference Column', 'lsx-wetu-importer' ); ?></label>
170
+								<label for="enable_tour_ref_column"><?php esc_html_e('Enable Reference Column', 'lsx-wetu-importer'); ?></label>
171 171
 							</th>
172 172
 							<td>
173 173
 								<input type="checkbox"
174 174
 								<?php
175
-								if ( isset( $options['enable_tour_ref_column'] ) && '' !== $options['enable_tour_ref_column'] ) {
176
-									echo esc_attr( 'checked="checked"' );
175
+								if (isset($options['enable_tour_ref_column']) && '' !== $options['enable_tour_ref_column']) {
176
+									echo esc_attr('checked="checked"');
177 177
 								}
178 178
 								?>
179 179
 								name="enable_tour_ref_column" />
180
-								<small><?php esc_html_e( 'Enables the use of the WETU Reference Column for better tours management.', 'lsx-wetu-importer' ); ?></small>
180
+								<small><?php esc_html_e('Enables the use of the WETU Reference Column for better tours management.', 'lsx-wetu-importer'); ?></small>
181 181
 							</td>
182 182
 						</tr>
183 183
 
184 184
 						<tr class="form-field -wrap">
185 185
 							<th scope="row">
186
-								<label for="enable_tour_featured_random"><?php esc_html_e( 'Randomize Featured Image', 'lsx-wetu-importer' ); ?></label>
186
+								<label for="enable_tour_featured_random"><?php esc_html_e('Randomize Featured Image', 'lsx-wetu-importer'); ?></label>
187 187
 							</th>
188 188
 							<td>
189 189
 								<input type="checkbox"
190 190
 								<?php
191
-								if ( isset( $options['enable_tour_featured_random'] ) && '' !== $options['enable_tour_featured_random'] ) {
192
-									echo esc_attr( 'checked="checked"' );
191
+								if (isset($options['enable_tour_featured_random']) && '' !== $options['enable_tour_featured_random']) {
192
+									echo esc_attr('checked="checked"');
193 193
 								}
194 194
 								?>
195 195
 								name="enable_tour_featured_random" />
196
-								<small><?php esc_html_e( 'This will randomize the featured image from the destination gallery.', 'lsx-wetu-importer' ); ?></small>
196
+								<small><?php esc_html_e('This will randomize the featured image from the destination gallery.', 'lsx-wetu-importer'); ?></small>
197 197
 							</td>
198 198
 						</tr>
199 199
 					</tbody>
200 200
 				</table>
201 201
 
202
-				<h1><?php esc_html_e( 'Accommodation', 'lsx-wetu-importer' ); ?></h1>
202
+				<h1><?php esc_html_e('Accommodation', 'lsx-wetu-importer'); ?></h1>
203 203
 
204 204
 				<table class="form-table">
205 205
 					<tbody>
206 206
 						<tr class="form-field -wrap">
207 207
 							<th scope="row">
208
-								<label for="disable_accommodation_title"><?php esc_html_e( 'Enable Custom Titles', 'lsx-wetu-importer' ); ?></label>
208
+								<label for="disable_accommodation_title"><?php esc_html_e('Enable Custom Titles', 'lsx-wetu-importer'); ?></label>
209 209
 							</th>
210 210
 							<td>
211 211
 								<input type="checkbox"
212 212
 								<?php
213
-								if ( isset( $options['disable_accommodation_title'] ) && '' !== $options['disable_accommodation_title'] ) {
214
-									echo esc_attr( 'checked="checked"' );
213
+								if (isset($options['disable_accommodation_title']) && '' !== $options['disable_accommodation_title']) {
214
+									echo esc_attr('checked="checked"');
215 215
 								}
216 216
 								?>
217 217
 								name="disable_accommodation_title" />
218 218
 
219
-								<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>
219
+								<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>
220 220
 							</td>
221 221
 						</tr>
222 222
 						<tr class="form-field -wrap">
223 223
 							<th scope="row">
224
-								<label for="disable_accommodation_descriptions"><?php esc_html_e( 'Disable Descriptions', 'lsx-wetu-importer' ); ?></label>
224
+								<label for="disable_accommodation_descriptions"><?php esc_html_e('Disable Descriptions', 'lsx-wetu-importer'); ?></label>
225 225
 							</th>
226 226
 							<td>
227 227
 								<input type="checkbox"
228 228
 								<?php
229
-								if ( isset( $options['disable_accommodation_descriptions'] ) && '' !== $options['disable_accommodation_descriptions'] ) {
230
-									echo esc_attr( 'checked="checked"' );
229
+								if (isset($options['disable_accommodation_descriptions']) && '' !== $options['disable_accommodation_descriptions']) {
230
+									echo esc_attr('checked="checked"');
231 231
 								}
232 232
 								?>
233 233
 								name="disable_accommodation_descriptions" />
234
-								<small><?php esc_html_e( 'If you are going to edit the accommodation descriptions imported then enable this setting.', 'lsx-wetu-importer' ); ?></small>
234
+								<small><?php esc_html_e('If you are going to edit the accommodation descriptions imported then enable this setting.', 'lsx-wetu-importer'); ?></small>
235 235
 							</td>
236 236
 						</tr>
237 237
 						<tr class="form-field -wrap">
238 238
 							<th scope="row">
239
-								<label for="disable_accommodation_filtering"><?php esc_html_e( 'Disable Description Filtering', 'lsx-wetu-importer' ); ?></label>
239
+								<label for="disable_accommodation_filtering"><?php esc_html_e('Disable Description Filtering', 'lsx-wetu-importer'); ?></label>
240 240
 							</th>
241 241
 							<td>
242 242
 								<input type="checkbox"
243 243
 								<?php
244
-								if ( isset( $options['disable_accommodation_filtering'] ) && '' !== $options['disable_accommodation_filtering'] ) {
245
-									echo esc_attr( 'checked="checked"' );
244
+								if (isset($options['disable_accommodation_filtering']) && '' !== $options['disable_accommodation_filtering']) {
245
+									echo esc_attr('checked="checked"');
246 246
 								}
247 247
 								?>
248 248
 								name="disable_accommodation_filtering" />
249
-								<small><?php esc_html_e( 'This will stop the HTML from being stripped out of the description.', 'lsx-wetu-importer' ); ?></small>
249
+								<small><?php esc_html_e('This will stop the HTML from being stripped out of the description.', 'lsx-wetu-importer'); ?></small>
250 250
 							</td>
251 251
 						</tr>
252 252
 
253 253
 						<tr class="form-field -wrap">
254 254
 							<th scope="row">
255
-								<label for="disable_accommodation_excerpts"><?php esc_html_e( 'Disable Excerpts', 'lsx-wetu-importer' ); ?></label>
255
+								<label for="disable_accommodation_excerpts"><?php esc_html_e('Disable Excerpts', 'lsx-wetu-importer'); ?></label>
256 256
 							</th>
257 257
 							<td>
258 258
 								<input type="checkbox"
259 259
 								<?php
260
-								if ( isset( $options['disable_accommodation_excerpts'] ) && '' !== $options['disable_accommodation_excerpts'] ) {
261
-									echo esc_attr( 'checked="checked"' );
260
+								if (isset($options['disable_accommodation_excerpts']) && '' !== $options['disable_accommodation_excerpts']) {
261
+									echo esc_attr('checked="checked"');
262 262
 								}
263 263
 								?>
264 264
 								name="disable_accommodation_excerpts" />
265
-								<small><?php esc_html_e( 'If you are going to edit the accommodation excerpts then enable this setting.', 'lsx-wetu-importer' ); ?></small>
265
+								<small><?php esc_html_e('If you are going to edit the accommodation excerpts then enable this setting.', 'lsx-wetu-importer'); ?></small>
266 266
 							</td>
267 267
 						</tr>
268 268
 					</tbody>
269 269
 				</table>
270 270
 
271
-				<h1><?php esc_html_e( 'Destinations', 'lsx-wetu-importer' ); ?></h1>
271
+				<h1><?php esc_html_e('Destinations', 'lsx-wetu-importer'); ?></h1>
272 272
 
273 273
 				<table class="form-table">
274 274
 					<tbody>
275 275
 						<tr class="form-field -wrap">
276 276
 							<th scope="row">
277
-								<label for="disable_destination_title"><?php esc_html_e( 'Enable Custom Titles', 'lsx-wetu-importer' ); ?></label>
277
+								<label for="disable_destination_title"><?php esc_html_e('Enable Custom Titles', 'lsx-wetu-importer'); ?></label>
278 278
 							</th>
279 279
 							<td>
280 280
 								<input type="checkbox"
281 281
 								<?php
282
-								if ( isset( $options['disable_destination_title'] ) && '' !== $options['disable_destination_title'] ) {
283
-									echo esc_attr( 'checked="checked"' );
282
+								if (isset($options['disable_destination_title']) && '' !== $options['disable_destination_title']) {
283
+									echo esc_attr('checked="checked"');
284 284
 								}
285 285
 								?>
286 286
 								name="disable_destination_title" />
287 287
 
288
-								<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>
288
+								<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>
289 289
 							</td>
290 290
 						</tr>
291 291
 						<tr class="form-field -wrap">
292 292
 							<th scope="row">
293
-								<label for="disable_destination_descriptions"><?php esc_html_e( 'Disable Descriptions', 'lsx-wetu-importer' ); ?></label>
293
+								<label for="disable_destination_descriptions"><?php esc_html_e('Disable Descriptions', 'lsx-wetu-importer'); ?></label>
294 294
 							</th>
295 295
 							<td>
296 296
 								<input type="checkbox"
297 297
 								<?php
298
-								if ( isset( $options['disable_destination_descriptions'] ) && '' !== $options['disable_destination_descriptions'] ) {
299
-									echo esc_attr( 'checked="checked"' );
298
+								if (isset($options['disable_destination_descriptions']) && '' !== $options['disable_destination_descriptions']) {
299
+									echo esc_attr('checked="checked"');
300 300
 								}
301 301
 								?>
302 302
 								name="disable_destination_descriptions" />
303
-								<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>
303
+								<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>
304 304
 							</td>
305 305
 						</tr>
306 306
 					</tbody>
307 307
 				</table>
308 308
 
309
-				<h1><?php esc_html_e( 'Images', 'lsx-wetu-importer' ); ?></h1>
309
+				<h1><?php esc_html_e('Images', 'lsx-wetu-importer'); ?></h1>
310 310
 
311 311
 				<table class="form-table">
312 312
 					<tbody>
313 313
 						<tr class="form-field -wrap">
314 314
 							<th scope="row">
315
-								<label for="image_replacing"><?php esc_html_e( 'Replace Images', 'lsx-wetu-importer' ); ?></label>
315
+								<label for="image_replacing"><?php esc_html_e('Replace Images', 'lsx-wetu-importer'); ?></label>
316 316
 							</th>
317 317
 							<td>
318 318
 								<input type="checkbox"
319 319
 								<?php
320
-								if ( isset( $options['image_replacing'] ) && '' !== $options['image_replacing'] ) {
321
-									echo esc_attr( 'checked="checked"' );
320
+								if (isset($options['image_replacing']) && '' !== $options['image_replacing']) {
321
+									echo esc_attr('checked="checked"');
322 322
 								}
323 323
 								?>
324 324
 								name="image_replacing" />
325
-								<p><?php esc_html_e( 'Do you want your images to be replaced on each import.', 'lsx-wetu-importer' ); ?></p>
325
+								<p><?php esc_html_e('Do you want your images to be replaced on each import.', 'lsx-wetu-importer'); ?></p>
326 326
 							</td>
327 327
 						</tr>
328 328
 						<tr class="form-field -wrap">
329 329
 							<th scope="row">
330
-								<label for="image_limit"> <?php esc_html_e( 'Limit the amount of images imported to the gallery', 'lsx-wetu-importer' ); ?></label>
330
+								<label for="image_limit"> <?php esc_html_e('Limit the amount of images imported to the gallery', 'lsx-wetu-importer'); ?></label>
331 331
 							</th>
332 332
 							<td>
333 333
 								<input placeholder="" type="text" value="
334 334
                                 <?php
335
-								if ( isset( $options['image_limit'] ) && '' !== $options['image_limit'] ) {
336
-									echo esc_attr( $options['image_limit'] );
335
+								if (isset($options['image_limit']) && '' !== $options['image_limit']) {
336
+									echo esc_attr($options['image_limit']);
337 337
 								}
338 338
 								?>
339 339
                                 "
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
 
344 344
 						<tr class="form-field -wrap">
345 345
 							<th scope="row">
346
-								<label for="image_scaling"><?php esc_html_e( 'Enable Image Scaling', 'lsx-wetu-importer' ); ?></label>
346
+								<label for="image_scaling"><?php esc_html_e('Enable Image Scaling', 'lsx-wetu-importer'); ?></label>
347 347
 							</th>
348 348
 							<td>
349 349
 								<input type="checkbox"
350 350
 								<?php
351
-								if ( isset( $options['image_scaling'] ) && '' !== $options['image_scaling'] ) {
352
-									echo esc_attr( 'checked="checked"' );
351
+								if (isset($options['image_scaling']) && '' !== $options['image_scaling']) {
352
+									echo esc_attr('checked="checked"');
353 353
 								}
354 354
 								?>
355 355
 								name="image_scaling" />
@@ -357,13 +357,13 @@  discard block
 block discarded – undo
357 357
 						</tr>
358 358
 						<tr class="form-field -wrap">
359 359
 							<th scope="row">
360
-								<label for="width"> <?php esc_html_e( 'Width (px)', 'lsx-wetu-importer' ); ?></label>
360
+								<label for="width"> <?php esc_html_e('Width (px)', 'lsx-wetu-importer'); ?></label>
361 361
 							</th>
362 362
 							<td>
363 363
 								<input placeholder="800" type="text" value="
364 364
                                 <?php
365
-								if ( isset( $options['width'] ) && '' !== $options['width'] ) {
366
-									echo esc_attr( $options['width'] );
365
+								if (isset($options['width']) && '' !== $options['width']) {
366
+									echo esc_attr($options['width']);
367 367
 								}
368 368
 								?>
369 369
                                 "
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 						</tr>
373 373
 						<tr class="form-field -wrap">
374 374
 							<th scope="row">
375
-								<label for="height"> <?php esc_html_e( 'Height (px)', 'lsx-wetu-importer' ); ?></label>
375
+								<label for="height"> <?php esc_html_e('Height (px)', 'lsx-wetu-importer'); ?></label>
376 376
 							</th>
377 377
 							<td>
378 378
 								<input placeholder="600" type="text" value="
379 379
                                 <?php
380
-								if ( isset( $options['height'] ) && '' !== $options['height'] ) {
381
-									echo esc_attr( $options['height'] );
380
+								if (isset($options['height']) && '' !== $options['height']) {
381
+									echo esc_attr($options['height']);
382 382
 								}
383 383
 								?>
384 384
                                 "
@@ -388,63 +388,63 @@  discard block
 block discarded – undo
388 388
 
389 389
 						<tr class="form-field -wrap image-settings">
390 390
 							<th scope="row">
391
-								<label for="scaling"> <?php esc_html_e( 'Scaling', 'lsx-wetu-importer' ); ?></label>
391
+								<label for="scaling"> <?php esc_html_e('Scaling', 'lsx-wetu-importer'); ?></label>
392 392
 							</th>
393 393
 							<td>
394 394
 								<input type="radio"
395 395
 								<?php
396
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'raw' === $options['scaling'] ) {
397
-									echo esc_attr( 'checked="checked"' );
396
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'raw' === $options['scaling']) {
397
+									echo esc_attr('checked="checked"');
398 398
 								}
399 399
 								?>
400
-								name="scaling" value="raw" /> <?php esc_html_e( 'Get the Full size image, no cropping takes place.', 'lsx-wetu-importer' ); ?><br />
400
+								name="scaling" value="raw" /> <?php esc_html_e('Get the Full size image, no cropping takes place.', 'lsx-wetu-importer'); ?><br />
401 401
 								<input type="radio"
402 402
 								<?php
403
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'c' === $options['scaling'] ) {
404
-									echo esc_attr( 'checked="checked"' );
403
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'c' === $options['scaling']) {
404
+									echo esc_attr('checked="checked"');
405 405
 								}
406 406
 								?>
407
-								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 />
407
+								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 />
408 408
 								<input type="radio"
409 409
 								<?php
410
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'h' === $options['scaling'] ) {
411
-									echo esc_attr( 'checked="checked"' );
410
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'h' === $options['scaling']) {
411
+									echo esc_attr('checked="checked"');
412 412
 								}
413 413
 								?>
414
-								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 />
414
+								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 />
415 415
 								<input type="radio"
416 416
 								<?php
417
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'w' === $options['scaling'] ) {
418
-									echo esc_attr( 'checked="checked"' );
417
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'w' === $options['scaling']) {
418
+									echo esc_attr('checked="checked"');
419 419
 								}
420 420
 								?>
421
-								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 />
421
+								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 />
422 422
 								<input type="radio"
423 423
 								<?php
424
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'nf' === $options['scaling'] ) {
425
-									echo esc_attr( 'checked="checked"' );
424
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'nf' === $options['scaling']) {
425
+									echo esc_attr('checked="checked"');
426 426
 								}
427 427
 								?>
428
-								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 />
428
+								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 />
429 429
 								<input type="radio"
430 430
 								<?php
431
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'n' === $options['scaling'] ) {
432
-									echo esc_attr( 'checked="checked"' );
431
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'n' === $options['scaling']) {
432
+									echo esc_attr('checked="checked"');
433 433
 								}
434 434
 								?>
435
-								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 />
435
+								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 />
436 436
 								<input type="radio"
437 437
 								<?php
438
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'W' === $options['scaling'] ) {
439
-									echo esc_attr( 'checked="checked"' );
438
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'W' === $options['scaling']) {
439
+									echo esc_attr('checked="checked"');
440 440
 								}
441 441
 								?>
442
-								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' ); ?>
442
+								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'); ?>
443 443
 							</td>
444 444
 						</tr>
445 445
 					</tbody>
446 446
 				</table>
447
-				<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>
447
+				<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>
448 448
 			</form>
449 449
 		</div>
450 450
 		<?php
@@ -456,17 +456,17 @@  discard block
 block discarded – undo
456 456
 	 * @return void
457 457
 	 */
458 458
 	public function save_options() {
459
-		if ( ! isset( $_POST['lsx_wetu_importer_save_options'] ) || ! wp_verify_nonce( $_POST['lsx_wetu_importer_save_options'], 'lsx_wetu_importer_save' ) ) {
459
+		if (!isset($_POST['lsx_wetu_importer_save_options']) || !wp_verify_nonce($_POST['lsx_wetu_importer_save_options'], 'lsx_wetu_importer_save')) {
460 460
 			return;
461 461
 		}
462 462
 		$data_to_save = array();
463
-		foreach ( $this->defaults as $key => $field ) {
464
-			if ( isset( $_POST[ $key ] ) ) {
465
-				$data_to_save[ $key ] = sanitize_text_field( $_POST[ $key ] );
466
-			} else {
467
-				$data_to_save[ $key ] = '';
463
+		foreach ($this->defaults as $key => $field) {
464
+			if (isset($_POST[$key])) {
465
+				$data_to_save[$key] = sanitize_text_field($_POST[$key]);
466
+			}else {
467
+				$data_to_save[$key] = '';
468 468
 			}
469 469
 		}
470
-		update_option( 'lsx_wetu_importer_settings', $data_to_save );
470
+		update_option('lsx_wetu_importer_settings', $data_to_save);
471 471
 	}
472 472
 }
Please login to merge, or discard this patch.