Passed
Push — master ( 8825a2...f816c4 )
by Warwick
02:22
created
settings/wetu.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <div class="uix-field-wrapper">
2 2
     <ul class="ui-tab-nav">
3
-        <li><a href="#ui-general" class="active"><?php esc_html_e( 'General','tour-operator' ); ?></a></li>
4
-		<li><a href="#ui-image-scaling"><?php esc_html_e( 'Image Settings','tour-operator' ); ?></a></li>
3
+        <li><a href="#ui-general" class="active"><?php esc_html_e('General', 'tour-operator'); ?></a></li>
4
+		<li><a href="#ui-image-scaling"><?php esc_html_e('Image Settings', 'tour-operator'); ?></a></li>
5 5
 	</ul>
6 6
 
7 7
 	<div id="ui-general" class="ui-tab active">
Please login to merge, or discard this patch.
classes/class-wetu-importer-settings.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,26 +17,26 @@  discard block
 block discarded – undo
17 17
 	 * @access private
18 18
 	 */
19 19
 	public function __construct() {
20
-		$temp_options = get_option( '_lsx-to_settings', false );
20
+		$temp_options = get_option('_lsx-to_settings', false);
21 21
 
22
-		if ( false !== $temp_options && isset( $temp_options[ $this->plugin_slug ] ) && ! empty( $temp_options[ $this->plugin_slug ] ) ) {
23
-			$this->options = $temp_options[ $this->plugin_slug ];
22
+		if (false !== $temp_options && isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug])) {
23
+			$this->options = $temp_options[$this->plugin_slug];
24 24
 			$this->set_variables();
25 25
 		}
26 26
 
27
-		add_filter( 'lsx_to_framework_settings_tabs', array( $this, 'settings_page_array' ) );
28
-		add_action( 'lsx_to_framework_api_tab_content',array( $this, 'api_settings' ),10,1 );
27
+		add_filter('lsx_to_framework_settings_tabs', array($this, 'settings_page_array'));
28
+		add_action('lsx_to_framework_api_tab_content', array($this, 'api_settings'), 10, 1);
29 29
 	}
30 30
 
31 31
 	/**
32 32
 	 * Returns the array of settings to the UIX Class in the lsx framework
33 33
 	 */
