@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | * Formats the row for output on the screen. |
| 383 | 383 | * |
| 384 | 384 | * @param boolean $row the current row to format. |
| 385 | - * @return void |
|
| 385 | + * @return string|null |
|
| 386 | 386 | */ |
| 387 | 387 | public function format_row( $row = false, $row_key = '' ) { |
| 388 | 388 | if ( false !== $row ) { |
@@ -633,6 +633,7 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | /** |
| 635 | 635 | * Set the team memberon each item. |
| 636 | + * @param boolean $team_members |
|
| 636 | 637 | */ |
| 637 | 638 | public function set_team_member( $id, $team_members ) { |
| 638 | 639 | delete_post_meta( $id, 'team_to_' . $this->tab_slug ); |
@@ -644,6 +645,7 @@ discard block |
||
| 644 | 645 | |
| 645 | 646 | /** |
| 646 | 647 | * Set the safari brand |
| 648 | + * @param boolean $safari_brands |
|
| 647 | 649 | */ |
| 648 | 650 | public function set_safari_brands( $id, $safari_brands ) { |
| 649 | 651 | foreach ( $safari_brands as $safari_brand ) { |
@@ -76,19 +76,19 @@ discard block |
||
| 76 | 76 | // $this->url = 'https://wetu.com/API/Pins/'; |
| 77 | 77 | // $this->url_qs = 'username=' . $this->api_username . '&password=' . $this->api_password; |
| 78 | 78 | //} elseif ( false !== $this->api_key ) { |
| 79 | - $this->url = 'https://wetu.com/API/Pins/' . $this->api_key; |
|
| 79 | + $this->url = 'https://wetu.com/API/Pins/'.$this->api_key; |
|
| 80 | 80 | $this->url_qs = 'all=include'; |
| 81 | 81 | //} |
| 82 | 82 | |
| 83 | - $temp_options = get_option( '_lsx-to_settings', false ); |
|
| 83 | + $temp_options = get_option('_lsx-to_settings', false); |
|
| 84 | 84 | |
| 85 | - if ( false !== $temp_options && isset( $temp_options[ $this->plugin_slug ] ) && ! empty( $temp_options[ $this->plugin_slug ] ) ) { |
|
| 86 | - $this->options = $temp_options[ $this->plugin_slug ]; |
|
| 85 | + if (false !== $temp_options && isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug])) { |
|
| 86 | + $this->options = $temp_options[$this->plugin_slug]; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - $accommodation_options = get_option( 'lsx_wetu_importer_accommodation_settings',false ); |
|
| 89 | + $accommodation_options = get_option('lsx_wetu_importer_accommodation_settings', false); |
|
| 90 | 90 | |
| 91 | - if ( false !== $accommodation_options ) { |
|
| 91 | + if (false !== $accommodation_options) { |
|
| 92 | 92 | $this->accommodation_options = $accommodation_options; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | </div> |
| 109 | 109 | |
| 110 | 110 | <form method="get" action="" id="posts-filter"> |
| 111 | - <input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr( $this->tab_slug ); ?>" /> |
|
| 111 | + <input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr($this->tab_slug); ?>" /> |
|
| 112 | 112 | |
| 113 | 113 | <table class="wp-list-table widefat fixed posts"> |
| 114 | 114 | <?php $this->table_header(); ?> |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | <tbody id="the-list"> |
| 117 | 117 | <tr class="post-0 type-tour status-none" id="post-0"> |
| 118 | 118 | <th class="check-column" scope="row"> |
| 119 | - <label for="cb-select-0" class="screen-reader-text"><?php esc_html_e( 'Enter a title to search for and press enter', 'lsx-wetu-importer' ); ?></label> |
|
| 119 | + <label for="cb-select-0" class="screen-reader-text"><?php esc_html_e('Enter a title to search for and press enter', 'lsx-wetu-importer'); ?></label> |
|
| 120 | 120 | </th> |
| 121 | 121 | <td class="post-title page-title column-title"> |
| 122 | 122 | <strong> |
| 123 | - <?php esc_html_e( 'Enter a title to search for', 'lsx-wetu-importer' ); ?> |
|
| 123 | + <?php esc_html_e('Enter a title to search for', 'lsx-wetu-importer'); ?> |
|
| 124 | 124 | </strong> |
| 125 | 125 | </td> |
| 126 | 126 | <td class="date column-date"> |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | </table> |
| 136 | 136 | |
| 137 | - <p><input class="button button-primary add" type="button" value="<?php esc_attr_e( 'Add to List', 'lsx-wetu-importer' ); ?>" /> |
|
| 138 | - <input class="button button-primary clear" type="button" value="<?php esc_attr_e( 'Clear', 'lsx-wetu-importer' ); ?>" /> |
|
| 137 | + <p><input class="button button-primary add" type="button" value="<?php esc_attr_e('Add to List', 'lsx-wetu-importer'); ?>" /> |
|
| 138 | + <input class="button button-primary clear" type="button" value="<?php esc_attr_e('Clear', 'lsx-wetu-importer'); ?>" /> |
|
| 139 | 139 | </p> |
| 140 | 140 | </form> |
| 141 | 141 | |
@@ -145,64 +145,64 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | <div class="row"> |
| 147 | 147 | <div class="settings-all" style="width:30%;display:block;float:left;"> |
| 148 | - <h3><?php esc_html_e( 'What content to Sync from WETU' ); ?></h3> |
|
| 148 | + <h3><?php esc_html_e('What content to Sync from WETU'); ?></h3> |
|
| 149 | 149 | <ul> |
| 150 | - <?php if ( ! isset( $this->options['disable_accommodation_descriptions'] ) ) { ?> |
|
| 151 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="description" /> <?php esc_html_e( 'Description', 'lsx-wetu-importer' ); ?></li> |
|
| 150 | + <?php if (!isset($this->options['disable_accommodation_descriptions'])) { ?> |
|
| 151 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="description" /> <?php esc_html_e('Description', 'lsx-wetu-importer'); ?></li> |
|
| 152 | 152 | <?php } ?> |
| 153 | - <?php if ( ! isset( $this->options['disable_accommodation_excerpts'] ) ) { ?> |
|
| 154 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="excerpt" /> <?php esc_html_e( 'Excerpt', 'lsx-wetu-importer' ); ?></li> |
|
| 153 | + <?php if (!isset($this->options['disable_accommodation_excerpts'])) { ?> |
|
| 154 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="excerpt" /> <?php esc_html_e('Excerpt', 'lsx-wetu-importer'); ?></li> |
|
| 155 | 155 | <?php } ?> |
| 156 | 156 | |
| 157 | - <?php if ( ! isset( $this->accommodation_settings['disable_single'] ) ) { ?> |
|
| 158 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="gallery" /> <?php esc_html_e( 'Main Gallery', 'lsx-wetu-importer' ); ?></li> |
|
| 157 | + <?php if (!isset($this->accommodation_settings['disable_single'])) { ?> |
|
| 158 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="gallery" /> <?php esc_html_e('Main Gallery', 'lsx-wetu-importer'); ?></li> |
|
| 159 | 159 | <?php } ?> |
| 160 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="category" /> <?php esc_html_e( 'Category', 'lsx-wetu-importer' ); ?></li> |
|
| 161 | - <?php if ( ! isset( $this->accommodation_settings['disable_single'] ) ) { ?> |
|
| 162 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="location" /> <?php esc_html_e( 'Location', 'lsx-wetu-importer' ); ?></li> |
|
| 160 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="category" /> <?php esc_html_e('Category', 'lsx-wetu-importer'); ?></li> |
|
| 161 | + <?php if (!isset($this->accommodation_settings['disable_single'])) { ?> |
|
| 162 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="location" /> <?php esc_html_e('Location', 'lsx-wetu-importer'); ?></li> |
|
| 163 | 163 | <?php } ?> |
| 164 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="destination" /> <?php esc_html_e( 'Connect Destinations', 'lsx-wetu-importer' ); ?></li> |
|
| 165 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="rating" /> <?php esc_html_e( 'Rating', 'lsx-wetu-importer' ); ?></li> |
|
| 166 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="rooms" /> <?php esc_html_e( 'Rooms', 'lsx-wetu-importer' ); ?></li> |
|
| 167 | - |
|
| 168 | - <?php if ( ! isset( $this->accommodation_settings['disable_single'] ) ) { ?> |
|
| 169 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="checkin" /> <?php esc_html_e( 'Check In / Check Out', 'lsx-wetu-importer' ); ?></li> |
|
| 170 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="facilities" /> <?php esc_html_e( 'Facilities', 'lsx-wetu-importer' ); ?></li> |
|
| 171 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="friendly" /> <?php esc_html_e( 'Friendly', 'lsx-wetu-importer' ); ?></li> |
|
| 164 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="destination" /> <?php esc_html_e('Connect Destinations', 'lsx-wetu-importer'); ?></li> |
|
| 165 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="rating" /> <?php esc_html_e('Rating', 'lsx-wetu-importer'); ?></li> |
|
| 166 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="rooms" /> <?php esc_html_e('Rooms', 'lsx-wetu-importer'); ?></li> |
|
| 167 | + |
|
| 168 | + <?php if (!isset($this->accommodation_settings['disable_single'])) { ?> |
|
| 169 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="checkin" /> <?php esc_html_e('Check In / Check Out', 'lsx-wetu-importer'); ?></li> |
|
| 170 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="facilities" /> <?php esc_html_e('Facilities', 'lsx-wetu-importer'); ?></li> |
|
| 171 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="friendly" /> <?php esc_html_e('Friendly', 'lsx-wetu-importer'); ?></li> |
|
| 172 | 172 | <?php } ?> |
| 173 | 173 | |
| 174 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="special_interests" /> <?php esc_html_e( 'Special Interests', 'lsx-wetu-importer' ); ?></li> |
|
| 175 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="spoken_languages" /> <?php esc_html_e( 'Spoken Languages', 'lsx-wetu-importer' ); ?></li> |
|
| 174 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="special_interests" /> <?php esc_html_e('Special Interests', 'lsx-wetu-importer'); ?></li> |
|
| 175 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="spoken_languages" /> <?php esc_html_e('Spoken Languages', 'lsx-wetu-importer'); ?></li> |
|
| 176 | 176 | |
| 177 | - <?php if ( class_exists( 'LSX_TO_Videos' ) && ! isset( $this->accommodation_settings['disable_single'] ) ) { ?> |
|
| 178 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="videos" /> <?php esc_html_e( 'Videos', 'lsx-wetu-importer' ); ?></li> |
|
| 177 | + <?php if (class_exists('LSX_TO_Videos') && !isset($this->accommodation_settings['disable_single'])) { ?> |
|
| 178 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="videos" /> <?php esc_html_e('Videos', 'lsx-wetu-importer'); ?></li> |
|
| 179 | 179 | <?php } ?> |
| 180 | 180 | </ul> |
| 181 | - <h4><?php esc_html_e( 'Additional Content' ); ?></h4> |
|
| 181 | + <h4><?php esc_html_e('Additional Content'); ?></h4> |
|
| 182 | 182 | <ul> |
| 183 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="featured_image" /> <?php esc_html_e( 'Set Featured Image', 'lsx-wetu-importer' ); ?></li> |
|
| 184 | - <?php if ( class_exists( 'LSX_Banners' ) && ! isset( $this->accommodation_settings['disable_single'] ) ) { ?> |
|
| 185 | - <li><input class="content" checked="checked" type="checkbox" name="content[]" value="banner_image" /> <?php esc_html_e( 'Set Banner Image', 'lsx-wetu-importer' ); ?></li> |
|
| 183 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="featured_image" /> <?php esc_html_e('Set Featured Image', 'lsx-wetu-importer'); ?></li> |
|
| 184 | + <?php if (class_exists('LSX_Banners') && !isset($this->accommodation_settings['disable_single'])) { ?> |
|
| 185 | + <li><input class="content" checked="checked" type="checkbox" name="content[]" value="banner_image" /> <?php esc_html_e('Set Banner Image', 'lsx-wetu-importer'); ?></li> |
|
| 186 | 186 | <?php } ?> |
| 187 | 187 | </ul> |
| 188 | 188 | </div> |
| 189 | 189 | <div style="width:30%;display:block;float:left;"> |
| 190 | - <h3><?php esc_html_e( 'Assign a Team Member' ); ?></h3> |
|
| 191 | - <?php $this->team_member_checkboxes( $this->accommodation_options ); ?> |
|
| 190 | + <h3><?php esc_html_e('Assign a Team Member'); ?></h3> |
|
| 191 | + <?php $this->team_member_checkboxes($this->accommodation_options); ?> |
|
| 192 | 192 | </div> |
| 193 | 193 | |
| 194 | 194 | <div style="width:30%;display:block;float:left;"> |
| 195 | - <h3><?php esc_html_e( 'Assign a Safari Brand' ); ?></h3> |
|
| 195 | + <h3><?php esc_html_e('Assign a Safari Brand'); ?></h3> |
|
| 196 | 196 | <?php |
| 197 | - echo wp_kses_post( $this->taxonomy_checkboxes( 'accommodation-brand', $this->accommodation_options ) ); |
|
| 197 | + echo wp_kses_post($this->taxonomy_checkboxes('accommodation-brand', $this->accommodation_options)); |
|
| 198 | 198 | ?> |
| 199 | 199 | </div> |
| 200 | 200 | |
| 201 | 201 | <br clear="both" /> |
| 202 | 202 | </div> |
| 203 | 203 | |
| 204 | - <h3><?php esc_html_e( 'Your List' ); ?></h3> |
|
| 205 | - <p><input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Sync', 'lsx-wetu-importer' ); ?>" /></p> |
|
| 204 | + <h3><?php esc_html_e('Your List'); ?></h3> |
|
| 205 | + <p><input class="button button-primary" type="submit" value="<?php esc_attr_e('Sync', 'lsx-wetu-importer'); ?>" /></p> |
|
| 206 | 206 | <table class="wp-list-table widefat fixed posts"> |
| 207 | 207 | <?php $this->table_header(); ?> |
| 208 | 208 | |
@@ -214,12 +214,12 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | </table> |
| 216 | 216 | |
| 217 | - <p><input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Sync', 'lsx-wetu-importer' ); ?>" /></p> |
|
| 217 | + <p><input class="button button-primary" type="submit" value="<?php esc_attr_e('Sync', 'lsx-wetu-importer'); ?>" /></p> |
|
| 218 | 218 | </form> |
| 219 | 219 | </div> |
| 220 | 220 | |
| 221 | 221 | <div style="display:none;" class="completed-list-wrapper"> |
| 222 | - <h3><?php esc_html_e( 'Completed' ); ?> - <small><?php esc_html_e( 'Import your', 'lsx-wetu-importer' ); ?> <a href="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>?page=<?php echo esc_attr( $this->plugin_slug ); ?>&tab=destination"><?php esc_html_e( 'destinations' ); ?></a> <?php esc_html_e( 'next', 'lsx-wetu-importer' ); ?></small></h3> |
|
| 222 | + <h3><?php esc_html_e('Completed'); ?> - <small><?php esc_html_e('Import your', 'lsx-wetu-importer'); ?> <a href="<?php echo esc_url(admin_url('admin.php')); ?>?page=<?php echo esc_attr($this->plugin_slug); ?>&tab=destination"><?php esc_html_e('destinations'); ?></a> <?php esc_html_e('next', 'lsx-wetu-importer'); ?></small></h3> |
|
| 223 | 223 | <ul> |
| 224 | 224 | </ul> |
| 225 | 225 | </div> |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | * search_form |
| 232 | 232 | */ |
| 233 | 233 | public function update_options_form() { |
| 234 | - echo '<div style="display:none;" class="wetu-status"><h3>' . esc_html__( 'Wetu Status', 'lsx-wetu-importer' ) . '</h3>'; |
|
| 234 | + echo '<div style="display:none;" class="wetu-status"><h3>'.esc_html__('Wetu Status', 'lsx-wetu-importer').'</h3>'; |
|
| 235 | 235 | |
| 236 | - $accommodation = get_transient( 'lsx_ti_accommodation' ); |
|
| 236 | + $accommodation = get_transient('lsx_ti_accommodation'); |
|
| 237 | 237 | |
| 238 | 238 | //if ( '' === $accommodation || false === $accommodation || isset( $_GET['refresh_accommodation'] ) ) { |
| 239 | 239 | //$this->update_options(); |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | * Save the list of Accommodation into an option |
| 247 | 247 | */ |
| 248 | 248 | public function update_options() { |
| 249 | - $data = wp_remote_get( $this->url . '/List?' . $this->url_qs ); |
|
| 249 | + $data = wp_remote_get($this->url.'/List?'.$this->url_qs); |
|
| 250 | 250 | |
| 251 | - $accommodation = json_decode( $data, true ); |
|
| 251 | + $accommodation = json_decode($data, true); |
|
| 252 | 252 | |
| 253 | - if ( isset( $accommodation['error'] ) ) { |
|
| 253 | + if (isset($accommodation['error'])) { |
|
| 254 | 254 | return $accommodation['error']; |
| 255 | - } elseif ( isset( $accommodation ) && ! empty( $accommodation ) ) { |
|
| 256 | - set_transient( 'lsx_ti_accommodation',$accommodation,60 * 60 * 2 ); |
|
| 255 | + } elseif (isset($accommodation) && !empty($accommodation)) { |
|
| 256 | + set_transient('lsx_ti_accommodation', $accommodation, 60 * 60 * 2); |
|
| 257 | 257 | return true; |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -263,115 +263,115 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | public function process_ajax_search() { |
| 265 | 265 | $return = false; |
| 266 | - check_ajax_referer( 'lsx_wetu_ajax_action', 'security' ); |
|
| 267 | - if ( isset( $_POST['action'] ) && 'lsx_tour_importer' === $_POST['action'] && isset( $_POST['type'] ) && 'accommodation' === $_POST['type'] ) { |
|
| 266 | + check_ajax_referer('lsx_wetu_ajax_action', 'security'); |
|
| 267 | + if (isset($_POST['action']) && 'lsx_tour_importer' === $_POST['action'] && isset($_POST['type']) && 'accommodation' === $_POST['type']) { |
|
| 268 | 268 | |
| 269 | 269 | $searched_items = false; |
| 270 | - if ( isset( $_POST['keyword'] ) ) { |
|
| 271 | - $keyphrases = array_map( 'sanitize_text_field', wp_unslash( $_POST['keyword'] ) ); |
|
| 272 | - } else { |
|
| 273 | - $keyphrases = array( 0 ); |
|
| 270 | + if (isset($_POST['keyword'])) { |
|
| 271 | + $keyphrases = array_map('sanitize_text_field', wp_unslash($_POST['keyword'])); |
|
| 272 | + }else { |
|
| 273 | + $keyphrases = array(0); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - if ( ! is_array( $keyphrases ) ) { |
|
| 277 | - $keyphrases = array( $keyphrases ); |
|
| 276 | + if (!is_array($keyphrases)) { |
|
| 277 | + $keyphrases = array($keyphrases); |
|
| 278 | 278 | } |
| 279 | - foreach ( $keyphrases as &$keyword ) { |
|
| 280 | - $keyword = ltrim( rtrim( $keyword ) ); |
|
| 279 | + foreach ($keyphrases as &$keyword) { |
|
| 280 | + $keyword = ltrim(rtrim($keyword)); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | $post_status = false; |
| 284 | 284 | |
| 285 | - if ( in_array( 'publish', $keyphrases ) ) { |
|
| 285 | + if (in_array('publish', $keyphrases)) { |
|
| 286 | 286 | $post_status = 'publish'; |
| 287 | 287 | } |
| 288 | - if ( in_array( 'pending', $keyphrases ) ) { |
|
| 288 | + if (in_array('pending', $keyphrases)) { |
|
| 289 | 289 | $post_status = 'pending'; |
| 290 | 290 | } |
| 291 | - if ( in_array( 'draft', $keyphrases ) ) { |
|
| 291 | + if (in_array('draft', $keyphrases)) { |
|
| 292 | 292 | $post_status = 'draft'; |
| 293 | 293 | } |
| 294 | - if ( in_array( 'import', $keyphrases ) ) { |
|
| 294 | + if (in_array('import', $keyphrases)) { |
|
| 295 | 295 | $post_status = 'import'; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // If there is a post status use it. |
| 299 | - if ( false !== $post_status ) { |
|
| 299 | + if (false !== $post_status) { |
|
| 300 | 300 | |
| 301 | 301 | $accommodation = array(); |
| 302 | 302 | $current_accommodation = $this->find_current_accommodation(); |
| 303 | - if ( ! empty( $current_accommodation ) ) { |
|
| 304 | - foreach ( $current_accommodation as $cs_key => $ccs_id ) { |
|
| 305 | - $accommodation[] = $this->prepare_row_attributes( $cs_key, $ccs_id->post_id ); |
|
| 303 | + if (!empty($current_accommodation)) { |
|
| 304 | + foreach ($current_accommodation as $cs_key => $ccs_id) { |
|
| 305 | + $accommodation[] = $this->prepare_row_attributes($cs_key, $ccs_id->post_id); |
|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | // Run through each accommodation and use it. |
| 310 | - if ( ! empty( $accommodation ) ) { |
|
| 311 | - foreach ( $accommodation as $row_key => $row ) { |
|
| 310 | + if (!empty($accommodation)) { |
|
| 311 | + foreach ($accommodation as $row_key => $row) { |
|
| 312 | 312 | $row['post_title'] = $row['name']; |
| 313 | - if ( 'import' === $post_status ) { |
|
| 314 | - if ( is_array( $this->queued_imports ) && in_array( $row['post_id'], $this->queued_imports ) ) { |
|
| 315 | - $current_status = get_post_status( $row['post_id'] ); |
|
| 316 | - if ( 'draft' === $current_status ) { |
|
| 317 | - $searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row ); |
|
| 313 | + if ('import' === $post_status) { |
|
| 314 | + if (is_array($this->queued_imports) && in_array($row['post_id'], $this->queued_imports)) { |
|
| 315 | + $current_status = get_post_status($row['post_id']); |
|
| 316 | + if ('draft' === $current_status) { |
|
| 317 | + $searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row); |
|
| 318 | 318 | } |
| 319 | - } else { |
|
| 319 | + }else { |
|
| 320 | 320 | continue; |
| 321 | 321 | } |
| 322 | - } else { |
|
| 323 | - if ( 0 === $row['post_id'] ) { |
|
| 322 | + }else { |
|
| 323 | + if (0 === $row['post_id']) { |
|
| 324 | 324 | continue; |
| 325 | - } else { |
|
| 326 | - $current_status = get_post_status( $row['post_id'] ); |
|
| 327 | - if ( $current_status !== $post_status ) { |
|
| 325 | + }else { |
|
| 326 | + $current_status = get_post_status($row['post_id']); |
|
| 327 | + if ($current_status !== $post_status) { |
|
| 328 | 328 | continue; |
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | - $searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row, $row_key ); |
|
| 331 | + $searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row, $row_key); |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | - } else { |
|
| 336 | - $key_string_search = implode( '+', $keyphrases ); |
|
| 337 | - $search_data = wp_remote_get( $this->url . '/Search/' . $key_string_search ); |
|
| 338 | - if ( ! empty( $search_data ) && isset( $search_data['response'] ) && isset( $search_data['response']['code'] ) && 200 === $search_data['response']['code'] ) { |
|
| 335 | + }else { |
|
| 336 | + $key_string_search = implode('+', $keyphrases); |
|
| 337 | + $search_data = wp_remote_get($this->url.'/Search/'.$key_string_search); |
|
| 338 | + if (!empty($search_data) && isset($search_data['response']) && isset($search_data['response']['code']) && 200 === $search_data['response']['code']) { |
|
| 339 | 339 | |
| 340 | - $search_data = json_decode( $search_data['body'], true ); |
|
| 341 | - foreach ( $search_data as $sdata_key => $sdata ) { |
|
| 340 | + $search_data = json_decode($search_data['body'], true); |
|
| 341 | + foreach ($search_data as $sdata_key => $sdata) { |
|
| 342 | 342 | |
| 343 | - if ( 'Destination' === trim( $sdata['type'] ) || 'Activity' === trim( $sdata['type'] ) || 'Restaurant' === trim( $sdata['type'] ) || 'None' === trim( $sdata['type'] ) || 'Site / Attraction' === trim( $sdata['type'] ) || '' === trim( $sdata['type'] ) ) { |
|
| 343 | + if ('Destination' === trim($sdata['type']) || 'Activity' === trim($sdata['type']) || 'Restaurant' === trim($sdata['type']) || 'None' === trim($sdata['type']) || 'Site / Attraction' === trim($sdata['type']) || '' === trim($sdata['type'])) { |
|
| 344 | 344 | continue; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - $temp_id = $this->get_post_id_by_key_value( $sdata['id'] ); |
|
| 348 | - if ( false === $temp_id ) { |
|
| 347 | + $temp_id = $this->get_post_id_by_key_value($sdata['id']); |
|
| 348 | + if (false === $temp_id) { |
|
| 349 | 349 | $sdata['post_id'] = 0; |
| 350 | 350 | $sdata['post_title'] = $sdata['name']; |
| 351 | - } else { |
|
| 351 | + }else { |
|
| 352 | 352 | $sdata['post_id'] = $temp_id; |
| 353 | - $sdata['post_title'] = get_the_title( $temp_id ); |
|
| 353 | + $sdata['post_title'] = get_the_title($temp_id); |
|
| 354 | 354 | } |
| 355 | - $searched_items[ sanitize_title( $sdata['name'] ) . '-' . $sdata['id'] ] = $this->format_row( $sdata, $sdata_key ); |
|
| 355 | + $searched_items[sanitize_title($sdata['name']).'-'.$sdata['id']] = $this->format_row($sdata, $sdata_key); |
|
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - if ( false !== $searched_items ) { |
|
| 361 | - $return = implode( $searched_items ); |
|
| 360 | + if (false !== $searched_items) { |
|
| 361 | + $return = implode($searched_items); |
|
| 362 | 362 | } |
| 363 | - print_r( $return ); |
|
| 363 | + print_r($return); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | die(); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - public function prepare_row_attributes( $cs_key, $ccs_id ) { |
|
| 369 | + public function prepare_row_attributes($cs_key, $ccs_id) { |
|
| 370 | 370 | $row_item = array( |
| 371 | 371 | 'id' => $cs_key, |
| 372 | 372 | 'type' => 'Accommodation', |
| 373 | - 'name' => get_the_title( $ccs_id ), |
|
| 374 | - 'last_modified' => date( 'Y-m-d', strtotime( 'now' ) ), |
|
| 373 | + 'name' => get_the_title($ccs_id), |
|
| 374 | + 'last_modified' => date('Y-m-d', strtotime('now')), |
|
| 375 | 375 | 'post_id' => $ccs_id, |
| 376 | 376 | ); |
| 377 | 377 | return $row_item; |
@@ -383,31 +383,31 @@ discard block |
||
| 383 | 383 | * @param boolean $row the current row to format. |
| 384 | 384 | * @return void |
| 385 | 385 | */ |
| 386 | - public function format_row( $row = false, $row_key = '' ) { |
|
| 387 | - if ( false !== $row ) { |
|
| 386 | + public function format_row($row = false, $row_key = '') { |
|
| 387 | + if (false !== $row) { |
|
| 388 | 388 | |
| 389 | 389 | $status = 'import'; |
| 390 | - if ( 0 !== $row['post_id'] ) { |
|
| 391 | - $status = '<a href="' . admin_url( '/post.php?post=' . $row['post_id'] . '&action=edit' ) . '" target="_blank">' . get_post_status( $row['post_id'] ) . '</a>'; |
|
| 390 | + if (0 !== $row['post_id']) { |
|
| 391 | + $status = '<a href="'.admin_url('/post.php?post='.$row['post_id'].'&action=edit').'" target="_blank">'.get_post_status($row['post_id']).'</a>'; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $row_html = ' |
| 395 | - <tr class="post-' . $row['post_id'] . ' type-tour" id="post-' . $row['post_id'] . '"> |
|
| 395 | + <tr class="post-' . $row['post_id'].' type-tour" id="post-'.$row['post_id'].'"> |
|
| 396 | 396 | <th class="check-column" scope="row"> |
| 397 | - <label for="cb-select-' . $row['id'] . '" class="screen-reader-text">' . $row['name'] . '</label> |
|
| 398 | - <input type="checkbox" data-identifier="' . $row['id'] . '" value="' . $row['post_id'] . '" name="post[]" id="cb-select-' . $row['id'] . '"> |
|
| 397 | + <label for="cb-select-' . $row['id'].'" class="screen-reader-text">'.$row['name'].'</label> |
|
| 398 | + <input type="checkbox" data-identifier="' . $row['id'].'" value="'.$row['post_id'].'" name="post[]" id="cb-select-'.$row['id'].'"> |
|
| 399 | 399 | </th> |
| 400 | 400 | <td class="column-order"> |
| 401 | - ' . ( $row_key + 1 ) . ' |
|
| 401 | + ' . ($row_key + 1).' |
|
| 402 | 402 | </td> |
| 403 | 403 | <td class="post-title page-title column-title"> |
| 404 | - <strong>' . $row['post_title'] . '</strong> - ' . $status . ' |
|
| 404 | + <strong>' . $row['post_title'].'</strong> - '.$status.' |
|
| 405 | 405 | </td> |
| 406 | 406 | <td class="date column-date"> |
| 407 | - <abbr title="' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '">' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '</abbr><br>Last Modified |
|
| 407 | + <abbr title="' . date('Y/m/d', strtotime($row['last_modified'])).'">'.date('Y/m/d', strtotime($row['last_modified'])).'</abbr><br>Last Modified |
|
| 408 | 408 | </td> |
| 409 | 409 | <td class="ssid column-ssid"> |
| 410 | - ' . $row['id'] . ' |
|
| 410 | + ' . $row['id'].' |
|
| 411 | 411 | </td> |
| 412 | 412 | </tr>'; |
| 413 | 413 | return $row_html; |
@@ -417,14 +417,14 @@ discard block |
||
| 417 | 417 | /** |
| 418 | 418 | * Saves the queue to the option. |
| 419 | 419 | */ |
| 420 | - public function remove_from_queue( $id ) { |
|
| 421 | - if ( ! empty( $this->queued_imports ) ) { |
|
| 422 | - $key = array_search( $id, $this->queued_imports ); |
|
| 423 | - if ( false !== $key ) { |
|
| 424 | - unset( $this->queued_imports[ $key ] ); |
|
| 420 | + public function remove_from_queue($id) { |
|
| 421 | + if (!empty($this->queued_imports)) { |
|
| 422 | + $key = array_search($id, $this->queued_imports); |
|
| 423 | + if (false !== $key) { |
|
| 424 | + unset($this->queued_imports[$key]); |
|
| 425 | 425 | |
| 426 | - delete_option( 'lsx_wetu_importer_que' ); |
|
| 427 | - update_option( 'lsx_wetu_importer_que', $this->queued_imports ); |
|
| 426 | + delete_option('lsx_wetu_importer_que'); |
|
| 427 | + update_option('lsx_wetu_importer_que', $this->queued_imports); |
|
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | } |
@@ -434,47 +434,47 @@ discard block |
||
| 434 | 434 | */ |
| 435 | 435 | public function process_ajax_import() { |
| 436 | 436 | $return = false; |
| 437 | - check_ajax_referer( 'lsx_wetu_ajax_action', 'security' ); |
|
| 437 | + check_ajax_referer('lsx_wetu_ajax_action', 'security'); |
|
| 438 | 438 | |
| 439 | - if ( isset( $_POST['action'] ) && 'lsx_import_items' === $_POST['action'] && isset( $_POST['type'] ) && 'accommodation' === $_POST['type'] && isset( $_POST['wetu_id'] ) ) { |
|
| 439 | + if (isset($_POST['action']) && 'lsx_import_items' === $_POST['action'] && isset($_POST['type']) && 'accommodation' === $_POST['type'] && isset($_POST['wetu_id'])) { |
|
| 440 | 440 | |
| 441 | - $wetu_id = sanitize_text_field( $_POST['wetu_id'] ); |
|
| 442 | - if ( isset( $_POST['post_id'] ) ) { |
|
| 443 | - $post_id = sanitize_text_field( $_POST['post_id'] ); |
|
| 444 | - } else { |
|
| 441 | + $wetu_id = sanitize_text_field($_POST['wetu_id']); |
|
| 442 | + if (isset($_POST['post_id'])) { |
|
| 443 | + $post_id = sanitize_text_field($_POST['post_id']); |
|
| 444 | + }else { |
|
| 445 | 445 | $post_id = 0; |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - if ( isset( $_POST['team_members'] ) ) { |
|
| 449 | - $team_members = array_map( 'sanitize_text_field', wp_unslash( $_POST['team_members'] ) ); |
|
| 450 | - } else { |
|
| 448 | + if (isset($_POST['team_members'])) { |
|
| 449 | + $team_members = array_map('sanitize_text_field', wp_unslash($_POST['team_members'])); |
|
| 450 | + }else { |
|
| 451 | 451 | $team_members = false; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if ( isset( $_POST['safari_brands'] ) ) { |
|
| 455 | - $safari_brands = array_map( 'sanitize_text_field', wp_unslash( $_POST['safari_brands'] ) ); |
|
| 456 | - } else { |
|
| 454 | + if (isset($_POST['safari_brands'])) { |
|
| 455 | + $safari_brands = array_map('sanitize_text_field', wp_unslash($_POST['safari_brands'])); |
|
| 456 | + }else { |
|
| 457 | 457 | $safari_brands = false; |
| 458 | 458 | } |
| 459 | - delete_option( 'lsx_wetu_importer_accommodation_settings' ); |
|
| 459 | + delete_option('lsx_wetu_importer_accommodation_settings'); |
|
| 460 | 460 | |
| 461 | - if ( isset( $_POST['content'] ) && is_array( $_POST['content'] ) && ! empty( $_POST['content'] ) ) { |
|
| 462 | - $content = array_map( 'sanitize_text_field', wp_unslash( $_POST['content'] ) ); |
|
| 463 | - add_option( 'lsx_wetu_importer_accommodation_settings',$content ); |
|
| 464 | - } else { |
|
| 461 | + if (isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])) { |
|
| 462 | + $content = array_map('sanitize_text_field', wp_unslash($_POST['content'])); |
|
| 463 | + add_option('lsx_wetu_importer_accommodation_settings', $content); |
|
| 464 | + }else { |
|
| 465 | 465 | $content = false; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - $jdata = wp_remote_get( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id ); |
|
| 468 | + $jdata = wp_remote_get($this->url.'/Get?'.$this->url_qs.'&ids='.$wetu_id); |
|
| 469 | 469 | |
| 470 | - if ( ! empty( $jdata ) && isset( $jdata['response'] ) && isset( $jdata['response']['code'] ) && 200 === $jdata['response']['code'] ) { |
|
| 471 | - $adata = json_decode( $jdata['body'], true ); |
|
| 472 | - $return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands ); |
|
| 473 | - $this->format_completed_row( $return ); |
|
| 474 | - $this->remove_from_queue( $return ); |
|
| 470 | + if (!empty($jdata) && isset($jdata['response']) && isset($jdata['response']['code']) && 200 === $jdata['response']['code']) { |
|
| 471 | + $adata = json_decode($jdata['body'], true); |
|
| 472 | + $return = $this->import_row($adata, $wetu_id, $post_id, $team_members, $content, $safari_brands); |
|
| 473 | + $this->format_completed_row($return); |
|
| 474 | + $this->remove_from_queue($return); |
|
| 475 | 475 | $this->cleanup_posts(); |
| 476 | - } else { |
|
| 477 | - $this->format_error( esc_html__( 'There was a problem importing your accommodation, please try refreshing the page.', 'lsx-wetu-importer' ) ); |
|
| 476 | + }else { |
|
| 477 | + $this->format_error(esc_html__('There was a problem importing your accommodation, please try refreshing the page.', 'lsx-wetu-importer')); |
|
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | } |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | /** |
| 483 | 483 | * Connect to wetu |
| 484 | 484 | */ |
| 485 | - public function import_row( $data, $wetu_id, $id = 0, $team_members = false, $importable_content = array(), $safari_brands = false ) { |
|
| 485 | + public function import_row($data, $wetu_id, $id = 0, $team_members = false, $importable_content = array(), $safari_brands = false) { |
|
| 486 | 486 | $post_name = ''; |
| 487 | 487 | $data_post_content = ''; |
| 488 | 488 | $data_post_excerpt = ''; |
@@ -493,138 +493,138 @@ discard block |
||
| 493 | 493 | $content_used_general_description = false; |
| 494 | 494 | |
| 495 | 495 | // Set the post_content. |
| 496 | - if ( ! empty( $importable_content ) && in_array( 'description', $importable_content ) ) { |
|
| 497 | - if ( isset( $data[0]['content']['extended_description'] ) ) { |
|
| 496 | + if (!empty($importable_content) && in_array('description', $importable_content)) { |
|
| 497 | + if (isset($data[0]['content']['extended_description'])) { |
|
| 498 | 498 | $data_post_content = $data[0]['content']['extended_description']; |
| 499 | - } elseif ( isset( $data[0]['content']['general_description'] ) ) { |
|
| 499 | + } elseif (isset($data[0]['content']['general_description'])) { |
|
| 500 | 500 | $data_post_content = $data[0]['content']['general_description']; |
| 501 | 501 | $content_used_general_description = true; |
| 502 | - } elseif ( isset( $data[0]['content']['teaser_description'] ) ) { |
|
| 502 | + } elseif (isset($data[0]['content']['teaser_description'])) { |
|
| 503 | 503 | $data_post_content = $data[0]['content']['teaser_description']; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - $post['post_content'] = wp_strip_all_tags( $data_post_content ); |
|
| 506 | + $post['post_content'] = wp_strip_all_tags($data_post_content); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | // set the post_excerpt. |
| 510 | - if ( ! empty( $importable_content ) && in_array( 'excerpt', $importable_content ) ) { |
|
| 511 | - if ( isset( $data[0]['content']['teaser_description'] ) ) { |
|
| 510 | + if (!empty($importable_content) && in_array('excerpt', $importable_content)) { |
|
| 511 | + if (isset($data[0]['content']['teaser_description'])) { |
|
| 512 | 512 | $data_post_excerpt = $data[0]['content']['teaser_description']; |
| 513 | - } elseif ( isset( $data[0]['content']['general_description'] ) && false === $content_used_general_description ) { |
|
| 513 | + } elseif (isset($data[0]['content']['general_description']) && false === $content_used_general_description) { |
|
| 514 | 514 | $data_post_excerpt = $data[0]['content']['general_description']; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | $post['post_excerpt'] = $data_post_excerpt; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - if ( false !== $id && '0' !== $id ) { |
|
| 520 | + if (false !== $id && '0' !== $id) { |
|
| 521 | 521 | $post['ID'] = $id; |
| 522 | 522 | |
| 523 | - if ( isset( $this->options ) && 'on' !== $this->options['disable_accommodation_title'] && isset( $data[0]['name'] ) ) { |
|
| 523 | + if (isset($this->options) && 'on' !== $this->options['disable_accommodation_title'] && isset($data[0]['name'])) { |
|
| 524 | 524 | $post['post_title'] = $data[0]['name']; |
| 525 | - $post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'accommodation', 0 ); |
|
| 525 | + $post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'accommodation', 0); |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | $post['post_status'] = 'publish'; |
| 529 | 529 | |
| 530 | - $id = wp_update_post( $post ); |
|
| 531 | - $prev_date = get_post_meta( $id, 'lsx_wetu_modified_date', true ); |
|
| 532 | - update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date ); |
|
| 533 | - } else { |
|
| 530 | + $id = wp_update_post($post); |
|
| 531 | + $prev_date = get_post_meta($id, 'lsx_wetu_modified_date', true); |
|
| 532 | + update_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']), $prev_date); |
|
| 533 | + }else { |
|
| 534 | 534 | // Set the name. |
| 535 | - if ( isset( $data[0]['name'] ) ) { |
|
| 536 | - $post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'accommodation', 0 ); |
|
| 535 | + if (isset($data[0]['name'])) { |
|
| 536 | + $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'accommodation', 0); |
|
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | $post['post_name'] = $post_name; |
| 540 | 540 | $post['post_title'] = $data[0]['name']; |
| 541 | 541 | $post['post_status'] = 'publish'; |
| 542 | - $id = wp_insert_post( $post ); |
|
| 542 | + $id = wp_insert_post($post); |
|
| 543 | 543 | |
| 544 | 544 | // Save the WETU ID and the Last date it was modified. |
| 545 | - if ( false !== $id ) { |
|
| 546 | - add_post_meta( $id, 'lsx_wetu_id', $wetu_id ); |
|
| 547 | - add_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ) ); |
|
| 545 | + if (false !== $id) { |
|
| 546 | + add_post_meta($id, 'lsx_wetu_id', $wetu_id); |
|
| 547 | + add_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified'])); |
|
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | // Setup some default for use in the import. |
| 552 | - if ( false !== $importable_content && ( in_array( 'gallery', $importable_content ) || in_array( 'banner_image', $importable_content ) || in_array( 'featured_image', $importable_content ) ) ) { |
|
| 553 | - $this->find_attachments( $id ); |
|
| 552 | + if (false !== $importable_content && (in_array('gallery', $importable_content) || in_array('banner_image', $importable_content) || in_array('featured_image', $importable_content))) { |
|
| 553 | + $this->find_attachments($id); |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | // Set the team member if it is there. |
| 557 | - if ( post_type_exists( 'team' ) && false !== $team_members && '' !== $team_members ) { |
|
| 558 | - $this->set_team_member( $id, $team_members ); |
|
| 557 | + if (post_type_exists('team') && false !== $team_members && '' !== $team_members) { |
|
| 558 | + $this->set_team_member($id, $team_members); |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | // Set the safari brand. |
| 562 | - if ( false !== $safari_brands && '' !== $safari_brands ) { |
|
| 563 | - $this->set_safari_brands( $id, $safari_brands ); |
|
| 562 | + if (false !== $safari_brands && '' !== $safari_brands) { |
|
| 563 | + $this->set_safari_brands($id, $safari_brands); |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - $this->set_map_data( $data, $id, 9 ); |
|
| 566 | + $this->set_map_data($data, $id, 9); |
|
| 567 | 567 | |
| 568 | - if ( post_type_exists( 'destination' ) && false !== $importable_content && in_array( 'destination', $importable_content ) ) { |
|
| 569 | - $this->connect_destinations( $data, $id ); |
|
| 568 | + if (post_type_exists('destination') && false !== $importable_content && in_array('destination', $importable_content)) { |
|
| 569 | + $this->connect_destinations($data, $id); |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - if ( false !== $importable_content && in_array( 'category', $importable_content ) ) { |
|
| 573 | - $this->set_taxonomy_style( $data, $id ); |
|
| 572 | + if (false !== $importable_content && in_array('category', $importable_content)) { |
|
| 573 | + $this->set_taxonomy_style($data, $id); |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | // Set the Room Data. |
| 577 | - if ( false !== $importable_content && in_array( 'rooms', $importable_content ) ) { |
|
| 578 | - $this->set_room_data( $data, $id ); |
|
| 577 | + if (false !== $importable_content && in_array('rooms', $importable_content)) { |
|
| 578 | + $this->set_room_data($data, $id); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | // Set the rating. |
| 582 | - if ( false !== $importable_content && in_array( 'rating', $importable_content ) ) { |
|
| 583 | - $this->set_rating( $data, $id ); |
|
| 582 | + if (false !== $importable_content && in_array('rating', $importable_content)) { |
|
| 583 | + $this->set_rating($data, $id); |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | // Set the checkin checkout data. |
| 587 | - if ( false !== $importable_content && in_array( 'checkin', $importable_content ) ) { |
|
| 588 | - $this->set_checkin_checkout( $data, $id ); |
|
| 587 | + if (false !== $importable_content && in_array('checkin', $importable_content)) { |
|
| 588 | + $this->set_checkin_checkout($data, $id); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | // Set the Spoken Languages. |
| 592 | - if ( false !== $importable_content && in_array( 'spoken_languages', $importable_content ) ) { |
|
| 593 | - $this->set_spoken_languages( $data, $id ); |
|
| 592 | + if (false !== $importable_content && in_array('spoken_languages', $importable_content)) { |
|
| 593 | + $this->set_spoken_languages($data, $id); |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | // Set the friendly options. |
| 597 | - if ( false !== $importable_content && in_array( 'friendly', $importable_content ) ) { |
|
| 598 | - $this->set_friendly( $data, $id ); |
|
| 597 | + if (false !== $importable_content && in_array('friendly', $importable_content)) { |
|
| 598 | + $this->set_friendly($data, $id); |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | // Set the special_interests. |
| 602 | - if ( false !== $importable_content && in_array( 'special_interests', $importable_content ) ) { |
|
| 603 | - $this->set_special_interests( $data, $id ); |
|
| 602 | + if (false !== $importable_content && in_array('special_interests', $importable_content)) { |
|
| 603 | + $this->set_special_interests($data, $id); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | // Import the videos. |
| 607 | - if ( false !== $importable_content && in_array( 'videos', $importable_content ) ) { |
|
| 608 | - $this->set_video_data( $data, $id ); |
|
| 607 | + if (false !== $importable_content && in_array('videos', $importable_content)) { |
|
| 608 | + $this->set_video_data($data, $id); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | // Import the facilities. |
| 612 | - if ( false !== $importable_content && in_array( 'facilities', $importable_content ) ) { |
|
| 613 | - $this->set_facilities( $data, $id ); |
|
| 612 | + if (false !== $importable_content && in_array('facilities', $importable_content)) { |
|
| 613 | + $this->set_facilities($data, $id); |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | // Set the featured image. |
| 617 | - if ( false !== $importable_content && in_array( 'featured_image', $importable_content ) ) { |
|
| 618 | - $this->set_featured_image( $data, $id ); |
|
| 617 | + if (false !== $importable_content && in_array('featured_image', $importable_content)) { |
|
| 618 | + $this->set_featured_image($data, $id); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - if ( false !== $importable_content && in_array( 'banner_image', $importable_content ) ) { |
|
| 622 | - $this->set_banner_image( $data, $id ); |
|
| 621 | + if (false !== $importable_content && in_array('banner_image', $importable_content)) { |
|
| 622 | + $this->set_banner_image($data, $id); |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | // Import the main gallery. |
| 626 | - if ( false !== $importable_content && in_array( 'gallery', $importable_content ) ) { |
|
| 627 | - $this->create_main_gallery( $data, $id ); |
|
| 626 | + if (false !== $importable_content && in_array('gallery', $importable_content)) { |
|
| 627 | + $this->create_main_gallery($data, $id); |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | return $id; |
@@ -633,55 +633,55 @@ discard block |
||
| 633 | 633 | /** |
| 634 | 634 | * Set the team memberon each item. |
| 635 | 635 | */ |
| 636 | - public function set_team_member( $id, $team_members ) { |
|
| 637 | - delete_post_meta( $id, 'team_to_' . $this->tab_slug ); |
|
| 636 | + public function set_team_member($id, $team_members) { |
|
| 637 | + delete_post_meta($id, 'team_to_'.$this->tab_slug); |
|
| 638 | 638 | |
| 639 | - foreach ( $team_members as $team ) { |
|
| 640 | - add_post_meta( $id, 'team_to_' . $this->tab_slug, $team ); |
|
| 639 | + foreach ($team_members as $team) { |
|
| 640 | + add_post_meta($id, 'team_to_'.$this->tab_slug, $team); |
|
| 641 | 641 | } |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | /** |
| 645 | 645 | * Set the safari brand |
| 646 | 646 | */ |
| 647 | - public function set_safari_brands( $id, $safari_brands ) { |
|
| 648 | - foreach ( $safari_brands as $safari_brand ) { |
|
| 649 | - wp_set_object_terms( $id, intval( $safari_brand ), 'accommodation-brand', true ); |
|
| 647 | + public function set_safari_brands($id, $safari_brands) { |
|
| 648 | + foreach ($safari_brands as $safari_brand) { |
|
| 649 | + wp_set_object_terms($id, intval($safari_brand), 'accommodation-brand', true); |
|
| 650 | 650 | } |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | /** |
| 654 | 654 | * Connects the destinations post type |
| 655 | 655 | */ |
| 656 | - public function connect_destinations( $data, $id ) { |
|
| 657 | - if ( isset( $data[0]['position'] ) ) { |
|
| 656 | + public function connect_destinations($data, $id) { |
|
| 657 | + if (isset($data[0]['position'])) { |
|
| 658 | 658 | $destinations = false; |
| 659 | 659 | |
| 660 | - if ( isset( $data[0]['position']['country'] ) ) { |
|
| 660 | + if (isset($data[0]['position']['country'])) { |
|
| 661 | 661 | $destinations['country'] = $data[0]['position']['country']; |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | - if ( isset( $data[0]['position']['destination'] ) ) { |
|
| 664 | + if (isset($data[0]['position']['destination'])) { |
|
| 665 | 665 | $destinations['destination'] = $data[0]['position']['destination']; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - if ( false !== $destinations ) { |
|
| 669 | - $prev_values = get_post_meta( $id, 'destination_to_accommodation', false ); |
|
| 668 | + if (false !== $destinations) { |
|
| 669 | + $prev_values = get_post_meta($id, 'destination_to_accommodation', false); |
|
| 670 | 670 | |
| 671 | - if ( false === $prev_values || ! is_array( $prev_values ) ) { |
|
| 671 | + if (false === $prev_values || !is_array($prev_values)) { |
|
| 672 | 672 | $prev_values = array(); |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | - delete_post_meta( $id, 'destination_to_accommodation', $prev_values ); |
|
| 676 | - $destinations = array_unique( $destinations ); |
|
| 675 | + delete_post_meta($id, 'destination_to_accommodation', $prev_values); |
|
| 676 | + $destinations = array_unique($destinations); |
|
| 677 | 677 | |
| 678 | - foreach ( $destinations as $key => $value ) { |
|
| 679 | - $destination = get_page_by_title( ltrim( rtrim( $value ) ), 'OBJECT', 'destination' ); |
|
| 680 | - if ( null !== $destination ) { |
|
| 681 | - if ( ! in_array( $destination->ID, $prev_values ) ) { |
|
| 682 | - add_post_meta( $id, 'destination_to_accommodation', $destination->ID, false ); |
|
| 683 | - add_post_meta( $destination->ID, 'accommodation_to_destination', $id, false ); |
|
| 684 | - $this->cleanup_posts[ $destination->ID ] = 'accommodation_to_destination'; |
|
| 678 | + foreach ($destinations as $key => $value) { |
|
| 679 | + $destination = get_page_by_title(ltrim(rtrim($value)), 'OBJECT', 'destination'); |
|
| 680 | + if (null !== $destination) { |
|
| 681 | + if (!in_array($destination->ID, $prev_values)) { |
|
| 682 | + add_post_meta($id, 'destination_to_accommodation', $destination->ID, false); |
|
| 683 | + add_post_meta($destination->ID, 'accommodation_to_destination', $id, false); |
|
| 684 | + $this->cleanup_posts[$destination->ID] = 'accommodation_to_destination'; |
|
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | 687 | } |
@@ -692,72 +692,72 @@ discard block |
||
| 692 | 692 | /** |
| 693 | 693 | * Set the Travel Style |
| 694 | 694 | */ |
| 695 | - public function set_taxonomy_style( $data, $id ) { |
|
| 695 | + public function set_taxonomy_style($data, $id) { |
|
| 696 | 696 | $terms = false; |
| 697 | 697 | |
| 698 | - if ( isset( $data[0]['category'] ) ) { |
|
| 699 | - $term = term_exists( trim( $data[0]['category'] ), 'accommodation-type' ); |
|
| 700 | - if ( ! $term ) { |
|
| 701 | - $term = wp_insert_term( trim( $data[0]['category'] ), 'accommodation-type' ); |
|
| 698 | + if (isset($data[0]['category'])) { |
|
| 699 | + $term = term_exists(trim($data[0]['category']), 'accommodation-type'); |
|
| 700 | + if (!$term) { |
|
| 701 | + $term = wp_insert_term(trim($data[0]['category']), 'accommodation-type'); |
|
| 702 | 702 | |
| 703 | - if ( is_wp_error( $term ) ) { |
|
| 704 | - echo wp_kses_post( $term->get_error_message() ); |
|
| 703 | + if (is_wp_error($term)) { |
|
| 704 | + echo wp_kses_post($term->get_error_message()); |
|
| 705 | 705 | } |
| 706 | - } else { |
|
| 707 | - wp_set_object_terms( $id, intval( $term['term_id'] ), 'accommodation-type', true ); |
|
| 706 | + }else { |
|
| 707 | + wp_set_object_terms($id, intval($term['term_id']), 'accommodation-type', true); |
|
| 708 | 708 | } |
| 709 | - } else { |
|
| 710 | - wp_set_object_terms( $id, intval( $term['term_id'] ), 'accommodation-type', true ); |
|
| 709 | + }else { |
|
| 710 | + wp_set_object_terms($id, intval($term['term_id']), 'accommodation-type', true); |
|
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | /** |
| 715 | 715 | * Saves the room data |
| 716 | 716 | */ |
| 717 | - public function set_room_data( $data, $id ) { |
|
| 718 | - if ( ! empty( $data[0]['rooms'] ) && is_array( $data[0]['rooms'] ) ) { |
|
| 717 | + public function set_room_data($data, $id) { |
|
| 718 | + if (!empty($data[0]['rooms']) && is_array($data[0]['rooms'])) { |
|
| 719 | 719 | $rooms = false; |
| 720 | 720 | |
| 721 | - foreach ( $data[0]['rooms'] as $room ) { |
|
| 721 | + foreach ($data[0]['rooms'] as $room) { |
|
| 722 | 722 | $temp_room = array(); |
| 723 | 723 | |
| 724 | - if ( isset( $room['name'] ) ) { |
|
| 724 | + if (isset($room['name'])) { |
|
| 725 | 725 | $temp_room['title'] = $room['name']; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - if ( isset( $room['description'] ) ) { |
|
| 729 | - $temp_room['description'] = strip_tags( $room['description'] ); |
|
| 728 | + if (isset($room['description'])) { |
|
| 729 | + $temp_room['description'] = strip_tags($room['description']); |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | $temp_room['price'] = 0; |
| 733 | 733 | $temp_room['type'] = 'room'; |
| 734 | 734 | |
| 735 | - if ( ! empty( $room['images'] ) && is_array( $room['images'] ) ) { |
|
| 735 | + if (!empty($room['images']) && is_array($room['images'])) { |
|
| 736 | 736 | $temp_room['gallery'] = array(); |
| 737 | - $temp_room['gallery'][] = $this->attach_image( $room['images'][0], $id ); |
|
| 737 | + $temp_room['gallery'][] = $this->attach_image($room['images'][0], $id); |
|
| 738 | 738 | } |
| 739 | 739 | $rooms[] = $temp_room; |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | - if ( false !== $id && '0' !== $id ) { |
|
| 743 | - delete_post_meta( $id, 'units' ); |
|
| 742 | + if (false !== $id && '0' !== $id) { |
|
| 743 | + delete_post_meta($id, 'units'); |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - foreach ( $rooms as $room ) { |
|
| 747 | - add_post_meta( $id, 'units', $room, false ); |
|
| 746 | + foreach ($rooms as $room) { |
|
| 747 | + add_post_meta($id, 'units', $room, false); |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | - if ( isset( $data[0]['features'] ) && isset( $data[0]['features']['rooms'] ) ) { |
|
| 750 | + if (isset($data[0]['features']) && isset($data[0]['features']['rooms'])) { |
|
| 751 | 751 | $room_count = $data[0]['features']['rooms']; |
| 752 | - } else { |
|
| 753 | - $room_count = count( $data[0]['rooms'] ); |
|
| 752 | + }else { |
|
| 753 | + $room_count = count($data[0]['rooms']); |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | - if ( false !== $id && '0' !== $id ) { |
|
| 757 | - $prev_rooms = get_post_meta( $id, 'number_of_rooms', true ); |
|
| 758 | - update_post_meta( $id, 'number_of_rooms', $room_count, $prev_rooms ); |
|
| 759 | - } else { |
|
| 760 | - add_post_meta( $id, 'number_of_rooms', $room_count, true ); |
|
| 756 | + if (false !== $id && '0' !== $id) { |
|
| 757 | + $prev_rooms = get_post_meta($id, 'number_of_rooms', true); |
|
| 758 | + update_post_meta($id, 'number_of_rooms', $room_count, $prev_rooms); |
|
| 759 | + }else { |
|
| 760 | + add_post_meta($id, 'number_of_rooms', $room_count, true); |
|
| 761 | 761 | } |
| 762 | 762 | } |
| 763 | 763 | } |
@@ -765,33 +765,33 @@ discard block |
||
| 765 | 765 | /** |
| 766 | 766 | * Set the ratings |
| 767 | 767 | */ |
| 768 | - public function set_rating( $data, $id ) { |
|
| 769 | - if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['star_authority'] ) ) { |
|
| 768 | + public function set_rating($data, $id) { |
|
| 769 | + if (!empty($data[0]['features']) && isset($data[0]['features']['star_authority'])) { |
|
| 770 | 770 | $rating_type = $data[0]['features']['star_authority']; |
| 771 | - } else { |
|
| 771 | + }else { |
|
| 772 | 772 | $rating_type = 'Unspecified2'; |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | - $this->save_custom_field( $rating_type, 'rating_type', $id ); |
|
| 775 | + $this->save_custom_field($rating_type, 'rating_type', $id); |
|
| 776 | 776 | |
| 777 | - if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['stars'] ) ) { |
|
| 778 | - $this->save_custom_field( $data[0]['features']['stars'], 'rating', $id, true ); |
|
| 777 | + if (!empty($data[0]['features']) && isset($data[0]['features']['stars'])) { |
|
| 778 | + $this->save_custom_field($data[0]['features']['stars'], 'rating', $id, true); |
|
| 779 | 779 | } |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | /** |
| 783 | 783 | * Set the spoken_languages |
| 784 | 784 | */ |
| 785 | - public function set_spoken_languages( $data, $id ) { |
|
| 786 | - if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['spoken_languages'] ) && ! empty( $data[0]['features']['spoken_languages'] ) ) { |
|
| 785 | + public function set_spoken_languages($data, $id) { |
|
| 786 | + if (!empty($data[0]['features']) && isset($data[0]['features']['spoken_languages']) && !empty($data[0]['features']['spoken_languages'])) { |
|
| 787 | 787 | $languages = false; |
| 788 | 788 | |
| 789 | - foreach ( $data[0]['features']['spoken_languages'] as $spoken_language ) { |
|
| 790 | - $languages[] = sanitize_title( $spoken_language ); |
|
| 789 | + foreach ($data[0]['features']['spoken_languages'] as $spoken_language) { |
|
| 790 | + $languages[] = sanitize_title($spoken_language); |
|
| 791 | 791 | } |
| 792 | 792 | |
| 793 | - if ( false !== $languages ) { |
|
| 794 | - $this->save_custom_field( $languages, 'spoken_languages', $id ); |
|
| 793 | + if (false !== $languages) { |
|
| 794 | + $this->save_custom_field($languages, 'spoken_languages', $id); |
|
| 795 | 795 | } |
| 796 | 796 | } |
| 797 | 797 | } |
@@ -799,16 +799,16 @@ discard block |
||
| 799 | 799 | /** |
| 800 | 800 | * Set the friendly |
| 801 | 801 | */ |
| 802 | - public function set_friendly( $data, $id ) { |
|
| 803 | - if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['suggested_visitor_types'] ) && ! empty( $data[0]['features']['suggested_visitor_types'] ) ) { |
|
| 802 | + public function set_friendly($data, $id) { |
|
| 803 | + if (!empty($data[0]['features']) && isset($data[0]['features']['suggested_visitor_types']) && !empty($data[0]['features']['suggested_visitor_types'])) { |
|
| 804 | 804 | $friendly_options = false; |
| 805 | 805 | |
| 806 | - foreach ( $data[0]['features']['suggested_visitor_types'] as $visitor_type ) { |
|
| 807 | - $friendly_options[] = sanitize_title( $visitor_type ); |
|
| 806 | + foreach ($data[0]['features']['suggested_visitor_types'] as $visitor_type) { |
|
| 807 | + $friendly_options[] = sanitize_title($visitor_type); |
|
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - if ( false !== $friendly_options ) { |
|
| 811 | - $this->save_custom_field( $friendly_options, 'suggested_visitor_types', $id ); |
|
| 810 | + if (false !== $friendly_options) { |
|
| 811 | + $this->save_custom_field($friendly_options, 'suggested_visitor_types', $id); |
|
| 812 | 812 | } |
| 813 | 813 | } |
| 814 | 814 | } |
@@ -816,16 +816,16 @@ discard block |
||
| 816 | 816 | /** |
| 817 | 817 | * Set the special interests |
| 818 | 818 | */ |
| 819 | - public function set_special_interests( $data, $id ) { |
|
| 820 | - if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['special_interests'] ) && ! empty( $data[0]['features']['special_interests'] ) ) { |
|
| 819 | + public function set_special_interests($data, $id) { |
|
| 820 | + if (!empty($data[0]['features']) && isset($data[0]['features']['special_interests']) && !empty($data[0]['features']['special_interests'])) { |
|
| 821 | 821 | $interests = false; |
| 822 | 822 | |
| 823 | - foreach ( $data[0]['features']['special_interests'] as $special_interest ) { |
|
| 824 | - $interests[] = sanitize_title( $special_interest ); |
|
| 823 | + foreach ($data[0]['features']['special_interests'] as $special_interest) { |
|
| 824 | + $interests[] = sanitize_title($special_interest); |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | - if ( false !== $interests ) { |
|
| 828 | - $this->save_custom_field( $interests, 'special_interests', $id ); |
|
| 827 | + if (false !== $interests) { |
|
| 828 | + $this->save_custom_field($interests, 'special_interests', $id); |
|
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | } |
@@ -833,24 +833,24 @@ discard block |
||
| 833 | 833 | /** |
| 834 | 834 | * Set the Check in and Check out Date |
| 835 | 835 | */ |
| 836 | - public function set_checkin_checkout( $data, $id ) { |
|
| 837 | - if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['check_in_time'] ) ) { |
|
| 838 | - $time = str_replace( 'h', ':', $data[0]['features']['check_in_time'] ); |
|
| 839 | - $time = date( 'h:ia', strtotime( $time ) ); |
|
| 840 | - $this->save_custom_field( $time, 'checkin_time', $id ); |
|
| 836 | + public function set_checkin_checkout($data, $id) { |
|
| 837 | + if (!empty($data[0]['features']) && isset($data[0]['features']['check_in_time'])) { |
|
| 838 | + $time = str_replace('h', ':', $data[0]['features']['check_in_time']); |
|
| 839 | + $time = date('h:ia', strtotime($time)); |
|
| 840 | + $this->save_custom_field($time, 'checkin_time', $id); |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | - if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['check_out_time'] ) ) { |
|
| 844 | - $time = str_replace( 'h', ':', $data[0]['features']['check_out_time'] ); |
|
| 845 | - $time = date( 'h:ia', strtotime( $time ) ); |
|
| 846 | - $this->save_custom_field( $time, 'checkout_time', $id ); |
|
| 843 | + if (!empty($data[0]['features']) && isset($data[0]['features']['check_out_time'])) { |
|
| 844 | + $time = str_replace('h', ':', $data[0]['features']['check_out_time']); |
|
| 845 | + $time = date('h:ia', strtotime($time)); |
|
| 846 | + $this->save_custom_field($time, 'checkout_time', $id); |
|
| 847 | 847 | } |
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | /** |
| 851 | 851 | * Set the Facilities |
| 852 | 852 | */ |
| 853 | - public function set_facilities( $data, $id ) { |
|
| 853 | + public function set_facilities($data, $id) { |
|
| 854 | 854 | $parent_facilities = array( |
| 855 | 855 | 'available_services' => 'Available Services', |
| 856 | 856 | 'property_facilities' => 'Property Facilities', |
@@ -858,15 +858,15 @@ discard block |
||
| 858 | 858 | 'activities_on_site' => 'Activities on Site', |
| 859 | 859 | ); |
| 860 | 860 | |
| 861 | - foreach ( $parent_facilities as $key => $label ) { |
|
| 861 | + foreach ($parent_facilities as $key => $label) { |
|
| 862 | 862 | $terms = false; |
| 863 | 863 | |
| 864 | - if ( isset( $data[0]['features'] ) && isset( $data[0]['features'][ $key ] ) ) { |
|
| 865 | - $parent_id = $this->set_term( $id, $label, 'facility' ); |
|
| 864 | + if (isset($data[0]['features']) && isset($data[0]['features'][$key])) { |
|
| 865 | + $parent_id = $this->set_term($id, $label, 'facility'); |
|
| 866 | 866 | } |
| 867 | 867 | |
| 868 | - foreach ( $data[0]['features'][ $key ] as $child_facility ) { |
|
| 869 | - $this->set_term( $id, $child_facility, 'facility', $parent_id ); |
|
| 868 | + foreach ($data[0]['features'][$key] as $child_facility) { |
|
| 869 | + $this->set_term($id, $child_facility, 'facility', $parent_id); |
|
| 870 | 870 | } |
| 871 | 871 | } |
| 872 | 872 | } |