Code Duplication    Length = 36-36 lines in 2 locations

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

@@ 335-370 (lines=36) @@
332
						}
333
334
						//If we are searching for
335
						if ( false !== $post_status ) {
336
							if ( 'import' === $post_status ) {
337
338
								if ( is_array( $this->queued_imports ) && in_array( $row['post_id'],$this->queued_imports ) ) {
339
									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
340
								} else {
341
									continue;
342
								}
343
							} else {
344
								if ( 0 === $row['post_id'] ) {
345
									continue;
346
								} else {
347
									$current_status = get_post_status( $row['post_id'] );
348
349
									if ( $current_status !== $post_status ) {
350
										continue;
351
									}
352
								}
353
354
								$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
355
							}
356
						} else {
357
							//Search through each keyword.
358
							foreach ( $keyphrases as $keyphrase ) {
359
								//Make sure the keyphrase is turned into an array
360
								$keywords = explode( ' ',$keyphrase );
361
362
								if ( ! is_array( $keywords ) ) {
363
									$keywords = array( $keywords );
364
								}
365
366
								if ( $this->multineedle_stripos( ltrim( rtrim( $row['name'] ) ), $keywords ) !== false ) {
367
									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
368
								}
369
							}
370
						}
371
					}
372
				}
373

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

@@ 393-428 (lines=36) @@
390
							}
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
						}// end of the destination if
430
					}
431
				}