Completed
Push — master ( 59f15b...3574d6 )
by Warwick
03:27
created
classes/class-accommodation.php 1 patch
Indentation   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function set_variables()
72 72
 	{
73
-	    parent::set_variables();
73
+		parent::set_variables();
74 74
 		// ** This request only works with API KEY **
75 75
 		//if ( false !== $this->api_username && false !== $this->api_password ) {
76 76
 		//	$this->url    = 'https://wetu.com/API/Pins/';
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * Display the importer administration screen
96 96
 	 */
97 97
 	public function display_page() {
98
-        ?>
98
+		?>
99 99
         <div class="wrap">
100 100
             <?php $this->navigation('accommodation'); ?>
101 101
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 		$accommodation = json_decode($data, true);
237 237
 
238 238
 		if(isset($accommodation['error'])){
239
-		    return $accommodation['error'];
240
-        }elseif (isset($accommodation) && !empty($accommodation)) {
239
+			return $accommodation['error'];
240
+		}elseif (isset($accommodation) && !empty($accommodation)) {
241 241
 			set_transient('lsx_ti_accommodation',$accommodation,60*60*2);
242 242
 			return true;
243 243
 		}
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 			$accommodation = get_transient('lsx_ti_accommodation');
254 254
 
255 255
 			if(false === $accommodation){
256
-			    $this->update_options();
257
-            }
256
+				$this->update_options();
257
+			}
258 258
 
259 259
 			if ( false !== $accommodation ) {
260 260
 				$searched_items = false;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 					$keyphrases = $_POST['keyword'];
264 264
 				}else{
265 265
 					$keyphrases = array(0);
266
-                }
266
+				}
267 267
 
