Completed
Push — master ( ef4c1a...1aafd8 )
by Warwick
07:18
created
classes/class-connect-accommodation.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 	 */
52 52
 	public function display_page() {
53 53
 		global $post;
54
-        ?>
54
+		?>
55 55
         <div class="wrap">
56 56
 
57 57
             <h3><span class="dashicons dashicons-admin-multisite"></span> <?php _e('Connect your Accommodation','wetu-importer'); ?></h3>
Please login to merge, or discard this patch.
classes/lsx-banners-integration.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * Display the importer administration screen
38 38
 	 */
39 39
 	public function display_page() {
40
-        ?>
40
+		?>
41 41
         <div class="wrap">
42 42
 			
43 43
             <h2><?php _e('Download new banners straight from WETU','wetu-importer'); ?></h2>
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 		$base = rawurlencode($base);
212 212
 	  $type = get_post_mime_type($post_id);
213 213
 	  switch ($type) {
214
-	    case 'image/jpeg':
215
-	    	return $base . ".jpg"; break;
216
-	    case 'image/png':
217
-	    	return $base . ".png"; break;
218
-	    case 'image/gif':
219
-	      	return $base . ".gif"; break;
220
-	    default:
221
-	      return false;
214
+		case 'image/jpeg':
215
+			return $base . ".jpg"; break;
216
+		case 'image/png':
217
+			return $base . ".png"; break;
218
+		case 'image/gif':
219
+		  	return $base . ".gif"; break;
220
+		default:
221
+		  return false;
222 222
 	  }
223 223
 	}	
224 224
 
Please login to merge, or discard this patch.
classes/class-accommodation.php 1 patch
Indentation   +207 added lines, -207 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);
@@ -420,17 +420,17 @@  discard block
 block discarded – undo
420 420
 				$content = false;
421 421
 			}
422 422
 
423
-            $jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
424
-            if($jdata)
425
-            {
426
-                $adata=json_decode($jdata,true);
427
-                if(!empty($adata))
428
-                {
429
-                	$return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands);
430
-                	$this->format_completed_row($return);
423
+			$jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
424
+			if($jdata)
425
+			{
426
+				$adata=json_decode($jdata,true);
427
+				if(!empty($adata))
428
+				{
429
+					$return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands);
430
+					$this->format_completed_row($return);
431 431
 					$this->cleanup_posts();
432
-                }
433
-            }
432
+				}
433
+			}
434 434
 		}
435 435
 	}
436 436
 
@@ -439,147 +439,147 @@  discard block
 block discarded – undo
439 439
 	 */
440 440
 	public function import_row($data,$wetu_id,$id=0,$team_members=false,$importable_content=false,$safari_brands=false) {
441 441
 
442
-        if(trim($data[0]['type'])=='Accommodation')
443
-        {
444
-	        $post_name = $data_post_content = $data_post_excerpt = '';
445
-	        $post = array(
446
-	          'post_type'		=> 'accommodation',
447
-	        );
448
-
449
-	        $content_used_general_description = false;
450
-
451
-	        //Set the post_content
452
-	        if(false !== $importable_content && in_array('description',$importable_content)){
453
-		        if(isset($data[0]['content']['extended_description']))
454
-		        {
455
-		            $data_post_content = $data[0]['content']['extended_description'];
456
-		        }elseif(isset($data[0]['content']['general_description'])){
457
-		            $data_post_content = $data[0]['content']['general_description'];
458
-		            $content_used_general_description = true;
459
-		        }elseif(isset($data[0]['content']['teaser_description'])){
460
-		        	$data_post_content = $data[0]['content']['teaser_description'];
461
-		        }
462
-	        	$post['post_content'] = wp_strip_all_tags($data_post_content);
463
-	        }
464
-
465
-	        //set the post_excerpt
466
-	        if(false !== $importable_content && in_array('excerpt',$importable_content)){
467
-		        if(isset($data[0]['content']['teaser_description'])){
468
-		        	$data_post_excerpt = $data[0]['content']['teaser_description'];
469
-		        }elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){
470
-		            $data_post_excerpt = $data[0]['content']['general_description'];
471
-		        }	   
472
-		        $post['post_excerpt'] = $data_post_excerpt;     	
473
-	        }
474
-
475
-	        if(false !== $id && '0' !== $id){
476
-	        	$post['ID'] = $id;
442
+		if(trim($data[0]['type'])=='Accommodation')
443
+		{
444
+			$post_name = $data_post_content = $data_post_excerpt = '';
445
+			$post = array(
446
+			  'post_type'		=> 'accommodation',
447
+			);
448
+
449
+			$content_used_general_description = false;
450
+
451
+			//Set the post_content
452
+			if(false !== $importable_content && in_array('description',$importable_content)){
453
+				if(isset($data[0]['content']['extended_description']))
454
+				{
455
+					$data_post_content = $data[0]['content']['extended_description'];
456
+				}elseif(isset($data[0]['content']['general_description'])){
457
+					$data_post_content = $data[0]['content']['general_description'];
458
+					$content_used_general_description = true;
459
+				}elseif(isset($data[0]['content']['teaser_description'])){
460
+					$data_post_content = $data[0]['content']['teaser_description'];
461
+				}
462
+				$post['post_content'] = wp_strip_all_tags($data_post_content);
463
+			}
464
+
465
+			//set the post_excerpt
466
+			if(false !== $importable_content && in_array('excerpt',$importable_content)){
467
+				if(isset($data[0]['content']['teaser_description'])){
468
+					$data_post_excerpt = $data[0]['content']['teaser_description'];
469
+				}elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){
470
+					$data_post_excerpt = $data[0]['content']['general_description'];
471
+				}	   
472
+				$post['post_excerpt'] = $data_post_excerpt;     	
473
+			}
474
+
475
+			if(false !== $id && '0' !== $id){
476
+				$post['ID'] = $id;
477 477
 				if(isset($data[0]['name'])){
478 478
 					$post['post_title'] = $data[0]['name'];
479
-	        		$post['post_status'] = 'publish';
479
+					$post['post_status'] = 'publish';
480 480
 					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
481 481
 				}
482
-	        	$id = wp_update_post($post);
483
-	        	$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
484
-	        	update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date);
485
-	        }else{
486
-
487
-		        //Set the name
488
-		        if(isset($data[0]['name'])){
489
-		            $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
490
-		        }
491
-	        	$post['post_name'] = $post_name;
492
-	        	$post['post_title'] = $data[0]['name'];
493
-	        	$post['post_status'] = 'publish';
494
-	        	$id = wp_insert_post($post);
495
-
496
-	        	//Save the WETU ID and the Last date it was modified.
497
-	        	if(false !== $id){
498
-	        		add_post_meta($id,'lsx_wetu_id',$wetu_id);
499
-	        		add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']));
500
-	        	}
501
-	        }
502
-	        //Setup some default for use in the import
503
-	        if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){
482
+				$id = wp_update_post($post);
483
+				$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
484
+				update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date);
485
+			}else{
486
+
487
+				//Set the name
488
+				if(isset($data[0]['name'])){
489
+					$post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
490
+				}
491
+				$post['post_name'] = $post_name;
492
+				$post['post_title'] = $data[0]['name'];
493
+				$post['post_status'] = 'publish';
494
+				$id = wp_insert_post($post);
495
+
496
+				//Save the WETU ID and the Last date it was modified.
497
+				if(false !== $id){
498
+					add_post_meta($id,'lsx_wetu_id',$wetu_id);
499
+					add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']));
500
+				}
501
+			}
502
+			//Setup some default for use in the import
503
+			if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){
504 504
 				$this->find_attachments($id);
505 505
 			}
