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