Code Duplication    Length = 40-41 lines in 2 locations

classes/class-accommodation.php 1 location

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

classes/class-tours.php 1 location

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