@@ -685,6 +685,7 @@ discard block |
||
685 | 685 | |
686 | 686 | /** |
687 | 687 | * Set the team memberon each item. |
688 | + * @param boolean $team_members |
|
688 | 689 | */ |
689 | 690 | public function set_team_member( $id, $team_members ) { |
690 | 691 | delete_post_meta( $id, 'team_to_' . $this->tab_slug ); |
@@ -696,6 +697,7 @@ discard block |
||
696 | 697 | |
697 | 698 | /** |
698 | 699 | * Saves the room data |
700 | + * @param string $meta_key |
|
699 | 701 | */ |
700 | 702 | public function set_travel_info( $data, $id, $meta_key, $importable = array( 'none' ) ) { |
701 | 703 | if ( ! empty( $data[0]['travel_information'] ) && isset( $data[0]['travel_information'][ $meta_key ] ) ) { |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | // $this->url = 'https://wetu.com/API/Pins/'; |
76 | 76 | // $this->url_qs = 'username=' . $this->api_username . '&password=' . $this->api_password; |
77 | 77 | //} elseif ( false !== $this->api_key ) { |
78 | - $this->url = 'https://wetu.com/API/Pins/' . $this->api_key; |
|
78 | + $this->url = 'https://wetu.com/API/Pins/'.$this->api_key; |
|
79 | 79 | $this->url_qs = 'all=include'; |
80 | 80 | //} |
81 | 81 | |
82 | - $temp_options = get_option( '_lsx-to_settings', false ); |
|
82 | + $temp_options = get_option('_lsx-to_settings', false); |
|
83 | 83 | |
84 | - if ( false !== $temp_options && isset( $temp_options[ $this->plugin_slug ] ) && ! empty( $temp_options[ $this->plugin_slug ] ) ) { |
|
85 | - $this->options = $temp_options[ $this->plugin_slug ]; |
|
84 | + if (false !== $temp_options && isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug])) { |
|
85 | + $this->options = $temp_options[$this->plugin_slug]; |
|
86 | 86 | } |
87 | 87 | |
88 | - $destination_options = get_option( 'wetu_importer_destination_settings', false ); |
|
88 | + $destination_options = get_option('wetu_importer_destination_settings', false); |
|
89 | 89 | |
90 | - if ( false !== $destination_options ) { |
|
90 | + if (false !== $destination_options) { |
|
91 | 91 | $this->destination_options = $destination_options; |
92 | 92 | } |
93 | 93 | } |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | public function display_page() { |
99 | 99 | ?> |
100 | 100 | <div class="wrap"> |
101 | - <?php $this->navigation( 'destination' ); ?> |
|
101 | + <?php $this->navigation('destination'); ?> |
|
102 | 102 | |
103 | 103 | <?php $this->search_form(); ?> |
104 | 104 | |
105 | 105 | <form method="get" action="" id="posts-filter"> |
106 | - <input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr( $this->tab_slug ); ?>"/> |
|
106 | + <input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr($this->tab_slug); ?>"/> |
|
107 | 107 | |
108 | 108 | <p><input class="button button-primary add" type="button" |
109 | - value="<?php esc_html_e( 'Add to List', 'wetu-importer' ); ?>"/> |
|
109 | + value="<?php esc_html_e('Add to List', 'wetu-importer'); ?>"/> |
|
110 | 110 | <input class="button button-primary clear" type="button" |
111 | - value="<?php esc_html_e( 'Clear', 'wetu-importer' ); ?>"/> |
|
111 | + value="<?php esc_html_e('Clear', 'wetu-importer'); ?>"/> |
|
112 | 112 | </p> |
113 | 113 | |
114 | 114 | <table class="wp-list-table widefat fixed posts"> |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | <tr class="post-0 type-tour status-none" id="post-0"> |
119 | 119 | <th class="check-column" scope="row"> |
120 | 120 | <label for="cb-select-0" |
121 | - class="screen-reader-text"><?php esc_html_e( 'Enter a title to search for and press enter', 'wetu-importer' ); ?></label> |
|
121 | + class="screen-reader-text"><?php esc_html_e('Enter a title to search for and press enter', 'wetu-importer'); ?></label> |
|
122 | 122 | </th> |
123 | 123 | <td class="post-title page-title column-title"> |
124 | 124 | <strong> |
125 | - <?php esc_html_e( 'Enter a title to search for', 'wetu-importer' ); ?> |
|
125 | + <?php esc_html_e('Enter a title to search for', 'wetu-importer'); ?> |
|
126 | 126 | </strong> |
127 | 127 | </td> |
128 | 128 | <td class="date column-date"> |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | </table> |
138 | 138 | |
139 | 139 | <p><input class="button button-primary add" type="button" |
140 | - value="<?php esc_html_e( 'Add to List', 'wetu-importer' ); ?>"/> |
|
140 | + value="<?php esc_html_e('Add to List', 'wetu-importer'); ?>"/> |
|
141 | 141 | <input class="button button-primary clear" type="button" |
142 | - value="<?php esc_html_e( 'Clear', 'wetu-importer' ); ?>"/> |
|
142 | + value="<?php esc_html_e('Clear', 'wetu-importer'); ?>"/> |
|
143 | 143 | </p> |
144 | 144 | </form> |
145 | 145 | |
@@ -149,114 +149,114 @@ discard block |
||
149 | 149 | |
150 | 150 | <div class="row"> |
151 | 151 | <div class="settings-all" style="width:30%;display:block;float:left;"> |
152 | - <h3><?php esc_html_e( 'What content to Sync from WETU' ); ?></h3> |
|
152 | + <h3><?php esc_html_e('What content to Sync from WETU'); ?></h3> |
|
153 | 153 | <ul> |
154 | 154 | <li> |
155 | - <input class="content select-all" <?php $this->checked( $this->destination_options, 'all' ); ?> |
|
155 | + <input class="content select-all" <?php $this->checked($this->destination_options, 'all'); ?> |
|
156 | 156 | type="checkbox" name="content[]" |
157 | - value="all"/> <?php esc_html_e( 'Select All', 'wetu-importer' ); ?></li> |
|
158 | - <?php if ( isset( $this->options ) && 'on' !== $this->options['disable_destination_descriptions'] ) { ?> |
|
157 | + value="all"/> <?php esc_html_e('Select All', 'wetu-importer'); ?></li> |
|
158 | + <?php if (isset($this->options) && 'on' !== $this->options['disable_destination_descriptions']) { ?> |
|
159 | 159 | <li> |
160 | - <input class="content" <?php $this->checked( $this->destination_options, 'description' ); ?> |
|
160 | + <input class="content" <?php $this->checked($this->destination_options, 'description'); ?> |
|
161 | 161 | type="checkbox" name="content[]" |
162 | - value="description"/> <?php esc_html_e( 'Description', 'wetu-importer' ); ?></li> |
|
162 | + value="description"/> <?php esc_html_e('Description', 'wetu-importer'); ?></li> |
|
163 | 163 | <?php } ?> |
164 | 164 | |
165 | 165 | <li> |
166 | - <input class="content" <?php $this->checked( $this->destination_options, 'gallery' ); ?> |
|
166 | + <input class="content" <?php $this->checked($this->destination_options, 'gallery'); ?> |
|
167 | 167 | type="checkbox" name="content[]" |
168 | - value="gallery"/> <?php esc_html_e( 'Main Gallery', 'wetu-importer' ); ?></li> |
|
169 | - <?php if ( class_exists( 'LSX_TO_Maps' ) ) { ?> |
|
168 | + value="gallery"/> <?php esc_html_e('Main Gallery', 'wetu-importer'); ?></li> |
|
169 | + <?php if (class_exists('LSX_TO_Maps')) { ?> |
|
170 | 170 | <li> |
171 | - <input class="content" <?php $this->checked( $this->destination_options, 'location' ); ?> |
|
171 | + <input class="content" <?php $this->checked($this->destination_options, 'location'); ?> |
|
172 | 172 | type="checkbox" name="content[]" |
173 | - value="location"/> <?php esc_html_e( 'Location', 'wetu-importer' ); ?></li> |
|
173 | + value="location"/> <?php esc_html_e('Location', 'wetu-importer'); ?></li> |
|
174 | 174 | <?php } ?> |
175 | 175 | |
176 | - <?php if ( class_exists( 'LSX_TO_Videos' ) ) { ?> |
|
176 | + <?php if (class_exists('LSX_TO_Videos')) { ?> |
|
177 | 177 | <li> |
178 | - <input class="content" <?php $this->checked( $this->destination_options, 'videos' ); ?> |
|
178 | + <input class="content" <?php $this->checked($this->destination_options, 'videos'); ?> |
|
179 | 179 | type="checkbox" name="content[]" |
180 | - value="videos"/> <?php esc_html_e( 'Videos', 'wetu-importer' ); ?></li> |
|
180 | + value="videos"/> <?php esc_html_e('Videos', 'wetu-importer'); ?></li> |
|
181 | 181 | <?php } ?> |
182 | 182 | |
183 | 183 | </ul> |
184 | - <h4><?php esc_html_e( 'Additional Content' ); ?></h4> |
|
184 | + <h4><?php esc_html_e('Additional Content'); ?></h4> |
|
185 | 185 | <ul> |
186 | 186 | <li> |
187 | - <input class="content" <?php $this->checked( $this->destination_options, 'continent' ); ?> |
|
187 | + <input class="content" <?php $this->checked($this->destination_options, 'continent'); ?> |
|
188 | 188 | type="checkbox" name="content[]" |
189 | - value="continent"/> <?php esc_html_e( 'Set Continent', 'wetu-importer' ); ?></li> |
|
189 | + value="continent"/> <?php esc_html_e('Set Continent', 'wetu-importer'); ?></li> |
|
190 | 190 | |
191 | 191 | <li> |
192 | - <input class="content" <?php $this->checked( $this->destination_options, 'featured_image' ); ?> |
|
192 | + <input class="content" <?php $this->checked($this->destination_options, 'featured_image'); ?> |
|
193 | 193 | type="checkbox" name="content[]" |
194 | - value="featured_image"/> <?php esc_html_e( 'Set Featured Image', 'wetu-importer' ); ?> |
|
194 | + value="featured_image"/> <?php esc_html_e('Set Featured Image', 'wetu-importer'); ?> |
|
195 | 195 | </li> |
196 | - <?php if ( class_exists( 'LSX_Banners' ) ) { ?> |
|
196 | + <?php if (class_exists('LSX_Banners')) { ?> |
|
197 | 197 | <li> |
198 | - <input class="content" <?php $this->checked( $this->destination_options, 'banner_image' ); ?> |
|
198 | + <input class="content" <?php $this->checked($this->destination_options, 'banner_image'); ?> |
|
199 | 199 | type="checkbox" name="content[]" |
200 | - value="banner_image"/> <?php esc_html_e( 'Set Banner Image', 'wetu-importer' ); ?> |
|
200 | + value="banner_image"/> <?php esc_html_e('Set Banner Image', 'wetu-importer'); ?> |
|
201 | 201 | </li> |
202 | 202 | <li> |
203 | - <input class="content" <?php $this->checked( $this->destination_options, 'unique_banner_image' ); ?> |
|
203 | + <input class="content" <?php $this->checked($this->destination_options, 'unique_banner_image'); ?> |
|
204 | 204 | type="checkbox" name="content[]" |
205 | - value="unique_banner_image"/> <?php esc_html_e( 'Use the WETU banner field', 'wetu-importer' ); ?> |
|
205 | + value="unique_banner_image"/> <?php esc_html_e('Use the WETU banner field', 'wetu-importer'); ?> |
|
206 | 206 | </li> |
207 | 207 | <?php } ?> |
208 | 208 | |
209 | 209 | <li> |
210 | - <input class="content" <?php $this->checked( $this->destination_options, 'strip_tags' ); ?> |
|
210 | + <input class="content" <?php $this->checked($this->destination_options, 'strip_tags'); ?> |
|
211 | 211 | type="checkbox" name="content[]" |
212 | - value="strip_tags"/> <?php esc_html_e( 'Strip HTML from the description', 'wetu-importer' ); ?></li> |
|
212 | + value="strip_tags"/> <?php esc_html_e('Strip HTML from the description', 'wetu-importer'); ?></li> |
|
213 | 213 | </ul> |
214 | 214 | </div> |
215 | 215 | <div class="settings-all" style="width:30%;display:block;float:left;"> |
216 | - <h3><?php esc_html_e( 'Travel Information' ); ?></h3> |
|
216 | + <h3><?php esc_html_e('Travel Information'); ?></h3> |
|
217 | 217 | <ul> |
218 | 218 | <li> |
219 | - <input class="content" <?php $this->checked( $this->destination_options, 'electricity' ); ?> |
|
219 | + <input class="content" <?php $this->checked($this->destination_options, 'electricity'); ?> |
|
220 | 220 | type="checkbox" name="content[]" |
221 | - value="electricity"/> <?php esc_html_e( 'Electricity', 'wetu-importer' ); ?></li> |
|
221 | + value="electricity"/> <?php esc_html_e('Electricity', 'wetu-importer'); ?></li> |
|
222 | 222 | <li> |
223 | - <input class="content" <?php $this->checked( $this->destination_options, 'banking' ); ?> |
|
223 | + <input class="content" <?php $this->checked($this->destination_options, 'banking'); ?> |
|
224 | 224 | type="checkbox" name="content[]" |
225 | - value="banking"/> <?php esc_html_e( 'Banking', 'wetu-importer' ); ?></li> |
|
225 | + value="banking"/> <?php esc_html_e('Banking', 'wetu-importer'); ?></li> |
|
226 | 226 | <li> |
227 | - <input class="content" <?php $this->checked( $this->destination_options, 'cuisine' ); ?> |
|
227 | + <input class="content" <?php $this->checked($this->destination_options, 'cuisine'); ?> |
|
228 | 228 | type="checkbox" name="content[]" |
229 | - value="cuisine"/> <?php esc_html_e( 'Cuisine', 'wetu-importer' ); ?></li> |
|
229 | + value="cuisine"/> <?php esc_html_e('Cuisine', 'wetu-importer'); ?></li> |
|
230 | 230 | <li> |
231 | - <input class="content" <?php $this->checked( $this->destination_options, 'climate' ); ?> |
|
231 | + <input class="content" <?php $this->checked($this->destination_options, 'climate'); ?> |
|
232 | 232 | type="checkbox" name="content[]" |
233 | - value="climate"/> <?php esc_html_e( 'Climate', 'wetu-importer' ); ?></li> |
|
233 | + value="climate"/> <?php esc_html_e('Climate', 'wetu-importer'); ?></li> |
|
234 | 234 | <li> |
235 | - <input class="content" <?php $this->checked( $this->destination_options, 'transport' ); ?> |
|
235 | + <input class="content" <?php $this->checked($this->destination_options, 'transport'); ?> |
|
236 | 236 | type="checkbox" name="content[]" |
237 | - value="transport"/> <?php esc_html_e( 'Transport', 'wetu-importer' ); ?></li> |
|
238 | - <li><input class="content" <?php $this->checked( $this->destination_options, 'dress' ); ?> |
|
237 | + value="transport"/> <?php esc_html_e('Transport', 'wetu-importer'); ?></li> |
|
238 | + <li><input class="content" <?php $this->checked($this->destination_options, 'dress'); ?> |
|
239 | 239 | type="checkbox" name="content[]" |
240 | - value="dress"/> <?php esc_html_e( 'Dress', 'wetu-importer' ); ?></li> |
|
241 | - <li><input class="content" <?php $this->checked( $this->destination_options, 'health' ); ?> |
|
240 | + value="dress"/> <?php esc_html_e('Dress', 'wetu-importer'); ?></li> |
|
241 | + <li><input class="content" <?php $this->checked($this->destination_options, 'health'); ?> |
|
242 | 242 | type="checkbox" name="content[]" |
243 | - value="health"/> <?php esc_html_e( 'Health', 'wetu-importer' ); ?></li> |
|
244 | - <li><input class="content" <?php $this->checked( $this->destination_options, 'safety' ); ?> |
|
243 | + value="health"/> <?php esc_html_e('Health', 'wetu-importer'); ?></li> |
|
244 | + <li><input class="content" <?php $this->checked($this->destination_options, 'safety'); ?> |
|
245 | 245 | type="checkbox" name="content[]" |
246 | - value="safety"/> <?php esc_html_e( 'Safety', 'wetu-importer' ); ?></li> |
|
247 | - <li><input class="content" <?php $this->checked( $this->destination_options, 'visa' ); ?> |
|
246 | + value="safety"/> <?php esc_html_e('Safety', 'wetu-importer'); ?></li> |
|
247 | + <li><input class="content" <?php $this->checked($this->destination_options, 'visa'); ?> |
|
248 | 248 | type="checkbox" name="content[]" |
249 | - value="visa"/> <?php esc_html_e( 'Visa', 'wetu-importer' ); ?></li> |
|
250 | - <li><input class="content" <?php $this->checked( $this->destination_options, 'additional_info' ); ?> |
|
249 | + value="visa"/> <?php esc_html_e('Visa', 'wetu-importer'); ?></li> |
|
250 | + <li><input class="content" <?php $this->checked($this->destination_options, 'additional_info'); ?> |
|
251 | 251 | type="checkbox" name="content[]" |
252 | - value="additional_info"/> <?php esc_html_e( 'General', 'wetu-importer' ); ?></li> |
|
252 | + value="additional_info"/> <?php esc_html_e('General', 'wetu-importer'); ?></li> |
|
253 | 253 | </ul> |
254 | 254 | </div> |
255 | 255 | |
256 | - <?php if ( class_exists( 'LSX_TO_Team' ) ) { ?> |
|
256 | + <?php if (class_exists('LSX_TO_Team')) { ?> |
|
257 | 257 | <div style="width:30%;display:block;float:left;"> |
258 | - <h3><?php esc_html_e( 'Assign a Team Member' ); ?></h3> |
|
259 | - <?php $this->team_member_checkboxes( $this->destination_options ); ?> |
|
258 | + <h3><?php esc_html_e('Assign a Team Member'); ?></h3> |
|
259 | + <?php $this->team_member_checkboxes($this->destination_options); ?> |
|
260 | 260 | </div> |
261 | 261 | <?php } ?> |
262 | 262 | |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | </div> |
265 | 265 | |
266 | 266 | |
267 | - <h3><?php esc_html_e( 'Your List' ); ?></h3> |
|
267 | + <h3><?php esc_html_e('Your List'); ?></h3> |
|
268 | 268 | <p><input class="button button-primary" type="submit" |
269 | - value="<?php esc_html_e( 'Sync', 'wetu-importer' ); ?>"/></p> |
|
269 | + value="<?php esc_html_e('Sync', 'wetu-importer'); ?>"/></p> |
|
270 | 270 | <table class="wp-list-table widefat fixed posts"> |
271 | 271 | <?php $this->table_header(); ?> |
272 | 272 | |
@@ -279,12 +279,12 @@ discard block |
||
279 | 279 | </table> |
280 | 280 | |
281 | 281 | <p><input class="button button-primary" type="submit" |
282 | - value="<?php esc_html_e( 'Sync', 'wetu-importer' ); ?>"/></p> |
|
282 | + value="<?php esc_html_e('Sync', 'wetu-importer'); ?>"/></p> |
|
283 | 283 | </form> |
284 | 284 | </div> |
285 | 285 | |
286 | 286 | <div style="display:none;" class="completed-list-wrapper"> |
287 | - <h3><?php esc_html_e( 'Completed' ); ?></h3> |
|
287 | + <h3><?php esc_html_e('Completed'); ?></h3> |
|
288 | 288 | <ul> |
289 | 289 | </ul> |
290 | 290 | </div> |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | /** |
296 | 296 | * Grab all the current destination posts via the lsx_wetu_id field. |
297 | 297 | */ |
298 | - public function find_current_destination( $post_type = 'destination' ) { |
|
298 | + public function find_current_destination($post_type = 'destination') { |
|
299 | 299 | global $wpdb; |
300 | 300 | $return = array(); |
301 | 301 | |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | "); |
315 | 315 | // @codingStandardsIgnoreEnd |
316 | 316 | |
317 | - if ( null !== $current_destination && ! empty( $current_destination ) ) { |
|
318 | - foreach ( $current_destination as $accom ) { |
|
319 | - $return[ $accom->meta_value ] = $accom; |
|
317 | + if (null !== $current_destination && !empty($current_destination)) { |
|
318 | + foreach ($current_destination as $accom) { |
|
319 | + $return[$accom->meta_value] = $accom; |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
@@ -330,95 +330,95 @@ discard block |
||
330 | 330 | $return = false; |
331 | 331 | |
332 | 332 | // @codingStandardsIgnoreLine |
333 | - if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_tour_importer' && isset( $_POST['type'] ) && $_POST['type'] === 'destination' ) { |
|
334 | - $accommodation = get_transient( 'lsx_ti_accommodation' ); |
|
333 | + if (isset($_POST['action']) && $_POST['action'] === 'lsx_tour_importer' && isset($_POST['type']) && $_POST['type'] === 'destination') { |
|
334 | + $accommodation = get_transient('lsx_ti_accommodation'); |
|
335 | 335 | |
336 | - if ( false === $accommodation ) { |
|
336 | + if (false === $accommodation) { |
|
337 | 337 | $this->update_options(); |
338 | 338 | } |
339 | 339 | |
340 | - if ( false !== $accommodation ) { |
|
340 | + if (false !== $accommodation) { |
|
341 | 341 | $searched_items = false; |
342 | 342 | |
343 | 343 | // @codingStandardsIgnoreLine |
344 | - if ( isset( $_POST['keyword'] ) ) { |
|
344 | + if (isset($_POST['keyword'])) { |
|
345 | 345 | // @codingStandardsIgnoreLine |
346 | 346 | $keyphrases = $_POST['keyword']; |
347 | - } else { |
|
348 | - $keyphrases = array( 0 ); |
|
347 | + }else { |
|
348 | + $keyphrases = array(0); |
|
349 | 349 | } |
350 | 350 | |
351 | - if ( ! is_array( $keyphrases ) ) { |
|
352 | - $keyphrases = array( $keyphrases ); |
|
351 | + if (!is_array($keyphrases)) { |
|
352 | + $keyphrases = array($keyphrases); |
|
353 | 353 | } |
354 | - foreach ( $keyphrases as &$keyword ) { |
|
355 | - $keyword = ltrim( rtrim( $keyword ) ); |
|
354 | + foreach ($keyphrases as &$keyword) { |
|
355 | + $keyword = ltrim(rtrim($keyword)); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $post_status = false; |
359 | 359 | |
360 | - if ( in_array( 'publish',$keyphrases ) ) { |
|
360 | + if (in_array('publish', $keyphrases)) { |
|
361 | 361 | $post_status = 'publish'; |
362 | 362 | } |
363 | - if ( in_array( 'pending',$keyphrases ) ) { |
|
363 | + if (in_array('pending', $keyphrases)) { |
|
364 | 364 | $post_status = 'pending'; |
365 | 365 | } |
366 | - if ( in_array( 'draft',$keyphrases ) ) { |
|
366 | + if (in_array('draft', $keyphrases)) { |
|
367 | 367 | $post_status = 'draft'; |
368 | 368 | } |
369 | - if ( in_array( 'import',$keyphrases ) ) { |
|
369 | + if (in_array('import', $keyphrases)) { |
|
370 | 370 | $post_status = 'import'; |
371 | 371 | } |
372 | 372 | |
373 | - if ( ! empty( $accommodation ) ) { |
|
373 | + if (!empty($accommodation)) { |
|
374 | 374 | |
375 | - $current_accommodation = $this->find_current_accommodation( 'destination' ); |
|
375 | + $current_accommodation = $this->find_current_accommodation('destination'); |
|
376 | 376 | |
377 | - foreach ( $accommodation as $row_key => $row ) { |
|
377 | + foreach ($accommodation as $row_key => $row) { |
|
378 | 378 | |
379 | - if ( 'Destination' === trim( $row['type'] ) ) { |
|
379 | + if ('Destination' === trim($row['type'])) { |
|
380 | 380 | |
381 | 381 | //If this is a current tour, add its ID to the row. |
382 | 382 | $row['post_id'] = 0; |
383 | 383 | |
384 | - if ( false !== $current_accommodation && array_key_exists( $row['id'], $current_accommodation ) ) { |
|
385 | - $row['post_id'] = $current_accommodation[ $row['id'] ]->post_id; |
|
384 | + if (false !== $current_accommodation && array_key_exists($row['id'], $current_accommodation)) { |
|
385 | + $row['post_id'] = $current_accommodation[$row['id']]->post_id; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | //If we are searching for |
389 | - if ( false !== $post_status ) { |
|
390 | - if ( 'import' === $post_status ) { |
|
389 | + if (false !== $post_status) { |
|
390 | + if ('import' === $post_status) { |
|
391 | 391 | |
392 | - if ( is_array( $this->queued_imports ) && in_array( $row['post_id'], $this->queued_imports ) ) { |
|
393 | - $searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row ); |
|
394 | - } else { |
|
392 | + if (is_array($this->queued_imports) && in_array($row['post_id'], $this->queued_imports)) { |
|
393 | + $searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row); |
|
394 | + }else { |
|
395 | 395 | continue; |
396 | 396 | } |
397 | - } else { |
|
398 | - if ( 0 === $row['post_id'] ) { |
|
397 | + }else { |
|
398 | + if (0 === $row['post_id']) { |
|
399 | 399 | continue; |
400 | - } else { |
|
401 | - $current_status = get_post_status( $row['post_id'] ); |
|
400 | + }else { |
|
401 | + $current_status = get_post_status($row['post_id']); |
|
402 | 402 | |
403 | - if ( $current_status !== $post_status ) { |
|
403 | + if ($current_status !== $post_status) { |
|
404 | 404 | continue; |
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
408 | - $searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row ); |
|
408 | + $searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row); |
|
409 | 409 | } |
410 | - } else { |
|
410 | + }else { |
|
411 | 411 | //Search through each keyword. |
412 | - foreach ( $keyphrases as $keyphrase ) { |
|
412 | + foreach ($keyphrases as $keyphrase) { |
|
413 | 413 | //Make sure the keyphrase is turned into an array |
414 | - $keywords = explode( ' ', $keyphrase ); |
|
414 | + $keywords = explode(' ', $keyphrase); |
|
415 | 415 | |
416 | - if ( ! is_array( $keywords ) ) { |
|
417 | - $keywords = array( $keywords ); |
|
416 | + if (!is_array($keywords)) { |
|
417 | + $keywords = array($keywords); |
|
418 | 418 | } |
419 | 419 | |
420 | - if ( $this->multineedle_stripos( ltrim( rtrim( $row['name'] ) ), $keywords ) !== false ) { |
|
421 | - $searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row ); |
|
420 | + if ($this->multineedle_stripos(ltrim(rtrim($row['name'])), $keywords) !== false) { |
|
421 | + $searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | } |
@@ -426,13 +426,13 @@ discard block |
||
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
429 | - if ( false !== $searched_items ) { |
|
430 | - ksort( $searched_items ); |
|
431 | - $return = implode( $searched_items ); |
|
429 | + if (false !== $searched_items) { |
|
430 | + ksort($searched_items); |
|
431 | + $return = implode($searched_items); |
|
432 | 432 | } |
433 | 433 | } |
434 | 434 | |
435 | - print_r( $return ); |
|
435 | + print_r($return); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | die(); |
@@ -441,28 +441,28 @@ discard block |
||
441 | 441 | /** |
442 | 442 | * Formats the row for output on the screen. |
443 | 443 | */ |
444 | - public function format_row( $row = false ) { |
|
445 | - if ( false !== $row ) { |
|
444 | + public function format_row($row = false) { |
|
445 | + if (false !== $row) { |
|
446 | 446 | |
447 | 447 | $status = 'import'; |
448 | - if ( 0 !== $row['post_id'] ) { |
|
449 | - $status = '<a href="' . admin_url( '/post.php?post=' . $row['post_id'] . '&action=edit' ) . '" target="_blank">' . get_post_status( $row['post_id'] ) . '</a>'; |
|
448 | + if (0 !== $row['post_id']) { |
|
449 | + $status = '<a href="'.admin_url('/post.php?post='.$row['post_id'].'&action=edit').'" target="_blank">'.get_post_status($row['post_id']).'</a>'; |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | $row_html = ' |
453 | - <tr class="post-' . $row['post_id'] . ' type-tour" id="post-' . $row['post_id'] . '"> |
|
453 | + <tr class="post-' . $row['post_id'].' type-tour" id="post-'.$row['post_id'].'"> |
|
454 | 454 | <th class="check-column" scope="row"> |
455 | - <label for="cb-select-' . $row['id'] . '" class="screen-reader-text">' . $row['name'] . '</label> |
|
456 | - <input type="checkbox" data-identifier="' . $row['id'] . '" value="' . $row['post_id'] . '" name="post[]" id="cb-select-' . $row['id'] . '"> |
|
455 | + <label for="cb-select-' . $row['id'].'" class="screen-reader-text">'.$row['name'].'</label> |
|
456 | + <input type="checkbox" data-identifier="' . $row['id'].'" value="'.$row['post_id'].'" name="post[]" id="cb-select-'.$row['id'].'"> |
|
457 | 457 | </th> |
458 | 458 | <td class="post-title page-title column-title"> |
459 | - <strong>' . $row['name'] . '</strong> - ' . $status . ' |
|
459 | + <strong>' . $row['name'].'</strong> - '.$status.' |
|
460 | 460 | </td> |
461 | 461 | <td class="date column-date"> |
462 | - <abbr title="' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '">' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '</abbr><br>Last Modified |
|
462 | + <abbr title="' . date('Y/m/d', strtotime($row['last_modified'])).'">'.date('Y/m/d', strtotime($row['last_modified'])).'</abbr><br>Last Modified |
|
463 | 463 | </td> |
464 | 464 | <td class="ssid column-ssid"> |
465 | - ' . $row['id'] . ' |
|
465 | + ' . $row['id'].' |
|
466 | 466 | </td> |
467 | 467 | </tr>'; |
468 | 468 | return $row_html; |
@@ -476,54 +476,54 @@ discard block |
||
476 | 476 | $return = false; |
477 | 477 | |
478 | 478 | // @codingStandardsIgnoreLine |
479 | - if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_import_items' && isset( $_POST['type'] ) && $_POST['type'] === 'destination' && isset( $_POST['wetu_id'] ) ) { |
|
479 | + if (isset($_POST['action']) && $_POST['action'] === 'lsx_import_items' && isset($_POST['type']) && $_POST['type'] === 'destination' && isset($_POST['wetu_id'])) { |
|
480 | 480 | // @codingStandardsIgnoreLine |
481 | 481 | $wetu_id = $_POST['wetu_id']; |
482 | 482 | |
483 | 483 | // @codingStandardsIgnoreLine |
484 | - if ( isset( $_POST['post_id'] ) ) { |
|
484 | + if (isset($_POST['post_id'])) { |
|
485 | 485 | // @codingStandardsIgnoreLine |
486 | 486 | $post_id = $_POST['post_id']; |
487 | - $this->current_post = get_post( $post_id ); |
|
488 | - } else { |
|
487 | + $this->current_post = get_post($post_id); |
|
488 | + }else { |
|
489 | 489 | $post_id = 0; |
490 | 490 | } |
491 | 491 | |
492 | 492 | // @codingStandardsIgnoreLine |
493 | - if ( isset( $_POST['team_members'] ) ) { |
|
493 | + if (isset($_POST['team_members'])) { |
|
494 | 494 | // @codingStandardsIgnoreLine |
495 | 495 | $team_members = $_POST['team_members']; |
496 | - } else { |
|
496 | + }else { |
|
497 | 497 | $team_members = false; |
498 | 498 | } |
499 | 499 | |
500 | 500 | $safari_brands = false; |
501 | 501 | |
502 | - delete_option( 'wetu_importer_destination_settings' ); |
|
502 | + delete_option('wetu_importer_destination_settings'); |
|
503 | 503 | |
504 | 504 | // @codingStandardsIgnoreLine |
505 | - if ( isset( $_POST['content'] ) && is_array( $_POST['content'] ) && ! empty( $_POST['content'] ) ) { |
|
505 | + if (isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])) { |
|
506 | 506 | // @codingStandardsIgnoreLine |
507 | 507 | $content = $_POST['content']; |
508 | - add_option( 'wetu_importer_destination_settings', $content ); |
|
509 | - } else { |
|
508 | + add_option('wetu_importer_destination_settings', $content); |
|
509 | + }else { |
|
510 | 510 | $content = false; |
511 | 511 | } |
512 | 512 | |
513 | - $jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id ); |
|
513 | + $jdata = file_get_contents($this->url.'/Get?'.$this->url_qs.'&ids='.$wetu_id); |
|
514 | 514 | |
515 | - if ( $jdata ) { |
|
516 | - $adata = json_decode( $jdata, true ); |
|
515 | + if ($jdata) { |
|
516 | + $adata = json_decode($jdata, true); |
|
517 | 517 | |
518 | - if ( ! empty( $adata ) && ! isset( $adata['error'] ) ) { |
|
519 | - $return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands ); |
|
520 | - $this->remove_from_queue( $return ); |
|
521 | - $this->format_completed_row( $return ); |
|
522 | - } else { |
|
523 | - if ( isset( $adata['error'] ) ) { |
|
524 | - $this->format_error( $adata['error'] ); |
|
525 | - } else { |
|
526 | - $this->format_error( esc_html__( 'There was a problem importing your destination, please try refreshing the page.','wetu-importer' ) ); |
|
518 | + if (!empty($adata) && !isset($adata['error'])) { |
|
519 | + $return = $this->import_row($adata, $wetu_id, $post_id, $team_members, $content, $safari_brands); |
|
520 | + $this->remove_from_queue($return); |
|
521 | + $this->format_completed_row($return); |
|
522 | + }else { |
|
523 | + if (isset($adata['error'])) { |
|
524 | + $this->format_error($adata['error']); |
|
525 | + }else { |
|
526 | + $this->format_error(esc_html__('There was a problem importing your destination, please try refreshing the page.', 'wetu-importer')); |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 | } |
@@ -533,14 +533,14 @@ discard block |
||
533 | 533 | /** |
534 | 534 | * Saves the queue to the option. |
535 | 535 | */ |
536 | - public function remove_from_queue( $id ) { |
|
537 | - if ( ! empty( $this->queued_imports ) ) { |
|
536 | + public function remove_from_queue($id) { |
|
537 | + if (!empty($this->queued_imports)) { |
|
538 | 538 | // @codingStandardsIgnoreLine |
539 | - if ( ( $key = array_search( $id, $this->queued_imports ) ) !== false ) { |
|
540 | - unset( $this->queued_imports[ $key ] ); |
|
539 | + if (($key = array_search($id, $this->queued_imports)) !== false) { |
|
540 | + unset($this->queued_imports[$key]); |
|
541 | 541 | |
542 | - delete_option( 'wetu_importer_que' ); |
|
543 | - update_option( 'wetu_importer_que',$this->queued_imports ); |
|
542 | + delete_option('wetu_importer_que'); |
|
543 | + update_option('wetu_importer_que', $this->queued_imports); |
|
544 | 544 | } |
545 | 545 | } |
546 | 546 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | /** |
549 | 549 | * Connect to wetu |
550 | 550 | */ |
551 | - public function import_row( $data, $wetu_id, $id = 0, $team_members = false, $importable_content = false, $safari_brands = false ) { |
|
552 | - if ( 'Destination' === trim( $data[0]['type'] ) ) { |
|
551 | + public function import_row($data, $wetu_id, $id = 0, $team_members = false, $importable_content = false, $safari_brands = false) { |
|
552 | + if ('Destination' === trim($data[0]['type'])) { |
|
553 | 553 | $post_name = ''; |
554 | 554 | $data_post_content = ''; |
555 | 555 | $data_post_excerpt = ''; |
@@ -559,124 +559,124 @@ discard block |
||
559 | 559 | ); |
560 | 560 | |
561 | 561 | //Set the post_content |
562 | - if ( false !== $importable_content && in_array( 'description', $importable_content ) ) { |
|
563 | - if ( isset( $data[0]['content']['general_description'] ) ) { |
|
562 | + if (false !== $importable_content && in_array('description', $importable_content)) { |
|
563 | + if (isset($data[0]['content']['general_description'])) { |
|
564 | 564 | |
565 | - if ( false !== $importable_content && in_array( 'strip_tags', $importable_content ) ) { |
|
566 | - $post['post_content'] = wp_strip_all_tags( $data[0]['content']['general_description'] ); |
|
567 | - } else { |
|
565 | + if (false !== $importable_content && in_array('strip_tags', $importable_content)) { |
|
566 | + $post['post_content'] = wp_strip_all_tags($data[0]['content']['general_description']); |
|
567 | + }else { |
|
568 | 568 | $post['post_content'] = $data[0]['content']['general_description']; |
569 | 569 | } |
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
573 | - if ( false !== $id && '0' !== $id ) { |
|
573 | + if (false !== $id && '0' !== $id) { |
|
574 | 574 | $post['ID'] = $id; |
575 | 575 | |
576 | - if ( isset( $data[0]['name'] ) ) { |
|
576 | + if (isset($data[0]['name'])) { |
|
577 | 577 | $post['post_title'] = $data[0]['name']; |
578 | 578 | $post['post_status'] = 'publish'; |
579 | - $post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 ); |
|
579 | + $post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0); |
|
580 | 580 | } |
581 | 581 | |
582 | - $id = wp_update_post( $post ); |
|
583 | - $prev_date = get_post_meta( $id, 'lsx_wetu_modified_date', true ); |
|
584 | - update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date ); |
|
585 | - } else { |
|
582 | + $id = wp_update_post($post); |
|
583 | + $prev_date = get_post_meta($id, 'lsx_wetu_modified_date', true); |
|
584 | + update_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']), $prev_date); |
|
585 | + }else { |
|
586 | 586 | //Set the name |
587 | - if ( isset( $data[0]['name'] ) ) { |
|
588 | - $post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 ); |
|
587 | + if (isset($data[0]['name'])) { |
|
588 | + $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | $post['post_name'] = $post_name; |
592 | 592 | $post['post_title'] = $data[0]['name']; |
593 | 593 | $post['post_status'] = 'publish'; |
594 | - $id = wp_insert_post( $post ); |
|
594 | + $id = wp_insert_post($post); |
|
595 | 595 | |
596 | 596 | //Save the WETU ID and the Last date it was modified. |
597 | - if ( false !== $id ) { |
|
598 | - add_post_meta( $id, 'lsx_wetu_id', $wetu_id ); |
|
599 | - add_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ) ); |
|
597 | + if (false !== $id) { |
|
598 | + add_post_meta($id, 'lsx_wetu_id', $wetu_id); |
|
599 | + add_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified'])); |
|
600 | 600 | } |
601 | 601 | } |
602 | 602 | |
603 | - $this->find_attachments( $id ); |
|
603 | + $this->find_attachments($id); |
|
604 | 604 | |
605 | 605 | //Set the team member if it is there |
606 | - if ( post_type_exists( 'team' ) && false !== $team_members && '' !== $team_members ) { |
|
607 | - $this->set_team_member( $id, $team_members ); |
|
606 | + if (post_type_exists('team') && false !== $team_members && '' !== $team_members) { |
|
607 | + $this->set_team_member($id, $team_members); |
|
608 | 608 | } |
609 | 609 | |
610 | - if ( class_exists( 'LSX_TO_Maps' ) ) { |
|
611 | - $this->set_map_data( $data, $id, 9 ); |
|
610 | + if (class_exists('LSX_TO_Maps')) { |
|
611 | + $this->set_map_data($data, $id, 9); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | //Set the Room Data |
615 | - if ( false !== $importable_content && in_array( 'videos', $importable_content ) ) { |
|
616 | - $this->set_video_data( $data, $id ); |
|
615 | + if (false !== $importable_content && in_array('videos', $importable_content)) { |
|
616 | + $this->set_video_data($data, $id); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | //Set the Electricity |
620 | - if ( false !== $importable_content && in_array( 'electricity', $importable_content ) ) { |
|
621 | - $this->set_travel_info( $data, $id, 'electricity', $importable_content ); |
|
620 | + if (false !== $importable_content && in_array('electricity', $importable_content)) { |
|
621 | + $this->set_travel_info($data, $id, 'electricity', $importable_content); |
|
622 | 622 | } |
623 | 623 | //Set the cuisine |
624 | - if ( false !== $importable_content && in_array( 'cuisine', $importable_content ) ) { |
|
625 | - $this->set_travel_info( $data, $id, 'cuisine', $importable_content ); |
|
624 | + if (false !== $importable_content && in_array('cuisine', $importable_content)) { |
|
625 | + $this->set_travel_info($data, $id, 'cuisine', $importable_content); |
|
626 | 626 | } |
627 | 627 | //Set the banking |
628 | - if ( false !== $importable_content && in_array( 'banking', $importable_content ) ) { |
|
629 | - $this->set_travel_info( $data, $id, 'banking', $importable_content ); |
|
628 | + if (false !== $importable_content && in_array('banking', $importable_content)) { |
|
629 | + $this->set_travel_info($data, $id, 'banking', $importable_content); |
|
630 | 630 | } |
631 | 631 | //Set the transport |
632 | - if ( false !== $importable_content && in_array( 'transport', $importable_content ) ) { |
|
633 | - $this->set_travel_info( $data, $id, 'transport', $importable_content ); |
|
632 | + if (false !== $importable_content && in_array('transport', $importable_content)) { |
|
633 | + $this->set_travel_info($data, $id, 'transport', $importable_content); |
|
634 | 634 | } |
635 | 635 | //Set the dress |
636 | - if ( false !== $importable_content && in_array( 'dress', $importable_content ) ) { |
|
637 | - $this->set_travel_info( $data, $id, 'dress', $importable_content ); |
|
636 | + if (false !== $importable_content && in_array('dress', $importable_content)) { |
|
637 | + $this->set_travel_info($data, $id, 'dress', $importable_content); |
|
638 | 638 | } |
639 | 639 | //Set the climate |
640 | - if ( false !== $importable_content && in_array( 'climate', $importable_content ) ) { |
|
641 | - $this->set_travel_info( $data, $id, 'climate', $importable_content ); |
|
640 | + if (false !== $importable_content && in_array('climate', $importable_content)) { |
|
641 | + $this->set_travel_info($data, $id, 'climate', $importable_content); |
|
642 | 642 | } |
643 | 643 | //Set the Health |
644 | - if ( false !== $importable_content && in_array( 'health', $importable_content ) ) { |
|
645 | - $this->set_travel_info( $data, $id, 'health', $importable_content ); |
|
644 | + if (false !== $importable_content && in_array('health', $importable_content)) { |
|
645 | + $this->set_travel_info($data, $id, 'health', $importable_content); |
|
646 | 646 | } |
647 | 647 | //Set the Safety |
648 | - if ( false !== $importable_content && in_array( 'safety', $importable_content ) ) { |
|
649 | - $this->set_travel_info( $data, $id, 'safety', $importable_content ); |
|
648 | + if (false !== $importable_content && in_array('safety', $importable_content)) { |
|
649 | + $this->set_travel_info($data, $id, 'safety', $importable_content); |
|
650 | 650 | } |
651 | 651 | //Set the Visa |
652 | - if ( false !== $importable_content && in_array( 'visa', $importable_content ) ) { |
|
653 | - $this->set_travel_info( $data, $id, 'visa', $importable_content ); |
|
652 | + if (false !== $importable_content && in_array('visa', $importable_content)) { |
|
653 | + $this->set_travel_info($data, $id, 'visa', $importable_content); |
|
654 | 654 | } |
655 | 655 | //Set the General |
656 | - if ( false !== $importable_content && in_array( 'additional_info', $importable_content ) ) { |
|
657 | - $this->set_travel_info( $data, $id, 'additional_info', $importable_content ); |
|
656 | + if (false !== $importable_content && in_array('additional_info', $importable_content)) { |
|
657 | + $this->set_travel_info($data, $id, 'additional_info', $importable_content); |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | //Setup some default for use in the import |
661 | - if ( false !== $importable_content && (in_array( 'gallery', $importable_content ) || in_array( 'banner_image', $importable_content ) || in_array( 'featured_image', $importable_content )) ) { |
|
662 | - $this->find_attachments( $id ); |
|
661 | + if (false !== $importable_content && (in_array('gallery', $importable_content) || in_array('banner_image', $importable_content) || in_array('featured_image', $importable_content))) { |
|
662 | + $this->find_attachments($id); |
|
663 | 663 | |
664 | 664 | //Set the featured image |
665 | - if ( false !== $importable_content && in_array( 'featured_image', $importable_content ) ) { |
|
666 | - $this->set_featured_image( $data, $id ); |
|
665 | + if (false !== $importable_content && in_array('featured_image', $importable_content)) { |
|
666 | + $this->set_featured_image($data, $id); |
|
667 | 667 | } |
668 | - if ( false !== $importable_content && in_array( 'banner_image', $importable_content ) ) { |
|
669 | - $this->set_banner_image( $data, $id, $importable_content ); |
|
668 | + if (false !== $importable_content && in_array('banner_image', $importable_content)) { |
|
669 | + $this->set_banner_image($data, $id, $importable_content); |
|
670 | 670 | } |
671 | 671 | //Import the main gallery |
672 | - if ( false !== $importable_content && in_array( 'gallery', $importable_content ) ) { |
|
673 | - $this->create_main_gallery( $data, $id ); |
|
672 | + if (false !== $importable_content && in_array('gallery', $importable_content)) { |
|
673 | + $this->create_main_gallery($data, $id); |
|
674 | 674 | } |
675 | 675 | } |
676 | 676 | |
677 | 677 | //Set the continent |
678 | - if ( false !== $importable_content && in_array( 'continent', $importable_content ) ) { |
|
679 | - $this->set_continent( $data, $id ); |
|
678 | + if (false !== $importable_content && in_array('continent', $importable_content)) { |
|
679 | + $this->set_continent($data, $id); |
|
680 | 680 | } |
681 | 681 | } |
682 | 682 | |
@@ -686,49 +686,49 @@ discard block |
||
686 | 686 | /** |
687 | 687 | * Set the team memberon each item. |
688 | 688 | */ |
689 | - public function set_team_member( $id, $team_members ) { |
|
690 | - delete_post_meta( $id, 'team_to_' . $this->tab_slug ); |
|
689 | + public function set_team_member($id, $team_members) { |
|
690 | + delete_post_meta($id, 'team_to_'.$this->tab_slug); |
|
691 | 691 | |
692 | - foreach ( $team_members as $team ) { |
|
693 | - add_post_meta( $id, 'team_to_' . $this->tab_slug, $team ); |
|
692 | + foreach ($team_members as $team) { |
|
693 | + add_post_meta($id, 'team_to_'.$this->tab_slug, $team); |
|
694 | 694 | } |
695 | 695 | } |
696 | 696 | |
697 | 697 | /** |
698 | 698 | * Saves the room data |
699 | 699 | */ |
700 | - public function set_travel_info( $data, $id, $meta_key, $importable = array( 'none' ) ) { |
|
701 | - if ( ! empty( $data[0]['travel_information'] ) && isset( $data[0]['travel_information'][ $meta_key ] ) ) { |
|
702 | - $content = $data[0]['travel_information'][ $meta_key ]; |
|
700 | + public function set_travel_info($data, $id, $meta_key, $importable = array('none')) { |
|
701 | + if (!empty($data[0]['travel_information']) && isset($data[0]['travel_information'][$meta_key])) { |
|
702 | + $content = $data[0]['travel_information'][$meta_key]; |
|
703 | 703 | |
704 | - if ( in_array( 'strip_tags', $importable ) ) { |
|
705 | - $content = strip_tags( $content ); |
|
704 | + if (in_array('strip_tags', $importable)) { |
|
705 | + $content = strip_tags($content); |
|
706 | 706 | } |
707 | 707 | |
708 | - $this->save_custom_field( $content, $meta_key, $id ); |
|
708 | + $this->save_custom_field($content, $meta_key, $id); |
|
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
712 | 712 | /** |
713 | 713 | * Set the Travel Style |
714 | 714 | */ |
715 | - public function set_continent( $data, $id ) { |
|
715 | + public function set_continent($data, $id) { |
|
716 | 716 | |
717 | - if ( isset( $data[0]['position']['country'] ) && $data[0]['map_object_id'] === $data[0]['position']['country_content_entity_id'] ) { |
|
717 | + if (isset($data[0]['position']['country']) && $data[0]['map_object_id'] === $data[0]['position']['country_content_entity_id']) { |
|
718 | 718 | //get the continent code. |
719 | - $continent_code = to_continent_label( to_continent_code( to_country_data( $data[0]['position']['country'], false ) ) ); |
|
719 | + $continent_code = to_continent_label(to_continent_code(to_country_data($data[0]['position']['country'], false))); |
|
720 | 720 | |
721 | - if ( '' !== $continent_code ) { |
|
721 | + if ('' !== $continent_code) { |
|
722 | 722 | // @codingStandardsIgnoreLine |
723 | - if ( ! $term = term_exists( trim( $continent_code ), 'continent' ) ) { |
|
724 | - $term = wp_insert_term( trim( $continent_code ), 'continent' ); |
|
723 | + if (!$term = term_exists(trim($continent_code), 'continent')) { |
|
724 | + $term = wp_insert_term(trim($continent_code), 'continent'); |
|
725 | 725 | |
726 | - if ( is_wp_error( $term ) ) { |
|
726 | + if (is_wp_error($term)) { |
|
727 | 727 | // @codingStandardsIgnoreLine |
728 | 728 | echo $term->get_error_message(); |
729 | 729 | } |
730 | - } else { |
|
731 | - wp_set_object_terms( $id, sanitize_title( $continent_code ), 'continent', true ); |
|
730 | + }else { |
|
731 | + wp_set_object_terms($id, sanitize_title($continent_code), 'continent', true); |
|
732 | 732 | } |
733 | 733 | } |
734 | 734 | } |
@@ -738,11 +738,11 @@ discard block |
||
738 | 738 | * search_form |
739 | 739 | */ |
740 | 740 | public function update_options_form() { |
741 | - echo '<div style="display:none;" class="wetu-status"><h3>' . esc_html__( 'Wetu Status', 'wetu-importer' ) . '</h3>'; |
|
741 | + echo '<div style="display:none;" class="wetu-status"><h3>'.esc_html__('Wetu Status', 'wetu-importer').'</h3>'; |
|
742 | 742 | |
743 | - $accommodation = get_transient( 'lsx_ti_accommodation' ); |
|
743 | + $accommodation = get_transient('lsx_ti_accommodation'); |
|
744 | 744 | |
745 | - if ( '' === $accommodation || false === $accommodation || isset( $_GET['refresh_accommodation'] ) ) { |
|
745 | + if ('' === $accommodation || false === $accommodation || isset($_GET['refresh_accommodation'])) { |
|
746 | 746 | $this->update_options(); |
747 | 747 | } |
748 | 748 | |
@@ -753,14 +753,14 @@ discard block |
||
753 | 753 | * Save the list of Accommodation into an option |
754 | 754 | */ |
755 | 755 | public function update_options() { |
756 | - $data = file_get_contents( $this->url . '/List?' . $this->url_qs ); |
|
756 | + $data = file_get_contents($this->url.'/List?'.$this->url_qs); |
|
757 | 757 | |
758 | - $accommodation = json_decode( $data, true ); |
|
758 | + $accommodation = json_decode($data, true); |
|
759 | 759 | |
760 | - if ( isset( $accommodation['error'] ) ) { |
|
760 | + if (isset($accommodation['error'])) { |
|
761 | 761 | return $accommodation['error']; |
762 | - } elseif ( isset( $accommodation ) && ! empty( $accommodation ) ) { |
|
763 | - set_transient( 'lsx_ti_accommodation',$accommodation,60 * 60 * 2 ); |
|
762 | + } elseif (isset($accommodation) && !empty($accommodation)) { |
|
763 | + set_transient('lsx_ti_accommodation', $accommodation, 60 * 60 * 2); |
|
764 | 764 | return true; |
765 | 765 | } |
766 | 766 | } |