Code Duplication    Length = 36-36 lines in 2 locations

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

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

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

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