34
-	public function settings_page_array( $tabs ) {
35
-		$tabs[ $this->plugin_slug ] = array(
34
+	public function settings_page_array($tabs) {
35
+		$tabs[$this->plugin_slug] = array(
36 36
 			'page_title'        => '',
37 37
 			'page_description'  => '',
38
-			'menu_title'        => __( 'Importer', 'wetu-importer' ),
39
-			'template'          => WETU_IMPORTER_PATH . 'settings/wetu.php',
38
+			'menu_title'        => __('Importer', 'wetu-importer'),
39
+			'template'          => WETU_IMPORTER_PATH.'settings/wetu.php',
40 40
 			'default'	 		=> false,
41 41
 		);
42 42
 
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * Adds the API key to the API Tab
48 48
 	 */
49
-	public function api_settings( $tab = 'general' ) {
50
-		if ( 'settings' === $tab ) { ?>
49
+	public function api_settings($tab = 'general') {
50
+		if ('settings' === $tab) { ?>
51 51
 			<tr class="form-field-wrap">
52 52
 				<th class="tour-operator_table_heading" style="padding-bottom:0px;" scope="row" colspan="2">
53
-					<h4 style="margin-bottom:0px;"><span><?php esc_html_e( 'WETU API', 'wetu-importer' ); ?></span></h4>
53
+					<h4 style="margin-bottom:0px;"><span><?php esc_html_e('WETU API', 'wetu-importer'); ?></span></h4>
54 54
 				</th>
55 55
 			</tr>
56 56
 			<tr class="form-field">
57 57
 				<th scope="row">
58
-					<i class="dashicons-before dashicons-admin-network"></i> <label for="wetu_api_key"> <?php esc_html_e( 'Key', 'wetu-importer' ); ?></label>
58
+					<i class="dashicons-before dashicons-admin-network"></i> <label for="wetu_api_key"> <?php esc_html_e('Key', 'wetu-importer'); ?></label>
59 59
 				</th>
60 60
 				<td>
61 61
 					<input type="text" {{#if wetu_api_key}} value="{{wetu_api_key}}" {{/if}} name="wetu_api_key" />
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			</tr>
64 64
 			<tr class="form-field">
65 65
 				<th scope="row">
66
-					<i class="dashicons-before dashicons-admin-users"></i> <label for="wetu_api_username"> <?php esc_html_e( 'Username', 'wetu-importer' ); ?></label>
66
+					<i class="dashicons-before dashicons-admin-users"></i> <label for="wetu_api_username"> <?php esc_html_e('Username', 'wetu-importer'); ?></label>
67 67
 				</th>
68 68
 				<td>
69 69
 					<input type="text" {{#if wetu_api_username}} value="{{wetu_api_username}}" {{/if}} name="wetu_api_username" />
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			</tr>
72 72
 			<tr class="form-field">
73 73
 				<th scope="row">
74
-					<i class="dashicons-before dashicons-lock"></i> <label for="wetu_api_password"> <?php esc_html_e( 'Password', 'wetu-importer' ); ?></label>
74
+					<i class="dashicons-before dashicons-lock"></i> <label for="wetu_api_password"> <?php esc_html_e('Password', 'wetu-importer'); ?></label>
75 75
 				</th>
76 76
 				<td>
77 77
 					<input type="text" {{#if wetu_api_password}} value="{{wetu_api_password}}" {{/if}} name="wetu_api_password" />
Please login to merge, or discard this patch.
classes/class-wetu-importer-banner-integration.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @access private
27 27
 	 */
28 28
 	public function __construct() {
29
-		add_action( 'wp_ajax_lsx_import_sync_banners',array( $this, 'sync_new_banner' ) );
30
-		add_action( 'wp_ajax_nopriv_lsx_import_sync_banners',array( $this, 'sync_new_banner' ) );
29
+		add_action('wp_ajax_lsx_import_sync_banners', array($this, 'sync_new_banner'));
30
+		add_action('wp_ajax_nopriv_lsx_import_sync_banners', array($this, 'sync_new_banner'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	public function display_page() {
37 37
 		?>
38 38
 		<div class="wrap">
39
-			<h2><?php esc_html_e( 'Download new banners straight from WETU','wetu-importer' ); ?></h2>
39
+			<h2><?php esc_html_e('Download new banners straight from WETU', 'wetu-importer'); ?></h2>
40 40
 
41 41
 			<form method="get" action="" id="banners-filter">
42
-				<input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr( $this->tab_slug ); ?>" />
42
+				<input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr($this->tab_slug); ?>" />
43 43
 
44 44
 			   <div class="ajax-loader-small" style="display:none;width:100%;text-align:center;">
45
-					<img style="width:32px;" src="<?php echo esc_url( WETU_IMPORTER_URL . 'assets/images/ajaxloader.gif' ); ?>" />
45
+					<img style="width:32px;" src="<?php echo esc_url(WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'); ?>" />
46 46
 				</div>
47 47
 
48 48
 				<table class="wp-list-table widefat fixed posts">
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 					<?php
61 61
 						$accommodation_args = array(
62 62
 							'post_type' => 'accommodation',
63
-							'post_status' => array( 'publish','pending','draft','future','private' ),
63
+							'post_status' => array('publish', 'pending', 'draft', 'future', 'private'),
64 64
 							'nopagin' => 'true',
65 65
 							'posts_per_page' => '1000',
66 66
 							'meta_query' => array(
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 								),
81 81
 							),
82 82
 						);
83
-						$accommodation = new WP_Query( $accommodation_args );
83
+						$accommodation = new WP_Query($accommodation_args);
84 84
 					?>
85 85
 
86 86
 					<tbody id="the-list">
87 87
 						<?php
88
-							if ( $accommodation->have_posts() ) {
89
-								while ( $accommodation->have_posts() ) {
88
+							if ($accommodation->have_posts()) {
89
+								while ($accommodation->have_posts()) {
90 90
 									$accommodation->the_post();
91 91
 									?>
92 92
 									<tr class="post-<?php the_ID(); ?> type-tour status-none" id="post-<?php the_ID(); ?>">
@@ -95,26 +95,26 @@  discard block
 block discarded – undo
95 95
 									$min_width = '1920';
96 96
 									$min_height = '500';
97 97
 
98
-									$img_group = get_post_meta( get_the_ID(),'image_group',true );
98
+									$img_group = get_post_meta(get_the_ID(), 'image_group', true);
99 99
 
100 100
 									$thumbnails_html = false;
101 101
 
102
-									if ( false !== $img_group ) {
103
-										foreach ( $img_group['banner_image'] as $banner_image ) {
104
-											$large = wp_get_attachment_image_src( $banner_image,'full' );
102
+									if (false !== $img_group) {
103
+										foreach ($img_group['banner_image'] as $banner_image) {
104
+											$large = wp_get_attachment_image_src($banner_image, 'full');
105 105
 											$real_width = $large[1];
106 106
 											$real_height = $large[2];
107 107
 
108 108
 											$status = 'optimized';
109
-											if ( $real_width < intval( $real_width ) ) {
109
+											if ($real_width < intval($real_width)) {
110 110
 												$status = 'width not enough.';
111 111
 												}
112 112
 
113
-											$thumbnail = wp_get_attachment_image_src( $banner_image,'thumbnail' );
113
+											$thumbnail = wp_get_attachment_image_src($banner_image, 'thumbnail');
114 114
 											$thumbnails_html[] = '
115 115
 													<div style="display:block;float:left;">
116
-														<img src="' . $thumbnail[0] . '" />
117
-														<p style="text-align:center;">' . $real_width . 'px by ' . $real_height . 'px</p>
116
+														<img src="' . $thumbnail[0].'" />
117
+														<p style="text-align:center;">' . $real_width.'px by '.$real_height.'px</p>
118 118
 													</div>';
119 119
 											}
120 120
 										}
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
 										<input type="checkbox" data-identifier="<?php the_ID(); ?>" value="<?php the_ID(); ?>" name="post[]" id="cb-select-<?php the_ID(); ?>">
125 125
 										</th>
126 126
 
127
-										<td class="post-title page-title column-title"><?php echo '<a href="' . esc_url( admin_url( '/post.php?post=' . get_the_ID() . '&action=edit' ) ) . '" target="_blank">';
127
+										<td class="post-title page-title column-title"><?php echo '<a href="'.esc_url(admin_url('/post.php?post='.get_the_ID().'&action=edit')).'" target="_blank">';
128 128
 										the_title();
129 129
 										echo '</a>'; ?></td>
130 130
 
131 131
 										<td colspan="2" class="thumbnails column-thumbnails">
132 132
 										<?php
133
-											if ( false !== $thumbnails_html ) {
133
+											if (false !== $thumbnails_html) {
134 134
 												// @codingStandardsIgnoreLine
135
-												echo implode( '', $thumbnails_html );
136
-											} else {
135
+												echo implode('', $thumbnails_html);
136
+											}else {
137 137
 												echo '<p>There was an error retrieving your images.</p>';
138 138
 											}
139 139
 										?>
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
 				</table>
159 159
 
160
-				<p><input class="button button-primary download" type="button" value="<?php esc_html_e( 'Download new Banners','wetu-importer' ); ?>" />
160
+				<p><input class="button button-primary download" type="button" value="<?php esc_html_e('Download new Banners', 'wetu-importer'); ?>" />
161 161
 				</p>
162 162
 			</form>
163 163
 		</div>
@@ -169,33 +169,33 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public function sync_new_banner() {
171 171
 		// @codingStandardsIgnoreLine
172
-		if ( isset( $_POST['action'] ) && 'lsx_import_sync_banners' === $_POST['action'] && isset( $_POST['post_id'] ) ) {
172
+		if (isset($_POST['action']) && 'lsx_import_sync_banners' === $_POST['action'] && isset($_POST['post_id'])) {
173 173
 			// @codingStandardsIgnoreLine
174
-			$banners = get_post_meta( $_POST['post_id'],'image_group',true );
174
+			$banners = get_post_meta($_POST['post_id'], 'image_group', true);
175 175
 			// @codingStandardsIgnoreLine
176
-			$this->wetu_id = get_post_meta( $_POST['post_id'],'lsx_wetu_id',true );
176
+			$this->wetu_id = get_post_meta($_POST['post_id'], 'lsx_wetu_id', true);
177 177
 
178 178
 			$new_banner_array = false;
179 179
 			$array_index = 0;
180 180
 
181
-			foreach ( $banners['banner_image'] as $banner_image ) {
182
-				$image_id = $this->attach_external_image2( $this->format_wetu_url( $banner_image ) );
183
-				if ( null !== $image_id && '' !== $image_id ) {
184
-					$new_banner_array['banner_image'][ 'cmb-field-' . $array_index ] = $image_id;
181
+			foreach ($banners['banner_image'] as $banner_image) {
182
+				$image_id = $this->attach_external_image2($this->format_wetu_url($banner_image));
183
+				if (null !== $image_id && '' !== $image_id) {
184
+					$new_banner_array['banner_image']['cmb-field-'.$array_index] = $image_id;
185 185
 					$array_index++;
186 186
 				}
187 187
 			}
188 188
 
189
-			if ( false !== $new_banner_array ) {
189
+			if (false !== $new_banner_array) {
190 190
 				// @codingStandardsIgnoreLine
191
-				delete_post_meta( $_POST['post_id'],'image_group' );
191
+				delete_post_meta($_POST['post_id'], 'image_group');
192 192
 				// @codingStandardsIgnoreLine
193
-				add_post_meta( $_POST['post_id'],'image_group',$new_banner_array,true );
193
+				add_post_meta($_POST['post_id'], 'image_group', $new_banner_array, true);
194 194
 				echo true;
195
-			} else {
195
+			}else {
196 196
 				echo false;
197 197
 			}
198
-		} else {
198
+		}else {
199 199
 			echo false;
200 200
 		}
201 201
 
@@ -205,71 +205,71 @@  discard block
 block discarded – undo
205 205
 	/**
206 206
 	 * formats the url
207 207
 	 */
208
-	public function format_wetu_url( $post_id ) {
209
-		return 'https://wetu.com/ImageHandler/c1920x800/' . $this->wetu_id . '/' . $this->format_filename( $post_id );
208
+	public function format_wetu_url($post_id) {
209
+		return 'https://wetu.com/ImageHandler/c1920x800/'.$this->wetu_id.'/'.$this->format_filename($post_id);
210 210
 	}
211 211
 
212 212
 	/**
213 213
 	 * formats the filename
214 214
 	 */
215
-	public function format_filename( $post_id ) {
216
-		$base = str_replace( '_',' ',get_the_title( $post_id ) );
217
-		$base = rawurlencode( $base );
218
-		$type = get_post_mime_type( $post_id );
215
+	public function format_filename($post_id) {
216
+		$base = str_replace('_', ' ', get_the_title($post_id));
217
+		$base = rawurlencode($base);
218
+		$type = get_post_mime_type($post_id);
219 219
 
220
-		switch ( $type ) {
220
+		switch ($type) {
221 221
 			case 'image/jpeg':
222
-				return $base . '.jpg';
222
+				return $base.'.jpg';
223 223
 			break;
224 224
 			case 'image/png':
225
-				return $base . '.png';
225
+				return $base.'.png';
226 226
 			break;
227 227
 			case 'image/gif':
228
-				return $base . '.gif';
228
+				return $base.'.gif';
229 229
 			break;
230 230
 			default:
231 231
 				return false;
232 232
 		}
233 233
 	}
234 234
 
235
-	public function attach_external_image2( $url = null, $post_data = array() ) {
236
-		if ( ! $url ) { return new WP_Error( 'missing', 'Need a valid URL' ); }
235
+	public function attach_external_image2($url = null, $post_data = array()) {
236
+		if (!$url) { return new WP_Error('missing', 'Need a valid URL'); }
237 237
 
238
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
239
-		require_once( ABSPATH . 'wp-admin/includes/media.php' );
240
-		require_once( ABSPATH . 'wp-admin/includes/image.php' );
238
+		require_once(ABSPATH.'wp-admin/includes/file.php');
239
+		require_once(ABSPATH.'wp-admin/includes/media.php');
240
+		require_once(ABSPATH.'wp-admin/includes/image.php');
241 241
 
242 242
 		//var_dump($tmp);
243
-		$tmp = tempnam( '/tmp', 'FOO' );
244
-		print_r( $url );
245
-		$image = file_get_contents( $url );
246
-		print_r( $image );
247
-		file_put_contents( $tmp, $image );
248
-		chmod( $tmp,'777' );
249
-
250
-		preg_match( '/[^\?]+\.(tif|TIFF|jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG|pdf|PDF|bmp|BMP)/', $url, $matches );    // fix file filename for query strings
251
-		$url_filename = basename( $matches[0] );
252
-		$url_filename = str_replace( '%20','_',$url_filename );
243
+		$tmp = tempnam('/tmp', 'FOO');
244
+		print_r($url);
245
+		$image = file_get_contents($url);
246
+		print_r($image);
247
+		file_put_contents($tmp, $image);
248
+		chmod($tmp, '777');
249
+
250
+		preg_match('/[^\?]+\.(tif|TIFF|jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG|pdf|PDF|bmp|BMP)/', $url, $matches); // fix file filename for query strings
251
+		$url_filename = basename($matches[0]);
252
+		$url_filename = str_replace('%20', '_', $url_filename);
253 253
 		// extract filename from url for title
254
-		$url_type = wp_check_filetype( $url_filename );                                           // determine file type (ext and mime/type)
254
+		$url_type = wp_check_filetype($url_filename); // determine file type (ext and mime/type)
255 255
 
256 256
 		// assemble file data (should be built like $_FILES since wp_handle_sideload() will be using)
257
-		$file_array['tmp_name'] = $tmp;                                                         // full server path to temp file
257
+		$file_array['tmp_name'] = $tmp; // full server path to temp file
258 258
 
259
-		if ( ! empty( $filename ) && ' ' != $filename ) {
260
-			$file_array['name'] = $filename . '.' . $url_type['ext'];                           // user given filename for title, add original URL extension
261
-		} else {
262
-			$file_array['name'] = $url_filename;                                                // just use original URL filename
259
+		if (!empty($filename) && ' ' != $filename) {
260
+			$file_array['name'] = $filename.'.'.$url_type['ext']; // user given filename for title, add original URL extension
261
+		}else {
262
+			$file_array['name'] = $url_filename; // just use original URL filename
263 263
 		}
264 264
 
265 265
 		// set additional wp_posts columns
266
-		if ( empty( $post_data['post_title'] ) ) {
267
-			$url_filename = str_replace( '%20',' ',$url_filename );
268
-			$post_data['post_title'] = basename( $url_filename, '.' . $url_type['ext'] );         // just use the original filename (no extension)
266
+		if (empty($post_data['post_title'])) {
267
+			$url_filename = str_replace('%20', ' ', $url_filename);
268
+			$post_data['post_title'] = basename($url_filename, '.'.$url_type['ext']); // just use the original filename (no extension)
269 269
 		}
270 270
 
271 271
 		// make sure gets tied to parent
272
-		if ( empty( $post_data['post_parent'] ) ) {
272
+		if (empty($post_data['post_parent'])) {
273 273
 			// @codingStandardsIgnoreLine
274 274
 			$post_data['post_parent'] = $_POST['post_id'];
275 275
 		}
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 
279 279
 		// do the validation and storage stuff
280 280
 		// @codingStandardsIgnoreLine
281
-		$att_id = media_handle_sideload( $file_array, $_POST['post_id'], null, $post_data );             // $post_data can override the items saved to wp_posts table, like post_mime_type, guid, post_parent, post_title, post_content, post_status
281
+		$att_id = media_handle_sideload($file_array, $_POST['post_id'], null, $post_data); // $post_data can override the items saved to wp_posts table, like post_mime_type, guid, post_parent, post_title, post_content, post_status
282 282
 
283 283
 		// If error storing permanently, unlink
284
-		if ( is_wp_error( $att_id ) ) {
285
-			unlink( $file_array['tmp_name'] );   // clean up
284
+		if (is_wp_error($att_id)) {
285
+			unlink($file_array['tmp_name']); // clean up
286 286
 			return false; // output wp_error
287 287
 			//return $att_id; // output wp_error
288 288
 		}
Please login to merge, or discard this patch.
classes/class-wetu-importer-connect-accommodation.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
 	 * @access private
36 36
 	 */
37 37
 	public function __construct() {
38
-		$temp_options = get_option( '_lsx-to_settings',false );
38
+		$temp_options = get_option('_lsx-to_settings', false);
39 39
 
40
-		if ( false !== $temp_options && isset( $temp_options[ $this->plugin_slug ] ) && ! empty( $temp_options[ $this->plugin_slug ] ) ) {
41
-			$this->options = $temp_options[ $this->plugin_slug ];
40
+		if (false !== $temp_options && isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug])) {
41
+			$this->options = $temp_options[$this->plugin_slug];
42 42
 		}
43 43
 
44
-		$this->url = 'http://wetu.com/API/Pins/' . $this->options['api_key'] . '/List';
44
+		$this->url = 'http://wetu.com/API/Pins/'.$this->options['api_key'].'/List';
45 45
 
46
-		add_action( 'lsx_tour_importer_admin_tab_' . $this->tab_slug, array( $this, 'display_page' ) );
47
-		add_action( 'wp_ajax_lsx_import_connect_accommodation',array( $this, 'process_connection' ) );
48
-		add_action( 'wp_ajax_nopriv_lsx_import_connect_accommodation',array( $this, 'process_connection' ) );
46
+		add_action('lsx_tour_importer_admin_tab_'.$this->tab_slug, array($this, 'display_page'));
47
+		add_action('wp_ajax_lsx_import_connect_accommodation', array($this, 'process_connection'));
48
+		add_action('wp_ajax_nopriv_lsx_import_connect_accommodation', array($this, 'process_connection'));
49 49
 	}
50 50
 
51 51
 	/**
@@ -55,45 +55,45 @@  discard block
 block discarded – undo
55 55
 		global $post;
56 56
 		?>
57 57
 		<div class="wrap">
58
-			<h3><span class="dashicons dashicons-admin-multisite"></span> <?php esc_html_e( 'Connect your Accommodation','wetu-importer' ); ?></h3>
58
+			<h3><span class="dashicons dashicons-admin-multisite"></span> <?php esc_html_e('Connect your Accommodation', 'wetu-importer'); ?></h3>
59 59
 
60 60
 			<form method="get" action="" id="connect-accommodation-filter">
61
-				<input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr( $this->tab_slug ); ?>" />
61
+				<input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr($this->tab_slug); ?>" />
62 62
 
63
-				<p><?php esc_html_e( 'Below is a list of your accommodation that does not contain a WETU ID, but its Title matches a name in the WETU DB. Connecting it will all you to pull through information from WETU.','wetu-importer' ); ?></p>
63
+				<p><?php esc_html_e('Below is a list of your accommodation that does not contain a WETU ID, but its Title matches a name in the WETU DB. Connecting it will all you to pull through information from WETU.', 'wetu-importer'); ?></p>
64 64
 
65 65
 				<div class="ajax-loader-small" style="display:none;width:100%;text-align:center;">
66
-					<img style="width:32px;" src="<?php echo esc_url( WETU_IMPORTER_URL . 'assets/images/ajaxloader.gif' ); ?>" />
66
+					<img style="width:32px;" src="<?php echo esc_url(WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'); ?>" />
67 67
 				</div>
68 68
 
69 69
 				<?php
70 70
 					$loose_accommodation = $this->find_current_accommodation();
71 71
 				?>
72
-				<p><input class="button button-primary connect" type="button" value="<?php esc_html_e( 'Connect','wetu-importer' ); ?>" /></p>
72
+				<p><input class="button button-primary connect" type="button" value="<?php esc_html_e('Connect', 'wetu-importer'); ?>" /></p>
73 73
 				<table class="wp-list-table widefat fixed posts">
74 74
 					<?php $this->table_header(); ?>
75 75
 
76 76
 					<tbody>
77
-						<?php if ( false !== $loose_accommodation ) {
77
+						<?php if (false !== $loose_accommodation) {
78 78
 
79 79
 							$loose_args = array(
80 80
 								'post_type' => 'accommodation',
81
-								'post_status' => array( 'publish','pending' ),
81
+								'post_status' => array('publish', 'pending'),
82 82
 								'nopagin' => true,
83 83
 								'post__in' => $loose_accommodation,
84 84
 							);
85
-							$loose_accommodation_query = new WP_Query( $loose_args );
86
-							$accommodation = get_transient( 'lsx_ti_accommodation' );
85
+							$loose_accommodation_query = new WP_Query($loose_args);
86
+							$accommodation = get_transient('lsx_ti_accommodation');
87 87
 							$identifier = '';
88 88
 
89
-							if ( $loose_accommodation_query->have_posts() && false !== $accommodation ) {
90
-								while ( $loose_accommodation_query->have_posts() ) {
89
+							if ($loose_accommodation_query->have_posts() && false !== $accommodation) {
90
+								while ($loose_accommodation_query->have_posts()) {
91 91
 									$loose_accommodation_query->the_post();
92 92
 
93
-									foreach ( $accommodation as $row_key => $row ) {
94
-										if ( stripos( ltrim( rtrim( $row->name ) ), $post->post_title ) !== false ) {
93
+									foreach ($accommodation as $row_key => $row) {
94
+										if (stripos(ltrim(rtrim($row->name)), $post->post_title) !== false) {
95 95
 											$identifier = $row->id;
96
-										} else {
96
+										}else {
97 97
 											continue;
98 98
 										}
99 99
 									}
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 									<tr class="post-<?php the_ID(); ?> type-accommodation status-none" id="post-<?php the_ID(); ?>">
102 102
 										<th class="check-column" scope="row">
103 103
 											<label for="cb-select-<?php the_ID(); ?>" class="screen-reader-text"><?php the_title(); ?></label>
104
-											<input type="checkbox" data-identifier="<?php echo esc_attr( $identifier ); ?>" value="<?php the_ID(); ?>" name="post[]" id="cb-select-<?php the_ID(); ?>">
104
+											<input type="checkbox" data-identifier="<?php echo esc_attr($identifier); ?>" value="<?php the_ID(); ?>" name="post[]" id="cb-select-<?php the_ID(); ?>">
105 105
 										</th>
106 106
 										<td class="post-title page-title column-title">
107
-											<strong><?php the_title(); ?></strong> - <a href="<?php echo esc_url( admin_url( '/post.php?post=' . $post->ID . '&action=edit' ) ); ?>" target="_blank"><?php echo esc_html( $post->post_status ); ?></a>
107
+											<strong><?php the_title(); ?></strong> - <a href="<?php echo esc_url(admin_url('/post.php?post='.$post->ID.'&action=edit')); ?>" target="_blank"><?php echo esc_html($post->post_status); ?></a>
108 108
 										</td>
109 109
 										<td class="excerpt column-excerpt">
110 110
 											<?php
111 111
 												// @codingStandardsIgnoreLine
112
-												echo strip_tags( get_the_excerpt() );
112
+												echo strip_tags(get_the_excerpt());
113 113
 											?>
114 114
 										</td>
115 115
 									</tr>
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 
123 123
 				</table>
124 124
 
125
-				<p><input class="button button-primary connect" type="button" value="<?php esc_html_e( 'Connect','wetu-importer' ); ?>" /></p>
125
+				<p><input class="button button-primary connect" type="button" value="<?php esc_html_e('Connect', 'wetu-importer'); ?>" /></p>
126 126
 
127 127
 			</form>
128 128
 
129 129
 			<div style="display:none;" class="completed-list-wrapper">
130
-				<h3><?php esc_html_e( 'Completed' ); ?></h3>
130
+				<h3><?php esc_html_e('Completed'); ?></h3>
131 131
 				<ul>
132 132
 				</ul>
133 133
 			</div>
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			FROM {$wpdb->posts}
184 184
 			WHERE post_type = 'accommodation'
185 185
 			LIMIT 0,500
186
-		",ARRAY_A);
186
+		", ARRAY_A);
187 187
 
188 188
 		$current_accommodation = $wpdb->get_results("
189 189
 			SELECT key1.post_id
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
 			AND key2.post_type = 'accommodation'
197 197
 
198 198
 			LIMIT 0,500
199
-		",ARRAY_A);
199
+		", ARRAY_A);
200 200
 
201
-		if ( null !== $all_accommodation && ! empty( $all_accommodation ) ) {
201
+		if (null !== $all_accommodation && !empty($all_accommodation)) {
202 202
 			//remove the extra accommodation
203
-			if ( null !== $current_accommodation && ! empty( $current_accommodation ) ) {
204
-				$all_accommodation = array_diff( $this->format_array( $all_accommodation,'ID' ), $this->format_array( $current_accommodation,'post_id' ) );
205
-			} elseif ( null !== $current_accommodation && empty( $current_accommodation ) ) {
206
-				$all_accommodation = $this->format_array( $current_accommodation,'post_id' );
203
+			if (null !== $current_accommodation && !empty($current_accommodation)) {
204
+				$all_accommodation = array_diff($this->format_array($all_accommodation, 'ID'), $this->format_array($current_accommodation, 'post_id'));
205
+			} elseif (null !== $current_accommodation && empty($current_accommodation)) {
206
+				$all_accommodation = $this->format_array($current_accommodation, 'post_id');
207 207
 			}
208 208
 
209 209
 			$return = $all_accommodation;
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 	/**
216 216
 	 * format the array
217 217
 	 */
218
-	public function format_array( $array, $key ) {
218
+	public function format_array($array, $key) {
219 219
 		$new_array = array();
220 220
 
221
-		foreach ( $array as $value ) {
222
-			$new_array[] = $value[ $key ];
221
+		foreach ($array as $value) {
222
+			$new_array[] = $value[$key];
223 223
 		}
224 224
 
225 225
 		return $new_array;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		$return = false;
233 233
 
234 234
 		// @codingStandardsIgnoreLine
235
-		if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_import_connect_accommodation' && isset( $_POST['type'] ) && $_POST['type'] === $this->tab_slug && isset( $_POST['post_id'] ) && isset( $_POST['wetu_id'] ) ) {
235
+		if (isset($_POST['action']) && $_POST['action'] === 'lsx_import_connect_accommodation' && isset($_POST['type']) && $_POST['type'] === $this->tab_slug && isset($_POST['post_id']) && isset($_POST['wetu_id'])) {
236 236
 			$post_id = false;
237 237
 			$matching_id = false;
238 238
 
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 			// @codingStandardsIgnoreLine
242 242
 			$matching_id = $_POST['wetu_id'];
243 243
 
244
-			add_post_meta( $post_id,'lsx_wetu_id',$matching_id );
245
-			$return = '<li class="post-' . $post_id . '"><span class="dashicons dashicons-yes"></span> <a target="_blank" href="' . get_permalink( $post_id ) . '">' . get_the_title( $post_id ) . '</a></li>';
244
+			add_post_meta($post_id, 'lsx_wetu_id', $matching_id);
245
+			$return = '<li class="post-'.$post_id.'"><span class="dashicons dashicons-yes"></span> <a target="_blank" href="'.get_permalink($post_id).'">'.get_the_title($post_id).'</a></li>';
246 246
 		}
247 247
 
248
-		print_r( $return );
248
+		print_r($return);
249 249
 		die();
250 250
 	}
251 251
 
Please login to merge, or discard this patch.
classes/class-lsx-api-manager.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -99,32 +99,32 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function __construct($api_array = array()) {
101 101
 
102
-		if(isset($api_array['api_key'])){
102
+		if (isset($api_array['api_key'])) {
103 103
 			$api_array['api_key'] = trim($api_array['api_key']);
104
-			if('dev-' === substr($api_array['api_key'], 0, 4)){
104
+			if ('dev-' === substr($api_array['api_key'], 0, 4)) {
105 105
 				$this->dev_mode = true;
106 106
 				$api_array['api_key'] = preg_replace('/^(dev-)(.*)$/i', '${2}', $api_array['api_key']);
107 107
 			}
108 108
 			$this->api_key = $api_array['api_key'];
109 109
 		}
110
-		if(isset($api_array['email'])){
110
+		if (isset($api_array['email'])) {
111 111
 			$this->email = trim($api_array['email']);
112 112
 		}
113
-		if(isset($api_array['product_id'])){
113
+		if (isset($api_array['product_id'])) {
114 114
 			$this->product_id = $api_array['product_id'];
115 115
 			$this->product_slug = sanitize_title($api_array['product_id']);
116 116
 		}
117
-		if(isset($api_array['version'])){
117
+		if (isset($api_array['version'])) {
118 118
 			$this->version = $api_array['version'];
119 119
 		}
120
-		if(isset($api_array['instance'])){
120
+		if (isset($api_array['instance'])) {
121 121
 			$this->password = $api_array['instance'];
122 122
 		}
123
-		if(isset($api_array['file'])){
123
+		if (isset($api_array['file'])) {
124 124
 			$this->file = $api_array['file'];
125 125
 		}
126 126
 
127
-		if(isset($api_array['documentation'])){
127
+		if (isset($api_array['documentation'])) {
128 128
 			$this->documentation = $api_array['documentation'];
129 129
 		}
130 130
 
@@ -132,32 +132,32 @@  discard block
 block discarded – undo
132 132
 			$this->api_url = 'https://dev.lsdev.biz/wc-api/product-key-api';
133 133
 			$this->products_api_url = 'https://dev.lsdev.biz/';
134 134
 			$this->license_check_url = 'https://dev.lsdev.biz/wc-api/license-status-check';
135
-		} else {
135
+		}else {
136 136
 			$this->api_url = 'https://www.lsdev.biz/wc-api/product-key-api';
137 137
 			$this->products_api_url = 'https://www.lsdev.biz/';
138 138
 			$this->license_check_url = 'https://www.lsdev.biz/wc-api/license-status-check';
139 139
 		}
140 140
 
141
-		add_filter( 'plugin_action_links_' . plugin_basename(str_replace('.php','',$this->file).'/'.$this->file), array($this,'add_action_links'));
142
-		$this->status = get_option($this->product_slug.'_status',false);
141
+		add_filter('plugin_action_links_'.plugin_basename(str_replace('.php', '', $this->file).'/'.$this->file), array($this, 'add_action_links'));
142
+		$this->status = get_option($this->product_slug.'_status', false);
143 143
 
144
-		if(isset($_GET['page']) && in_array($_GET['page'],apply_filters('lsx_api_manager_options_pages',array(false)))){
144
+		if (isset($_GET['page']) && in_array($_GET['page'], apply_filters('lsx_api_manager_options_pages', array(false)))) {
145 145
 
146 146
 			//Maybe activate the software, do this before the status checks.
147 147
 			$this->activate_deactivate();
148 148
 
149
-			if(false === $this->status){
149
+			if (false === $this->status) {
150 150
 				$this->status = $this->check_status();
151
-				update_option($this->product_slug.'_status',$this->status);
151
+				update_option($this->product_slug.'_status', $this->status);
152 152
 			}
153 153
 
154 154
 			$button_url = '<a data-product="'.$this->product_slug.'" style="margin-top:-5px;" href="';
155 155
 			$button_label = '';
156
-			$admin_url_base = function_exists( 'tour_operator' ) ? 'admin.php?page=lsx-to-settings' : 'themes.php?page=lsx-settings';
157
-			if(false === $this->status || 'inactive' === $this->status){
156
+			$admin_url_base = function_exists('tour_operator') ? 'admin.php?page=lsx-to-settings' : 'themes.php?page=lsx-settings';
157
+			if (false === $this->status || 'inactive' === $this->status) {
158 158
 				$button_url .= admin_url($admin_url_base.'&action=activate&product='.$this->product_slug);
159 159
 				$button_label = 'Activate';
160
-			}elseif('active' === $this->status){
160
+			}elseif ('active' === $this->status) {
161 161
 				$button_url .= admin_url($admin_url_base.'&action=deactivate&product='.$this->product_slug);
162 162
 				$button_label = 'Deactivate';
163 163
 			}
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 			$this->button = $button_url;
166 166
 		}
167 167
 
168
-		add_filter('site_transient_update_plugins', array($this,'injectUpdate'));
169
-		add_action( "in_plugin_update_message-".$this->file,array($this,'plugin_update_message'),10,2);
168
+		add_filter('site_transient_update_plugins', array($this, 'injectUpdate'));
169
+		add_action("in_plugin_update_message-".$this->file, array($this, 'plugin_update_message'), 10, 2);
170 170
 
171
-		if ( function_exists( 'tour_operator' ) ) {
172
-			add_action( 'lsx_to_framework_api_tab_content', array( $this, 'dashboard_tabs' ), 1, 1 );
173
-		} else {
174
-			add_action( 'lsx_framework_api_tab_content', array( $this, 'dashboard_tabs' ), 1, 1 );
171
+		if (function_exists('tour_operator')) {
172
+			add_action('lsx_to_framework_api_tab_content', array($this, 'dashboard_tabs'), 1, 1);
173
+		}else {
174
+			add_action('lsx_framework_api_tab_content', array($this, 'dashboard_tabs'), 1, 1);
175 175
 		}
176 176
 
177
-		add_action('wp_ajax_wc_api_'.$this->product_slug,array($this,'activate_deactivate'));
178
-		add_action('wp_ajax_nopriv_wc_api_'.$this->product_slug,array($this,'activate_deactivate'));
177
+		add_action('wp_ajax_wc_api_'.$this->product_slug, array($this, 'activate_deactivate'));
178
+		add_action('wp_ajax_nopriv_wc_api_'.$this->product_slug, array($this, 'activate_deactivate'));
179 179
 	}
180 180
 
181 181
 	/**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public static function get_instance() {
189 189
 		// If the single instance hasn't been set, set it now.
190
-		if ( null == self::$instance ) {
190
+		if (null == self::$instance) {
191 191
 			self::$instance = new self;
192 192
 		}
193 193
 		return self::$instance;
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return    object A single instance of this class.
202 202
 	 */
203
-	public function dashboard_tabs($tab='general') {
204
-		if('api' !== $tab){ return false;}
203
+	public function dashboard_tabs($tab = 'general') {
204
+		if ('api' !== $tab) { return false; }
205 205
 
206
-		if('active' === $this->status){
207
-			$description = __( '<span style="color:#008000;">Your license is now active</span>', $this->product_slug );
208
-		}else{
209
-			$description = __( 'You can find your key on your <a target="_blank" href="https://www.lsdev.biz/my-account/">My Account</a> page.', $this->product_slug );
206
+		if ('active' === $this->status) {
207
+			$description = __('<span style="color:#008000;">Your license is now active</span>', $this->product_slug);
208
+		}else {
209
+			$description = __('You can find your key on your <a target="_blank" href="https://www.lsdev.biz/my-account/">My Account</a> page.', $this->product_slug);
210 210
 		}
211 211
 
212 212
 		?>
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
 				<?php
217 217
 				$colour = 'red';
218
-				if('active' === $this->status){
218
+				if ('active' === $this->status) {
219 219
 					$colour = 'green';
220 220
 				}
221 221
 				?>
@@ -223,18 +223,18 @@  discard block
 block discarded – undo
223 223
 				<h4 style="margin-bottom:0px;">
224 224
 					<span><?php echo $this->product_id; ?></span>
225 225
 					- <span><?php echo $this->version; ?></span>
226
-					- <span style="color:<?php echo $colour;?>;"><?php echo $this->status; ?></span>
226
+					- <span style="color:<?php echo $colour; ?>;"><?php echo $this->status; ?></span>
227 227
 					- <?php echo $this->button; ?>
228 228
 				</h4>
229 229
 
230
-				<?php if ( $this->dev_mode && is_array( $this->messages ) ) { ?><p><small class="messages" style="font-weight:normal;"><?php echo implode( '. ', $this->messages ); ?></small></p><?php }  ?>
230
+				<?php if ($this->dev_mode && is_array($this->messages)) { ?><p><small class="messages" style="font-weight:normal;"><?php echo implode('. ', $this->messages); ?></small></p><?php }  ?>
231 231
 
232 232
 			</th>
233 233
 		</tr>
234 234
 
235 235
 		<tr class="form-field <?php echo $this->product_slug; ?>-api-email-wrap">
236 236
 			<th style="font-size:13px;" scope="row">
237
-				<i class="dashicons-before dashicons-email-alt"></i> <?php esc_html_e( 'Registered Email', $this->product_slug ); ?>
237
+				<i class="dashicons-before dashicons-email-alt"></i> <?php esc_html_e('Registered Email', $this->product_slug); ?>
238 238
 			</th>
239 239
 			<td>
240 240
 				<input type="text" {{#if <?php echo $this->product_slug; ?>_email}} value="{{<?php echo $this->product_slug; ?>_email}}" {{/if}} name="<?php echo $this->product_slug; ?>_email" /><br />
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		</tr>
244 244
 		<tr class="form-field <?php echo $this->product_slug; ?>-api-key-wrap">
245 245
 			<th style="font-size:13px;" scope="row">
246
-				<i class="dashicons-before dashicons-admin-network"></i> <?php esc_html_e( 'API Key', $this->product_slug ); ?>
246
+				<i class="dashicons-before dashicons-admin-network"></i> <?php esc_html_e('API Key', $this->product_slug); ?>
247 247
 			</th>
248 248
 			<td>
249 249
 				<input type="text" {{#if <?php echo $this->product_slug; ?>_api_key}} value="{{<?php echo $this->product_slug; ?>_api_key}}" {{/if}} name="<?php echo $this->product_slug; ?>_api_key" />
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	/**
258 258
 	 * outputs the scripts for the dashboard settings pages.
259 259
 	 */
260
-	public function settings_page_scripts(){ ?>
260
+	public function settings_page_scripts() { ?>
261 261
 		{{#script}}
262 262
 		jQuery( function( $ ){
263 263
 		$( '.<?php echo $this->product_slug; ?>-api-email-wrap input' ).on( 'change', function() {
@@ -287,26 +287,26 @@  discard block
 block discarded – undo
287 287
 	/**
288 288
 	 * Return an instance of this class.
289 289
 	 */
290
-	public function activate_deactivate(){
291
-		if(isset($_GET['action']) && 'activate' === $_GET['action']
290
+	public function activate_deactivate() {
291
+		if (isset($_GET['action']) && 'activate' === $_GET['action']
292 292
 			&& isset($_GET['product']) && $this->product_slug === $_GET['product']
293 293
 			&& false !== $this->api_key && '' !== $this->api_key
294
-			&& false !== $this->email && '' !== $this->email){
294
+			&& false !== $this->email && '' !== $this->email) {
295 295
 
296 296
 
297 297
 			$response = $this->query('activation');
298
-			if(is_object($response) && isset($response->activated) && true === $response->activated){
299
-				update_option($this->product_slug.'_status','active');
298
+			if (is_object($response) && isset($response->activated) && true === $response->activated) {
299
+				update_option($this->product_slug.'_status', 'active');
300 300
 				$this->status = 'active';
301 301
 			}
302 302
 		}
303 303
 
304
-		if((isset($_GET['action']) && 'deactivate' === $_GET['action'] && isset($_GET['product']) && $this->product_slug === $_GET['product'])
305
-			|| (false === $this->api_key || '' === $this->api_key || false === $this->email || '' === $this->email)){
304
+		if ((isset($_GET['action']) && 'deactivate' === $_GET['action'] && isset($_GET['product']) && $this->product_slug === $_GET['product'])
305
+			|| (false === $this->api_key || '' === $this->api_key || false === $this->email || '' === $this->email)) {
306 306
 
307
-			if('active' === $this->status) {
307
+			if ('active' === $this->status) {
308 308
 				$this->query('deactivation');
309
-				update_option($this->product_slug.'_status','inactive');
309
+				update_option($this->product_slug.'_status', 'inactive');
310 310
 				$this->status = 'inactive';
311 311
 			}
312 312
 		}
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 	/**
316 316
 	 * Generates the API URL
317 317
 	 */
318
-	public function create_software_api_url( $args ) {
318
+	public function create_software_api_url($args) {
319 319
 
320 320
 		$endpoint = 'am-software-api';
321
-		if('pluginupdatecheck' === $args['request']){
321
+		if ('pluginupdatecheck' === $args['request']) {
322 322
 			$endpoint = 'upgrade-api';
323 323
 		}
324
-		$api_url = add_query_arg( 'wc-api', $endpoint, $this->products_api_url );
325
-		return $api_url . '&' . http_build_query( $args );
324
+		$api_url = add_query_arg('wc-api', $endpoint, $this->products_api_url);
325
+		return $api_url.'&'.http_build_query($args);
326 326
 	}
327 327
 
328 328
 	/**
@@ -330,23 +330,23 @@  discard block
 block discarded – undo
330 330
 	 * @return string
331 331
 	 */
332 332
 	public function check_status($response = false) {
333
-		if(false === $response){
333
+		if (false === $response) {
334 334
 			$response = $this->query('status');
335 335
 		}
336
-		if ( $this->dev_mode ) {
337
-			$this->messages[] = print_r( $response, true );
336
+		if ($this->dev_mode) {
337
+			$this->messages[] = print_r($response, true);
338 338
 		}
339 339
 		$status = 'inactive';
340
-		if(is_object($response)){
340
+		if (is_object($response)) {
341 341
 
342
-			if(isset($response->error)){
342
+			if (isset($response->error)) {
343 343
 				$this->messages[] = $this->format_error_code($response->code);
344
-			}elseif(isset($response->status_check)){
344
+			}elseif (isset($response->status_check)) {
345 345
 				$status = $response->status_check;
346
-				if(isset($response->activations_remaining)){
346
+				if (isset($response->activations_remaining)) {
347 347
 					$this->messages[] = $response->activations_remaining;
348 348
 				}
349
-				if(isset($response->message)){
349
+				if (isset($response->message)) {
350 350
 					$this->messages[] = $response->message;
351 351
 				}
352 352
 			}
@@ -359,15 +359,15 @@  discard block
 block discarded – undo
359 359
 	 * @param  string $action
360 360
 	 * @return array
361 361
 	 */
362
-	public function query($action='status') {
363
-		if ( 'status' === $action ) {
364
-			$transient_status_id = 'lsx_addon_' . $this->product_id . '_status';
365
-			$response =  get_transient( $transient_status_id );
366
-		} else {
362
+	public function query($action = 'status') {
363
+		if ('status' === $action) {
364
+			$transient_status_id = 'lsx_addon_'.$this->product_id.'_status';
365
+			$response = get_transient($transient_status_id);
366
+		}else {
367 367
 			$response = false;
368 368
 		}
369 369
 
370
-		if ( ! $response ) {
370
+		if (!$response) {
371 371
 			$args = array(
372 372
 				'request' 		=> $action,
373 373
 				'email' 		=> $this->email,
@@ -376,18 +376,18 @@  discard block
 block discarded – undo
376 376
 				'platform' 		=> home_url(),
377 377
 				'instance' 		=> $this->password
378 378
 			);
379
-			$target_url = esc_url_raw( $this->create_software_api_url( $args ) );
379
+			$target_url = esc_url_raw($this->create_software_api_url($args));
380 380
 
381
-			$request = wp_remote_get( $target_url );
382
-			if( is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) != 200 ) {
381
+			$request = wp_remote_get($target_url);
382
+			if (is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) {
383 383
 				// Request failed
384 384
 				return false;
385 385
 			}
386
-			$response = wp_remote_retrieve_body( $request );
387
-			if ( $this->dev_mode ) {
388
-				$this->messages[] = print_r( $response, true );
386
+			$response = wp_remote_retrieve_body($request);
387
+			if ($this->dev_mode) {
388
+				$this->messages[] = print_r($response, true);
389 389
 			}
390
-			set_transient( $transient_status_id, $response, MINUTE_IN_SECONDS );
390
+			set_transient($transient_status_id, $response, MINUTE_IN_SECONDS);
391 391
 		}
392 392
 
393 393
 		return json_decode($response);
@@ -398,28 +398,28 @@  discard block
 block discarded – undo
398 398
 	 * @param  array $args
399 399
 	 * @return array
400 400
 	 */
401
-	public function format_error_code($code=false){
402
-		switch ( $code ) {
401
+	public function format_error_code($code = false) {
402
+		switch ($code) {
403 403
 			case '101' :
404
-				$error = array( 'error' => esc_html__( 'Invalid API License Key. Login to your My Account page to find a valid API License Key', $this->product_slug ), 'code' => '101' );
404
+				$error = array('error' => esc_html__('Invalid API License Key. Login to your My Account page to find a valid API License Key', $this->product_slug), 'code' => '101');
405 405
 				break;
406 406
 			case '102' :
407
-				$error = array( 'error' => esc_html__( 'Software has been deactivated', $this->product_slug ), 'code' => '102' );
407
+				$error = array('error' => esc_html__('Software has been deactivated', $this->product_slug), 'code' => '102');
408 408
 				break;
409 409
 			case '103' :
410
-				$error = array( 'error' => esc_html__( 'Exceeded maximum number of activations', $this->product_slug ), 'code' => '103' );
410
+				$error = array('error' => esc_html__('Exceeded maximum number of activations', $this->product_slug), 'code' => '103');
411 411
 				break;
412 412
 			case '104' :
413
-				$error = array( 'error' => esc_html__( 'Invalid Instance ID', $this->product_slug ), 'code' => '104' );
413
+				$error = array('error' => esc_html__('Invalid Instance ID', $this->product_slug), 'code' => '104');
414 414
 				break;
415 415
 			case '105' :
416
-				$error = array( 'error' => esc_html__( 'Invalid API License Key', $this->product_slug ), 'code' => '105' );
416
+				$error = array('error' => esc_html__('Invalid API License Key', $this->product_slug), 'code' => '105');
417 417
 				break;
418 418
 			case '106' :
419
-				$error = array( 'error' => esc_html__( 'Subscription Is Not Active', $this->product_slug ), 'code' => '106' );
419
+				$error = array('error' => esc_html__('Subscription Is Not Active', $this->product_slug), 'code' => '106');
420 420
 				break;
421 421
 			default :
422
-				$error = array( 'error' => esc_html__( 'Invalid Request', $this->product_slug ), 'code' => '100' );
422
+				$error = array('error' => esc_html__('Invalid Request', $this->product_slug), 'code' => '100');
423 423
 				break;
424 424
 		}
425 425
 	}
@@ -436,15 +436,15 @@  discard block
 block discarded – undo
436 436
 		return $result;
437 437
 	}
438 438
 
439
-	public function set_update_status(){
439
+	public function set_update_status() {
440 440
 		$this->status = $this->check_status();
441
-		$this->upgrade_response = get_transient($this->product_slug.'_upgrade_response',false);
441
+		$this->upgrade_response = get_transient($this->product_slug.'_upgrade_response', false);
442 442
 
443
-		if(false !== $this->upgrade_response){
443
+		if (false !== $this->upgrade_response) {
444 444
 			$this->upgrade_response = maybe_unserialize($this->upgrade_response);
445 445
 		}
446 446
 
447
-		if(isset($this->status) && 'active' === $this->status && false === $this->upgrade_response){
447
+		if (isset($this->status) && 'active' === $this->status && false === $this->upgrade_response) {
448 448
 			$args = array(
449 449
 				'request' 			=> 'pluginupdatecheck',
450 450
 				'plugin_name' 		=> $this->product_slug.'/'.$this->file,
@@ -456,15 +456,15 @@  discard block
 block discarded – undo
456 456
 				'instance' 			=> $this->password,
457 457
 				'software_version'	=> $this->version,
458 458
 			);
459
-			$target_url = esc_url_raw( $this->create_software_api_url( $args ) );
460
-			$request = wp_remote_get( $target_url );
461
-			if( is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) != 200 ) {
459
+			$target_url = esc_url_raw($this->create_software_api_url($args));
460
+			$request = wp_remote_get($target_url);
461
+			if (is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) {
462 462
 				// Request failed
463
-				$this->upgrade_response=false;
463
+				$this->upgrade_response = false;
464 464
 			}
465
-			$response = wp_remote_retrieve_body( $request );
465
+			$response = wp_remote_retrieve_body($request);
466 466
 			$this->upgrade_response = maybe_unserialize($response);
467
-			set_transient($this->product_slug . '_upgrade_response', $response, 60 * 30);
467
+			set_transient($this->product_slug.'_upgrade_response', $response, 60 * 30);
468 468
 		}
469 469
 	}
470 470
 
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
 	 * @param StdClass $updates Update list.
475 475
 	 * @return StdClass Modified update list.
476 476
 	 */
477
-	public function injectUpdate($updates=false){
477
+	public function injectUpdate($updates = false) {
478 478
 		$this->set_update_status();
479
-		if(isset($this->status) && 'active' === $this->status && null !== $this->upgrade_response && is_object($this->upgrade_response) && isset($this->upgrade_response->new_version) && version_compare ( $this->upgrade_response->new_version , $this->version , '>' )){
479
+		if (isset($this->status) && 'active' === $this->status && null !== $this->upgrade_response && is_object($this->upgrade_response) && isset($this->upgrade_response->new_version) && version_compare($this->upgrade_response->new_version, $this->version, '>')) {
480 480
 
481 481
 			//setup the response if our plugin is the only one that needs updating.
482
-			if ( !is_object($updates) ) {
482
+			if (!is_object($updates)) {
483 483
 				$updates = new StdClass();
484 484
 				$updates->response = array();
485 485
 			}
@@ -491,15 +491,15 @@  discard block
 block discarded – undo
491 491
 	/**
492 492
 	 * Adds in the "settings" link for the plugins.php page
493 493
 	 */
494
-	public function add_action_links ( $links ) {
495
-		$admin_url_base = function_exists( 'tour_operator' ) ? 'admin.php?page=lsx-to-settings' : 'themes.php?page=lsx-settings';
494
+	public function add_action_links($links) {
495
+		$admin_url_base = function_exists('tour_operator') ? 'admin.php?page=lsx-to-settings' : 'themes.php?page=lsx-settings';
496 496
 		$documentation = $this->product_slug;
497
-		if(false !== $this->documentation){$documentation = $this->documentation; }
497
+		if (false !== $this->documentation) {$documentation = $this->documentation; }
498 498
 		$mylinks = array(
499
-			'<a href="' . admin_url( $admin_url_base ) . '">'.esc_html__('Settings',$this->product_slug).'</a>',
500
-			'<a href="https://www.lsdev.biz/documentation/'.$documentation.'/" target="_blank">'.esc_html__('Documentation',$this->product_slug).'</a>',
501
-			'<a href="https://www.lsdev.biz/contact-us/" target="_blank">'.esc_html__('Support',$this->product_slug).'</a>',
499
+			'<a href="'.admin_url($admin_url_base).'">'.esc_html__('Settings', $this->product_slug).'</a>',
500
+			'<a href="https://www.lsdev.biz/documentation/'.$documentation.'/" target="_blank">'.esc_html__('Documentation', $this->product_slug).'</a>',
501
+			'<a href="https://www.lsdev.biz/contact-us/" target="_blank">'.esc_html__('Support', $this->product_slug).'</a>',
502 502
 		);
503
-		return array_merge( $links, $mylinks );
503
+		return array_merge($links, $mylinks);
504 504
 	}
505 505
 }
Please login to merge, or discard this patch.
wetu-importer.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,50 +11,50 @@  discard block
 block discarded – undo
11 11
  * Domain Path: /languages/
12 12
  */
13 13
 
14
-define( 'WETU_IMPORTER_PATH',  plugin_dir_path( __FILE__ ) );
15
-define( 'WETU_IMPORTER_CORE',  __FILE__ );
16
-define( 'WETU_IMPORTER_URL',  plugin_dir_url( __FILE__ ) );
17
-define( 'WETU_IMPORTER_VER',  '1.1.1' );
14
+define('WETU_IMPORTER_PATH', plugin_dir_path(__FILE__));
15
+define('WETU_IMPORTER_CORE', __FILE__);
16
+define('WETU_IMPORTER_URL', plugin_dir_url(__FILE__));
17
+define('WETU_IMPORTER_VER', '1.1.1');
18 18
 
19
-register_activation_hook( WETU_IMPORTER_CORE, array( 'WETU_Importer', 'register_activation_hook' ) );
19
+register_activation_hook(WETU_IMPORTER_CORE, array('WETU_Importer', 'register_activation_hook'));
20 20
 
21 21
 /* ======================= The API Classes ========================= */
22 22
 
23
-if ( ! class_exists( 'LSX_API_Manager' ) ) {
24
-	require_once( 'classes/class-lsx-api-manager.php' );
23
+if (!class_exists('LSX_API_Manager')) {
24
+	require_once('classes/class-lsx-api-manager.php');
25 25
 }
26 26
 
27 27
 /**
28 28
  *	Grabs the email and api key from settings.
29 29
  */
30
-function lsx_to_wetu_importer_options_pages_filter( $pages ) {
30
+function lsx_to_wetu_importer_options_pages_filter($pages) {
31 31
 	$pages[] = 'lsx-to-settings';
32 32
 	return $pages;
33 33
 }
34 34
 
35
-add_filter( 'lsx_api_manager_options_pages', 'lsx_to_wetu_importer_options_pages_filter', 10, 1 );
35
+add_filter('lsx_api_manager_options_pages', 'lsx_to_wetu_importer_options_pages_filter', 10, 1);
36 36
 
37 37
 function lsx_to_wetu_importer_api_admin_init() {
38
-	$options = get_option( '_lsx-to_settings', false );
38
+	$options = get_option('_lsx-to_settings', false);
39 39
 
40 40
 	$data = array(
41 41
 		'api_key' => '',
42 42
 		'email' => '',
43 43
 	);
44 44
 
45
-	if ( false !== $options && isset( $options['api'] ) ) {
46
-		if ( isset( $options['api']['wetu-importer_api_key'] ) && '' !== $options['api']['wetu-importer_api_key'] ) {
45
+	if (false !== $options && isset($options['api'])) {
46
+		if (isset($options['api']['wetu-importer_api_key']) && '' !== $options['api']['wetu-importer_api_key']) {
47 47
 			$data['api_key'] = $options['api']['wetu-importer_api_key'];
48 48
 		}
49 49
 
50
-		if ( isset( $options['api']['wetu-importer_email'] ) && '' !== $options['api']['wetu-importer_email'] ) {
50
+		if (isset($options['api']['wetu-importer_email']) && '' !== $options['api']['wetu-importer_email']) {
51 51
 			$data['email'] = $options['api']['wetu-importer_email'];
52 52
 		}
53 53
 	}
54 54
 
55
-	$instance = get_option( 'lsx_api_instance', false );
55
+	$instance = get_option('lsx_api_instance', false);
56 56
 
57
-	if ( false === $instance ) {
57
+	if (false === $instance) {
58 58
 		$instance = LSX_API_Manager::generatePassword();
59 59
 	}
60 60
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 		'file' => 'wetu-importer.php',
68 68
 	);
69 69
 
70
-	$lsx_to_wetu_importer_api_manager = new LSX_API_Manager( $api_array );
70
+	$lsx_to_wetu_importer_api_manager = new LSX_API_Manager($api_array);
71 71
 }
72 72
 
73
-add_action( 'admin_init', 'lsx_to_wetu_importer_api_admin_init' );
73
+add_action('admin_init', 'lsx_to_wetu_importer_api_admin_init');
74 74
 
75 75
 /* ======================= Below is the Plugin Class init ========================= */
76 76
 
77
-require_once( WETU_IMPORTER_PATH . 'classes/class-wetu-importer.php' );
77
+require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer.php');
78 78
 //require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer-connect-accommodation.php');
79
-require_once( WETU_IMPORTER_PATH . 'classes/class-wetu-importer-settings.php' );
79
+require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer-settings.php');
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,11 +235,11 @@  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
-		if ( '' === $accommodation || false === $accommodation || isset( $_GET['refresh_accommodation'] ) ) {
242
+		if ('' === $accommodation || false === $accommodation || isset($_GET['refresh_accommodation'])) {
243 243
 			$this->update_options();
244 244
 		}
245 245
 
@@ -250,14 +250,14 @@  discard block
 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,57 +269,57 @@  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' ) {
273
-			$accommodation = get_transient( 'lsx_ti_accommodation' );
272
+		if (isset($_POST['action']) && $_POST['action'] === 'lsx_tour_importer' && isset($_POST['type']) && $_POST['type'] === 'accommodation') {
273
+			$accommodation = get_transient('lsx_ti_accommodation');
274 274
 
275
-			if ( false === $accommodation ) {
275
+			if (false === $accommodation) {
276 276
 				$this->update_options();
277 277
 			}
278 278
 
279
-			if ( false !== $accommodation ) {
279
+			if (false !== $accommodation) {
280 280
 				$searched_items = false;
281 281
 
282 282
 				// @codingStandardsIgnoreLine
283
-				if ( isset( $_POST['keyword'] ) ) {
283
+				if (isset($_POST['keyword'])) {
284 284
 					// @codingStandardsIgnoreLine
285 285
 					$keyphrases = $_POST['keyword'];
286
-				} else {
287
-					$keyphrases = array( 0 );
286
+				}else {
287
+					$keyphrases = array(0);
288 288
 				}
289 289
 
290
-				if ( ! is_array( $keyphrases ) ) {
291
-					$keyphrases = array( $keyphrases );
290
+				if (!is_array($keyphrases)) {
291
+					$keyphrases = array($keyphrases);
292 292
 				}
293
-				foreach ( $keyphrases as &$keyword ) {
294
-					$keyword = ltrim( rtrim( $keyword ) );
293
+				foreach ($keyphrases as &$keyword) {
294
+					$keyword = ltrim(rtrim($keyword));
295 295
 				}
296 296
 
297 297
 				$post_status = false;
298 298
 
299
-				if ( in_array( 'publish',$keyphrases ) ) {
299
+				if (in_array('publish', $keyphrases)) {
300 300
 					$post_status = 'publish';
301 301
 				}
302
-				if ( in_array( 'pending',$keyphrases ) ) {
302
+				if (in_array('pending', $keyphrases)) {
303 303
 					$post_status = 'pending';
304 304
 				}
305
-				if ( in_array( 'draft',$keyphrases ) ) {
305
+				if (in_array('draft', $keyphrases)) {
306 306
 					$post_status = 'draft';
307 307
 				}
308
-				if ( in_array( 'import',$keyphrases ) ) {
308
+				if (in_array('import', $keyphrases)) {
309 309
 					$post_status = 'import';
310 310
 				}
311 311
 
312
-				if ( ! empty( $accommodation ) ) {
312
+				if (!empty($accommodation)) {
313 313
 					$current_accommodation = $this->find_current_accommodation();
314 314
 
315
-					foreach ( $accommodation as $row_key => $row ) {
315
+					foreach ($accommodation as $row_key => $row) {
316 316
 
317
-						if ( 'Destination' === trim( $row['type'] ) ||
318
-							 'Activity' === trim( $row['type'] ) ||
319
-							 'Restaurant' === trim( $row['type'] ) ||
320
-							 'None' === trim( $row['type'] ) ||
321
-							 'Site / Attraction' === trim( $row['type'] ) ||
322
-							 '' === trim( $row['type'] )
317
+						if ('Destination' === trim($row['type']) ||
318
+							 'Activity' === trim($row['type']) ||
319
+							 'Restaurant' === trim($row['type']) ||
320
+							 'None' === trim($row['type']) ||
321
+							 'Site / Attraction' === trim($row['type']) ||
322
+							 '' === trim($row['type'])
323 323
 						) {
324 324
 							continue;
325 325
 						}
@@ -327,57 +327,57 @@  discard block
 block discarded – undo
327 327
 						//If this is a current tour, add its ID to the row.
328 328
 						$row['post_id'] = 0;
329 329
 
330
-						if ( false !== $current_accommodation && array_key_exists( $row['id'], $current_accommodation ) ) {
331
-							$row['post_id'] = $current_accommodation[ $row['id'] ]->post_id;
330
+						if (false !== $current_accommodation && array_key_exists($row['id'], $current_accommodation)) {
331
+							$row['post_id'] = $current_accommodation[$row['id']]->post_id;
332 332
 						}
333 333
 
334 334
 						//If we are searching for
335
-						if ( false !== $post_status ) {
336
-							if ( 'import' === $post_status ) {
335
+						if (false !== $post_status) {
336
+							if ('import' === $post_status) {
337 337
 
338
-								if ( is_array( $this->queued_imports ) && in_array( $row['post_id'],$this->queued_imports ) ) {
339
-									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
340
-								} else {
338
+								if (is_array($this->queued_imports) && in_array($row['post_id'], $this->queued_imports)) {
339
+									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
340
+								}else {
341 341
 									continue;
342 342
 								}
343
-							} else {
344
-								if ( 0 === $row['post_id'] ) {
343
+							}else {
344
+								if (0 === $row['post_id']) {
345 345
 									continue;
346
-								} else {
347
-									$current_status = get_post_status( $row['post_id'] );
346
+								}else {
347
+									$current_status = get_post_status($row['post_id']);
348 348
 
349
-									if ( $current_status !== $post_status ) {
349
+									if ($current_status !== $post_status) {
350 350
 										continue;
351 351
 									}
352 352
 								}
353 353
 
354
-								$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
354
+								$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
355 355
 							}
356
-						} else {
356
+						}else {
357 357
 							//Search through each keyword.
358
-							foreach ( $keyphrases as $keyphrase ) {
358
+							foreach ($keyphrases as $keyphrase) {
359 359
 								//Make sure the keyphrase is turned into an array
360
-								$keywords = explode( ' ',$keyphrase );
360
+								$keywords = explode(' ', $keyphrase);
361 361
 
362
-								if ( ! is_array( $keywords ) ) {
363
-									$keywords = array( $keywords );
362
+								if (!is_array($keywords)) {
363
+									$keywords = array($keywords);
364 364
 								}
365 365
 
366
-								if ( $this->multineedle_stripos( ltrim( rtrim( $row['name'] ) ), $keywords ) !== false ) {
367
-									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
366
+								if ($this->multineedle_stripos(ltrim(rtrim($row['name'])), $keywords) !== false) {
367
+									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
368 368
 								}
369 369
 							}
370 370
 						}
371 371
 					}
372 372
 				}
373 373
 
374
-				if ( false !== $searched_items ) {
375
-					ksort( $searched_items );
376
-					$return = implode( $searched_items );
374
+				if (false !== $searched_items) {
375
+					ksort($searched_items);
376
+					$return = implode($searched_items);
377 377
 				}
378 378
 			}
379 379
 
380
-			print_r( $return );
380
+			print_r($return);
381 381
 		}
382 382
 
383 383
 		die();
@@ -386,28 +386,28 @@  discard block
 block discarded – undo
386 386
 	/**
387 387
 	 * Formats the row for output on the screen.
388 388
 	 */
389
-	public function format_row( $row = false ) {
390
-		if ( false !== $row ) {
389
+	public function format_row($row = false) {
390
+		if (false !== $row) {
391 391
 
392 392
 			$status = 'import';
393
-			if ( 0 !== $row['post_id'] ) {
394
-				$status = '<a href="' . admin_url( '/post.php?post=' . $row['post_id'] . '&action=edit' ) . '" target="_blank">' . get_post_status( $row['post_id'] ) . '</a>';
393
+			if (0 !== $row['post_id']) {
394
+				$status = '<a href="'.admin_url('/post.php?post='.$row['post_id'].'&action=edit').'" target="_blank">'.get_post_status($row['post_id']).'</a>';
395 395
 			}
396 396
 
397 397
 			$row_html = '
398
-			<tr class="post-' . $row['post_id'] . ' type-tour" id="post-' . $row['post_id'] . '">
398
+			<tr class="post-' . $row['post_id'].' type-tour" id="post-'.$row['post_id'].'">
399 399
 				<th class="check-column" scope="row">
400
-					<label for="cb-select-' . $row['id'] . '" class="screen-reader-text">' . $row['name'] . '</label>
401
-					<input type="checkbox" data-identifier="' . $row['id'] . '" value="' . $row['post_id'] . '" name="post[]" id="cb-select-' . $row['id'] . '">
400
+					<label for="cb-select-' . $row['id'].'" class="screen-reader-text">'.$row['name'].'</label>
401
+					<input type="checkbox" data-identifier="' . $row['id'].'" value="'.$row['post_id'].'" name="post[]" id="cb-select-'.$row['id'].'">
402 402
 				</th>
403 403
 				<td class="post-title page-title column-title">
404
-					<strong>' . $row['name'] . '</strong> - ' . $status . '
404
+					<strong>' . $row['name'].'</strong> - '.$status.'
405 405
 				</td>
406 406
 				<td class="date column-date">
407
-					<abbr title="' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '">' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '</abbr><br>Last Modified
407
+					<abbr title="' . date('Y/m/d', strtotime($row['last_modified'])).'">'.date('Y/m/d', strtotime($row['last_modified'])).'</abbr><br>Last Modified
408 408
 				</td>
409 409
 				<td class="ssid column-ssid">
410
-					' . $row['id'] . '
410
+					' . $row['id'].'
411 411
 				</td>
412 412
 			</tr>';
413 413
 			return $row_html;
@@ -417,14 +417,14 @@  discard block
 block discarded – undo
417 417
 	/**
418 418
 	 * Saves the queue to the option.
419 419
 	 */
420
-	public function remove_from_queue( $id ) {
421
-		if ( ! empty( $this->queued_imports ) ) {
420
+	public function remove_from_queue($id) {
421
+		if (!empty($this->queued_imports)) {
422 422
 			// @codingStandardsIgnoreLine
423
-			if ( ( $key = array_search( $id, $this->queued_imports ) ) !== false ) {
424
-				unset( $this->queued_imports[ $key ] );
423
+			if (($key = array_search($id, $this->queued_imports)) !== false) {
424
+				unset($this->queued_imports[$key]);
425 425
 
426
-				delete_option( 'wetu_importer_que' );
427
-				update_option( 'wetu_importer_que',$this->queued_imports );
426
+				delete_option('wetu_importer_que');
427
+				update_option('wetu_importer_que', $this->queued_imports);
428 428
 			}
429 429
 		}
430 430
 	}
@@ -436,59 +436,59 @@  discard block
 block discarded – undo
436 436
 		$return = false;
437 437
 
438 438
 		// @codingStandardsIgnoreLine
439
-		if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_import_items' && isset( $_POST['type'] ) && $_POST['type'] === 'accommodation' && isset( $_POST['wetu_id'] ) ) {
439
+		if (isset($_POST['action']) && $_POST['action'] === 'lsx_import_items' && isset($_POST['type']) && $_POST['type'] === 'accommodation' && isset($_POST['wetu_id'])) {
440 440
 			// @codingStandardsIgnoreLine
441 441
 			$wetu_id = $_POST['wetu_id'];
442 442
 
443 443
 			// @codingStandardsIgnoreLine
444
-			if ( isset( $_POST['post_id'] ) ) {
444
+			if (isset($_POST['post_id'])) {
445 445
 				// @codingStandardsIgnoreLine
446 446
 				$post_id = $_POST['post_id'];
447
-			} else {
447
+			}else {
448 448
 				$post_id = 0;
449 449
 			}
450 450
 
451 451
 			// @codingStandardsIgnoreLine
452
-			if ( isset( $_POST['team_members'] ) ) {
452
+			if (isset($_POST['team_members'])) {
453 453
 				// @codingStandardsIgnoreLine
454 454
 				$team_members = $_POST['team_members'];
455
-			} else {
455
+			}else {
456 456
 				$team_members = false;
457 457
 			}
458 458
 
459 459
 			// @codingStandardsIgnoreLine
460
-			if ( isset( $_POST['safari_brands'] ) ) {
460
+			if (isset($_POST['safari_brands'])) {
461 461
 				// @codingStandardsIgnoreLine
462 462
 				$safari_brands = $_POST['safari_brands'];
463
-			} else {
463
+			}else {
464 464
 				$safari_brands = false;
465 465
 			}
466 466
 
467
-			delete_option( 'wetu_importer_accommodation_settings' );
467
+			delete_option('wetu_importer_accommodation_settings');
468 468
 
469 469
 			// @codingStandardsIgnoreLine
470
-			if ( isset( $_POST['content'] ) && is_array( $_POST['content'] ) && ! empty( $_POST['content'] ) ) {
470
+			if (isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])) {
471 471
 				// @codingStandardsIgnoreLine
472 472
 				$content = $_POST['content'];
473
-				add_option( 'wetu_importer_accommodation_settings',$content );
474
-			} else {
473
+				add_option('wetu_importer_accommodation_settings', $content);
474
+			}else {
475 475
 				$content = false;
476 476
 			}
477 477
 
478
-			$jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
478
+			$jdata = file_get_contents($this->url.'/Get?'.$this->url_qs.'&ids='.$wetu_id);
479 479
 
480
-			if ( $jdata ) {
481
-				$adata = json_decode( $jdata,true );
482
-				if ( ! empty( $adata ) && ! isset( $adata['error'] ) ) {
483
-					$return = $this->import_row( $adata,$wetu_id,$post_id,$team_members,$content,$safari_brands );
484
-					$this->format_completed_row( $return );
485
-					$this->remove_from_queue( $return );
480
+			if ($jdata) {
481
+				$adata = json_decode($jdata, true);
482
+				if (!empty($adata) && !isset($adata['error'])) {
483
+					$return = $this->import_row($adata, $wetu_id, $post_id, $team_members, $content, $safari_brands);
484
+					$this->format_completed_row($return);
485
+					$this->remove_from_queue($return);
486 486
 					$this->cleanup_posts();
487
-				} else {
488
-					if ( isset( $adata['error'] ) ) {
489
-						$this->format_error( $adata['error'] );
490
-					} else {
491
-						$this->format_error( esc_html__( 'There was a problem importing your accommodation, please try refreshing the page.', 'wetu-importer' ) );
487
+				}else {
488
+					if (isset($adata['error'])) {
489
+						$this->format_error($adata['error']);
490
+					}else {
491
+						$this->format_error(esc_html__('There was a problem importing your accommodation, please try refreshing the page.', 'wetu-importer'));
492 492
 					}
493 493
 				}
494 494
 			}
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	/**
499 499
 	 * Connect to wetu
500 500
 	 */
501
-	public function import_row( $data, $wetu_id, $id = 0, $team_members = false, $importable_content = false, $safari_brands = false ) {
501
+	public function import_row($data, $wetu_id, $id = 0, $team_members = false, $importable_content = false, $safari_brands = false) {
502 502
 		$post_name = '';
503 503
 		$data_post_content = '';
504 504
 		$data_post_excerpt = '';
@@ -510,139 +510,139 @@  discard block
 block discarded – undo
510 510
 		$content_used_general_description = false;
511 511
 
512 512
 		//Set the post_content
513
-		if ( false !== $importable_content && in_array( 'description',$importable_content ) ) {
514
-			if ( isset( $data[0]['content']['extended_description'] ) ) {
513
+		if (false !== $importable_content && in_array('description', $importable_content)) {
514
+			if (isset($data[0]['content']['extended_description'])) {
515 515
 				$data_post_content = $data[0]['content']['extended_description'];
516
-			} elseif ( isset( $data[0]['content']['general_description'] ) ) {
516
+			} elseif (isset($data[0]['content']['general_description'])) {
517 517
 				$data_post_content = $data[0]['content']['general_description'];
518 518
 				$content_used_general_description = true;
519
-			} elseif ( isset( $data[0]['content']['teaser_description'] ) ) {
519
+			} elseif (isset($data[0]['content']['teaser_description'])) {
520 520
 				$data_post_content = $data[0]['content']['teaser_description'];
521 521
 			}
522 522
 
523
-			$post['post_content'] = wp_strip_all_tags( $data_post_content );
523
+			$post['post_content'] = wp_strip_all_tags($data_post_content);
524 524
 		}
525 525
 
526 526
 		//set the post_excerpt
527
-		if ( false !== $importable_content && in_array( 'excerpt',$importable_content ) ) {
528
-			if ( isset( $data[0]['content']['teaser_description'] ) ) {
527
+		if (false !== $importable_content && in_array('excerpt', $importable_content)) {
528
+			if (isset($data[0]['content']['teaser_description'])) {
529 529
 				$data_post_excerpt = $data[0]['content']['teaser_description'];
530
-			} elseif ( isset( $data[0]['content']['general_description'] ) && false === $content_used_general_description ) {
530
+			} elseif (isset($data[0]['content']['general_description']) && false === $content_used_general_description) {
531 531
 				$data_post_excerpt = $data[0]['content']['general_description'];
532 532
 			}
533 533
 
534 534
 			$post['post_excerpt'] = $data_post_excerpt;
535 535
 		}
536 536
 
537
-		if ( false !== $id && '0' !== $id ) {
537
+		if (false !== $id && '0' !== $id) {
538 538
 			$post['ID'] = $id;
539 539
 
540
-			if ( isset( $data[0]['name'] ) ) {
540
+			if (isset($data[0]['name'])) {
541 541
 				$post['post_title'] = $data[0]['name'];
542 542
 				$post['post_status'] = 'publish';
543
-				$post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ),$id, 'draft', 'accommodation', 0 );
543
+				$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'accommodation', 0);
544 544
 			}
545 545
 
546
-			$id = wp_update_post( $post );
547
-			$prev_date = get_post_meta( $id,'lsx_wetu_modified_date', true );
548
-			update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date );
549
-		} else {
546
+			$id = wp_update_post($post);
547
+			$prev_date = get_post_meta($id, 'lsx_wetu_modified_date', true);
548
+			update_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']), $prev_date);
549
+		}else {
550 550
 			//Set the name
551
-			if ( isset( $data[0]['name'] ) ) {
552
-				$post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ),$id, 'draft', 'accommodation', 0 );
551
+			if (isset($data[0]['name'])) {
552
+				$post_name = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'accommodation', 0);
553 553
 			}
554 554
 
555 555
 			$post['post_name'] = $post_name;
556 556
 			$post['post_title'] = $data[0]['name'];
557 557
 			$post['post_status'] = 'publish';
558
-			$id = wp_insert_post( $post );
558
+			$id = wp_insert_post($post);
559 559
 
560 560
 			//Save the WETU ID and the Last date it was modified.
561
-			if ( false !== $id ) {
562
-				add_post_meta( $id,'lsx_wetu_id',$wetu_id );
563
-				add_post_meta( $id,'lsx_wetu_modified_date',strtotime( $data[0]['last_modified'] ) );
561
+			if (false !== $id) {
562
+				add_post_meta($id, 'lsx_wetu_id', $wetu_id);
563
+				add_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']));
564 564
 			}
565 565
 		}
566 566
 
567 567
 		//Setup some default for use in the import
568
-		if ( false !== $importable_content && (in_array( 'gallery',$importable_content ) || in_array( 'banner_image',$importable_content ) || in_array( 'featured_image',$importable_content )) ) {
569
-			$this->find_attachments( $id );
568
+		if (false !== $importable_content && (in_array('gallery', $importable_content) || in_array('banner_image', $importable_content) || in_array('featured_image', $importable_content))) {
569
+			$this->find_attachments($id);
570 570
 		}
571 571
 
572 572
 		//Set the team member if it is there
573
-		if ( post_type_exists( 'team' ) && false !== $team_members && '' !== $team_members ) {
574
-			$this->set_team_member( $id,$team_members );
573
+		if (post_type_exists('team') && false !== $team_members && '' !== $team_members) {
574
+			$this->set_team_member($id, $team_members);
575 575
 		}
576 576
 
577 577
 		//Set the safari brand
578
-		if ( false !== $safari_brands && '' !== $safari_brands ) {
579
-			$this->set_safari_brands( $id,$safari_brands );
578
+		if (false !== $safari_brands && '' !== $safari_brands) {
579
+			$this->set_safari_brands($id, $safari_brands);
580 580
 		}
581 581
 
582
-		if ( class_exists( 'LSX_TO_Maps' ) ) {
583
-			$this->set_map_data( $data,$id,9 );
582
+		if (class_exists('LSX_TO_Maps')) {
583
+			$this->set_map_data($data, $id, 9);
584 584
 		}
585 585
 
586
-		if ( post_type_exists( 'destination' ) && false !== $importable_content && in_array( 'destination',$importable_content ) ) {
587
-			$this->connect_destinations( $data,$id );
586
+		if (post_type_exists('destination') && false !== $importable_content && in_array('destination', $importable_content)) {
587
+			$this->connect_destinations($data, $id);
588 588
 		}
589 589
 
590
-		if ( false !== $importable_content && in_array( 'category',$importable_content ) ) {
591
-			$this->set_taxonomy_style( $data,$id );
590
+		if (false !== $importable_content && in_array('category', $importable_content)) {
591
+			$this->set_taxonomy_style($data, $id);
592 592
 		}
593 593
 
594 594
 		//Set the Room Data
595
-		if ( false !== $importable_content && in_array( 'rooms',$importable_content ) ) {
596
-			$this->set_room_data( $data,$id );
595
+		if (false !== $importable_content && in_array('rooms', $importable_content)) {
596
+			$this->set_room_data($data, $id);
597 597
 		}
598 598
 
599 599
 		//Set the rating
600
-		if ( false !== $importable_content && in_array( 'rating',$importable_content ) ) {
601
-			$this->set_rating( $data,$id );
600
+		if (false !== $importable_content && in_array('rating', $importable_content)) {
601
+			$this->set_rating($data, $id);
602 602
 		}
603 603
 
604 604
 		//Set the checkin checkout data
605
-		if ( false !== $importable_content && in_array( 'checkin',$importable_content ) ) {
606
-			$this->set_checkin_checkout( $data,$id );
605
+		if (false !== $importable_content && in_array('checkin', $importable_content)) {
606
+			$this->set_checkin_checkout($data, $id);
607 607
 		}
608 608
 
609 609
 		//Set the Spoken Languages
610
-		if ( false !== $importable_content && in_array( 'spoken_languages',$importable_content ) ) {
611
-			$this->set_spoken_languages( $data,$id );
610
+		if (false !== $importable_content && in_array('spoken_languages', $importable_content)) {
611
+			$this->set_spoken_languages($data, $id);
612 612
 		}
613 613
 
614 614
 		//Set the friendly options
615
-		if ( false !== $importable_content && in_array( 'friendly',$importable_content ) ) {
616
-			$this->set_friendly( $data,$id );
615
+		if (false !== $importable_content && in_array('friendly', $importable_content)) {
616
+			$this->set_friendly($data, $id);
617 617
 		}
618 618
 
619 619
 		//Set the special_interests
620
-		if ( false !== $importable_content && in_array( 'special_interests',$importable_content ) ) {
621
-			$this->set_special_interests( $data,$id );
620
+		if (false !== $importable_content && in_array('special_interests', $importable_content)) {
621
+			$this->set_special_interests($data, $id);
622 622
 		}
623 623
 
624 624
 		//Import the videos
625
-		if ( false !== $importable_content && in_array( 'videos',$importable_content ) ) {
626
-			$this->set_video_data( $data,$id );
625
+		if (false !== $importable_content && in_array('videos', $importable_content)) {
626
+			$this->set_video_data($data, $id);
627 627
 		}
628 628
 
629 629
 		//Import the facilities
630
-		if ( false !== $importable_content && in_array( 'facilities',$importable_content ) ) {
631
-			$this->set_facilities( $data,$id );
630
+		if (false !== $importable_content && in_array('facilities', $importable_content)) {
631
+			$this->set_facilities($data, $id);
632 632
 		}
633 633
 
634 634
 		//Set the featured image
635
-		if ( false !== $importable_content && in_array( 'featured_image',$importable_content ) ) {
636
-			$this->set_featured_image( $data,$id );
635
+		if (false !== $importable_content && in_array('featured_image', $importable_content)) {
636
+			$this->set_featured_image($data, $id);
637 637
 		}
638 638
 
639
-		if ( false !== $importable_content && in_array( 'banner_image',$importable_content ) ) {
640
-			$this->set_banner_image( $data,$id );
639
+		if (false !== $importable_content && in_array('banner_image', $importable_content)) {
640
+			$this->set_banner_image($data, $id);
641 641
 		}
642 642
 
643 643
 		//Import the main gallery
644
-		if ( false !== $importable_content && in_array( 'gallery',$importable_content ) ) {
645
-			$this->create_main_gallery( $data,$id );
644
+		if (false !== $importable_content && in_array('gallery', $importable_content)) {
645
+			$this->create_main_gallery($data, $id);
646 646
 		}
647 647
 
648 648
 		return $id;
@@ -651,58 +651,58 @@  discard block
 block discarded – undo
651 651
 	/**
652 652
 	 * Set the team memberon each item.
653 653
 	 */
654
-	public function set_team_member( $id, $team_members ) {
655
-		delete_post_meta( $id, 'team_to_' . $this->tab_slug );
654
+	public function set_team_member($id, $team_members) {
655
+		delete_post_meta($id, 'team_to_'.$this->tab_slug);
656 656
 
657
-		foreach ( $team_members as $team ) {
658
-			add_post_meta( $id,'team_to_' . $this->tab_slug,$team );
657
+		foreach ($team_members as $team) {
658
+			add_post_meta($id, 'team_to_'.$this->tab_slug, $team);
659 659
 		}
660 660
 	}
661 661
 
662 662
 	/**
663 663
 	 * Set the safari brand
664 664
 	 */
665
-	public function set_safari_brands( $id, $safari_brands ) {
666
-		foreach ( $safari_brands as $safari_brand ) {
667
-			wp_set_object_terms( $id, intval( $safari_brand ), 'accommodation-brand',true );
665
+	public function set_safari_brands($id, $safari_brands) {
666
+		foreach ($safari_brands as $safari_brand) {
667
+			wp_set_object_terms($id, intval($safari_brand), 'accommodation-brand', true);
668 668
 		}
669 669
 	}
670 670
 
671 671
 	/**
672 672
 	 * Connects the destinations post type
673 673
 	 */
674
-	public function connect_destinations( $data, $id ) {
675
-		if ( isset( $data[0]['position'] ) ) {
674
+	public function connect_destinations($data, $id) {
675
+		if (isset($data[0]['position'])) {
676 676
 			$destinations = false;
677 677
 
678
-			if ( isset( $data[0]['position']['country'] ) ) {
678
+			if (isset($data[0]['position']['country'])) {
679 679
 				$destinations['country'] = $data[0]['position']['country'];
680 680
 			}
681 681
 
682
-			if ( isset( $data[0]['position']['destination'] ) ) {
682
+			if (isset($data[0]['position']['destination'])) {
683 683
 				$destinations['destination'] = $data[0]['position']['destination'];
684 684
 			}
685 685
 
686
-			if ( false !== $destinations ) {
687
-				$prev_values = get_post_meta( $id,'destination_to_accommodation',false );
686
+			if (false !== $destinations) {
687
+				$prev_values = get_post_meta($id, 'destination_to_accommodation', false);
688 688
 
689
-				if ( false === $prev_values || ! is_array( $prev_values ) ) {
689
+				if (false === $prev_values || !is_array($prev_values)) {
690 690
 					$prev_values = array();
691 691
 				}
692 692
 
693
-				delete_post_meta( $id,'destination_to_accommodation',$prev_values );
693
+				delete_post_meta($id, 'destination_to_accommodation', $prev_values);
694 694
 
695 695
 				//print_r($destinations);
696
-				$destinations = array_unique( $destinations );
696
+				$destinations = array_unique($destinations);
697 697
 				//print_r($destinations);
698 698
 
699
-				foreach ( $destinations as $key => $value ) {
700
-					$destination = get_page_by_title( ltrim( rtrim( $value ) ), 'OBJECT', 'destination' );
701
-					if ( null !== $destination ) {
702
-						if ( ! in_array( $destination->ID,$prev_values ) ) {
703
-							   add_post_meta( $id,'destination_to_accommodation',$destination->ID,false );
704
-							   add_post_meta( $destination->ID,'accommodation_to_destination',$id,false );
705
-							$this->cleanup_posts[ $destination->ID ] = 'accommodation_to_destination';
699
+				foreach ($destinations as $key => $value) {
700
+					$destination = get_page_by_title(ltrim(rtrim($value)), 'OBJECT', 'destination');
701
+					if (null !== $destination) {
702
+						if (!in_array($destination->ID, $prev_values)) {
703
+							   add_post_meta($id, 'destination_to_accommodation', $destination->ID, false);
704
+							   add_post_meta($destination->ID, 'accommodation_to_destination', $id, false);
705
+							$this->cleanup_posts[$destination->ID] = 'accommodation_to_destination';
706 706
 						}
707 707
 					}
708 708
 				}
@@ -713,50 +713,50 @@  discard block
 block discarded – undo
713 713
 	/**
714 714
 	 * Set the Travel Style
715 715
 	 */
716
-	public function set_taxonomy_style( $data, $id ) {
716
+	public function set_taxonomy_style($data, $id) {
717 717
 		$terms = false;
718 718
 
719
-		if ( isset( $data[0]['category'] ) ) {
719
+		if (isset($data[0]['category'])) {
720 720
 			// @codingStandardsIgnoreLine
721
-			if ( ! $term = term_exists( trim( $data[0]['category'] ), 'accommodation-type' ) ) {
722
-				$term = wp_insert_term( trim( $data[0]['category'] ), 'accommodation-type' );
721
+			if (!$term = term_exists(trim($data[0]['category']), 'accommodation-type')) {
722
+				$term = wp_insert_term(trim($data[0]['category']), 'accommodation-type');
723 723
 
724
-				if ( is_wp_error( $term ) ) {
724
+				if (is_wp_error($term)) {
725 725
 					// @codingStandardsIgnoreLine
726 726
 					echo $term->get_error_message();
727 727
 				}
728
-			} else {
729
-				wp_set_object_terms( $id, intval( $term['term_id'] ), 'accommodation-type',true );
728
+			}else {
729
+				wp_set_object_terms($id, intval($term['term_id']), 'accommodation-type', true);
730 730
 			}
731
-		} else {
732
-			wp_set_object_terms( $id, intval( $term['term_id'] ), 'accommodation-type',true );
731
+		}else {
732
+			wp_set_object_terms($id, intval($term['term_id']), 'accommodation-type', true);
733 733
 		}
734 734
 	}
735 735
 
736 736
 	/**
737 737
 	 * Saves the room data
738 738
 	 */
739
-	public function set_room_data( $data, $id ) {
740
-		if ( ! empty( $data[0]['rooms'] ) && is_array( $data[0]['rooms'] ) ) {
739
+	public function set_room_data($data, $id) {
740
+		if (!empty($data[0]['rooms']) && is_array($data[0]['rooms'])) {
741 741
 			$rooms = false;
742 742
 
743
-			foreach ( $data[0]['rooms'] as $room ) {
743
+			foreach ($data[0]['rooms'] as $room) {
744 744
 				$temp_room = array();
745 745
 
746
-				if ( isset( $room['name'] ) ) {
746
+				if (isset($room['name'])) {
747 747
 					$temp_room['title'] = $room['name'];
748 748
 				}
749 749
 
750
-				if ( isset( $room['description'] ) ) {
751
-					$temp_room['description'] = strip_tags( $room['description'] );
750
+				if (isset($room['description'])) {
751
+					$temp_room['description'] = strip_tags($room['description']);
752 752
 				}
753 753
 
754 754
 				$temp_room['price'] = 0;
755 755
 				$temp_room['type'] = 'room';
756 756
 
757
-				if ( ! empty( $room['images'] ) && is_array( $room['images'] ) ) {
757
+				if (!empty($room['images']) && is_array($room['images'])) {
758 758
 					$temp_room['gallery'] = array();
759
-					$temp_room['gallery'][] = $this->attach_image( $room['images'][0], $id );
759
+					$temp_room['gallery'][] = $this->attach_image($room['images'][0], $id);
760 760
 
761 761
 					/*foreach($room['images'] as $image_data){
762 762
 			    		$temp_room['gallery'][] = $this->attach_image($image_data,$id);
@@ -766,25 +766,25 @@  discard block
 block discarded – undo
766 766
 				$rooms[] = $temp_room;
767 767
 			}
768 768
 
769
-			if ( false !== $id && '0' !== $id ) {
770
-				delete_post_meta( $id, 'units' );
769
+			if (false !== $id && '0' !== $id) {
770
+				delete_post_meta($id, 'units');
771 771
 			}
772 772
 
773
-			foreach ( $rooms as $room ) {
774
-				add_post_meta( $id,'units',$room,false );
773
+			foreach ($rooms as $room) {
774
+				add_post_meta($id, 'units', $room, false);
775 775
 			}
776 776
 
777
-			if ( isset( $data[0]['features'] ) && isset( $data[0]['features']['rooms'] ) ) {
777
+			if (isset($data[0]['features']) && isset($data[0]['features']['rooms'])) {
778 778
 				$room_count = $data[0]['features']['rooms'];
779
-			} else {
780
-				$room_count = count( $data[0]['rooms'] );
779
+			}else {
780
+				$room_count = count($data[0]['rooms']);
781 781
 			}
782 782
 
783
-			if ( false !== $id && '0' !== $id ) {
784
-				$prev_rooms = get_post_meta( $id,'number_of_rooms',true );
785
-				update_post_meta( $id,'number_of_rooms',$room_count,$prev_rooms );
786
-			} else {
787
-				add_post_meta( $id,'number_of_rooms',$room_count,true );
783
+			if (false !== $id && '0' !== $id) {
784
+				$prev_rooms = get_post_meta($id, 'number_of_rooms', true);
785
+				update_post_meta($id, 'number_of_rooms', $room_count, $prev_rooms);
786
+			}else {
787
+				add_post_meta($id, 'number_of_rooms', $room_count, true);
788 788
 			}
789 789
 		}
790 790
 	}
@@ -792,33 +792,33 @@  discard block
 block discarded – undo
792 792
 	/**
793 793
 	 * Set the ratings
794 794
 	 */
795
-	public function set_rating( $data, $id ) {
796
-		if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['star_authority'] ) ) {
795
+	public function set_rating($data, $id) {
796
+		if (!empty($data[0]['features']) && isset($data[0]['features']['star_authority'])) {
797 797
 			$rating_type = $data[0]['features']['star_authority'];
798
-		} else {
798
+		}else {
799 799
 			$rating_type = 'Unspecified2';
800 800
 		}
801 801
 
802
-		$this->save_custom_field( $rating_type,'rating_type',$id );
802
+		$this->save_custom_field($rating_type, 'rating_type', $id);
803 803
 
804
-		if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['stars'] ) ) {
805
-			$this->save_custom_field( $data[0]['features']['stars'],'rating',$id,true );
804
+		if (!empty($data[0]['features']) && isset($data[0]['features']['stars'])) {
805
+			$this->save_custom_field($data[0]['features']['stars'], 'rating', $id, true);
806 806
 		}
807 807
 	}
808 808
 
809 809
 	/**
810 810
 	 * Set the spoken_languages
811 811
 	 */
812
-	public function set_spoken_languages( $data, $id ) {
813
-		if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['spoken_languages'] ) && ! empty( $data[0]['features']['spoken_languages'] ) ) {
812
+	public function set_spoken_languages($data, $id) {
813
+		if (!empty($data[0]['features']) && isset($data[0]['features']['spoken_languages']) && !empty($data[0]['features']['spoken_languages'])) {
814 814
 			$languages = false;
815 815
 
816
-			foreach ( $data[0]['features']['spoken_languages'] as $spoken_language ) {
817
-				$languages[] = sanitize_title( $spoken_language );
816
+			foreach ($data[0]['features']['spoken_languages'] as $spoken_language) {
817
+				$languages[] = sanitize_title($spoken_language);
818 818
 			}
819 819
 
820
-			if ( false !== $languages ) {
821
-				$this->save_custom_field( $languages,'spoken_languages',$id );
820
+			if (false !== $languages) {
821
+				$this->save_custom_field($languages, 'spoken_languages', $id);
822 822
 			}
823 823
 		}
824 824
 	}
@@ -826,16 +826,16 @@  discard block
 block discarded – undo
826 826
 	/**
827 827
 	 * Set the friendly
828 828
 	 */
829
-	public function set_friendly( $data, $id ) {
830
-		if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['suggested_visitor_types'] ) && ! empty( $data[0]['features']['suggested_visitor_types'] ) ) {
829
+	public function set_friendly($data, $id) {
830
+		if (!empty($data[0]['features']) && isset($data[0]['features']['suggested_visitor_types']) && !empty($data[0]['features']['suggested_visitor_types'])) {
831 831
 			$friendly_options = false;
832 832
 
833
-			foreach ( $data[0]['features']['suggested_visitor_types'] as $visitor_type ) {
834
-				$friendly_options[] = sanitize_title( $visitor_type );
833
+			foreach ($data[0]['features']['suggested_visitor_types'] as $visitor_type) {
834
+				$friendly_options[] = sanitize_title($visitor_type);
835 835
 			}
836 836
 
837
-			if ( false !== $friendly_options ) {
838
-				$this->save_custom_field( $friendly_options,'suggested_visitor_types',$id );
837
+			if (false !== $friendly_options) {
838
+				$this->save_custom_field($friendly_options, 'suggested_visitor_types', $id);
839 839
 			}
840 840
 		}
841 841
 	}
@@ -843,16 +843,16 @@  discard block
 block discarded – undo
843 843
 	/**
844 844
 	 * Set the special interests
845 845
 	 */
846
-	public function set_special_interests( $data, $id ) {
847
-		if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['special_interests'] ) && ! empty( $data[0]['features']['special_interests'] ) ) {
846
+	public function set_special_interests($data, $id) {
847
+		if (!empty($data[0]['features']) && isset($data[0]['features']['special_interests']) && !empty($data[0]['features']['special_interests'])) {
848 848
 			$interests = false;
849 849
 
850
-			foreach ( $data[0]['features']['special_interests'] as $special_interest ) {
851
-				$interests[] = sanitize_title( $special_interest );
850
+			foreach ($data[0]['features']['special_interests'] as $special_interest) {
851
+				$interests[] = sanitize_title($special_interest);
852 852
 			}
853 853
 
854
-			if ( false !== $interests ) {
855
-				$this->save_custom_field( $interests,'special_interests',$id );
854
+			if (false !== $interests) {
855
+				$this->save_custom_field($interests, 'special_interests', $id);
856 856
 			}
857 857
 		}
858 858
 	}
@@ -860,24 +860,24 @@  discard block
 block discarded – undo
860 860
 	/**
861 861
 	 * Set the Check in and Check out Date
862 862
 	 */
863
-	public function set_checkin_checkout( $data, $id ) {
864
-		if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['check_in_time'] ) ) {
865
-			$time = str_replace( 'h',':',$data[0]['features']['check_in_time'] );
866
-			$time = date( 'h:ia',strtotime( $time ) );
867
-			$this->save_custom_field( $time,'checkin_time',$id );
863
+	public function set_checkin_checkout($data, $id) {
864
+		if (!empty($data[0]['features']) && isset($data[0]['features']['check_in_time'])) {
865
+			$time = str_replace('h', ':', $data[0]['features']['check_in_time']);
866
+			$time = date('h:ia', strtotime($time));
867
+			$this->save_custom_field($time, 'checkin_time', $id);
868 868
 		}
869 869
 
870
-		if ( ! empty( $data[0]['features'] ) && isset( $data[0]['features']['check_out_time'] ) ) {
871
-			$time = str_replace( 'h',':',$data[0]['features']['check_out_time'] );
872
-			$time = date( 'h:ia',strtotime( $time ) );
873
-			$this->save_custom_field( $time,'checkout_time',$id );
870
+		if (!empty($data[0]['features']) && isset($data[0]['features']['check_out_time'])) {
871
+			$time = str_replace('h', ':', $data[0]['features']['check_out_time']);
872
+			$time = date('h:ia', strtotime($time));
873
+			$this->save_custom_field($time, 'checkout_time', $id);
874 874
 		}
875 875
 	}
876 876
 
877 877
 	/**
878 878
 	 * Set the Facilities
879 879
 	 */
880
-	public function set_facilities( $data, $id ) {
880
+	public function set_facilities($data, $id) {
881 881
 		$parent_facilities = array(
882 882
 			'available_services' => 'Available Services',
883 883
 			'property_facilities' => 'Property Facilities',
@@ -885,15 +885,15 @@  discard block
 block discarded – undo
885 885
 			'activities_on_site' => 'Activities on Site',
886 886
 		);
887 887
 
888
-		foreach ( $parent_facilities as $key => $label ) {
888
+		foreach ($parent_facilities as $key => $label) {
889 889
 			$terms = false;
890 890
 
891
-			if ( isset( $data[0]['features'] ) && isset( $data[0]['features'][ $key ] ) ) {
892
-				$parent_id = $this->set_term( $id,$label,'facility' );
891
+			if (isset($data[0]['features']) && isset($data[0]['features'][$key])) {
892
+				$parent_id = $this->set_term($id, $label, 'facility');
893 893
 			}
894 894
 
895
-			foreach ( $data[0]['features'][ $key ] as $child_facility ) {
896
-				$this->set_term( $id,$child_facility,'facility',$parent_id );
895
+			foreach ($data[0]['features'][$key] as $child_facility) {
896
+				$this->set_term($id, $child_facility, 'facility', $parent_id);
897 897
 			}
898 898
 		}
899 899
 	}
Please login to merge, or discard this patch.
classes/class-wetu-importer.php 1 patch
Spacing   +312 added lines, -312 removed lines patch added patch discarded remove patch
@@ -191,31 +191,31 @@  discard block
 block discarded – undo
191 191
 	 * @access private
192 192
 	 */
193 193
 	public function __construct() {
194
-		add_action( 'admin_init', array( $this, 'compatible_version_check' ) );
194
+		add_action('admin_init', array($this, 'compatible_version_check'));
195 195
 
196 196
 		// Don't run anything else in the plugin, if we're on an incompatible PHP version
197
-		if ( ! self::compatible_version() ) {
197
+		if (!self::compatible_version()) {
198 198
 			return;
199 199
 		}
200 200
 
201 201
 		$this->set_variables();
202 202
 
203
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
204
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ,11 );
205
-		add_action( 'admin_menu', array( $this, 'register_importer_page' ),20 );
203
+		add_action('init', array($this, 'load_plugin_textdomain'));
204
+		add_action('admin_enqueue_scripts', array($this, 'admin_scripts'), 11);
205
+		add_action('admin_menu', array($this, 'register_importer_page'), 20);
206 206
 
207
-		require_once( WETU_IMPORTER_PATH . 'classes/class-wetu-importer-accommodation.php' );
208
-		require_once( WETU_IMPORTER_PATH . 'classes/class-wetu-importer-destination.php' );
209
-		require_once( WETU_IMPORTER_PATH . 'classes/class-wetu-importer-tours.php' );
207
+		require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer-accommodation.php');
208
+		require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer-destination.php');
209
+		require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer-tours.php');
210 210
 
211
-		add_action( 'init', array( $this, 'load_class' ) );
211
+		add_action('init', array($this, 'load_class'));
212 212
 
213
-		if ( 'default' !== $this->tab_slug ) {
214
-			add_action( 'wp_ajax_lsx_tour_importer',array( $this, 'process_ajax_search' ) );
215
-			add_action( 'wp_ajax_nopriv_lsx_tour_importer',array( $this, 'process_ajax_search' ) );
213
+		if ('default' !== $this->tab_slug) {
214
+			add_action('wp_ajax_lsx_tour_importer', array($this, 'process_ajax_search'));
215
+			add_action('wp_ajax_nopriv_lsx_tour_importer', array($this, 'process_ajax_search'));
216 216
 
217
-			add_action( 'wp_ajax_lsx_import_items',array( $this, 'process_ajax_import' ) );
218
-			add_action( 'wp_ajax_nopriv_lsx_import_items',array( $this, 'process_ajax_import' ) );
217
+			add_action('wp_ajax_lsx_import_items', array($this, 'process_ajax_import'));
218
+			add_action('wp_ajax_nopriv_lsx_import_items', array($this, 'process_ajax_import'));
219 219
 		}
220 220
 	}
221 221
 
@@ -227,19 +227,19 @@  discard block
 block discarded – undo
227 227
 	 * @since 1.0.0
228 228
 	 */
229 229
 	public function load_plugin_textdomain() {
230
-		load_plugin_textdomain( 'wetu-importer', false, basename( WETU_IMPORTER_PATH ) . '/languages' );
230
+		load_plugin_textdomain('wetu-importer', false, basename(WETU_IMPORTER_PATH).'/languages');
231 231
 	}
232 232
 
233 233
 	/**
234 234
 	 * Sets the variables used throughout the plugin.
235 235
 	 */
236 236
 	public function set_variables() {
237
-		$this->post_types = array( 'accommodation','destination','tour' );
238
-		$temp_options = get_option( '_lsx-to_settings',false );
237
+		$this->post_types = array('accommodation', 'destination', 'tour');
238
+		$temp_options = get_option('_lsx-to_settings', false);
239 239
 
240 240
 		//Set the options.
241
-		if ( false !== $temp_options && isset( $temp_options[ $this->plugin_slug ] ) ) {
242
-			$this->options = $temp_options[ $this->plugin_slug ];
241
+		if (false !== $temp_options && isset($temp_options[$this->plugin_slug])) {
242
+			$this->options = $temp_options[$this->plugin_slug];
243 243
 
244 244
 			$this->accommodation_settings = $temp_options['accommodation'];
245 245
 			$this->tour_settings = $temp_options['tour'];
@@ -249,59 +249,59 @@  discard block
 block discarded – undo
249 249
 			$this->api_username = false;
250 250
 			$this->api_password = false;
251 251
 
252
-			if ( ! defined( 'WETU_API_KEY' ) ) {
253
-				if ( isset( $temp_options['api']['wetu_api_key'] ) && '' !== $temp_options['api']['wetu_api_key'] ) {
252
+			if (!defined('WETU_API_KEY')) {
253
+				if (isset($temp_options['api']['wetu_api_key']) && '' !== $temp_options['api']['wetu_api_key']) {
254 254
 					$this->api_key = $temp_options['api']['wetu_api_key'];
255 255
 				}
256
-				if ( isset( $temp_options['api']['wetu_api_username'] ) && '' !== $temp_options['api']['wetu_api_username'] ) {
256
+				if (isset($temp_options['api']['wetu_api_username']) && '' !== $temp_options['api']['wetu_api_username']) {
257 257
 					$this->api_username = $temp_options['api']['wetu_api_username'];
258 258
 				}
259
-				if ( isset( $temp_options['api']['wetu_api_password'] ) && '' !== $temp_options['api']['wetu_api_password'] ) {
259
+				if (isset($temp_options['api']['wetu_api_password']) && '' !== $temp_options['api']['wetu_api_password']) {
260 260
 					$this->api_password = $temp_options['api']['wetu_api_password'];
261 261
 				}
262
-			} else {
262
+			}else {
263 263
 				$this->api_key = WETU_API_KEY;
264 264
 			}
265 265
 
266 266
 			//Set the tab slug
267 267
 			// @codingStandardsIgnoreLine
268
-			if ( isset( $_GET['tab'] ) || isset( $_POST['type'] ) ) {
269
-				if ( isset( $_GET['tab'] ) ) {
268
+			if (isset($_GET['tab']) || isset($_POST['type'])) {
269
+				if (isset($_GET['tab'])) {
270 270
 					$this->tab_slug = $_GET['tab'];
271
-				} else {
271
+				}else {
272 272
 					// @codingStandardsIgnoreLine
273 273
 					$this->tab_slug = $_POST['type'];
274 274
 				}
275 275
 
276 276
 				//If any tours were queued
277
-				$this->queued_imports = get_option( 'wetu_importer_que', array() );
277
+				$this->queued_imports = get_option('wetu_importer_que', array());
278 278
 			}
279 279
 
280 280
 			//Set the scaling options
281
-			if ( isset( $this->options ) && isset( $this->options['image_scaling'] ) ) {
281
+			if (isset($this->options) && isset($this->options['image_scaling'])) {
282 282
 				$this->scale_images = true;
283 283
 				$width = '1024';
284 284
 
285
-				if ( isset( $this->options['width'] ) && '' !== $this->options['width'] ) {
285
+				if (isset($this->options['width']) && '' !== $this->options['width']) {
286 286
 					$width = $this->options['width'];
287 287
 				}
288 288
 
289 289
 				$height = '768';
290 290
 
291
-				if ( isset( $this->options['height'] ) && '' !== $this->options['height'] ) {
291
+				if (isset($this->options['height']) && '' !== $this->options['height']) {
292 292
 					$height = $this->options['height'];
293 293
 				}
294 294
 
295 295
 				$cropping = 'w';
296 296
 
297
-				if ( isset( $this->options['cropping'] ) && '' !== $this->options['cropping'] ) {
297
+				if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
298 298
 					$cropping = $this->options['cropping'];
299 299
 				}
300 300
 
301
-				$this->image_scaling_url = 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
301
+				$this->image_scaling_url = 'https://wetu.com/ImageHandler/'.$cropping.$width.'x'.$height.'/';
302 302
 			}
303 303
 
304
-			if ( isset( $this->options ) && isset( $this->options['image_limit'] ) && '' !== $this->options['image_limit'] ) {
304
+			if (isset($this->options) && isset($this->options['image_limit']) && '' !== $this->options['image_limit']) {
305 305
 				$this->image_limit = $this->options['image_limit'];
306 306
 			}
307 307
 		}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * @since 1.0.0
325 325
 	 */
326 326
 	public static function compatible_version() {
327
-		if ( version_compare( PHP_VERSION, '5.6', '<' ) ) {
327
+		if (version_compare(PHP_VERSION, '5.6', '<')) {
328 328
 			return false;
329 329
 		}
330 330
 
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
 	 * @since 1.0.0
339 339
 	 */
340 340
 	public function compatible_version_check() {
341
-		if ( ! self::compatible_version() ) {
342
-			if ( is_plugin_active( plugin_basename( WETU_IMPORTER_CORE ) ) ) {
343
-				deactivate_plugins( plugin_basename( WETU_IMPORTER_CORE ) );
344
-				add_action( 'admin_notices', array( $this, 'compatible_version_notice' ) );
341
+		if (!self::compatible_version()) {
342
+			if (is_plugin_active(plugin_basename(WETU_IMPORTER_CORE))) {
343
+				deactivate_plugins(plugin_basename(WETU_IMPORTER_CORE));
344
+				add_action('admin_notices', array($this, 'compatible_version_notice'));
345 345
 
346
-				if ( isset( $_GET['activate'] ) ) {
347
-					unset( $_GET['activate'] );
346
+				if (isset($_GET['activate'])) {
347
+					unset($_GET['activate']);
348 348
 				}
349 349
 			}
350 350
 		}
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	public function compatible_version_notice() {
359 359
 		$class = 'notice notice-error';
360
-		$message = esc_html__( 'Wetu Importer Plugin requires PHP 5.6 or higher.', 'wetu-importer' );
361
-		printf( '<div class="%1$s"><p>%2$s</p></div>', esc_html( $class ), esc_html( $message ) );
360
+		$message = esc_html__('Wetu Importer Plugin requires PHP 5.6 or higher.', 'wetu-importer');
361
+		printf('<div class="%1$s"><p>%2$s</p></div>', esc_html($class), esc_html($message));
362 362
 	}
363 363
 
364 364
 	/**
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 	 * @since 1.0.0
369 369
 	 */
370 370
 	public static function compatible_version_check_on_activation() {
371
-		if ( ! self::compatible_version() ) {
372
-			deactivate_plugins( plugin_basename( WETU_IMPORTER_CORE ) );
373
-			wp_die( esc_html__( 'Wetu Importer Plugin requires PHP 5.6 or higher.', 'wetu-importer' ) );
371
+		if (!self::compatible_version()) {
372
+			deactivate_plugins(plugin_basename(WETU_IMPORTER_CORE));
373
+			wp_die(esc_html__('Wetu Importer Plugin requires PHP 5.6 or higher.', 'wetu-importer'));
374 374
 		}
375 375
 	}
376 376
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
      * Load the importer class you want to use
381 381
      */
382 382
 	public function load_class() {
383
-		switch ( $this->tab_slug ) {
383
+		switch ($this->tab_slug) {
384 384
 			case 'accommodation':
385 385
 				$this->current_importer = new WETU_Importer_Accommodation();
386 386
 				break;
@@ -403,27 +403,27 @@  discard block
 block discarded – undo
403 403
 	 * Registers the admin page which will house the importer form.
404 404
 	 */
405 405
 	public function register_importer_page() {
406
-		add_submenu_page( 'tour-operator',esc_html__( 'Importer', 'tour-operator' ), esc_html__( 'Importer', 'tour-operator' ), 'manage_options', 'wetu-importer', array( $this, 'display_page' ) );
406
+		add_submenu_page('tour-operator', esc_html__('Importer', 'tour-operator'), esc_html__('Importer', 'tour-operator'), 'manage_options', 'wetu-importer', array($this, 'display_page'));
407 407
 	}
408 408
 
409 409
 	/**
410 410
 	 * Enqueue the JS needed to contact wetu and return your result.
411 411
 	 */
412 412
 	public function admin_scripts() {
413
-		if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
413
+		if (defined('WP_DEBUG') && true === WP_DEBUG) {
414 414
 			$min = '';
415
-		} else {
415
+		}else {
416 416
 			$min = '.min';
417 417
 		}
418 418
 
419 419
 		$min = '';
420 420
 
421
-		if ( is_admin() && isset( $_GET['page'] ) && $this->plugin_slug === $_GET['page'] ) {
422
-			wp_enqueue_script( 'wetu-importers-script', WETU_IMPORTER_URL . 'assets/js/wetu-importer' . $min . '.js', array( 'jquery' ), WETU_IMPORTER_VER, true );
421
+		if (is_admin() && isset($_GET['page']) && $this->plugin_slug === $_GET['page']) {
422
+			wp_enqueue_script('wetu-importers-script', WETU_IMPORTER_URL.'assets/js/wetu-importer'.$min.'.js', array('jquery'), WETU_IMPORTER_VER, true);
423 423
 
424
-			wp_localize_script( 'wetu-importers-script', 'lsx_tour_importer_params', array(
425
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
426
-			) );
424
+			wp_localize_script('wetu-importers-script', 'lsx_tour_importer_params', array(
425
+				'ajax_url' => admin_url('admin-ajax.php'),
426
+			));
427 427
 		}
428 428
 	}
429 429
 
@@ -438,14 +438,14 @@  discard block
 block discarded – undo
438 438
 				screen_icon();
439 439
 			?>
440 440
 
441
-			<?php if ( ! is_object( $this->current_importer ) ) {
441
+			<?php if (!is_object($this->current_importer)) {
442 442
 				?>
443
-				<h2><?php esc_html_e( 'Welcome to the LSX Wetu Importer', 'wetu-importer' ); ?></h2>
443
+				<h2><?php esc_html_e('Welcome to the LSX Wetu Importer', 'wetu-importer'); ?></h2>
444 444
 				<p>If this is the first time you are running the import, then follow the steps below.</p>
445 445
 				<ul>
446
-					<li>Step 1 - Import your <a href="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>?page=<?php echo esc_attr( $this->plugin_slug ); ?>&tab=tour"><?php esc_html_e( 'Tours', 'wetu-importer' ); ?></a></li>
447
-					<li>Step 2 - The tour import will have created draft <a href="<?php echo esc_attr( admin_url( 'admin.php' ) ); ?>?page=<?php echo esc_attr( $this->plugin_slug ); ?>&tab=accommodation"><?php esc_html_e( 'accommodation', 'wetu-importer' ); ?></a> that will need to be imported.</li>
448
-					<li>Step 3 - Lastly import the <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', 'wetu-importer' ); ?></a> draft posts created during the previous two steps.</li>
446
+					<li>Step 1 - Import your <a href="<?php echo esc_url(admin_url('admin.php')); ?>?page=<?php echo esc_attr($this->plugin_slug); ?>&tab=tour"><?php esc_html_e('Tours', 'wetu-importer'); ?></a></li>
447
+					<li>Step 2 - The tour import will have created draft <a href="<?php echo esc_attr(admin_url('admin.php')); ?>?page=<?php echo esc_attr($this->plugin_slug); ?>&tab=accommodation"><?php esc_html_e('accommodation', 'wetu-importer'); ?></a> that will need to be imported.</li>
448
+					<li>Step 3 - Lastly import the <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', 'wetu-importer'); ?></a> draft posts created during the previous two steps.</li>
449 449
 				</ul>
450 450
 
451 451
 				<?php /*<h3><?php esc_html_e('Additional Tools', 'wetu-importer'); ?></h3>
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 					<?php } ?>
457 457
                 </ul>
458 458
 				<?php*/
459
-			} else {
459
+			}else {
460 460
 				$this->current_importer->display_page();
461 461
 			}; ?>
462 462
 		</div>
@@ -468,42 +468,42 @@  discard block
 block discarded – undo
468 468
 	 */
469 469
 	public function search_form() {
470 470
 		?>
471
-		<form class="ajax-form" id="<?php echo esc_attr( $this->plugin_slug ); ?>-search-form" method="get" action="tools.php" data-type="<?php echo esc_attr( $this->tab_slug ); ?>">
472
-			<input type="hidden" name="page" value="<?php echo esc_attr( $this->tab_slug ); ?>" />
471
+		<form class="ajax-form" id="<?php echo esc_attr($this->plugin_slug); ?>-search-form" method="get" action="tools.php" data-type="<?php echo esc_attr($this->tab_slug); ?>">
472
+			<input type="hidden" name="page" value="<?php echo esc_attr($this->tab_slug); ?>" />
473 473
 
474
-			<h3><span class="dashicons dashicons-search"></span> <?php esc_html_e( 'Search', 'wetu-importer' ); ?></h3>
474
+			<h3><span class="dashicons dashicons-search"></span> <?php esc_html_e('Search', 'wetu-importer'); ?></h3>
475 475
 
476
-			<?php do_action( 'wetu_importer_search_form',$this ); ?>
476
+			<?php do_action('wetu_importer_search_form', $this); ?>
477 477
 
478 478
 			<div class="normal-search">
479
-				<input pattern=".{3,}" placeholder="3 characters minimum" class="keyword" name="keyword" value=""> <input class="button button-primary submit" type="submit" value="<?php esc_html_e( 'Search', 'wetu-importer' ); ?>" />
479
+				<input pattern=".{3,}" placeholder="3 characters minimum" class="keyword" name="keyword" value=""> <input class="button button-primary submit" type="submit" value="<?php esc_html_e('Search', 'wetu-importer'); ?>" />
480 480
 			</div>
481 481
 
482 482
 			<div class="advanced-search hidden" style="display:none;">
483
-				<p><?php esc_html_e( 'Enter several keywords, each on a new line.', 'wetu-importer' ); ?></p>
483
+				<p><?php esc_html_e('Enter several keywords, each on a new line.', 'wetu-importer'); ?></p>
484 484
 				<textarea rows="10" cols="40" name="bulk-keywords"></textarea>
485
-				<input class="button button-primary submit" type="submit" value="<?php esc_attr_e( 'Search', 'wetu-importer' ); ?>" />
485
+				<input class="button button-primary submit" type="submit" value="<?php esc_attr_e('Search', 'wetu-importer'); ?>" />
486 486
 			</div>
487 487
 
488 488
 			<p>
489
-				<a class="advanced-search-toggle" href="#"><?php esc_html_e( 'Bulk Search', 'wetu-importer' ); ?></a> |
490
-				<a class="published search-toggle" href="#publish"><?php esc_attr_e( 'Published', 'wetu-importer' ); ?></a> |
491
-				<a class="pending search-toggle"  href="#pending"><?php esc_attr_e( 'Pending', 'wetu-importer' ); ?></a> |
492
-				<a class="draft search-toggle"  href="#draft"><?php esc_attr_e( 'Draft', 'wetu-importer' ); ?></a>
493
-
494
-				<?php if ( 'tour' === $this->tab_slug ) { ?>
495
-					| <a class="import search-toggle"  href="#import"><?php esc_attr_e( 'WETU', 'wetu-importer' ); ?></a>
496
-				<?php } else if ( ! empty( $this->queued_imports ) ) { ?>
497
-					| <a class="import search-toggle"  href="#import"><?php esc_attr_e( 'WETU Queue', 'wetu-importer' ); ?></a>
489
+				<a class="advanced-search-toggle" href="#"><?php esc_html_e('Bulk Search', 'wetu-importer'); ?></a> |
490
+				<a class="published search-toggle" href="#publish"><?php esc_attr_e('Published', 'wetu-importer'); ?></a> |
491
+				<a class="pending search-toggle"  href="#pending"><?php esc_attr_e('Pending', 'wetu-importer'); ?></a> |
492
+				<a class="draft search-toggle"  href="#draft"><?php esc_attr_e('Draft', 'wetu-importer'); ?></a>
493
+
494
+				<?php if ('tour' === $this->tab_slug) { ?>
495
+					| <a class="import search-toggle"  href="#import"><?php esc_attr_e('WETU', 'wetu-importer'); ?></a>
496
+				<?php }else if (!empty($this->queued_imports)) { ?>
497
+					| <a class="import search-toggle"  href="#import"><?php esc_attr_e('WETU Queue', 'wetu-importer'); ?></a>
498 498
 				<?php } ?>
499 499
 			</p>
500 500
 
501 501
 			<div class="ajax-loader" style="display:none;width:100%;text-align:center;">
502
-				<img style="width:64px;" src="<?php echo esc_url( WETU_IMPORTER_URL . 'assets/images/ajaxloader.gif' ); ?>" />
502
+				<img style="width:64px;" src="<?php echo esc_url(WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'); ?>" />
503 503
 			</div>
504 504
 
505 505
 			<div class="ajax-loader-small" style="display:none;width:100%;text-align:center;">
506
-				<img style="width:32px;" src="<?php echo esc_url( WETU_IMPORTER_URL . 'assets/images/ajaxloader.gif' ); ?>" />
506
+				<img style="width:32px;" src="<?php echo esc_url(WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'); ?>" />
507 507
 			</div>
508 508
 		</form>
509 509
 		<?php
@@ -552,19 +552,19 @@  discard block
 block discarded – undo
552 552
 	 *
553 553
 	 * @param $tab string
554 554
 	 */
555
-	public function navigation( $tab = '' ) {
555
+	public function navigation($tab = '') {
556 556
 		$post_types = array(
557
-			'tour'              => esc_attr( 'Tours', 'wetu-importer' ),
558
-			'accommodation'     => esc_attr( 'Accommodation', 'wetu-importer' ),
559
-			'destination'       => esc_attr( 'Destinations', 'wetu-importer' ),
557
+			'tour'              => esc_attr('Tours', 'wetu-importer'),
558
+			'accommodation'     => esc_attr('Accommodation', 'wetu-importer'),
559
+			'destination'       => esc_attr('Destinations', 'wetu-importer'),
560 560
 		);
561 561
 
562 562
 		// @codingStandardsIgnoreLine
563
-		echo '<div class="wet-navigation"><div class="subsubsub"><a class="' . $this->itemd( $tab, '', 'current', false ) . '" href="' . admin_url( 'admin.php' ) . '?page=' . $this->plugin_slug . '">' . esc_attr__( 'Home', 'wetu-importer' ) . '</a>';
563
+		echo '<div class="wet-navigation"><div class="subsubsub"><a class="'.$this->itemd($tab, '', 'current', false).'" href="'.admin_url('admin.php').'?page='.$this->plugin_slug.'">'.esc_attr__('Home', 'wetu-importer').'</a>';
564 564
 
565
-		foreach ( $post_types as $post_type => $label ) {
565
+		foreach ($post_types as $post_type => $label) {
566 566
 			// @codingStandardsIgnoreLine
567
-			echo ' | <a class="' . $this->itemd( $tab, $post_type, 'current', false ) . '" href="' . admin_url( 'admin.php' ) . '?page=' . $this->plugin_slug . '&tab=' . $post_type . '">' . $label . '</a>';
567
+			echo ' | <a class="'.$this->itemd($tab, $post_type, 'current', false).'" href="'.admin_url('admin.php').'?page='.$this->plugin_slug.'&tab='.$post_type.'">'.$label.'</a>';
568 568
 		}
569 569
 
570 570
 		echo '</div><br clear="both"/></div>';
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	/**
574 574
 	 * set_taxonomy with some terms
575 575
 	 */
576
-	public function team_member_checkboxes( $selected = array() ) {
577
-		if ( post_type_exists( 'team' ) ) { ?>
576
+	public function team_member_checkboxes($selected = array()) {
577
+		if (post_type_exists('team')) { ?>
578 578
 			<ul>
579 579
 				<?php
580 580
 					$team_args = array(
@@ -584,15 +584,15 @@  discard block
 block discarded – undo
584 584
 						'fields' => 'ids',
585 585
 					);
586 586
 
587
-					$team_members = new WP_Query( $team_args );
587
+					$team_members = new WP_Query($team_args);
588 588
 
589
-					if ( $team_members->have_posts() ) {
590
-						foreach ( $team_members->posts as $member ) {
589
+					if ($team_members->have_posts()) {
590
+						foreach ($team_members->posts as $member) {
591 591
 							// @codingStandardsIgnoreLine ?>
592
-							<li><input class="team" <?php $this->checked( $selected, $member ); ?> type="checkbox" value="<?php echo $member; ?>" /> <?php echo get_the_title( $member ); ?></li>
592
+							<li><input class="team" <?php $this->checked($selected, $member); ?> type="checkbox" value="<?php echo $member; ?>" /> <?php echo get_the_title($member); ?></li>
593 593
 						<?php }
594
-					} else { ?>
595
-						<li><input class="team" type="checkbox" value="0" /> <?php esc_html_e( 'None', 'wetu-importer' ); ?></li>
594
+					}else { ?>
595
+						<li><input class="team" type="checkbox" value="0" /> <?php esc_html_e('None', 'wetu-importer'); ?></li>
596 596
 					<?php }
597 597
 				?>
598 598
 			</ul>
@@ -609,14 +609,14 @@  discard block
 block discarded – undo
609 609
 	 * @param $needle string
610 610
 	 * @param $echo bool
611 611
 	 */
612
-	public function checked( $haystack = false, $needle = '', $echo = true ) {
613
-		$return = $this->itemd( $haystack,$needle, 'checked' );
612
+	public function checked($haystack = false, $needle = '', $echo = true) {
613
+		$return = $this->itemd($haystack, $needle, 'checked');
614 614
 
615
-		if ( '' !== $return ) {
616
-			if ( true === $echo ) {
615
+		if ('' !== $return) {
616
+			if (true === $echo) {
617 617
 				// @codingStandardsIgnoreLine
618 618
 				echo $return;
619
-			} else {
619
+			}else {
620 620
 				return $return;
621 621
 			}
622 622
 		}
@@ -629,14 +629,14 @@  discard block
 block discarded – undo
629 629
 	 * @param $needle string
630 630
 	 * @param $echo bool
631 631
 	 */
632
-	public function selected( $haystack = false, $needle = '', $echo = true ) {
633
-		$return = $this->itemd( $haystack,$needle,'selected' );
632
+	public function selected($haystack = false, $needle = '', $echo = true) {
633
+		$return = $this->itemd($haystack, $needle, 'selected');
634 634
 
635
-		if ( '' !== $return ) {
636
-			if ( true === $echo ) {
635
+		if ('' !== $return) {
636
+			if (true === $echo) {
637 637
 				// @codingStandardsIgnoreLine
638 638
 				echo $return;
639
-			} else {
639
+			}else {
640 640
 				return $return;
641 641
 			}
642 642
 		}
@@ -651,17 +651,17 @@  discard block
 block discarded – undo
651 651
 	 * @param $wrap bool
652 652
 	 * @return $html string
653 653
 	 */
654
-	public function itemd( $haystack = false, $needle = '', $type = '', $wrap = true ) {
654
+	public function itemd($haystack = false, $needle = '', $type = '', $wrap = true) {
655 655
 		$html = '';
656 656
 
657
-		if ( '' !== $type ) {
658
-			if ( ! is_array( $haystack ) ) {
659
-				$haystack = array( $haystack );
657
+		if ('' !== $type) {
658
+			if (!is_array($haystack)) {
659
+				$haystack = array($haystack);
660 660
 			}
661
-			if ( in_array( $needle, $haystack ) ) {
662
-				if ( true === $wrap || 'true' === $wrap ) {
663
-					$html = $type . '="' . $type . '"';
664
-				} else {
661
+			if (in_array($needle, $haystack)) {
662
+				if (true === $wrap || 'true' === $wrap) {
663
+					$html = $type.'="'.$type.'"';
664
+				}else {
665 665
 					$html = $type;
666 666
 				}
667 667
 			}
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
 	/**
674 674
 	 * grabs any attachments for the current item
675 675
 	 */
676
-	public function find_attachments( $id = false ) {
677
-		if ( false !== $id ) {
678
-			if ( empty( $this->found_attachments ) ) {
676
+	public function find_attachments($id = false) {
677
+		if (false !== $id) {
678
+			if (empty($this->found_attachments)) {
679 679
 				$attachments_args = array(
680 680
 					'post_parent' => $id,
681 681
 					'post_status' => 'inherit',
@@ -685,11 +685,11 @@  discard block
 block discarded – undo
685 685
 					'posts_per_page' => '-1',
686 686
 				);
687 687
 
688
-				$attachments = new WP_Query( $attachments_args );
688
+				$attachments = new WP_Query($attachments_args);
689 689
 
690
-				if ( $attachments->have_posts() ) {
691
-					foreach ( $attachments->posts as $attachment ) {
692
-						$this->found_attachments[ $attachment->ID ] = str_replace( array( '.jpg', '.png', '.jpeg' ),'',$attachment->post_title );
690
+				if ($attachments->have_posts()) {
691
+					foreach ($attachments->posts as $attachment) {
692
+						$this->found_attachments[$attachment->ID] = str_replace(array('.jpg', '.png', '.jpeg'), '', $attachment->post_title);
693 693
 						//$this->gallery_meta[] = $attachment->ID;
694 694
 					}
695 695
 				}
@@ -702,19 +702,19 @@  discard block
 block discarded – undo
702 702
 	/**
703 703
 	 * Saves the room data
704 704
 	 */
705
-	public function save_custom_field( $value = false, $meta_key, $id, $decrease = false, $unique = true ) {
706
-		if ( false !== $value ) {
707
-			if ( false !== $decrease ) {
708
-				$value = intval( $value );
705
+	public function save_custom_field($value = false, $meta_key, $id, $decrease = false, $unique = true) {
706
+		if (false !== $value) {
707
+			if (false !== $decrease) {
708
+				$value = intval($value);
709 709
 				$value--;
710 710
 			}
711 711
 
712
-			$prev = get_post_meta( $id,$meta_key,true );
712
+			$prev = get_post_meta($id, $meta_key, true);
713 713
 
714
-			if ( false !== $id && '0' !== $id && false !== $prev && true === $unique ) {
715
-				update_post_meta( $id,$meta_key,$value,$prev );
716
-			} else {
717
-				add_post_meta( $id,$meta_key,$value,$unique );
714
+			if (false !== $id && '0' !== $id && false !== $prev && true === $unique) {
715
+				update_post_meta($id, $meta_key, $value, $prev);
716
+			}else {
717
+				add_post_meta($id, $meta_key, $value, $unique);
718 718
 			}
719 719
 		}
720 720
 	}
@@ -723,15 +723,15 @@  discard block
 block discarded – undo
723 723
 	 * Grabs the custom fields,  and resaves an array of unique items.
724 724
 	 */
725 725
 	public function cleanup_posts() {
726
-		if ( ! empty( $this->cleanup_posts ) ) {
726
+		if (!empty($this->cleanup_posts)) {
727 727
 
728
-			foreach ( $this->cleanup_posts as $id => $key ) {
729
-				$prev_items = get_post_meta( $id, $key, false );
730
-				$new_items = array_unique( $prev_items );
731
-				delete_post_meta( $id, $key );
728
+			foreach ($this->cleanup_posts as $id => $key) {
729
+				$prev_items = get_post_meta($id, $key, false);
730
+				$new_items = array_unique($prev_items);
731
+				delete_post_meta($id, $key);
732 732
 
733
-				foreach ( $new_items as $new_item ) {
734
-					add_post_meta( $id, $key, $new_item, false );
733
+				foreach ($new_items as $new_item) {
734
+					add_post_meta($id, $key, $new_item, false);
735 735
 				}
736 736
 			}
737 737
 		}
@@ -742,52 +742,52 @@  discard block
 block discarded – undo
742 742
 	/**
743 743
 	 * set_taxonomy with some terms
744 744
 	 */
745
-	public function set_taxonomy( $taxonomy, $terms, $id ) {
745
+	public function set_taxonomy($taxonomy, $terms, $id) {
746 746
 		$result = array();
747 747
 
748
-		if ( ! empty( $data ) ) {
749
-			foreach ( $data as $k ) {
750
-				if ( $id ) {
748
+		if (!empty($data)) {
749
+			foreach ($data as $k) {
750
+				if ($id) {
751 751
 					// @codingStandardsIgnoreLine
752
-					if ( ! $term = term_exists( trim( $k ), $tax ) ) {
753
-						$term = wp_insert_term( trim( $k ), $tax );
752
+					if (!$term = term_exists(trim($k), $tax)) {
753
+						$term = wp_insert_term(trim($k), $tax);
754 754
 
755
-						if ( is_wp_error( $term ) ) {
755
+						if (is_wp_error($term)) {
756 756
 							// @codingStandardsIgnoreLine
757 757
 							echo $term->get_error_message();
758
-						} else {
759
-							wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
758
+						}else {
759
+							wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
760 760
 						}
761
-					} else {
762
-						wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
761
+					}else {
762
+						wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
763 763
 					}
764
-				} else {
765
-					$result[] = trim( $k );
764
+				}else {
765
+					$result[] = trim($k);
766 766
 				}
767 767
 			}
768 768
 		}
769 769
 		return $result;
770 770
 	}
771 771
 
772
-	public function set_term( $id = false, $name = false, $taxonomy = false, $parent = false ) {
772
+	public function set_term($id = false, $name = false, $taxonomy = false, $parent = false) {
773 773
 		// @codingStandardsIgnoreLine
774
-		if ( ! $term = term_exists( $name, $taxonomy ) ) {
775
-			if ( false !== $parent ) {
774
+		if (!$term = term_exists($name, $taxonomy)) {
775
+			if (false !== $parent) {
776 776
 				$parent = array(
777 777
 					'parent' => $parent,
778 778
 				);
779 779
 			}
780 780
 
781
-			$term = wp_insert_term( trim( $name ), $taxonomy,$parent );
781
+			$term = wp_insert_term(trim($name), $taxonomy, $parent);
782 782
 
783
-			if ( is_wp_error( $term ) ) {
783
+			if (is_wp_error($term)) {
784 784
 				// @codingStandardsIgnoreLine
785 785
 				echo $term->get_error_message();
786
-			} else {
787
-				wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
786
+			}else {
787
+				wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
788 788
 			}
789
-		} else {
790
-			wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
789
+		}else {
790
+			wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
791 791
 		}
792 792
 
793 793
 		return $term['term_id'];
@@ -796,22 +796,22 @@  discard block
 block discarded – undo
796 796
 	/**
797 797
 	 * set_taxonomy with some terms
798 798
 	 */
799
-	public function taxonomy_checkboxes( $taxonomy = false, $selected = array() ) {
799
+	public function taxonomy_checkboxes($taxonomy = false, $selected = array()) {
800 800
 		$return = '';
801 801
 
802
-		if ( false !== $taxonomy ) {
802
+		if (false !== $taxonomy) {
803 803
 			$return .= '<ul>';
804
-			$terms = get_terms( array(
804
+			$terms = get_terms(array(
805 805
 				'taxonomy' => $taxonomy,
806 806
 				'hide_empty' => false,
807
-			) );
807
+			));
808 808
 
809
-			if ( ! is_wp_error( $terms ) ) {
810
-				foreach ( $terms as $term ) {
811
-					$return .= '<li><input class="' . $taxonomy . '" ' . $this->checked( $selected,$term->term_id,false ) . ' type="checkbox" value="' . $term->term_id . '" /> ' . $term->name . '</li>';
809
+			if (!is_wp_error($terms)) {
810
+				foreach ($terms as $term) {
811
+					$return .= '<li><input class="'.$taxonomy.'" '.$this->checked($selected, $term->term_id, false).' type="checkbox" value="'.$term->term_id.'" /> '.$term->name.'</li>';
812 812
 				}
813
-			} else {
814
-				$return .= '<li><input type="checkbox" value="" /> ' . __( 'None', 'wetu-importer' ) . '</li>';
813
+			}else {
814
+				$return .= '<li><input type="checkbox" value="" /> '.__('None', 'wetu-importer').'</li>';
815 815
 			}
816 816
 
817 817
 			$return .= '</ul>';
@@ -825,44 +825,44 @@  discard block
 block discarded – undo
825 825
 	/**
826 826
 	 * Saves the longitude and lattitude, as well as sets the map marker.
827 827
 	 */
828
-	public function set_map_data( $data, $id, $zoom = '10' ) {
828
+	public function set_map_data($data, $id, $zoom = '10') {
829 829
 		$longitude = false;
830 830
 		$latitude = false;
831 831
 		$address = false;
832 832
 
833
-		if ( isset( $data[0]['position'] ) ) {
834
-			if ( isset( $data[0]['position']['driving_latitude'] ) ) {
833
+		if (isset($data[0]['position'])) {
834
+			if (isset($data[0]['position']['driving_latitude'])) {
835 835
 				$latitude = $data[0]['position']['driving_latitude'];
836
-			} elseif ( isset( $data[0]['position']['latitude'] ) ) {
836
+			} elseif (isset($data[0]['position']['latitude'])) {
837 837
 				$latitude = $data[0]['position']['latitude'];
838 838
 			}
839 839
 
840
-			if ( isset( $data[0]['position']['driving_longitude'] ) ) {
840
+			if (isset($data[0]['position']['driving_longitude'])) {
841 841
 				$longitude = $data[0]['position']['driving_longitude'];
842
-			} elseif ( isset( $data[0]['position']['longitude'] ) ) {
842
+			} elseif (isset($data[0]['position']['longitude'])) {
843 843
 				$longitude = $data[0]['position']['longitude'];
844 844
 			}
845 845
 		}
846 846
 
847
-		if ( isset( $data[0]['content'] ) && isset( $data[0]['content']['contact_information'] ) ) {
848
-			if ( isset( $data[0]['content']['contact_information']['address'] ) ) {
849
-				$address = strip_tags( $data[0]['content']['contact_information']['address'] );
850
-				$address = explode( "\n", $address );
847
+		if (isset($data[0]['content']) && isset($data[0]['content']['contact_information'])) {
848
+			if (isset($data[0]['content']['contact_information']['address'])) {
849
+				$address = strip_tags($data[0]['content']['contact_information']['address']);
850
+				$address = explode("\n", $address);
851 851
 
852
-				foreach ( $address as $bitkey => $bit ) {
853
-					$bit = ltrim( rtrim( $bit ) );
852
+				foreach ($address as $bitkey => $bit) {
853
+					$bit = ltrim(rtrim($bit));
854 854
 
855
-					if ( false === $bit || '' === $bit || null === $bit || empty( $bit ) ) {
856
-						unset( $address[ $bitkey ] );
855
+					if (false === $bit || '' === $bit || null === $bit || empty($bit)) {
856
+						unset($address[$bitkey]);
857 857
 					}
858 858
 				}
859 859
 
860
-				$address = implode( ', ',$address );
861
-				$address = str_replace( ', , ', ', ', $address );
860
+				$address = implode(', ', $address);
861
+				$address = str_replace(', , ', ', ', $address);
862 862
 			}
863 863
 		}
864 864
 
865
-		if ( false !== $longitude ) {
865
+		if (false !== $longitude) {
866 866
 			$location_data = array(
867 867
 				'address'	=> (string) $address,
868 868
 				'lat'		=> (string) $latitude,
@@ -871,11 +871,11 @@  discard block
 block discarded – undo
871 871
 				'elevation'	=> '',
872 872
 			);
873 873
 
874
-			if ( false !== $id && '0' !== $id ) {
875
-				$prev = get_post_meta( $id,'location',true );
876
-				update_post_meta( $id,'location',$location_data,$prev );
877
-			} else {
878
-				add_post_meta( $id,'location',$location_data,true );
874
+			if (false !== $id && '0' !== $id) {
875
+				$prev = get_post_meta($id, 'location', true);
876
+				update_post_meta($id, 'location', $location_data, $prev);
877
+			}else {
878
+				add_post_meta($id, 'location', $location_data, true);
879 879
 			}
880 880
 		}
881 881
 	}
@@ -885,17 +885,17 @@  discard block
 block discarded – undo
885 885
 	/**
886 886
 	 * Creates the main gallery data
887 887
 	 */
888
-	public function set_featured_image( $data, $id ) {
889
-		if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
890
-			$this->featured_image = $this->attach_image( $data[0]['content']['images'][0], $id,  array(
888
+	public function set_featured_image($data, $id) {
889
+		if (is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])) {
890
+			$this->featured_image = $this->attach_image($data[0]['content']['images'][0], $id, array(
891 891
 				'width' => '800',
892 892
 				'height' => '600',
893 893
 				'cropping' => 'h',
894
-			) );
894
+			));
895 895
 
896
-			if ( false !== $this->featured_image ) {
897
-				delete_post_meta( $id,'_thumbnail_id' );
898
-				add_post_meta( $id,'_thumbnail_id',$this->featured_image,true );
896
+			if (false !== $this->featured_image) {
897
+				delete_post_meta($id, '_thumbnail_id');
898
+				add_post_meta($id, '_thumbnail_id', $this->featured_image, true);
899 899
 			}
900 900
 		}
901 901
 	}
@@ -903,26 +903,26 @@  discard block
 block discarded – undo
903 903
 	/**
904 904
 	 * Sets a banner image
905 905
 	 */
906
-	public function set_banner_image( $data, $id, $content = array( 'none' ) ) {
907
-		if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
908
-			if ( in_array( 'unique_banner_image', $content ) && isset( $data[0]['destination_image'] ) && is_array( $data[0]['destination_image'] ) ) {
909
-				$temp_banner = $this->attach_image( $data[0]['destination_image'], $id, array(
906
+	public function set_banner_image($data, $id, $content = array('none')) {
907
+		if (is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])) {
908
+			if (in_array('unique_banner_image', $content) && isset($data[0]['destination_image']) && is_array($data[0]['destination_image'])) {
909
+				$temp_banner = $this->attach_image($data[0]['destination_image'], $id, array(
910 910
 					'width' => '1920',
911 911
 					'height' => '600',
912 912
 					'cropping' => 'c',
913 913
 				));
914
-			} else {
915
-				$temp_banner = $this->attach_image( $data[0]['content']['images'][1], $id, array(
914
+			}else {
915
+				$temp_banner = $this->attach_image($data[0]['content']['images'][1], $id, array(
916 916
 					'width' => '1920',
917 917
 					'height' => '600',
918 918
 					'cropping' => 'c',
919 919
 				));
920 920
 			}
921 921
 
922
-			if ( false !== $temp_banner ) {
922
+			if (false !== $temp_banner) {
923 923
 				$this->banner_image = $temp_banner;
924 924
 
925
-				delete_post_meta( $id,'image_group' );
925
+				delete_post_meta($id, 'image_group');
926 926
 
927 927
 				$new_banner = array(
928 928
 					'banner_image' => array(
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 					),
931 931
 				);
932 932
 
933
-				add_post_meta( $id,'image_group',$new_banner,true );
933
+				add_post_meta($id, 'image_group', $new_banner, true);
934 934
 			}
935 935
 		}
936 936
 	}
@@ -938,17 +938,17 @@  discard block
 block discarded – undo
938 938
 	/**
939 939
 	 * Creates the main gallery data
940 940
 	 */
941
-	public function create_main_gallery( $data, $id ) {
942
-		if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
943
-			if ( isset( $this->options['image_replacing'] ) && 'on' === $this->options['image_replacing'] ) {
944
-				$current_gallery = get_post_meta( $id, 'gallery', false );
941
+	public function create_main_gallery($data, $id) {
942
+		if (is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])) {
943
+			if (isset($this->options['image_replacing']) && 'on' === $this->options['image_replacing']) {
944
+				$current_gallery = get_post_meta($id, 'gallery', false);
945 945
 
946
-				if ( false !== $current_gallery && ! empty( $current_gallery ) ) {
947
-					foreach ( $current_gallery as $g ) {
948
-						delete_post_meta( $id,'gallery', $g );
946
+				if (false !== $current_gallery && !empty($current_gallery)) {
947
+					foreach ($current_gallery as $g) {
948
+						delete_post_meta($id, 'gallery', $g);
949 949
 
950
-						if ( 'attachment' === get_post_type( $g ) ) {
951
-							wp_delete_attachment( $g, true );
950
+						if ('attachment' === get_post_type($g)) {
951
+							wp_delete_attachment($g, true);
952 952
 						}
953 953
 					}
954 954
 				}
@@ -956,32 +956,32 @@  discard block
 block discarded – undo
956 956
 
957 957
 			$counter = 0;
958 958
 
959
-			foreach ( $data[0]['content']['images'] as $image_data ) {
960
-				if ( ( 0 === $counter && false !== $this->featured_image ) || ( 1 === $counter && false !== $this->banner_image ) ) {
959
+			foreach ($data[0]['content']['images'] as $image_data) {
960
+				if ((0 === $counter && false !== $this->featured_image) || (1 === $counter && false !== $this->banner_image)) {
961 961
 					$counter++;
962 962
 
963
-					if ( false !== $this->image_limit && false !== $this->image_limit ) {
963
+					if (false !== $this->image_limit && false !== $this->image_limit) {
964 964
 						$this->image_limit++;
965 965
 					}
966 966
 
967 967
 					continue;
968 968
 				}
969 969
 
970
-				if ( false !== $this->image_limit && $counter >= $this->image_limit ) {
970
+				if (false !== $this->image_limit && $counter >= $this->image_limit) {
971 971
 					continue;
972 972
 				}
973 973
 
974
-				$this->gallery_meta[] = $this->attach_image( $image_data,$id );
974
+				$this->gallery_meta[] = $this->attach_image($image_data, $id);
975 975
 				$counter++;
976 976
 			}
977 977
 
978
-			if ( ! empty( $this->gallery_meta ) ) {
979
-				delete_post_meta( $id,'gallery' );
980
-				$this->gallery_meta = array_unique( $this->gallery_meta );
978
+			if (!empty($this->gallery_meta)) {
979
+				delete_post_meta($id, 'gallery');
980
+				$this->gallery_meta = array_unique($this->gallery_meta);
981 981
 
982
-				foreach ( $this->gallery_meta as $gallery_id ) {
983
-					if ( false !== $gallery_id && '' !== $gallery_id && ! is_array( $gallery_id ) ) {
984
-						add_post_meta( $id,'gallery',$gallery_id,false );
982
+				foreach ($this->gallery_meta as $gallery_id) {
983
+					if (false !== $gallery_id && '' !== $gallery_id && !is_array($gallery_id)) {
984
+						add_post_meta($id, 'gallery', $gallery_id, false);
985 985
 					}
986 986
 				}
987 987
 			}
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 	/**
992 992
 	 * search_form
993 993
 	 */
994
-	public function get_scaling_url( $args = array() ) {
994
+	public function get_scaling_url($args = array()) {
995 995
 		$defaults = array(
996 996
 			'width' => '1024',
997 997
 			'height' => '768',
@@ -999,59 +999,59 @@  discard block
 block discarded – undo
999 999
 			'cropping' => 'h',
1000 1000
 		);
1001 1001
 
1002
-		if ( false !== $this->options ) {
1003
-			if ( isset( $this->options['width'] ) && '' !== $this->options['width'] ) {
1002
+		if (false !== $this->options) {
1003
+			if (isset($this->options['width']) && '' !== $this->options['width']) {
1004 1004
 				$defaults['width'] = $this->options['width'];
1005 1005
 			}
1006 1006
 
1007
-			if ( isset( $this->options['height'] ) && '' !== $this->options['height'] ) {
1007
+			if (isset($this->options['height']) && '' !== $this->options['height']) {
1008 1008
 				$defaults['height'] = $this->options['height'];
1009 1009
 			}
1010 1010
 
1011
-			if ( isset( $this->options['cropping'] ) && '' !== $this->options['cropping'] ) {
1011
+			if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
1012 1012
 				$defaults['cropping'] = $this->options['cropping'];
1013 1013
 			}
1014 1014
 		}
1015 1015
 
1016
-		$args = wp_parse_args( $args, $defaults );
1016
+		$args = wp_parse_args($args, $defaults);
1017 1017
 		$cropping = $args['cropping'];
1018 1018
 		$width = $args['width'];
1019 1019
 		$height = $args['height'];
1020 1020
 
1021
-		return 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
1021
+		return 'https://wetu.com/ImageHandler/'.$cropping.$width.'x'.$height.'/';
1022 1022
 	}
1023 1023
 
1024 1024
 	/**
1025 1025
 	 * Attaches 1 image
1026 1026
 	 */
1027
-	public function attach_image( $v = false, $parent_id, $image_sizes = false, $banner = false ) {
1028
-		if ( false !== $v ) {
1029
-			$temp_fragment = explode( '/',$v['url_fragment'] );
1030
-			$url_filename = $temp_fragment[ count( $temp_fragment ) -1 ];
1031
-			$url_filename = str_replace( array( '.jpg', '.png', '.jpeg' ),'',$url_filename );
1032
-			$url_filename = trim( $url_filename );
1027
+	public function attach_image($v = false, $parent_id, $image_sizes = false, $banner = false) {
1028
+		if (false !== $v) {
1029
+			$temp_fragment = explode('/', $v['url_fragment']);
1030
+			$url_filename = $temp_fragment[count($temp_fragment) - 1];
1031
+			$url_filename = str_replace(array('.jpg', '.png', '.jpeg'), '', $url_filename);
1032
+			$url_filename = trim($url_filename);
1033 1033
 			$title = $url_filename;
1034
-			$url_filename = str_replace( ' ','_',$url_filename );
1034
+			$url_filename = str_replace(' ', '_', $url_filename);
1035 1035
 
1036
-			if ( ! isset( $this->options['image_replacing'] ) && in_array( $url_filename, $this->found_attachments ) ) {
1037
-				return array_search( $url_filename,$this->found_attachments );
1036
+			if (!isset($this->options['image_replacing']) && in_array($url_filename, $this->found_attachments)) {
1037
+				return array_search($url_filename, $this->found_attachments);
1038 1038
 			}
1039 1039
 
1040 1040
 			$postdata = array();
1041 1041
 
1042
-			if ( empty( $v['label'] ) ) {
1042
+			if (empty($v['label'])) {
1043 1043
 				$v['label'] = '';
1044 1044
 			}
1045 1045
 
1046
-			if ( ! empty( $v['description'] ) ) {
1047
-				$desc = wp_strip_all_tags( $v['description'] );
1046
+			if (!empty($v['description'])) {
1047
+				$desc = wp_strip_all_tags($v['description']);
1048 1048
 				$posdata = array(
1049 1049
 					'post_excerpt' => $desc,
1050 1050
 				);
1051 1051
 			}
1052 1052
 
1053
-			if ( ! empty( $v['section'] ) ) {
1054
-				$desc = wp_strip_all_tags( $v['section'] );
1053
+			if (!empty($v['section'])) {
1054
+				$desc = wp_strip_all_tags($v['section']);
1055 1055
 				$posdata = array(
1056 1056
 					'post_excerpt' => $desc,
1057 1057
 				);
@@ -1059,88 +1059,88 @@  discard block
 block discarded – undo
1059 1059
 
1060 1060
 			$attach_id = null;
1061 1061
 			//Resizor - add option to setting if required
1062
-			$fragment = str_replace( ' ','%20',$v['url_fragment'] );
1063
-			$url = $this->get_scaling_url( $image_sizes ) . $fragment;
1062
+			$fragment = str_replace(' ', '%20', $v['url_fragment']);
1063
+			$url = $this->get_scaling_url($image_sizes).$fragment;
1064 1064
 
1065
-			$attach_id = $this->attach_external_image2( $url,$parent_id,'',$v['label'],$postdata );
1065
+			$attach_id = $this->attach_external_image2($url, $parent_id, '', $v['label'], $postdata);
1066 1066
 
1067
-			$this->found_attachments[ $attach_id ] = $url_filename;
1067
+			$this->found_attachments[$attach_id] = $url_filename;
1068 1068
 
1069 1069
 			//echo($attach_id.' add image');
1070
-			if ( ! empty( $attach_id ) ) {
1070
+			if (!empty($attach_id)) {
1071 1071
 				return $attach_id;
1072 1072
 			}
1073 1073
 		}
1074 1074
 		return 	false;
1075 1075
 	}
1076 1076
 
1077
-	public function attach_external_image2( $url = null, $post_id = null, $thumb = null, $filename = null, $post_data = array() ) {
1078
-		if ( ! $url || ! $post_id ) { return new WP_Error( 'missing', 'Need a valid URL and post ID...' ); }
1077
+	public function attach_external_image2($url = null, $post_id = null, $thumb = null, $filename = null, $post_data = array()) {
1078
+		if (!$url || !$post_id) { return new WP_Error('missing', 'Need a valid URL and post ID...'); }
1079 1079
 
1080
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
1081
-		require_once( ABSPATH . 'wp-admin/includes/media.php' );
1082
-		require_once( ABSPATH . 'wp-admin/includes/image.php' );
1080
+		require_once(ABSPATH.'wp-admin/includes/file.php');
1081
+		require_once(ABSPATH.'wp-admin/includes/media.php');
1082
+		require_once(ABSPATH.'wp-admin/includes/image.php');
1083 1083
 		// Download file to temp location, returns full server path to temp file
1084 1084
 		//$tmp = download_url( $url );
1085 1085
 
1086 1086
 		//var_dump($tmp);
1087
-		$tmp = tempnam( '/tmp', 'FOO' );
1087
+		$tmp = tempnam('/tmp', 'FOO');
1088 1088
 
1089
-		$image = file_get_contents( $url );
1090
-		file_put_contents( $tmp, $image );
1091
-		chmod( $tmp,'777' );
1089
+		$image = file_get_contents($url);
1090
+		file_put_contents($tmp, $image);
1091
+		chmod($tmp, '777');
1092 1092
 
1093
-		preg_match( '/[^\?]+\.(tif|TIFF|jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG|pdf|PDF|bmp|BMP)/', $url, $matches );    // fix file filename for query strings
1094
-		$url_filename = basename( $matches[0] );
1095
-		$url_filename = str_replace( '%20','_',$url_filename );
1093
+		preg_match('/[^\?]+\.(tif|TIFF|jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG|pdf|PDF|bmp|BMP)/', $url, $matches); // fix file filename for query strings
1094
+		$url_filename = basename($matches[0]);
1095
+		$url_filename = str_replace('%20', '_', $url_filename);
1096 1096
 		// extract filename from url for title
1097
-		$url_type = wp_check_filetype( $url_filename );                                           // determine file type (ext and mime/type)
1097
+		$url_type = wp_check_filetype($url_filename); // determine file type (ext and mime/type)
1098 1098
 
1099 1099
 		// override filename if given, reconstruct server path
1100
-		if ( ! empty( $filename ) && ' ' != $filename ) {
1101
-			$filename = sanitize_file_name( $filename );
1102
-			$tmppath = pathinfo( $tmp );
1100
+		if (!empty($filename) && ' ' != $filename) {
1101
+			$filename = sanitize_file_name($filename);
1102
+			$tmppath = pathinfo($tmp);
1103 1103
 
1104 1104
 			$extension = '';
1105
-			if ( isset( $tmppath['extension'] ) ) {
1105
+			if (isset($tmppath['extension'])) {
1106 1106
 				$extension = $tmppath['extension'];
1107 1107
 			}
1108 1108
 
1109
-			$new = $tmppath['dirname'] . '/' . $filename . '.' . $extension;
1110
-			rename( $tmp, $new );                                                                 // renames temp file on server
1111
-			$tmp = $new;                                                                        // push new filename (in path) to be used in file array later
1109
+			$new = $tmppath['dirname'].'/'.$filename.'.'.$extension;
1110
+			rename($tmp, $new); // renames temp file on server
1111
+			$tmp = $new; // push new filename (in path) to be used in file array later
1112 1112
 		}
1113 1113
 
1114 1114
 		// assemble file data (should be built like $_FILES since wp_handle_sideload() will be using)
1115
-		$file_array['tmp_name'] = $tmp;                                                         // full server path to temp file
1115
+		$file_array['tmp_name'] = $tmp; // full server path to temp file
1116 1116
 
1117
-		if ( ! empty( $filename ) && ' ' != $filename ) {
1118
-			$file_array['name'] = $filename . '.' . $url_type['ext'];                           // user given filename for title, add original URL extension
1119
-		} else {
1120
-			$file_array['name'] = $url_filename;                                                // just use original URL filename
1117
+		if (!empty($filename) && ' ' != $filename) {
1118
+			$file_array['name'] = $filename.'.'.$url_type['ext']; // user given filename for title, add original URL extension
1119
+		}else {
1120
+			$file_array['name'] = $url_filename; // just use original URL filename
1121 1121
 		}
1122 1122
 
1123 1123
 		// set additional wp_posts columns
1124
-		if ( empty( $post_data['post_title'] ) ) {
1124
+		if (empty($post_data['post_title'])) {
1125 1125
 
1126
-			$url_filename = str_replace( '%20',' ',$url_filename );
1126
+			$url_filename = str_replace('%20', ' ', $url_filename);
1127 1127
 
1128
-			$post_data['post_title'] = basename( $url_filename, '.' . $url_type['ext'] );         // just use the original filename (no extension)
1128
+			$post_data['post_title'] = basename($url_filename, '.'.$url_type['ext']); // just use the original filename (no extension)
1129 1129
 		}
1130 1130
 
1131 1131
 		// make sure gets tied to parent
1132
-		if ( empty( $post_data['post_parent'] ) ) {
1132
+		if (empty($post_data['post_parent'])) {
1133 1133
 			$post_data['post_parent'] = $post_id;
1134 1134
 		}
1135 1135
 
1136 1136
 		// required libraries for media_handle_sideload
1137 1137
 
1138 1138
 		// do the validation and storage stuff
1139
-		$att_id = media_handle_sideload( $file_array, $post_id, null, $post_data );             // $post_data can override the items saved to wp_posts table, like post_mime_type, guid, post_parent, post_title, post_content, post_status
1139
+		$att_id = media_handle_sideload($file_array, $post_id, null, $post_data); // $post_data can override the items saved to wp_posts table, like post_mime_type, guid, post_parent, post_title, post_content, post_status
1140 1140
 
1141 1141
 		// If error storing permanently, unlink
1142
-		if ( is_wp_error( $att_id ) ) {
1143
-			unlink( $file_array['tmp_name'] );   // clean up
1142
+		if (is_wp_error($att_id)) {
1143
+			unlink($file_array['tmp_name']); // clean up
1144 1144
 			return false; // output wp_error
1145 1145
 			//return $att_id; // output wp_error
1146 1146
 		}
@@ -1169,35 +1169,35 @@  discard block
 block discarded – undo
1169 1169
 	/**
1170 1170
 	 * Formats the row for the completed list.
1171 1171
 	 */
1172
-	public function format_completed_row( $response ) {
1172
+	public function format_completed_row($response) {
1173 1173
 		// @codingStandardsIgnoreLine
1174
-		echo '<li class="post-' . $response . '"><span class="dashicons dashicons-yes"></span> <a target="_blank" href="' . get_permalink( $response ) . '">' . get_the_title( $response ) . '</a></li>';
1174
+		echo '<li class="post-'.$response.'"><span class="dashicons dashicons-yes"></span> <a target="_blank" href="'.get_permalink($response).'">'.get_the_title($response).'</a></li>';
1175 1175
 	}
1176 1176
 
1177 1177
 	/**
1178 1178
 	 * Formats the error.
1179 1179
 	 */
1180
-	public function format_error( $response ) {
1180
+	public function format_error($response) {
1181 1181
 		// @codingStandardsIgnoreLine
1182
-		echo '<li class="post-error"><span class="dashicons dashicons-no"></span>' . $response . '</li>';
1182
+		echo '<li class="post-error"><span class="dashicons dashicons-no"></span>'.$response.'</li>';
1183 1183
 	}
1184 1184
 
1185 1185
 	/**
1186 1186
 	 * Does a multine search
1187 1187
 	 */
1188
-	public function multineedle_stripos( $haystack, $needles, $offset = 0 ) {
1188
+	public function multineedle_stripos($haystack, $needles, $offset = 0) {
1189 1189
 		$found = false;
1190
-		$needle_count = count( $needles );
1190
+		$needle_count = count($needles);
1191 1191
 
1192
-		foreach ( $needles as $needle ) {
1193
-			if ( false !== stripos( $haystack, $needle, $offset ) ) {
1192
+		foreach ($needles as $needle) {
1193
+			if (false !== stripos($haystack, $needle, $offset)) {
1194 1194
 				$found[] = true;
1195 1195
 			}
1196 1196
 		}
1197 1197
 
1198
-		if ( false !== $found && count( $found ) === $needle_count ) {
1198
+		if (false !== $found && count($found) === $needle_count) {
1199 1199
 			return true;
1200
-		} else {
1200
+		}else {
1201 1201
 			return false;
1202 1202
 		}
1203 1203
 	}
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 	/**
1206 1206
 	 * Grab all the current accommodation posts via the lsx_wetu_id field.
1207 1207
 	 */
1208
-	public function find_current_accommodation( $post_type = 'accommodation' ) {
1208
+	public function find_current_accommodation($post_type = 'accommodation') {
1209 1209
 		global $wpdb;
1210 1210
 		$return = array();
1211 1211
 
@@ -1224,9 +1224,9 @@  discard block
 block discarded – undo
1224 1224
 		");
1225 1225
 		// @codingStandardsIgnoreEnd
1226 1226
 
1227
-		if ( null !== $current_accommodation && ! empty( $current_accommodation ) ) {
1228
-			foreach ( $current_accommodation as $accom ) {
1229
-				$return[ $accom->meta_value ] = $accom;
1227
+		if (null !== $current_accommodation && !empty($current_accommodation)) {
1228
+			foreach ($current_accommodation as $accom) {
1229
+				$return[$accom->meta_value] = $accom;
1230 1230
 			}
1231 1231
 		}
1232 1232
 
@@ -1236,20 +1236,20 @@  discard block
 block discarded – undo
1236 1236
 	/**
1237 1237
 	 * Set the Video date
1238 1238
 	 */
1239
-	public function set_video_data( $data, $id ) {
1240
-		if ( ! empty( $data[0]['content']['youtube_videos'] ) && is_array( $data[0]['content']['youtube_videos'] ) ) {
1239
+	public function set_video_data($data, $id) {
1240
+		if (!empty($data[0]['content']['youtube_videos']) && is_array($data[0]['content']['youtube_videos'])) {
1241 1241
 			$videos = false;
1242 1242
 
1243
-			foreach ( $data[0]['content']['youtube_videos'] as $video ) {
1243
+			foreach ($data[0]['content']['youtube_videos'] as $video) {
1244 1244
 				$temp_video = array();
1245 1245
 
1246
-				if ( isset( $video['label'] ) ) {
1246
+				if (isset($video['label'])) {
1247 1247
 					$temp_video['title'] = $video['label'];
1248 1248
 				}
1249
-				if ( isset( $video['description'] ) ) {
1250
-					$temp_video['description'] = strip_tags( $video['description'] );
1249
+				if (isset($video['description'])) {
1250
+					$temp_video['description'] = strip_tags($video['description']);
1251 1251
 				}
1252
-				if ( isset( $video['url'] ) ) {
1252
+				if (isset($video['url'])) {
1253 1253
 					$temp_video['url'] = $video['url'];
1254 1254
 				}
1255 1255
 
@@ -1257,24 +1257,24 @@  discard block
 block discarded – undo
1257 1257
 				$videos[] = $temp_video;
1258 1258
 			}
1259 1259
 
1260
-			if ( false !== $id && '0' !== $id ) {
1261
-				delete_post_meta( $id, 'videos' );
1260
+			if (false !== $id && '0' !== $id) {
1261
+				delete_post_meta($id, 'videos');
1262 1262
 			}
1263 1263
 
1264
-			foreach ( $videos as $video ) {
1265
-				add_post_meta( $id,'videos',$video,false );
1264
+			foreach ($videos as $video) {
1265
+				add_post_meta($id, 'videos', $video, false);
1266 1266
 			}
1267 1267
 		}
1268 1268
 	}
1269 1269
 
1270
-	public function shuffle_assoc( &$array ) {
1270
+	public function shuffle_assoc(&$array) {
1271 1271
 		$new = array();
1272
-		$keys = array_keys( $array );
1272
+		$keys = array_keys($array);
1273 1273
 
1274
-		shuffle( $keys );
1274
+		shuffle($keys);
1275 1275
 
1276
-		foreach ( $keys as $key ) {
1277
-			$new[ $key ] = $array[ $key ];
1276
+		foreach ($keys as $key) {
1277
+			$new[$key] = $array[$key];
1278 1278
 		}
1279 1279
 
1280 1280
 		$array = $new;
Please login to merge, or discard this patch.
classes/class-wetu-importer-destination.php 1 patch
Spacing   +235 added lines, -235 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,114 +149,114 @@  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, 'continent' ); ?>
187
+									<input class="content" <?php $this->checked($this->destination_options, 'continent'); ?>
188 188
 										   type="checkbox" name="content[]"
189
-										   value="continent"/> <?php esc_html_e( 'Set Continent', 'wetu-importer' ); ?></li>
189
+										   value="continent"/> <?php esc_html_e('Set Continent', 'wetu-importer'); ?></li>
190 190
 
191 191
 								<li>
192
-									<input class="content" <?php $this->checked( $this->destination_options, 'featured_image' ); ?>
192
+									<input class="content" <?php $this->checked($this->destination_options, 'featured_image'); ?>
193 193
 										   type="checkbox" name="content[]"
194
-										   value="featured_image"/> <?php esc_html_e( 'Set Featured Image', 'wetu-importer' ); ?>
194
+										   value="featured_image"/> <?php esc_html_e('Set Featured Image', 'wetu-importer'); ?>
195 195
 								</li>
196
-								<?php if ( class_exists( 'LSX_Banners' ) ) { ?>
196
+								<?php if (class_exists('LSX_Banners')) { ?>
197 197
 									<li>
198
-										<input class="content" <?php $this->checked( $this->destination_options, 'banner_image' ); ?>
198
+										<input class="content" <?php $this->checked($this->destination_options, 'banner_image'); ?>
199 199
 											   type="checkbox" name="content[]"
200
-											   value="banner_image"/> <?php esc_html_e( 'Set Banner Image', 'wetu-importer' ); ?>
200
+											   value="banner_image"/> <?php esc_html_e('Set Banner Image', 'wetu-importer'); ?>
201 201
 									</li>
202 202
 									<li>
203
-										<input class="content" <?php $this->checked( $this->destination_options, 'unique_banner_image' ); ?>
203
+										<input class="content" <?php $this->checked($this->destination_options, 'unique_banner_image'); ?>
204 204
 											   type="checkbox" name="content[]"
205
-											   value="unique_banner_image"/> <?php esc_html_e( 'Use the WETU banner field', 'wetu-importer' ); ?>
205
+											   value="unique_banner_image"/> <?php esc_html_e('Use the WETU banner field', 'wetu-importer'); ?>
206 206
 									</li>
207 207
 								<?php } ?>
208 208
 
209 209
 								<li>
210
-									<input class="content" <?php $this->checked( $this->destination_options, 'strip_tags' ); ?>
210
+									<input class="content" <?php $this->checked($this->destination_options, 'strip_tags'); ?>
211 211
 										   type="checkbox" name="content[]"
212
-										   value="strip_tags"/> <?php esc_html_e( 'Strip HTML from the description', 'wetu-importer' ); ?></li>
212
+										   value="strip_tags"/> <?php esc_html_e('Strip HTML from the description', 'wetu-importer'); ?></li>
213 213
 							</ul>
214 214
 						</div>
215 215
 						<div class="settings-all" style="width:30%;display:block;float:left;">
216
-							<h3><?php esc_html_e( 'Travel Information' ); ?></h3>
216
+							<h3><?php esc_html_e('Travel Information'); ?></h3>
217 217
 							<ul>
218 218
 								<li>
219
-									<input class="content" <?php $this->checked( $this->destination_options, 'electricity' ); ?>
219
+									<input class="content" <?php $this->checked($this->destination_options, 'electricity'); ?>
220 220
 										   type="checkbox" name="content[]"
221
-										   value="electricity"/> <?php esc_html_e( 'Electricity', 'wetu-importer' ); ?></li>
221
+										   value="electricity"/> <?php esc_html_e('Electricity', 'wetu-importer'); ?></li>
222 222
 								<li>
223
-									<input class="content" <?php $this->checked( $this->destination_options, 'banking' ); ?>
223
+									<input class="content" <?php $this->checked($this->destination_options, 'banking'); ?>
224 224
 										   type="checkbox" name="content[]"
225
-										   value="banking"/> <?php esc_html_e( 'Banking', 'wetu-importer' ); ?></li>
225
+										   value="banking"/> <?php esc_html_e('Banking', 'wetu-importer'); ?></li>
226 226
 								<li>
227
-									<input class="content" <?php $this->checked( $this->destination_options, 'cuisine' ); ?>
227
+									<input class="content" <?php $this->checked($this->destination_options, 'cuisine'); ?>
228 228
 										   type="checkbox" name="content[]"
229
-										   value="cuisine"/> <?php esc_html_e( 'Cuisine', 'wetu-importer' ); ?></li>
229
+										   value="cuisine"/> <?php esc_html_e('Cuisine', 'wetu-importer'); ?></li>
230 230
 								<li>
231
-									<input class="content" <?php $this->checked( $this->destination_options, 'climate' ); ?>
231
+									<input class="content" <?php $this->checked($this->destination_options, 'climate'); ?>
232 232
 										   type="checkbox" name="content[]"
233
-										   value="climate"/> <?php esc_html_e( 'Climate', 'wetu-importer' ); ?></li>
233
+										   value="climate"/> <?php esc_html_e('Climate', 'wetu-importer'); ?></li>
234 234
 								<li>
235
-									<input class="content" <?php $this->checked( $this->destination_options, 'transport' ); ?>
235
+									<input class="content" <?php $this->checked($this->destination_options, 'transport'); ?>
236 236
 										   type="checkbox" name="content[]"
237
-										   value="transport"/> <?php esc_html_e( 'Transport', 'wetu-importer' ); ?></li>
238
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'dress' ); ?>
237
+										   value="transport"/> <?php esc_html_e('Transport', 'wetu-importer'); ?></li>
238
+								<li><input class="content" <?php $this->checked($this->destination_options, 'dress'); ?>
239 239
 										   type="checkbox" name="content[]"
240
-										   value="dress"/> <?php esc_html_e( 'Dress', 'wetu-importer' ); ?></li>
241
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'health' ); ?>
240
+										   value="dress"/> <?php esc_html_e('Dress', 'wetu-importer'); ?></li>
241
+								<li><input class="content" <?php $this->checked($this->destination_options, 'health'); ?>
242 242
 										   type="checkbox" name="content[]"
243
-										   value="health"/> <?php esc_html_e( 'Health', 'wetu-importer' ); ?></li>
244
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'safety' ); ?>
243
+										   value="health"/> <?php esc_html_e('Health', 'wetu-importer'); ?></li>
244
+								<li><input class="content" <?php $this->checked($this->destination_options, 'safety'); ?>
245 245
 										   type="checkbox" name="content[]"
246
-										   value="safety"/> <?php esc_html_e( 'Safety', 'wetu-importer' ); ?></li>
247
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'visa' ); ?>
246
+										   value="safety"/> <?php esc_html_e('Safety', 'wetu-importer'); ?></li>
247
+								<li><input class="content" <?php $this->checked($this->destination_options, 'visa'); ?>
248 248
 										   type="checkbox" name="content[]"
249
-										   value="visa"/> <?php esc_html_e( 'Visa', 'wetu-importer' ); ?></li>
250
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'additional_info' ); ?>
249
+										   value="visa"/> <?php esc_html_e('Visa', 'wetu-importer'); ?></li>
250
+								<li><input class="content" <?php $this->checked($this->destination_options, 'additional_info'); ?>
251 251
 										   type="checkbox" name="content[]"
252
-										   value="additional_info"/> <?php esc_html_e( 'General', 'wetu-importer' ); ?></li>
252
+										   value="additional_info"/> <?php esc_html_e('General', 'wetu-importer'); ?></li>
253 253
 							</ul>
254 254
 						</div>
255 255
 
256
-						<?php if ( class_exists( 'LSX_TO_Team' ) ) { ?>
256
+						<?php if (class_exists('LSX_TO_Team')) { ?>
257 257
 							<div style="width:30%;display:block;float:left;">
258
-								<h3><?php esc_html_e( 'Assign a Team Member' ); ?></h3>
259
-								<?php $this->team_member_checkboxes( $this->destination_options ); ?>
258
+								<h3><?php esc_html_e('Assign a Team Member'); ?></h3>
259
+								<?php $this->team_member_checkboxes($this->destination_options); ?>
260 260
 							</div>
261 261
 						<?php } ?>
262 262
 
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 					</div>
265 265
 
266 266
 
267
-					<h3><?php esc_html_e( 'Your List' ); ?></h3>
267
+					<h3><?php esc_html_e('Your List'); ?></h3>
268 268
 					<p><input class="button button-primary" type="submit"
269
-							  value="<?php esc_html_e( 'Sync', 'wetu-importer' ); ?>"/></p>
269
+							  value="<?php esc_html_e('Sync', 'wetu-importer'); ?>"/></p>
270 270
 					<table class="wp-list-table widefat fixed posts">
271 271
 						<?php $this->table_header(); ?>
272 272
 
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
 					</table>
280 280
 
281 281
 					<p><input class="button button-primary" type="submit"
282
-							  value="<?php esc_html_e( 'Sync', 'wetu-importer' ); ?>"/></p>
282
+							  value="<?php esc_html_e('Sync', 'wetu-importer'); ?>"/></p>
283 283
 				</form>
284 284
 			</div>
285 285
 
286 286
 			<div style="display:none;" class="completed-list-wrapper">
287
-				<h3><?php esc_html_e( 'Completed' ); ?></h3>
287
+				<h3><?php esc_html_e('Completed'); ?></h3>
288 288
 				<ul>
289 289
 				</ul>
290 290
 			</div>
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 	/**
296 296
 	 * Grab all the current destination posts via the lsx_wetu_id field.
297 297
 	 */
298
-	public function find_current_destination( $post_type = 'destination' ) {
298
+	public function find_current_destination($post_type = 'destination') {
299 299
 		global $wpdb;
300 300
 		$return = array();
301 301
 
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 		");
315 315
 		// @codingStandardsIgnoreEnd
316 316
 
317
-		if ( null !== $current_destination && ! empty( $current_destination ) ) {
318
-			foreach ( $current_destination as $accom ) {
319
-				$return[ $accom->meta_value ] = $accom;
317
+		if (null !== $current_destination && !empty($current_destination)) {
318
+			foreach ($current_destination as $accom) {
319
+				$return[$accom->meta_value] = $accom;
320 320
 			}
321 321
 		}
322 322
 
@@ -330,95 +330,95 @@  discard block
 block discarded – undo
330 330
 		$return = false;
331 331
 
332 332
 		// @codingStandardsIgnoreLine
333
-		if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_tour_importer' && isset( $_POST['type'] ) && $_POST['type'] === 'destination' ) {
334
-			$accommodation = get_transient( 'lsx_ti_accommodation' );
333
+		if (isset($_POST['action']) && $_POST['action'] === 'lsx_tour_importer' && isset($_POST['type']) && $_POST['type'] === 'destination') {
334
+			$accommodation = get_transient('lsx_ti_accommodation');
335 335
 
336
-			if ( false === $accommodation ) {
336
+			if (false === $accommodation) {
337 337
 				$this->update_options();
338 338
 			}
339 339
 
340
-			if ( false !== $accommodation ) {
340
+			if (false !== $accommodation) {
341 341
 				$searched_items = false;
342 342
 
343 343
 				// @codingStandardsIgnoreLine
344
-				if ( isset( $_POST['keyword'] ) ) {
344
+				if (isset($_POST['keyword'])) {
345 345
 					// @codingStandardsIgnoreLine
346 346
 					$keyphrases = $_POST['keyword'];
347
-				} else {
348
-					$keyphrases = array( 0 );
347
+				}else {
348
+					$keyphrases = array(0);
349 349
 				}
350 350
 
351
-				if ( ! is_array( $keyphrases ) ) {
352
-					$keyphrases = array( $keyphrases );
351
+				if (!is_array($keyphrases)) {
352
+					$keyphrases = array($keyphrases);
353 353
 				}
354
-				foreach ( $keyphrases as &$keyword ) {
355
-					$keyword = ltrim( rtrim( $keyword ) );
354
+				foreach ($keyphrases as &$keyword) {
355
+					$keyword = ltrim(rtrim($keyword));
356 356
 				}
357 357
 
358 358
 				$post_status = false;
359 359
 
360
-				if ( in_array( 'publish',$keyphrases ) ) {
360
+				if (in_array('publish', $keyphrases)) {
361 361
 					$post_status = 'publish';
362 362
 				}
363
-				if ( in_array( 'pending',$keyphrases ) ) {
363
+				if (in_array('pending', $keyphrases)) {
364 364
 					$post_status = 'pending';
365 365
 				}
366
-				if ( in_array( 'draft',$keyphrases ) ) {
366
+				if (in_array('draft', $keyphrases)) {
367 367
 					$post_status = 'draft';
368 368
 				}
369
-				if ( in_array( 'import',$keyphrases ) ) {
369
+				if (in_array('import', $keyphrases)) {
370 370
 					$post_status = 'import';
371 371
 				}
372 372
 
373
-				if ( ! empty( $accommodation ) ) {
373
+				if (!empty($accommodation)) {
374 374
 
375
-					$current_accommodation = $this->find_current_accommodation( 'destination' );
375
+					$current_accommodation = $this->find_current_accommodation('destination');
376 376
 
377
-					foreach ( $accommodation as $row_key => $row ) {
377
+					foreach ($accommodation as $row_key => $row) {
378 378
 
379
-						if ( 'Destination' === trim( $row['type'] ) ) {
379
+						if ('Destination' === trim($row['type'])) {
380 380
 
381 381
 							//If this is a current tour, add its ID to the row.
382 382
 							$row['post_id'] = 0;
383 383
 
384
-							if ( false !== $current_accommodation && array_key_exists( $row['id'], $current_accommodation ) ) {
385
-								$row['post_id'] = $current_accommodation[ $row['id'] ]->post_id;
384
+							if (false !== $current_accommodation && array_key_exists($row['id'], $current_accommodation)) {
385
+								$row['post_id'] = $current_accommodation[$row['id']]->post_id;
386 386
 							}
387 387
 
388 388
 							//If we are searching for
389
-							if ( false !== $post_status ) {
390
-								if ( 'import' === $post_status ) {
389
+							if (false !== $post_status) {
390
+								if ('import' === $post_status) {
391 391
 
392
-									if ( is_array( $this->queued_imports ) && in_array( $row['post_id'], $this->queued_imports ) ) {
393
-										$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
394
-									} else {
392
+									if (is_array($this->queued_imports) && in_array($row['post_id'], $this->queued_imports)) {
393
+										$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
394
+									}else {
395 395
 										continue;
396 396
 									}
397
-								} else {
398
-									if ( 0 === $row['post_id'] ) {
397
+								}else {
398
+									if (0 === $row['post_id']) {
399 399
 										continue;
400
-									} else {
401
-										$current_status = get_post_status( $row['post_id'] );
400
+									}else {
401
+										$current_status = get_post_status($row['post_id']);
402 402
 
403
-										if ( $current_status !== $post_status ) {
403
+										if ($current_status !== $post_status) {
404 404
 											continue;
405 405
 										}
406 406
 									}
407 407
 
408
-									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
408
+									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
409 409
 								}
410
-							} else {
410
+							}else {
411 411
 								//Search through each keyword.
412
-								foreach ( $keyphrases as $keyphrase ) {
412
+								foreach ($keyphrases as $keyphrase) {
413 413
 									//Make sure the keyphrase is turned into an array
414
-									$keywords = explode( ' ', $keyphrase );
414
+									$keywords = explode(' ', $keyphrase);
415 415
 
416
-									if ( ! is_array( $keywords ) ) {
417
-										$keywords = array( $keywords );
416
+									if (!is_array($keywords)) {
417
+										$keywords = array($keywords);
418 418
 									}
419 419
 
420
-									if ( $this->multineedle_stripos( ltrim( rtrim( $row['name'] ) ), $keywords ) !== false ) {
421
-										$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
420
+									if ($this->multineedle_stripos(ltrim(rtrim($row['name'])), $keywords) !== false) {
421
+										$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
422 422
 									}
423 423
 								}
424 424
 							}
@@ -426,13 +426,13 @@  discard block
 block discarded – undo
426 426
 					}
427 427
 				}
428 428
 
429
-				if ( false !== $searched_items ) {
430
-					ksort( $searched_items );
431
-					$return = implode( $searched_items );
429
+				if (false !== $searched_items) {
430
+					ksort($searched_items);
431
+					$return = implode($searched_items);
432 432
 				}
433 433
 			}
434 434
 
435
-			print_r( $return );
435
+			print_r($return);
436 436
 		}
437 437
 
438 438
 		die();
@@ -441,28 +441,28 @@  discard block
 block discarded – undo
441 441
 	/**
442 442
 	 * Formats the row for output on the screen.
443 443
 	 */
444
-	public function format_row( $row = false ) {
445
-		if ( false !== $row ) {
444
+	public function format_row($row = false) {
445
+		if (false !== $row) {
446 446
 
447 447
 			$status = 'import';
448
-			if ( 0 !== $row['post_id'] ) {
449
-				$status = '<a href="' . admin_url( '/post.php?post=' . $row['post_id'] . '&action=edit' ) . '" target="_blank">' . get_post_status( $row['post_id'] ) . '</a>';
448
+			if (0 !== $row['post_id']) {
449
+				$status = '<a href="'.admin_url('/post.php?post='.$row['post_id'].'&action=edit').'" target="_blank">'.get_post_status($row['post_id']).'</a>';
450 450
 			}
451 451
 
452 452
 			$row_html = '
453
-			<tr class="post-' . $row['post_id'] . ' type-tour" id="post-' . $row['post_id'] . '">
453
+			<tr class="post-' . $row['post_id'].' type-tour" id="post-'.$row['post_id'].'">
454 454
 				<th class="check-column" scope="row">
455
-					<label for="cb-select-' . $row['id'] . '" class="screen-reader-text">' . $row['name'] . '</label>
456
-					<input type="checkbox" data-identifier="' . $row['id'] . '" value="' . $row['post_id'] . '" name="post[]" id="cb-select-' . $row['id'] . '">
455
+					<label for="cb-select-' . $row['id'].'" class="screen-reader-text">'.$row['name'].'</label>
456
+					<input type="checkbox" data-identifier="' . $row['id'].'" value="'.$row['post_id'].'" name="post[]" id="cb-select-'.$row['id'].'">
457 457
 				</th>
458 458
 				<td class="post-title page-title column-title">
459
-					<strong>' . $row['name'] . '</strong> - ' . $status . '
459
+					<strong>' . $row['name'].'</strong> - '.$status.'
460 460
 				</td>
461 461
 				<td class="date column-date">
462
-					<abbr title="' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '">' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '</abbr><br>Last Modified
462
+					<abbr title="' . date('Y/m/d', strtotime($row['last_modified'])).'">'.date('Y/m/d', strtotime($row['last_modified'])).'</abbr><br>Last Modified
463 463
 				</td>
464 464
 				<td class="ssid column-ssid">
465
-					' . $row['id'] . '
465
+					' . $row['id'].'
466 466
 				</td>
467 467
 			</tr>';
468 468
 			return $row_html;
@@ -476,54 +476,54 @@  discard block
 block discarded – undo
476 476
 		$return = false;
477 477
 
478 478
 		// @codingStandardsIgnoreLine
479
-		if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_import_items' && isset( $_POST['type'] ) && $_POST['type'] === 'destination' && isset( $_POST['wetu_id'] ) ) {
479
+		if (isset($_POST['action']) && $_POST['action'] === 'lsx_import_items' && isset($_POST['type']) && $_POST['type'] === 'destination' && isset($_POST['wetu_id'])) {
480 480
 			// @codingStandardsIgnoreLine
481 481
 			$wetu_id = $_POST['wetu_id'];
482 482
 
483 483
 			// @codingStandardsIgnoreLine
484
-			if ( isset( $_POST['post_id'] ) ) {
484
+			if (isset($_POST['post_id'])) {
485 485
 				// @codingStandardsIgnoreLine
486 486
 				$post_id = $_POST['post_id'];
487
-				$this->current_post = get_post( $post_id );
488
-			} else {
487
+				$this->current_post = get_post($post_id);
488
+			}else {
489 489
 				$post_id = 0;
490 490
 			}
491 491
 
492 492
 			// @codingStandardsIgnoreLine
493
-			if ( isset( $_POST['team_members'] ) ) {
493
+			if (isset($_POST['team_members'])) {
494 494
 				// @codingStandardsIgnoreLine
495 495
 				$team_members = $_POST['team_members'];
496
-			} else {
496
+			}else {
497 497
 				$team_members = false;
498 498
 			}
499 499
 
500 500
 			$safari_brands = false;
501 501
 
502
-			delete_option( 'wetu_importer_destination_settings' );
502
+			delete_option('wetu_importer_destination_settings');
503 503
 
504 504
 			// @codingStandardsIgnoreLine
505
-			if ( isset( $_POST['content'] ) && is_array( $_POST['content'] ) && ! empty( $_POST['content'] ) ) {
505
+			if (isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])) {
506 506
 				// @codingStandardsIgnoreLine
507 507
 				$content = $_POST['content'];
508
-				add_option( 'wetu_importer_destination_settings', $content );
509
-			} else {
508
+				add_option('wetu_importer_destination_settings', $content);
509
+			}else {
510 510
 				$content = false;
511 511
 			}
512 512
 
513
-			$jdata = file_get_contents( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
513
+			$jdata = file_get_contents($this->url.'/Get?'.$this->url_qs.'&ids='.$wetu_id);
514 514
 
515
-			if ( $jdata ) {
516
-				$adata = json_decode( $jdata, true );
515
+			if ($jdata) {
516
+				$adata = json_decode($jdata, true);
517 517
 
518
-				if ( ! empty( $adata ) && ! isset( $adata['error'] ) ) {
519
-					$return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands );
520
-					$this->remove_from_queue( $return );
521
-					$this->format_completed_row( $return );
522
-				} else {
523
-					if ( isset( $adata['error'] ) ) {
524
-						$this->format_error( $adata['error'] );
525
-					} else {
526
-						$this->format_error( esc_html__( 'There was a problem importing your destination, please try refreshing the page.','wetu-importer' ) );
518
+				if (!empty($adata) && !isset($adata['error'])) {
519
+					$return = $this->import_row($adata, $wetu_id, $post_id, $team_members, $content, $safari_brands);
520
+					$this->remove_from_queue($return);
521
+					$this->format_completed_row($return);
522
+				}else {
523
+					if (isset($adata['error'])) {
524
+						$this->format_error($adata['error']);
525
+					}else {
526
+						$this->format_error(esc_html__('There was a problem importing your destination, please try refreshing the page.', 'wetu-importer'));
527 527
 					}
528 528
 				}
529 529
 			}
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
 	/**
534 534
 	 * Saves the queue to the option.
535 535
 	 */
536
-	public function remove_from_queue( $id ) {
537
-		if ( ! empty( $this->queued_imports ) ) {
536
+	public function remove_from_queue($id) {
537
+		if (!empty($this->queued_imports)) {
538 538
 			// @codingStandardsIgnoreLine
539
-			if ( ( $key = array_search( $id, $this->queued_imports ) ) !== false ) {
540
-				unset( $this->queued_imports[ $key ] );
539
+			if (($key = array_search($id, $this->queued_imports)) !== false) {
540
+				unset($this->queued_imports[$key]);
541 541
 
542
-				delete_option( 'wetu_importer_que' );
543
-				update_option( 'wetu_importer_que',$this->queued_imports );
542
+				delete_option('wetu_importer_que');
543
+				update_option('wetu_importer_que', $this->queued_imports);
544 544
 			}
545 545
 		}
546 546
 	}
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 	/**
549 549
 	 * Connect to wetu
550 550
 	 */
551
-	public function import_row( $data, $wetu_id, $id = 0, $team_members = false, $importable_content = false, $safari_brands = false ) {
552
-		if ( 'Destination' === trim( $data[0]['type'] ) ) {
551
+	public function import_row($data, $wetu_id, $id = 0, $team_members = false, $importable_content = false, $safari_brands = false) {
552
+		if ('Destination' === trim($data[0]['type'])) {
553 553
 			$post_name = '';
554 554
 			$data_post_content = '';
555 555
 			$data_post_excerpt = '';
@@ -559,124 +559,124 @@  discard block
 block discarded – undo
559 559
 			);
560 560
 
561 561
 			//Set the post_content
562
-			if ( false !== $importable_content && in_array( 'description', $importable_content ) ) {
563
-				if ( isset( $data[0]['content']['general_description'] ) ) {
562
+			if (false !== $importable_content && in_array('description', $importable_content)) {
563
+				if (isset($data[0]['content']['general_description'])) {
564 564
 
565
-					if ( false !== $importable_content && in_array( 'strip_tags', $importable_content ) ) {
566
-						$post['post_content'] = wp_strip_all_tags( $data[0]['content']['general_description'] );
567
-					} else {
565
+					if (false !== $importable_content && in_array('strip_tags', $importable_content)) {
566
+						$post['post_content'] = wp_strip_all_tags($data[0]['content']['general_description']);
567
+					}else {
568 568
 						$post['post_content'] = $data[0]['content']['general_description'];
569 569
 					}
570 570
 				}
571 571
 			}
572 572
 
573
-			if ( false !== $id && '0' !== $id ) {
573
+			if (false !== $id && '0' !== $id) {
574 574
 				$post['ID'] = $id;
575 575
 
576
-				if ( isset( $data[0]['name'] ) ) {
576
+				if (isset($data[0]['name'])) {
577 577
 					$post['post_title'] = $data[0]['name'];
578 578
 					$post['post_status'] = 'publish';
579
-					$post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 );
579
+					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0);
580 580
 				}
581 581
 
582
-				$id = wp_update_post( $post );
583
-				$prev_date = get_post_meta( $id, 'lsx_wetu_modified_date', true );
584
-				update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date );
585
-			} else {
582
+				$id = wp_update_post($post);
583
+				$prev_date = get_post_meta($id, 'lsx_wetu_modified_date', true);
584
+				update_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']), $prev_date);
585
+			}else {
586 586
 				//Set the name
587
-				if ( isset( $data[0]['name'] ) ) {
588
-					$post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 );
587
+				if (isset($data[0]['name'])) {
588
+					$post_name = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0);
589 589
 				}
590 590
 
591 591
 				$post['post_name'] = $post_name;
592 592
 				$post['post_title'] = $data[0]['name'];
593 593
 				$post['post_status'] = 'publish';
594
-				$id = wp_insert_post( $post );
594
+				$id = wp_insert_post($post);
595 595
 
596 596
 				//Save the WETU ID and the Last date it was modified.
597
-				if ( false !== $id ) {
598
-					add_post_meta( $id, 'lsx_wetu_id', $wetu_id );
599
-					add_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ) );
597
+				if (false !== $id) {
598
+					add_post_meta($id, 'lsx_wetu_id', $wetu_id);
599
+					add_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']));
600 600
 				}
601 601
 			}
602 602
 
603
-			$this->find_attachments( $id );
603
+			$this->find_attachments($id);
604 604
 
605 605
 			//Set the team member if it is there
606
-			if ( post_type_exists( 'team' ) && false !== $team_members && '' !== $team_members ) {
607
-				$this->set_team_member( $id, $team_members );
606
+			if (post_type_exists('team') && false !== $team_members && '' !== $team_members) {
607
+				$this->set_team_member($id, $team_members);
608 608
 			}
609 609
 
610
-			if ( class_exists( 'LSX_TO_Maps' ) ) {
611
-				$this->set_map_data( $data, $id, 9 );
610
+			if (class_exists('LSX_TO_Maps')) {
611
+				$this->set_map_data($data, $id, 9);
612 612
 			}
613 613
 
614 614
 			//Set the Room Data
615
-			if ( false !== $importable_content && in_array( 'videos', $importable_content ) ) {
616
-				$this->set_video_data( $data, $id );
615
+			if (false !== $importable_content && in_array('videos', $importable_content)) {
616
+				$this->set_video_data($data, $id);
617 617
 			}
618 618
 
619 619
 			//Set the Electricity
620
-			if ( false !== $importable_content && in_array( 'electricity', $importable_content ) ) {
621
-				$this->set_travel_info( $data, $id, 'electricity' );
620
+			if (false !== $importable_content && in_array('electricity', $importable_content)) {
621
+				$this->set_travel_info($data, $id, 'electricity');
622 622
 			}
623 623
 			//Set the cuisine
624
-			if ( false !== $importable_content && in_array( 'cuisine', $importable_content ) ) {
625
-				$this->set_travel_info( $data, $id, 'cuisine' );
624
+			if (false !== $importable_content && in_array('cuisine', $importable_content)) {
625
+				$this->set_travel_info($data, $id, 'cuisine');
626 626
 			}
627 627
 			//Set the banking
628
-			if ( false !== $importable_content && in_array( 'banking', $importable_content ) ) {
629
-				$this->set_travel_info( $data, $id, 'banking' );
628
+			if (false !== $importable_content && in_array('banking', $importable_content)) {
629
+				$this->set_travel_info($data, $id, 'banking');
630 630
 			}
631 631
 			//Set the transport
632
-			if ( false !== $importable_content && in_array( 'transport', $importable_content ) ) {
633
-				$this->set_travel_info( $data, $id, 'transport' );
632
+			if (false !== $importable_content && in_array('transport', $importable_content)) {
633
+				$this->set_travel_info($data, $id, 'transport');
634 634
 			}
635 635
 			//Set the dress
636
-			if ( false !== $importable_content && in_array( 'dress', $importable_content ) ) {
637
-				$this->set_travel_info( $data, $id, 'dress' );
636
+			if (false !== $importable_content && in_array('dress', $importable_content)) {
637
+				$this->set_travel_info($data, $id, 'dress');
638 638
 			}
639 639
 			//Set the climate
640
-			if ( false !== $importable_content && in_array( 'climate', $importable_content ) ) {
641
-				$this->set_travel_info( $data, $id, 'climate' );
640
+			if (false !== $importable_content && in_array('climate', $importable_content)) {
641
+				$this->set_travel_info($data, $id, 'climate');
642 642
 			}
643 643
 			//Set the Health
644
-			if ( false !== $importable_content && in_array( 'health', $importable_content ) ) {
645
-				$this->set_travel_info( $data, $id, 'health' );
644
+			if (false !== $importable_content && in_array('health', $importable_content)) {
645
+				$this->set_travel_info($data, $id, 'health');
646 646
 			}
647 647
 			//Set the Safety
648
-			if ( false !== $importable_content && in_array( 'safety', $importable_content ) ) {
649
-				$this->set_travel_info( $data, $id, 'safety' );
648
+			if (false !== $importable_content && in_array('safety', $importable_content)) {
649
+				$this->set_travel_info($data, $id, 'safety');
650 650
 			}
651 651
 			//Set the Visa
652
-			if ( false !== $importable_content && in_array( 'visa', $importable_content ) ) {
653
-				$this->set_travel_info( $data, $id, 'visa' );
652
+			if (false !== $importable_content && in_array('visa', $importable_content)) {
653
+				$this->set_travel_info($data, $id, 'visa');
654 654
 			}
655 655
 			//Set the General
656
-			if ( false !== $importable_content && in_array( 'additional_info', $importable_content ) ) {
657
-				$this->set_travel_info( $data, $id, 'additional_info' );
656
+			if (false !== $importable_content && in_array('additional_info', $importable_content)) {
657
+				$this->set_travel_info($data, $id, 'additional_info');
658 658
 			}
659 659
 
660 660
 			//Setup some default for use in the import
661
-			if ( false !== $importable_content && (in_array( 'gallery', $importable_content ) || in_array( 'banner_image', $importable_content ) || in_array( 'featured_image', $importable_content )) ) {
662
-				$this->find_attachments( $id );
661
+			if (false !== $importable_content && (in_array('gallery', $importable_content) || in_array('banner_image', $importable_content) || in_array('featured_image', $importable_content))) {
662
+				$this->find_attachments($id);
663 663
 
664 664
 				//Set the featured image
665
-				if ( false !== $importable_content && in_array( 'featured_image', $importable_content ) ) {
666
-					$this->set_featured_image( $data, $id );
665
+				if (false !== $importable_content && in_array('featured_image', $importable_content)) {
666
+					$this->set_featured_image($data, $id);
667 667
 				}
668
-				if ( false !== $importable_content && in_array( 'banner_image', $importable_content ) ) {
669
-					$this->set_banner_image( $data, $id, $importable_content );
668
+				if (false !== $importable_content && in_array('banner_image', $importable_content)) {
669
+					$this->set_banner_image($data, $id, $importable_content);
670 670
 				}
671 671
 				//Import the main gallery
672
-				if ( false !== $importable_content && in_array( 'gallery', $importable_content ) ) {
673
-					$this->create_main_gallery( $data, $id );
672
+				if (false !== $importable_content && in_array('gallery', $importable_content)) {
673
+					$this->create_main_gallery($data, $id);
674 674
 				}
675 675
 			}
676 676
 
677 677
 			//Set the continent
678
-			if ( false !== $importable_content && in_array( 'continent', $importable_content ) ) {
679
-				$this->set_continent( $data, $id );
678
+			if (false !== $importable_content && in_array('continent', $importable_content)) {
679
+				$this->set_continent($data, $id);
680 680
 			}
681 681
 		}
682 682
 
@@ -686,44 +686,44 @@  discard block
 block discarded – undo
686 686
 	/**
687 687
 	 * Set the team memberon each item.
688 688
 	 */
689
-	public function set_team_member( $id, $team_members ) {
690
-		delete_post_meta( $id, 'team_to_' . $this->tab_slug );
689
+	public function set_team_member($id, $team_members) {
690
+		delete_post_meta($id, 'team_to_'.$this->tab_slug);
691 691
 
692
-		foreach ( $team_members as $team ) {
693
-			add_post_meta( $id, 'team_to_' . $this->tab_slug, $team );
692
+		foreach ($team_members as $team) {
693
+			add_post_meta($id, 'team_to_'.$this->tab_slug, $team);
694 694
 		}
695 695
 	}
696 696
 
697 697
 	/**
698 698
 	 * Saves the room data
699 699
 	 */
700
-	public function set_travel_info( $data, $id, $meta_key ) {
701
-		if ( ! empty( $data[0]['travel_information'] ) && isset( $data[0]['travel_information'][ $meta_key ] ) ) {
702
-			$content = $data[0]['travel_information'][ $meta_key ];
703
-			$this->save_custom_field( $content, $meta_key, $id );
700
+	public function set_travel_info($data, $id, $meta_key) {
701
+		if (!empty($data[0]['travel_information']) && isset($data[0]['travel_information'][$meta_key])) {
702
+			$content = $data[0]['travel_information'][$meta_key];
703
+			$this->save_custom_field($content, $meta_key, $id);
704 704
 		}
705 705
 	}
706 706
 
707 707
 	/**
708 708
 	 * Set the Travel Style
709 709
 	 */
710
-	public function set_continent( $data, $id ) {
710
+	public function set_continent($data, $id) {
711 711
 
712
-		if ( isset( $data[0]['position']['country'] ) && $data[0]['map_object_id'] === $data[0]['position']['country_content_entity_id'] ) {
712
+		if (isset($data[0]['position']['country']) && $data[0]['map_object_id'] === $data[0]['position']['country_content_entity_id']) {
713 713
 			//get the continent code.
714
-			$continent_code = to_continent_label( to_continent_code( to_country_data( $data[0]['position']['country'], false ) ) );
714
+			$continent_code = to_continent_label(to_continent_code(to_country_data($data[0]['position']['country'], false)));
715 715
 
716
-			if ( '' !== $continent_code ) {
716
+			if ('' !== $continent_code) {
717 717
 				// @codingStandardsIgnoreLine
718
-				if ( ! $term = term_exists( trim( $continent_code ), 'continent' ) ) {
719
-					$term = wp_insert_term( trim( $continent_code ), 'continent' );
718
+				if (!$term = term_exists(trim($continent_code), 'continent')) {
719
+					$term = wp_insert_term(trim($continent_code), 'continent');
720 720
 
721
-					if ( is_wp_error( $term ) ) {
721
+					if (is_wp_error($term)) {
722 722
 						// @codingStandardsIgnoreLine
723 723
 						echo $term->get_error_message();
724 724
 					}
725
-				} else {
726
-					wp_set_object_terms( $id, sanitize_title( $continent_code ), 'continent', true );
725
+				}else {
726
+					wp_set_object_terms($id, sanitize_title($continent_code), 'continent', true);
727 727
 				}
728 728
 			}
729 729
 		}
@@ -733,11 +733,11 @@  discard block
 block discarded – undo
733 733
 	 * search_form
734 734
 	 */
735 735
 	public function update_options_form() {
736
-		echo '<div style="display:none;" class="wetu-status"><h3>' . esc_html__( 'Wetu Status', 'wetu-importer' ) . '</h3>';
736
+		echo '<div style="display:none;" class="wetu-status"><h3>'.esc_html__('Wetu Status', 'wetu-importer').'</h3>';
737 737
 
738
-		$accommodation = get_transient( 'lsx_ti_accommodation' );
738
+		$accommodation = get_transient('lsx_ti_accommodation');
739 739
 
740
-		if ( '' === $accommodation || false === $accommodation || isset( $_GET['refresh_accommodation'] ) ) {
740
+		if ('' === $accommodation || false === $accommodation || isset($_GET['refresh_accommodation'])) {
741 741
 			$this->update_options();
742 742
 		}
743 743
 
@@ -748,14 +748,14 @@  discard block
 block discarded – undo
748 748
 	 * Save the list of Accommodation into an option
749 749
 	 */
750 750
 	public function update_options() {
751
-		$data = file_get_contents( $this->url . '/List?' . $this->url_qs );
751
+		$data = file_get_contents($this->url.'/List?'.$this->url_qs);
752 752
 
753
-		$accommodation = json_decode( $data, true );
753
+		$accommodation = json_decode($data, true);
754 754
 
755
-		if ( isset( $accommodation['error'] ) ) {
755
+		if (isset($accommodation['error'])) {
756 756
 			return $accommodation['error'];
757
-		} elseif ( isset( $accommodation ) && ! empty( $accommodation ) ) {
758
-			set_transient( 'lsx_ti_accommodation',$accommodation,60 * 60 * 2 );
757
+		} elseif (isset($accommodation) && !empty($accommodation)) {
758
+			set_transient('lsx_ti_accommodation', $accommodation, 60 * 60 * 2);
759 759
 			return true;
760 760
 		}
761 761
 	}
Please login to merge, or discard this patch.