506 506
 
507
-	        //Set the team member if it is there
508
-	        if(post_type_exists('team') && false !== $team_members && '' !== $team_members){
509
-	        	$this->set_team_member($id,$team_members);
510
-	    	}
511
-
512
-	        //Set the safari brand
513
-	        if(false !== $safari_brands && '' !== $safari_brands){
514
-	        	$this->set_safari_brands($id,$safari_brands);
515
-
516
-	    	}	    	
517
-
518
-	        if(class_exists('LSX_TO_Maps')){
519
-	        	$this->set_map_data($data,$id,9);
520
-	        }
521
-
522
-	        if(post_type_exists('destination') && false !== $importable_content && in_array('destination',$importable_content)){
523
-	        	$this->connect_destinations($data,$id);
524
-	        }
525
-
526
-	        if(false !== $importable_content && in_array('category',$importable_content)){
527
-	        	$this->set_taxonomy_style($data,$id);
528
-	        }
529
-
530
-	        //Set the Room Data
531
-	        if(false !== $importable_content && in_array('rooms',$importable_content)){
532
-	        	$this->set_room_data($data,$id);
533
-	    	}
534
-
535
-	    	//Set the rating
536
-	    	if(false !== $importable_content && in_array('rating',$importable_content)){
537
-	       		$this->set_rating($data,$id);
538
-	    	}
539
-
540
-	    	//Set the checkin checkout data
541
-	    	if(false !== $importable_content && in_array('checkin',$importable_content)){
542
-	        	$this->set_checkin_checkout($data,$id);
543
-	        }
544
-
545
-	    	//Set the Spoken Languages
546
-	    	if(false !== $importable_content && in_array('spoken_languages',$importable_content)){
547
-	       		$this->set_spoken_languages($data,$id);
548
-	    	}
549
-
550
-	    	//Set the friendly options
551
-	    	if(false !== $importable_content && in_array('friendly',$importable_content)){
552
-	       		$this->set_friendly($data,$id);
553
-	    	}
554
-
555
-	    	//Set the special_interests
556
-	    	if(false !== $importable_content && in_array('special_interests',$importable_content)){
557
-	       		$this->set_special_interests($data,$id);
558
-	    	}	    		    		        
559
-
560
-	        //Import the videos
561
-	        if(false !== $importable_content && in_array('videos',$importable_content)){
562
-	        	$this->set_video_data($data,$id);
563
-	        }
564
-
565
-	        //Import the facilities
566
-	        if(false !== $importable_content && in_array('facilities',$importable_content)){
567
-	        	$this->set_facilities($data,$id);
568
-	        }	        
569
-
570
-	        //Set the featured image
571
-	        if(false !== $importable_content && in_array('featured_image',$importable_content)){
572
-	        	$this->set_featured_image($data,$id);
573
-	        }
574
-	        if(false !== $importable_content && in_array('banner_image',$importable_content)){
575
-	        	$this->set_banner_image($data,$id);
576
-	        }	        
577
-	        //Import the main gallery
578
-	        if(false !== $importable_content && in_array('gallery',$importable_content)){	    	
579
-	    		$this->create_main_gallery($data,$id);
580
-	        }	        	        	        
581
-        }
582
-        return $id;
507
+			//Set the team member if it is there
508
+			if(post_type_exists('team') && false !== $team_members && '' !== $team_members){
509
+				$this->set_team_member($id,$team_members);
510
+			}
511
+
512
+			//Set the safari brand
513
+			if(false !== $safari_brands && '' !== $safari_brands){
514
+				$this->set_safari_brands($id,$safari_brands);
515
+
516
+			}	    	
517
+
518
+			if(class_exists('LSX_TO_Maps')){
519
+				$this->set_map_data($data,$id,9);
520
+			}
521
+
522
+			if(post_type_exists('destination') && false !== $importable_content && in_array('destination',$importable_content)){
523
+				$this->connect_destinations($data,$id);
524
+			}
525
+
526
+			if(false !== $importable_content && in_array('category',$importable_content)){
527
+				$this->set_taxonomy_style($data,$id);
528
+			}
529
+
530
+			//Set the Room Data
531
+			if(false !== $importable_content && in_array('rooms',$importable_content)){
532
+				$this->set_room_data($data,$id);
533
+			}
534
+
535
+			//Set the rating
536
+			if(false !== $importable_content && in_array('rating',$importable_content)){
537
+		   		$this->set_rating($data,$id);
538
+			}
539
+
540
+			//Set the checkin checkout data
541
+			if(false !== $importable_content && in_array('checkin',$importable_content)){
542
+				$this->set_checkin_checkout($data,$id);
543
+			}
544
+
545
+			//Set the Spoken Languages
546
+			if(false !== $importable_content && in_array('spoken_languages',$importable_content)){
547
+		   		$this->set_spoken_languages($data,$id);
548
+			}
549
+
550
+			//Set the friendly options
551
+			if(false !== $importable_content && in_array('friendly',$importable_content)){
552
+		   		$this->set_friendly($data,$id);
553
+			}
554
+
555
+			//Set the special_interests
556
+			if(false !== $importable_content && in_array('special_interests',$importable_content)){
557
+		   		$this->set_special_interests($data,$id);
558
+			}	    		    		        
559
+
560
+			//Import the videos
561
+			if(false !== $importable_content && in_array('videos',$importable_content)){
562
+				$this->set_video_data($data,$id);
563
+			}
564
+
565
+			//Import the facilities
566
+			if(false !== $importable_content && in_array('facilities',$importable_content)){
567
+				$this->set_facilities($data,$id);
568
+			}	        
569
+
570
+			//Set the featured image
571
+			if(false !== $importable_content && in_array('featured_image',$importable_content)){
572
+				$this->set_featured_image($data,$id);
573
+			}
574
+			if(false !== $importable_content && in_array('banner_image',$importable_content)){
575
+				$this->set_banner_image($data,$id);
576
+			}	        
577
+			//Import the main gallery
578
+			if(false !== $importable_content && in_array('gallery',$importable_content)){	    	
579
+				$this->create_main_gallery($data,$id);
580
+			}	        	        	        
581
+		}
582
+		return $id;
583 583
 	}
