Completed
Push — master ( 593133...8c8e21 )
by Fernando
02:56
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-admin.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * Display the importer administration screen
79 79
 	 */
80 80
 	public function display_page() {
81
-        ?>
81
+		?>
82 82
         <div class="wrap">
83 83
             <?php screen_icon(); ?>
84 84
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 		            </ul> 
101 101
 	             	            
102 102
             <?php } else {
103
-            	do_action('lsx_tour_importer_admin_tab_'.$_GET['tab']);
104
-            } ?>
103
+				do_action('lsx_tour_importer_admin_tab_'.$_GET['tab']);
104
+			} ?>
105 105
         </div>
106 106
         <?php
107 107
 	}
@@ -148,37 +148,37 @@  discard block
 block discarded – undo
148 148
 	 * set_taxonomy with some terms
149 149
 	 */
150 150
 	public function set_taxonomy($taxonomy,$terms,$id) {
151
-        $result=array();
152
-        if(!empty($data))
153
-        {
154
-            foreach($data as $k)
155
-            {
156
-                if($id)
157
-                {
158
-                    if(!$term = term_exists(trim($k), $tax))
159
-                    {
160
-                        $term = wp_insert_term(trim($k), $tax);
161
-                        if ( is_wp_error($term) )
162
-                        {
163
-                            echo $term->get_error_message();
164
-                        }
165
-                        else
166
-                        {
167
-                            wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true);
168
-                        }
169
-                    }
170
-                    else
171
-                    {
172
-                        wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true);
173
-                    }
174
-                }
175
-                else
176
-                {
177
-                    $result[]=trim($k);
178
-                }
179
-            }
180
-        }
181
-        return $result;
151
+		$result=array();
152
+		if(!empty($data))
153
+		{
154
+			foreach($data as $k)
155
+			{
156
+				if($id)
157
+				{
158
+					if(!$term = term_exists(trim($k), $tax))
159
+					{
160
+						$term = wp_insert_term(trim($k), $tax);
161
+						if ( is_wp_error($term) )
162
+						{
163
+							echo $term->get_error_message();
164
+						}
165
+						else
166
+						{
167
+							wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true);
168
+						}
169
+					}
170
+					else
171
+					{
172
+						wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true);
173
+					}
174
+				}
175
+				else
176
+				{
177
+					$result[]=trim($k);
178
+				}
179
+			}
180
+		}
181
+		return $result;
182 182
 	}
183 183
 
184 184
 	/**
@@ -188,21 +188,21 @@  discard block
 block discarded – undo
188 188
 		if(post_type_exists('team')) { ?>
189 189
     		<ul>
190 190
     			<?php
191
-    				$team_args=array(
192
-    					'post_type'	=>	'team',
193
-    					'post_status' => 'publish',
194
-    					'nopagin' => true,
195
-    					'fields' => 'ids'
196
-    				);
197
-    				$team_members = new WP_Query($team_args);
198
-    					if($team_members->have_posts()){
199
-    						foreach($team_members->posts as $member){ ?>
191
+					$team_args=array(
192
+						'post_type'	=>	'team',
193
+						'post_status' => 'publish',
194
+						'nopagin' => true,
195
+						'fields' => 'ids'
196
+					);
197
+					$team_members = new WP_Query($team_args);
198
+						if($team_members->have_posts()){
199
+							foreach($team_members->posts as $member){ ?>
200 200
     							<li><input class="team" type="checkbox" value="<?php echo $member; ?>" /> <?php echo get_the_title($member); ?></li>
201 201
     						<?php }
202
-    					}else{ ?>
202
+						}else{ ?>
203 203
     							<li><input class="team" type="checkbox" value="0" /> <?php _e('None','wetu-importer'); ?></li>
204 204
     					<?php }
205
-    				?>
205
+					?>
206 206
     		</ul>
207 207
     	<?php }		
208 208
 	}
@@ -253,20 +253,20 @@  discard block
 block discarded – undo
253 253
 		if(false !== $id){
254 254
 			if(empty($this->found_attachments)){
255 255
 
256
-		    	$attachments_args = array(
257
-		    			'post_parent' => $id,
258
-		    			'post_status' => 'inherit',
259
-		    			'post_type' => 'attachment',
260
-		    			'order' => 'ASC',
261
-		    	);   	
256
+				$attachments_args = array(
257
+						'post_parent' => $id,
258
+						'post_status' => 'inherit',
259
+						'post_type' => 'attachment',
260
+						'order' => 'ASC',
261
+				);   	
262 262
 		    	 
263
-		    	$attachments = new WP_Query($attachments_args);
264
-		    	if($attachments->have_posts()){
265
-		    		foreach($attachments->posts as $attachment){
266
-		    			$this->found_attachments[$attachment->ID] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title);
267
-		    			$this->gallery_meta[] = $attachment->ID;
268
-		    		}
269
-		    	}
263
+				$attachments = new WP_Query($attachments_args);
264
+				if($attachments->have_posts()){
265
+					foreach($attachments->posts as $attachment){
266
+						$this->found_attachments[$attachment->ID] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title);
267
+						$this->gallery_meta[] = $attachment->ID;
268
+					}
269
+				}
270 270
 			}
271 271
 		}
272 272
 	}		
Please login to merge, or discard this patch.
classes/class-tours.php 1 patch
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * Display the importer administration screen
93 93
 	 */
94 94
 	public function display_page() {
95
-        ?>
95
+		?>
96 96
         <div class="wrap">
97 97
             <?php screen_icon(); ?>
98 98
 
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 			$result = $this->update_options();
219 219
 
220 220
 			if(true === $result){
221
-			    echo '<span style="color:green;">'.esc_attr('Connected','wetu-importer').'</span>';
222
-            }else{
223
-			    echo '<span style="color:red;">'.wp_kses_post($result).'</span>';
224
-            }
221
+				echo '<span style="color:green;">'.esc_attr('Connected','wetu-importer').'</span>';
222
+			}else{
223
+				echo '<span style="color:red;">'.wp_kses_post($result).'</span>';
224
+			}
225 225
 		}else{
226 226
 			echo '<span style="color:green;">'.esc_attr('Connected','wetu-importer').'</span>';
227
-        }
227
+		}
228 228
 		echo '</h3></div>';
229 229
 	}
230 230
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 		$tours  = json_decode($data, true);
237 237
 
238 238
 		if(isset($tours['error'])){
239
-		    return $tours['error'];
240
-        }elseif (isset($tours['itineraries']) && !empty($tours['itineraries'])) {
239
+			return $tours['error'];
240
+		}elseif (isset($tours['itineraries']) && !empty($tours['itineraries'])) {
241 241
 			set_transient('lsx_ti_tours',$tours['itineraries'],60*60*2);
242 242
 			return true;
243 243
 		}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 					$keyphrases = $_POST['keyword'];
287 287
 				}else{
288 288
 					$keyphrases = array(0);
289
-                }
289
+				}
290 290
 
291 291
 				if(!is_array($keyphrases)){
292 292
 					$keyphrases = array($keyphrases);
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 
316 316
 					foreach($tours as $row_key => $row){
317 317
 
318
-					    if(isset($row['is_disabled']) && true === $row['is_disabled']){
319
-                            continue;
320
-                        }
318
+						if(isset($row['is_disabled']) && true === $row['is_disabled']){
319
+							continue;
320
+						}
321 321
 
322
-                        if('Sample' === $row['type']){
323
-                            continue;
324
-                        }
322
+						if('Sample' === $row['type']){
323
+							continue;
324
+						}
325 325
 
326
-                        //If this is a current tour, add its ID to the row.
326
+						//If this is a current tour, add its ID to the row.
327 327
 						$row['post_id'] = 0;
328 328
 						if(false !== $current_tours && array_key_exists($row['identifier'], $current_tours)){
329 329
 							$row['post_id'] = $current_tours[$row['identifier']]->post_id;
@@ -332,31 +332,31 @@  discard block
 block discarded – undo
332 332
 						//If we are searching for
333 333
 						if(false !== $post_status){
334 334
 
335
-                            if('import' === $post_status){
335
+							if('import' === $post_status){
336 336
 
337 337
 								if(0 !== $row['post_id']){
338
-								    continue;
338
+									continue;
339 339
 								}else{
340 340
 									$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
341
-                                }
341
+								}
342 342
 
343 343
 
344
-                            }else{
344
+							}else{
345 345
 
346 346
 								if(0 === $row['post_id']){
347 347
 									continue;
348 348
 								}else{
349 349
 									$current_status = get_post_status($row['post_id']);
350 350
 									if($current_status !== $post_status){
351
-									    continue;
352
-                                    }
351
+										continue;
352
+									}
353 353
 
354 354
 								}
355 355
 								$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
356 356
 
357
-                            }
357
+							}
358 358
 
359
-                        }else{
359
+						}else{
360 360
 							//Search through each keyword.
361 361
 							foreach($keyphrases as $keyphrase){
362 362
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 									$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
371 371
 								}
372 372
 							}
373
-                        }
373
+						}
374 374
 					}		
