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