584 584
 
585 585
 	/**
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 
590 590
 		delete_post_meta($id, 'team_to_'.$this->tab_slug);
591 591
 		foreach($team_members as $team){
592
-        	add_post_meta($id,'team_to_'.$this->tab_slug,$team);			
592
+			add_post_meta($id,'team_to_'.$this->tab_slug,$team);			
593 593
 		}
594 594
 	}
595 595
 
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 	 */
599 599
 	public function set_safari_brands($id,$safari_brands) {
600 600
 		foreach($safari_brands as $safari_brand){
601
-        	wp_set_object_terms( $id, intval($safari_brand), 'accommodation-brand',true);			
601
+			wp_set_object_terms( $id, intval($safari_brand), 'accommodation-brand',true);			
602 602
 		}
603 603
 	}
604 604
 
@@ -607,32 +607,32 @@  discard block
 block discarded – undo
607 607
 	 */
608 608
 	public function connect_destinations($data,$id) {
609 609
 		if(isset($data[0]['position'])){
610
-		    $destinations = false;
611
-		    if(isset($data[0]['position']['country'])){
612
-		    	$destinations['country'] = $data[0]['position']['country'];
613
-		    }
614
-		    if(isset($data[0]['position']['destination'])){
615
-		    	$destinations['destination'] = $data[0]['position']['destination'];
616
-		    }
610
+			$destinations = false;
611
+			if(isset($data[0]['position']['country'])){
612
+				$destinations['country'] = $data[0]['position']['country'];
613
+			}
614
+			if(isset($data[0]['position']['destination'])){
615
+				$destinations['destination'] = $data[0]['position']['destination'];
616
+			}
617 617
 		    
618
-		    if(false !== $destinations){	
619
-		    	$prev_values = get_post_meta($id,'destination_to_accommodation',false);
620
-		    	if(false === $prev_values || !is_array($prev_values)){
621
-		    		$prev_values = array();
622
-		    	}
623
-		    	//print_r($destinations);
618
+			if(false !== $destinations){	
619
+				$prev_values = get_post_meta($id,'destination_to_accommodation',false);
620
+				if(false === $prev_values || !is_array($prev_values)){
621
+					$prev_values = array();
622
+				}
623
+				//print_r($destinations);
624 624
 				$destinations = array_unique($destinations);
625 625
 				//print_r($destinations);
626
-			    foreach($destinations as $key => $value){
627
-				    $destination = get_page_by_title(ltrim(rtrim($value)), 'OBJECT', 'destination');
628
-	                if (null !== $destination) {
629
-	                	if(!in_array($destination->ID,$prev_values)){
630
-	                   		add_post_meta($id,'destination_to_accommodation',$destination->ID,false);
631
-	                   		add_post_meta($destination->ID,'accommodation_to_destination',$id,false);
626
+				foreach($destinations as $key => $value){
627
+					$destination = get_page_by_title(ltrim(rtrim($value)), 'OBJECT', 'destination');
628
+					if (null !== $destination) {
629
+						if(!in_array($destination->ID,$prev_values)){
630
+					   		add_post_meta($id,'destination_to_accommodation',$destination->ID,false);
631
+					   		add_post_meta($destination->ID,'accommodation_to_destination',$id,false);
632 632
 							$this->cleanup_posts[$destination->ID] = 'accommodation_to_destination';
633
-	                	}
634
-	                } 		    	
635
-			    }	
633
+						}
634
+					} 		    	
635
+				}	
636 636
 			}
637 637
 		}
638 638
 	}	
@@ -644,15 +644,15 @@  discard block
 block discarded – undo
644 644
 		$terms = false;
645 645
 		if(isset($data[0]['category'])){
646 646
 			if(!$term = term_exists(trim($data[0]['category']), 'accommodation-type'))
647
-	        {
648
-	            $term = wp_insert_term(trim($data[0]['category']), 'accommodation-type');
649
-	            if ( is_wp_error($term) ){echo $term->get_error_message();}
650
-	            else { wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true); }
651
-	        }
652
-	        else
653
-	        {
654
-	            wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true);
655
-	        }				
647
+			{
648
+				$term = wp_insert_term(trim($data[0]['category']), 'accommodation-type');
649
+				if ( is_wp_error($term) ){echo $term->get_error_message();}
650
+				else { wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true); }
651
+			}
652
+			else
653
+			{
654
+				wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true);
655
+			}				
656 656
 		}
