Code Duplication    Length = 40-41 lines in 2 locations

classes/class-accommodation.php 1 location

@@ 389-428 (lines=40) @@
386
						}
387
388
						//If we are searching for
389
						if(false !== $post_status){
390
391
							if('import' === $post_status){
392
393
								if(0 !== $row['post_id']){
394
									continue;
395
								}else{
396
									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
397
								}
398
399
400
							}else{
401
402
								if(0 === $row['post_id']){
403
									continue;
404
								}else{
405
									$current_status = get_post_status($row['post_id']);
406
									if($current_status !== $post_status){
407
										continue;
408
									}
409
410
								}
411
								$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
412
							}
413
414
						}else{
415
							//Search through each keyword.
416
							foreach($keyphrases as $keyphrase){
417
418
								//Make sure the keyphrase is turned into an array
419
								$keywords = explode(" ",$keyphrase);
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

classes/class-tours.php 1 location

@@ 363-403 (lines=41) @@
360
						}
361
362
						//If we are searching for
363
						if(false !== $post_status){
364
365
                            if('import' === $post_status){
366
367
								if(0 !== $row['post_id']){
368
								    continue;
369
								}else{
370
									$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
371
                                }
372
373
374
                            }else{
375
376
								if(0 === $row['post_id']){
377
									continue;
378
								}else{
379
									$current_status = get_post_status($row['post_id']);
380
									if($current_status !== $post_status){
381
									    continue;
382
                                    }
383
384
								}
385
								$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
386
387
                            }
388
389
                        }else{
390
							//Search through each keyword.
391
							foreach($keyphrases as $keyphrase){
392
393
								//Make sure the keyphrase is turned into an array
394
								$keywords = explode(" ",$keyphrase);
395
								if(!is_array($keywords)){
396
									$keywords = array($keywords);
397
								}
398
399
								if($this->multineedle_stripos(ltrim(rtrim($row['name'])), $keywords) !== false){
400
									$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
401
								}
402
							}
403
                        }
404
					}		
405
				}
406