268 268
 				if(!is_array($keyphrases)){
269 269
 					$keyphrases = array($keyphrases);
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 
305 305
 							if('import' === $post_status){
306 306
 
307
-							    if(is_array($this->queued_imports) && in_array($row['post_id'],$this->queued_imports)){
307
+								if(is_array($this->queued_imports) && in_array($row['post_id'],$this->queued_imports)){
308 308
 									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
309
-                                }else{
310
-							        continue;
311
-                                }
309
+								}else{
310
+									continue;
311
+								}
312 312
 
313 313
 							}else{
314 314
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	 * Saves the queue to the option.
388 388
 	 */
389 389
 	public function remove_from_queue($id) {
390
-        if (!empty($this->queued_imports)) {
390
+		if (!empty($this->queued_imports)) {
391 391
 
392 392
 			if(($key = array_search($id, $this->queued_imports)) !== false) {
393 393
 				unset($this->queued_imports[$key]);
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 				delete_option('wetu_importer_que');
396 396
 				update_option('wetu_importer_que',$this->queued_imports);
397 397
 			}
398
-        }
398
+		}
399 399
 	}
400 400
 
401 401
 	/**
@@ -434,18 +434,18 @@  discard block
 block discarded – undo
434 434
 				$content = false;
435 435
 			}
436 436
 
437
-            $jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
438
-            if($jdata)
439
-            {
440
-                $adata=json_decode($jdata,true);
441
-                if(!empty($adata))
442
-                {
443
-                	$return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands);
444
-                	$this->format_completed_row($return);
445
-                	$this->remove_from_queue($return);
437
+			$jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
438
+			if($jdata)
439
+			{
440
+				$adata=json_decode($jdata,true);
441
+				if(!empty($adata))
442
+				{
443
+					$return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands);
444
+					$this->format_completed_row($return);
445
+					$this->remove_from_queue($return);
446 446
 					$this->cleanup_posts();
447
-                }
448
-            }
447
+				}
448
+			}
449 449
 		}
450 450
 	}
451 451
 
@@ -454,144 +454,144 @@  discard block
 block discarded – undo
454 454
 	 */
455 455
 	public function import_row($data,$wetu_id,$id=0,$team_members=false,$importable_content=false,$safari_brands=false) {
456 456
 
457
-	        $post_name = $data_post_content = $data_post_excerpt = '';
458
-	        $post = array(
459
-	          'post_type'		=> 'accommodation',
460
-	        );
461
-
462
-	        $content_used_general_description = false;
463
-
464
-	        //Set the post_content
465
-	        if(false !== $importable_content && in_array('description',$importable_content)){
466
-		        if(isset($data[0]['content']['extended_description']))
467
-		        {
468
-		            $data_post_content = $data[0]['content']['extended_description'];
469
-		        }elseif(isset($data[0]['content']['general_description'])){
470
-		            $data_post_content = $data[0]['content']['general_description'];
471
-		            $content_used_general_description = true;
472
-		        }elseif(isset($data[0]['content']['teaser_description'])){
473
-		        	$data_post_content = $data[0]['content']['teaser_description'];
474
-		        }
475
-	        	$post['post_content'] = wp_strip_all_tags($data_post_content);
476
-	        }
477
-
478
-	        //set the post_excerpt
479
-	        if(false !== $importable_content && in_array('excerpt',$importable_content)){
480
-		        if(isset($data[0]['content']['teaser_description'])){
481
-		        	$data_post_excerpt = $data[0]['content']['teaser_description'];
482
-		        }elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){
483
-		            $data_post_excerpt = $data[0]['content']['general_description'];
484
-		        }	   
485
-		        $post['post_excerpt'] = $data_post_excerpt;     	
486
-	        }
487
-
488
-	        if(false !== $id && '0' !== $id){
489
-	        	$post['ID'] = $id;
457
+			$post_name = $data_post_content = $data_post_excerpt = '';
458
+			$post = array(
459
+			  'post_type'		=> 'accommodation',
460
+			);
461
+
462
+			$content_used_general_description = false;
463
+
464
+			//Set the post_content
465
+			if(false !== $importable_content && in_array('description',$importable_content)){
466
+				if(isset($data[0]['content']['extended_description']))
467
+				{
468
+					$data_post_content = $data[0]['content']['extended_description'];
469
+				}elseif(isset($data[0]['content']['general_description'])){
470
+					$data_post_content = $data[0]['content']['general_description'];
471
+					$content_used_general_description = true;
472
+				}elseif(isset($data[0]['content']['teaser_description'])){
473
+					$data_post_content = $data[0]['content']['teaser_description'];
474
+				}
475
+				$post['post_content'] = wp_strip_all_tags($data_post_content);
476
+			}
477
+
478
+			//set the post_excerpt
479
+			if(false !== $importable_content && in_array('excerpt',$importable_content)){
480
+				if(isset($data[0]['content']['teaser_description'])){
481
+					$data_post_excerpt = $data[0]['content']['teaser_description'];
482
+				}elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){
483
+					$data_post_excerpt = $data[0]['content']['general_description'];
484
+				}	   
485
+				$post['post_excerpt'] = $data_post_excerpt;     	
486
+			}
487
+
488
+			if(false !== $id && '0' !== $id){
489
+				$post['ID'] = $id;
490 490
 				if(isset($data[0]['name'])){
491 491
 					$post['post_title'] = $data[0]['name'];
492
-	        		$post['post_status'] = 'publish';
492
+					$post['post_status'] = 'publish';
493 493
 					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
494 494
 				}
495
-	        	$id = wp_update_post($post);
496
-	        	$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
497
-	        	update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date);
498
-	        }else{
499
-
500
-		        //Set the name
501
-		        if(isset($data[0]['name'])){
502
-		            $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
503
-		        }
504
-	        	$post['post_name'] = $post_name;
505
-	        	$post['post_title'] = $data[0]['name'];
506
-	        	$post['post_status'] = 'publish';
507
-	        	$id = wp_insert_post($post);
508
-
509
-	        	//Save the WETU ID and the Last date it was modified.
510
-	        	if(false !== $id){
511
-	        		add_post_meta($id,'lsx_wetu_id',$wetu_id);
512
-	        		add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']));
513
-	        	}
514
-	        }
515
-	        //Setup some default for use in the import
516
-	        if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){
495
+				$id = wp_update_post($post);
496
+				$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
497
+				update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date);
498
+			}else{
499
+
500
+				//Set the name
501
+				if(isset($data[0]['name'])){
502
+					$post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
503
+				}
504
+				$post['post_name'] = $post_name;
505
+				$post['post_title'] = $data[0]['name'];
506
+				$post['post_status'] = 'publish';
507
+				$id = wp_insert_post($post);
508
+
509
+				//Save the WETU ID and the Last date it was modified.
510
+				if(false !== $id){
511
+					add_post_meta($id,'lsx_wetu_id',$wetu_id);
512
+					add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']));
513
+				}
514
+			}
515
+			//Setup some default for use in the import
516
+			if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){
517 517
 				$this->find_attachments($id);
518 518
 			}