657 657
 	}		
658 658
 
@@ -676,25 +676,25 @@  discard block
 block discarded – undo
676 676
 				$temp_room['type'] = 'room';
677 677
 
678 678
 				if(!empty($room['images']) && is_array($room['images'])){
679
-			    	$attachments_args = array(
680
-			    			'post_parent' => $id,
681
-			    			'post_status' => 'inherit',
682
-			    			'post_type' => 'attachment',
683
-			    			'order' => 'ASC',
684
-			    	);   	
685
-			    	$attachments = new WP_Query($attachments_args);
686
-			    	$found_attachments = array();
687
-
688
-			    	if($attachments->have_posts()){
689
-			    		foreach($attachments->posts as $attachment){
690
-			    			$found_attachments[] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title);
691
-			    		}
692
-			    	}
679
+					$attachments_args = array(
680
+							'post_parent' => $id,
681
+							'post_status' => 'inherit',
682
+							'post_type' => 'attachment',
683
+							'order' => 'ASC',
684
+					);   	
685
+					$attachments = new WP_Query($attachments_args);
686
+					$found_attachments = array();
687
+
688
+					if($attachments->have_posts()){
689
+						foreach($attachments->posts as $attachment){
690
+							$found_attachments[] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title);
691
+						}
692
+					}
693 693
 
694 694
 					$temp_room['gallery'] = array();
695 695
 					foreach($room['images'] as $image_data){
696
-			    		$temp_room['gallery'][] = $this->attach_image($image_data,$id,$found_attachments);
697
-			    	}
696
+						$temp_room['gallery'][] = $this->attach_image($image_data,$id,$found_attachments);
697
+					}
698 698
 				}
699 699
 				$rooms[] = $temp_room;
700 700
 			}
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 				delete_post_meta($id, 'units');				
704 704
 			}
705 705
 			foreach($rooms as $room){
706
-		        add_post_meta($id,'units',$room,false);			
706
+				add_post_meta($id,'units',$room,false);			
707 707
 			}
708 708
 
709 709
 			if(isset($data[0]['features']) && isset($data[0]['features']['rooms'])){
@@ -713,11 +713,11 @@  discard block
 block discarded – undo
713 713
 			}
714 714
 
715 715
 			if(false !== $id && '0' !== $id){
716
-	        	$prev_rooms = get_post_meta($id,'number_of_rooms',true);
717
-	        	update_post_meta($id,'number_of_rooms',$room_count,$prev_rooms);
718
-	        }else{
719
-	        	add_post_meta($id,'number_of_rooms',$room_count,true);
720
-	        }
716
+				$prev_rooms = get_post_meta($id,'number_of_rooms',true);
717
+				update_post_meta($id,'number_of_rooms',$room_count,$prev_rooms);
718
+			}else{
719
+				add_post_meta($id,'number_of_rooms',$room_count,true);
720
+			}
721 721
 		}
722 722
 	}
723 723
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 				delete_post_meta($id, 'videos');				
828 828
 			}
829 829
 			foreach($videos as $video){
830
-		        add_post_meta($id,'videos',$video,false);			
830
+				add_post_meta($id,'videos',$video,false);			
831 831
 			}
832 832
 		}
833 833
 	}	
Please login to merge, or discard this patch.
classes/class-tours.php 1 patch
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function set_variables()
99 99
 	{
100
-	    parent::set_variables();
100
+		parent::set_variables();
101 101
 
102 102
 		if ( false !== $this->api_username && false !== $this->api_password ) {
103 103
 			$this->url    = 'https://wetu.com/API/Itinerary/';
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * Display the importer administration screen
123 123
 	 */
124 124
 	public function display_page() {
125
-        ?>
125
+		?>
126 126
         <div class="wrap">
127 127
 			<?php $this->navigation('tour'); ?>
128 128
 
@@ -254,20 +254,20 @@  discard block
 block discarded – undo
254 254
 			$result = $this->update_options();
255 255
 
256 256
 			if(true === $result){
257
-			    echo '<span style="color:green;">'.esc_attr('Connected','wetu-importer').'</span>';
258
-                echo ' - <small><a href="#">'.esc_attr('Refresh','wetu-importer').'</a></small>';
259
-            }else{
260
-			    echo '<span style="color:red;">'.wp_kses_post($result).'</span>';
261
-            }
257
+				echo '<span style="color:green;">'.esc_attr('Connected','wetu-importer').'</span>';
258
+				echo ' - <small><a href="#">'.esc_attr('Refresh','wetu-importer').'</a></small>';
259
+			}else{
260
+				echo '<span style="color:red;">'.wp_kses_post($result).'</span>';
261
+			}
262 262
 		}else{
263 263
 			echo '<span style="color:green;">'.esc_attr('Connected','wetu-importer').'</span> - <small><a href="#">'.esc_attr('Refresh','wetu-importer').'</a></small>';
264
-        }
264
+		}
265 265
 		echo '</h3>';
266 266
 
267 267
 		$form_options = get_option('lsx_ti_tours_api_options');
268 268
 		if(false === $form_options){
269 269
 			$form_options = array(0);
270
-        }
270
+		}
271 271
 		?>