375 375
 				}
376 376
 
@@ -435,17 +435,17 @@  discard block
 block discarded – undo
435 435
 				$content = false;
436 436
 			}
437 437
 
438
-            $jdata=file_get_contents("http://wetu.com/API/Itinerary/V7/Get?id=".$wetu_id);
438
+			$jdata=file_get_contents("http://wetu.com/API/Itinerary/V7/Get?id=".$wetu_id);
439 439
 
440
-            if($jdata)
441
-            {
440
+			if($jdata)
441
+			{
442 442
 				$jdata=json_decode($jdata,true);
443
-                if(!empty($jdata))
444
-                {
445
-                	$return = $this->import_row($jdata,$wetu_id,$post_id,$content);
446
-                	$this->format_completed_row($return);
447
-                }
448
-            }
443
+				if(!empty($jdata))
444
+				{
445
+					$return = $this->import_row($jdata,$wetu_id,$post_id,$content);
446
+					$this->format_completed_row($return);
447
+				}
448
+			}
449 449
 			die();
450 450
 		}
451 451
 
@@ -453,61 +453,61 @@  discard block
 block discarded – undo
453 453
 
454 454
 	/**
455 455
 	 * Connect to wetu
456
-     *
457
-     * @param $data array
458
-     * @param $wetu_id string
456
+	 *
457
+	 * @param $data array
458
+	 * @param $wetu_id string
459 459
 	 */
460 460
 	public function import_row($data,$wetu_id,$id=0,$importable_content=false,$old1=false,$old2=false) {
461
-        $post_name = $data_post_content = $data_post_excerpt = '';
462
-        $post = array(
463
-          'post_type'		=> 'tour',
464
-        );
461
+		$post_name = $data_post_content = $data_post_excerpt = '';
462
+		$post = array(
463
+		  'post_type'		=> 'tour',
464
+		);
465 465
 
466
-        //Set the post_content
466
+		//Set the post_content
467 467
 		$content_used_general_description = false;
468
-        if(false !== $importable_content && in_array('description',$importable_content)){
469
-            $data_post_content = '';
470
-
471
-            if(isset($data['description'])){
472
-                $data_post_content = $data['description'];
473
-            }elseif(isset($data['summary'])){
474
-                $data_post_content = $data['summary'];
475
-                $content_used_general_description = true;
476
-            }
477
-            $post['post_content'] = wp_strip_all_tags($data_post_content);
478
-        }
479
-
480
-        //set the post_excerpt
481
-        if(false !== $importable_content && in_array('excerpt',$importable_content)){
482
-            if(isset($data['summary']) && false === $content_used_general_description){
483
-                $post['post_excerpt'] = $data['summary'];
484
-            }
485
-        }
486
-
487
-        //Create or update the post
488
-        if(false !== $id && '0' !== $id){
489
-            $post['ID'] = $id;
490
-	        $post['post_status'] = 'pending';
491
-            $id = wp_update_post($post);
492
-            $prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
493
-            update_post_meta($id,'lsx_wetu_modified_date',strtotime($data['last_modified']),$prev_date);
494
-        }else{
495
-
496
-            //Set the name
497
-            if(isset($data['name'])){
498
-                $post_name = wp_unique_post_slug(sanitize_title($data['name']),$id, 'draft', 'tour', 0);
499
-            }
500
-            $post['post_name'] = $post_name;
501
-            $post['post_title'] = $data['name'];
502
-            $post['post_status'] = 'pending';
503
-            $id = wp_insert_post($post);
504
-
505
-            //Save the WETU ID and the Last date it was modified.
506
-            if(false !== $id){
507
-                add_post_meta($id,'lsx_wetu_id',$wetu_id);
508
-                add_post_meta($id,'lsx_wetu_modified_date',strtotime($data['last_modified']));
509
-            }
510
-        }
468
+		if(false !== $importable_content && in_array('description',$importable_content)){
469
+			$data_post_content = '';
470
+
471
+			if(isset($data['description'])){
472
+				$data_post_content = $data['description'];
473
+			}elseif(isset($data['summary'])){
474
+				$data_post_content = $data['summary'];
475
+				$content_used_general_description = true;
476
+			}
477
+			$post['post_content'] = wp_strip_all_tags($data_post_content);
478
+		}
479
+
480
+		//set the post_excerpt
481
+		if(false !== $importable_content && in_array('excerpt',$importable_content)){
482
+			if(isset($data['summary']) && false === $content_used_general_description){
483
+				$post['post_excerpt'] = $data['summary'];
484
+			}
485
+		}
486
+
487
+		//Create or update the post
488
+		if(false !== $id && '0' !== $id){
489
+			$post['ID'] = $id;
490
+			$post['post_status'] = 'pending';
491
+			$id = wp_update_post($post);
492
+			$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
493
+			update_post_meta($id,'lsx_wetu_modified_date',strtotime($data['last_modified']),$prev_date);
494
+		}else{
495
+
496
+			//Set the name
497
+			if(isset($data['name'])){
498
+				$post_name = wp_unique_post_slug(sanitize_title($data['name']),$id, 'draft', 'tour', 0);
499
+			}
500
+			$post['post_name'] = $post_name;
501
+			$post['post_title'] = $data['name'];
502
+			$post['post_status'] = 'pending';
503
+			$id = wp_insert_post($post);
504
+
505
+			//Save the WETU ID and the Last date it was modified.
506
+			if(false !== $id){
507
+				add_post_meta($id,'lsx_wetu_id',$wetu_id);
508
+				add_post_meta($id,'lsx_wetu_modified_date',strtotime($data['last_modified']));
509
+			}
510
+		}
511 511
 
512 512
 
513 513
 		//Set the price
@@ -520,9 +520,9 @@  discard block
 block discarded – undo
520 520
 			$this->set_duration($data,$id);
521 521
 		}
522 522
 
523
-        if(in_array('itineraries',$importable_content) && isset($data['legs']) && !empty($data['legs'])){
524
-            $this->process_itineraries($data,$id,$importable_content);
525
-        }
523
+		if(in_array('itineraries',$importable_content) && isset($data['legs']) && !empty($data['legs'])){
524
+			$this->process_itineraries($data,$id,$importable_content);
525
+		}
526 526
 