519 519
 
520
-	        //Set the team member if it is there
521
-	        if(post_type_exists('team') && false !== $team_members && '' !== $team_members){
522
-	        	$this->set_team_member($id,$team_members);
523
-	    	}
524
-
525
-	        //Set the safari brand
526
-	        if(false !== $safari_brands && '' !== $safari_brands){
527
-	        	$this->set_safari_brands($id,$safari_brands);
528
-
529
-	    	}	    	
530
-
531
-	        if(class_exists('LSX_TO_Maps')){
532
-	        	$this->set_map_data($data,$id,9);
533
-	        }
534
-
535
-	        if(post_type_exists('destination') && false !== $importable_content && in_array('destination',$importable_content)){
536
-	        	$this->connect_destinations($data,$id);
537
-	        }
538
-
539
-	        if(false !== $importable_content && in_array('category',$importable_content)){
540
-	        	$this->set_taxonomy_style($data,$id);
541
-	        }
542
-
543
-	        //Set the Room Data
544
-	        if(false !== $importable_content && in_array('rooms',$importable_content)){
545
-	        	$this->set_room_data($data,$id);
546
-	    	}
547
-
548
-	    	//Set the rating
549
-	    	if(false !== $importable_content && in_array('rating',$importable_content)){
550
-	       		$this->set_rating($data,$id);
551
-	    	}
552
-
553
-	    	//Set the checkin checkout data
554
-	    	if(false !== $importable_content && in_array('checkin',$importable_content)){
555
-	        	$this->set_checkin_checkout($data,$id);
556
-	        }
557
-
558
-	    	//Set the Spoken Languages
559
-	    	if(false !== $importable_content && in_array('spoken_languages',$importable_content)){
560
-	       		$this->set_spoken_languages($data,$id);
561
-	    	}
562
-
563
-	    	//Set the friendly options
564
-	    	if(false !== $importable_content && in_array('friendly',$importable_content)){
565
-	       		$this->set_friendly($data,$id);
566
-	    	}
567
-
568
-	    	//Set the special_interests
569
-	    	if(false !== $importable_content && in_array('special_interests',$importable_content)){
570
-	       		$this->set_special_interests($data,$id);
571
-	    	}	    		    		        
572
-
573
-	        //Import the videos
574
-	        if(false !== $importable_content && in_array('videos',$importable_content)){
575
-	        	$this->set_video_data($data,$id);
576
-	        }
577
-
578
-	        //Import the facilities
579
-	        if(false !== $importable_content && in_array('facilities',$importable_content)){
580
-	        	$this->set_facilities($data,$id);
581
-	        }	        
582
-
583
-	        //Set the featured image
584
-	        if(false !== $importable_content && in_array('featured_image',$importable_content)){
585
-	        	$this->set_featured_image($data,$id);
586
-	        }
587
-	        if(false !== $importable_content && in_array('banner_image',$importable_content)){
588
-	        	$this->set_banner_image($data,$id);
589
-	        }	        
590
-	        //Import the main gallery
591
-	        if(false !== $importable_content && in_array('gallery',$importable_content)){	    	
592
-	    		$this->create_main_gallery($data,$id);
593
-	        }
594
-        return $id;
520
+			//Set the team member if it is there
521
+			if(post_type_exists('team') && false !== $team_members && '' !== $team_members){
522
+				$this->set_team_member($id,$team_members);
523
+			}
524
+
525
+			//Set the safari brand
526
+			if(false !== $safari_brands && '' !== $safari_brands){
527
+				$this->set_safari_brands($id,$safari_brands);
528
+
529
+			}	    	
530
+
531
+			if(class_exists('LSX_TO_Maps')){
532
+				$this->set_map_data($data,$id,9);
533
+			}
534
+
535
+			if(post_type_exists('destination') && false !== $importable_content && in_array('destination',$importable_content)){
536
+				$this->connect_destinations($data,$id);
537
+			}
538
+
539
+			if(false !== $importable_content && in_array('category',$importable_content)){
540
+				$this->set_taxonomy_style($data,$id);
541
+			}
542
+
543
+			//Set the Room Data
544
+			if(false !== $importable_content && in_array('rooms',$importable_content)){
545
+				$this->set_room_data($data,$id);
546
+			}
547
+
548
+			//Set the rating
549
+			if(false !== $importable_content && in_array('rating',$importable_content)){
550
+		   		$this->set_rating($data,$id);
551
+			}
552
+
553
+			//Set the checkin checkout data
554
+			if(false !== $importable_content && in_array('checkin',$importable_content)){
555
+				$this->set_checkin_checkout($data,$id);
556
+			}
557
+
558
+			//Set the Spoken Languages
559
+			if(false !== $importable_content && in_array('spoken_languages',$importable_content)){
560
+		   		$this->set_spoken_languages($data,$id);
561
+			}
562
+
563
+			//Set the friendly options
564
+			if(false !== $importable_content && in_array('friendly',$importable_content)){
565
+		   		$this->set_friendly($data,$id);
566
+			}
567
+
568
+			//Set the special_interests
569
+			if(false !== $importable_content && in_array('special_interests',$importable_content)){
570
+		   		$this->set_special_interests($data,$id);
571
+			}	    		    		        
572
+
573
+			//Import the videos
574
+			if(false !== $importable_content && in_array('videos',$importable_content)){
575
+				$this->set_video_data($data,$id);
576
+			}
577
+
578
+			//Import the facilities
579
+			if(false !== $importable_content && in_array('facilities',$importable_content)){
580
+				$this->set_facilities($data,$id);
581
+			}	        
582
+
583
+			//Set the featured image
584
+			if(false !== $importable_content && in_array('featured_image',$importable_content)){
585
+				$this->set_featured_image($data,$id);
586
+			}
587
+			if(false !== $importable_content && in_array('banner_image',$importable_content)){
588
+				$this->set_banner_image($data,$id);
589
+			}	        
590
+			//Import the main gallery
591
+			if(false !== $importable_content && in_array('gallery',$importable_content)){	    	
592
+				$this->create_main_gallery($data,$id);
593
+			}
594
+		return $id;
595 595
 	}
