Code Duplication    Length = 20-36 lines in 2 locations

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

@@ 338-357 (lines=20) @@
335
336
						//If we are searching for
337
						if ( false !== $post_status ) {
338
							if ( 'import' === $post_status ) {
339
340
								if ( is_array( $this->queued_imports ) && in_array( $row['post_id'],$this->queued_imports ) ) {
341
									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
342
								} else {
343
									continue;
344
								}
345
							} else {
346
								if ( 0 === $row['post_id'] ) {
347
									continue;
348
								} else {
349
									$current_status = get_post_status( $row['post_id'] );
350
351
									if ( $current_status !== $post_status ) {
352
										continue;
353
									}
354
								}
355
356
								$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
357
							}
358
						} else {
359
							//Search through each keyword.
360
							foreach ( $keyphrases as $keyphrase ) {

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

@@ 393-428 (lines=36) @@
390
						//If this is a current tour, add its ID to the row.
391
392
						//If we are searching for
393
						if ( false !== $post_status ) {
394
							if ( 'import' === $post_status ) {
395
396
								if ( is_array( $this->queued_imports ) && in_array( $row['post_id'], $this->queued_imports ) ) {
397
									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
398
								} else {
399
									continue;
400
								}
401
							} else {
402
								if ( 0 === $row['post_id'] ) {
403
									continue;
404
								} else {
405
									$current_status = get_post_status( $row['post_id'] );
406
407
									if ( $current_status !== $post_status ) {
408
										continue;
409
									}
410
								}
411
412
								$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
413
							}
414
						} else {
415
							//Search through each keyword.
416
							/*foreach ( $keyphrases as $keyphrase ) {
417
								//Make sure the keyphrase is turned into an array
418
								$keywords = explode( ' ', $keyphrase );
419
420
								if ( ! is_array( $keywords ) ) {
421
									$keywords = array( $keywords );
422
								}
423
424
								if ( $this->multineedle_stripos( ltrim( rtrim( $row['name'] ) ), $keywords ) !== false ) {
425
									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
426
								}
427
							}*/
428
						}
429
					}
430
				}
431