527 527
 		if(in_array('map',$importable_content) && isset($data['routes']) && !empty($data['routes'])){
528 528
 			$this->process_map_points($data,$id);
@@ -533,24 +533,24 @@  discard block
 block discarded – undo
533 533
 		if(false !== $importable_content && (in_array('itinerary_gallery',$importable_content) || in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){
534 534
 			$this->find_attachments($id);
535 535
 		}
536
-        //Set the featured image
537
-        //TODO Test These
538
-        if(false !== $importable_content && in_array('featured_image',$importable_content)){
539
-            $this->set_featured_image($data,$id);
540
-        }
536
+		//Set the featured image
537
+		//TODO Test These
538
+		if(false !== $importable_content && in_array('featured_image',$importable_content)){
539
+			$this->set_featured_image($data,$id);
540
+		}
541 541
 
542 542
 		//TODO Test These
543
-        if(false !== $importable_content && in_array('banner_image',$importable_content)){
544
-            $this->set_banner_image($data,$id);
545
-        }
543
+		if(false !== $importable_content && in_array('banner_image',$importable_content)){
544
+			$this->set_banner_image($data,$id);
545
+		}
546 546
 
547 547
 		//TODO Test These
548
-        //Import the main gallery
549
-        if(false !== $importable_content && in_array('gallery',$importable_content)){
550
-            $this->create_main_gallery($data,$id);
551
-        }
548
+		//Import the main gallery
549
+		if(false !== $importable_content && in_array('gallery',$importable_content)){
550
+			$this->create_main_gallery($data,$id);
551
+		}
552 552
 
553
-        return $id;
553
+		return $id;
554 554
 	}
555 555
 
556 556
 	/**
@@ -638,31 +638,31 @@  discard block
 block discarded – undo
638 638
 	 */
639 639
 	public function process_map_points($data,$id) {
640 640
 
641
-	    if(!empty($data['routes'])){
641
+		if(!empty($data['routes'])){
642 642
 
643
-	        delete_post_meta($id,'wetu_map_points');
643
+			delete_post_meta($id,'wetu_map_points');
644 644
 
645
-	        $points = array();
645
+			$points = array();
646 646
 
647
-	        foreach($data['routes'] as $route){
647
+			foreach($data['routes'] as $route){
648 648
 
649 649
 
650
-	            if(isset($route['points']) && '' !== $route['points']){
650
+				if(isset($route['points']) && '' !== $route['points']){
651 651
 
652
-	                $temp_points = explode(';',$route['points']);
653
-	                $point_counter = count($temp_points);
652
+					$temp_points = explode(';',$route['points']);
653
+					$point_counter = count($temp_points);
654 654
 
655 655
 					for ($x = 0; $x <= $point_counter; $x++) {
656
-					    $y = $x+1;
656
+						$y = $x+1;
657 657
 						$points[] = $temp_points[$x].','.$temp_points[$y];
658 658
 						$x++;
659 659
 					}
660 660
 				}
661
-            }
662
-            if(!empty($points)){
661
+			}
662
+			if(!empty($points)){
663 663
 				$this->save_custom_field(implode(' ',$points),'wetu_map_points',$id,false,true);
664
-            }
665
-        }
664
+			}
665
+		}
666 666
 
667 667
 	}
668 668
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	 * Set the Itinerary Day
671 671
 	 */
672 672
 	public function set_itinerary_day($day,$id) {
673
-        $this->save_custom_field($day,'itinerary',$id,false,false);
673
+		$this->save_custom_field($day,'itinerary',$id,false,false);
674 674
 	}
675 675
 
676 676
 	/**
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
 	 */
679 679
 	public function set_price($data,$id) {
680 680
 		if(isset($data['price']) && ''!== $data['price']){
681
-            $price = preg_replace("/[^0-9,.]/", "", $data['price']);
682
-            $this->save_custom_field($price,'price',$id);
681
+			$price = preg_replace("/[^0-9,.]/", "", $data['price']);
682
+			$this->save_custom_field($price,'price',$id);
683 683
 		}
684 684
 	}
685 685
 
@@ -700,35 +700,35 @@  discard block
 block discarded – undo
700 700
 	 */
701 701
 	public function set_accommodation($day,$id) {
702 702
 
703
-	    $ac_id = false;
703
+		$ac_id = false;
704 704
 		$this->current_accommodation = $this->find_current_accommodation();
705 705
 		
706 706
 		if(isset($day['content_entity_id']) && !empty($day['content_entity_id'])){
707 707
 
708 708
 			if(false !== $this->current_accommodation && !empty($this->current_accommodation) && array_key_exists($day['content_entity_id'],$this->current_accommodation)){
709
-                $ac_id = $this->current_accommodation[$day['content_entity_id']];
709
+				$ac_id = $this->current_accommodation[$day['content_entity_id']];
710 710
 			}else{
711 711
 				$ac_id = wp_insert_post(array(
712
-                    'post_type' => 'accommodation',
713
-                    'post_status' => 'draft',
714
-                    'post_title' => $day['content_entity_id']
715
-                ));
712
+					'post_type' => 'accommodation',
713
+					'post_status' => 'draft',
714
+					'post_title' => $day['content_entity_id']
715
+				));
716 716
 				$this->save_custom_field($day['content_entity_id'],'lsx_wetu_id',$ac_id);
717 717
 			}
718 718
 
719 719
 			if('' !== $ac_id && false !== $ac_id){
720
-			    $this->save_custom_field($ac_id,'accommodation_to_tour',$id,false,false);
720
+				$this->save_custom_field($ac_id,'accommodation_to_tour',$id,false,false);
721 721
 				$this->save_custom_field($id,'tour_to_accommodation',$ac_id,false,false);
722
-            }
722
+			}
723 723
 		}
724 724
 		return $ac_id;
725 725
 	}
726 726
 
727 727
 	/**
728 728
 	 * Grab all the current accommodation posts via the lsx_wetu_id field.
729
-     *
730
-     * @param $post_type string
731
-     * @return boolean / array
729
+	 *
730
+	 * @param $post_type string
731
+	 * @return boolean / array
732 732
 	 */
733 733
 	public function find_current_accommodation($post_type='accommodation') {
734 734
 		global $wpdb;
@@ -736,16 +736,16 @@  discard block
 block discarded – undo
736 736
 
737 737
 		$return = false;
738 738
 		if(!empty($accommodation)){
739
-		    foreach($accommodation as $key => $acc){
739
+			foreach($accommodation as $key => $acc){
740 740
 				$return[$acc->meta_value] = $acc->post_id;
741
-            }
742
-        }
741
+			}
742
+		}
743 743
 		return $return;
744 744
 	}
745 745
 
746 746
 	/**
747 747
 	 * Grab all the current accommodation posts via the lsx_wetu_id field.
748
-     * @return boolean / array
748
+	 * @return boolean / array
749 749
 	 */
750 750
 	public function find_current_destinations() {
751 751
 		return $this->find_current_accommodation('destination');
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 				$country_wetu_id = get_post_meta($potential_id,'lsx_wetu_id',true);
773 773
 				if(false !== $country_wetu_id){
774 774
 					$this->set_country($country_wetu_id, $id);
775
-                }
775
+				}
776 776
 
777 777
 			}else {
778 778
 
@@ -783,27 +783,27 @@  discard block
 block discarded – undo
783 783
 
784 784
 					if (!empty($destination_data) && !isset($destination_data['error'])) {
785 785
 
786
-					    $destination_title = $day['destination_content_entity_id'];
786
+						$destination_title = $day['destination_content_entity_id'];
787 787
 
788
-					    if(isset($destination_data[0]['name'])){
788
+						if(isset($destination_data[0]['name'])){
789 789
 							$destination_title = $destination_data[0]['name'];
790
-                        }
790
+						}
791 791
 
792
-					    if(isset($destination_data[0]['map_object_id']) && isset($destination_data[0]['position']['country_content_entity_id'])
793
-                            && $destination_data[0]['map_object_id'] !== $destination_data[0]['position']['country_content_entity_id']){
792
+						if(isset($destination_data[0]['map_object_id']) && isset($destination_data[0]['position']['country_content_entity_id'])
793
+							&& $destination_data[0]['map_object_id'] !== $destination_data[0]['position']['country_content_entity_id']){
794 794
 
795 795
 							$country_id = $this->set_country($destination_data[0]['position']['country_content_entity_id'], $id);
796
-                        }
796
+						}
797 797
 
798
-                        $dest_post = array(
798
+						$dest_post = array(
799 799
 							'post_type' => 'destination',
800 800
 							'post_status' => 'draft',
801 801
 							'post_title' => $destination_title
802 802
 						);
803 803
 
804
-					    if(false !== $country_id){
804
+						if(false !== $country_id){
805 805
 							$dest_post['post_parent'] = $country_id;
806
-                        }
806
+						}
807 807
 						$dest_id = wp_insert_post($dest_post);
808 808
 
809 809
 						$this->save_custom_field($day['destination_content_entity_id'], 'lsx_wetu_id', $dest_id);
@@ -822,45 +822,45 @@  discard block
 block discarded – undo
822 822
 	 * Connects the destinations post type
823 823
 	 *
824 824
 	 * @param $dest_id string
825
-     * @param $country_id array
825
+	 * @param $country_id array
826 826
 	 * @param $id string
827 827
 	 */
828 828
 	public function set_country($country_wetu_id, $id) {
829
-	    $country_id = false;
829
+		$country_id = false;
830 830
 		$this->current_destinations = $this->find_current_destinations();
831 831
 
832
-        if (false !== $this->current_destinations && !empty($this->current_destinations) && array_key_exists($country_wetu_id, $this->current_destinations)) {
833
-            $country_id = $this->current_destinations[$country_wetu_id];
834
-        } else {
832
+		if (false !== $this->current_destinations && !empty($this->current_destinations) && array_key_exists($country_wetu_id, $this->current_destinations)) {
833
+			$country_id = $this->current_destinations[$country_wetu_id];
834
+		} else {
835 835
 
836
-            $country_json = file_get_contents("http://wetu.com/API/Pins/".$this->api_key."/Get?ids=" . $country_wetu_id);
836
+			$country_json = file_get_contents("http://wetu.com/API/Pins/".$this->api_key."/Get?ids=" . $country_wetu_id);
837 837
 
838
-            if ($country_json) {
839
-                $country_data = json_decode($country_json, true);
838
+			if ($country_json) {
839
+				$country_data = json_decode($country_json, true);
840 840
 
841
-                if (!empty($country_data) && !isset($country_data['error'])) {
841
+				if (!empty($country_data) && !isset($country_data['error'])) {
842 842
 
843
-                    $country_title = $country_wetu_id;
844
-                    if (isset($country_data[0]['name'])) {
843
+					$country_title = $country_wetu_id;
844
+					if (isset($country_data[0]['name'])) {
845 845
 						$country_title = $country_data[0]['name'];
846
-                    }
846
+					}
847 847
 
848 848
 					$country_id = wp_insert_post(array(
849
-                        'post_type' => 'destination',
850
-                        'post_status' => 'draft',
851
-                        'post_title' => $country_title
852
-                    ));
853
-                    $this->save_custom_field($country_wetu_id, 'lsx_wetu_id', $country_id);
854
-                }
855
-            }
856
-        }
857
-
858
-        if ('' !== $country_id && false !== $country_id) {
859
-            $this->save_custom_field($country_id, 'destination_to_tour', $id, false, false);
860
-            $this->save_custom_field($id, 'tour_to_destination', $country_id, false, false);
861
-
862
-            return $country_id;
863
-        }
849
+						'post_type' => 'destination',
850
+						'post_status' => 'draft',
851
+						'post_title' => $country_title
852
+					));
853
+					$this->save_custom_field($country_wetu_id, 'lsx_wetu_id', $country_id);
854
+				}
855
+			}
856
+		}
857
+
858
+		if ('' !== $country_id && false !== $country_id) {
859
+			$this->save_custom_field($country_id, 'destination_to_tour', $id, false, false);
860
+			$this->save_custom_field($id, 'tour_to_destination', $country_id, false, false);
861
+
862
+			return $country_id;
863
+		}
864 864
 	}
865 865
 }