596 596
 
597 597
 	/**
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
 		delete_post_meta($id, 'team_to_'.$this->tab_slug);
603 603
 		foreach($team_members as $team){
604
-        	add_post_meta($id,'team_to_'.$this->tab_slug,$team);			
604
+			add_post_meta($id,'team_to_'.$this->tab_slug,$team);			
605 605
 		}
606 606
 	}
607 607
 
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 	 */
611 611
 	public function set_safari_brands($id,$safari_brands) {
612 612
 		foreach($safari_brands as $safari_brand){
613
-        	wp_set_object_terms( $id, intval($safari_brand), 'accommodation-brand',true);			
613
+			wp_set_object_terms( $id, intval($safari_brand), 'accommodation-brand',true);			
614 614
 		}
615 615
 	}
616 616
 
@@ -619,32 +619,32 @@  discard block
 block discarded – undo
619 619
 	 */
620 620
 	public function connect_destinations($data,$id) {
621 621
 		if(isset($data[0]['position'])){
622
-		    $destinations = false;
623
-		    if(isset($data[0]['position']['country'])){
624
-		    	$destinations['country'] = $data[0]['position']['country'];
625
-		    }
626
-		    if(isset($data[0]['position']['destination'])){
627
-		    	$destinations['destination'] = $data[0]['position']['destination'];
628
-		    }
622
+			$destinations = false;
623
+			if(isset($data[0]['position']['country'])){
624
+				$destinations['country'] = $data[0]['position']['country'];
625
+			}
626
+			if(isset($data[0]['position']['destination'])){
627
+				$destinations['destination'] = $data[0]['position']['destination'];
628
+			}
629 629
 		    
630
-		    if(false !== $destinations){	
631
-		    	$prev_values = get_post_meta($id,'destination_to_accommodation',false);
632
-		    	if(false === $prev_values || !is_array($prev_values)){
633
-		    		$prev_values = array();
634
-		    	}
635
-		    	//print_r($destinations);
630
+			if(false !== $destinations){	
631
+				$prev_values = get_post_meta($id,'destination_to_accommodation',false);
632
+				if(false === $prev_values || !is_array($prev_values)){
633
+					$prev_values = array();
634
+				}
635
+				//print_r($destinations);
636 636
 				$destinations = array_unique($destinations);
637 637
 				//print_r($destinations);
638
-			    foreach($destinations as $key => $value){
639
-				    $destination = get_page_by_title(ltrim(rtrim($value)), 'OBJECT', 'destination');
640
-	                if (null !== $destination) {
641
-	                	if(!in_array($destination->ID,$prev_values)){
642
-	                   		add_post_meta($id,'destination_to_accommodation',$destination->ID,false);
643
-	                   		add_post_meta($destination->ID,'accommodation_to_destination',$id,false);
638
+				foreach($destinations as $key => $value){
639
+					$destination = get_page_by_title(ltrim(rtrim($value)), 'OBJECT', 'destination');
640
+					if (null !== $destination) {
641
+						if(!in_array($destination->ID,$prev_values)){
642
+					   		add_post_meta($id,'destination_to_accommodation',$destination->ID,false);
643
+					   		add_post_meta($destination->ID,'accommodation_to_destination',$id,false);
644 644
 							$this->cleanup_posts[$destination->ID] = 'accommodation_to_destination';
645
-	                	}
646
-	                } 		    	
647
-			    }	
645
+						}
646
+					} 		    	
647
+				}	
648 648
 			}
649 649
 		}
650 650
 	}	
@@ -656,15 +656,15 @@  discard block
 block discarded – undo
656 656
 		$terms = false;
657 657
 		if(isset($data[0]['category'])){
658 658
 			if(!$term = term_exists(trim($data[0]['category']), 'accommodation-type'))
659
-	        {
660
-	            $term = wp_insert_term(trim($data[0]['category']), 'accommodation-type');
661
-	            if ( is_wp_error($term) ){echo $term->get_error_message();}
662
-	            else { wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true); }
663
-	        }
664
-	        else
665
-	        {
666
-	            wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true);
667
-	        }				
659
+			{
660
+				$term = wp_insert_term(trim($data[0]['category']), 'accommodation-type');
661
+				if ( is_wp_error($term) ){echo $term->get_error_message();}
662
+				else { wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true); }
663
+			}
664
+			else
665
+			{
666
+				wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true);
667
+			}				
668 668
 		}