272 272
         <form method="get" class="tour-refresh-form" action="<?php echo admin_url('admin.php'); ?>">
273 273
 
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	public function update_options() {
297 297
 
298
-	    $own = '';
299
-	    $options = array();
298
+		$own = '';
299
+		$options = array();
300 300
 
301
-	    delete_option('lsx_ti_tours_api_options');
301
+		delete_option('lsx_ti_tours_api_options');
302 302
 
303
-	    if(isset($_GET['own'])){
303
+		if(isset($_GET['own'])){
304 304
 			$this->url_qs .= '&own=true';
305 305
 			$options[] = 'own';
306
-        }
306
+		}
307 307
 
308 308
 		if(isset($_GET['type'])){
309 309
 			$this->url_qs .= '&type='.implode('',$_GET['type']);
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 		$tours = json_decode($data, true);
320 320
 
321 321
 		if(isset($tours['error'])){
322
-		    return $tours['error'];
323
-        }elseif (isset($tours['itineraries']) && !empty($tours['itineraries'])) {
322
+			return $tours['error'];
323
+		}elseif (isset($tours['itineraries']) && !empty($tours['itineraries'])) {
324 324
 			set_transient('lsx_ti_tours',$tours['itineraries'],60*60*2);
325 325
 			return true;
326 326
 		}
@@ -523,71 +523,71 @@  discard block
 block discarded – undo
523 523
 				$content = false;
524 524
 			}
525 525
 
526
-            $jdata=file_get_contents("http://wetu.com/API/Itinerary/V7/Get?id=".$wetu_id);
526
+			$jdata=file_get_contents("http://wetu.com/API/Itinerary/V7/Get?id=".$wetu_id);
527 527
 
528
-            if($jdata)
529
-            {
528
+			if($jdata)
529
+			{
530 530
 				$jdata=json_decode($jdata,true);
531
-                if(!empty($jdata))
532
-                {
533
-                	$return = $this->import_row($jdata,$wetu_id,$post_id,$content);
534
-                	$this->format_completed_row($return);
535
-                	$this->cleanup_posts();
536
-                	$this->attach_destination_images($content);
537
-                }
538
-            }
531
+				if(!empty($jdata))
532
+				{
533
+					$return = $this->import_row($jdata,$wetu_id,$post_id,$content);
534
+					$this->format_completed_row($return);
535
+					$this->cleanup_posts();
536
+					$this->attach_destination_images($content);
537
+				}
538
+			}
539 539
 		}
540 540
 	}
541 541
 
542 542
 	/**
543 543
 	 * Connect to wetu
544
-     *
545
-     * @param $data array
546
-     * @param $wetu_id string
544
+	 *
545
+	 * @param $data array
546
+	 * @param $wetu_id string
547 547
 	 */
548 548
 	public function import_row($data,$wetu_id,$id=0,$importable_content=false,$old1=false,$old2=false) {
549
-        $post_name = $data_post_content = $data_post_excerpt = '';
550
-        $post = array(
551
-          'post_type'		=> 'tour',
552
-        );
549
+		$post_name = $data_post_content = $data_post_excerpt = '';
550
+		$post = array(
551
+		  'post_type'		=> 'tour',
552
+		);
553 553
 
554
-        //Set the post_content
554
+		//Set the post_content
555 555
 		$content_used_general_description = false;
556
-        if(false !== $importable_content && in_array('description',$importable_content)){
557
-            $data_post_content = '';
558
-
559
-            if(isset($data['description'])){
560
-                $data_post_content = $data['description'];
561
-            }elseif(isset($data['summary'])){
562
-                $data_post_content = $data['summary'];
563
-            }
564
-            $post['post_content'] = $data_post_content;
565
-        }
566
-
567
-        //Create or update the post
568
-        if(false !== $id && '0' !== $id){
569
-            $post['ID'] = $id;
570
-	        $post['post_status'] = 'publish';
571
-            $id = wp_update_post($post);
572
-            $prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
573
-            update_post_meta($id,'lsx_wetu_modified_date',strtotime($data['last_modified']),$prev_date);
574
-        }else{
575
-
576
-            //Set the name
577
-            if(isset($data['name'])){
578
-                $post_name = wp_unique_post_slug(sanitize_title($data['name']),$id, 'draft', 'tour', 0);
579
-            }
580
-            $post['post_name'] = $post_name;
581
-            $post['post_title'] = $data['name'];
582
-            $post['post_status'] = 'publish';
583
-            $id = wp_insert_post($post);
584
-
585
-            //Save the WETU ID and the Last date it was modified.
586
-            if(false !== $id){
587
-                add_post_meta($id,'lsx_wetu_id',$wetu_id);
588
-                add_post_meta($id,'lsx_wetu_modified_date',strtotime($data['last_modified']));
589
-            }
590
-        }
556
+		if(false !== $importable_content && in_array('description',$importable_content)){
557
+			$data_post_content = '';
558
+
559
+			if(isset($data['description'])){
560
+				$data_post_content = $data['description'];
561
+			}elseif(isset($data['summary'])){
562
+				$data_post_content = $data['summary'];
563
+			}
564
+			$post['post_content'] = $data_post_content;
565
+		}
566
+
567
+		//Create or update the post
568
+		if(false !== $id && '0' !== $id){
569
+			$post['ID'] = $id;
570
+			$post['post_status'] = 'publish';
571
+			$id = wp_update_post($post);
572
+			$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
573
+			update_post_meta($id,'lsx_wetu_modified_date',strtotime($data['last_modified']),$prev_date);
574
+		}else{
575
+
576
+			//Set the name
577
+			if(isset($data['name'])){
578
+				$post_name = wp_unique_post_slug(sanitize_title($data['name']),$id, 'draft', 'tour', 0);
579
+			}
580
+			$post['post_name'] = $post_name;
581
+			$post['post_title'] = $data['name'];
582
+			$post['post_status'] = 'publish';
583
+			$id = wp_insert_post($post);
584
+
585
+			//Save the WETU ID and the Last date it was modified.
586
+			if(false !== $id){
587
+				add_post_meta($id,'lsx_wetu_id',$wetu_id);
588
+				add_post_meta($id,'lsx_wetu_modified_date',strtotime($data['last_modified']));
589
+			}
590
+		}
591 591
 
592 592
 
593 593
 		//Set the price
@@ -600,15 +600,15 @@  discard block
 block discarded – undo
600 600
 			$this->set_duration($data,$id);
601 601
 		}