866 866
 $wetu_importer_tours = new WETU_Importer_Tours();
867 867
\ No newline at end of file
Please login to merge, or discard this patch.
classes/class-destination.php 1 patch
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
 		parent::set_variables();
69 69
 
70 70
 		if(false !== $this->api_key){
71
-		    $this->url = 'https://wetu.com/API/Pins/'.$this->api_key;
72
-        }
71
+			$this->url = 'https://wetu.com/API/Pins/'.$this->api_key;
72
+		}
73 73
 	}
74 74
 
75 75
 	/**
76 76
 	 * Display the importer administration screen
77 77
 	 */
78 78
 	public function display_page() {
79
-        ?>
79
+		?>
80 80
         <div class="wrap">
81 81
             <?php screen_icon(); ?>
82 82
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 					$keyphrases = $_POST['keyword'];
294 294
 				}else{
295 295
 					$keyphrases = array(0);
296
-                }
296
+				}
297 297
 
298 298
 				if(!is_array($keyphrases)){
299 299
 					$keyphrases = array($keyphrases);
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 						//If we are searching for
323 323
 						if(false !== $post_status){
324 324
 
325
-                            $current_status = get_post_status($row->post_id);
326
-                            if($current_status !== $post_status){
327
-                                continue;
328
-                            }
329
-                            $searched_items[sanitize_title($row->name).'-'.$row->meta_value] = $this->format_row($row);
325
+							$current_status = get_post_status($row->post_id);
326
+							if($current_status !== $post_status){
327
+								continue;
328
+							}
329
+							$searched_items[sanitize_title($row->name).'-'.$row->meta_value] = $this->format_row($row);
330 330
 
331 331
 
332 332
 						}else{
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 				$team_members = false;
409 409
 			}
410 410
 
411
-            $safari_brands = false;
411
+			$safari_brands = false;
412 412
 
413 413
 			if(isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])){
414 414
 				$content = $_POST['content'];	
@@ -416,16 +416,16 @@  discard block
 block discarded – undo
416 416
 				$content = false;
417 417
 			}
418 418
 
419
-            $jdata=file_get_contents($this->url."/Get?ids=".$wetu_id);
420
-            if($jdata)
421
-            {
422
-                $adata=json_decode($jdata,true);
423
-                if(!empty($adata))
424
-                {
425
-                	$return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands);
426
-                	$this->format_completed_row($return);
427
-                }
428
-            }
419
+			$jdata=file_get_contents($this->url."/Get?ids=".$wetu_id);
420
+			if($jdata)
421
+			{
422
+				$adata=json_decode($jdata,true);
423
+				if(!empty($adata))
424
+				{
425
+					$return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands);
426
+					$this->format_completed_row($return);
427
+				}
428
+			}
429 429
 
430 430
 			die();
431 431
 		}
@@ -437,82 +437,82 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	public function import_row($data,$wetu_id,$id=0,$team_members=false,$importable_content=false,$safari_brands=false) {
439 439
 
440
-        if(trim($data[0]['type'])=='Destination')
441
-        {
442
-	        $post_name = $data_post_content = $data_post_excerpt = '';
443
-	        $post = array(
444
-	          'post_type'		=> 'destination',
445
-	        );
446
-
447
-	        $content_used_general_description = false;
448
-
449
-	        //Set the post_content
450
-	        if(false !== $importable_content && in_array('description',$importable_content)){
451
-		        if(isset($data[0]['content']['extended_description']))
452
-		        {
453
-		            $data_post_content = $data[0]['content']['extended_description'];
454
-		        }elseif(isset($data[0]['content']['general_description'])){
455
-		            $data_post_content = $data[0]['content']['general_description'];
456
-		            $content_used_general_description = true;
457
-		        }elseif(isset($data[0]['content']['teaser_description'])){
458
-		        	$data_post_content = $data[0]['content']['teaser_description'];
459
-		        }
460
-	        	$post['post_content'] = wp_strip_all_tags($data_post_content);
461
-	        }
462
-
463
-	        //set the post_excerpt
464
-	        if(false !== $importable_content && in_array('excerpt',$importable_content)){
465
-		        if(isset($data[0]['content']['teaser_description'])){
466
-		        	$data_post_excerpt = $data[0]['content']['teaser_description'];
467
-		        }elseif(isset($data[0]['content']['extended_description'])){
440
+		if(trim($data[0]['type'])=='Destination')
441
+		{
442
+			$post_name = $data_post_content = $data_post_excerpt = '';
443
+			$post = array(
444
+			  'post_type'		=> 'destination',
445
+			);
446
+
447
+			$content_used_general_description = false;
448
+
449
+			//Set the post_content
450
+			if(false !== $importable_content && in_array('description',$importable_content)){
451
+				if(isset($data[0]['content']['extended_description']))
452
+				{
453
+					$data_post_content = $data[0]['content']['extended_description'];
454
+				}elseif(isset($data[0]['content']['general_description'])){
455
+					$data_post_content = $data[0]['content']['general_description'];
456
+					$content_used_general_description = true;
457
+				}elseif(isset($data[0]['content']['teaser_description'])){
458
+					$data_post_content = $data[0]['content']['teaser_description'];
459
+				}
460
+				$post['post_content'] = wp_strip_all_tags($data_post_content);
461
+			}
462
+
463
+			//set the post_excerpt
464
+			if(false !== $importable_content && in_array('excerpt',$importable_content)){
465
+				if(isset($data[0]['content']['teaser_description'])){
466
+					$data_post_excerpt = $data[0]['content']['teaser_description'];
467
+				}elseif(isset($data[0]['content']['extended_description'])){
468 468
 					$data_post_excerpt = $data[0]['content']['extended_description'];
469 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
-	        }
470
+					$data_post_excerpt = $data[0]['content']['general_description'];
471
+				}	   
472
+				$post['post_excerpt'] = $data_post_excerpt;     	
473
+			}
474 474
 
475
-	        if(false !== $id && '0' !== $id){
476
-	        	$post['ID'] = $id;
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 479
 					$post['post_status'] = 'pending';
480 480
 					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 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', 'destination', 0);
490
-		        }
491
-	        	$post['post_name'] = $post_name;
492
-	        	$post['post_title'] = $data[0]['name'];
493
-	        	$post['post_status'] = 'pending';
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
-
503
-	        //Set the team member if it is there
504
-	        if(post_type_exists('team') && false !== $team_members && '' !== $team_members){
505
-	        	$this->set_team_member($id,$team_members);
506
-	    	}
507
-
508
-	        if(false !== $importable_content && in_array('location',$importable_content)){
509
-	        	$this->set_map_data($data,$id);
510
-	        }
511
-
512
-	        //Set the Room Data
513
-	        if(false !== $importable_content && in_array('videos',$importable_content)){
514
-	        	$this->set_video_data($data,$id);
515
-	    	}
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', 'destination', 0);
490
+				}
491
+				$post['post_name'] = $post_name;
492
+				$post['post_title'] = $data[0]['name'];
493
+				$post['post_status'] = 'pending';
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
+
503
+			//Set the team member if it is there
504
+			if(post_type_exists('team') && false !== $team_members && '' !== $team_members){
505
+				$this->set_team_member($id,$team_members);
506
+			}
507
+
508
+			if(false !== $importable_content && in_array('location',$importable_content)){
509
+				$this->set_map_data($data,$id);
510
+			}
511
+
512
+			//Set the Room Data
513
+			if(false !== $importable_content && in_array('videos',$importable_content)){
514
+				$this->set_video_data($data,$id);
515
+			}
516 516
 
517 517
 			//Set the Electricity
518 518
 			if(false !== $importable_content && in_array('electricity',$importable_content)){
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
 				$this->set_travel_info($data,$id,'climate');
540 540
 			}
541 541
 
542
-        }
543
-        return $id;
542
+		}
543
+		return $id;
544 544
 	}
545 545
 