669 669
 	}		
670 670
 
@@ -688,25 +688,25 @@  discard block
 block discarded – undo
688 688
 				$temp_room['type'] = 'room';
689 689
 
690 690
 				if(!empty($room['images']) && is_array($room['images'])){
691
-			    	$attachments_args = array(
692
-			    			'post_parent' => $id,
693
-			    			'post_status' => 'inherit',
694
-			    			'post_type' => 'attachment',
695
-			    			'order' => 'ASC',
696
-			    	);   	
697
-			    	$attachments = new WP_Query($attachments_args);
698
-			    	$found_attachments = array();
699
-
700
-			    	if($attachments->have_posts()){
701
-			    		foreach($attachments->posts as $attachment){
702
-			    			$found_attachments[] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title);
703
-			    		}
704
-			    	}
691
+					$attachments_args = array(
692
+							'post_parent' => $id,
693
+							'post_status' => 'inherit',
694
+							'post_type' => 'attachment',
695
+							'order' => 'ASC',
696
+					);   	
697
+					$attachments = new WP_Query($attachments_args);
698
+					$found_attachments = array();
699
+
700
+					if($attachments->have_posts()){
701
+						foreach($attachments->posts as $attachment){
702
+							$found_attachments[] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title);
703
+						}
704
+					}
705 705
 