602 602
 
603
-        if(false !== $importable_content && in_array('itineraries',$importable_content) && isset($data['legs']) && !empty($data['legs'])){
604
-            $this->process_itineraries($data,$id,$importable_content);
605
-        }
603
+		if(false !== $importable_content && in_array('itineraries',$importable_content) && isset($data['legs']) && !empty($data['legs'])){
604
+			$this->process_itineraries($data,$id,$importable_content);
605
+		}
606 606
 
607 607
 		if(in_array('map',$importable_content) && isset($data['routes']) && !empty($data['routes'])){
608 608
 			$this->set_map_data($data,$id);
609 609
 		}
610 610
 
611
-        return $id;
611
+		return $id;
612 612
 	}
613 613
 
614 614
 	/**
@@ -770,17 +770,17 @@  discard block
 block discarded – undo
770 770
 	 * Set the Itinerary Day
771 771
 	 */
772 772
 	public function set_itinerary_day($day,$id) {
773
-        $this->save_custom_field($day,'itinerary',$id,false,false);
773
+		$this->save_custom_field($day,'itinerary',$id,false,false);
774 774
 	}
775 775
 
776 776
 	/**
777 777
 	 * Set the price
778 778
 	 */
779 779
 	public function set_price($data,$id) {
780
-	    //Price
780
+		//Price
781 781
 		if(isset($data['price']) && ''!== $data['price']){
782
-            $price = preg_replace("/[^0-9,.]/", "", $data['price']);
783
-            $this->save_custom_field($price,'price',$id);
782
+			$price = preg_replace("/[^0-9,.]/", "", $data['price']);
783
+			$this->save_custom_field($price,'price',$id);
784 784
 		}
785 785
 
786 786
 		//Price includes
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 			$this->save_custom_field($data['price_includes'],'included',$id);
789 789
 		}
790 790
 
791
-        //Price Excludes
791
+		//Price Excludes
792 792
 		if(isset($data['price_excludes']) && ''!== $data['price_excludes']){
793 793
 			$this->save_custom_field($data['price_excludes'],'not_included',$id);
794 794
 		}
@@ -811,35 +811,35 @@  discard block
 block discarded – undo
811 811
 	 */
812 812
 	public function set_accommodation($day,$id) {
813 813
 
814
-	    $ac_id = false;
814
+		$ac_id = false;
815 815
 		$this->current_accommodation = $this->find_current_accommodation();
816 816
 		
817 817
 		if(isset($day['content_entity_id']) && !empty($day['content_entity_id'])){
818 818
 
819 819
 			if(false !== $this->current_accommodation && !empty($this->current_accommodation) && array_key_exists($day['content_entity_id'],$this->current_accommodation)){
820
-                $ac_id = $this->current_accommodation[$day['content_entity_id']];
820
+				$ac_id = $this->current_accommodation[$day['content_entity_id']];
821 821
 			}else{
822 822
 				$ac_id = wp_insert_post(array(
823
-                    'post_type' => 'accommodation',
824
-                    'post_status' => 'draft',
825
-                    'post_title' => $day['content_entity_id']
826
-                ));
823
+					'post_type' => 'accommodation',
824
+					'post_status' => 'draft',
825
+					'post_title' => $day['content_entity_id']
826
+				));
827 827
 				$this->save_custom_field($day['content_entity_id'],'lsx_wetu_id',$ac_id);
828 828
 			}
829 829
 
830 830
 			if('' !== $ac_id && false !== $ac_id){
831
-			    $this->save_custom_field($ac_id,'accommodation_to_tour',$id,false,false);
831
+				$this->save_custom_field($ac_id,'accommodation_to_tour',$id,false,false);
832 832
 				$this->save_custom_field($id,'tour_to_accommodation',$ac_id,false,false);
833
-            }
833
+			}
834 834
 		}
835 835
 		return $ac_id;
836 836
 	}
837 837
 
838 838
 	/**
839 839
 	 * Grab all the current accommodation posts via the lsx_wetu_id field.
840
-     *
841
-     * @param $post_type string
842
-     * @return boolean / array
840
+	 *
841
+	 * @param $post_type string
842
+	 * @return boolean / array
843 843
 	 */
844 844
 	public function find_current_accommodation($post_type='accommodation') {
845 845
 		global $wpdb;
@@ -847,16 +847,16 @@  discard block
 block discarded – undo
847 847
 
848 848
 		$return = false;
849 849
 		if(!empty($accommodation)){
850
-		    foreach($accommodation as $key => $acc){
850
+			foreach($accommodation as $key => $acc){
851 851
 				$return[$acc->meta_value] = $acc->post_id;
852
-            }
853
-        }
852
+			}
853
+		}
854 854
 		return $return;
855 855
 	}
856 856
 
857 857
 	/**
858 858
 	 * Grab all the current accommodation posts via the lsx_wetu_id field.
859
-     * @return boolean / array
859
+	 * @return boolean / array
860 860
 	 */
861 861
 	public function find_current_destinations() {
862 862
 		return $this->find_current_accommodation('destination');
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 				$country_wetu_id = get_post_meta($potential_id,'lsx_wetu_id',true);
885 885
 				if(false !== $country_wetu_id){
886 886
 					$country_id = $this->set_country($country_wetu_id, $id);
887
-                }
887
+				}
888 888
 