546 546
 	/**
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 
551 551
 		delete_post_meta($id, 'team_to_'.$this->tab_slug);
552 552
 		foreach($team_members as $team){
553
-        	add_post_meta($id,'team_to_'.$this->tab_slug,$team);			
553
+			add_post_meta($id,'team_to_'.$this->tab_slug,$team);			
554 554
 		}
555 555
 	}
556 556
 	
@@ -602,11 +602,11 @@  discard block
 block discarded – undo
602 602
 				'elevation'	=>	'',
603 603
 			);
604 604
 			if(false !== $id && '0' !== $id){
605
-	        	$prev = get_post_meta($id,'location',true);
606
-	        	update_post_meta($id,'location',$location_data,$prev);
607
-	        }else{
608
-	        	add_post_meta($id,'location',$location_data,true);
609
-	        }
605
+				$prev = get_post_meta($id,'location',true);
606
+				update_post_meta($id,'location',$location_data,$prev);
607
+			}else{
608
+				add_post_meta($id,'location',$location_data,true);
609
+			}
610 610
 		}
611 611
 	}
612 612
 
Please login to merge, or discard this patch.
classes/class-accommodation.php 1 patch
Indentation   +326 added lines, -326 removed lines patch added patch discarded remove patch
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 		parent::set_variables();
68 68
 
69 69
 		if(false !== $this->api_key){
70
-		    $this->url = 'https://wetu.com/API/Pins/'.$this->api_key;
71
-        }
70
+			$this->url = 'https://wetu.com/API/Pins/'.$this->api_key;
71
+		}
72 72
 	}
73 73
 
74 74
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * Display the importer administration screen
109 109
 	 */
110 110
 	public function display_page() {
111
-        ?>
111
+		?>
112 112
         <div class="wrap">
113 113
             <?php screen_icon(); ?>
114 114
 
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 		$accommodation  = json_decode($data, true);
286 286
 
287 287
 		if(isset($accommodation['error'])){
288
-		    return $accommodation['error'];
289
-        }elseif (isset($accommodation) && !empty($accommodation)) {
288
+			return $accommodation['error'];
289
+		}elseif (isset($accommodation) && !empty($accommodation)) {
290 290
 			set_transient('lsx_ti_accommodation',$accommodation,60*60*2);
291 291
 			return true;
292 292
 		}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 					$keyphrases = $_POST['keyword'];
335 335
 				}else{
336 336
 					$keyphrases = array(0);
337
-                }
337
+				}
338 338
 
339 339
 				if(!is_array($keyphrases)){
340 340
 					$keyphrases = array($keyphrases);
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
 	public function multineedle_stripos($haystack, $needles, $offset=0) {
432 432
 		$found = false;
433 433
 		$needle_count = count($needles);
434
-	    foreach($needles as $needle) {
435
-	    	if(false !== stripos($haystack, $needle, $offset)){
436
-	        	$found[] = true;
437
-	    	}
438
-	    }
439
-	    if(false !== $found && $needle_count === count($found)){ 
440
-	    	return true;
434
+		foreach($needles as $needle) {
435
+			if(false !== stripos($haystack, $needle, $offset)){
436
+				$found[] = true;
437
+			}
438
+		}
439
+		if(false !== $found && $needle_count === count($found)){ 
440
+			return true;
441 441
 		}else{
442 442
 			return false;
443 443
 		}
@@ -506,16 +506,16 @@  discard block
 block discarded – undo
506 506
 				$content = false;
507 507
 			}
508 508
 
509
-            $jdata=file_get_contents($this->url."/Get?ids=".$wetu_id);
510
-            if($jdata)
511
-            {
512
-                $adata=json_decode($jdata,true);
513
-                if(!empty($adata))
514
-                {
515
-                	$return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands);
516
-                	$this->format_completed_row($return);
517
-                }
518
-            }
509
+			$jdata=file_get_contents($this->url."/Get?ids=".$wetu_id);
510
+			if($jdata)
511
+			{
512
+				$adata=json_decode($jdata,true);
513
+				if(!empty($adata))
514
+				{
515
+					$return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands);
516
+					$this->format_completed_row($return);
517
+				}
518
+			}
519 519
 
520 520
 			die();
521 521
 		}
@@ -532,148 +532,148 @@  discard block
 block discarded – undo
532 532
 	 */
533 533
 	public function import_row($data,$wetu_id,$id=0,$team_members=false,$importable_content=false,$safari_brands=false) {
534 534
 
535
-        if(trim($data[0]['type'])=='Accommodation')
536
-        {
537
-	        $post_name = $data_post_content = $data_post_excerpt = '';
538
-	        $post = array(
539
-	          'post_type'		=> 'accommodation',
540
-	        );
541
-
542
-	        $content_used_general_description = false;
543
-
544
-	        //Set the post_content
545
-	        if(false !== $importable_content && in_array('description',$importable_content)){
546
-		        if(isset($data[0]['content']['extended_description']))
547
-		        {
548
-		            $data_post_content = $data[0]['content']['extended_description'];
549
-		        }elseif(isset($data[0]['content']['general_description'])){
550
-		            $data_post_content = $data[0]['content']['general_description'];
551
-		            $content_used_general_description = true;
552
-		        }elseif(isset($data[0]['content']['teaser_description'])){
553
-		        	$data_post_content = $data[0]['content']['teaser_description'];
554
-		        }
555
-	        	$post['post_content'] = wp_strip_all_tags($data_post_content);
556
-	        }
557
-
558
-	        //set the post_excerpt
559
-	        if(false !== $importable_content && in_array('excerpt',$importable_content)){
560
-		        if(isset($data[0]['content']['teaser_description'])){
561
-		        	$data_post_excerpt = $data[0]['content']['teaser_description'];
562
-		        }elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){
563
-		            $data_post_excerpt = $data[0]['content']['general_description'];
564
-		        }	   
565
-		        $post['post_excerpt'] = $data_post_excerpt;     	
566
-	        }
567
-
568
-	        if(false !== $id && '0' !== $id){
569
-	        	$post['ID'] = $id;
535
+		if(trim($data[0]['type'])=='Accommodation')
536
+		{
537
+			$post_name = $data_post_content = $data_post_excerpt = '';
538
+			$post = array(
539
+			  'post_type'		=> 'accommodation',
540
+			);
541
+
542
+			$content_used_general_description = false;
543
+
544
+			//Set the post_content
545
+			if(false !== $importable_content && in_array('description',$importable_content)){
546
+				if(isset($data[0]['content']['extended_description']))
547
+				{
548
+					$data_post_content = $data[0]['content']['extended_description'];
549
+				}elseif(isset($data[0]['content']['general_description'])){
550
+					$data_post_content = $data[0]['content']['general_description'];
551
+					$content_used_general_description = true;
552
+				}elseif(isset($data[0]['content']['teaser_description'])){
553
+					$data_post_content = $data[0]['content']['teaser_description'];
554
+				}
555
+				$post['post_content'] = wp_strip_all_tags($data_post_content);
556
+			}
557
+
558
+			//set the post_excerpt
559
+			if(false !== $importable_content && in_array('excerpt',$importable_content)){
560
+				if(isset($data[0]['content']['teaser_description'])){
561
+					$data_post_excerpt = $data[0]['content']['teaser_description'];
562
+				}elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){
563
+					$data_post_excerpt = $data[0]['content']['general_description'];
564
+				}	   
565
+				$post['post_excerpt'] = $data_post_excerpt;     	
566
+			}
567
+
568
+			if(false !== $id && '0' !== $id){
569
+				$post['ID'] = $id;
570 570
 				if(isset($data[0]['name'])){
571 571
 					$post['post_title'] = $data[0]['name'];
572
-	        		$post['post_status'] = 'pending';
572
+					$post['post_status'] = 'pending';
573 573
 					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
574 574
 				}
575
-	        	$id = wp_update_post($post);
576
-	        	$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
577
-	        	update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date);
578
-	        }else{
579
-
580
-		        //Set the name
581
-		        if(isset($data[0]['name'])){
582
-		            $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
583
-		        }
584
-	        	$post['post_name'] = $post_name;
585
-	        	$post['post_title'] = $data[0]['name'];
586
-	        	$post['post_status'] = 'pending';
587
-	        	$id = wp_insert_post($post);
588
-
589
-	        	//Save the WETU ID and the Last date it was modified.
590
-	        	if(false !== $id){
591
-	        		add_post_meta($id,'lsx_wetu_id',$wetu_id);
592
-	        		add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']));
593
-	        	}
594
-	        }
595
-	        //Setup some default for use in the import
596
-	        if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){
575
+				$id = wp_update_post($post);
576
+				$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
577
+				update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date);
578
+			}else{
579
+
580
+				//Set the name
581
+				if(isset($data[0]['name'])){
582
+					$post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
583
+				}
584
+				$post['post_name'] = $post_name;
585
+				$post['post_title'] = $data[0]['name'];
586
+				$post['post_status'] = 'pending';
587
+				$id = wp_insert_post($post);
588
+
589
+				//Save the WETU ID and the Last date it was modified.
590
+				if(false !== $id){
591
+					add_post_meta($id,'lsx_wetu_id',$wetu_id);
592
+					add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']));
593
+				}
594
+			}
595
+			//Setup some default for use in the import
596
+			if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){
597 597
 				$this->find_attachments($id);
598 598
 			}
