Code Duplication    Length = 27-27 lines in 2 locations

classes/class-accommodation.php 1 location

@@ 489-515 (lines=27) @@
486
		        $post['post_excerpt'] = $data_post_excerpt;     	
487
	        }
488
489
	        if(false !== $id && '0' !== $id){
490
	        	$post['ID'] = $id;
491
				if(isset($data[0]['name'])){
492
					$post['post_title'] = $data[0]['name'];
493
	        		$post['post_status'] = 'publish';
494
					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
495
				}
496
	        	$id = wp_update_post($post);
497
	        	$prev_date = get_post_meta($id,'lsx_wetu_modified_date',true);
498
	        	update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date);
499
	        }else{
500
501
		        //Set the name
502
		        if(isset($data[0]['name'])){
503
		            $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0);
504
		        }
505
	        	$post['post_name'] = $post_name;
506
	        	$post['post_title'] = $data[0]['name'];
507
	        	$post['post_status'] = 'publish';
508
	        	$id = wp_insert_post($post);
509
510
	        	//Save the WETU ID and the Last date it was modified.
511
	        	if(false !== $id){
512
	        		add_post_meta($id,'lsx_wetu_id',$wetu_id);
513
	        		add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']));
514
	        	}
515
	        }
516
	        //Setup some default for use in the import
517
	        if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){
518
				$this->find_attachments($id);

classes/class-destination.php 1 location

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