Code Duplication    Length = 40-41 lines in 2 locations

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

classes/class-accommodation.php 1 location

@@ 403-442 (lines=40) @@
400
						}
401
402
						//If we are searching for
403
						if(false !== $post_status){
404
405
							if('import' === $post_status){
406
407
								if(0 !== $row['post_id']){
408
									continue;
409
								}else{
410
									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
411
								}
412
413
414
							}else{
415
416
								if(0 === $row['post_id']){
417
									continue;
418
								}else{
419
									$current_status = get_post_status($row['post_id']);
420
									if($current_status !== $post_status){
421
										continue;
422
									}
423
424
								}
425
								$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
426
							}
427
428
						}else{
429
							//Search through each keyword.
430
							foreach($keyphrases as $keyphrase){
431
432
								//Make sure the keyphrase is turned into an array
433
								$keywords = explode(" ",$keyphrase);
434
								if(!is_array($keywords)){
435
									$keywords = array($keywords);
436
								}
437
438
								if($this->multineedle_stripos(ltrim(rtrim($row['name'])), $keywords) !== false){
439
									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
440
								}
441
							}
442
						}
443
					}		
444
				}
445