599 599
 
600
-	        //Set the team member if it is there
601
-	        if(post_type_exists('team') && false !== $team_members && '' !== $team_members){
602
-	        	$this->set_team_member($id,$team_members);
603
-	    	}
604
-
605
-	        //Set the safari brand
606
-	        if(false !== $safari_brands && '' !== $safari_brands){
607
-	        	$this->set_safari_brands($id,$safari_brands);
608
-
609
-	    	}	    	
610
-
611
-	        if(false !== $importable_content && in_array('location',$importable_content)){
612
-	        	$this->set_map_data($data,$id);
613
-	        	$this->set_location_taxonomy($data,$id);
614
-	        }
615
-
616
-	        if(post_type_exists('destination') && false !== $importable_content && in_array('destination',$importable_content)){
617
-	        	$this->connect_destinations($data,$id);
618
-	        }
619
-
620
-	        if(false !== $importable_content && in_array('category',$importable_content)){
621
-	        	$this->set_taxonomy_style($data,$id);
622
-	        }
623
-
624
-	        //Set the Room Data
625
-	        if(false !== $importable_content && in_array('rooms',$importable_content)){
626
-	        	$this->set_room_data($data,$id);
627
-	    	}
628
-
629
-	    	//Set the rating
630
-	    	if(false !== $importable_content && in_array('rating',$importable_content)){
631
-	       		$this->set_rating($data,$id);
632
-	    	}
633
-
634
-	    	//Set the checkin checkout data
635
-	    	if(false !== $importable_content && in_array('checkin',$importable_content)){
636
-	        	$this->set_checkin_checkout($data,$id);
637
-	        }
638
-
639
-	    	//Set the Spoken Languages
640
-	    	if(false !== $importable_content && in_array('spoken_languages',$importable_content)){
641
-	       		$this->set_spoken_languages($data,$id);
642
-	    	}
643
-
644
-	    	//Set the friendly options
645
-	    	if(false !== $importable_content && in_array('friendly',$importable_content)){
646
-	       		$this->set_friendly($data,$id);
647
-	    	}
648
-
649
-	    	//Set the special_interests
650
-	    	if(false !== $importable_content && in_array('special_interests',$importable_content)){
651
-	       		$this->set_special_interests($data,$id);
652
-	    	}	    		    		        
653
-
654
-	        //Import the videos
655
-	        if(false !== $importable_content && in_array('videos',$importable_content)){
656
-	        	$this->set_video_data($data,$id);
657
-	        }
658
-
659
-	        //Import the facilities
660
-	        if(false !== $importable_content && in_array('facilities',$importable_content)){
661
-	        	$this->set_facilities($data,$id);
662
-	        }	        
663
-
664
-	        //Set the featured image
665
-	        if(false !== $importable_content && in_array('featured_image',$importable_content)){
666
-	        	$this->set_featured_image($data,$id);
667
-	        }
668
-	        if(false !== $importable_content && in_array('banner_image',$importable_content)){
669
-	        	$this->set_banner_image($data,$id);
670
-	        }	        
671
-	        //Import the main gallery
672
-	        if(false !== $importable_content && in_array('gallery',$importable_content)){	    	
673
-	    		$this->create_main_gallery($data,$id);
674
-	        }	        	        	        
675
-        }
676
-        return $id;
600
+			//Set the team member if it is there
601
+			if(post_type_exists('team') && false !== $team_members && '' !== $team_members){
602
+				$this->set_team_member($id,$team_members);
603
+			}
604
+
605
+			//Set the safari brand
606
+			if(false !== $safari_brands && '' !== $safari_brands){
607
+				$this->set_safari_brands($id,$safari_brands);
608
+
609
+			}	    	
610
+
611
+			if(false !== $importable_content && in_array('location',$importable_content)){
612
+				$this->set_map_data($data,$id);
613
+				$this->set_location_taxonomy($data,$id);
614
+			}
615
+
616
+			if(post_type_exists('destination') && false !== $importable_content && in_array('destination',$importable_content)){
617
+				$this->connect_destinations($data,$id);
618
+			}
619
+
620
+			if(false !== $importable_content && in_array('category',$importable_content)){
621
+				$this->set_taxonomy_style($data,$id);
622
+			}
623
+
624
+			//Set the Room Data
625
+			if(false !== $importable_content && in_array('rooms',$importable_content)){
626
+				$this->set_room_data($data,$id);
627
+			}
628
+
629
+			//Set the rating
630
+			if(false !== $importable_content && in_array('rating',$importable_content)){
631
+		   		$this->set_rating($data,$id);
632
+			}
633
+
634
+			//Set the checkin checkout data
635
+			if(false !== $importable_content && in_array('checkin',$importable_content)){
636
+				$this->set_checkin_checkout($data,$id);
637
+			}
638
+
639
+			//Set the Spoken Languages
640
+			if(false !== $importable_content && in_array('spoken_languages',$importable_content)){
641
+		   		$this->set_spoken_languages($data,$id);
642
+			}
643
+
644
+			//Set the friendly options
645
+			if(false !== $importable_content && in_array('friendly',$importable_content)){
646
+		   		$this->set_friendly($data,$id);
647
+			}
648
+
649
+			//Set the special_interests
650
+			if(false !== $importable_content && in_array('special_interests',$importable_content)){
651
+		   		$this->set_special_interests($data,$id);
652
+			}	    		    		        
653
+
654
+			//Import the videos
655
+			if(false !== $importable_content && in_array('videos',$importable_content)){
656
+				$this->set_video_data($data,$id);
657
+			}
658
+
659
+			//Import the facilities
660
+			if(false !== $importable_content && in_array('facilities',$importable_content)){
661
+				$this->set_facilities($data,$id);
662
+			}	        
663
+
664
+			//Set the featured image
665
+			if(false !== $importable_content && in_array('featured_image',$importable_content)){
666
+				$this->set_featured_image($data,$id);
667
+			}
668
+			if(false !== $importable_content && in_array('banner_image',$importable_content)){
669
+				$this->set_banner_image($data,$id);
670
+			}	        
671
+			//Import the main gallery
672
+			if(false !== $importable_content && in_array('gallery',$importable_content)){	    	
673
+				$this->create_main_gallery($data,$id);
674
+			}	        	        	        
675
+		}
676
+		return $id;
677 677
 	}
678 678
 
679 679
 	/**
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 
684 684
 		delete_post_meta($id, 'team_to_'.$this->tab_slug);
685 685
 		foreach($team_members as $team){
686
-        	add_post_meta($id,'team_to_'.$this->tab_slug,$team);			
686
+			add_post_meta($id,'team_to_'.$this->tab_slug,$team);			
687 687
 		}
688 688
 	}
689 689
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	 */
693 693
 	public function set_safari_brands($id,$safari_brands) {
694 694
 		foreach($safari_brands as $safari_brand){
695
-        	wp_set_object_terms( $id, intval($safari_brand), 'accommodation-brand',true);			
695
+			wp_set_object_terms( $id, intval($safari_brand), 'accommodation-brand',true);			
696 696
 		}
697 697
 	}	
698 698
 	
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
 				'elevation'	=>	'',
745 745
 			);
746 746
 			if(false !== $id && '0' !== $id){
747
-	        	$prev = get_post_meta($id,'location',true);
748
-	        	update_post_meta($id,'location',$location_data,$prev);
749
-	        }else{
750
-	        	add_post_meta($id,'location',$location_data,true);
751
-	        }
747
+				$prev = get_post_meta($id,'location',true);
748
+				update_post_meta($id,'location',$location_data,$prev);
749
+			}else{
750
+				add_post_meta($id,'location',$location_data,true);
751
+			}
752 752
 		}
753 753
 	}
