Code Duplication    Length = 27-27 lines in 2 locations

classes/class-accommodation.php 1 location

@@ 583-609 (lines=27) @@
580
		        $post['post_excerpt'] = $data_post_excerpt;     	
581
	        }
582
583
	        if(false !== $id && '0' !== $id){
584
	        	$post['ID'] = $id;
585
				if(isset($data[0]['name'])){
586
					$post['post_title'] = $data[0]['name'];
587
	        		$post['post_status'] = 'publish';
588
					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
589
				}
590
	        	$id = wp_update_post($post);
591
	        	$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
592
	        	update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date);
593
	        }else{
594
595
		        //Set the name
596
		        if(isset($data[0]['name'])){
597
		            $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
598
		        }
599
	        	$post['post_name'] = $post_name;
600
	        	$post['post_title'] = $data[0]['name'];
601
	        	$post['post_status'] = 'publish';
602
	        	$id = wp_insert_post($post);
603
604
	        	//Save the WETU ID and the Last date it was modified.
605
	        	if(false !== $id){
606
	        		add_post_meta($id,'lsx_wetu_id',$wetu_id);
607
	        		add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']));
608
	        	}
609
	        }
610
	        //Setup some default for use in the import
611
	        if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){
612
				$this->find_attachments($id);

classes/class-destination.php 1 location

@@ 506-532 (lines=27) @@
503
		        $post['post_excerpt'] = $data_post_excerpt;     	
504
	        }
505
506
	        if(false !== $id && '0' !== $id){
507
	        	$post['ID'] = $id;
508
				if(isset($data[0]['name'])){
509
					$post['post_title'] = $data[0]['name'];
510
					$post['post_status'] = 'publish';
511
					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0);
512
				}
513
	        	$id = wp_update_post($post);
514
	        	$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
515
	        	update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date);
516
	        }else{
517
518
		        //Set the name
519
		        if(isset($data[0]['name'])){
520
		            $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0);
521
		        }
522
	        	$post['post_name'] = $post_name;
523
	        	$post['post_title'] = $data[0]['name'];
524
	        	$post['post_status'] = 'publish';
525
	        	$id = wp_insert_post($post);
526
527
	        	//Save the WETU ID and the Last date it was modified.
528
	        	if(false !== $id){
529
	        		add_post_meta($id,'lsx_wetu_id',$wetu_id);
530
	        		add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']));
531
	        	}
532
	        }
533
534
	        //Set the team member if it is there
535
	        if(post_type_exists('team') && false !== $team_members && '' !== $team_members){