Code Duplication    Length = 27-27 lines in 2 locations

classes/class-accommodation.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'] = 'publish';
480
					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 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', '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
				$this->find_attachments($id);

classes/class-destination.php 1 location

@@ 535-561 (lines=27) @@
532
				$post['post_excerpt'] = $data_post_excerpt;
533
			}
534
535
			if (false !== $id && '0' !== $id) {
536
				$post['ID'] = $id;
537
				if (isset($data[0]['name'])) {
538
					$post['post_title'] = $data[0]['name'];
539
					$post['post_status'] = 'publish';
540
					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0);
541
				}
542
				$id = wp_update_post($post);
543
				$prev_date = get_post_meta($id, 'lsx_wetu_modified_date', true);
544
				update_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']), $prev_date);
545
			} else {
546
547
				//Set the name
548
				if (isset($data[0]['name'])) {
549
					$post_name = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0);
550
				}
551
				$post['post_name'] = $post_name;
552
				$post['post_title'] = $data[0]['name'];
553
				$post['post_status'] = 'publish';
554
				$id = wp_insert_post($post);
555
556
				//Save the WETU ID and the Last date it was modified.
557
				if (false !== $id) {
558
					add_post_meta($id, 'lsx_wetu_id', $wetu_id);
559
					add_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']));
560
				}
561
			}
562
563
			//Set the team member if it is there
564
			if (post_type_exists('team') && false !== $team_members && '' !== $team_members) {