754 754
 	/**
@@ -762,35 +762,35 @@  discard block
 block discarded – undo
762 762
 			if(isset($data[0]['position']['country'])){
763 763
 
764 764
 				if(!$term = term_exists(trim($data[0]['position']['country']), 'location'))
765
-		        {
766
-		            $term = wp_insert_term(trim($data[0]['position']['country']), 'location');
767
-		            if ( is_wp_error($term) ){
768
-		            	echo $term->get_error_message();
769
-		            }
770
-		            else {
771
-		            	wp_set_object_terms( $id, intval($term['term_id']), 'location',true);
772
-		            }
773
-		        }
774
-		        else
775
-		        {
776
-		            wp_set_object_terms( $id, intval($term['term_id']), 'location',true);
777
-		        }
778
-		        $country_id = intval($term['term_id']);
779
-		    }
765
+				{
766
+					$term = wp_insert_term(trim($data[0]['position']['country']), 'location');
767
+					if ( is_wp_error($term) ){
768
+						echo $term->get_error_message();
769
+					}
770
+					else {
771
+						wp_set_object_terms( $id, intval($term['term_id']), 'location',true);
772
+					}
773
+				}
774
+				else
775
+				{
776
+					wp_set_object_terms( $id, intval($term['term_id']), 'location',true);
777
+				}
778
+				$country_id = intval($term['term_id']);
779
+			}
780 780
 
781 781
 			if(isset($data[0]['position']['destination'])){
782 782
 
783 783
 				$tax_args = array('parent'=>$country_id);
784 784
 				if(!$term = term_exists(trim($data[0]['position']['destination']), 'location'))
785
-		        {
786
-		            $term = wp_insert_term(trim($data[0]['position']['destination']), 'location', $tax_args);
787
-		            if ( is_wp_error($term) ){echo $term->get_error_message();}
788
-		            else { wp_set_object_terms( $id, intval($term['term_id']), 'location',true); }
789
-		        }
790
-		        else
791
-		        {
792
-		            wp_set_object_terms( $id, intval($term['term_id']), 'location',true);
793
-		        }				
785
+				{
786
+					$term = wp_insert_term(trim($data[0]['position']['destination']), 'location', $tax_args);
787
+					if ( is_wp_error($term) ){echo $term->get_error_message();}
788
+					else { wp_set_object_terms( $id, intval($term['term_id']), 'location',true); }
789
+				}
790
+				else
791
+				{
792
+					wp_set_object_terms( $id, intval($term['term_id']), 'location',true);
793
+				}				
794 794
 			}		
795 795
 		}
796 796
 	}
@@ -800,28 +800,28 @@  discard block
 block discarded – undo
800 800
 	 */
801 801
 	public function connect_destinations($data,$id) {
802 802
 		if(isset($data[0]['position'])){
803
-		    $destinations = false;
804
-		    if(isset($data[0]['position']['country'])){
805
-		    	$destinations['country'] = $data[0]['position']['country'];
806
-		    }
807
-		    if(isset($data[0]['position']['destination'])){
808
-		    	$destinations['destination'] = $data[0]['position']['destination'];
809
-		    }
803
+			$destinations = false;
804
+			if(isset($data[0]['position']['country'])){
805
+				$destinations['country'] = $data[0]['position']['country'];
806
+			}
807
+			if(isset($data[0]['position']['destination'])){
808
+				$destinations['destination'] = $data[0]['position']['destination'];
809
+			}
810 810
 		    
811
-		    if(false !== $destinations){	
812
-		    	$prev_values = get_post_meta($id,'destination_to_accommodation',false);
813
-		    	if(false === $prev_values || !is_array($prev_values)){
814
-		    		$prev_values = array();
815
-		    	}
816
-			    foreach($destinations as $key => $value){
817
-				    $destination = get_page_by_title(ltrim(rtrim($value)), 'OBJECT', 'destination');
818
-	                if (null !== $destination) {
819
-	                	if(!in_array($destination->ID,$prev_values)){
820
-	                   		add_post_meta($id,'destination_to_accommodation',$destination->ID,false);
821
-	                   		add_post_meta($destination->ID,'accommodation_to_destination',$id,false);
822
-	                	}
823
-	                } 		    	
824
-			    }	
811
+			if(false !== $destinations){	
812
+				$prev_values = get_post_meta($id,'destination_to_accommodation',false);
813
+				if(false === $prev_values || !is_array($prev_values)){
814
+					$prev_values = array();
815
+				}
816
+				foreach($destinations as $key => $value){
817
+					$destination = get_page_by_title(ltrim(rtrim($value)), 'OBJECT', 'destination');
818
+					if (null !== $destination) {
819
+						if(!in_array($destination->ID,$prev_values)){
820
+					   		add_post_meta($id,'destination_to_accommodation',$destination->ID,false);
821
+					   		add_post_meta($destination->ID,'accommodation_to_destination',$id,false);
822
+						}
823
+					} 		    	
824
+				}	
825 825
 			}
826 826
 		}
827 827
 	}	
@@ -833,15 +833,15 @@  discard block
 block discarded – undo
833 833
 		$terms = false;
834 834
 		if(isset($data[0]['category'])){
835 835
 			if(!$term = term_exists(trim($data[0]['category']), 'accommodation-type'))
836
-	        {
837
-	            $term = wp_insert_term(trim($data[0]['category']), 'accommodation-type');
838
-	            if ( is_wp_error($term) ){echo $term->get_error_message();}
839
-	            else { wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true); }
840
-	        }
841
-	        else
842
-	        {
843
-	            wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true);
844
-	        }				
836
+			{
837
+				$term = wp_insert_term(trim($data[0]['category']), 'accommodation-type');
838
+				if ( is_wp_error($term) ){echo $term->get_error_message();}
839
+				else { wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true); }
840
+			}
841
+			else
842
+			{
843
+				wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true);
844
+			}				
845 845
 		}
846 846
 	}		
847 847
 
@@ -865,25 +865,25 @@  discard block
 block discarded – undo
865 865
 				$temp_room['type'] = 'room';
866 866
 
867 867
 				if(!empty($room['images']) && is_array($room['images'])){
868
-			    	$attachments_args = array(
869
-			    			'post_parent' => $id,
870
-			    			'post_status' => 'inherit',
871
-			    			'post_type' => 'attachment',
872
-			    			'order' => 'ASC',
873
-			    	);   	
874
-			    	$attachments = new WP_Query($attachments_args);
875
-			    	$found_attachments = array();
876
-
877
-			    	if($attachments->have_posts()){
878
-			    		foreach($attachments->posts as $attachment){
879
-			    			$found_attachments[] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title);
880
-			    		}
881
-			    	}
868
+					$attachments_args = array(
869
+							'post_parent' => $id,
870
+							'post_status' => 'inherit',
871
+							'post_type' => 'attachment',
872
+							'order' => 'ASC',
873
+					);   	
874
+					$attachments = new WP_Query($attachments_args);
875
+					$found_attachments = array();
876
+
877
+					if($attachments->have_posts()){
878
+						foreach($attachments->posts as $attachment){
879
+							$found_attachments[] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title);
880
+						}
881
+					}
882 882
 
883 883
 					$temp_room['gallery'] = array();
884 884
 					foreach($room['images'] as $image_data){
885
-			    		$temp_room['gallery'][] = $this->attach_image($image_data,$id,$found_attachments);
886
-			    	}
885
+						$temp_room['gallery'][] = $this->attach_image($image_data,$id,$found_attachments);
886
+					}
887 887
 				}
888 888
 				$rooms[] = $temp_room;
889 889
 			}
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 				delete_post_meta($id, 'units');				
893 893
 			}
894 894
 			foreach($rooms as $room){
895
-		        add_post_meta($id,'units',$room,false);			
895
+				add_post_meta($id,'units',$room,false);			
896 896
 			}
897 897
 
898 898
 			if(isset($data[0]['features']) && isset($data[0]['features']['rooms'])){
@@ -902,11 +902,11 @@  discard block
 block discarded – undo
902 902
 			}
903 903
 
904 904
 			if(false !== $id && '0' !== $id){
905
-	        	$prev_rooms = get_post_meta($id,'number_of_rooms',true);
906
-	        	update_post_meta($id,'number_of_rooms',$room_count,$prev_rooms);
907
-	        }else{
908
-	        	add_post_meta($id,'number_of_rooms',$room_count,true);
909
-	        }
905
+				$prev_rooms = get_post_meta($id,'number_of_rooms',true);
906
+				update_post_meta($id,'number_of_rooms',$room_count,$prev_rooms);
907
+			}else{
908
+				add_post_meta($id,'number_of_rooms',$room_count,true);
909
+			}
910 910
 		}
911 911
 	}
912 912
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 				delete_post_meta($id, 'videos');				
1016 1016
 			}
1017 1017
 			foreach($videos as $video){
1018
-		        add_post_meta($id,'videos',$video,false);			
1018
+				add_post_meta($id,'videos',$video,false);			
1019 1019
 			}
1020 1020
 		}
1021 1021
 	}	
@@ -1044,17 +1044,17 @@  discard block
 block discarded – undo
1044 1044
 
1045 1045
 	function set_term($id=false,$name=false,$taxonomy=false,$parent=false){
1046 1046
 		if(!$term = term_exists($name, $taxonomy))
1047
-        {
1048
-        	if(false !== $parent){ $parent = array('parent'=>$parent); }
1049
-            $term = wp_insert_term(trim($name), $taxonomy,$parent);
1050
-            if ( is_wp_error($term) ){echo $term->get_error_message();}
1051
-            else { wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true); }
1052
-        }
1053
-        else
1054
-        {
1055
-            wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true);
1056
-        }
1057
-        return $term['term_id'];
1047
+		{
1048
+			if(false !== $parent){ $parent = array('parent'=>$parent); }
1049
+			$term = wp_insert_term(trim($name), $taxonomy,$parent);
1050
+			if ( is_wp_error($term) ){echo $term->get_error_message();}
1051
+			else { wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true); }
1052
+		}
1053
+		else
1054
+		{
1055
+			wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true);
1056
+		}
1057
+		return $term['term_id'];
1058 1058
 	}	