706 706
 					$temp_room['gallery'] = array();
707 707
 					foreach($room['images'] as $image_data){
708
-			    		$temp_room['gallery'][] = $this->attach_image($image_data,$id,$found_attachments);
709
-			    	}
708
+						$temp_room['gallery'][] = $this->attach_image($image_data,$id,$found_attachments);
709
+					}
710 710
 				}
711 711
 				$rooms[] = $temp_room;
712 712
 			}
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 				delete_post_meta($id, 'units');				
716 716
 			}
717 717
 			foreach($rooms as $room){
718
-		        add_post_meta($id,'units',$room,false);			
718
+				add_post_meta($id,'units',$room,false);			
719 719
 			}
720 720
 
721 721
 			if(isset($data[0]['features']) && isset($data[0]['features']['rooms'])){
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 			}
726 726
 
727 727
 			if(false !== $id && '0' !== $id){
728
-	        	$prev_rooms = get_post_meta($id,'number_of_rooms',true);
729
-	        	update_post_meta($id,'number_of_rooms',$room_count,$prev_rooms);
730
-	        }else{
731
-	        	add_post_meta($id,'number_of_rooms',$room_count,true);
732
-	        }
728
+				$prev_rooms = get_post_meta($id,'number_of_rooms',true);
729
+				update_post_meta($id,'number_of_rooms',$room_count,$prev_rooms);
730
+			}else{
731
+				add_post_meta($id,'number_of_rooms',$room_count,true);
732
+			}
733 733
 		}
734 734
 	}
735 735
 
Please login to merge, or discard this patch.
classes/class-destination.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -469,12 +469,12 @@
 block discarded – undo
469 469
 					$this->remove_from_queue($return);
470 470
 					$this->format_completed_row($return);
471 471
 				}else{
472
-				    if(isset($adata['error'])){
473
-				        $this->format_error($adata['error']);
474
-                    }else{
472
+					if(isset($adata['error'])){
473
+						$this->format_error($adata['error']);
474
+					}else{
475 475
 						$this->format_error(esc_html__('There was a problem importing your destination.','wet-importer'));
476
-                    }
477
-                }
476
+					}
477
+				}
478 478
 			}
479 479
 		}
480 480
 	}
Please login to merge, or discard this patch.
classes/class-importer.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
 			$this->api_username = false;
211 211
 			$this->api_password = false;
212 212
 
213
-            if (isset($temp_options['api']['wetu_api_key']) && '' !== $temp_options['api']['wetu_api_key']) {
214
-                $this->api_key = $temp_options['api']['wetu_api_key'];
215
-            }
216
-            if (isset($temp_options['api']['wetu_api_username']) && '' !== $temp_options['api']['wetu_api_username']) {
217
-                $this->api_username = $temp_options['api']['wetu_api_username'];
218
-            }
219
-            if (isset($temp_options['api']['wetu_api_password']) && '' !== $temp_options['api']['wetu_api_password']) {
220
-                $this->api_password = $temp_options['api']['wetu_api_password'];
221
-            }
213
+			if (isset($temp_options['api']['wetu_api_key']) && '' !== $temp_options['api']['wetu_api_key']) {
214
+				$this->api_key = $temp_options['api']['wetu_api_key'];
215
+			}
216
+			if (isset($temp_options['api']['wetu_api_username']) && '' !== $temp_options['api']['wetu_api_username']) {
217
+				$this->api_username = $temp_options['api']['wetu_api_username'];
218
+			}
219
+			if (isset($temp_options['api']['wetu_api_password']) && '' !== $temp_options['api']['wetu_api_password']) {
220
+				$this->api_password = $temp_options['api']['wetu_api_password'];
221
+			}
222 222
 
223 223
 			//Set the tab slug
224 224
 			if(isset($_GET['tab']) || isset($_POST['type'])) {
@@ -234,22 +234,22 @@  discard block
 block discarded – undo
234 234
 			}
235 235
 
