Code Duplication    Length = 27-27 lines in 2 locations

classes/class-accommodation.php 1 location

@@ 568-594 (lines=27) @@
565
		        $post['post_excerpt'] = $data_post_excerpt;     	
566
	        }
567
568
	        if(false !== $id && '0' !== $id){
569
	        	$post['ID'] = $id;
570
				if(isset($data[0]['name'])){
571
					$post['post_title'] = $data[0]['name'];
572
	        		$post['post_status'] = 'pending';
573
					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
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))){
597
				$this->find_attachments($id);

classes/class-destination.php 1 location

@@ 475-501 (lines=27) @@
472
		        $post['post_excerpt'] = $data_post_excerpt;     	
473
	        }
474
475
	        if(false !== $id && '0' !== $id){
476
	        	$post['ID'] = $id;
477
				if(isset($data[0]['name'])){
478
					$post['post_title'] = $data[0]['name'];
479
					$post['post_status'] = 'pending';
480
					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0);
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){