889 889
 			}else {
890 890
 
@@ -895,27 +895,27 @@  discard block
 block discarded – undo
895 895
 
896 896
 					if (!empty($destination_data) && !isset($destination_data['error'])) {
897 897
 
898
-					    $destination_title = $day['destination_content_entity_id'];
898
+						$destination_title = $day['destination_content_entity_id'];
899 899
 
900
-					    if(isset($destination_data[0]['name'])){
900
+						if(isset($destination_data[0]['name'])){
901 901
 							$destination_title = $destination_data[0]['name'];
902
-                        }
902
+						}
903 903
 
904
-					    if(isset($destination_data[0]['map_object_id']) && isset($destination_data[0]['position']['country_content_entity_id'])
905
-                            && $destination_data[0]['map_object_id'] !== $destination_data[0]['position']['country_content_entity_id']){
904
+						if(isset($destination_data[0]['map_object_id']) && isset($destination_data[0]['position']['country_content_entity_id'])
905
+							&& $destination_data[0]['map_object_id'] !== $destination_data[0]['position']['country_content_entity_id']){
906 906
 
907 907
 							$country_id = $this->set_country($destination_data[0]['position']['country_content_entity_id'], $id);
908
-                        }
908
+						}
909 909
 
910
-                        $dest_post = array(
910
+						$dest_post = array(
911 911
 							'post_type' => 'destination',
912 912
 							'post_status' => 'draft',
913 913
 							'post_title' => $destination_title
914 914
 						);
915 915
 
916
-					    if(false !== $country_id){
916
+						if(false !== $country_id){
917 917
 							$dest_post['post_parent'] = $country_id;
918
-                        }
918
+						}
919 919
 						$dest_id = wp_insert_post($dest_post);
920 920
 
921 921
 						//Make sure we register the
@@ -933,16 +933,16 @@  discard block
 block discarded – undo
933 933
 
934 934
 				// Save the first destination so we can grab the tour featured image and banner
935 935
 				if(0 === $leg_counter){
936
-				    $this->destination_images[$id] = array($dest_id,$day['destination_content_entity_id']);
937
-                }
936
+					$this->destination_images[$id] = array($dest_id,$day['destination_content_entity_id']);
937
+				}
938 938
 
939 939
 				//Add this relation info so we can make sure certain items are set as countries.
940 940
 				if(0 !== $country_id && false !== $country_id){
941
-                    $this->relation_meta[$dest_id] = $country_id;
941
+					$this->relation_meta[$dest_id] = $country_id;
942 942
 					$this->relation_meta[$country_id] = 0;
943
-                }else{
943
+				}else{
944 944
 					$this->relation_meta[$dest_id] = 0;
945
-                }
945
+				}
946 946
 			}
947 947
 		}
948 948
 		return $dest_id;
@@ -952,53 +952,53 @@  discard block
 block discarded – undo
952 952
 	 * Connects the destinations post type
953 953
 	 *
954 954
 	 * @param $dest_id string
955
-     * @param $country_id array
955
+	 * @param $country_id array
956 956
 	 * @param $id string
957
-     *
958
-     * @return string
957
+	 *
958
+	 * @return string
959 959
 	 */
960 960
 	public function set_country($country_wetu_id, $id) {
961
-	    $country_id = false;
961
+		$country_id = false;
962 962
 		$this->current_destinations = $this->find_current_destinations();
963 963
 
964
-        if (false !== $this->current_destinations && !empty($this->current_destinations) && array_key_exists($country_wetu_id, $this->current_destinations)) {
965
-            $country_id = $this->current_destinations[$country_wetu_id];
966
-        } else {
964
+		if (false !== $this->current_destinations && !empty($this->current_destinations) && array_key_exists($country_wetu_id, $this->current_destinations)) {
965
+			$country_id = $this->current_destinations[$country_wetu_id];
966
+		} else {
967 967
 
968
-            $country_json = file_get_contents("http://wetu.com/API/Pins/".$this->api_key."/Get?ids=" . $country_wetu_id);
968
+			$country_json = file_get_contents("http://wetu.com/API/Pins/".$this->api_key."/Get?ids=" . $country_wetu_id);
969 969
 
970
-            if ($country_json) {
971
-                $country_data = json_decode($country_json, true);
970
+			if ($country_json) {
971
+				$country_data = json_decode($country_json, true);
972 972
 
973
-                if (!empty($country_data) && !isset($country_data['error'])) {
973
+				if (!empty($country_data) && !isset($country_data['error'])) {
974 974
 
975 975
 					//Format the title of the destination if its available,  otherwise default to the WETU ID.
976
-                    $country_title = $country_wetu_id;
977
-                    if (isset($country_data[0]['name'])) {
976
+					$country_title = $country_wetu_id;
977
+					if (isset($country_data[0]['name'])) {
978 978
 						$country_title = $country_data[0]['name'];
979
-                    }
979
+					}
980 980
 
981 981
 					$country_id = wp_insert_post(array(
982
-                        'post_type' => 'destination',
983
-                        'post_status' => 'draft',
984
-                        'post_title' => $country_title
985
-                    ));
982
+						'post_type' => 'destination',
983
+						'post_status' => 'draft',
984
+						'post_title' => $country_title
985
+					));
986 986
 					//add the country to the current destination stack
987 987
 					$this->current_destinations[$country_wetu_id] = $country_id;
988 988
 
989 989
 					//Save the wetu field
990
-                    $this->save_custom_field($country_wetu_id, 'lsx_wetu_id', $country_id);
991
-                }
992
-            }
993
-        }
994
-
995
-        if ('' !== $country_id && false !== $country_id) {
996
-            $this->save_custom_field($country_id, 'destination_to_tour', $id, false, false);
997
-            $this->save_custom_field($id, 'tour_to_destination', $country_id, false, false);
990
+					$this->save_custom_field($country_wetu_id, 'lsx_wetu_id', $country_id);
991
+				}
992
+			}
993
+		}
994
+
995
+		if ('' !== $country_id && false !== $country_id) {
996
+			$this->save_custom_field($country_id, 'destination_to_tour', $id, false, false);
997
+			$this->save_custom_field($id, 'tour_to_destination', $country_id, false, false);
998 998
 			$this->cleanup_posts[$country_id] = 'tour_to_destination';
999 999
 
1000
-            return $country_id;
1001
-        }
1000
+			return $country_id;
1001
+		}
1002 1002
 	}