236 236
 			//Set the scaling options
237
-            if (isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug]) && isset($this->options['image_scaling'])) {
238
-                $this->scale_images = true;
239
-                $width = '800';
240
-                if (isset($this->options['width']) && '' !== $this->options['width']) {
241
-                    $width = $this->options['width'];
242
-                }
243
-                $height = '600';
244
-                if (isset($this->options['height']) && '' !== $this->options['height']) {
245
-                    $height = $this->options['height'];
246
-                }
247
-                $cropping = 'raw';
248
-                if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
249
-                    $cropping = $this->options['cropping'];
250
-                }
251
-                $this->image_scaling_url = 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
252
-            }
237
+			if (isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug]) && isset($this->options['image_scaling'])) {
238
+				$this->scale_images = true;
239
+				$width = '800';
240
+				if (isset($this->options['width']) && '' !== $this->options['width']) {
241
+					$width = $this->options['width'];
242
+				}
243
+				$height = '600';
244
+				if (isset($this->options['height']) && '' !== $this->options['height']) {
245
+					$height = $this->options['height'];
246
+				}
247
+				$cropping = 'raw';
248
+				if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
249
+					$cropping = $this->options['cropping'];
250
+				}
251
+				$this->image_scaling_url = 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
252
+			}
253 253
 
254 254
 		}
255 255
 	}
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 
324 324
 	// DISPLAY FUNCTIONS
325 325
 
326
-    /*
326
+	/*
327 327
      * Load the importer class you want to use
328 328
      */
329
-    public function load_class(){
329
+	public function load_class(){
330 330
 
331 331
 		switch($this->tab_slug){
332 332
 			case 'accommodation':
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 				break;
347 347
 		}
348 348
 
349
-    }
349
+	}
350 350
 
351 351
 	/**
352 352
 	 * Registers the admin page which will house the importer form.
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 				<?php*/
403 403
 			}else{
404 404
 			   $this->current_importer->display_page();
405
-            }; ?>
405
+			}; ?>
406 406
         </div>
407 407
 		<?php
408 408
 	}
@@ -802,12 +802,12 @@  discard block
 block discarded – undo
802 802
 	 */
803 803
 	public function set_featured_image($data,$id) {
804 804
 		if(is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])){
805
-		    if('tour' === $this->tab_slug){
806
-		        $key = array_rand($data[0]['content']['images']);
807
-                $this->featured_image = $this->attach_image($data[0]['content']['images'][$key],$id);
808
-            }else{
805
+			if('tour' === $this->tab_slug){
806
+				$key = array_rand($data[0]['content']['images']);
807
+				$this->featured_image = $this->attach_image($data[0]['content']['images'][$key],$id);
808
+			}else{
809 809
 				$this->featured_image = $this->attach_image($data[0]['content']['images'][0],$id);
810
-            }
810
+			}
811 811
 
812 812
 
813 813
 			if(false !== $this->featured_image){
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	public function set_banner_image($data,$id) {
829 829
 		if(is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])){
830
-		    if(isset($data[0]['destination_image']) && is_array($data[0]['destination_image'])) {
830
+			if(isset($data[0]['destination_image']) && is_array($data[0]['destination_image'])) {
831 831
 				$temp_banner = $this->attach_image($data[0]['destination_image'], $id, array('width' => '1920', 'height' => '600', 'cropping' => 'c'));
832 832
 			}else{
833 833
 				if ('tour' === $this->tab_slug) {
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 				} else {
837 837
 					$temp_banner = $this->attach_image($data[0]['content']['images'][1], $id, array('width' => '1920', 'height' => '600', 'cropping' => 'c'));
838 838
 				}
839
-            }
839
+			}
840 840
 
841 841
 
842 842
 			if(false !== $temp_banner){
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 	 * Run through the accommodation grabbed from the DB.
1049 1049
 	 */
1050 1050
 	public function process_ajax_search() {
1051
-	    $this->current_importer->process_ajax_search();
1051
+		$this->current_importer->process_ajax_search();
1052 1052
 		die();
1053 1053
 	}
1054 1054
 
Please login to merge, or discard this patch.