Code Duplication    Length = 15-17 lines in 3 locations

classes/class-wetu-importer-accommodation.php 1 location

@@ 480-494 (lines=15) @@
477
478
			$jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
479
480
			if ( $jdata ) {
481
				$adata = json_decode( $jdata,true );
482
				if ( ! empty( $adata ) && ! isset( $adata['error'] ) ) {
483
					$return = $this->import_row( $adata,$wetu_id,$post_id,$team_members,$content,$safari_brands );
484
					$this->format_completed_row( $return );
485
					$this->remove_from_queue( $return );
486
					$this->cleanup_posts();
487
				} else {
488
					if ( isset( $adata['error'] ) ) {
489
						$this->format_error( $adata['error'] );
490
					} else {
491
						$this->format_error( esc_html__( 'There was a problem importing your accommodation, please try refreshing the page.', 'wetu-importer' ) );
492
					}
493
				}
494
			}
495
		}
496
	}
497

classes/class-wetu-importer-tours.php 1 location

@@ 538-554 (lines=17) @@
535
536
			$jdata = file_get_contents( 'http://wetu.com/API/Itinerary/V7/Get?id=' . $wetu_id );
537
538
			if ( $jdata ) {
539
				$jdata = json_decode( $jdata,true );
540
				if ( ! empty( $jdata ) && ! isset( $jdata['error'] ) ) {
541
					$return = $this->import_row( $jdata,$wetu_id,$post_id,$content );
542
					$this->format_completed_row( $return );
543
					$this->save_queue();
544
					$this->cleanup_posts();
545
					$this->attach_destination_images( $content );
546
					$this->clean_attached_destinations( $return );
547
				} else {
548
					if ( isset( $adata['error'] ) ) {
549
						$this->format_error( $adata['error'] );
550
					} else {
551
						$this->format_error( esc_html__( 'There was a problem importing your tour, please try refreshing the page.','wetu-importer' ) );
552
					}
553
				}
554
			}
555
		}
556
	}
557

classes/class-wetu-importer-destination.php 1 location

@@ 519-533 (lines=15) @@
516
517
			$jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
518
519
			if ( $jdata ) {
520
				$adata = json_decode( $jdata, true );
521
522
				if ( ! empty( $adata ) && ! isset( $adata['error'] ) ) {
523
					$return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands );
524
					$this->remove_from_queue( $return );
525
					$this->format_completed_row( $return );
526
				} else {
527
					if ( isset( $adata['error'] ) ) {
528
						$this->format_error( $adata['error'] );
529
					} else {
530
						$this->format_error( esc_html__( 'There was a problem importing your destination, please try refreshing the page.','wetu-importer' ) );
531
					}
532
				}
533
			}
534
		}
535
	}
536