Code Duplication    Length = 40-41 lines in 2 locations

classes/class-accommodation.php 1 location

@@ 303-342 (lines=40) @@
300
						}
301
302
						//If we are searching for
303
						if(false !== $post_status){
304
305
							if('import' === $post_status){
306
307
								if(0 !== $row['post_id']){
308
									continue;
309
								}else{
310
									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
311
								}
312
313
314
							}else{
315
316
								if(0 === $row['post_id']){
317
									continue;
318
								}else{
319
									$current_status = get_post_status($row['post_id']);
320
									if($current_status !== $post_status){
321
										continue;
322
									}
323
324
								}
325
								$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
326
							}
327
328
						}else{
329
							//Search through each keyword.
330
							foreach($keyphrases as $keyphrase){
331
332
								//Make sure the keyphrase is turned into an array
333
								$keywords = explode(" ",$keyphrase);
334
								if(!is_array($keywords)){
335
									$keywords = array($keywords);
336
								}
337
338
								if($this->multineedle_stripos(ltrim(rtrim($row['name'])), $keywords) !== false){
339
									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
340
								}
341
							}
342
						}
343
					}		
344
				}
345

classes/class-tours.php 1 location

@@ 418-458 (lines=41) @@
415
						}
416
417
						//If we are searching for
418
						if(false !== $post_status){
419
420
							if('import' === $post_status){
421
422
								if(0 !== $row['post_id']){
423
									continue;
424
								}else{
425
									$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
426
								}
427
428
429
							}else{
430
431
								if(0 === $row['post_id']){
432
									continue;
433
								}else{
434
									$current_status = get_post_status($row['post_id']);
435
									if($current_status !== $post_status){
436
										continue;
437
									}
438
439
								}
440
								$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
441
442
							}
443
444
						}else{
445
							//Search through each keyword.
446
							foreach($keyphrases as $keyphrase){
447
448
								//Make sure the keyphrase is turned into an array
449
								$keywords = explode(" ",$keyphrase);
450
								if(!is_array($keywords)){
451
									$keywords = array($keywords);
452
								}
453
454
								if($this->multineedle_stripos(ltrim(rtrim($row['name'])), $keywords) !== false){
455
									$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
456
								}
457
							}
458
						}
459
					}
460
				}
461