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