@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | if('import' === $post_status) { |
358 | 358 | if(is_array($this->queued_imports) && in_array($row->post_id,$this->queued_imports)){ |
359 | 359 | $searched_items[sanitize_title($row->name) . '-' . $row->meta_value] = $this->format_row($row); |
360 | - }else{ |
|
360 | + } else{ |
|
361 | 361 | continue; |
362 | 362 | } |
363 | - }else if (false !== $post_status) { |
|
363 | + } else if (false !== $post_status) { |
|
364 | 364 | |
365 | 365 | $current_status = get_post_status($row->post_id); |
366 | 366 | if ($current_status !== $post_status) { |
@@ -468,10 +468,10 @@ discard block |
||
468 | 468 | $return = $this->import_row($adata, $wetu_id, $post_id, $team_members, $content, $safari_brands); |
469 | 469 | $this->remove_from_queue($return); |
470 | 470 | $this->format_completed_row($return); |
471 | - }else{ |
|
471 | + } else{ |
|
472 | 472 | if(isset($adata['error'])){ |
473 | 473 | $this->format_error($adata['error']); |
474 | - }else{ |
|
474 | + } else{ |
|
475 | 475 | $this->format_error(esc_html__('There was a problem importing your destination, please try refreshing the page.','wetu-importer')); |
476 | 476 | } |
477 | 477 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | if(isset($accommodation['error'])){ |
239 | 239 | return $accommodation['error']; |
240 | - }elseif (isset($accommodation) && !empty($accommodation)) { |
|
240 | + } elseif (isset($accommodation) && !empty($accommodation)) { |
|
241 | 241 | set_transient('lsx_ti_accommodation',$accommodation,60*60*2); |
242 | 242 | return true; |
243 | 243 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | if(isset($_POST['keyword'] )) { |
263 | 263 | $keyphrases = $_POST['keyword']; |
264 | - }else{ |
|
264 | + } else{ |
|
265 | 265 | $keyphrases = array(0); |
266 | 266 | } |
267 | 267 | |
@@ -306,15 +306,15 @@ discard block |
||
306 | 306 | |
307 | 307 | if(is_array($this->queued_imports) && in_array($row['post_id'],$this->queued_imports)){ |
308 | 308 | $searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row); |
309 | - }else{ |
|
309 | + } else{ |
|
310 | 310 | continue; |
311 | 311 | } |
312 | 312 | |
313 | - }else{ |
|
313 | + } else{ |
|
314 | 314 | |
315 | 315 | if(0 === $row['post_id']){ |
316 | 316 | continue; |
317 | - }else{ |
|
317 | + } else{ |
|
318 | 318 | $current_status = get_post_status($row['post_id']); |
319 | 319 | if($current_status !== $post_status){ |
320 | 320 | continue; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row); |
325 | 325 | } |
326 | 326 | |
327 | - }else{ |
|
327 | + } else{ |
|
328 | 328 | //Search through each keyword. |
329 | 329 | foreach($keyphrases as $keyphrase){ |
330 | 330 | |
@@ -409,19 +409,19 @@ discard block |
||
409 | 409 | $wetu_id = $_POST['wetu_id']; |
410 | 410 | if(isset($_POST['post_id'])){ |
411 | 411 | $post_id = $_POST['post_id']; |
412 | - }else{ |
|
412 | + } else{ |
|
413 | 413 | $post_id = 0; |
414 | 414 | } |
415 | 415 | |
416 | 416 | if(isset($_POST['team_members'])){ |
417 | 417 | $team_members = $_POST['team_members']; |
418 | - }else{ |
|
418 | + } else{ |
|
419 | 419 | $team_members = false; |
420 | 420 | } |
421 | 421 | |
422 | 422 | if(isset($_POST['safari_brands'])){ |
423 | 423 | $safari_brands = $_POST['safari_brands']; |
424 | - }else{ |
|
424 | + } else{ |
|
425 | 425 | $safari_brands = false; |
426 | 426 | } |
427 | 427 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | if(isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])){ |
430 | 430 | $content = $_POST['content']; |
431 | 431 | add_option('wetu_importer_accommodation_settings',$content); |
432 | - }else{ |
|
432 | + } else{ |
|
433 | 433 | |
434 | 434 | $content = false; |
435 | 435 | } |
@@ -443,10 +443,10 @@ discard block |
||
443 | 443 | $this->format_completed_row($return); |
444 | 444 | $this->remove_from_queue($return); |
445 | 445 | $this->cleanup_posts(); |
446 | - }else{ |
|
446 | + } else{ |
|
447 | 447 | if(isset($adata['error'])){ |
448 | 448 | $this->format_error($adata['error']); |
449 | - }else{ |
|
449 | + } else{ |
|
450 | 450 | $this->format_error(esc_html__('There was a problem importing your accommodation, please try refreshing the page.','wetu-importer')); |
451 | 451 | } |
452 | 452 | } |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | if(isset($data[0]['content']['extended_description'])) |
472 | 472 | { |
473 | 473 | $data_post_content = $data[0]['content']['extended_description']; |
474 | - }elseif(isset($data[0]['content']['general_description'])){ |
|
474 | + } elseif(isset($data[0]['content']['general_description'])){ |
|
475 | 475 | $data_post_content = $data[0]['content']['general_description']; |
476 | 476 | $content_used_general_description = true; |
477 | - }elseif(isset($data[0]['content']['teaser_description'])){ |
|
477 | + } elseif(isset($data[0]['content']['teaser_description'])){ |
|
478 | 478 | $data_post_content = $data[0]['content']['teaser_description']; |
479 | 479 | } |
480 | 480 | $post['post_content'] = wp_strip_all_tags($data_post_content); |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | if(false !== $importable_content && in_array('excerpt',$importable_content)){ |
485 | 485 | if(isset($data[0]['content']['teaser_description'])){ |
486 | 486 | $data_post_excerpt = $data[0]['content']['teaser_description']; |
487 | - }elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){ |
|
487 | + } elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){ |
|
488 | 488 | $data_post_excerpt = $data[0]['content']['general_description']; |
489 | 489 | } |
490 | 490 | $post['post_excerpt'] = $data_post_excerpt; |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | $id = wp_update_post($post); |
501 | 501 | $prev_date = get_post_meta($id,'lsx_wetu_modified_date',true); |
502 | 502 | update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date); |
503 | - }else{ |
|
503 | + } else{ |
|
504 | 504 | |
505 | 505 | //Set the name |
506 | 506 | if(isset($data[0]['name'])){ |
@@ -663,10 +663,8 @@ discard block |
||
663 | 663 | if(!$term = term_exists(trim($data[0]['category']), 'accommodation-type')) |
664 | 664 | { |
665 | 665 | $term = wp_insert_term(trim($data[0]['category']), 'accommodation-type'); |
666 | - if ( is_wp_error($term) ){echo $term->get_error_message();} |
|
667 | - else { wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true); } |
|
668 | - } |
|
669 | - else |
|
666 | + if ( is_wp_error($term) ){echo $term->get_error_message();} else { wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true); } |
|
667 | + } else |
|
670 | 668 | { |
671 | 669 | wp_set_object_terms( $id, intval($term['term_id']), 'accommodation-type',true); |
672 | 670 | } |
@@ -725,14 +723,14 @@ discard block |
||
725 | 723 | |
726 | 724 | if(isset($data[0]['features']) && isset($data[0]['features']['rooms'])){ |
727 | 725 | $room_count = $data[0]['features']['rooms']; |
728 | - }else{ |
|
726 | + } else{ |
|
729 | 727 | $room_count = count($data[0]['rooms']); |
730 | 728 | } |
731 | 729 | |
732 | 730 | if(false !== $id && '0' !== $id){ |
733 | 731 | $prev_rooms = get_post_meta($id,'number_of_rooms',true); |
734 | 732 | update_post_meta($id,'number_of_rooms',$room_count,$prev_rooms); |
735 | - }else{ |
|
733 | + } else{ |
|
736 | 734 | add_post_meta($id,'number_of_rooms',$room_count,true); |
737 | 735 | } |
738 | 736 | } |
@@ -745,7 +743,7 @@ discard block |
||
745 | 743 | |
746 | 744 | if(!empty($data[0]['features']) && isset($data[0]['features']['star_authority'])){ |
747 | 745 | $rating_type = $data[0]['features']['star_authority']; |
748 | - }else{ |
|
746 | + } else{ |
|
749 | 747 | $rating_type = 'Unspecified2'; |
750 | 748 | } |
751 | 749 | $this->save_custom_field($rating_type,'rating_type',$id); |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | if(true === $result){ |
257 | 257 | echo '<span style="color:green;">'.esc_attr('Connected','wetu-importer').'</span>'; |
258 | 258 | echo ' - <small><a href="#">'.esc_attr('Refresh','wetu-importer').'</a></small>'; |
259 | - }else{ |
|
259 | + } else{ |
|
260 | 260 | echo '<span style="color:red;">'.wp_kses_post($result).'</span>'; |
261 | 261 | } |
262 | - }else{ |
|
262 | + } else{ |
|
263 | 263 | echo '<span style="color:green;">'.esc_attr('Connected','wetu-importer').'</span> - <small><a href="#">'.esc_attr('Refresh','wetu-importer').'</a></small>'; |
264 | 264 | } |
265 | 265 | echo '</h3>'; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | if(isset($tours['error'])){ |
324 | 324 | return $tours['error']; |
325 | - }elseif (isset($tours['itineraries']) && !empty($tours['itineraries'])) { |
|
325 | + } elseif (isset($tours['itineraries']) && !empty($tours['itineraries'])) { |
|
326 | 326 | set_transient('lsx_ti_tours',$tours['itineraries'],60*60*2); |
327 | 327 | return true; |
328 | 328 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | if(isset($_POST['keyword'] )) { |
373 | 373 | $keyphrases = $_POST['keyword']; |
374 | - }else{ |
|
374 | + } else{ |
|
375 | 375 | $keyphrases = array(0); |
376 | 376 | } |
377 | 377 | |
@@ -423,16 +423,16 @@ discard block |
||
423 | 423 | |
424 | 424 | if(0 !== $row['post_id']){ |
425 | 425 | continue; |
426 | - }else{ |
|
426 | + } else{ |
|
427 | 427 | $searched_items[sanitize_title($row['name']).'-'.$row['identifier']] = $this->format_row($row); |
428 | 428 | } |
429 | 429 | |
430 | 430 | |
431 | - }else{ |
|
431 | + } else{ |
|
432 | 432 | |
433 | 433 | if(0 === $row['post_id']){ |
434 | 434 | continue; |
435 | - }else{ |
|
435 | + } else{ |
|
436 | 436 | $current_status = get_post_status($row['post_id']); |
437 | 437 | if($current_status !== $post_status){ |
438 | 438 | continue; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | |
444 | 444 | } |
445 | 445 | |
446 | - }else{ |
|
446 | + } else{ |
|
447 | 447 | //Search through each keyword. |
448 | 448 | foreach($keyphrases as $keyphrase){ |
449 | 449 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | $wetu_id = $_POST['wetu_id']; |
514 | 514 | if(isset($_POST['post_id'])){ |
515 | 515 | $post_id = $_POST['post_id']; |
516 | - }else{ |
|
516 | + } else{ |
|
517 | 517 | $post_id = 0; |
518 | 518 | } |
519 | 519 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | if(isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])){ |
522 | 522 | $content = $_POST['content']; |
523 | 523 | add_option('wetu_importer_tour_settings',$content); |
524 | - }else{ |
|
524 | + } else{ |
|
525 | 525 | $content = false; |
526 | 526 | } |
527 | 527 | |
@@ -536,10 +536,10 @@ discard block |
||
536 | 536 | $this->save_queue(); |
537 | 537 | $this->cleanup_posts(); |
538 | 538 | $this->attach_destination_images($content); |
539 | - }else{ |
|
539 | + } else{ |
|
540 | 540 | if(isset($adata['error'])){ |
541 | 541 | $this->format_error($adata['error']); |
542 | - }else{ |
|
542 | + } else{ |
|
543 | 543 | $this->format_error(esc_html__('There was a problem importing your tour, please try refreshing the page.','wetu-importer')); |
544 | 544 | } |
545 | 545 | } |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | if(isset($data['description'])){ |
568 | 568 | $data_post_content = $data['description']; |
569 | - }elseif(isset($data['summary'])){ |
|
569 | + } elseif(isset($data['summary'])){ |
|
570 | 570 | $data_post_content = $data['summary']; |
571 | 571 | } |
572 | 572 | $post['post_content'] = $data_post_content; |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | $id = wp_update_post($post); |
580 | 580 | $prev_date = get_post_meta($id,'lsx_wetu_modified_date',true); |
581 | 581 | update_post_meta($id,'lsx_wetu_modified_date',strtotime($data['last_modified']),$prev_date); |
582 | - }else{ |
|
582 | + } else{ |
|
583 | 583 | |
584 | 584 | //Set the name |
585 | 585 | if(isset($data['name'])){ |
@@ -670,42 +670,42 @@ discard block |
||
670 | 670 | //Description |
671 | 671 | if(false !== $importable_content && in_array('itinerary_description',$importable_content) && isset($day['notes'])){ |
672 | 672 | $current_day['description'] = $day['notes']; |
673 | - }else{ |
|
673 | + } else{ |
|
674 | 674 | $current_day['description'] = ''; |
675 | 675 | } |
676 | 676 | |
677 | 677 | //Itinerary Gallery |
678 | 678 | if(false !== $importable_content && in_array('itinerary_gallery',$importable_content) && isset($day['images'])){ |
679 | 679 | $current_day['featured_image'] = ''; |
680 | - }else{ |
|
680 | + } else{ |
|
681 | 681 | $current_day['featured_image'] = ''; |
682 | 682 | } |
683 | 683 | |
684 | 684 | //Accommodation |
685 | 685 | if(false !== $current_accommodation){ |
686 | 686 | $current_day['accommodation_to_tour'] = array($current_accommodation); |
687 | - }else{ |
|
687 | + } else{ |
|
688 | 688 | $current_day['accommodation_to_tour'] = array(); |
689 | 689 | } |
690 | 690 | |
691 | 691 | //Destination |
692 | 692 | if(false !== $current_destination){ |
693 | 693 | $current_day['destination_to_tour'] = array($current_destination); |
694 | - }else{ |
|
694 | + } else{ |
|
695 | 695 | $current_day['destination_to_tour'] = array(); |
696 | 696 | } |
697 | 697 | |
698 | 698 | //Included |
699 | 699 | if(false !== $importable_content && in_array('itinerary_included',$importable_content) && isset($day['included']) && '' !== $day['included']){ |
700 | 700 | $current_day['included'] = $day['included']; |
701 | - }else{ |
|
701 | + } else{ |
|
702 | 702 | $current_day['included'] = ''; |
703 | 703 | } |
704 | 704 | |
705 | 705 | //Excluded |
706 | 706 | if(false !== $importable_content && in_array('itinerary_excluded',$importable_content) && isset($day['excluded']) && '' !== $day['excluded']){ |
707 | 707 | $current_day['excluded'] = $day['excluded']; |
708 | - }else{ |
|
708 | + } else{ |
|
709 | 709 | $current_day['excluded'] = ''; |
710 | 710 | } |
711 | 711 | |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | $day_counter++; |
714 | 714 | } |
715 | 715 | |
716 | - }else{ |
|
716 | + } else{ |
|
717 | 717 | $day_counter = $day_counter + (int)$leg['nights']; |
718 | 718 | } |
719 | 719 | |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | |
827 | 827 | if(false !== $this->current_accommodation && !empty($this->current_accommodation) && array_key_exists($day['content_entity_id'],$this->current_accommodation)){ |
828 | 828 | $ac_id = $this->current_accommodation[$day['content_entity_id']]; |
829 | - }else{ |
|
829 | + } else{ |
|
830 | 830 | $ac_id = wp_insert_post(array( |
831 | 831 | 'post_type' => 'accommodation', |
832 | 832 | 'post_status' => 'draft', |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | $country_id = $this->set_country($country_wetu_id, $id); |
897 | 897 | } |
898 | 898 | |
899 | - }else { |
|
899 | + } else { |
|
900 | 900 | |
901 | 901 | $destination_json = file_get_contents("http://wetu.com/API/Pins/".$this->api_key."/Get?ids=" . $day['destination_content_entity_id']); |
902 | 902 | |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | if(0 !== $country_id && false !== $country_id){ |
956 | 956 | $this->relation_meta[$dest_id] = $country_id; |
957 | 957 | $this->relation_meta[$country_id] = 0; |
958 | - }else{ |
|
958 | + } else{ |
|
959 | 959 | $this->relation_meta[$dest_id] = 0; |
960 | 960 | } |
961 | 961 | } |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | public function queue_item($id) { |
1063 | 1063 | if(is_array($this->import_queue) && !in_array($id,$this->import_queue)){ |
1064 | 1064 | $this->import_queue[] = $id; |
1065 | - }else{ |
|
1065 | + } else{ |
|
1066 | 1066 | $this->import_queue[] = $id; |
1067 | 1067 | } |
1068 | 1068 | } |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | if (!empty($this->queued_imports)) { |
1077 | 1077 | $saved_imports = array_merge($this->queued_imports,$this->import_queue); |
1078 | 1078 | |
1079 | - }else{ |
|
1079 | + } else{ |
|
1080 | 1080 | $saved_imports = $this->import_queue; |
1081 | 1081 | } |
1082 | 1082 | delete_option('wetu_importer_que'); |