1059 1059
 
1060 1060
 	/**
@@ -1062,17 +1062,17 @@  discard block
 block discarded – undo
1062 1062
 	 */
1063 1063
 	public function set_featured_image($data,$id) {
1064 1064
 		if(is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])){
1065
-	    	$this->featured_image = $this->attach_image($data[0]['content']['images'][0],$id);
1065
+			$this->featured_image = $this->attach_image($data[0]['content']['images'][0],$id);
1066 1066
 
1067
-	    	if(false !== $this->featured_image){
1068
-	    		delete_post_meta($id,'_thumbnail_id');
1069
-	    		add_post_meta($id,'_thumbnail_id',$this->featured_image,true);
1067
+			if(false !== $this->featured_image){
1068
+				delete_post_meta($id,'_thumbnail_id');
1069
+				add_post_meta($id,'_thumbnail_id',$this->featured_image,true);
1070 1070
 
1071
-	    		if(!empty($this->gallery_meta) && !in_array($this->featured_image,$this->gallery_meta)){
1072
-	    			add_post_meta($id,'gallery',$this->featured_image,false);
1073
-	    			$this->gallery_meta[] = $this->featured_image;
1074
-	    		}
1075
-	    	}			
1071
+				if(!empty($this->gallery_meta) && !in_array($this->featured_image,$this->gallery_meta)){
1072
+					add_post_meta($id,'gallery',$this->featured_image,false);
1073
+					$this->gallery_meta[] = $this->featured_image;
1074
+				}
1075
+			}			
1076 1076
 		}	
1077 1077
 	}	
1078 1078
 
@@ -1081,18 +1081,18 @@  discard block
 block discarded – undo
1081 1081
 	 */
1082 1082
 	public function set_banner_image($data,$id) {
1083 1083
 		if(is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])){
1084
-	    	$this->banner_image = $this->attach_image($data[0]['content']['images'][1],$id,array('width'=>'1920','height'=>'800','cropping'=>'c'));
1085
-
1086
-	    	if(false !== $this->banner_image){
1087
-	    		delete_post_meta($id,'image_group');
1088
-	    		$new_banner = array('banner_image'=>array('cmb-field-0'=>$this->banner_image));
1089
-	    		add_post_meta($id,'image_group',$new_banner,true);
1090
-
1091
-	    		if(!empty($this->gallery_meta) && !in_array($this->banner_image,$this->gallery_meta)){
1092
-	    			add_post_meta($id,'gallery',$this->banner_image,false);
1093
-	    			$this->gallery_meta[] = $this->banner_image;
1094
-	    		}
1095
-	    	}			
1084
+			$this->banner_image = $this->attach_image($data[0]['content']['images'][1],$id,array('width'=>'1920','height'=>'800','cropping'=>'c'));
1085
+
1086
+			if(false !== $this->banner_image){
1087
+				delete_post_meta($id,'image_group');
1088
+				$new_banner = array('banner_image'=>array('cmb-field-0'=>$this->banner_image));
1089
+				add_post_meta($id,'image_group',$new_banner,true);
1090
+
1091
+				if(!empty($this->gallery_meta) && !in_array($this->banner_image,$this->gallery_meta)){
1092
+					add_post_meta($id,'gallery',$this->banner_image,false);
1093
+					$this->gallery_meta[] = $this->banner_image;
1094
+				}
1095
+			}			
1096 1096
 		}	
1097 1097
 	}		
1098 1098
 
@@ -1103,24 +1103,24 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
 		if(is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])){
1105 1105
 
1106
-	    	$counter = 0;
1107
-	    	foreach($data[0]['content']['images'] as $image_data){
1108
-	    		if($counter === 0 && false !== $this->featured_image){continue;}
1109
-	    		if($counter === 1 && false !== $this->banner_image){continue;}
1110
-
1111
-	    		$this->gallery_meta[] = $temp_id = $this->attach_image($image_data,$id);
1112
-	    		$counter++;
1113
-	    	}
1114
-
1115
-	    	if(!empty($this->gallery_meta)){
1116
-	    		delete_post_meta($id,'gallery');
1117
-	    		foreach($this->gallery_meta as $gallery_id){
1118
-	    			if(false !== $gallery_id && '' !== $gallery_id && !is_array($gallery_id)){
1119
-	    				add_post_meta($id,'gallery',$gallery_id,false);
1120
-	    			}
1121
-	    		}
1122
-	    	}
1123
-    	}
1106
+			$counter = 0;
1107
+			foreach($data[0]['content']['images'] as $image_data){
1108
+				if($counter === 0 && false !== $this->featured_image){continue;}
1109
+				if($counter === 1 && false !== $this->banner_image){continue;}
1110
+
1111
+				$this->gallery_meta[] = $temp_id = $this->attach_image($image_data,$id);
1112
+				$counter++;
1113
+			}
1114
+
1115
+			if(!empty($this->gallery_meta)){
1116
+				delete_post_meta($id,'gallery');
1117
+				foreach($this->gallery_meta as $gallery_id){
1118
+					if(false !== $gallery_id && '' !== $gallery_id && !is_array($gallery_id)){
1119
+						add_post_meta($id,'gallery',$gallery_id,false);
1120
+					}
1121
+				}
1122
+			}
1123
+		}
1124 1124
 	}	
1125 1125
 
1126 1126
 	/**
@@ -1129,42 +1129,42 @@  discard block
 block discarded – undo
1129 1129
 	public function attach_image($v=false,$parent_id,$image_sizes=false){
1130 1130
 		if(false !== $v){
1131 1131
 	   		$temp_fragment = explode('/',$v['url_fragment']);
1132
-	    	$url_filename = $temp_fragment[count($temp_fragment)-1];
1133
-	    	$url_filename = str_replace(array('.jpg','.png','.jpeg'),'',$url_filename);
1132
+			$url_filename = $temp_fragment[count($temp_fragment)-1];
1133
+			$url_filename = str_replace(array('.jpg','.png','.jpeg'),'',$url_filename);
1134 1134
 	
1135
-	    	if(in_array($url_filename,$this->found_attachments)){
1136
-	    		return array_search($url_filename,$this->found_attachments);
1137
-	    	}
1135
+			if(in_array($url_filename,$this->found_attachments)){
1136
+				return array_search($url_filename,$this->found_attachments);
1137
+			}
1138 1138
 	    	               
1139
-	        $postdata=array();
1140
-	        if(empty($v['label']))
1141
-	        {
1142
-	            $v['label']='';
1143
-	        }
1144
-	        if(!empty($v['description']))
1145
-	        {
1146
-	            $desc=wp_strip_all_tags($v['description']);
1147
-	            $posdata=array('post_excerpt'=>$desc);
1148
-	        }
1149
-	        if(!empty($v['section']))
1150
-	        {
1151
-	            $desc=wp_strip_all_tags($v['section']);
1152
-	            $posdata=array('post_excerpt'=>$desc);
1153
-	        }
1154
-
1155
-	        $attachID=NULL;  
1156
-	        //Resizor - add option to setting if required
1157
-	        $fragment = str_replace(' ','%20',$v['url_fragment']);
1158
-	        $url = $this->get_scaling_url($image_sizes).$fragment;
1159
-	        $attachID = $this->attach_external_image2($url,$parent_id,'',$v['label'],$postdata);
1160
-
1161
-	        //echo($attachID.' add image');
1162
-	        if($attachID!=NULL)
1163
-	        {
1164
-	            return $attachID;
1165
-	        }
1166
-        }	
1167
-        return 	false;
1139
+			$postdata=array();
1140
+			if(empty($v['label']))
1141
+			{
1142
+				$v['label']='';
1143
+			}
1144
+			if(!empty($v['description']))
1145
+			{
1146
+				$desc=wp_strip_all_tags($v['description']);
1147
+				$posdata=array('post_excerpt'=>$desc);
1148
+			}
1149
+			if(!empty($v['section']))
1150
+			{
1151
+				$desc=wp_strip_all_tags($v['section']);
1152
+				$posdata=array('post_excerpt'=>$desc);
1153
+			}
1154
+
1155
+			$attachID=NULL;  
1156
+			//Resizor - add option to setting if required
1157
+			$fragment = str_replace(' ','%20',$v['url_fragment']);
1158
+			$url = $this->get_scaling_url($image_sizes).$fragment;
1159
+			$attachID = $this->attach_external_image2($url,$parent_id,'',$v['label'],$postdata);
1160
+
1161
+			//echo($attachID.' add image');
1162
+			if($attachID!=NULL)
1163
+			{
1164
+				return $attachID;
1165
+			}
1166
+		}	
1167
+		return 	false;
1168 1168
 	}
1169 1169
 	public function attach_external_image2( $url = null, $post_id = null, $thumb = null, $filename = null, $post_data = array() ) {
1170 1170
 	
Please login to merge, or discard this patch.