1003 1003
 
1004 1004
 	/**
@@ -1011,9 +1011,9 @@  discard block
 block discarded – undo
1011 1011
 	 * @return string
1012 1012
 	 */
1013 1013
 	public function attach_destination_images($importable_content=array()) {
1014
-	    if(false !== $this->destination_images){
1014
+		if(false !== $this->destination_images){
1015 1015
 
1016
-	        foreach($this->destination_images as $tour => $destination){
1016
+			foreach($this->destination_images as $tour => $destination){
1017 1017
 
1018 1018
 				$url = 'https://wetu.com/API/Pins/' . $this->api_key;
1019 1019
 				$url_qs = '';
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 						}
1035 1035
 					}
1036 1036
 				}
1037
-            }
1038
-        }
1037
+			}
1038
+		}
1039 1039
 	}
1040 1040
 }
1041 1041
\ No newline at end of file
Please login to merge, or discard this patch.
classes/class-importer.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
 			$this->api_username = false;
203 203
 			$this->api_password = false;
204 204
 
205
-            if (isset($temp_options['api']['wetu_api_key']) && '' !== $temp_options['api']['wetu_api_key']) {
206
-                $this->api_key = $temp_options['api']['wetu_api_key'];
207
-            }
208
-            if (isset($temp_options['api']['wetu_api_username']) && '' !== $temp_options['api']['wetu_api_username']) {
209
-                $this->api_username = $temp_options['api']['wetu_api_username'];
210
-            }
211
-            if (isset($temp_options['api']['wetu_api_password']) && '' !== $temp_options['api']['wetu_api_password']) {
212
-                $this->api_password = $temp_options['api']['wetu_api_password'];
213
-            }
205
+			if (isset($temp_options['api']['wetu_api_key']) && '' !== $temp_options['api']['wetu_api_key']) {
206
+				$this->api_key = $temp_options['api']['wetu_api_key'];
207
+			}
208
+			if (isset($temp_options['api']['wetu_api_username']) && '' !== $temp_options['api']['wetu_api_username']) {
209
+				$this->api_username = $temp_options['api']['wetu_api_username'];
210
+			}
211
+			if (isset($temp_options['api']['wetu_api_password']) && '' !== $temp_options['api']['wetu_api_password']) {
212
+				$this->api_password = $temp_options['api']['wetu_api_password'];
213
+			}
214 214
 
215 215
 			//Set the tab slug
216 216
 			if(isset($_GET['tab']) || isset($_POST['type'])) {
@@ -224,25 +224,25 @@  discard block
 block discarded – undo
224 224
 					//If any tours were queued
225 225
 					$this->queued_imports = get_option('wetu_importer_que', false);
226 226
 				}
227
-            }
227
+			}
228 228
 
229 229
 			//Set the scaling options
230
-            if (isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug]) && isset($this->options['image_scaling'])) {
231
-                $this->scale_images = true;
232
-                $width = '800';
233
-                if (isset($this->options['width']) && '' !== $this->options['width']) {
234
-                    $width = $this->options['width'];
235
-                }
236
-                $height = '600';
237
-                if (isset($this->options['height']) && '' !== $this->options['height']) {
238
-                    $height = $this->options['height'];
239
-                }
240
-                $cropping = 'raw';
241
-                if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
242
-                    $cropping = $this->options['cropping'];
243
-                }
244
-                $this->image_scaling_url = 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
245
-            }
230
+			if (isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug]) && isset($this->options['image_scaling'])) {
231
+				$this->scale_images = true;
232
+				$width = '800';
233
+				if (isset($this->options['width']) && '' !== $this->options['width']) {
234
+					$width = $this->options['width'];
235
+				}
236
+				$height = '600';
237
+				if (isset($this->options['height']) && '' !== $this->options['height']) {
238
+					$height = $this->options['height'];
239
+				}
240
+				$cropping = 'raw';
241
+				if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
242
+					$cropping = $this->options['cropping'];
243
+				}
244
+				$this->image_scaling_url = 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
245
+			}
246 246
 
247 247
 		}
248 248
 	}
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 
317 317
 	// DISPLAY FUNCTIONS
318 318
 
319
-    /*
319
+	/*
320 320
      * Load the importer class you want to use
321 321
      */
322
-    public function load_class(){
322
+	public function load_class(){
323 323
 
324 324
 		switch($this->tab_slug){
325 325
 			case 'accommodation':
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 				break;
340 340
 		}
341 341
 
342
-    }
342
+	}
343 343
 
344 344
 	/**
345 345
 	 * Registers the admin page which will house the importer form.
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 				<?php
396 396
 			}else{
397 397
 			   $this->current_importer->display_page();
398
-            }; ?>
398
+			}; ?>
399 399
         </div>
400 400
 		<?php
401 401
 	}
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	 * Run through the accommodation grabbed from the DB.
1017 1017
 	 */
1018 1018
 	public function process_ajax_search() {
1019
-	    $this->current_importer->process_ajax_search();
1019
+		$this->current_importer->process_ajax_search();
1020 1020
 	}
1021 1021
 
1022 1022
 	/**
Please login to merge, or discard this patch.