Passed
Push — master ( e65b13...58d22b )
by Warwick
02:08
created
classes/class-lsx-wetu-importer.php 1 patch
Spacing   +342 added lines, -342 removed lines patch added patch discarded remove patch
@@ -197,34 +197,34 @@  discard block
 block discarded – undo
197 197
 	 * @access private
198 198
 	 */
199 199
 	public function __construct() {
200
-		add_action( 'admin_init', array( $this, 'compatible_version_check' ) );
201
-		require_once LSX_WETU_IMPORTER_PATH . 'includes/helpers.php';
200
+		add_action('admin_init', array($this, 'compatible_version_check'));
201
+		require_once LSX_WETU_IMPORTER_PATH.'includes/helpers.php';
202 202
 
203 203
 		// Don't run anything else in the plugin, if we're on an incompatible PHP version.
204
-		if ( ! self::compatible_version() ) {
204
+		if (!self::compatible_version()) {
205 205
 			return;
206 206
 		}
207 207
 
208 208
 		$this->set_variables();
209 209
 
210
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
211
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ), 11 );
212
-		add_action( 'admin_menu', array( $this, 'register_importer_page' ), 20 );
210
+		add_action('init', array($this, 'load_plugin_textdomain'));
211
+		add_action('admin_enqueue_scripts', array($this, 'admin_scripts'), 11);
212
+		add_action('admin_menu', array($this, 'register_importer_page'), 20);
213 213
 
214
-		require_once LSX_WETU_IMPORTER_PATH . 'classes/class-welcome.php';
215
-		require_once LSX_WETU_IMPORTER_PATH . 'classes/class-lsx-wetu-importer-accommodation.php';
216
-		require_once LSX_WETU_IMPORTER_PATH . 'classes/class-lsx-wetu-importer-destination.php';
217
-		require_once LSX_WETU_IMPORTER_PATH . 'classes/class-lsx-wetu-importer-tours.php';
218
-		require_once LSX_WETU_IMPORTER_PATH . 'classes/class-settings.php';
214
+		require_once LSX_WETU_IMPORTER_PATH.'classes/class-welcome.php';
215
+		require_once LSX_WETU_IMPORTER_PATH.'classes/class-lsx-wetu-importer-accommodation.php';
216
+		require_once LSX_WETU_IMPORTER_PATH.'classes/class-lsx-wetu-importer-destination.php';
217
+		require_once LSX_WETU_IMPORTER_PATH.'classes/class-lsx-wetu-importer-tours.php';
218
+		require_once LSX_WETU_IMPORTER_PATH.'classes/class-settings.php';
219 219
 
220
-		add_action( 'init', array( $this, 'load_class' ) );
220
+		add_action('init', array($this, 'load_class'));
221 221
 
222
-		if ( 'default' !== $this->tab_slug ) {
223
-			add_action( 'wp_ajax_lsx_tour_importer', array( $this, 'process_ajax_search' ) );
224
-			add_action( 'wp_ajax_nopriv_lsx_tour_importer', array( $this, 'process_ajax_search' ) );
222
+		if ('default' !== $this->tab_slug) {
223
+			add_action('wp_ajax_lsx_tour_importer', array($this, 'process_ajax_search'));
224
+			add_action('wp_ajax_nopriv_lsx_tour_importer', array($this, 'process_ajax_search'));
225 225
 
226
-			add_action( 'wp_ajax_lsx_import_items', array( $this, 'process_ajax_import' ) );
227
-			add_action( 'wp_ajax_nopriv_lsx_import_items', array( $this, 'process_ajax_import' ) );
226
+			add_action('wp_ajax_lsx_import_items', array($this, 'process_ajax_import'));
227
+			add_action('wp_ajax_nopriv_lsx_import_items', array($this, 'process_ajax_import'));
228 228
 		}
229 229
 	}
230 230
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 	 * @since 1.0.0
237 237
 	 */
238 238
 	public function load_plugin_textdomain() {
239
-		load_plugin_textdomain( 'lsx-wetu-importer', false, basename( LSX_WETU_IMPORTER_PATH ) . '/languages' );
239
+		load_plugin_textdomain('lsx-wetu-importer', false, basename(LSX_WETU_IMPORTER_PATH).'/languages');
240 240
 	}
241 241
 
242 242
 	/**
243 243
 	 * Sets the variables used throughout the plugin.
244 244
 	 */
