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

@@ 373-413 (lines=41) @@
370
						}
371
372
						//If we are searching for
373
						if(false !== $post_status){
374
375
							if('import' === $post_status){
376
377
								if(0 !== $row['post_id']){
378
									continue;
379
								}else{
380
									$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
381
								}
382
383
384
							}else{
385
386
								if(0 === $row['post_id']){
387
									continue;
388
								}else{
389
									$current_status = get_post_status($row['post_id']);
390
									if($current_status !== $post_status){
391
										continue;
392
									}
393
394
								}
395
								$searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row);
396
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['identifier']] = $this->format_row($row);
411
								}
412
							}
413
						}
414
					}
415
				}
416