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