245 245
 	public function set_variables() {
246
-		$this->post_types = array( 'accommodation', 'destination', 'tour' );
246
+		$this->post_types = array('accommodation', 'destination', 'tour');
247 247
 		$options = \lsx_wetu_importer\includes\helpers\get_options();
248 248
 
249 249
 		// Set the options.
250
-		if ( ! empty( $options ) ) {
250
+		if (!empty($options)) {
251 251
 			$this->options = $options;
252 252
 
253
-			$temp_options = get_option( '_lsx-to_settings', false );
254
-			if ( false !== $temp_options ) {
253
+			$temp_options = get_option('_lsx-to_settings', false);
254
+			if (false !== $temp_options) {
255 255
 				$this->accommodation_settings = $temp_options['accommodation'];
256 256
 				$this->tour_settings          = $temp_options['tour'];
257 257
 				$this->destination_settings   = $temp_options['destination'];
@@ -259,49 +259,49 @@  discard block
 block discarded – undo
259 259
 
260 260
 			$this->api_key = false;
261 261
 
262
-			if ( ! defined( 'WETU_API_KEY' ) ) {
263
-				if ( isset( $options['api_key'] ) && '' !== $options['api_key'] ) {
262
+			if (!defined('WETU_API_KEY')) {
263
+				if (isset($options['api_key']) && '' !== $options['api_key']) {
264 264
 					$this->api_key = $options['api_key'];
265 265
 				}
266
-			} else {
266
+			}else {
267 267
 				$this->api_key = WETU_API_KEY;
268 268
 			}
269 269
 
270 270
 			// Set the tab slug.
271
-			if ( isset( $_GET['tab'] ) || ( defined( 'DOING_AJAX' ) && check_ajax_referer( 'lsx_wetu_ajax_action', 'security' ) && isset( $_POST['type'] ) ) ) {
272
-				if ( isset( $_GET['tab'] ) ) {
273
-					$this->tab_slug = wp_unslash( $_GET['tab'] );
274
-				} else {
275
-					$this->tab_slug = wp_unslash( $_POST['type'] );
271
+			if (isset($_GET['tab']) || (defined('DOING_AJAX') && check_ajax_referer('lsx_wetu_ajax_action', 'security') && isset($_POST['type']))) {
272
+				if (isset($_GET['tab'])) {
273
+					$this->tab_slug = wp_unslash($_GET['tab']);
274
+				}else {
275
+					$this->tab_slug = wp_unslash($_POST['type']);
276 276
 				}
277 277
 
278 278
 				// If any tours were queued.
279
-				$this->queued_imports = get_option( 'lsx_wetu_importer_que', array() );
279
+				$this->queued_imports = get_option('lsx_wetu_importer_que', array());
280 280
 			}
281 281
 
282 282
 			// Set the scaling options.
283
-			if ( isset( $this->options ) && isset( $this->options['image_scaling'] ) ) {
283
+			if (isset($this->options) && isset($this->options['image_scaling'])) {
284 284
 				$this->scale_images = true;
285 285
 
286 286
 				$width = '1024';
287
-				if ( isset( $this->options['width'] ) && '' !== $this->options['width'] ) {
287
+				if (isset($this->options['width']) && '' !== $this->options['width']) {
288 288
 					$width = $this->options['width'];
289 289
 				}
290 290
 
291 291
 				$height = '768';
292
-				if ( isset( $this->options['height'] ) && '' !== $this->options['height'] ) {
292
+				if (isset($this->options['height']) && '' !== $this->options['height']) {
293 293
 					$height = $this->options['height'];
294 294
 				}
295 295
 
296 296
 				$cropping = 'w';
297
-				if ( isset( $this->options['cropping'] ) && '' !== $this->options['cropping'] ) {
297
+				if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
298 298
 					$cropping = $this->options['cropping'];
299 299
 				}
300 300
 
301
-				$this->image_scaling_url = 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
301
+				$this->image_scaling_url = 'https://wetu.com/ImageHandler/'.$cropping.$width.'x'.$height.'/';
302 302
 			}
303 303
 
304
-			if ( isset( $this->options ) && isset( $this->options['image_limit'] ) && '' !== $this->options['image_limit'] ) {
304
+			if (isset($this->options) && isset($this->options['image_limit']) && '' !== $this->options['image_limit']) {
305 305
 				$this->image_limit = $this->options['image_limit'];
306 306
 			}
307 307
 		}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * @since 1.0.0
325 325
 	 */
326 326
 	public static function compatible_version() {
327
-		if ( version_compare( PHP_VERSION, '5.6', '<' ) ) {
327
+		if (version_compare(PHP_VERSION, '5.6', '<')) {
328 328
 			return false;
329 329
 		}
330 330
 
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
 	 * @since 1.0.0
339 339
 	 */
340 340
 	public function compatible_version_check() {
341
-		if ( ! self::compatible_version() ) {
342
-			if ( is_plugin_active( plugin_basename( LSX_WETU_IMPORTER_CORE ) ) ) {
343
-				deactivate_plugins( plugin_basename( LSX_WETU_IMPORTER_CORE ) );
344
-				add_action( 'admin_notices', array( $this, 'compatible_version_notice' ) );
341
+		if (!self::compatible_version()) {
342
+			if (is_plugin_active(plugin_basename(LSX_WETU_IMPORTER_CORE))) {
343
+				deactivate_plugins(plugin_basename(LSX_WETU_IMPORTER_CORE));
344
+				add_action('admin_notices', array($this, 'compatible_version_notice'));
345 345
 
346
-				if ( isset( $_GET['activate'] ) ) {
347
-					unset( $_GET['activate'] );
346
+				if (isset($_GET['activate'])) {
347
+					unset($_GET['activate']);
348 348
 				}
349 349
 			}
350 350
 		}
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	public function compatible_version_notice() {
359 359
 		$class = 'notice notice-error';
360
-		$message = esc_html__( 'LSX Importer for Wetu Plugin requires PHP 5.6 or higher.', 'lsx-wetu-importer' );
361
-		printf( '<div class="%1$s"><p>%2$s</p></div>', esc_html( $class ), esc_html( $message ) );
360
+		$message = esc_html__('LSX Importer for Wetu Plugin requires PHP 5.6 or higher.', 'lsx-wetu-importer');
361
+		printf('<div class="%1$s"><p>%2$s</p></div>', esc_html($class), esc_html($message));
362 362
 	}
363 363
 
364 364
 	/**
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 	 * @since 1.0.0
369 369
 	 */
370 370
 	public static function compatible_version_check_on_activation() {
371
-		if ( ! self::compatible_version() ) {
372
-			deactivate_plugins( plugin_basename( LSX_WETU_IMPORTER_CORE ) );
373
-			wp_die( esc_html__( 'LSX Importer for Wetu Plugin requires PHP 5.6 or higher.', 'lsx-wetu-importer' ) );
371
+		if (!self::compatible_version()) {
372
+			deactivate_plugins(plugin_basename(LSX_WETU_IMPORTER_CORE));
373
+			wp_die(esc_html__('LSX Importer for Wetu Plugin requires PHP 5.6 or higher.', 'lsx-wetu-importer'));
374 374
 		}
375 375
 	}
376 376
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 * Load the importer class you want to use
381 381
 	 */
382 382
 	public function load_class() {
383
-		switch ( $this->tab_slug ) {
383
+		switch ($this->tab_slug) {
384 384
 			case 'accommodation':
385 385
 				$this->current_importer = new LSX_WETU_Importer_Accommodation();
386 386
 				break;
@@ -407,32 +407,32 @@  discard block
 block discarded – undo
407 407
 	 * Registers the admin page which will house the importer form.
408 408
 	 */
409 409
 	public function register_importer_page() {
410
-		add_submenu_page( 'tour-operator', esc_html__( 'Importer', 'tour-operator' ), esc_html__( 'Importer', 'tour-operator' ), 'manage_options', 'lsx-wetu-importer', array( $this, 'display_page' ) );
410
+		add_submenu_page('tour-operator', esc_html__('Importer', 'tour-operator'), esc_html__('Importer', 'tour-operator'), 'manage_options', 'lsx-wetu-importer', array($this, 'display_page'));
411 411
 	}
412 412
 
413 413
 	/**
414 414
 	 * Enqueue the JS needed to contact wetu and return your result.
415 415
 	 */
416 416
 	public function admin_scripts() {
417
-		if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
417
+		if (defined('WP_DEBUG') && true === WP_DEBUG) {
418 418
 			$min = '';
419
-		} else {
419
+		}else {
420 420
 			$min = '.min';
421 421
 		}
422 422
 
423 423
 		$min = '';
424 424
 
425
-		if ( is_admin() && isset( $_GET['page'] ) && $this->plugin_slug === $_GET['page'] ) {
425
+		if (is_admin() && isset($_GET['page']) && $this->plugin_slug === $_GET['page']) {
426 426
 
427
-			wp_enqueue_style( 'lsx-wetu-importer-style', LSX_WETU_IMPORTER_URL . 'assets/css/lsx-wetu-importer.css', LSX_WETU_IMPORTER_VER, true );
428
-			wp_enqueue_script( 'lsx-wetu-importers-script', LSX_WETU_IMPORTER_URL . 'assets/js/lsx-wetu-importer' . $min . '.js', array( 'jquery' ), LSX_WETU_IMPORTER_VER, true );
427
+			wp_enqueue_style('lsx-wetu-importer-style', LSX_WETU_IMPORTER_URL.'assets/css/lsx-wetu-importer.css', LSX_WETU_IMPORTER_VER, true);
428
+			wp_enqueue_script('lsx-wetu-importers-script', LSX_WETU_IMPORTER_URL.'assets/js/lsx-wetu-importer'.$min.'.js', array('jquery'), LSX_WETU_IMPORTER_VER, true);
429 429
 
430 430
 			wp_localize_script(
431 431
 				'lsx-wetu-importers-script',
432 432
 				'lsx_tour_importer_params',
433 433
 				array(
434
-					'ajax_url' => admin_url( 'admin-ajax.php' ),
435
-					'ajax_nonce' => wp_create_nonce( 'lsx_wetu_ajax_action' ),
434
+					'ajax_url' => admin_url('admin-ajax.php'),
435
+					'ajax_nonce' => wp_create_nonce('lsx_wetu_ajax_action'),
436 436
 				)
437 437
 			);
438 438
 		}
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 		?>
446 446
 		<div class="wrap">
447 447
 			<?php
448
-			$this->navigation( $this->tab_slug );
449
-			if ( 'default' !== $this->tab_slug && 'settings' !== $this->tab_slug ) {
448
+			$this->navigation($this->tab_slug);
449
+			if ('default' !== $this->tab_slug && 'settings' !== $this->tab_slug) {
450 450
 				$this->wetu_status();
451 451
 				$this->post_status_navigation();
452 452
 			}
@@ -464,15 +464,15 @@  discard block
 block discarded – undo
464 464
 	public function post_status_navigation() {
465 465
 		?>
466 466
 		<ul class="subsubsub">
467
-			<li class="searchform"><a class="current" href="#search"><?php esc_attr_e( 'Search', 'lsx-wetu-importer' ); ?></a> | </li>
468
-			<li class="publish"><a href="#publish"><?php esc_attr_e( 'Published', 'lsx-wetu-importer' ); ?> <span class="count"> (<?php echo esc_attr( \lsx_wetu_importer\includes\helpers\get_post_count( $this->tab_slug, 'publish ' ) ); ?>)</span></a> | </li>
469
-			<li class="pending"><a href="#pending"><?php esc_attr_e( 'Pending', 'lsx-wetu-importer' ); ?> <span class="count"> (<?php echo esc_attr( \lsx_wetu_importer\includes\helpers\get_post_count( $this->tab_slug, 'pending ' ) ); ?>)</span></a>| </li> 
470
-			<li class="draft"><a href="#draft"><?php esc_attr_e( 'Draft', 'lsx-wetu-importer' ); ?></a> <span class="count"> (<?php echo esc_attr( \lsx_wetu_importer\includes\helpers\get_post_count( $this->tab_slug, 'draft ' ) ); ?>)</span></li>
471
-
472
-			<?php if ( 'tour' === $this->tab_slug ) { ?>
473
-				<li class="import"> | <a class="import search-toggle"  href="#import"><?php esc_attr_e( 'WETU', 'lsx-wetu-importer' ); ?> <span class="count"> (<?php echo esc_attr( \lsx_wetu_importer\includes\helpers\get_wetu_tour_count() ); ?>)</span></a></li>
474
-			<?php } else if ( ! empty( $this->queued_imports ) ) { ?>
475
-				<li class="import"> | <a class="import search-toggle"  href="#import"><?php esc_attr_e( 'WETU Queue', 'lsx-wetu-importer' ); ?> <span class="count"> (<?php echo esc_attr( \lsx_wetu_importer\includes\helpers\get_wetu_queue_count( $this->tab_slug ) ); ?>)</span></a></li>
467
+			<li class="searchform"><a class="current" href="#search"><?php esc_attr_e('Search', 'lsx-wetu-importer'); ?></a> | </li>
468
+			<li class="publish"><a href="#publish"><?php esc_attr_e('Published', 'lsx-wetu-importer'); ?> <span class="count"> (<?php echo esc_attr(\lsx_wetu_importer\includes\helpers\get_post_count($this->tab_slug, 'publish ')); ?>)</span></a> | </li>
469
+			<li class="pending"><a href="#pending"><?php esc_attr_e('Pending', 'lsx-wetu-importer'); ?> <span class="count"> (<?php echo esc_attr(\lsx_wetu_importer\includes\helpers\get_post_count($this->tab_slug, 'pending ')); ?>)</span></a>| </li> 
470
+			<li class="draft"><a href="#draft"><?php esc_attr_e('Draft', 'lsx-wetu-importer'); ?></a> <span class="count"> (<?php echo esc_attr(\lsx_wetu_importer\includes\helpers\get_post_count($this->tab_slug, 'draft ')); ?>)</span></li>
471
+
472
+			<?php if ('tour' === $this->tab_slug) { ?>
473
+				<li class="import"> | <a class="import search-toggle"  href="#import"><?php esc_attr_e('WETU', 'lsx-wetu-importer'); ?> <span class="count"> (<?php echo esc_attr(\lsx_wetu_importer\includes\helpers\get_wetu_tour_count()); ?>)</span></a></li>
474
+			<?php }else if (!empty($this->queued_imports)) { ?>
475
+				<li class="import"> | <a class="import search-toggle"  href="#import"><?php esc_attr_e('WETU Queue', 'lsx-wetu-importer'); ?> <span class="count"> (<?php echo esc_attr(\lsx_wetu_importer\includes\helpers\get_wetu_queue_count($this->tab_slug)); ?>)</span></a></li>
476 476
 			<?php } ?>
477 477
 		</ul>
478 478
 		<?php
@@ -483,29 +483,29 @@  discard block
 block discarded – undo
483 483
 	 */
484 484
 	public function search_form() {
485 485
 		?>
486
-		<form class="ajax-form" id="<?php echo esc_attr( $this->plugin_slug ); ?>-search-form" method="get" action="tools.php" data-type="<?php echo esc_attr( $this->tab_slug ); ?>">
487
-			<input type="hidden" name="page" value="<?php echo esc_attr( $this->tab_slug ); ?>" />
486
+		<form class="ajax-form" id="<?php echo esc_attr($this->plugin_slug); ?>-search-form" method="get" action="tools.php" data-type="<?php echo esc_attr($this->tab_slug); ?>">
487
+			<input type="hidden" name="page" value="<?php echo esc_attr($this->tab_slug); ?>" />
488 488
 
489
-			<?php do_action( 'lsx_wetu_importer_search_form',$this ); ?>
489
+			<?php do_action('lsx_wetu_importer_search_form', $this); ?>
490 490
 
491 491
 			<div class="normal-search">
492
-				<input pattern=".{3,}" placeholder="3 characters minimum" class="keyword" name="keyword" value=""> <input class="button button-primary submit" type="submit" value="<?php esc_html_e( 'Search', 'lsx-wetu-importer' ); ?>" />
492
+				<input pattern=".{3,}" placeholder="3 characters minimum" class="keyword" name="keyword" value=""> <input class="button button-primary submit" type="submit" value="<?php esc_html_e('Search', 'lsx-wetu-importer'); ?>" />
493 493
 			</div>
494 494
 
495 495
 			<div class="advanced-search hidden" style="display:none;">
496 496
 				<textarea rows="10" cols="40" name="bulk-keywords"></textarea>
497
-				<input class="button button-primary submit" type="submit" value="<?php esc_attr_e( 'Search', 'lsx-wetu-importer' ); ?>" />
497
+				<input class="button button-primary submit" type="submit" value="<?php esc_attr_e('Search', 'lsx-wetu-importer'); ?>" />
498 498
 			</div>
499 499
 
500 500
 			<div class="ajax-loader" style="display:none;width:100%;text-align:center;">
501
-				<img style="width:64px;" src="<?php echo esc_url( LSX_WETU_IMPORTER_URL . 'assets/images/ajaxloader.gif' ); ?>" />
501
+				<img style="width:64px;" src="<?php echo esc_url(LSX_WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'); ?>" />
502 502
 			</div>
503 503
 
504 504
 			<div class="ajax-loader-small" style="display:none;width:100%;text-align:center;">
505
-				<img style="width:32px;" src="<?php echo esc_url( LSX_WETU_IMPORTER_URL . 'assets/images/ajaxloader.gif' ); ?>" />
505
+				<img style="width:32px;" src="<?php echo esc_url(LSX_WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'); ?>" />
506 506
 			</div>
507 507
 
508
-			<a class="button advanced-search-toggle" href="#"><?php esc_html_e( 'Bulk Search', 'lsx-wetu-importer' ); ?></a>
508
+			<a class="button advanced-search-toggle" href="#"><?php esc_html_e('Bulk Search', 'lsx-wetu-importer'); ?></a>
509 509
 		</form>
510 510
 		<?php
511 511
 	}
@@ -553,43 +553,43 @@  discard block
 block discarded – undo
553 553
 	 *
554 554
 	 * @param $tab string
555 555
 	 */
556
-	public function navigation( $tab = '' ) {
556
+	public function navigation($tab = '') {
557 557
 		$post_types = array(
558
-			'tour'          => esc_attr( 'Tours', 'lsx-wetu-importer' ),
559
-			'accommodation' => esc_attr( 'Accommodation', 'lsx-wetu-importer' ),
560
-			'destination'   => esc_attr( 'Destinations', 'lsx-wetu-importer' ),
558
+			'tour'          => esc_attr('Tours', 'lsx-wetu-importer'),
559
+			'accommodation' => esc_attr('Accommodation', 'lsx-wetu-importer'),
560
+			'destination'   => esc_attr('Destinations', 'lsx-wetu-importer'),
561 561
 		);
562 562
 
563
-		echo wp_kses_post( '<div class="wp-filter">' );
564
-		echo wp_kses_post( '<ul class="filter-links">' );
565
-		echo wp_kses_post( '<li><a class="' . $this->itemd( $tab, 'default', 'current', false ) . '" href="' . admin_url( 'admin.php' ) . '?page=' . $this->plugin_slug . '">' . esc_attr__( 'Home', 'lsx-wetu-importer' ) . '</a></li>' );
563
+		echo wp_kses_post('<div class="wp-filter">');
564
+		echo wp_kses_post('<ul class="filter-links">');
565
+		echo wp_kses_post('<li><a class="'.$this->itemd($tab, 'default', 'current', false).'" href="'.admin_url('admin.php').'?page='.$this->plugin_slug.'">'.esc_attr__('Home', 'lsx-wetu-importer').'</a></li>');
566 566
 
567
-		foreach ( $post_types as $post_type => $label ) {
568
-			echo wp_kses_post( ' | <li><a class="' . $this->itemd( $tab, $post_type, 'current', false ) . '" href="' . admin_url( 'admin.php' ) . '?page=' . $this->plugin_slug . '&tab=' . $post_type . '">' . $label . '</a></li>' );
567
+		foreach ($post_types as $post_type => $label) {
568
+			echo wp_kses_post(' | <li><a class="'.$this->itemd($tab, $post_type, 'current', false).'" href="'.admin_url('admin.php').'?page='.$this->plugin_slug.'&tab='.$post_type.'">'.$label.'</a></li>');
569 569
 		}
570 570
 
571
-		echo wp_kses_post( ' | <li><a class="' . $this->itemd( $tab, 'settings', 'current', false ) . '" href="' . admin_url( 'admin.php' ) . '?page=' . $this->plugin_slug . '&tab=settings">' . esc_attr__( 'Settings', 'lsx-wetu-importer' ) . '</a></li>' );
572
-		echo wp_kses_post( '</ul> </div>' );
571
+		echo wp_kses_post(' | <li><a class="'.$this->itemd($tab, 'settings', 'current', false).'" href="'.admin_url('admin.php').'?page='.$this->plugin_slug.'&tab=settings">'.esc_attr__('Settings', 'lsx-wetu-importer').'</a></li>');
572
+		echo wp_kses_post('</ul> </div>');
573 573
 	}
574 574
 
575 575
 	/**
576 576
 	 * Wetu Status Bar.
577 577
 	 */
578 578
 	public function wetu_status() {
579
-		$tours = get_transient( 'lsx_ti_tours' );
580
-		echo '<div class="wetu-status tour-wetu-status"><h3>' . esc_html__( 'Wetu Status','lsx-wetu-importer' ) . ' - ';
579
+		$tours = get_transient('lsx_ti_tours');
580
+		echo '<div class="wetu-status tour-wetu-status"><h3>'.esc_html__('Wetu Status', 'lsx-wetu-importer').' - ';
581 581
 
582
-		if ( '' === $tours || false === $tours || isset( $_GET['refresh_tours'] ) ) {
582
+		if ('' === $tours || false === $tours || isset($_GET['refresh_tours'])) {
583 583
 			$result = $this->update_options();
584 584
 
585
-			if ( true === $result ) {
586
-				echo '<span style="color:green;">' . esc_attr( 'Connected','lsx-wetu-importer' ) . '</span>';
587
-				echo ' - <small><a href="#">' . esc_attr( 'Refresh','lsx-wetu-importer' ) . '</a></small>';
588
-			} else {
589
-				echo '<span style="color:red;">' . wp_kses_post( $result ) . '</span>';
585
+			if (true === $result) {
586
+				echo '<span style="color:green;">'.esc_attr('Connected', 'lsx-wetu-importer').'</span>';
587
+				echo ' - <small><a href="#">'.esc_attr('Refresh', 'lsx-wetu-importer').'</a></small>';
588
+			}else {
589
+				echo '<span style="color:red;">'.wp_kses_post($result).'</span>';
590 590
 			}
591
-		} else {
592
-			echo '<span style="color:green;">' . esc_attr( 'Connected','lsx-wetu-importer' ) . '</span> - <small><a href="#">' . esc_attr( 'Refresh','lsx-wetu-importer' ) . '</a></small>';
591
+		}else {
592
+			echo '<span style="color:green;">'.esc_attr('Connected', 'lsx-wetu-importer').'</span> - <small><a href="#">'.esc_attr('Refresh', 'lsx-wetu-importer').'</a></small>';
593 593
 		}
594 594
 		echo '</h3>';
595 595
 		echo '</div>';
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
 	/**
599 599
 	 * Set_taxonomy with some terms
600 600
 	 */
601
-	public function team_member_checkboxes( $selected = array() ) {
602
-		if ( post_type_exists( 'team' ) ) { ?>
601
+	public function team_member_checkboxes($selected = array()) {
602
+		if (post_type_exists('team')) { ?>
603 603
 			<ul>
604 604
 				<?php
605 605
 					$team_args = array(
@@ -609,16 +609,16 @@  discard block
 block discarded – undo
609 609
 						'fields' => 'ids',
610 610
 					);
611 611
 
612
-					$team_members = new WP_Query( $team_args );
612
+					$team_members = new WP_Query($team_args);
613 613
 
614
-					if ( $team_members->have_posts() ) {
615
-						foreach ( $team_members->posts as $member ) {
614
+					if ($team_members->have_posts()) {
615
+						foreach ($team_members->posts as $member) {
616 616
 							?>
617
-							<li><input class="team" <?php $this->checked( $selected, $member ); ?> type="checkbox" value="<?php echo $member; ?>" /> <?php echo get_the_title( $member ); ?></li>
617
+							<li><input class="team" <?php $this->checked($selected, $member); ?> type="checkbox" value="<?php echo $member; ?>" /> <?php echo get_the_title($member); ?></li>
618 618
 							<?php
619 619
 						}
620
-					} else { ?>
621
-						<li><input class="team" type="checkbox" value="0" /> <?php esc_html_e( 'None', 'lsx-wetu-importer' ); ?></li>
620
+					}else { ?>
621
+						<li><input class="team" type="checkbox" value="0" /> <?php esc_html_e('None', 'lsx-wetu-importer'); ?></li>
622 622
 					<?php }
623 623
 				?>
624 624
 			</ul>
@@ -635,13 +635,13 @@  discard block
 block discarded – undo
635 635
 	 * @param $needle string
636 636
 	 * @param $echo bool
637 637
 	 */
638
-	public function checked( $haystack = false, $needle = '', $echo = true ) {
639
-		$return = $this->itemd( $haystack,$needle, 'checked' );
638
+	public function checked($haystack = false, $needle = '', $echo = true) {
639
+		$return = $this->itemd($haystack, $needle, 'checked');
640 640
 
641
-		if ( '' !== $return ) {
642
-			if ( true === $echo ) {
643
-				echo wp_kses_post( $return );
644
-			} else {
641
+		if ('' !== $return) {
642
+			if (true === $echo) {
643
+				echo wp_kses_post($return);
644
+			}else {
645 645
 				return $return;
646 646
 			}
647 647
 		}
@@ -654,13 +654,13 @@  discard block
 block discarded – undo
654 654
 	 * @param $needle string
655 655
 	 * @param $echo bool
656 656
 	 */
657
-	public function selected( $haystack = false, $needle = '', $echo = true ) {
658
-		$return = $this->itemd( $haystack, $needle, 'selected' );
657
+	public function selected($haystack = false, $needle = '', $echo = true) {
658
+		$return = $this->itemd($haystack, $needle, 'selected');
659 659
 
660
-		if ( '' !== $return ) {
661
-			if ( true === $echo ) {
662
-				echo wp_kses_post( $return );
663
-			} else {
660
+		if ('' !== $return) {
661
+			if (true === $echo) {
662
+				echo wp_kses_post($return);
663
+			}else {
664 664
 				return $return;
665 665
 			}
666 666
 		}
@@ -675,17 +675,17 @@  discard block
 block discarded – undo
675 675
 	 * @param $wrap bool
676 676
 	 * @return $html string
677 677
 	 */
678
-	public function itemd( $haystack = false, $needle = '', $type = '', $wrap = true ) {
678
+	public function itemd($haystack = false, $needle = '', $type = '', $wrap = true) {
679 679
 		$html = '';
680 680
 
681
-		if ( '' !== $type ) {
682
-			if ( ! is_array( $haystack ) ) {
683
-				$haystack = array( $haystack );
681
+		if ('' !== $type) {
682
+			if (!is_array($haystack)) {
683
+				$haystack = array($haystack);
684 684
 			}
685
-			if ( in_array( $needle, $haystack ) ) {
686
-				if ( true === $wrap || 'true' === $wrap ) {
687
-					$html = $type . '="' . $type . '"';
688
-				} else {
685
+			if (in_array($needle, $haystack)) {
686
+				if (true === $wrap || 'true' === $wrap) {
687
+					$html = $type.'="'.$type.'"';
688
+				}else {
689 689
 					$html = $type;
690 690
 				}
691 691
 			}
@@ -697,9 +697,9 @@  discard block
 block discarded – undo
697 697
 	/**
698 698
 	 * Grabs any attachments for the current item
699 699
 	 */
700
-	public function find_attachments( $id = false ) {
701
-		if ( false !== $id ) {
702
-			if ( empty( $this->found_attachments ) ) {
700
+	public function find_attachments($id = false) {
701
+		if (false !== $id) {
702
+			if (empty($this->found_attachments)) {
703 703
 				$attachments_args = array(
704 704
 					'post_parent' => $id,
705 705
 					'post_status' => 'inherit',
@@ -709,11 +709,11 @@  discard block
 block discarded – undo
709 709
 					'posts_per_page' => '-1',
710 710
 				);
711 711
 
712
-				$attachments = new WP_Query( $attachments_args );
712
+				$attachments = new WP_Query($attachments_args);
713 713
 
714
-				if ( $attachments->have_posts() ) {
715
-					foreach ( $attachments->posts as $attachment ) {
716
-						$this->found_attachments[ $attachment->ID ] = str_replace( array( '.jpg', '.png', '.jpeg' ), '', $attachment->post_title );
714
+				if ($attachments->have_posts()) {
715
+					foreach ($attachments->posts as $attachment) {
716
+						$this->found_attachments[$attachment->ID] = str_replace(array('.jpg', '.png', '.jpeg'), '', $attachment->post_title);
717 717
 					}
718 718
 				}
719 719
 			}
@@ -725,19 +725,19 @@  discard block
 block discarded – undo
725 725
 	/**
726 726
 	 * Saves the room data
727 727
 	 */
728
-	public function save_custom_field( $value = false, $meta_key, $id, $decrease = false, $unique = true ) {
729
-		if ( false !== $value ) {
730
-			if ( false !== $decrease ) {
731
-				$value = intval( $value );
728
+	public function save_custom_field($value = false, $meta_key, $id, $decrease = false, $unique = true) {
729
+		if (false !== $value) {
730
+			if (false !== $decrease) {
731
+				$value = intval($value);
732 732
 				$value--;
733 733
 			}
734 734
 
735
-			$prev = get_post_meta( $id, $meta_key, true );
735
+			$prev = get_post_meta($id, $meta_key, true);
736 736
 
737
-			if ( false !== $id && '0' !== $id && false !== $prev && true === $unique ) {
738
-				update_post_meta( $id, $meta_key, $value, $prev );
739
-			} else {
740
-				add_post_meta( $id, $meta_key, $value, $unique );
737
+			if (false !== $id && '0' !== $id && false !== $prev && true === $unique) {
738
+				update_post_meta($id, $meta_key, $value, $prev);
739
+			}else {
740
+				add_post_meta($id, $meta_key, $value, $unique);
741 741
 			}
742 742
 		}
743 743
 	}
@@ -746,15 +746,15 @@  discard block
 block discarded – undo
746 746
 	 * Grabs the custom fields,  and resaves an array of unique items.
747 747
 	 */
748 748
 	public function cleanup_posts() {
749
-		if ( ! empty( $this->cleanup_posts ) ) {
749
+		if (!empty($this->cleanup_posts)) {
750 750
 
751
-			foreach ( $this->cleanup_posts as $id => $key ) {
752
-				$prev_items = get_post_meta( $id, $key, false );
753
-				$new_items = array_unique( $prev_items );
754
-				delete_post_meta( $id, $key );
751
+			foreach ($this->cleanup_posts as $id => $key) {
752
+				$prev_items = get_post_meta($id, $key, false);
753
+				$new_items = array_unique($prev_items);
754
+				delete_post_meta($id, $key);
755 755
 
756
-				foreach ( $new_items as $new_item ) {
757
-					add_post_meta( $id, $key, $new_item, false );
756
+				foreach ($new_items as $new_item) {
757
+					add_post_meta($id, $key, $new_item, false);
758 758
 				}
759 759
 			}
760 760
 		}
@@ -765,26 +765,26 @@  discard block
 block discarded – undo
765 765
 	/**
766 766
 	 * Set_taxonomy with some terms
767 767
 	 */
768
-	public function set_taxonomy( $taxonomy, $terms, $id ) {
768
+	public function set_taxonomy($taxonomy, $terms, $id) {
769 769
 		$result = array();
770 770
 
771
-		if ( ! empty( $data ) ) {
772
-			foreach ( $data as $k ) {
773
-				if ( $id ) {
774
-					$term = term_exists( trim( $k ), $tax );
775
-					if ( ! $term ) {
776
-						$term = wp_insert_term( trim( $k ), $tax );
777
-
778
-						if ( is_wp_error( $term ) ) {
779
-							echo wp_kses_post( $term->get_error_message() );
780
-						} else {
781
-							wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
771
+		if (!empty($data)) {
772
+			foreach ($data as $k) {
773
+				if ($id) {
774
+					$term = term_exists(trim($k), $tax);
775
+					if (!$term) {
776
+						$term = wp_insert_term(trim($k), $tax);
777
+
778
+						if (is_wp_error($term)) {
779
+							echo wp_kses_post($term->get_error_message());
780
+						}else {
781
+							wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
782 782
 						}
783
-					} else {
784
-						wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
783
+					}else {
784
+						wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
785 785
 					}
786
-				} else {
787
-					$result[] = trim( $k );
786
+				}else {
787
+					$result[] = trim($k);
788 788
 				}
789 789
 			}
790 790
 		}
@@ -800,23 +800,23 @@  discard block
 block discarded – undo
800 800
 	 * @param boolean $parent
801 801
 	 * @return void
802 802
 	 */
803
-	public function set_term( $id = false, $name = false, $taxonomy = false, $parent = false ) {
804
-		$term = term_exists( $name, $taxonomy );
805
-		if ( ! $term ) {
806
-			if ( false !== $parent ) {
803
+	public function set_term($id = false, $name = false, $taxonomy = false, $parent = false) {
804
+		$term = term_exists($name, $taxonomy);
805
+		if (!$term) {
806
+			if (false !== $parent) {
807 807
 				$parent = array(
808 808
 					'parent' => $parent,
809 809
 				);
810 810
 			}
811
-			$term = wp_insert_term( trim( $name ), $taxonomy,$parent );
811
+			$term = wp_insert_term(trim($name), $taxonomy, $parent);
812 812
 
813
-			if ( is_wp_error( $term ) ) {
814
-				echo wp_kses_post( $term->get_error_message() );
815
-			} else {
816
-				wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
813
+			if (is_wp_error($term)) {
814
+				echo wp_kses_post($term->get_error_message());
815
+			}else {
816
+				wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
817 817
 			}
818
-		} else {
819
-			wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
818
+		}else {
819
+			wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
820 820
 		}
821 821
 
822 822
 		return $term['term_id'];
@@ -825,22 +825,22 @@  discard block
 block discarded – undo
825 825
 	/**
826 826
 	 * set_taxonomy with some terms
827 827
 	 */
828
-	public function taxonomy_checkboxes( $taxonomy = false, $selected = array() ) {
828
+	public function taxonomy_checkboxes($taxonomy = false, $selected = array()) {
829 829
 		$return = '';
830 830
 
831
-		if ( false !== $taxonomy ) {
831
+		if (false !== $taxonomy) {
832 832
 			$return .= '<ul>';
833
-			$terms = get_terms( array(
833
+			$terms = get_terms(array(
834 834
 				'taxonomy' => $taxonomy,
835 835
 				'hide_empty' => false,
836
-			) );
836
+			));
837 837
 
838
-			if ( ! is_wp_error( $terms ) ) {
839
-				foreach ( $terms as $term ) {
840
-					$return .= '<li><input class="' . $taxonomy . '" ' . $this->checked( $selected,$term->term_id,false ) . ' type="checkbox" value="' . $term->term_id . '" /> ' . $term->name . '</li>';
838
+			if (!is_wp_error($terms)) {
839
+				foreach ($terms as $term) {
840
+					$return .= '<li><input class="'.$taxonomy.'" '.$this->checked($selected, $term->term_id, false).' type="checkbox" value="'.$term->term_id.'" /> '.$term->name.'</li>';
841 841
 				}
842
-			} else {
843
-				$return .= '<li><input type="checkbox" value="" /> ' . __( 'None', 'lsx-wetu-importer' ) . '</li>';
842
+			}else {
843
+				$return .= '<li><input type="checkbox" value="" /> '.__('None', 'lsx-wetu-importer').'</li>';
844 844
 			}
845 845
 
846 846
 			$return .= '</ul>';
@@ -854,44 +854,44 @@  discard block
 block discarded – undo
854 854
 	/**
855 855
 	 * Saves the longitude and lattitude, as well as sets the map marker.
856 856
 	 */
857
-	public function set_map_data( $data, $id, $zoom = '10' ) {
857
+	public function set_map_data($data, $id, $zoom = '10') {
858 858
 		$longitude = false;
859 859
 		$latitude = false;
860 860
 		$address = false;
861 861
 
862
-		if ( isset( $data[0]['position'] ) ) {
863
-			if ( isset( $data[0]['position']['driving_latitude'] ) ) {
862
+		if (isset($data[0]['position'])) {
863
+			if (isset($data[0]['position']['driving_latitude'])) {
864 864
 				$latitude = $data[0]['position']['driving_latitude'];
865
-			} elseif ( isset( $data[0]['position']['latitude'] ) ) {
865
+			} elseif (isset($data[0]['position']['latitude'])) {
866 866
 				$latitude = $data[0]['position']['latitude'];
867 867
 			}
868 868
 
869
-			if ( isset( $data[0]['position']['driving_longitude'] ) ) {
869
+			if (isset($data[0]['position']['driving_longitude'])) {
870 870
 				$longitude = $data[0]['position']['driving_longitude'];
871
-			} elseif ( isset( $data[0]['position']['longitude'] ) ) {
871
+			} elseif (isset($data[0]['position']['longitude'])) {
872 872
 				$longitude = $data[0]['position']['longitude'];
873 873
 			}
874 874
 		}
875 875
 
876
-		if ( isset( $data[0]['content'] ) && isset( $data[0]['content']['contact_information'] ) ) {
877
-			if ( isset( $data[0]['content']['contact_information']['address'] ) ) {
878
-				$address = strip_tags( $data[0]['content']['contact_information']['address'] );
879
-				$address = explode( "\n", $address );
876
+		if (isset($data[0]['content']) && isset($data[0]['content']['contact_information'])) {
877
+			if (isset($data[0]['content']['contact_information']['address'])) {
878
+				$address = strip_tags($data[0]['content']['contact_information']['address']);
879
+				$address = explode("\n", $address);
880 880
 
881
-				foreach ( $address as $bitkey => $bit ) {
882
-					$bit = ltrim( rtrim( $bit ) );
881
+				foreach ($address as $bitkey => $bit) {
882
+					$bit = ltrim(rtrim($bit));
883 883
 
884
-					if ( false === $bit || '' === $bit || null === $bit || empty( $bit ) ) {
885
-						unset( $address[ $bitkey ] );
884
+					if (false === $bit || '' === $bit || null === $bit || empty($bit)) {
885
+						unset($address[$bitkey]);
886 886
 					}
887 887
 				}
888 888
 
889
-				$address = implode( ', ',$address );
890
-				$address = str_replace( ', , ', ', ', $address );
889
+				$address = implode(', ', $address);
890
+				$address = str_replace(', , ', ', ', $address);
891 891
 			}
892 892
 		}
893 893
 
894
-		if ( false !== $longitude ) {
894
+		if (false !== $longitude) {
895 895
 			$location_data = array(
896 896
 				'address'	=> (string) $address,
897 897
 				'lat'		=> (string) $latitude,
@@ -900,11 +900,11 @@  discard block
 block discarded – undo
900 900
 				'elevation'	=> '',
901 901
 			);
902 902
 
903
-			if ( false !== $id && '0' !== $id ) {
904
-				$prev = get_post_meta( $id,'location',true );
905
-				update_post_meta( $id,'location',$location_data,$prev );
906
-			} else {
907
-				add_post_meta( $id,'location',$location_data,true );
903
+			if (false !== $id && '0' !== $id) {
904
+				$prev = get_post_meta($id, 'location', true);
905
+				update_post_meta($id, 'location', $location_data, $prev);
906
+			}else {
907
+				add_post_meta($id, 'location', $location_data, true);
908 908
 			}
909 909
 		}
910 910
 	}
@@ -914,17 +914,17 @@  discard block
 block discarded – undo
914 914
 	/**
915 915
 	 * Creates the main gallery data
916 916
 	 */
917
-	public function set_featured_image( $data, $id ) {
918
-		if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
919
-			$this->featured_image = $this->attach_image( $data[0]['content']['images'][0], $id,  array(
917
+	public function set_featured_image($data, $id) {
918
+		if (is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])) {
919
+			$this->featured_image = $this->attach_image($data[0]['content']['images'][0], $id, array(
920 920
 				'width' => '800',
921 921
 				'height' => '600',
922 922
 				'cropping' => 'h',
923
-			) );
923
+			));
924 924
 
925
-			if ( false !== $this->featured_image ) {
926
-				delete_post_meta( $id,'_thumbnail_id' );
927
-				add_post_meta( $id,'_thumbnail_id',$this->featured_image,true );
925
+			if (false !== $this->featured_image) {
926
+				delete_post_meta($id, '_thumbnail_id');
927
+				add_post_meta($id, '_thumbnail_id', $this->featured_image, true);
928 928
 			}
929 929
 		}
930 930
 	}
@@ -932,26 +932,26 @@  discard block
 block discarded – undo
932 932
 	/**
933 933
 	 * Sets a banner image
934 934
 	 */
935
-	public function set_banner_image( $data, $id, $content = array( 'none' ) ) {
936
-		if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
937
-			if ( in_array( 'unique_banner_image', $content ) && isset( $data[0]['destination_image'] ) && is_array( $data[0]['destination_image'] ) ) {
938
-				$temp_banner = $this->attach_image( $data[0]['destination_image'], $id, array(
935
+	public function set_banner_image($data, $id, $content = array('none')) {
936
+		if (is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])) {
937
+			if (in_array('unique_banner_image', $content) && isset($data[0]['destination_image']) && is_array($data[0]['destination_image'])) {
938
+				$temp_banner = $this->attach_image($data[0]['destination_image'], $id, array(
939 939
 					'width' => '1920',
940 940
 					'height' => '600',
941 941
 					'cropping' => 'c',
942 942
 				));
943
-			} else {
944
-				$temp_banner = $this->attach_image( $data[0]['content']['images'][1], $id, array(
943
+			}else {
944
+				$temp_banner = $this->attach_image($data[0]['content']['images'][1], $id, array(
945 945
 					'width' => '1920',
946 946
 					'height' => '600',
947 947
 					'cropping' => 'c',
948 948
 				));
949 949
 			}
950 950
 
951
-			if ( false !== $temp_banner ) {
951
+			if (false !== $temp_banner) {
952 952
 				$this->banner_image = $temp_banner;
953 953
 
954
-				delete_post_meta( $id,'image_group' );
954
+				delete_post_meta($id, 'image_group');
955 955
 
956 956
 				$new_banner = array(
957 957
 					'banner_image' => array(
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 					),
960 960
 				);
961 961
 
962
-				add_post_meta( $id,'image_group',$new_banner,true );
962
+				add_post_meta($id, 'image_group', $new_banner, true);
963 963
 			}
964 964
 		}
965 965
 	}
@@ -967,17 +967,17 @@  discard block
 block discarded – undo
967 967
 	/**
968 968
 	 * Creates the main gallery data
969 969
 	 */
970
-	public function create_main_gallery( $data, $id ) {
971
-		if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
972
-			if ( isset( $this->options['image_replacing'] ) && 'on' === $this->options['image_replacing'] ) {
973
-				$current_gallery = get_post_meta( $id, 'gallery', false );
970
+	public function create_main_gallery($data, $id) {
971
+		if (is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])) {
972
+			if (isset($this->options['image_replacing']) && 'on' === $this->options['image_replacing']) {
973
+				$current_gallery = get_post_meta($id, 'gallery', false);
974 974
 
975
-				if ( false !== $current_gallery && ! empty( $current_gallery ) ) {
976
-					foreach ( $current_gallery as $g ) {
977
-						delete_post_meta( $id,'gallery', $g );
975
+				if (false !== $current_gallery && !empty($current_gallery)) {
976
+					foreach ($current_gallery as $g) {
977
+						delete_post_meta($id, 'gallery', $g);
978 978
 
979
-						if ( 'attachment' === get_post_type( $g ) ) {
980
-							wp_delete_attachment( $g, true );
979
+						if ('attachment' === get_post_type($g)) {
980
+							wp_delete_attachment($g, true);
981 981
 						}
982 982
 					}
983 983
 				}
@@ -985,32 +985,32 @@  discard block
 block discarded – undo
985 985
 
986 986
 			$counter = 0;
987 987
 
988
-			foreach ( $data[0]['content']['images'] as $image_data ) {
989
-				if ( ( 0 === $counter && false !== $this->featured_image ) || ( 1 === $counter && false !== $this->banner_image ) ) {
988
+			foreach ($data[0]['content']['images'] as $image_data) {
989
+				if ((0 === $counter && false !== $this->featured_image) || (1 === $counter && false !== $this->banner_image)) {
990 990
 					$counter++;
991 991
 
992
-					if ( false !== $this->image_limit && false !== $this->image_limit ) {
992
+					if (false !== $this->image_limit && false !== $this->image_limit) {
993 993
 						$this->image_limit++;
994 994
 					}
995 995
 
996 996
 					continue;
997 997
 				}
998 998
 
999
-				if ( false !== $this->image_limit && $counter >= $this->image_limit ) {
999
+				if (false !== $this->image_limit && $counter >= $this->image_limit) {
1000 1000
 					continue;
1001 1001
 				}
1002 1002
 
1003
-				$this->gallery_meta[] = $this->attach_image( $image_data,$id );
1003
+				$this->gallery_meta[] = $this->attach_image($image_data, $id);
1004 1004
 				$counter++;
1005 1005
 			}
1006 1006
 
1007
-			if ( ! empty( $this->gallery_meta ) ) {
1008
-				delete_post_meta( $id,'gallery' );
1009
-				$this->gallery_meta = array_unique( $this->gallery_meta );
1007
+			if (!empty($this->gallery_meta)) {
1008
+				delete_post_meta($id, 'gallery');
1009
+				$this->gallery_meta = array_unique($this->gallery_meta);
1010 1010
 
1011
-				foreach ( $this->gallery_meta as $gallery_id ) {
1012
-					if ( false !== $gallery_id && '' !== $gallery_id && ! is_array( $gallery_id ) ) {
1013
-						add_post_meta( $id,'gallery',$gallery_id,false );
1011
+				foreach ($this->gallery_meta as $gallery_id) {
1012
+					if (false !== $gallery_id && '' !== $gallery_id && !is_array($gallery_id)) {
1013
+						add_post_meta($id, 'gallery', $gallery_id, false);
1014 1014
 					}
1015 1015
 				}
1016 1016
 			}
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 	/**
1021 1021
 	 * search_form
1022 1022
 	 */
1023
-	public function get_scaling_url( $args = array() ) {
1023
+	public function get_scaling_url($args = array()) {
1024 1024
 		$defaults = array(
1025 1025
 			'width' => '1024',
1026 1026
 			'height' => '768',
@@ -1028,59 +1028,59 @@  discard block
 block discarded – undo
1028 1028
 			'cropping' => 'h',
1029 1029
 		);
1030 1030
 
1031
-		if ( false !== $this->options ) {
1032
-			if ( isset( $this->options['width'] ) && '' !== $this->options['width'] ) {
1031
+		if (false !== $this->options) {
1032
+			if (isset($this->options['width']) && '' !== $this->options['width']) {
1033 1033
 				$defaults['width'] = $this->options['width'];
1034 1034
 			}
1035 1035
 
1036
-			if ( isset( $this->options['height'] ) && '' !== $this->options['height'] ) {
1036
+			if (isset($this->options['height']) && '' !== $this->options['height']) {
1037 1037
 				$defaults['height'] = $this->options['height'];
1038 1038
 			}
1039 1039
 
1040
-			if ( isset( $this->options['cropping'] ) && '' !== $this->options['cropping'] ) {
1040
+			if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
1041 1041
 				$defaults['cropping'] = $this->options['cropping'];
1042 1042
 			}
1043 1043
 		}
1044 1044
 
1045
-		$args = wp_parse_args( $args, $defaults );
1045
+		$args = wp_parse_args($args, $defaults);
1046 1046
 		$cropping = $args['cropping'];
1047 1047
 		$width = $args['width'];
1048 1048
 		$height = $args['height'];
1049 1049
 
1050
-		return 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
1050
+		return 'https://wetu.com/ImageHandler/'.$cropping.$width.'x'.$height.'/';
1051 1051
 	}
1052 1052
 
1053 1053
 	/**
1054 1054
 	 * Attaches 1 image
1055 1055
 	 */
1056
-	public function attach_image( $v = false, $parent_id, $image_sizes = false, $banner = false ) {
1057
-		if ( false !== $v ) {
1058
-			$temp_fragment = explode( '/',$v['url_fragment'] );
1059
-			$url_filename = $temp_fragment[ count( $temp_fragment ) -1 ];
1060
-			$url_filename = str_replace( array( '.jpg', '.png', '.jpeg' ),'',$url_filename );
1061
-			$url_filename = trim( $url_filename );
1056
+	public function attach_image($v = false, $parent_id, $image_sizes = false, $banner = false) {
1057
+		if (false !== $v) {
1058
+			$temp_fragment = explode('/', $v['url_fragment']);
1059
+			$url_filename = $temp_fragment[count($temp_fragment) - 1];
1060
+			$url_filename = str_replace(array('.jpg', '.png', '.jpeg'), '', $url_filename);
1061
+			$url_filename = trim($url_filename);
1062 1062
 			$title = $url_filename;
1063
-			$url_filename = str_replace( ' ','_',$url_filename );
1063
+			$url_filename = str_replace(' ', '_', $url_filename);
1064 1064
 
1065
-			if ( ! isset( $this->options['image_replacing'] ) && in_array( $url_filename, $this->found_attachments ) ) {
1066
-				return array_search( $url_filename,$this->found_attachments );
1065
+			if (!isset($this->options['image_replacing']) && in_array($url_filename, $this->found_attachments)) {
1066
+				return array_search($url_filename, $this->found_attachments);
1067 1067
 			}
1068 1068
 
1069 1069
 			$postdata = array();
1070 1070
 
1071
-			if ( empty( $v['label'] ) ) {
1071
+			if (empty($v['label'])) {
1072 1072
 				$v['label'] = '';
1073 1073
 			}
1074 1074
 
1075
-			if ( ! empty( $v['description'] ) ) {
1076
-				$desc = wp_strip_all_tags( $v['description'] );
1075
+			if (!empty($v['description'])) {
1076
+				$desc = wp_strip_all_tags($v['description']);
1077 1077
 				$posdata = array(
1078 1078
 					'post_excerpt' => $desc,
1079 1079
 				);
1080 1080
 			}
1081 1081
 
1082
-			if ( ! empty( $v['section'] ) ) {
1083
-				$desc = wp_strip_all_tags( $v['section'] );
1082
+			if (!empty($v['section'])) {
1083
+				$desc = wp_strip_all_tags($v['section']);
1084 1084
 				$posdata = array(
1085 1085
 					'post_excerpt' => $desc,
1086 1086
 				);
@@ -1088,88 +1088,88 @@  discard block
 block discarded – undo
1088 1088
 
1089 1089
 			$attach_id = null;
1090 1090
 			//Resizor - add option to setting if required
1091
-			$fragment = str_replace( ' ','%20',$v['url_fragment'] );
1092
-			$url = $this->get_scaling_url( $image_sizes ) . $fragment;
1091
+			$fragment = str_replace(' ', '%20', $v['url_fragment']);
1092
+			$url = $this->get_scaling_url($image_sizes).$fragment;
1093 1093
 
1094
-			$attach_id = $this->attach_external_image2( $url,$parent_id,'',$v['label'],$postdata );
1094
+			$attach_id = $this->attach_external_image2($url, $parent_id, '', $v['label'], $postdata);
1095 1095
 
1096
-			$this->found_attachments[ $attach_id ] = $url_filename;
1096
+			$this->found_attachments[$attach_id] = $url_filename;
1097 1097
 
1098 1098
 			//echo($attach_id.' add image');
1099
-			if ( ! empty( $attach_id ) ) {
1099
+			if (!empty($attach_id)) {
1100 1100
 				return $attach_id;
1101 1101
 			}
1102 1102
 		}
1103 1103
 		return 	false;
1104 1104
 	}
1105 1105
 
1106
-	public function attach_external_image2( $url = null, $post_id = null, $thumb = null, $filename = null, $post_data = array() ) {
1107
-		if ( ! $url || ! $post_id ) { return new WP_Error( 'missing', 'Need a valid URL and post ID...' ); }
1106
+	public function attach_external_image2($url = null, $post_id = null, $thumb = null, $filename = null, $post_data = array()) {
1107
+		if (!$url || !$post_id) { return new WP_Error('missing', 'Need a valid URL and post ID...'); }
1108 1108
 
1109
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
1110
-		require_once( ABSPATH . 'wp-admin/includes/media.php' );
1111
-		require_once( ABSPATH . 'wp-admin/includes/image.php' );
1109
+		require_once(ABSPATH.'wp-admin/includes/file.php');
1110
+		require_once(ABSPATH.'wp-admin/includes/media.php');
1111
+		require_once(ABSPATH.'wp-admin/includes/image.php');
1112 1112
 		// Download file to temp location, returns full server path to temp file
1113 1113
 		//$tmp = download_url( $url );
1114 1114
 
1115 1115
 		//var_dump($tmp);
1116
-		$tmp = tempnam( '/tmp', 'FOO' );
1116
+		$tmp = tempnam('/tmp', 'FOO');
1117 1117
 
1118
-		$image = file_get_contents( $url );
1119
-		file_put_contents( $tmp, $image );
1120
-		chmod( $tmp,'777' );
1118
+		$image = file_get_contents($url);
1119
+		file_put_contents($tmp, $image);
1120
+		chmod($tmp, '777');
1121 1121
 
1122
-		preg_match( '/[^\?]+\.(tif|TIFF|jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG|pdf|PDF|bmp|BMP)/', $url, $matches );    // fix file filename for query strings
1123
-		$url_filename = basename( $matches[0] );
1124
-		$url_filename = str_replace( '%20','_',$url_filename );
1122
+		preg_match('/[^\?]+\.(tif|TIFF|jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG|pdf|PDF|bmp|BMP)/', $url, $matches); // fix file filename for query strings
1123
+		$url_filename = basename($matches[0]);
1124
+		$url_filename = str_replace('%20', '_', $url_filename);
1125 1125
 		// extract filename from url for title
1126
-		$url_type = wp_check_filetype( $url_filename );                                           // determine file type (ext and mime/type)
1126
+		$url_type = wp_check_filetype($url_filename); // determine file type (ext and mime/type)
1127 1127
 
1128 1128
 		// override filename if given, reconstruct server path
1129
-		if ( ! empty( $filename ) && ' ' != $filename ) {
1130
-			$filename = sanitize_file_name( $filename );
1131
-			$tmppath = pathinfo( $tmp );
1129
+		if (!empty($filename) && ' ' != $filename) {
1130
+			$filename = sanitize_file_name($filename);
1131
+			$tmppath = pathinfo($tmp);
1132 1132
 
1133 1133
 			$extension = '';
1134
-			if ( isset( $tmppath['extension'] ) ) {
1134
+			if (isset($tmppath['extension'])) {
1135 1135
 				$extension = $tmppath['extension'];
1136 1136
 			}
1137 1137
 
1138
-			$new = $tmppath['dirname'] . '/' . $filename . '.' . $extension;
1139
-			rename( $tmp, $new );                                                                 // renames temp file on server
1140
-			$tmp = $new;                                                                        // push new filename (in path) to be used in file array later
1138
+			$new = $tmppath['dirname'].'/'.$filename.'.'.$extension;
1139
+			rename($tmp, $new); // renames temp file on server
1140
+			$tmp = $new; // push new filename (in path) to be used in file array later
1141 1141
 		}
1142 1142
 
1143 1143
 		// assemble file data (should be built like $_FILES since wp_handle_sideload() will be using)
1144
-		$file_array['tmp_name'] = $tmp;                                                         // full server path to temp file
1144
+		$file_array['tmp_name'] = $tmp; // full server path to temp file
1145 1145
 
1146
-		if ( ! empty( $filename ) && ' ' != $filename ) {
1147
-			$file_array['name'] = $filename . '.' . $url_type['ext'];                           // user given filename for title, add original URL extension
1148
-		} else {
1149
-			$file_array['name'] = $url_filename;                                                // just use original URL filename
1146
+		if (!empty($filename) && ' ' != $filename) {
1147
+			$file_array['name'] = $filename.'.'.$url_type['ext']; // user given filename for title, add original URL extension
1148
+		}else {
1149
+			$file_array['name'] = $url_filename; // just use original URL filename
1150 1150
 		}
1151 1151
 
1152 1152
 		// set additional wp_posts columns
1153
-		if ( empty( $post_data['post_title'] ) ) {
1153
+		if (empty($post_data['post_title'])) {
1154 1154
 
1155
-			$url_filename = str_replace( '%20',' ',$url_filename );
1155
+			$url_filename = str_replace('%20', ' ', $url_filename);
1156 1156
 
1157
-			$post_data['post_title'] = basename( $url_filename, '.' . $url_type['ext'] );         // just use the original filename (no extension)
1157
+			$post_data['post_title'] = basename($url_filename, '.'.$url_type['ext']); // just use the original filename (no extension)
1158 1158
 		}
1159 1159
 
1160 1160
 		// make sure gets tied to parent
1161
-		if ( empty( $post_data['post_parent'] ) ) {
1161
+		if (empty($post_data['post_parent'])) {
1162 1162
 			$post_data['post_parent'] = $post_id;
1163 1163
 		}
1164 1164
 
1165 1165
 		// required libraries for media_handle_sideload
1166 1166
 
1167 1167
 		// do the validation and storage stuff
1168
-		$att_id = media_handle_sideload( $file_array, $post_id, null, $post_data );             // $post_data can override the items saved to wp_posts table, like post_mime_type, guid, post_parent, post_title, post_content, post_status
1168
+		$att_id = media_handle_sideload($file_array, $post_id, null, $post_data); // $post_data can override the items saved to wp_posts table, like post_mime_type, guid, post_parent, post_title, post_content, post_status
1169 1169
 
1170 1170
 		// If error storing permanently, unlink
1171
-		if ( is_wp_error( $att_id ) ) {
1172
-			unlink( $file_array['tmp_name'] );   // clean up
1171
+		if (is_wp_error($att_id)) {
1172
+			unlink($file_array['tmp_name']); // clean up
1173 1173
 			return false; // output wp_error
1174 1174
 			//return $att_id; // output wp_error
1175 1175
 		}
@@ -1197,33 +1197,33 @@  discard block
 block discarded – undo
1197 1197
 	/**
1198 1198
 	 * Formats the row for the completed list.
1199 1199
 	 */
1200
-	public function format_completed_row( $response ) {
1201
-		echo wp_kses_post( '<li class="post-' . $response . '"><span class="dashicons dashicons-yes"></span> <a target="_blank" href="' . get_permalink( $response ) . '">' . get_the_title( $response ) . '</a></li>' );
1200
+	public function format_completed_row($response) {
1201
+		echo wp_kses_post('<li class="post-'.$response.'"><span class="dashicons dashicons-yes"></span> <a target="_blank" href="'.get_permalink($response).'">'.get_the_title($response).'</a></li>');
1202 1202
 	}
1203 1203
 
1204 1204
 	/**
1205 1205
 	 * Formats the error.
1206 1206
 	 */
1207
-	public function format_error( $response ) {
1208
-		echo wp_kses_post( '<li class="post-error"><span class="dashicons dashicons-no"></span>' . $response . '</li>' );
1207
+	public function format_error($response) {
1208
+		echo wp_kses_post('<li class="post-error"><span class="dashicons dashicons-no"></span>'.$response.'</li>');
1209 1209
 	}
1210 1210
 
1211 1211
 	/**
1212 1212
 	 * Does a multine search
1213 1213
 	 */
1214
-	public function multineedle_stripos( $haystack, $needles, $offset = 0 ) {
1214
+	public function multineedle_stripos($haystack, $needles, $offset = 0) {
1215 1215
 		$found = false;
1216
-		$needle_count = count( $needles );
1216
+		$needle_count = count($needles);
1217 1217
 
1218
-		foreach ( $needles as $needle ) {
1219
-			if ( false !== stripos( $haystack, $needle, $offset ) ) {
1218
+		foreach ($needles as $needle) {
1219
+			if (false !== stripos($haystack, $needle, $offset)) {
1220 1220
 				$found[] = true;
1221 1221
 			}
1222 1222
 		}
1223 1223
 
1224
-		if ( false !== $found && count( $found ) === $needle_count ) {
1224
+		if (false !== $found && count($found) === $needle_count) {
1225 1225
 			return true;
1226
-		} else {
1226
+		}else {
1227 1227
 			return false;
1228 1228
 		}
1229 1229
 	}
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 	/**
1232 1232
 	 * Grab all the current accommodation posts via the lsx_wetu_id field.
1233 1233
 	 */
1234
-	public function find_current_accommodation( $post_type = 'accommodation' ) {
1234
+	public function find_current_accommodation($post_type = 'accommodation') {
1235 1235
 		global $wpdb;
1236 1236
 		$return = array();
1237 1237
 
@@ -1250,9 +1250,9 @@  discard block
 block discarded – undo
1250 1250
 		");
1251 1251
 		// @codingStandardsIgnoreEnd
1252 1252
 
1253
-		if ( null !== $current_accommodation && ! empty( $current_accommodation ) ) {
1254
-			foreach ( $current_accommodation as $accom ) {
1255
-				$return[ $accom->meta_value ] = $accom;
1253
+		if (null !== $current_accommodation && !empty($current_accommodation)) {
1254
+			foreach ($current_accommodation as $accom) {
1255
+				$return[$accom->meta_value] = $accom;
1256 1256
 			}
1257 1257
 		}
1258 1258
 
@@ -1262,20 +1262,20 @@  discard block
 block discarded – undo
1262 1262
 	/**
1263 1263
 	 * Set the Video date
1264 1264
 	 */
1265
-	public function set_video_data( $data, $id ) {
1266
-		if ( ! empty( $data[0]['content']['youtube_videos'] ) && is_array( $data[0]['content']['youtube_videos'] ) ) {
1265
+	public function set_video_data($data, $id) {
1266
+		if (!empty($data[0]['content']['youtube_videos']) && is_array($data[0]['content']['youtube_videos'])) {
1267 1267
 			$videos = false;
1268 1268
 
1269
-			foreach ( $data[0]['content']['youtube_videos'] as $video ) {
1269
+			foreach ($data[0]['content']['youtube_videos'] as $video) {
1270 1270
 				$temp_video = array();
1271 1271
 
1272
-				if ( isset( $video['label'] ) ) {
1272
+				if (isset($video['label'])) {
1273 1273
 					$temp_video['title'] = $video['label'];
1274 1274
 				}
1275
-				if ( isset( $video['description'] ) ) {
1276
-					$temp_video['description'] = strip_tags( $video['description'] );
1275
+				if (isset($video['description'])) {
1276
+					$temp_video['description'] = strip_tags($video['description']);
1277 1277
 				}
1278
-				if ( isset( $video['url'] ) ) {
1278
+				if (isset($video['url'])) {
1279 1279
 					$temp_video['url'] = $video['url'];
1280 1280
 				}
1281 1281
 
@@ -1283,24 +1283,24 @@  discard block
 block discarded – undo
1283 1283
 				$videos[] = $temp_video;
1284 1284
 			}
1285 1285
 
1286
-			if ( false !== $id && '0' !== $id ) {
1287
-				delete_post_meta( $id, 'videos' );
1286
+			if (false !== $id && '0' !== $id) {
1287
+				delete_post_meta($id, 'videos');
1288 1288
 			}
1289 1289
 
1290
-			foreach ( $videos as $video ) {
1291
-				add_post_meta( $id,'videos',$video,false );
1290
+			foreach ($videos as $video) {
1291
+				add_post_meta($id, 'videos', $video, false);
1292 1292
 			}
1293 1293
 		}
1294 1294
 	}
1295 1295
 
1296
-	public function shuffle_assoc( &$array ) {
1296
+	public function shuffle_assoc(&$array) {
1297 1297
 		$new = array();
1298
-		$keys = array_keys( $array );
1298
+		$keys = array_keys($array);
1299 1299
 
1300
-		shuffle( $keys );
1300
+		shuffle($keys);
1301 1301
 
1302
-		foreach ( $keys as $key ) {
1303
-			$new[ $key ] = $array[ $key ];
1302
+		foreach ($keys as $key) {
1303
+			$new[$key] = $array[$key];
1304 1304
 		}
1305 1305
 
1306 1306
 		$array = $new;
@@ -1314,29 +1314,29 @@  discard block
 block discarded – undo
1314 1314
 	public function update_options() {
1315 1315
 		$own = '';
1316 1316
 		$options = array();
1317
-		delete_option( 'lsx_ti_tours_api_options' );
1317
+		delete_option('lsx_ti_tours_api_options');
1318 1318
 
1319
-		if ( isset( $_GET['own'] ) ) {
1319
+		if (isset($_GET['own'])) {
1320 1320
 			$this->current_importer->url_qs .= '&own=true';
1321 1321
 			$options[] = 'own';
1322 1322
 		}
1323 1323
 
1324
-		if ( isset( $_GET['type'] ) && 'allitineraries' !== $_GET['type'] ) {
1325
-			$this->current_importer->url_qs .= '&type=' . implode( '', $_GET['type'] );
1326
-			$options[] = implode( '', $_GET['type'] );
1324
+		if (isset($_GET['type']) && 'allitineraries' !== $_GET['type']) {
1325
+			$this->current_importer->url_qs .= '&type='.implode('', $_GET['type']);
1326
+			$options[] = implode('', $_GET['type']);
1327 1327
 		}
1328 1328
 
1329 1329
 		$this->current_importer->url_qs .= '&results=2000';
1330 1330
 
1331
-		add_option( 'lsx_ti_tours_api_options', $options );
1331
+		add_option('lsx_ti_tours_api_options', $options);
1332 1332
 
1333
-		$data = wp_remote_get( $this->current_importer->url . '/V8/List?' . $this->current_importer->url_qs );
1334
-		$tours = json_decode( wp_remote_retrieve_body( $data ), true );
1333
+		$data = wp_remote_get($this->current_importer->url.'/V8/List?'.$this->current_importer->url_qs);
1334
+		$tours = json_decode(wp_remote_retrieve_body($data), true);
1335 1335
 
1336
-		if ( isset( $tours['error'] ) ) {
1336
+		if (isset($tours['error'])) {
1337 1337
 			return $tours['error'];
1338
-		} elseif ( isset( $tours['itineraries'] ) && ! empty( $tours['itineraries'] ) ) {
1339
-			set_transient( 'lsx_ti_tours', $tours['itineraries'], 60 * 60 * 2 );
1338
+		} elseif (isset($tours['itineraries']) && !empty($tours['itineraries'])) {
1339
+			set_transient('lsx_ti_tours', $tours['itineraries'], 60 * 60 * 2);
1340 1340
 			return true;
1341 1341
 		}
1342 1342
 	}
Please login to merge, or discard this patch.
classes/class-lsx-wetu-importer-destination.php 1 patch
Spacing   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function set_variables() {
72 72
 		parent::set_variables();
73
-		$this->url    = 'https://wetu.com/API/Pins/' . $this->api_key;
73
+		$this->url    = 'https://wetu.com/API/Pins/'.$this->api_key;
74 74
 		$this->url_qs = 'all=include';
75
-		$temp_options = get_option( '_lsx-to_settings', false );
75
+		$temp_options = get_option('_lsx-to_settings', false);
76 76
 
77
-		if ( false !== $temp_options && isset( $temp_options[ $this->plugin_slug ] ) && ! empty( $temp_options[ $this->plugin_slug ] ) ) {
78
-			$this->options = $temp_options[ $this->plugin_slug ];
77
+		if (false !== $temp_options && isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug])) {
78
+			$this->options = $temp_options[$this->plugin_slug];
79 79
 		}
80 80
 
81
-		$destination_options = get_option( 'lsx_wetu_importer_destination_settings', false );
81
+		$destination_options = get_option('lsx_wetu_importer_destination_settings', false);
82 82
 
83
-		if ( false !== $destination_options ) {
83
+		if (false !== $destination_options) {
84 84
 			$this->destination_options = $destination_options;
85 85
 		}
86 86
 	}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			</div>
97 97
 
98 98
 			<form method="get" action="" id="posts-filter">
99
-				<input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr( $this->tab_slug ); ?>"/>
99
+				<input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr($this->tab_slug); ?>"/>
100 100
 
101 101
 				<table class="wp-list-table widefat fixed posts">
102 102
 					<?php $this->table_header(); ?>
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 					<tr class="post-0 type-tour status-none" id="post-0">
106 106
 						<th class="check-column" scope="row">
107 107
 							<label for="cb-select-0"
108
-								   class="screen-reader-text"><?php esc_html_e( 'Enter a title to search for and press enter', 'lsx-wetu-importer' ); ?></label>
108
+								   class="screen-reader-text"><?php esc_html_e('Enter a title to search for and press enter', 'lsx-wetu-importer'); ?></label>
109 109
 						</th>
110 110
 						<td class="post-title page-title column-title">
111 111
 							<strong>
112
-								<?php esc_html_e( 'Enter a title to search for', 'lsx-wetu-importer' ); ?>
112
+								<?php esc_html_e('Enter a title to search for', 'lsx-wetu-importer'); ?>
113 113
 							</strong>
114 114
 						</td>
115 115
 						<td class="date column-date">
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 				</table>
125 125
 
126 126
 				<p><input class="button button-primary add" type="button"
127
-						  value="<?php esc_html_e( 'Add to List', 'lsx-wetu-importer' ); ?>"/>
127
+						  value="<?php esc_html_e('Add to List', 'lsx-wetu-importer'); ?>"/>
128 128
 					<input class="button button-primary clear" type="button"
129
-						   value="<?php esc_html_e( 'Clear', 'lsx-wetu-importer' ); ?>"/>
129
+						   value="<?php esc_html_e('Clear', 'lsx-wetu-importer'); ?>"/>
130 130
 				</p>
131 131
 			</form>
132 132
 
@@ -136,118 +136,118 @@  discard block
 block discarded – undo
136 136
 
137 137
 					<div class="row">
138 138
 						<div class="settings-all" style="width:30%;display:block;float:left;">
139
-							<h3><?php esc_html_e( 'What content to Sync from WETU' ); ?></h3>
139
+							<h3><?php esc_html_e('What content to Sync from WETU'); ?></h3>
140 140
 							<ul>
141 141
 								<li>
142
-									<input class="content select-all" <?php $this->checked( $this->destination_options, 'all' ); ?>
142
+									<input class="content select-all" <?php $this->checked($this->destination_options, 'all'); ?>
143 143
 										   type="checkbox" name="content[]"
144
-										   value="all"/> <?php esc_html_e( 'Select All', 'lsx-wetu-importer' ); ?></li>
145
-								<?php if ( isset( $this->options ) && isset( $this->options['disable_destination_descriptions'] ) && 'on' !== $this->options['disable_destination_descriptions'] ) { ?>
144
+										   value="all"/> <?php esc_html_e('Select All', 'lsx-wetu-importer'); ?></li>
145
+								<?php if (isset($this->options) && isset($this->options['disable_destination_descriptions']) && 'on' !== $this->options['disable_destination_descriptions']) { ?>
146 146
 								<li>
147
-									<input class="content" <?php $this->checked( $this->destination_options, 'description' ); ?>
147
+									<input class="content" <?php $this->checked($this->destination_options, 'description'); ?>
148 148
 										   type="checkbox" name="content[]"
149
-										   value="description"/> <?php esc_html_e( 'Description', 'lsx-wetu-importer' ); ?></li>
149
+										   value="description"/> <?php esc_html_e('Description', 'lsx-wetu-importer'); ?></li>
150 150
 								<?php } ?>
151 151
 
152 152
 								<li>
153
-									<input class="content" <?php $this->checked( $this->destination_options, 'gallery' ); ?>
153
+									<input class="content" <?php $this->checked($this->destination_options, 'gallery'); ?>
154 154
 										   type="checkbox" name="content[]"
155
-										   value="gallery"/> <?php esc_html_e( 'Main Gallery', 'lsx-wetu-importer' ); ?></li>
156
-								<?php if ( class_exists( 'LSX_TO_Maps' ) ) { ?>
155
+										   value="gallery"/> <?php esc_html_e('Main Gallery', 'lsx-wetu-importer'); ?></li>
156
+								<?php if (class_exists('LSX_TO_Maps')) { ?>
157 157
 									<li>
158
-										<input class="content" <?php $this->checked( $this->destination_options, 'location' ); ?>
158
+										<input class="content" <?php $this->checked($this->destination_options, 'location'); ?>
159 159
 											   type="checkbox" name="content[]"
160
-											   value="location"/> <?php esc_html_e( 'Location', 'lsx-wetu-importer' ); ?></li>
160
+											   value="location"/> <?php esc_html_e('Location', 'lsx-wetu-importer'); ?></li>
161 161
 								<?php } ?>
162 162
 
163
-								<?php if ( class_exists( 'LSX_TO_Videos' ) ) { ?>
163
+								<?php if (class_exists('LSX_TO_Videos')) { ?>
164 164
 									<li>
165
-										<input class="content" <?php $this->checked( $this->destination_options, 'videos' ); ?>
165
+										<input class="content" <?php $this->checked($this->destination_options, 'videos'); ?>
166 166
 											   type="checkbox" name="content[]"
167
-											   value="videos"/> <?php esc_html_e( 'Videos', 'lsx-wetu-importer' ); ?></li>
167
+											   value="videos"/> <?php esc_html_e('Videos', 'lsx-wetu-importer'); ?></li>
168 168
 								<?php } ?>
169 169
 
170 170
 							</ul>
171
-							<h4><?php esc_html_e( 'Additional Content' ); ?></h4>
171
+							<h4><?php esc_html_e('Additional Content'); ?></h4>
172 172
 							<ul>
173 173
 								<li>
174
-									<input class="content" <?php $this->checked( $this->destination_options, 'country' ); ?>
174
+									<input class="content" <?php $this->checked($this->destination_options, 'country'); ?>
175 175
 										   type="checkbox" name="content[]"
176
-										   value="country"/> <?php esc_html_e( 'Set Country', 'lsx-wetu-importer' ); ?></li>
176
+										   value="country"/> <?php esc_html_e('Set Country', 'lsx-wetu-importer'); ?></li>
177 177
 								<li>
178
-									<input class="content" <?php $this->checked( $this->destination_options, 'continent' ); ?>
178
+									<input class="content" <?php $this->checked($this->destination_options, 'continent'); ?>
179 179
 										   type="checkbox" name="content[]"
180
-										   value="continent"/> <?php esc_html_e( 'Set Continent', 'lsx-wetu-importer' ); ?></li>
180
+										   value="continent"/> <?php esc_html_e('Set Continent', 'lsx-wetu-importer'); ?></li>
181 181
 
182 182
 								<li>
183
-									<input class="content" <?php $this->checked( $this->destination_options, 'featured_image' ); ?>
183
+									<input class="content" <?php $this->checked($this->destination_options, 'featured_image'); ?>
184 184
 										   type="checkbox" name="content[]"
185
-										   value="featured_image"/> <?php esc_html_e( 'Set Featured Image', 'lsx-wetu-importer' ); ?>
185
+										   value="featured_image"/> <?php esc_html_e('Set Featured Image', 'lsx-wetu-importer'); ?>
186 186
 								</li>
187
-								<?php if ( class_exists( 'LSX_Banners' ) ) { ?>
187
+								<?php if (class_exists('LSX_Banners')) { ?>
188 188
 									<li>
189
-										<input class="content" <?php $this->checked( $this->destination_options, 'banner_image' ); ?>
189
+										<input class="content" <?php $this->checked($this->destination_options, 'banner_image'); ?>
190 190
 											   type="checkbox" name="content[]"
191
-											   value="banner_image"/> <?php esc_html_e( 'Set Banner Image', 'lsx-wetu-importer' ); ?>
191
+											   value="banner_image"/> <?php esc_html_e('Set Banner Image', 'lsx-wetu-importer'); ?>
192 192
 									</li>
193 193
 									<li>
194
-										<input class="content" <?php $this->checked( $this->destination_options, 'unique_banner_image' ); ?>
194
+										<input class="content" <?php $this->checked($this->destination_options, 'unique_banner_image'); ?>
195 195
 											   type="checkbox" name="content[]"
196
-											   value="unique_banner_image"/> <?php esc_html_e( 'Use the WETU banner field', 'lsx-wetu-importer' ); ?>
196
+											   value="unique_banner_image"/> <?php esc_html_e('Use the WETU banner field', 'lsx-wetu-importer'); ?>
197 197
 									</li>
198 198
 								<?php } ?>
199 199
 
200 200
 								<li>
201
-									<input class="content" <?php $this->checked( $this->destination_options, 'strip_tags' ); ?>
201
+									<input class="content" <?php $this->checked($this->destination_options, 'strip_tags'); ?>
202 202
 										   type="checkbox" name="content[]"
203
-										   value="strip_tags"/> <?php esc_html_e( 'Strip HTML from the description', 'lsx-wetu-importer' ); ?></li>
203
+										   value="strip_tags"/> <?php esc_html_e('Strip HTML from the description', 'lsx-wetu-importer'); ?></li>
204 204
 							</ul>
205 205
 						</div>
206 206
 						<div class="settings-all" style="width:30%;display:block;float:left;">
207
-							<h3><?php esc_html_e( 'Travel Information' ); ?></h3>
207
+							<h3><?php esc_html_e('Travel Information'); ?></h3>
208 208
 							<ul>
209 209
 								<li>
210
-									<input class="content" <?php $this->checked( $this->destination_options, 'electricity' ); ?>
210
+									<input class="content" <?php $this->checked($this->destination_options, 'electricity'); ?>
211 211
 										   type="checkbox" name="content[]"
212
-										   value="electricity"/> <?php esc_html_e( 'Electricity', 'lsx-wetu-importer' ); ?></li>
212
+										   value="electricity"/> <?php esc_html_e('Electricity', 'lsx-wetu-importer'); ?></li>
213 213
 								<li>
214
-									<input class="content" <?php $this->checked( $this->destination_options, 'banking' ); ?>
214
+									<input class="content" <?php $this->checked($this->destination_options, 'banking'); ?>
215 215
 										   type="checkbox" name="content[]"
216
-										   value="banking"/> <?php esc_html_e( 'Banking', 'lsx-wetu-importer' ); ?></li>
216
+										   value="banking"/> <?php esc_html_e('Banking', 'lsx-wetu-importer'); ?></li>
217 217
 								<li>
218
-									<input class="content" <?php $this->checked( $this->destination_options, 'cuisine' ); ?>
218
+									<input class="content" <?php $this->checked($this->destination_options, 'cuisine'); ?>
219 219
 										   type="checkbox" name="content[]"
220
-										   value="cuisine"/> <?php esc_html_e( 'Cuisine', 'lsx-wetu-importer' ); ?></li>
220
+										   value="cuisine"/> <?php esc_html_e('Cuisine', 'lsx-wetu-importer'); ?></li>
221 221
 								<li>
222
-									<input class="content" <?php $this->checked( $this->destination_options, 'climate' ); ?>
222
+									<input class="content" <?php $this->checked($this->destination_options, 'climate'); ?>
223 223
 										   type="checkbox" name="content[]"
224
-										   value="climate"/> <?php esc_html_e( 'Climate', 'lsx-wetu-importer' ); ?></li>
224
+										   value="climate"/> <?php esc_html_e('Climate', 'lsx-wetu-importer'); ?></li>
225 225
 								<li>
226
-									<input class="content" <?php $this->checked( $this->destination_options, 'transport' ); ?>
226
+									<input class="content" <?php $this->checked($this->destination_options, 'transport'); ?>
227 227
 										   type="checkbox" name="content[]"
228
-										   value="transport"/> <?php esc_html_e( 'Transport', 'lsx-wetu-importer' ); ?></li>
229
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'dress' ); ?>
228
+										   value="transport"/> <?php esc_html_e('Transport', 'lsx-wetu-importer'); ?></li>
229
+								<li><input class="content" <?php $this->checked($this->destination_options, 'dress'); ?>
230 230
 										   type="checkbox" name="content[]"
231
-										   value="dress"/> <?php esc_html_e( 'Dress', 'lsx-wetu-importer' ); ?></li>
232
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'health' ); ?>
231
+										   value="dress"/> <?php esc_html_e('Dress', 'lsx-wetu-importer'); ?></li>
232
+								<li><input class="content" <?php $this->checked($this->destination_options, 'health'); ?>
233 233
 										   type="checkbox" name="content[]"
234
-										   value="health"/> <?php esc_html_e( 'Health', 'lsx-wetu-importer' ); ?></li>
235
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'safety' ); ?>
234
+										   value="health"/> <?php esc_html_e('Health', 'lsx-wetu-importer'); ?></li>
235
+								<li><input class="content" <?php $this->checked($this->destination_options, 'safety'); ?>
236 236
 										   type="checkbox" name="content[]"
237
-										   value="safety"/> <?php esc_html_e( 'Safety', 'lsx-wetu-importer' ); ?></li>
238
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'visa' ); ?>
237
+										   value="safety"/> <?php esc_html_e('Safety', 'lsx-wetu-importer'); ?></li>
238
+								<li><input class="content" <?php $this->checked($this->destination_options, 'visa'); ?>
239 239
 										   type="checkbox" name="content[]"
240
-										   value="visa"/> <?php esc_html_e( 'Visa', 'lsx-wetu-importer' ); ?></li>
241
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'additional_info' ); ?>
240
+										   value="visa"/> <?php esc_html_e('Visa', 'lsx-wetu-importer'); ?></li>
241
+								<li><input class="content" <?php $this->checked($this->destination_options, 'additional_info'); ?>
242 242
 										   type="checkbox" name="content[]"
243
-										   value="additional_info"/> <?php esc_html_e( 'General', 'lsx-wetu-importer' ); ?></li>
243
+										   value="additional_info"/> <?php esc_html_e('General', 'lsx-wetu-importer'); ?></li>
244 244
 							</ul>
245 245
 						</div>
246 246
 
247
-						<?php if ( class_exists( 'LSX_TO_Team' ) ) { ?>
247
+						<?php if (class_exists('LSX_TO_Team')) { ?>
248 248
 							<div style="width:30%;display:block;float:left;">
249
-								<h3><?php esc_html_e( 'Assign a Team Member' ); ?></h3>
250
-								<?php $this->team_member_checkboxes( $this->destination_options ); ?>
249
+								<h3><?php esc_html_e('Assign a Team Member'); ?></h3>
250
+								<?php $this->team_member_checkboxes($this->destination_options); ?>
251 251
 							</div>
252 252
 						<?php } ?>
253 253
 
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 					</div>
256 256
 
257 257
 
258
-					<h3><?php esc_html_e( 'Your List' ); ?></h3>
258
+					<h3><?php esc_html_e('Your List'); ?></h3>
259 259
 					<p><input class="button button-primary" type="submit"
260
-							  value="<?php esc_html_e( 'Sync', 'lsx-wetu-importer' ); ?>"/></p>
260
+							  value="<?php esc_html_e('Sync', 'lsx-wetu-importer'); ?>"/></p>
261 261
 					<table class="wp-list-table widefat fixed posts">
262 262
 						<?php $this->table_header(); ?>
263 263
 
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 					</table>
271 271
 
272 272
 					<p><input class="button button-primary" type="submit"
273
-							  value="<?php esc_html_e( 'Sync', 'lsx-wetu-importer' ); ?>"/></p>
273
+							  value="<?php esc_html_e('Sync', 'lsx-wetu-importer'); ?>"/></p>
274 274
 				</form>
275 275
 			</div>
276 276
 
277 277
 			<div style="display:none;" class="completed-list-wrapper">
278
-				<h3><?php esc_html_e( 'Completed' ); ?></h3>
278
+				<h3><?php esc_html_e('Completed'); ?></h3>
279 279
 				<ul>
280 280
 				</ul>
281 281
 			</div>
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	/**
287 287
 	 * Grab all the current destination posts via the lsx_wetu_id field.
288 288
 	 */
289
-	public function find_current_destination( $post_type = 'destination' ) {
289
+	public function find_current_destination($post_type = 'destination') {
290 290
 		global $wpdb;
291 291
 		$return = array();
292 292
 
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
 		");
306 306
 		// @codingStandardsIgnoreEnd
307 307
 
308
-		if ( null !== $current_destination && ! empty( $current_destination ) ) {
309
-			foreach ( $current_destination as $accom ) {
310
-				$return[ $accom->meta_value ] = $accom;
308
+		if (null !== $current_destination && !empty($current_destination)) {
309
+			foreach ($current_destination as $accom) {
310
+				$return[$accom->meta_value] = $accom;
311 311
 			}
312 312
 		}
313 313
 
@@ -321,119 +321,119 @@  discard block
 block discarded – undo
321 321
 		$return = false;
322 322
 
323 323
 		// @codingStandardsIgnoreLine
324
-		if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_tour_importer' && isset( $_POST['type'] ) && $_POST['type'] === 'destination' ) {
324
+		if (isset($_POST['action']) && $_POST['action'] === 'lsx_tour_importer' && isset($_POST['type']) && $_POST['type'] === 'destination') {
325 325
 
326 326
 			$searched_items = false;
327 327
 
328 328
 			// @codingStandardsIgnoreLine
329
-			if ( isset( $_POST['keyword'] ) ) {
329
+			if (isset($_POST['keyword'])) {
330 330
 				// @codingStandardsIgnoreLine
331 331
 				$keyphrases = $_POST['keyword'];
332
-			} else {
333
-				$keyphrases = array( 0 );
332
+			}else {
333
+				$keyphrases = array(0);
334 334
 			}
335 335
 
336
-			if ( ! is_array( $keyphrases ) ) {
337
-				$keyphrases = array( $keyphrases );
336
+			if (!is_array($keyphrases)) {
337
+				$keyphrases = array($keyphrases);
338 338
 			}
339
-			foreach ( $keyphrases as &$keyword ) {
340
-				$keyword = ltrim( rtrim( $keyword ) );
339
+			foreach ($keyphrases as &$keyword) {
340
+				$keyword = ltrim(rtrim($keyword));
341 341
 			}
342 342
 
343 343
 			$post_status = false;
344 344
 
345
-			if ( in_array( 'publish', $keyphrases ) ) {
345
+			if (in_array('publish', $keyphrases)) {
346 346
 				$post_status = 'publish';
347 347
 			}
348
-			if ( in_array( 'pending', $keyphrases ) ) {
348
+			if (in_array('pending', $keyphrases)) {
349 349
 				$post_status = 'pending';
350 350
 			}
351
-			if ( in_array( 'draft', $keyphrases ) ) {
351
+			if (in_array('draft', $keyphrases)) {
352 352
 				$post_status = 'draft';
353 353
 			}
354
-			if ( in_array( 'import', $keyphrases ) ) {
354
+			if (in_array('import', $keyphrases)) {
355 355
 				$post_status = 'import';
356 356
 			}
357 357
 
358 358
 			// If there is a post status use it.
359
-			if ( false !== $post_status ) {
359
+			if (false !== $post_status) {
360 360
 
361 361
 				$accommodation = array();
362
-				$current_accommodation = $this->find_current_accommodation( 'destination' );
363
-				if ( ! empty( $current_accommodation ) ) {
364
-					foreach ( $current_accommodation as $cs_key => $ccs_id ) {
365
-						$accommodation[] = $this->prepare_row_attributes( $cs_key, $ccs_id->post_id );
362
+				$current_accommodation = $this->find_current_accommodation('destination');
363
+				if (!empty($current_accommodation)) {
364
+					foreach ($current_accommodation as $cs_key => $ccs_id) {
365
+						$accommodation[] = $this->prepare_row_attributes($cs_key, $ccs_id->post_id);
366 366
 					}
367 367
 				}
368 368
 
369 369
 				// Run through each accommodation and use it.
370
-				if ( ! empty( $accommodation ) ) {
371
-					foreach ( $accommodation as $row_key => $row ) {
372
-						if ( 'import' === $post_status ) {
373
-
374
-							if ( is_array( $this->queued_imports ) && in_array( $row['post_id'], $this->queued_imports ) ) {
375
-								$current_status = get_post_status( $row['post_id'] );
376
-								if ( 'draft' === $current_status ) {
377
-									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
370
+				if (!empty($accommodation)) {
371
+					foreach ($accommodation as $row_key => $row) {
372
+						if ('import' === $post_status) {
373
+
374
+							if (is_array($this->queued_imports) && in_array($row['post_id'], $this->queued_imports)) {
375
+								$current_status = get_post_status($row['post_id']);
376
+								if ('draft' === $current_status) {
377
+									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
378 378
 								}
379
-							} else {
379
+							}else {
380 380
 								continue;
381 381
 							}
382
-						} else {
383
-							if ( 0 === $row['post_id'] ) {
382
+						}else {
383
+							if (0 === $row['post_id']) {
384 384
 								continue;
385
-							} else {
386
-								$current_status = get_post_status( $row['post_id'] );
385
+							}else {
386
+								$current_status = get_post_status($row['post_id']);
387 387
 
388
-								if ( $current_status !== $post_status ) {
388
+								if ($current_status !== $post_status) {
389 389
 									continue;
390 390
 								}
391 391
 							}
392
-							$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
392
+							$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
393 393
 						}
394 394
 					}
395 395
 				}
396
-			} else {
396
+			}else {
397 397
 
398
-				$key_string_search = implode( '+', $keyphrases );
399
-				$search_data = file_get_contents( $this->url . '/Search/' . $key_string_search . '/?all=include' );
400
-				$search_data = json_decode( $search_data, true );
398
+				$key_string_search = implode('+', $keyphrases);
399
+				$search_data = file_get_contents($this->url.'/Search/'.$key_string_search.'/?all=include');
400
+				$search_data = json_decode($search_data, true);
401 401
 
402
-				if ( ! isset( $search_data['error'] ) ) {
403
-					foreach ( $search_data as $sdata ) {
402
+				if (!isset($search_data['error'])) {
403
+					foreach ($search_data as $sdata) {
404 404
 
405
-						if ( 'Destination' !== trim( $sdata['type'] ) ) {
405
+						if ('Destination' !== trim($sdata['type'])) {
406 406
 							continue;
407 407
 						}
408 408
 
409
-						$temp_id = $this->get_post_id_by_key_value( $sdata['id'] );
410
-						if ( false === $temp_id ) {
409
+						$temp_id = $this->get_post_id_by_key_value($sdata['id']);
410
+						if (false === $temp_id) {
411 411
 							$sdata['post_id'] = 0;
412
-						} else {
412
+						}else {
413 413
 							$sdata['post_id'] = $temp_id;
414 414
 						}
415
-						$searched_items[ sanitize_title( $sdata['name'] ) . '-' . $sdata['id'] ] = $this->format_row( $sdata );
415
+						$searched_items[sanitize_title($sdata['name']).'-'.$sdata['id']] = $this->format_row($sdata);
416 416
 					}
417 417
 				}
418 418
 			}
419 419
 
420
-			if ( false !== $searched_items ) {
421
-				ksort( $searched_items );
422
-				$return = implode( $searched_items );
420
+			if (false !== $searched_items) {
421
+				ksort($searched_items);
422
+				$return = implode($searched_items);
423 423
 			}
424 424
 
425
-			print_r( $return );
425
+			print_r($return);
426 426
 		}
427 427
 
428 428
 		die();
429 429
 	}
430 430
 
431
-	public function prepare_row_attributes( $cs_key, $ccs_id ) {
431
+	public function prepare_row_attributes($cs_key, $ccs_id) {
432 432
 		$row_item = array(
433 433
 			'id' => $cs_key,
434 434
 			'type' => 'Destination',
435
-			'name' => get_the_title( $ccs_id ),
436
-			'last_modified' => date( 'Y-m-d', strtotime( 'now' ) ),
435
+			'name' => get_the_title($ccs_id),
436
+			'last_modified' => date('Y-m-d', strtotime('now')),
437 437
 			'post_id' => $ccs_id,
438 438
 		);
439 439
 		return $row_item;
@@ -442,28 +442,28 @@  discard block
 block discarded – undo
442 442
 	/**
443 443
 	 * Formats the row for output on the screen.
444 444
 	 */
445
-	public function format_row( $row = false ) {
446
-		if ( false !== $row ) {
445
+	public function format_row($row = false) {
446
+		if (false !== $row) {
447 447
 
448 448
 			$status = 'import';
449
-			if ( 0 !== $row['post_id'] ) {
450
-				$status = '<a href="' . admin_url( '/post.php?post=' . $row['post_id'] . '&action=edit' ) . '" target="_blank">' . get_post_status( $row['post_id'] ) . '</a>';
449
+			if (0 !== $row['post_id']) {
450
+				$status = '<a href="'.admin_url('/post.php?post='.$row['post_id'].'&action=edit').'" target="_blank">'.get_post_status($row['post_id']).'</a>';
451 451
 			}
452 452
 
453 453
 			$row_html = '
454
-			<tr class="post-' . $row['post_id'] . ' type-tour" id="post-' . $row['post_id'] . '">
454
+			<tr class="post-' . $row['post_id'].' type-tour" id="post-'.$row['post_id'].'">
455 455
 				<th class="check-column" scope="row">
456
-					<label for="cb-select-' . $row['id'] . '" class="screen-reader-text">' . $row['name'] . '</label>
457
-					<input type="checkbox" data-identifier="' . $row['id'] . '" value="' . $row['post_id'] . '" name="post[]" id="cb-select-' . $row['id'] . '">
456
+					<label for="cb-select-' . $row['id'].'" class="screen-reader-text">'.$row['name'].'</label>
457
+					<input type="checkbox" data-identifier="' . $row['id'].'" value="'.$row['post_id'].'" name="post[]" id="cb-select-'.$row['id'].'">
458 458
 				</th>
459 459
 				<td class="post-title page-title column-title">
460
-					<strong>' . $row['name'] . '</strong> - ' . $status . '
460
+					<strong>' . $row['name'].'</strong> - '.$status.'
461 461
 				</td>
462 462
 				<td class="date column-date">
463
-					<abbr title="' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '">' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '</abbr><br>Last Modified
463
+					<abbr title="' . date('Y/m/d', strtotime($row['last_modified'])).'">'.date('Y/m/d', strtotime($row['last_modified'])).'</abbr><br>Last Modified
464 464
 				</td>
465 465
 				<td class="ssid column-ssid">
466
-					' . $row['id'] . '
466
+					' . $row['id'].'
467 467
 				</td>
468 468
 			</tr>';
469 469
 			return $row_html;
@@ -476,50 +476,50 @@  discard block
 block discarded – undo
476 476
 	public function process_ajax_import() {
477 477
 		$return = false;
478 478
 
479
-		check_ajax_referer( 'lsx_wetu_ajax_action', 'security' );
480
-		if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_import_items' && isset( $_POST['type'] ) && $_POST['type'] === 'destination' && isset( $_POST['wetu_id'] ) ) {
479
+		check_ajax_referer('lsx_wetu_ajax_action', 'security');
480
+		if (isset($_POST['action']) && $_POST['action'] === 'lsx_import_items' && isset($_POST['type']) && $_POST['type'] === 'destination' && isset($_POST['wetu_id'])) {
481 481
 
482
-			$wetu_id = wp_unslash( $_POST['wetu_id'] );
482
+			$wetu_id = wp_unslash($_POST['wetu_id']);
483 483
 
484 484
 			// @codingStandardsIgnoreLine
485
-			if ( isset( $_POST['post_id'] ) ) {
485
+			if (isset($_POST['post_id'])) {
486 486
 				// @codingStandardsIgnoreLine
487 487
 				$post_id = $_POST['post_id'];
488
-				$this->current_post = get_post( $post_id );
489
-			} else {
488
+				$this->current_post = get_post($post_id);
489
+			}else {
490 490
 				$post_id = 0;
491 491
 			}
492 492
 
493 493
 			// @codingStandardsIgnoreLine
494
-			if ( isset( $_POST['team_members'] ) ) {
494
+			if (isset($_POST['team_members'])) {
495 495
 				// @codingStandardsIgnoreLine
496 496
 				$team_members = $_POST['team_members'];
497
-			} else {
497
+			}else {
498 498
 				$team_members = false;
499 499
 			}
500 500
 
501 501
 			$safari_brands = false;
502 502
 
503
-			delete_option( 'lsx_wetu_importer_destination_settings' );
503
+			delete_option('lsx_wetu_importer_destination_settings');
504 504
 
505 505
 			// @codingStandardsIgnoreLine
506
-			if ( isset( $_POST['content'] ) && is_array( $_POST['content'] ) && ! empty( $_POST['content'] ) ) {
506
+			if (isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])) {
507 507
 				// @codingStandardsIgnoreLine
508 508
 				$content = $_POST['content'];
509
-				add_option( 'lsx_wetu_importer_destination_settings', $content );
510
-			} else {
509
+				add_option('lsx_wetu_importer_destination_settings', $content);
510
+			}else {
511 511
 				$content = false;
512 512
 			}
513 513
 
514
-			$jdata = wp_remote_get( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
514
+			$jdata = wp_remote_get($this->url.'/Get?'.$this->url_qs.'&ids='.$wetu_id);
515 515
 
516
-			if ( ! empty( $jdata ) && isset( $jdata['response'] ) && isset( $jdata['response']['code'] ) && 200 === $jdata['response']['code'] ) {
517
-				$adata = json_decode( $jdata, true );
518
-				$return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands );
519
-				$this->remove_from_queue( $return );
520
-				$this->format_completed_row( $return );
521
-			} else {
522
-				$this->format_error( esc_html__( 'There was a problem importing your destination, please try refreshing the page.', 'lsx-wetu-importer' ) );
516
+			if (!empty($jdata) && isset($jdata['response']) && isset($jdata['response']['code']) && 200 === $jdata['response']['code']) {
517
+				$adata = json_decode($jdata, true);
518
+				$return = $this->import_row($adata, $wetu_id, $post_id, $team_members, $content, $safari_brands);
519
+				$this->remove_from_queue($return);
520
+				$this->format_completed_row($return);
521
+			}else {
522
+				$this->format_error(esc_html__('There was a problem importing your destination, please try refreshing the page.', 'lsx-wetu-importer'));
523 523
 			}
524 524
 		}
525 525
 	}
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 	/**
528 528
 	 * Saves the queue to the option.
529 529
 	 */
530
-	public function remove_from_queue( $id ) {
531
-		if ( ! empty( $this->queued_imports ) ) {
532
-			$key = array_search( $id, $this->queued_imports );
533
-			if ( false !== $key ) {
534
-				unset( $this->queued_imports[ $key ] );
530
+	public function remove_from_queue($id) {
531
+		if (!empty($this->queued_imports)) {
532
+			$key = array_search($id, $this->queued_imports);
533
+			if (false !== $key) {
534
+				unset($this->queued_imports[$key]);
535 535
 
536
-				delete_option( 'lsx_wetu_importer_que' );
537
-				update_option( 'lsx_wetu_importer_que', $this->queued_imports );
536
+				delete_option('lsx_wetu_importer_que');
537
+				update_option('lsx_wetu_importer_que', $this->queued_imports);
538 538
 			}
539 539
 		}
540 540
 	}
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 	/**
543 543
 	 * Connect to wetu
544 544
 	 */
545
-	public function import_row( $data, $wetu_id, $id = 0, $team_members = false, $importable_content = array(), $safari_brands = false ) {
546
-		if ( 'Destination' === trim( $data[0]['type'] ) ) {
545
+	public function import_row($data, $wetu_id, $id = 0, $team_members = false, $importable_content = array(), $safari_brands = false) {
546
+		if ('Destination' === trim($data[0]['type'])) {
547 547
 			$post_name = '';
548 548
 			$data_post_content = '';
549 549
 			$data_post_excerpt = '';
@@ -552,132 +552,132 @@  discard block
 block discarded – undo
552 552
 				'post_type' => 'destination',
553 553
 			);
554 554
 
555
-			if ( ! empty( $importable_content ) && in_array( 'country', $importable_content ) ) {
556
-				$parent = $this->check_for_parent( $data );
557
-				if ( false !== $parent ) {
555
+			if (!empty($importable_content) && in_array('country', $importable_content)) {
556
+				$parent = $this->check_for_parent($data);
557
+				if (false !== $parent) {
558 558
 					$post['post_parent'] = $parent;
559 559
 				}
560 560
 			}
561 561
 
562 562
 			// Set the post_content.
563
-			if ( ! empty( $importable_content ) && in_array( 'description', $importable_content ) ) {
564
-				if ( isset( $data[0]['content']['general_description'] ) ) {
563
+			if (!empty($importable_content) && in_array('description', $importable_content)) {
564
+				if (isset($data[0]['content']['general_description'])) {
565 565
 
566
-					if ( in_array( 'strip_tags', $importable_content ) ) {
567
-						$post['post_content'] = wp_strip_all_tags( $data[0]['content']['general_description'] );
568
-					} else {
566
+					if (in_array('strip_tags', $importable_content)) {
567
+						$post['post_content'] = wp_strip_all_tags($data[0]['content']['general_description']);
568
+					}else {
569 569
 						$post['post_content'] = $data[0]['content']['general_description'];
570 570
 					}
571 571
 				}
572 572
 			}
573 573
 
574
-			if ( false !== $id && '0' !== $id ) {
574
+			if (false !== $id && '0' !== $id) {
575 575
 				$post['ID'] = $id;
576 576
 
577
-				if ( isset( $data[0]['name'] ) ) {
577
+				if (isset($data[0]['name'])) {
578 578
 					$post['post_title'] = $data[0]['name'];
579 579
 					$post['post_status'] = 'publish';
580
-					$post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 );
580
+					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0);
581 581
 				}
582 582
 
583
-				$id = wp_update_post( $post );
584
-				$prev_date = get_post_meta( $id, 'lsx_wetu_modified_date', true );
585
-				update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date );
586
-			} else {
583
+				$id = wp_update_post($post);
584
+				$prev_date = get_post_meta($id, 'lsx_wetu_modified_date', true);
585
+				update_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']), $prev_date);
586
+			}else {
587 587
 				// Set the name.
588
-				if ( isset( $data[0]['name'] ) ) {
589
-					$post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 );
588
+				if (isset($data[0]['name'])) {
589
+					$post_name = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0);
590 590
 				}
591 591
 
592 592
 				$post['post_name'] = $post_name;
593 593
 				$post['post_title'] = $data[0]['name'];
594 594
 				$post['post_status'] = 'publish';
595
-				$id = wp_insert_post( $post );
595
+				$id = wp_insert_post($post);
596 596
 
597 597
 				// Save the WETU ID and the Last date it was modified.
598
-				if ( false !== $id ) {
599
-					add_post_meta( $id, 'lsx_wetu_id', $wetu_id );
600
-					add_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ) );
598
+				if (false !== $id) {
599
+					add_post_meta($id, 'lsx_wetu_id', $wetu_id);
600
+					add_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']));
601 601
 				}
602 602
 			}
603 603
 
604
-			$this->find_attachments( $id );
604
+			$this->find_attachments($id);
605 605
 
606 606
 			// Set the team member if it is there.
607
-			if ( post_type_exists( 'team' ) && false !== $team_members && '' !== $team_members ) {
608
-				$this->set_team_member( $id, $team_members );
607
+			if (post_type_exists('team') && false !== $team_members && '' !== $team_members) {
608
+				$this->set_team_member($id, $team_members);
609 609
 			}
610 610
 
611
-			if ( class_exists( 'LSX_TO_Maps' ) ) {
612
-				$this->set_map_data( $data, $id, 9 );
611
+			if (class_exists('LSX_TO_Maps')) {
612
+				$this->set_map_data($data, $id, 9);
613 613
 			}
614 614
 
615 615
 			// Set the Room Data.
616
-			if ( false !== $importable_content && in_array( 'videos', $importable_content ) ) {
617
-				$this->set_video_data( $data, $id );
616
+			if (false !== $importable_content && in_array('videos', $importable_content)) {
617
+				$this->set_video_data($data, $id);
618 618
 			}
619 619
 
620 620
 			// Set the Electricity.
621
-			if ( false !== $importable_content && in_array( 'electricity', $importable_content ) ) {
622
-				$this->set_travel_info( $data, $id, 'electricity', $importable_content );
621
+			if (false !== $importable_content && in_array('electricity', $importable_content)) {
622
+				$this->set_travel_info($data, $id, 'electricity', $importable_content);
623 623
 			}
624 624
 			// Set the cuisine.
625
-			if ( false !== $importable_content && in_array( 'cuisine', $importable_content ) ) {
626
-				$this->set_travel_info( $data, $id, 'cuisine', $importable_content );
625
+			if (false !== $importable_content && in_array('cuisine', $importable_content)) {
626
+				$this->set_travel_info($data, $id, 'cuisine', $importable_content);
627 627
 			}
628 628
 			// Set the banking.
629
-			if ( false !== $importable_content && in_array( 'banking', $importable_content ) ) {
630
-				$this->set_travel_info( $data, $id, 'banking', $importable_content );
629
+			if (false !== $importable_content && in_array('banking', $importable_content)) {
630
+				$this->set_travel_info($data, $id, 'banking', $importable_content);
631 631
 			}
632 632
 			// Set the transport.
633
-			if ( false !== $importable_content && in_array( 'transport', $importable_content ) ) {
634
-				$this->set_travel_info( $data, $id, 'transport', $importable_content );
633
+			if (false !== $importable_content && in_array('transport', $importable_content)) {
634
+				$this->set_travel_info($data, $id, 'transport', $importable_content);
635 635
 			}
636 636
 			// Set the dress.
637
-			if ( false !== $importable_content && in_array( 'dress', $importable_content ) ) {
638
-				$this->set_travel_info( $data, $id, 'dress', $importable_content );
637
+			if (false !== $importable_content && in_array('dress', $importable_content)) {
638
+				$this->set_travel_info($data, $id, 'dress', $importable_content);
639 639
 			}
640 640
 			// Set the climate.
641
-			if ( false !== $importable_content && in_array( 'climate', $importable_content ) ) {
642
-				$this->set_travel_info( $data, $id, 'climate', $importable_content );
641
+			if (false !== $importable_content && in_array('climate', $importable_content)) {
642
+				$this->set_travel_info($data, $id, 'climate', $importable_content);
643 643
 			}
644 644
 			// Set the Health.
645
-			if ( false !== $importable_content && in_array( 'health', $importable_content ) ) {
646
-				$this->set_travel_info( $data, $id, 'health', $importable_content );
645
+			if (false !== $importable_content && in_array('health', $importable_content)) {
646
+				$this->set_travel_info($data, $id, 'health', $importable_content);
647 647
 			}
648 648
 			// Set the Safety.
649
-			if ( false !== $importable_content && in_array( 'safety', $importable_content ) ) {
650
-				$this->set_travel_info( $data, $id, 'safety', $importable_content );
649
+			if (false !== $importable_content && in_array('safety', $importable_content)) {
650
+				$this->set_travel_info($data, $id, 'safety', $importable_content);
651 651
 			}
652 652
 			// Set the Visa.
653
-			if ( false !== $importable_content && in_array( 'visa', $importable_content ) ) {
654
-				$this->set_travel_info( $data, $id, 'visa', $importable_content );
653
+			if (false !== $importable_content && in_array('visa', $importable_content)) {
654
+				$this->set_travel_info($data, $id, 'visa', $importable_content);
655 655
 			}
656 656
 			// Set the General.
657
-			if ( false !== $importable_content && in_array( 'additional_info', $importable_content ) ) {
658
-				$this->set_travel_info( $data, $id, 'additional_info', $importable_content );
657
+			if (false !== $importable_content && in_array('additional_info', $importable_content)) {
658
+				$this->set_travel_info($data, $id, 'additional_info', $importable_content);
659 659
 			}
660 660
 
661 661
 			// Setup some default for use in the import.
662
-			if ( false !== $importable_content && (in_array( 'gallery', $importable_content ) || in_array( 'banner_image', $importable_content ) || in_array( 'featured_image', $importable_content )) ) {
663
-				$this->find_attachments( $id );
662
+			if (false !== $importable_content && (in_array('gallery', $importable_content) || in_array('banner_image', $importable_content) || in_array('featured_image', $importable_content))) {
663
+				$this->find_attachments($id);
664 664
 
665 665
 				// Set the featured image.
666
-				if ( false !== $importable_content && in_array( 'featured_image', $importable_content ) ) {
667
-					$this->set_featured_image( $data, $id );
666
+				if (false !== $importable_content && in_array('featured_image', $importable_content)) {
667
+					$this->set_featured_image($data, $id);
668 668
 				}
669
-				if ( false !== $importable_content && in_array( 'banner_image', $importable_content ) ) {
670
-					$this->set_banner_image( $data, $id, $importable_content );
669
+				if (false !== $importable_content && in_array('banner_image', $importable_content)) {
670
+					$this->set_banner_image($data, $id, $importable_content);
671 671
 				}
672 672
 				// Import the main gallery.
673
-				if ( false !== $importable_content && in_array( 'gallery', $importable_content ) ) {
674
-					$this->create_main_gallery( $data, $id );
673
+				if (false !== $importable_content && in_array('gallery', $importable_content)) {
674
+					$this->create_main_gallery($data, $id);
675 675
 				}
676 676
 			}
677 677
 
678 678
 			// Set the continent.
679
-			if ( false !== $importable_content && in_array( 'continent', $importable_content ) ) {
680
-				$this->set_continent( $data, $id );
679
+			if (false !== $importable_content && in_array('continent', $importable_content)) {
680
+				$this->set_continent($data, $id);
681 681
 			}
682 682
 		}
683 683
 
@@ -687,48 +687,48 @@  discard block
 block discarded – undo
687 687
 	/**
688 688
 	 * Set the team memberon each item.
689 689
 	 */
690
-	public function set_team_member( $id, $team_members ) {
691
-		delete_post_meta( $id, 'team_to_' . $this->tab_slug );
690
+	public function set_team_member($id, $team_members) {
691
+		delete_post_meta($id, 'team_to_'.$this->tab_slug);
692 692
 
693
-		foreach ( $team_members as $team ) {
694
-			add_post_meta( $id, 'team_to_' . $this->tab_slug, $team );
693
+		foreach ($team_members as $team) {
694
+			add_post_meta($id, 'team_to_'.$this->tab_slug, $team);
695 695
 		}
696 696
 	}
697 697
 
698 698
 	/**
699 699
 	 * Saves the room data
700 700
 	 */
701
-	public function set_travel_info( $data, $id, $meta_key, $importable = array( 'none' ) ) {
702
-		if ( ! empty( $data[0]['travel_information'] ) && isset( $data[0]['travel_information'][ $meta_key ] ) ) {
703
-			$content = $data[0]['travel_information'][ $meta_key ];
701
+	public function set_travel_info($data, $id, $meta_key, $importable = array('none')) {
702
+		if (!empty($data[0]['travel_information']) && isset($data[0]['travel_information'][$meta_key])) {
703
+			$content = $data[0]['travel_information'][$meta_key];
704 704
 
705
-			if ( in_array( 'strip_tags', $importable ) ) {
706
-				$content = strip_tags( $content );
705
+			if (in_array('strip_tags', $importable)) {
706
+				$content = strip_tags($content);
707 707
 			}
708 708
 
709
-			$this->save_custom_field( $content, $meta_key, $id );
709
+			$this->save_custom_field($content, $meta_key, $id);
710 710
 		}
711 711
 	}
712 712
 
713 713
 	/**
714 714
 	 * Set the Travel Style
715 715
 	 */
716
-	public function set_continent( $data, $id ) {
716
+	public function set_continent($data, $id) {
717 717
 
718
-		if ( isset( $data[0]['position']['country'] ) && $data[0]['map_object_id'] === $data[0]['position']['country_content_entity_id'] ) {
718
+		if (isset($data[0]['position']['country']) && $data[0]['map_object_id'] === $data[0]['position']['country_content_entity_id']) {
719 719
 			//get the continent code.
720
-			$continent_code = to_continent_label( to_continent_code( to_country_data( $data[0]['position']['country'], false ) ) );
720
+			$continent_code = to_continent_label(to_continent_code(to_country_data($data[0]['position']['country'], false)));
721 721
 
722
-			if ( '' !== $continent_code ) {
723
-				$term = term_exists( trim( $continent_code ), 'continent' );
724
-				if ( ! $term ) {
725
-					$term = wp_insert_term( trim( $continent_code ), 'continent' );
722
+			if ('' !== $continent_code) {
723
+				$term = term_exists(trim($continent_code), 'continent');
724
+				if (!$term) {
725
+					$term = wp_insert_term(trim($continent_code), 'continent');
726 726
 
727
-					if ( is_wp_error( $term ) ) {
728
-						echo wp_kses_post( $term->get_error_message() );
727
+					if (is_wp_error($term)) {
728
+						echo wp_kses_post($term->get_error_message());
729 729
 					}
730
-				} else {
731
-					wp_set_object_terms( $id, sanitize_title( $continent_code ), 'continent', true );
730
+				}else {
731
+					wp_set_object_terms($id, sanitize_title($continent_code), 'continent', true);
732 732
 				}
733 733
 			}
734 734
 		}
@@ -738,14 +738,14 @@  discard block
 block discarded – undo
738 738
 	 * Save the list of Accommodation into an option
739 739
 	 */
740 740
 	public function update_options() {
741
-		$data = file_get_contents( $this->url . '/List?' . $this->url_qs );
741
+		$data = file_get_contents($this->url.'/List?'.$this->url_qs);
742 742
 
743
-		$accommodation = json_decode( $data, true );
743
+		$accommodation = json_decode($data, true);
744 744
 
745
-		if ( isset( $accommodation['error'] ) ) {
745
+		if (isset($accommodation['error'])) {
746 746
 			return $accommodation['error'];
747
-		} elseif ( isset( $accommodation ) && ! empty( $accommodation ) ) {
748
-			set_transient( 'lsx_ti_accommodation', $accommodation,60 * 60 * 2 );
747
+		} elseif (isset($accommodation) && !empty($accommodation)) {
748
+			set_transient('lsx_ti_accommodation', $accommodation, 60 * 60 * 2);
749 749
 			return true;
750 750
 		}
751 751
 	}
@@ -754,11 +754,11 @@  discard block
 block discarded – undo
754 754
 	 * search_form
755 755
 	 */
756 756
 	public function update_options_form() {
757
-		echo '<div style="display:none;" class="wetu-status"><h3>' . esc_html__( 'Wetu Status', 'lsx-wetu-importer' ) . '</h3>';
757
+		echo '<div style="display:none;" class="wetu-status"><h3>'.esc_html__('Wetu Status', 'lsx-wetu-importer').'</h3>';
758 758
 
759
-		$accommodation = get_transient( 'lsx_ti_accommodation' );
759
+		$accommodation = get_transient('lsx_ti_accommodation');
760 760
 
761
-		if ( '' === $accommodation || false === $accommodation || isset( $_GET['refresh_accommodation'] ) ) {
761
+		if ('' === $accommodation || false === $accommodation || isset($_GET['refresh_accommodation'])) {
762 762
 			$this->update_options();
763 763
 		}
764 764
 
@@ -768,12 +768,12 @@  discard block
 block discarded – undo
768 768
 	/**
769 769
 	 * Save the list of Accommodation into an option
770 770
 	 */
771
-	public function check_for_parent( $data = array() ) {
771
+	public function check_for_parent($data = array()) {
772 772
 		global $wpdb;
773 773
 
774
-		if ( $data[0]['position']['country_content_entity_id'] !== $data[0]['position']['destination_content_entity_id'] ) {
775
-			$result = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'lsx_wetu_id' AND meta_value = '%s'", array( $data[0]['position']['country_content_entity_id'] ) ) );
776
-			if ( ! empty( $result ) && '' !== $result && false !== $result ) {
774
+		if ($data[0]['position']['country_content_entity_id'] !== $data[0]['position']['destination_content_entity_id']) {
775
+			$result = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'lsx_wetu_id' AND meta_value = '%s'", array($data[0]['position']['country_content_entity_id'])));
776
+			if (!empty($result) && '' !== $result && false !== $result) {
777 777
 				return $result;
778 778
 			}
779 779
 		}
Please login to merge, or discard this patch.