@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * Display the importer administration screen |
| 105 | 105 | */ |
| 106 | 106 | public function display_page() { |
| 107 | - ?> |
|
| 107 | + ?> |
|
| 108 | 108 | <div class="wrap"> |
| 109 | 109 | <?php screen_icon(); ?> |
| 110 | 110 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $keyphrases = $_POST['keyword']; |
| 330 | 330 | }else{ |
| 331 | 331 | $keyphrases = array(0); |
| 332 | - } |
|
| 332 | + } |
|
| 333 | 333 | |
| 334 | 334 | if(!is_array($keyphrases)){ |
| 335 | 335 | $keyphrases = array($keyphrases); |
@@ -358,11 +358,11 @@ discard block |
||
| 358 | 358 | //If we are searching for |
| 359 | 359 | if(false !== $post_status){ |
| 360 | 360 | |
| 361 | - $current_status = get_post_status($row->post_id); |
|
| 362 | - if($current_status !== $post_status){ |
|
| 363 | - continue; |
|
| 364 | - } |
|
| 365 | - $searched_items[sanitize_title($row->name).'-'.$row->meta_value] = $this->format_row($row); |
|
| 361 | + $current_status = get_post_status($row->post_id); |
|
| 362 | + if($current_status !== $post_status){ |
|
| 363 | + continue; |
|
| 364 | + } |
|
| 365 | + $searched_items[sanitize_title($row->name).'-'.$row->meta_value] = $this->format_row($row); |
|
| 366 | 366 | |
| 367 | 367 | |
| 368 | 368 | }else{ |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $team_members = false; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - $safari_brands = false; |
|
| 447 | + $safari_brands = false; |
|
| 448 | 448 | |
| 449 | 449 | if(isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])){ |
| 450 | 450 | $content = $_POST['content']; |
@@ -455,16 +455,16 @@ discard block |
||
| 455 | 455 | $content = false; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - $jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id ); |
|
| 459 | - if($jdata) |
|
| 460 | - { |
|
| 461 | - $adata=json_decode($jdata,true); |
|
| 462 | - if(!empty($adata)) |
|
| 463 | - { |
|
| 464 | - $return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands); |
|
| 465 | - $this->format_completed_row($return); |
|
| 466 | - } |
|
| 467 | - } |
|
| 458 | + $jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id ); |
|
| 459 | + if($jdata) |
|
| 460 | + { |
|
| 461 | + $adata=json_decode($jdata,true); |
|
| 462 | + if(!empty($adata)) |
|
| 463 | + { |
|
| 464 | + $return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands); |
|
| 465 | + $this->format_completed_row($return); |
|
| 466 | + } |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | 469 | die(); |
| 470 | 470 | } |
@@ -476,82 +476,82 @@ discard block |
||
| 476 | 476 | */ |
| 477 | 477 | public function import_row($data,$wetu_id,$id=0,$team_members=false,$importable_content=false,$safari_brands=false) { |
| 478 | 478 | |
| 479 | - if(trim($data[0]['type'])=='Destination') |
|
| 480 | - { |
|
| 481 | - $post_name = $data_post_content = $data_post_excerpt = ''; |
|
| 482 | - $post = array( |
|
| 483 | - 'post_type' => 'destination', |
|
| 484 | - ); |
|
| 485 | - |
|
| 486 | - $content_used_general_description = false; |
|
| 487 | - |
|
| 488 | - //Set the post_content |
|
| 489 | - if(false !== $importable_content && in_array('description',$importable_content)){ |
|
| 490 | - if(isset($data[0]['content']['extended_description'])) |
|
| 491 | - { |
|
| 492 | - $data_post_content = $data[0]['content']['extended_description']; |
|
| 493 | - }elseif(isset($data[0]['content']['general_description'])){ |
|
| 494 | - $data_post_content = $data[0]['content']['general_description']; |
|
| 495 | - $content_used_general_description = true; |
|
| 496 | - }elseif(isset($data[0]['content']['teaser_description'])){ |
|
| 497 | - $data_post_content = $data[0]['content']['teaser_description']; |
|
| 498 | - } |
|
| 499 | - $post['post_content'] = wp_strip_all_tags($data_post_content); |
|
| 500 | - } |
|
| 501 | - |
|
| 502 | - //set the post_excerpt |
|
| 503 | - if(false !== $importable_content && in_array('excerpt',$importable_content)){ |
|
| 504 | - if(isset($data[0]['content']['teaser_description'])){ |
|
| 505 | - $data_post_excerpt = $data[0]['content']['teaser_description']; |
|
| 506 | - }elseif(isset($data[0]['content']['extended_description'])){ |
|
| 479 | + if(trim($data[0]['type'])=='Destination') |
|
| 480 | + { |
|
| 481 | + $post_name = $data_post_content = $data_post_excerpt = ''; |
|
| 482 | + $post = array( |
|
| 483 | + 'post_type' => 'destination', |
|
| 484 | + ); |
|
| 485 | + |
|
| 486 | + $content_used_general_description = false; |
|
| 487 | + |
|
| 488 | + //Set the post_content |
|
| 489 | + if(false !== $importable_content && in_array('description',$importable_content)){ |
|
| 490 | + if(isset($data[0]['content']['extended_description'])) |
|
| 491 | + { |
|
| 492 | + $data_post_content = $data[0]['content']['extended_description']; |
|
| 493 | + }elseif(isset($data[0]['content']['general_description'])){ |
|
| 494 | + $data_post_content = $data[0]['content']['general_description']; |
|
| 495 | + $content_used_general_description = true; |
|
| 496 | + }elseif(isset($data[0]['content']['teaser_description'])){ |
|
| 497 | + $data_post_content = $data[0]['content']['teaser_description']; |
|
| 498 | + } |
|
| 499 | + $post['post_content'] = wp_strip_all_tags($data_post_content); |
|
| 500 | + } |
|
| 501 | + |
|
| 502 | + //set the post_excerpt |
|
| 503 | + if(false !== $importable_content && in_array('excerpt',$importable_content)){ |
|
| 504 | + if(isset($data[0]['content']['teaser_description'])){ |
|
| 505 | + $data_post_excerpt = $data[0]['content']['teaser_description']; |
|
| 506 | + }elseif(isset($data[0]['content']['extended_description'])){ |
|
| 507 | 507 | $data_post_excerpt = $data[0]['content']['extended_description']; |
| 508 | 508 | }elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){ |
| 509 | - $data_post_excerpt = $data[0]['content']['general_description']; |
|
| 510 | - } |
|
| 511 | - $post['post_excerpt'] = $data_post_excerpt; |
|
| 512 | - } |
|
| 509 | + $data_post_excerpt = $data[0]['content']['general_description']; |
|
| 510 | + } |
|
| 511 | + $post['post_excerpt'] = $data_post_excerpt; |
|
| 512 | + } |
|
| 513 | 513 | |
| 514 | - if(false !== $id && '0' !== $id){ |
|
| 515 | - $post['ID'] = $id; |
|
| 514 | + if(false !== $id && '0' !== $id){ |
|
| 515 | + $post['ID'] = $id; |
|
| 516 | 516 | if(isset($data[0]['name'])){ |
| 517 | 517 | $post['post_title'] = $data[0]['name']; |
| 518 | 518 | $post['post_status'] = 'publish'; |
| 519 | 519 | $post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0); |
| 520 | 520 | } |
| 521 | - $id = wp_update_post($post); |
|
| 522 | - $prev_date = get_post_meta($id,'lsx_wetu_modified_date',true); |
|
| 523 | - update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date); |
|
| 524 | - }else{ |
|
| 525 | - |
|
| 526 | - //Set the name |
|
| 527 | - if(isset($data[0]['name'])){ |
|
| 528 | - $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0); |
|
| 529 | - } |
|
| 530 | - $post['post_name'] = $post_name; |
|
| 531 | - $post['post_title'] = $data[0]['name']; |
|
| 532 | - $post['post_status'] = 'publish'; |
|
| 533 | - $id = wp_insert_post($post); |
|
| 534 | - |
|
| 535 | - //Save the WETU ID and the Last date it was modified. |
|
| 536 | - if(false !== $id){ |
|
| 537 | - add_post_meta($id,'lsx_wetu_id',$wetu_id); |
|
| 538 | - add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified'])); |
|
| 539 | - } |
|
| 540 | - } |
|
| 541 | - |
|
| 542 | - //Set the team member if it is there |
|
| 543 | - if(post_type_exists('team') && false !== $team_members && '' !== $team_members){ |
|
| 544 | - $this->set_team_member($id,$team_members); |
|
| 545 | - } |
|
| 546 | - |
|
| 547 | - if(class_exists('LSX_TO_Maps')){ |
|
| 548 | - $this->set_map_data($data,$id,4); |
|
| 549 | - } |
|
| 550 | - |
|
| 551 | - //Set the Room Data |
|
| 552 | - if(false !== $importable_content && in_array('videos',$importable_content)){ |
|
| 553 | - $this->set_video_data($data,$id); |
|
| 554 | - } |
|
| 521 | + $id = wp_update_post($post); |
|
| 522 | + $prev_date = get_post_meta($id,'lsx_wetu_modified_date',true); |
|
| 523 | + update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date); |
|
| 524 | + }else{ |
|
| 525 | + |
|
| 526 | + //Set the name |
|
| 527 | + if(isset($data[0]['name'])){ |
|
| 528 | + $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0); |
|
| 529 | + } |
|
| 530 | + $post['post_name'] = $post_name; |
|
| 531 | + $post['post_title'] = $data[0]['name']; |
|
| 532 | + $post['post_status'] = 'publish'; |
|
| 533 | + $id = wp_insert_post($post); |
|
| 534 | + |
|
| 535 | + //Save the WETU ID and the Last date it was modified. |
|
| 536 | + if(false !== $id){ |
|
| 537 | + add_post_meta($id,'lsx_wetu_id',$wetu_id); |
|
| 538 | + add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified'])); |
|
| 539 | + } |
|
| 540 | + } |
|
| 541 | + |
|
| 542 | + //Set the team member if it is there |
|
| 543 | + if(post_type_exists('team') && false !== $team_members && '' !== $team_members){ |
|
| 544 | + $this->set_team_member($id,$team_members); |
|
| 545 | + } |
|
| 546 | + |
|
| 547 | + if(class_exists('LSX_TO_Maps')){ |
|
| 548 | + $this->set_map_data($data,$id,4); |
|
| 549 | + } |
|
| 550 | + |
|
| 551 | + //Set the Room Data |
|
| 552 | + if(false !== $importable_content && in_array('videos',$importable_content)){ |
|
| 553 | + $this->set_video_data($data,$id); |
|
| 554 | + } |
|
| 555 | 555 | |
| 556 | 556 | //Set the Electricity |
| 557 | 557 | if(false !== $importable_content && in_array('electricity',$importable_content)){ |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | } |
| 599 | - return $id; |
|
| 599 | + return $id; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /** |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | |
| 607 | 607 | delete_post_meta($id, 'team_to_'.$this->tab_slug); |
| 608 | 608 | foreach($team_members as $team){ |
| 609 | - add_post_meta($id,'team_to_'.$this->tab_slug,$team); |
|
| 609 | + add_post_meta($id,'team_to_'.$this->tab_slug,$team); |
|
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | |
@@ -657,11 +657,11 @@ discard block |
||
| 657 | 657 | 'elevation' => '', |
| 658 | 658 | ); |
| 659 | 659 | if(false !== $id && '0' !== $id){ |
| 660 | - $prev = get_post_meta($id,'location',true); |
|
| 661 | - update_post_meta($id,'location',$location_data,$prev); |
|
| 662 | - }else{ |
|
| 663 | - add_post_meta($id,'location',$location_data,true); |
|
| 664 | - } |
|
| 660 | + $prev = get_post_meta($id,'location',true); |
|
| 661 | + update_post_meta($id,'location',$location_data,$prev); |
|
| 662 | + }else{ |
|
| 663 | + add_post_meta($id,'location',$location_data,true); |
|
| 664 | + } |
|
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | |
@@ -64,21 +64,21 @@ discard block |
||
| 64 | 64 | public function __construct() { |
| 65 | 65 | $this->set_variables(); |
| 66 | 66 | |
| 67 | - add_action( 'lsx_tour_importer_admin_tab_'.$this->tab_slug, array($this,'display_page') ); |
|
| 67 | + add_action('lsx_tour_importer_admin_tab_'.$this->tab_slug, array($this, 'display_page')); |
|
| 68 | 68 | |
| 69 | - add_action('wp_ajax_lsx_tour_importer',array($this,'process_ajax_search')); |
|
| 70 | - add_action('wp_ajax_nopriv_lsx_tour_importer',array($this,'process_ajax_search')); |
|
| 69 | + add_action('wp_ajax_lsx_tour_importer', array($this, 'process_ajax_search')); |
|
| 70 | + add_action('wp_ajax_nopriv_lsx_tour_importer', array($this, 'process_ajax_search')); |
|
| 71 | 71 | |
| 72 | - add_action('wp_ajax_lsx_import_items',array($this,'process_ajax_import')); |
|
| 73 | - add_action('wp_ajax_nopriv_lsx_import_items',array($this,'process_ajax_import')); |
|
| 72 | + add_action('wp_ajax_lsx_import_items', array($this, 'process_ajax_import')); |
|
| 73 | + add_action('wp_ajax_nopriv_lsx_import_items', array($this, 'process_ajax_import')); |
|
| 74 | 74 | |
| 75 | - $temp_options = get_option('_lsx-to_settings',false); |
|
| 76 | - if(false !== $temp_options && isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug])){ |
|
| 75 | + $temp_options = get_option('_lsx-to_settings', false); |
|
| 76 | + if (false !== $temp_options && isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug])) { |
|
| 77 | 77 | $this->options = $temp_options[$this->plugin_slug]; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - $destination_options = get_option('wetu_importer_destination_settings',false); |
|
| 81 | - if(false !== $destination_options){ |
|
| 80 | + $destination_options = get_option('wetu_importer_destination_settings', false); |
|
| 81 | + if (false !== $destination_options) { |
|
| 82 | 82 | $this->destination_options = $destination_options; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | // $this->url = 'https://wetu.com/API/Pins/'; |
| 96 | 96 | // $this->url_qs = 'username=' . $this->api_username . '&password=' . $this->api_password; |
| 97 | 97 | //} elseif ( false !== $this->api_key ) { |
| 98 | - $this->url = 'https://wetu.com/API/Pins/' . $this->api_key; |
|
| 98 | + $this->url = 'https://wetu.com/API/Pins/'.$this->api_key; |
|
| 99 | 99 | $this->url_qs = ''; |
| 100 | 100 | //} |
| 101 | 101 | } |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | <form method="get" action="" id="posts-filter"> |
| 114 | 114 | <input type="hidden" name="post_type" class="post_type" value="<?php echo $this->tab_slug; ?>" /> |
| 115 | 115 | |
| 116 | - <p><input class="button button-primary add" type="button" value="<?php _e('Add to List','wetu-importer'); ?>" /> |
|
| 117 | - <input class="button button-primary clear" type="button" value="<?php _e('Clear','wetu-importer'); ?>" /> |
|
| 116 | + <p><input class="button button-primary add" type="button" value="<?php _e('Add to List', 'wetu-importer'); ?>" /> |
|
| 117 | + <input class="button button-primary clear" type="button" value="<?php _e('Clear', 'wetu-importer'); ?>" /> |
|
| 118 | 118 | </p> |
| 119 | 119 | |
| 120 | 120 | <table class="wp-list-table widefat fixed posts"> |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | <tbody id="the-list"> |
| 124 | 124 | <tr class="post-0 type-tour status-none" id="post-0"> |
| 125 | 125 | <th class="check-column" scope="row"> |
| 126 | - <label for="cb-select-0" class="screen-reader-text"><?php _e('Enter a title to search for and press enter','wetu-importer'); ?></label> |
|
| 126 | + <label for="cb-select-0" class="screen-reader-text"><?php _e('Enter a title to search for and press enter', 'wetu-importer'); ?></label> |
|
| 127 | 127 | </th> |
| 128 | 128 | <td class="post-title page-title column-title"> |
| 129 | 129 | <strong> |
| 130 | - <?php _e('Enter a title to search for','wetu-importer'); ?> |
|
| 130 | + <?php _e('Enter a title to search for', 'wetu-importer'); ?> |
|
| 131 | 131 | </strong> |
| 132 | 132 | </td> |
| 133 | 133 | <td class="date column-date"> |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | </table> |
| 143 | 143 | |
| 144 | - <p><input class="button button-primary add" type="button" value="<?php _e('Add to List','wetu-importer'); ?>" /> |
|
| 145 | - <input class="button button-primary clear" type="button" value="<?php _e('Clear','wetu-importer'); ?>" /> |
|
| 144 | + <p><input class="button button-primary add" type="button" value="<?php _e('Add to List', 'wetu-importer'); ?>" /> |
|
| 145 | + <input class="button button-primary clear" type="button" value="<?php _e('Clear', 'wetu-importer'); ?>" /> |
|
| 146 | 146 | </p> |
| 147 | 147 | </form> |
| 148 | 148 | |
@@ -154,39 +154,39 @@ discard block |
||
| 154 | 154 | <div style="width:30%;display:block;float:left;"> |
| 155 | 155 | <h3><?php _e('What content to Sync from WETU'); ?></h3> |
| 156 | 156 | <ul> |
| 157 | - <li><input class="content" <?php $this->checked($this->destination_options,'description'); ?> type="checkbox" name="content[]" value="description" /> <?php _e('Description','wetu-importer'); ?></li> |
|
| 158 | - <li><input class="content" <?php $this->checked($this->destination_options,'excerpt'); ?> type="checkbox" name="content[]" value="excerpt" /> <?php _e('Excerpt','wetu-importer'); ?></li> |
|
| 159 | - <li><input class="content" <?php $this->checked($this->destination_options,'gallery'); ?> type="checkbox" name="content[]" value="gallery" /> <?php _e('Main Gallery','wetu-importer'); ?></li> |
|
| 160 | - <?php if(class_exists('LSX_TO_Maps')){ ?> |
|
| 161 | - <li><input class="content" <?php $this->checked($this->destination_options,'location'); ?> type="checkbox" name="content[]" value="location" /> <?php _e('Location','wetu-importer'); ?></li> |
|
| 157 | + <li><input class="content" <?php $this->checked($this->destination_options, 'description'); ?> type="checkbox" name="content[]" value="description" /> <?php _e('Description', 'wetu-importer'); ?></li> |
|
| 158 | + <li><input class="content" <?php $this->checked($this->destination_options, 'excerpt'); ?> type="checkbox" name="content[]" value="excerpt" /> <?php _e('Excerpt', 'wetu-importer'); ?></li> |
|
| 159 | + <li><input class="content" <?php $this->checked($this->destination_options, 'gallery'); ?> type="checkbox" name="content[]" value="gallery" /> <?php _e('Main Gallery', 'wetu-importer'); ?></li> |
|
| 160 | + <?php if (class_exists('LSX_TO_Maps')) { ?> |
|
| 161 | + <li><input class="content" <?php $this->checked($this->destination_options, 'location'); ?> type="checkbox" name="content[]" value="location" /> <?php _e('Location', 'wetu-importer'); ?></li> |
|
| 162 | 162 | <?php } ?> |
| 163 | 163 | |
| 164 | - <?php if(class_exists('LSX_TO_Videos')){ ?> |
|
| 165 | - <li><input class="content" <?php $this->checked($this->destination_options,'videos'); ?> type="checkbox" name="content[]" value="videos" /> <?php _e('Videos','wetu-importer'); ?></li> |
|
| 164 | + <?php if (class_exists('LSX_TO_Videos')) { ?> |
|
| 165 | + <li><input class="content" <?php $this->checked($this->destination_options, 'videos'); ?> type="checkbox" name="content[]" value="videos" /> <?php _e('Videos', 'wetu-importer'); ?></li> |
|
| 166 | 166 | <?php } ?> |
| 167 | 167 | |
| 168 | 168 | </ul> |
| 169 | 169 | <h4><?php _e('Additional Content'); ?></h4> |
| 170 | 170 | <ul> |
| 171 | - <li><input class="content" <?php $this->checked($this->destination_options,'featured_image'); ?> type="checkbox" name="content[]" value="featured_image" /> <?php _e('Set Featured Image','wetu-importer'); ?></li> |
|
| 172 | - <?php if(class_exists('LSX_Banners')){ ?> |
|
| 173 | - <li><input class="content" <?php $this->checked($this->destination_options,'banner_image'); ?> type="checkbox" name="content[]" value="banner_image" /> <?php _e('Set Banner Image','wetu-importer'); ?></li> |
|
| 171 | + <li><input class="content" <?php $this->checked($this->destination_options, 'featured_image'); ?> type="checkbox" name="content[]" value="featured_image" /> <?php _e('Set Featured Image', 'wetu-importer'); ?></li> |
|
| 172 | + <?php if (class_exists('LSX_Banners')) { ?> |
|
| 173 | + <li><input class="content" <?php $this->checked($this->destination_options, 'banner_image'); ?> type="checkbox" name="content[]" value="banner_image" /> <?php _e('Set Banner Image', 'wetu-importer'); ?></li> |
|
| 174 | 174 | <?php } ?> |
| 175 | 175 | </ul> |
| 176 | 176 | </div> |
| 177 | 177 | <div style="width:30%;display:block;float:left;"> |
| 178 | 178 | <h3><?php _e('Travel Information'); ?></h3> |
| 179 | 179 | <ul> |
| 180 | - <li><input class="content" <?php $this->checked($this->destination_options,'electricity'); ?> type="checkbox" name="content[]" value="electricity" /> <?php _e('Electricity','wetu-importer'); ?></li> |
|
| 181 | - <li><input class="content" <?php $this->checked($this->destination_options,'banking'); ?> type="checkbox" name="content[]" value="banking" /> <?php _e('Banking','wetu-importer'); ?></li> |
|
| 182 | - <li><input class="content" <?php $this->checked($this->destination_options,'cuisine'); ?> type="checkbox" name="content[]" value="cuisine" /> <?php _e('Cuisine','wetu-importer'); ?></li> |
|
| 183 | - <li><input class="content" <?php $this->checked($this->destination_options,'climate'); ?> type="checkbox" name="content[]" value="climate" /> <?php _e('Climate','wetu-importer'); ?></li> |
|
| 184 | - <li><input class="content" <?php $this->checked($this->destination_options,'transport'); ?> type="checkbox" name="content[]" value="transport" /> <?php _e('Transport','wetu-importer'); ?></li> |
|
| 185 | - <li><input class="content" <?php $this->checked($this->destination_options,'dress'); ?> type="checkbox" name="content[]" value="dress" /> <?php _e('Dress','wetu-importer'); ?></li> |
|
| 180 | + <li><input class="content" <?php $this->checked($this->destination_options, 'electricity'); ?> type="checkbox" name="content[]" value="electricity" /> <?php _e('Electricity', 'wetu-importer'); ?></li> |
|
| 181 | + <li><input class="content" <?php $this->checked($this->destination_options, 'banking'); ?> type="checkbox" name="content[]" value="banking" /> <?php _e('Banking', 'wetu-importer'); ?></li> |
|
| 182 | + <li><input class="content" <?php $this->checked($this->destination_options, 'cuisine'); ?> type="checkbox" name="content[]" value="cuisine" /> <?php _e('Cuisine', 'wetu-importer'); ?></li> |
|
| 183 | + <li><input class="content" <?php $this->checked($this->destination_options, 'climate'); ?> type="checkbox" name="content[]" value="climate" /> <?php _e('Climate', 'wetu-importer'); ?></li> |
|
| 184 | + <li><input class="content" <?php $this->checked($this->destination_options, 'transport'); ?> type="checkbox" name="content[]" value="transport" /> <?php _e('Transport', 'wetu-importer'); ?></li> |
|
| 185 | + <li><input class="content" <?php $this->checked($this->destination_options, 'dress'); ?> type="checkbox" name="content[]" value="dress" /> <?php _e('Dress', 'wetu-importer'); ?></li> |
|
| 186 | 186 | </ul> |
| 187 | 187 | </div> |
| 188 | 188 | |
| 189 | - <?php if(class_exists('LSX_TO_Team')){ ?> |
|
| 189 | + <?php if (class_exists('LSX_TO_Team')) { ?> |
|
| 190 | 190 | <div style="width:30%;display:block;float:left;"> |
| 191 | 191 | <h3><?php _e('Assign a Team Member'); ?></h3> |
| 192 | 192 | <?php $this->team_member_checkboxes($this->destination_options); ?> |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | |
| 200 | 200 | <h3><?php _e('Your List'); ?></h3> |
| 201 | - <p><input class="button button-primary" type="submit" value="<?php _e('Sync','wetu-importer'); ?>" /></p> |
|
| 201 | + <p><input class="button button-primary" type="submit" value="<?php _e('Sync', 'wetu-importer'); ?>" /></p> |
|
| 202 | 202 | <table class="wp-list-table widefat fixed posts"> |
| 203 | 203 | <?php $this->table_header(); ?> |
| 204 | 204 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | </table> |
| 212 | 212 | |
| 213 | - <p><input class="button button-primary" type="submit" value="<?php _e('Sync','wetu-importer'); ?>" /></p> |
|
| 213 | + <p><input class="button button-primary" type="submit" value="<?php _e('Sync', 'wetu-importer'); ?>" /></p> |
|
| 214 | 214 | </form> |
| 215 | 215 | </div> |
| 216 | 216 | |
@@ -231,31 +231,31 @@ discard block |
||
| 231 | 231 | <form class="ajax-form" id="<?php echo $this->plugin_slug; ?>-search-form" method="get" action="tools.php" data-type="<?php echo $this->tab_slug; ?>"> |
| 232 | 232 | <input type="hidden" name="page" value="<?php echo $this->tab_slug; ?>" /> |
| 233 | 233 | |
| 234 | - <h3><span class="dashicons dashicons-search"></span> <?php _e('Search','wetu-importer'); ?></h3> |
|
| 234 | + <h3><span class="dashicons dashicons-search"></span> <?php _e('Search', 'wetu-importer'); ?></h3> |
|
| 235 | 235 | <div class="normal-search"> |
| 236 | - <input pattern=".{3,}" placeholder="3 characters minimum" class="keyword" name="keyword" value=""> <input class="button button-primary submit" type="submit" value="<?php _e('Search','wetu-importer'); ?>" /> |
|
| 236 | + <input pattern=".{3,}" placeholder="3 characters minimum" class="keyword" name="keyword" value=""> <input class="button button-primary submit" type="submit" value="<?php _e('Search', 'wetu-importer'); ?>" /> |
|
| 237 | 237 | </div> |
| 238 | 238 | |
| 239 | 239 | |
| 240 | 240 | <div class="advanced-search hidden" style="display:none;"> |
| 241 | - <p><?php _e('Enter several keywords, each on a new line.','wetu-importer'); ?></p> |
|
| 241 | + <p><?php _e('Enter several keywords, each on a new line.', 'wetu-importer'); ?></p> |
|
| 242 | 242 | <textarea rows="10" cols="40" name="bulk-keywords"></textarea> |
| 243 | - <input class="button button-primary submit" type="submit" value="<?php _e('Search','wetu-importer'); ?>" /> |
|
| 243 | + <input class="button button-primary submit" type="submit" value="<?php _e('Search', 'wetu-importer'); ?>" /> |
|
| 244 | 244 | </div> |
| 245 | 245 | |
| 246 | 246 | <p> |
| 247 | - <a class="advanced-search-toggle" href="#"><?php _e('Bulk Search','wetu-importer'); ?></a> | |
|
| 248 | - <a class="published search-toggle" href="#publish"><?php esc_attr_e('Published','wetu-importer'); ?></a> | |
|
| 249 | - <a class="pending search-toggle" href="#pending"><?php esc_attr_e('Pending','wetu-importer'); ?></a> | |
|
| 250 | - <a class="draft search-toggle" href="#draft"><?php esc_attr_e('Draft','wetu-importer'); ?></a> |
|
| 247 | + <a class="advanced-search-toggle" href="#"><?php _e('Bulk Search', 'wetu-importer'); ?></a> | |
|
| 248 | + <a class="published search-toggle" href="#publish"><?php esc_attr_e('Published', 'wetu-importer'); ?></a> | |
|
| 249 | + <a class="pending search-toggle" href="#pending"><?php esc_attr_e('Pending', 'wetu-importer'); ?></a> | |
|
| 250 | + <a class="draft search-toggle" href="#draft"><?php esc_attr_e('Draft', 'wetu-importer'); ?></a> |
|
| 251 | 251 | </p> |
| 252 | 252 | |
| 253 | 253 | <div class="ajax-loader" style="display:none;width:100%;text-align:center;"> |
| 254 | - <img style="width:64px;" src="<?php echo WETU_IMPORTER_URL.'assets/images/ajaxloader.gif';?>" /> |
|
| 254 | + <img style="width:64px;" src="<?php echo WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'; ?>" /> |
|
| 255 | 255 | </div> |
| 256 | 256 | |
| 257 | 257 | <div class="ajax-loader-small" style="display:none;width:100%;text-align:center;"> |
| 258 | - <img style="width:32px;" src="<?php echo WETU_IMPORTER_URL.'assets/images/ajaxloader.gif';?>" /> |
|
| 258 | + <img style="width:32px;" src="<?php echo WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'; ?>" /> |
|
| 259 | 259 | </div> |
| 260 | 260 | </form> |
| 261 | 261 | <?php |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | /** |
| 292 | 292 | * Grab all the current destination posts via the lsx_wetu_id field. |
| 293 | 293 | */ |
| 294 | - public function find_current_destination($post_type='destination') { |
|
| 294 | + public function find_current_destination($post_type = 'destination') { |
|
| 295 | 295 | global $wpdb; |
| 296 | 296 | $return = array(); |
| 297 | 297 | |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | LIMIT 0,500 |
| 309 | 309 | "); |
| 310 | - if(null !== $current_destination && !empty($current_destination)){ |
|
| 311 | - foreach($current_destination as $accom){ |
|
| 310 | + if (null !== $current_destination && !empty($current_destination)) { |
|
| 311 | + foreach ($current_destination as $accom) { |
|
| 312 | 312 | $return[$accom->meta_value] = $accom; |
| 313 | 313 | } |
| 314 | 314 | } |
@@ -320,32 +320,32 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | public function process_ajax_search() { |
| 322 | 322 | $return = false; |
| 323 | - if(isset($_POST['action']) && $_POST['action'] === 'lsx_tour_importer' && isset($_POST['type']) && $_POST['type'] === 'destination'){ |
|
| 323 | + if (isset($_POST['action']) && $_POST['action'] === 'lsx_tour_importer' && isset($_POST['type']) && $_POST['type'] === 'destination') { |
|
| 324 | 324 | |
| 325 | - if ( isset($_POST['keyword'] )) { |
|
| 325 | + if (isset($_POST['keyword'])) { |
|
| 326 | 326 | $searched_items = false; |
| 327 | 327 | |
| 328 | - if(isset($_POST['keyword'] )) { |
|
| 328 | + if (isset($_POST['keyword'])) { |
|
| 329 | 329 | $keyphrases = $_POST['keyword']; |
| 330 | - }else{ |
|
| 330 | + }else { |
|
| 331 | 331 | $keyphrases = array(0); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if(!is_array($keyphrases)){ |
|
| 334 | + if (!is_array($keyphrases)) { |
|
| 335 | 335 | $keyphrases = array($keyphrases); |
| 336 | 336 | } |
| 337 | - foreach($keyphrases as &$keyword){ |
|
| 337 | + foreach ($keyphrases as &$keyword) { |
|
| 338 | 338 | $keyword = ltrim(rtrim($keyword)); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | $post_status = false; |
| 342 | - if(in_array('publish',$keyphrases)){ |
|
| 342 | + if (in_array('publish', $keyphrases)) { |
|
| 343 | 343 | $post_status = 'publish'; |
| 344 | 344 | } |
| 345 | - if(in_array('pending',$keyphrases)){ |
|
| 345 | + if (in_array('pending', $keyphrases)) { |
|
| 346 | 346 | $post_status = 'pending'; |
| 347 | 347 | } |
| 348 | - if(in_array('draft',$keyphrases)){ |
|
| 348 | + if (in_array('draft', $keyphrases)) { |
|
| 349 | 349 | $post_status = 'draft'; |
| 350 | 350 | } |
| 351 | 351 | |
@@ -353,29 +353,29 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | if (!empty($destination)) { |
| 355 | 355 | |
| 356 | - foreach($destination as $row){ |
|
| 356 | + foreach ($destination as $row) { |
|
| 357 | 357 | |
| 358 | 358 | //If we are searching for |
| 359 | - if(false !== $post_status){ |
|
| 359 | + if (false !== $post_status) { |
|
| 360 | 360 | |
| 361 | 361 | $current_status = get_post_status($row->post_id); |
| 362 | - if($current_status !== $post_status){ |
|
| 362 | + if ($current_status !== $post_status) { |
|
| 363 | 363 | continue; |
| 364 | 364 | } |
| 365 | 365 | $searched_items[sanitize_title($row->name).'-'.$row->meta_value] = $this->format_row($row); |
| 366 | 366 | |
| 367 | 367 | |
| 368 | - }else{ |
|
| 368 | + }else { |
|
| 369 | 369 | //Search through each keyword. |
| 370 | - foreach($keyphrases as $keyphrase){ |
|
| 370 | + foreach ($keyphrases as $keyphrase) { |
|
| 371 | 371 | |
| 372 | 372 | //Make sure the keyphrase is turned into an array |
| 373 | - $keywords = explode(" ",$keyphrase); |
|
| 374 | - if(!is_array($keywords)){ |
|
| 373 | + $keywords = explode(" ", $keyphrase); |
|
| 374 | + if (!is_array($keywords)) { |
|
| 375 | 375 | $keywords = array($keywords); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - if($this->multineedle_stripos(ltrim(rtrim($row->name)), $keywords) !== false){ |
|
| 378 | + if ($this->multineedle_stripos(ltrim(rtrim($row->name)), $keywords) !== false) { |
|
| 379 | 379 | $searched_items[sanitize_title($row->name).'-'.$row->meta_value] = $this->format_row($row); |
| 380 | 380 | } |
| 381 | 381 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - if(false !== $searched_items){ |
|
| 386 | + if (false !== $searched_items) { |
|
| 387 | 387 | ksort($searched_items); |
| 388 | 388 | $return = implode($searched_items); |
| 389 | 389 | } |
@@ -396,11 +396,11 @@ discard block |
||
| 396 | 396 | /** |
| 397 | 397 | * Formats the row for output on the screen. |
| 398 | 398 | */ |
| 399 | - public function format_row($row = false){ |
|
| 400 | - if(false !== $row){ |
|
| 399 | + public function format_row($row = false) { |
|
| 400 | + if (false !== $row) { |
|
| 401 | 401 | |
| 402 | 402 | $status = 'import'; |
| 403 | - if(0 !== $row->post_id){ |
|
| 403 | + if (0 !== $row->post_id) { |
|
| 404 | 404 | $status = '<a href="'.admin_url('/post.php?post='.$row->post_id.'&action=edit').'" target="_blank">'.get_post_status($row->post_id).'</a>'; |
| 405 | 405 | } |
| 406 | 406 | |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | <strong>'.$row->name.'</strong> - '.$status.' |
| 415 | 415 | </td> |
| 416 | 416 | <td class="date column-date"> |
| 417 | - <abbr title="'.date('Y/m/d',strtotime($row->last_modified)).'">'.date('Y/m/d',strtotime($row->last_modified)).'</abbr><br>Last Modified |
|
| 417 | + <abbr title="'.date('Y/m/d', strtotime($row->last_modified)).'">'.date('Y/m/d', strtotime($row->last_modified)).'</abbr><br>Last Modified |
|
| 418 | 418 | </td> |
| 419 | 419 | <td class="ssid column-ssid"> |
| 420 | 420 | '.$row->meta_value.' |
@@ -429,39 +429,39 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | public function process_ajax_import() { |
| 431 | 431 | $return = false; |
| 432 | - if(isset($_POST['action']) && $_POST['action'] === 'lsx_import_items' && isset($_POST['type']) && $_POST['type'] === 'destination' && isset($_POST['wetu_id'])){ |
|
| 432 | + if (isset($_POST['action']) && $_POST['action'] === 'lsx_import_items' && isset($_POST['type']) && $_POST['type'] === 'destination' && isset($_POST['wetu_id'])) { |
|
| 433 | 433 | |
| 434 | 434 | $wetu_id = $_POST['wetu_id']; |
| 435 | - if(isset($_POST['post_id'])){ |
|
| 435 | + if (isset($_POST['post_id'])) { |
|
| 436 | 436 | $post_id = $_POST['post_id']; |
| 437 | - }else{ |
|
| 437 | + }else { |
|
| 438 | 438 | $post_id = 0; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - if(isset($_POST['team_members'])){ |
|
| 441 | + if (isset($_POST['team_members'])) { |
|
| 442 | 442 | $team_members = $_POST['team_members']; |
| 443 | - }else{ |
|
| 443 | + }else { |
|
| 444 | 444 | $team_members = false; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | $safari_brands = false; |
| 448 | 448 | |
| 449 | - if(isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])){ |
|
| 449 | + if (isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])) { |
|
| 450 | 450 | $content = $_POST['content']; |
| 451 | 451 | delete_option('wetu_importer_destination_settings'); |
| 452 | - add_option('wetu_importer_destination_settings',$content); |
|
| 453 | - }else{ |
|
| 452 | + add_option('wetu_importer_destination_settings', $content); |
|
| 453 | + }else { |
|
| 454 | 454 | delete_option('wetu_importer_destination_settings'); |
| 455 | 455 | $content = false; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - $jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id ); |
|
| 459 | - if($jdata) |
|
| 458 | + $jdata = file_get_contents($this->url.'/Get?'.$this->url_qs.'&ids='.$wetu_id); |
|
| 459 | + if ($jdata) |
|
| 460 | 460 | { |
| 461 | - $adata=json_decode($jdata,true); |
|
| 462 | - if(!empty($adata)) |
|
| 461 | + $adata = json_decode($jdata, true); |
|
| 462 | + if (!empty($adata)) |
|
| 463 | 463 | { |
| 464 | - $return = $this->import_row($adata,$wetu_id,$post_id,$team_members,$content,$safari_brands); |
|
| 464 | + $return = $this->import_row($adata, $wetu_id, $post_id, $team_members, $content, $safari_brands); |
|
| 465 | 465 | $this->format_completed_row($return); |
| 466 | 466 | } |
| 467 | 467 | } |
@@ -474,9 +474,9 @@ discard block |
||
| 474 | 474 | /** |
| 475 | 475 | * Connect to wetu |
| 476 | 476 | */ |
| 477 | - public function import_row($data,$wetu_id,$id=0,$team_members=false,$importable_content=false,$safari_brands=false) { |
|
| 477 | + public function import_row($data, $wetu_id, $id = 0, $team_members = false, $importable_content = false, $safari_brands = false) { |
|
| 478 | 478 | |
| 479 | - if(trim($data[0]['type'])=='Destination') |
|
| 479 | + if (trim($data[0]['type']) == 'Destination') |
|
| 480 | 480 | { |
| 481 | 481 | $post_name = $data_post_content = $data_post_excerpt = ''; |
| 482 | 482 | $post = array( |
@@ -486,46 +486,46 @@ discard block |
||
| 486 | 486 | $content_used_general_description = false; |
| 487 | 487 | |
| 488 | 488 | //Set the post_content |
| 489 | - if(false !== $importable_content && in_array('description',$importable_content)){ |
|
| 490 | - if(isset($data[0]['content']['extended_description'])) |
|
| 489 | + if (false !== $importable_content && in_array('description', $importable_content)) { |
|
| 490 | + if (isset($data[0]['content']['extended_description'])) |
|
| 491 | 491 | { |
| 492 | 492 | $data_post_content = $data[0]['content']['extended_description']; |
| 493 | - }elseif(isset($data[0]['content']['general_description'])){ |
|
| 493 | + }elseif (isset($data[0]['content']['general_description'])) { |
|
| 494 | 494 | $data_post_content = $data[0]['content']['general_description']; |
| 495 | 495 | $content_used_general_description = true; |
| 496 | - }elseif(isset($data[0]['content']['teaser_description'])){ |
|
| 496 | + }elseif (isset($data[0]['content']['teaser_description'])) { |
|
| 497 | 497 | $data_post_content = $data[0]['content']['teaser_description']; |
| 498 | 498 | } |
| 499 | 499 | $post['post_content'] = wp_strip_all_tags($data_post_content); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | //set the post_excerpt |
| 503 | - if(false !== $importable_content && in_array('excerpt',$importable_content)){ |
|
| 504 | - if(isset($data[0]['content']['teaser_description'])){ |
|
| 503 | + if (false !== $importable_content && in_array('excerpt', $importable_content)) { |
|
| 504 | + if (isset($data[0]['content']['teaser_description'])) { |
|
| 505 | 505 | $data_post_excerpt = $data[0]['content']['teaser_description']; |
| 506 | - }elseif(isset($data[0]['content']['extended_description'])){ |
|
| 506 | + }elseif (isset($data[0]['content']['extended_description'])) { |
|
| 507 | 507 | $data_post_excerpt = $data[0]['content']['extended_description']; |
| 508 | - }elseif(isset($data[0]['content']['general_description']) && false === $content_used_general_description){ |
|
| 508 | + }elseif (isset($data[0]['content']['general_description']) && false === $content_used_general_description) { |
|
| 509 | 509 | $data_post_excerpt = $data[0]['content']['general_description']; |
| 510 | 510 | } |
| 511 | 511 | $post['post_excerpt'] = $data_post_excerpt; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - if(false !== $id && '0' !== $id){ |
|
| 514 | + if (false !== $id && '0' !== $id) { |
|
| 515 | 515 | $post['ID'] = $id; |
| 516 | - if(isset($data[0]['name'])){ |
|
| 516 | + if (isset($data[0]['name'])) { |
|
| 517 | 517 | $post['post_title'] = $data[0]['name']; |
| 518 | 518 | $post['post_status'] = 'publish'; |
| 519 | - $post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0); |
|
| 519 | + $post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0); |
|
| 520 | 520 | } |
| 521 | 521 | $id = wp_update_post($post); |
| 522 | - $prev_date = get_post_meta($id,'lsx_wetu_modified_date',true); |
|
| 523 | - update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date); |
|
| 524 | - }else{ |
|
| 522 | + $prev_date = get_post_meta($id, 'lsx_wetu_modified_date', true); |
|
| 523 | + update_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']), $prev_date); |
|
| 524 | + }else { |
|
| 525 | 525 | |
| 526 | 526 | //Set the name |
| 527 | - if(isset($data[0]['name'])){ |
|
| 528 | - $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0); |
|
| 527 | + if (isset($data[0]['name'])) { |
|
| 528 | + $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0); |
|
| 529 | 529 | } |
| 530 | 530 | $post['post_name'] = $post_name; |
| 531 | 531 | $post['post_title'] = $data[0]['name']; |
@@ -533,65 +533,65 @@ discard block |
||
| 533 | 533 | $id = wp_insert_post($post); |
| 534 | 534 | |
| 535 | 535 | //Save the WETU ID and the Last date it was modified. |
| 536 | - if(false !== $id){ |
|
| 537 | - add_post_meta($id,'lsx_wetu_id',$wetu_id); |
|
| 538 | - add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified'])); |
|
| 536 | + if (false !== $id) { |
|
| 537 | + add_post_meta($id, 'lsx_wetu_id', $wetu_id); |
|
| 538 | + add_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified'])); |
|
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | //Set the team member if it is there |
| 543 | - if(post_type_exists('team') && false !== $team_members && '' !== $team_members){ |
|
| 544 | - $this->set_team_member($id,$team_members); |
|
| 543 | + if (post_type_exists('team') && false !== $team_members && '' !== $team_members) { |
|
| 544 | + $this->set_team_member($id, $team_members); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - if(class_exists('LSX_TO_Maps')){ |
|
| 548 | - $this->set_map_data($data,$id,4); |
|
| 547 | + if (class_exists('LSX_TO_Maps')) { |
|
| 548 | + $this->set_map_data($data, $id, 4); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | //Set the Room Data |
| 552 | - if(false !== $importable_content && in_array('videos',$importable_content)){ |
|
| 553 | - $this->set_video_data($data,$id); |
|
| 552 | + if (false !== $importable_content && in_array('videos', $importable_content)) { |
|
| 553 | + $this->set_video_data($data, $id); |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | //Set the Electricity |
| 557 | - if(false !== $importable_content && in_array('electricity',$importable_content)){ |
|
| 558 | - $this->set_travel_info($data,$id,'electricity'); |
|
| 557 | + if (false !== $importable_content && in_array('electricity', $importable_content)) { |
|
| 558 | + $this->set_travel_info($data, $id, 'electricity'); |
|
| 559 | 559 | } |
| 560 | 560 | //Set the cuisine |
| 561 | - if(false !== $importable_content && in_array('cuisine',$importable_content)){ |
|
| 562 | - $this->set_travel_info($data,$id,'cuisine'); |
|
| 561 | + if (false !== $importable_content && in_array('cuisine', $importable_content)) { |
|
| 562 | + $this->set_travel_info($data, $id, 'cuisine'); |
|
| 563 | 563 | } |
| 564 | 564 | //Set the banking |
| 565 | - if(false !== $importable_content && in_array('banking',$importable_content)){ |
|
| 566 | - $this->set_travel_info($data,$id,'banking'); |
|
| 565 | + if (false !== $importable_content && in_array('banking', $importable_content)) { |
|
| 566 | + $this->set_travel_info($data, $id, 'banking'); |
|
| 567 | 567 | } |
| 568 | 568 | //Set the transport |
| 569 | - if(false !== $importable_content && in_array('transport',$importable_content)){ |
|
| 570 | - $this->set_travel_info($data,$id,'transport'); |
|
| 569 | + if (false !== $importable_content && in_array('transport', $importable_content)) { |
|
| 570 | + $this->set_travel_info($data, $id, 'transport'); |
|
| 571 | 571 | } |
| 572 | 572 | //Set the dress |
| 573 | - if(false !== $importable_content && in_array('dress',$importable_content)){ |
|
| 574 | - $this->set_travel_info($data,$id,'dress'); |
|
| 573 | + if (false !== $importable_content && in_array('dress', $importable_content)) { |
|
| 574 | + $this->set_travel_info($data, $id, 'dress'); |
|
| 575 | 575 | } |
| 576 | 576 | //Set the climate |
| 577 | - if(false !== $importable_content && in_array('climate',$importable_content)){ |
|
| 578 | - $this->set_travel_info($data,$id,'climate'); |
|
| 577 | + if (false !== $importable_content && in_array('climate', $importable_content)) { |
|
| 578 | + $this->set_travel_info($data, $id, 'climate'); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | //Setup some default for use in the import |
| 582 | - if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){ |
|
| 582 | + if (false !== $importable_content && (in_array('gallery', $importable_content) || in_array('banner_image', $importable_content) || in_array('featured_image', $importable_content))) { |
|
| 583 | 583 | $this->find_attachments($id); |
| 584 | 584 | |
| 585 | 585 | //Set the featured image |
| 586 | - if(false !== $importable_content && in_array('featured_image',$importable_content)){ |
|
| 587 | - $this->set_featured_image($data,$id); |
|
| 586 | + if (false !== $importable_content && in_array('featured_image', $importable_content)) { |
|
| 587 | + $this->set_featured_image($data, $id); |
|
| 588 | 588 | } |
| 589 | - if(false !== $importable_content && in_array('banner_image',$importable_content)){ |
|
| 590 | - $this->set_banner_image($data,$id); |
|
| 589 | + if (false !== $importable_content && in_array('banner_image', $importable_content)) { |
|
| 590 | + $this->set_banner_image($data, $id); |
|
| 591 | 591 | } |
| 592 | 592 | //Import the main gallery |
| 593 | - if(false !== $importable_content && in_array('gallery',$importable_content)){ |
|
| 594 | - $this->create_main_gallery($data,$id); |
|
| 593 | + if (false !== $importable_content && in_array('gallery', $importable_content)) { |
|
| 594 | + $this->create_main_gallery($data, $id); |
|
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | 597 | |
@@ -602,65 +602,65 @@ discard block |
||
| 602 | 602 | /** |
| 603 | 603 | * Set the team memberon each item. |
| 604 | 604 | */ |
| 605 | - public function set_team_member($id,$team_members) { |
|
| 605 | + public function set_team_member($id, $team_members) { |
|
| 606 | 606 | |
| 607 | 607 | delete_post_meta($id, 'team_to_'.$this->tab_slug); |
| 608 | - foreach($team_members as $team){ |
|
| 609 | - add_post_meta($id,'team_to_'.$this->tab_slug,$team); |
|
| 608 | + foreach ($team_members as $team) { |
|
| 609 | + add_post_meta($id, 'team_to_'.$this->tab_slug, $team); |
|
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | /** |
| 614 | 614 | * Saves the longitude and lattitude, as well as sets the map marker. |
| 615 | 615 | */ |
| 616 | - public function set_map_data($data,$id,$zoom=15) { |
|
| 616 | + public function set_map_data($data, $id, $zoom = 15) { |
|
| 617 | 617 | $longitude = $latitude = $address = false; |
| 618 | 618 | |
| 619 | - if(isset($data[0]['position'])){ |
|
| 619 | + if (isset($data[0]['position'])) { |
|
| 620 | 620 | |
| 621 | - if(isset($data[0]['position']['driving_latitude'])){ |
|
| 621 | + if (isset($data[0]['position']['driving_latitude'])) { |
|
| 622 | 622 | $latitude = $data[0]['position']['driving_latitude']; |
| 623 | - }elseif(isset($data[0]['position']['latitude'])){ |
|
| 623 | + }elseif (isset($data[0]['position']['latitude'])) { |
|
| 624 | 624 | $latitude = $data[0]['position']['latitude']; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | - if(isset($data[0]['position']['driving_longitude'])){ |
|
| 627 | + if (isset($data[0]['position']['driving_longitude'])) { |
|
| 628 | 628 | $longitude = $data[0]['position']['driving_longitude']; |
| 629 | - }elseif(isset($data[0]['position']['longitude'])){ |
|
| 629 | + }elseif (isset($data[0]['position']['longitude'])) { |
|
| 630 | 630 | $longitude = $data[0]['position']['longitude']; |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | } |
| 634 | - if(isset($data[0]['content']) && isset($data[0]['content']['contact_information'])){ |
|
| 635 | - if(isset($data[0]['content']['contact_information']['address'])){ |
|
| 634 | + if (isset($data[0]['content']) && isset($data[0]['content']['contact_information'])) { |
|
| 635 | + if (isset($data[0]['content']['contact_information']['address'])) { |
|
| 636 | 636 | $address = strip_tags($data[0]['content']['contact_information']['address']); |
| 637 | 637 | |
| 638 | - $address = explode("\n",$address); |
|
| 639 | - foreach($address as $bitkey => $bit){ |
|
| 638 | + $address = explode("\n", $address); |
|
| 639 | + foreach ($address as $bitkey => $bit) { |
|
| 640 | 640 | $bit = ltrim(rtrim($bit)); |
| 641 | - if(false === $bit || '' === $bit || null === $bit or empty($bit)){ |
|
| 641 | + if (false === $bit || '' === $bit || null === $bit or empty($bit)) { |
|
| 642 | 642 | unset($address[$bitkey]); |
| 643 | 643 | } |
| 644 | 644 | } |
| 645 | - $address = implode(', ',$address); |
|
| 645 | + $address = implode(', ', $address); |
|
| 646 | 646 | $address = str_replace(', , ', ', ', $address); |
| 647 | 647 | } |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | |
| 651 | - if(false !== $longitude){ |
|
| 651 | + if (false !== $longitude) { |
|
| 652 | 652 | $location_data = array( |
| 653 | - 'address' => (string)$address, |
|
| 654 | - 'lat' => (string)$latitude, |
|
| 655 | - 'long' => (string)$longitude, |
|
| 656 | - 'zoom' => (string)$zoom, |
|
| 653 | + 'address' => (string) $address, |
|
| 654 | + 'lat' => (string) $latitude, |
|
| 655 | + 'long' => (string) $longitude, |
|
| 656 | + 'zoom' => (string) $zoom, |
|
| 657 | 657 | 'elevation' => '', |
| 658 | 658 | ); |
| 659 | - if(false !== $id && '0' !== $id){ |
|
| 660 | - $prev = get_post_meta($id,'location',true); |
|
| 661 | - update_post_meta($id,'location',$location_data,$prev); |
|
| 662 | - }else{ |
|
| 663 | - add_post_meta($id,'location',$location_data,true); |
|
| 659 | + if (false !== $id && '0' !== $id) { |
|
| 660 | + $prev = get_post_meta($id, 'location', true); |
|
| 661 | + update_post_meta($id, 'location', $location_data, $prev); |
|
| 662 | + }else { |
|
| 663 | + add_post_meta($id, 'location', $location_data, true); |
|
| 664 | 664 | } |
| 665 | 665 | } |
| 666 | 666 | } |
@@ -668,11 +668,11 @@ discard block |
||
| 668 | 668 | /** |
| 669 | 669 | * Saves the room data |
| 670 | 670 | */ |
| 671 | - public function set_travel_info($data,$id,$meta_key) { |
|
| 671 | + public function set_travel_info($data, $id, $meta_key) { |
|
| 672 | 672 | |
| 673 | - if(!empty($data[0]['travel_information']) && isset($data[0]['travel_information'][$meta_key])){ |
|
| 673 | + if (!empty($data[0]['travel_information']) && isset($data[0]['travel_information'][$meta_key])) { |
|
| 674 | 674 | $content = $data[0]['travel_information'][$meta_key]; |
| 675 | - $this->save_custom_field($content,$meta_key,$id); |
|
| 675 | + $this->save_custom_field($content, $meta_key, $id); |
|
| 676 | 676 | } |
| 677 | 677 | } |
| 678 | 678 | |