Passed
Push — master ( c9a335...2052a6 )
by Warwick
03:24
created
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-logger.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace lsx;
4 4
 
5
-if ( ! class_exists( '\lsx\LSX_Logger' ) ) {
5
+if (!class_exists('\lsx\LSX_Logger')) {
6 6
 
7 7
 	/**
8 8
 	 * LSX_Logger Main Class
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		 * Constructor.
33 33
 		 */
34 34
 		public function __construct() {
35
-			add_action( 'wp_before_admin_bar_render', array( $this, 'wp_admin_bar_menu' ) );
35
+			add_action('wp_before_admin_bar_render', array($this, 'wp_admin_bar_menu'));
36 36
 		}
37 37
 
38 38
 		/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		public static function init() {
44 44
 
45 45
 			// If the single instance hasn't been set, set it now.
46
-			if ( ! isset( self::$instance ) ) {
46
+			if (!isset(self::$instance)) {
47 47
 				self::$instance = new self();
48 48
 			}
49 49
 			return self::$instance;
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 		 * @param $message string
58 58
 		 * @return  void
59 59
 		 */
60
-		public function log( $plugin = '', $key = '', $message = '' ) {
61
-			$this->logs[ $plugin ][ $key ] = $message;
60
+		public function log($plugin = '', $key = '', $message = '') {
61
+			$this->logs[$plugin][$key] = $message;
62 62
 		}
63 63
 
64 64
 		/**
@@ -67,19 +67,19 @@  discard block
 block discarded – undo
67 67
 		 * @param $plugin string | boolean
68 68
 		 * @return  string
69 69
 		 */
70
-		public function output_log( $plugin = false ) {
70
+		public function output_log($plugin = false) {
71 71
 			$return = '';
72
-			if ( ! empty( $this->logs ) ) {
73
-				foreach ( $this->logs as $plugin_key => $log ) {
72
+			if (!empty($this->logs)) {
73
+				foreach ($this->logs as $plugin_key => $log) {
74 74
 
75 75
 					$return = '<div style="padding: 15px;">';
76
-					if ( false !== $plugin && $plugin_key !== $plugin ) {
76
+					if (false !== $plugin && $plugin_key !== $plugin) {
77 77
 						continue;
78
-					} else if ( false === $plugin ) {
79
-						$return .= '<h4>' . $plugin_key . '</h4>';
78
+					}else if (false === $plugin) {
79
+						$return .= '<h4>'.$plugin_key.'</h4>';
80 80
 					}
81 81
 					$return .= '<ul>';
82
-					$return .= $this->loop_through_logs( $log );
82
+					$return .= $this->loop_through_logs($log);
83 83
 					$return .= '</ul>';
84 84
 					$return .= '</div>';
85 85
 				}
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 		 * @param $log_array array
94 94
 		 * @return  string
95 95
 		 */
96
-		public function loop_through_logs( $log_array = array() ) {
96
+		public function loop_through_logs($log_array = array()) {
97 97
 			$return = '';
98
-			foreach ( $log_array as $key => $message ) {
99
-				$return .= '<li>' . $message . ' <small>(' . $key . ')</small></li>';
98
+			foreach ($log_array as $key => $message) {
99
+				$return .= '<li>'.$message.' <small>('.$key.')</small></li>';
100 100
 			}
101 101
 			return $return;
102 102
 		}
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 		 */
109 109
 		function wp_admin_bar_menu() {
110 110
 			global $wp_admin_bar;
111
-			$wp_admin_bar->add_menu( array(
111
+			$wp_admin_bar->add_menu(array(
112 112
 				'parent' => false,
113 113
 				'id' => 'lsx_logger',
114
-				'title' => __( 'LSX Log' ), // link title
114
+				'title' => __('LSX Log'), // link title
115 115
 				'href' => '',
116 116
 			));
117
-			$wp_admin_bar->add_menu( array(
117
+			$wp_admin_bar->add_menu(array(
118 118
 				'parent' => 'lsx_logger',
119 119
 				'id' => 'lsx_logger_output',
120 120
 				'title' => '', // link title
Please login to merge, or discard this patch.
wetu-importer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@
 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', '2.0.0' );
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', '2.0.0');
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
 /* ======================= Below is the Plugin Class init ========================= */
22 22
 
23
-require_once( WETU_IMPORTER_PATH . 'classes/class-lsx-logger.php' );
24
-require_once( WETU_IMPORTER_PATH . 'classes/class-wetu-importer.php' );
23
+require_once(WETU_IMPORTER_PATH.'classes/class-lsx-logger.php');
24
+require_once(WETU_IMPORTER_PATH.'classes/class-wetu-importer.php');
Please login to merge, or discard this patch.
classes/class-settings.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 			'height'                             => '600',
59 59
 			'scaling'                            => 'h',
60 60
 		);
61
-		$this->fields   = array_keys( $this->defaults );
62
-		add_action( 'admin_init', array( $this, 'save_options' ) );
61
+		$this->fields = array_keys($this->defaults);
62
+		add_action('admin_init', array($this, 'save_options'));
63 63
 	}
64 64
 
65 65
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function get_instance() {
71 71
 		// If the single instance hasn't been set, set it now.
72
-		if ( ! isset( self::$instance ) ) {
72
+		if (!isset(self::$instance)) {
73 73
 			self::$instance = new self();
74 74
 		}
75 75
 		return self::$instance;
@@ -80,117 +80,117 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function display_page() {
82 82
 		$options = \wetu_importer\includes\helpers\get_options();
83
-		foreach ( $options as $key => $value ) {
84
-			$value = trim( $value );
83
+		foreach ($options as $key => $value) {
84
+			$value = trim($value);
85 85
 		}
86
-		$options = wp_parse_args( $options, $this->defaults );
86
+		$options = wp_parse_args($options, $this->defaults);
87 87
 		?>
88 88
 		<div class="wrap">
89 89
 			<form method="post" class="">
90
-				<?php wp_nonce_field( 'wetu_importer_save', 'wetu_importer_save_options' ); ?>
90
+				<?php wp_nonce_field('wetu_importer_save', 'wetu_importer_save_options'); ?>
91 91
 				
92
-				<h1><?php esc_html_e( 'General', 'wetu-importer' ); ?></h1>
92
+				<h1><?php esc_html_e('General', 'wetu-importer'); ?></h1>
93 93
 				<table class="form-table">
94 94
 					<tbody>
95 95
 						<tr class="form-field">
96 96
 							<th scope="row">
97
-								<label for="wetu_api_key"> <?php esc_html_e( 'API Key', 'wetu-importer' ); ?></label>
97
+								<label for="wetu_api_key"> <?php esc_html_e('API Key', 'wetu-importer'); ?></label>
98 98
 							</th>
99 99
 							<td>
100
-								<input type="text" value="<?php if ( isset( $options['api_key'] ) ) { echo esc_attr( $options['api_key'] ); } ?>" name="api_key" />
100
+								<input type="text" value="<?php if (isset($options['api_key'])) { echo esc_attr($options['api_key']); } ?>" name="api_key" />
101 101
 							</td>
102 102
 						</tr>
103 103
 						<tr class="form-field -wrap">
104 104
 							<th scope="row">
105
-								<label for="disable_tour_descriptions"><?php esc_html_e( 'Disable Tour Descriptions', 'wetu-importer' ); ?></label>
105
+								<label for="disable_tour_descriptions"><?php esc_html_e('Disable Tour Descriptions', 'wetu-importer'); ?></label>
106 106
 							</th>
107 107
 							<td>
108 108
 								<input type="checkbox"
109 109
 								<?php
110
-								if ( isset( $options['disable_tour_descriptions'] ) && '' !== $options['disable_tour_descriptions'] ) {
111
-									echo esc_attr( 'checked="checked"' );
110
+								if (isset($options['disable_tour_descriptions']) && '' !== $options['disable_tour_descriptions']) {
111
+									echo esc_attr('checked="checked"');
112 112
 								}
113 113
 								?>
114 114
 								name="disable_tour_descriptions" />
115 115
 
116
-								<small><?php esc_html_e( 'If you are going to manage your tour descriptions on this site and not on WETU then enable this setting.', 'wetu-importer' ); ?></small>
116
+								<small><?php esc_html_e('If you are going to manage your tour descriptions on this site and not on WETU then enable this setting.', 'wetu-importer'); ?></small>
117 117
 							</td>
118 118
 						</tr>
119 119
 						<tr class="form-field -wrap">
120 120
 							<th scope="row">
121
-								<label for="disable_accommodation_descriptions"><?php esc_html_e( 'Disable Accommodation Descriptions', 'wetu-importer' ); ?></label>
121
+								<label for="disable_accommodation_descriptions"><?php esc_html_e('Disable Accommodation Descriptions', 'wetu-importer'); ?></label>
122 122
 							</th>
123 123
 							<td>
124 124
 								<input type="checkbox"
125 125
 								<?php
126
-								if ( isset( $options['disable_accommodation_descriptions'] ) && '' !== $options['disable_accommodation_descriptions'] ) {
127
-									echo esc_attr( 'checked="checked"' );
126
+								if (isset($options['disable_accommodation_descriptions']) && '' !== $options['disable_accommodation_descriptions']) {
127
+									echo esc_attr('checked="checked"');
128 128
 								}
129 129
 								?>
130 130
 								name="disable_accommodation_descriptions" />
131
-								<small><?php esc_html_e( 'If you are going to edit the accommodation descriptions imported then enable this setting.', 'wetu-importer' ); ?></small>
131
+								<small><?php esc_html_e('If you are going to edit the accommodation descriptions imported then enable this setting.', 'wetu-importer'); ?></small>
132 132
 							</td>
133 133
 						</tr>
134 134
 						<tr class="form-field -wrap">
135 135
 							<th scope="row">
136
-								<label for="disable_accommodation_excerpts"><?php esc_html_e( 'Disable Accommodation Excerpts', 'wetu-importer' ); ?></label>
136
+								<label for="disable_accommodation_excerpts"><?php esc_html_e('Disable Accommodation Excerpts', 'wetu-importer'); ?></label>
137 137
 							</th>
138 138
 							<td>
139 139
 								<input type="checkbox"
140 140
 								<?php
141
-								if ( isset( $options['disable_accommodation_excerpts'] ) && '' !== $options['disable_accommodation_excerpts'] ) {
142
-									echo esc_attr( 'checked="checked"' );
141
+								if (isset($options['disable_accommodation_excerpts']) && '' !== $options['disable_accommodation_excerpts']) {
142
+									echo esc_attr('checked="checked"');
143 143
 								}
144 144
 								?>
145 145
 								name="disable_accommodation_excerpts" />
146
-								<small><?php esc_html_e( 'If you are going to edit the accommodation excerpts then enable this setting.', 'wetu-importer' ); ?></small>
146
+								<small><?php esc_html_e('If you are going to edit the accommodation excerpts then enable this setting.', 'wetu-importer'); ?></small>
147 147
 							</td>
148 148
 						</tr>
149 149
 						<tr class="form-field -wrap">
150 150
 							<th scope="row">
151
-								<label for="disable_destination_descriptions"><?php esc_html_e( 'Disable Destinations Descriptions', 'wetu-importer' ); ?></label>
151
+								<label for="disable_destination_descriptions"><?php esc_html_e('Disable Destinations Descriptions', 'wetu-importer'); ?></label>
152 152
 							</th>
153 153
 							<td>
154 154
 								<input type="checkbox"
155 155
 								<?php
156
-								if ( isset( $options['disable_destination_descriptions'] ) && '' !== $options['disable_destination_descriptions'] ) {
157
-									echo esc_attr( 'checked="checked"' );
156
+								if (isset($options['disable_destination_descriptions']) && '' !== $options['disable_destination_descriptions']) {
157
+									echo esc_attr('checked="checked"');
158 158
 								}
159 159
 								?>
160 160
 								name="disable_destination_descriptions" />
161
-								<small><?php esc_html_e( 'If you are going to edit the destination descriptions on this site then enable this setting.', 'wetu-importer' ); ?></small>
161
+								<small><?php esc_html_e('If you are going to edit the destination descriptions on this site then enable this setting.', 'wetu-importer'); ?></small>
162 162
 							</td>
163 163
 						</tr>					
164 164
 					</tbody>
165 165
 				</table>
166 166
 
167
-				<h1><?php esc_html_e( 'Images', 'wetu-importer' ); ?></h1>
167
+				<h1><?php esc_html_e('Images', 'wetu-importer'); ?></h1>
168 168
 
169 169
 				<table class="form-table">
170 170
 					<tbody>
171 171
 						<tr class="form-field -wrap">
172 172
 							<th scope="row">
173
-								<label for="image_replacing"><?php esc_html_e( 'Replace Images', 'wetu-importer' ); ?></label>
173
+								<label for="image_replacing"><?php esc_html_e('Replace Images', 'wetu-importer'); ?></label>
174 174
 							</th>
175 175
 							<td>
176 176
 								<input type="checkbox"
177 177
 								<?php
178
-								if ( isset( $options['image_replacing'] ) && '' !== $options['image_replacing'] ) {
179
-									echo esc_attr( 'checked="checked"' );
178
+								if (isset($options['image_replacing']) && '' !== $options['image_replacing']) {
179
+									echo esc_attr('checked="checked"');
180 180
 								}
181 181
 								?>
182 182
 								name="image_replacing" />
183
-								<p><?php esc_html_e( 'Do you want your images to be replaced on each import.', 'wetu-importer' ); ?></p>
183
+								<p><?php esc_html_e('Do you want your images to be replaced on each import.', 'wetu-importer'); ?></p>
184 184
 							</td>
185 185
 						</tr>
186 186
 						<tr class="form-field -wrap">
187 187
 							<th scope="row">
188
-								<label for="image_limit"> <?php esc_html_e( 'Limit the amount of images imported to the gallery', 'wetu-importer' ); ?></label>
188
+								<label for="image_limit"> <?php esc_html_e('Limit the amount of images imported to the gallery', 'wetu-importer'); ?></label>
189 189
 							</th>
190 190
 							<td>
191 191
 								<input placeholder="" type="text" value="<?php
192
-								if ( isset( $options['image_limit'] ) && '' !== $options['image_limit'] ) {
193
-									echo esc_attr( $options['image_limit'] );
192
+								if (isset($options['image_limit']) && '' !== $options['image_limit']) {
193
+									echo esc_attr($options['image_limit']);
194 194
 								}
195 195
 								?>
196 196
 								"
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 
201 201
 						<tr class="form-field -wrap">
202 202
 							<th scope="row">
203
-								<label for="image_scaling"><?php esc_html_e( 'Enable Image Scaling', 'wetu-importer' ); ?></label>
203
+								<label for="image_scaling"><?php esc_html_e('Enable Image Scaling', 'wetu-importer'); ?></label>
204 204
 							</th>
205 205
 							<td>
206 206
 								<input type="checkbox"
207 207
 								<?php
208
-								if ( isset( $options['image_scaling'] ) && '' !== $options['image_scaling'] ) {
209
-									echo esc_attr( 'checked="checked"' );
208
+								if (isset($options['image_scaling']) && '' !== $options['image_scaling']) {
209
+									echo esc_attr('checked="checked"');
210 210
 								}
211 211
 								?>
212 212
 								name="image_scaling" />
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
 						</tr>
215 215
 						<tr class="form-field -wrap">
216 216
 							<th scope="row">
217
-								<label for="width"> <?php esc_html_e( 'Width (px)', 'wetu-importer' ); ?></label>
217
+								<label for="width"> <?php esc_html_e('Width (px)', 'wetu-importer'); ?></label>
218 218
 							</th>
219 219
 							<td>
220 220
 								<input placeholder="800" type="text" value="<?php
221
-								if ( isset( $options['width'] ) && '' !== $options['width'] ) {
222
-									echo esc_attr( $options['width'] );
221
+								if (isset($options['width']) && '' !== $options['width']) {
222
+									echo esc_attr($options['width']);
223 223
 								}
224 224
 								?>"
225 225
 								name="width" />
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 						</tr>
228 228
 						<tr class="form-field -wrap">
229 229
 							<th scope="row">
230
-								<label for="height"> <?php esc_html_e( 'Height (px)', 'wetu-importer' ); ?></label>
230
+								<label for="height"> <?php esc_html_e('Height (px)', 'wetu-importer'); ?></label>
231 231
 							</th>
232 232
 							<td>
233 233
 								<input placeholder="600" type="text" value="<?php
234
-								if ( isset( $options['height'] ) && '' !== $options['height'] ) {
235
-									echo esc_attr( $options['height'] );
234
+								if (isset($options['height']) && '' !== $options['height']) {
235
+									echo esc_attr($options['height']);
236 236
 								}
237 237
 								?>"
238 238
 								name="height" />
@@ -241,63 +241,63 @@  discard block
 block discarded – undo
241 241
 
242 242
 						<tr class="form-field -wrap">
243 243
 							<th scope="row">
244
-								<label for="scaling"> <?php esc_html_e( 'Scaling', 'wetu-importer' ); ?></label>
244
+								<label for="scaling"> <?php esc_html_e('Scaling', 'wetu-importer'); ?></label>
245 245
 							</th>
246 246
 							<td>
247 247
 								<input type="radio"
248 248
 								<?php
249
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'raw' === $options['scaling'] ) {
250
-									echo esc_attr( 'checked="checked"' );
249
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'raw' === $options['scaling']) {
250
+									echo esc_attr('checked="checked"');
251 251
 								}
252 252
 								?>
253
-								name="scaling" value="raw" /> <?php esc_html_e( 'Get the Full size image, no cropping takes place.', 'wetu-importer' ); ?><br />
253
+								name="scaling" value="raw" /> <?php esc_html_e('Get the Full size image, no cropping takes place.', 'wetu-importer'); ?><br />
254 254
 								<input type="radio"
255 255
 								<?php
256
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'c' === $options['scaling'] ) {
257
-									echo esc_attr( 'checked="checked"' );
256
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'c' === $options['scaling']) {
257
+									echo esc_attr('checked="checked"');
258 258
 								}
259 259
 								?>
260
-								name="scaling"  value="c" /> <?php esc_html_e( 'Crop image to fit fully into the frame, Crop is taken from middle, preserving as much of the image as possible.', 'wetu-importer' ); ?><br />
260
+								name="scaling"  value="c" /> <?php esc_html_e('Crop image to fit fully into the frame, Crop is taken from middle, preserving as much of the image as possible.', 'wetu-importer'); ?><br />
261 261
 								<input type="radio"
262 262
 								<?php
263
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'h' === $options['scaling'] ) {
264
-									echo esc_attr( 'checked="checked"' );
263
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'h' === $options['scaling']) {
264
+									echo esc_attr('checked="checked"');
265 265
 								}
266 266
 								?>
267
-								name="scaling"  value="h" /> <?php esc_html_e( 'Crop image to fit fully into the frame, but resize to height first, then crop on width if needed', 'wetu-importer' ); ?><br />
267
+								name="scaling"  value="h" /> <?php esc_html_e('Crop image to fit fully into the frame, but resize to height first, then crop on width if needed', 'wetu-importer'); ?><br />
268 268
 								<input type="radio"
269 269
 								<?php
270
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'w' === $options['scaling'] ) {
271
-									echo esc_attr( 'checked="checked"' );
270
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'w' === $options['scaling']) {
271
+									echo esc_attr('checked="checked"');
272 272
 								}
273 273
 								?>
274
-								name="scaling"  value="w" /> <?php esc_html_e( 'Crop image to fit fully into the frame, but resize to width first, then crop on height if needed', 'wetu-importer' ); ?><br />
274
+								name="scaling"  value="w" /> <?php esc_html_e('Crop image to fit fully into the frame, but resize to width first, then crop on height if needed', 'wetu-importer'); ?><br />
275 275
 								<input type="radio"
276 276
 								<?php
277
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'nf' === $options['scaling'] ) {
278
-									echo esc_attr( 'checked="checked"' );
277
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'nf' === $options['scaling']) {
278
+									echo esc_attr('checked="checked"');
279 279
 								}
280 280
 								?>
281
-								name="scaling"  value="nf" /> <?php esc_html_e( 'Resize the image to fit within the frame. but pad the image with white to ensure the resolution matches the frame', 'wetu-importer' ); ?><br />
281
+								name="scaling"  value="nf" /> <?php esc_html_e('Resize the image to fit within the frame. but pad the image with white to ensure the resolution matches the frame', 'wetu-importer'); ?><br />
282 282
 								<input type="radio"
283 283
 								<?php
284
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'n' === $options['scaling'] ) {
285
-									echo esc_attr( 'checked="checked"' );
284
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'n' === $options['scaling']) {
285
+									echo esc_attr('checked="checked"');
286 286
 								}
287 287
 								?>
288
-								name="scaling"  value="n" /> <?php esc_html_e( 'Resize the image to fit within the frame. but do not upscale the image.', 'wetu-importer' ); ?><br />
288
+								name="scaling"  value="n" /> <?php esc_html_e('Resize the image to fit within the frame. but do not upscale the image.', 'wetu-importer'); ?><br />
289 289
 								<input type="radio"
290 290
 								<?php
291
-								if ( isset( $options['scaling'] ) && '' !== $options['scaling'] && 'W' === $options['scaling'] ) {
292
-									echo esc_attr( 'checked="checked"' );
291
+								if (isset($options['scaling']) && '' !== $options['scaling'] && 'W' === $options['scaling']) {
292
+									echo esc_attr('checked="checked"');
293 293
 								}
294 294
 								?>
295
-								name="scaling"  value="W" /> <?php esc_html_e( 'Resize the image to fit within the frame. Image will not exceed specified dimensions', 'wetu-importer' ); ?>
295
+								name="scaling"  value="W" /> <?php esc_html_e('Resize the image to fit within the frame. Image will not exceed specified dimensions', 'wetu-importer'); ?>
296 296
 							</td>
297 297
 						</tr>
298 298
 					</tbody>
299 299
 				</table>
300
-				<p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_html_e( 'Save Changes', 'wetu-importer' ); ?>"></p>
300
+				<p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_html_e('Save Changes', 'wetu-importer'); ?>"></p>
301 301
 			</form>
302 302
 		</div>
303 303
 		<?php
@@ -309,17 +309,17 @@  discard block
 block discarded – undo
309 309
 	 * @return void
310 310
 	 */
311 311
 	public function save_options() {
312
-		if ( ! isset( $_POST['wetu_importer_save_options'] ) || ! wp_verify_nonce( $_POST['wetu_importer_save_options'], 'wetu_importer_save' ) ) {
312
+		if (!isset($_POST['wetu_importer_save_options']) || !wp_verify_nonce($_POST['wetu_importer_save_options'], 'wetu_importer_save')) {
313 313
 			return;
314 314
 		}
315 315
 		$data_to_save = array();
316
-		foreach ( $this->defaults as $key => $field ) {
317
-			if ( isset( $_POST[ $key ] ) ) {
318
-				$data_to_save[ $key ] = $_POST[ $key ];
319
-			} else {
320
-				$data_to_save[ $key ] = '';
316
+		foreach ($this->defaults as $key => $field) {
317
+			if (isset($_POST[$key])) {
318
+				$data_to_save[$key] = $_POST[$key];
319
+			}else {
320
+				$data_to_save[$key] = '';
321 321
 			}
322 322
 		}
323
-		update_option( 'wetu_importer_settings', $data_to_save );
323
+		update_option('wetu_importer_settings', $data_to_save);
324 324
 	}
325 325
 }
Please login to merge, or discard this patch.
classes/class-welcome.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function get_instance() {
42 42
 		// If the single instance hasn't been set, set it now.
43
-		if ( ! isset( self::$instance ) ) {
43
+		if (!isset(self::$instance)) {
44 44
 			self::$instance = new self();
45 45
 		}
46 46
 		return self::$instance;
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	public function display_page() {
53 53
 		?>
54 54
 		<div class="row section">
55
-			<h1><?php esc_html_e( 'Welcome to the LSX Wetu Importer', 'wetu-importer' ); ?></h1>
56
-			<p><?php esc_html_e( 'If this is the first time running the import, please follow the steps below.', 'wetu-importer' ); ?></p>
55
+			<h1><?php esc_html_e('Welcome to the LSX Wetu Importer', 'wetu-importer'); ?></h1>
56
+			<p><?php esc_html_e('If this is the first time running the import, please follow the steps below.', 'wetu-importer'); ?></p>
57 57
 		</div>
58 58
 		<?php
59 59
 		$this->importer_steps();
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 		?>
70 70
 		<div class="row section postbox">
71 71
 			<div class="welcome-block-header">
72
-				<p class="heading"><?php esc_html_e( 'Import your tours', 'wetu-importer' ); ?></p>
72
+				<p class="heading"><?php esc_html_e('Import your tours', 'wetu-importer'); ?></p>
73 73
 				<p class="value"><span>1</span></p>
74 74
 			</div>
75 75
 			<div class="welcome-block-header">
76
-				<p class="heading"><?php esc_html_e( 'Import accommodation', 'wetu-importer' ); ?></p>
76
+				<p class="heading"><?php esc_html_e('Import accommodation', 'wetu-importer'); ?></p>
77 77
 				<p class="value"><span>2</span></p>
78 78
 			</div>
79 79
 			<div class="welcome-block-header">
80
-				<p class="heading"><?php esc_html_e( 'Import destination', 'wetu-importer' ); ?></p>
80
+				<p class="heading"><?php esc_html_e('Import destination', 'wetu-importer'); ?></p>
81 81
 				<p class="value"><span>3</span></p>
82 82
 			</div>
83 83
 			<div class="welcome-block-header">
84
-				<p class="heading"><?php esc_html_e( 'Done', 'wetu-importer' ); ?></p>
84
+				<p class="heading"><?php esc_html_e('Done', 'wetu-importer'); ?></p>
85 85
 				<p class="value"><span class="dashicons dashicons-yes"></span></p>
86 86
 			</div>
87 87
 			<div class="spacer"></div>
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function tour_block() {
122 122
 		?>
123
-			<h2 class="title"><?php esc_html_e( 'Importing tours', 'wetu-importer' ); ?></h2>
124
-			<p class="excerpt"><?php esc_html_e( 'Search for tours, select the ones you want to import and choose the data you want to sync on import. All connected accommodadtions will be imported as drafts to be pubished after completing the tour import.', 'wetu-importer' ); ?></p>
125
-			<p><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=tour' ); ?>" class="button button-primary"><?php esc_html_e( 'Import Tours', 'wetu-importer' ); ?></a></p>
123
+			<h2 class="title"><?php esc_html_e('Importing tours', 'wetu-importer'); ?></h2>
124
+			<p class="excerpt"><?php esc_html_e('Search for tours, select the ones you want to import and choose the data you want to sync on import. All connected accommodadtions will be imported as drafts to be pubished after completing the tour import.', 'wetu-importer'); ?></p>
125
+			<p><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=tour'); ?>" class="button button-primary"><?php esc_html_e('Import Tours', 'wetu-importer'); ?></a></p>
126 126
 			<p>
127 127
 				<ul class="link-list">
128
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=tour' ); ?>#publish"><?php esc_html_e( 'Published', 'wetu-importer' ); ?>  (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( 'tour', 'publish ' ) ); ?>)</a></li>
129
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=tour' ); ?>#pending"><?php esc_html_e( 'Pending', 'wetu-importer' ); ?>  (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( 'tour', 'pending ' ) ); ?>)</a></li>
130
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=tour' ); ?>#draft"><?php esc_html_e( 'Draft', 'wetu-importer' ); ?>  (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( 'tour', 'draft ' ) ); ?>)</a></li>
128
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=tour'); ?>#publish"><?php esc_html_e('Published', 'wetu-importer'); ?>  (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count('tour', 'publish ')); ?>)</a></li>
129
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=tour'); ?>#pending"><?php esc_html_e('Pending', 'wetu-importer'); ?>  (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count('tour', 'pending ')); ?>)</a></li>
130
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=tour'); ?>#draft"><?php esc_html_e('Draft', 'wetu-importer'); ?>  (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count('tour', 'draft ')); ?>)</a></li>
131 131
 				</ul>
132 132
 			</p>			
133 133
 		<?php
@@ -139,16 +139,16 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function accommodation_block() {
141 141
 		?>
142
-			<h2 class="title"><?php esc_html_e( 'Import and publish accommodation', 'wetu-importer' ); ?></h2>
143
-			<p class="excerpt"><?php esc_html_e( 'All accommodations connnected to your tours have been imported as drafts. Review the imported accommodations, sync selected data and publish.', 'wetu-importer' ); ?></p>
144
-			<p><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=accommodation' ); ?>" class="button button-primary"><?php esc_html_e( 'Sync accommodation', 'wetu-importer' ); ?></a></p>
142
+			<h2 class="title"><?php esc_html_e('Import and publish accommodation', 'wetu-importer'); ?></h2>
143
+			<p class="excerpt"><?php esc_html_e('All accommodations connnected to your tours have been imported as drafts. Review the imported accommodations, sync selected data and publish.', 'wetu-importer'); ?></p>
144
+			<p><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=accommodation'); ?>" class="button button-primary"><?php esc_html_e('Sync accommodation', 'wetu-importer'); ?></a></p>
145 145
 
146 146
 			<p>
147 147
 				<ul class="link-list">
148
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=accommodation' ); ?>#publish"><?php esc_html_e( 'Published', 'wetu-importer' ); ?> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( 'accommodation', 'publish ' ) ); ?>)</a></li>
149
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=accommodation' ); ?>#pending"><?php esc_html_e( 'Pending', 'wetu-importer' ); ?> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( 'accommodation', 'pending ' ) ); ?>)</a></li>
150
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=accommodation' ); ?>#draft"><?php esc_html_e( 'Draft', 'wetu-importer' ); ?> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( 'accommodation', 'draft ' ) ); ?>)</a></li>
151
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=accommodation' ); ?>#import"><?php esc_html_e( 'Wetu Queue', 'wetu-importer' ); ?>  (<?php echo esc_attr( \wetu_importer\includes\helpers\get_wetu_queue_count( 'accommodation' ) ); ?>)</a></li>
148
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=accommodation'); ?>#publish"><?php esc_html_e('Published', 'wetu-importer'); ?> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count('accommodation', 'publish ')); ?>)</a></li>
149
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=accommodation'); ?>#pending"><?php esc_html_e('Pending', 'wetu-importer'); ?> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count('accommodation', 'pending ')); ?>)</a></li>
150
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=accommodation'); ?>#draft"><?php esc_html_e('Draft', 'wetu-importer'); ?> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count('accommodation', 'draft ')); ?>)</a></li>
151
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=accommodation'); ?>#import"><?php esc_html_e('Wetu Queue', 'wetu-importer'); ?>  (<?php echo esc_attr(\wetu_importer\includes\helpers\get_wetu_queue_count('accommodation')); ?>)</a></li>
152 152
 				</ul>
153 153
 			</p>			
154 154
 		<?php
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function destination_block() {
162 162
 		?>
163
-			<h2 class="title"><?php esc_html_e( 'Import and publish destinations', 'wetu-importer' ); ?></h2>
164
-			<p class="excerpt"><?php esc_html_e( 'All destinations and regions connnected to your tours & accommodations have been imported as drafts. Review the imported accommodations, sync selected data and publish.', 'wetu-importer' ); ?></p>
165
-			<p><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=destination' ); ?>" class="button button-primary"><?php esc_html_e( 'Sync destinations', 'wetu-importer' ); ?></a></p>
163
+			<h2 class="title"><?php esc_html_e('Import and publish destinations', 'wetu-importer'); ?></h2>
164
+			<p class="excerpt"><?php esc_html_e('All destinations and regions connnected to your tours & accommodations have been imported as drafts. Review the imported accommodations, sync selected data and publish.', 'wetu-importer'); ?></p>
165
+			<p><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=destination'); ?>" class="button button-primary"><?php esc_html_e('Sync destinations', 'wetu-importer'); ?></a></p>
166 166
 			<p>
167 167
 				<ul class="link-list">
168
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=destination' ); ?>#publish"><?php esc_html_e( 'Published', 'wetu-importer' ); ?> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( 'destination', 'publish ' ) ); ?>)</a></li>
169
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=destination' ); ?>#pending"><?php esc_html_e( 'Pending', 'wetu-importer' ); ?> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( 'destination', 'pending ' ) ); ?>)</a></li>
170
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=destination' ); ?>#draft"><?php esc_html_e( 'Draft', 'wetu-importer' ); ?> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( 'destination', 'draft ' ) ); ?>)</a></li>
171
-					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=wetu-importer&tab=destination' ); ?>#import"><?php esc_html_e( 'Wetu Queue', 'wetu-importer' ); ?>  (<?php echo esc_attr( \wetu_importer\includes\helpers\get_wetu_queue_count( 'destination' ) ); ?>)</a></li>
168
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=destination'); ?>#publish"><?php esc_html_e('Published', 'wetu-importer'); ?> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count('destination', 'publish ')); ?>)</a></li>
169
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=destination'); ?>#pending"><?php esc_html_e('Pending', 'wetu-importer'); ?> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count('destination', 'pending ')); ?>)</a></li>
170
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=destination'); ?>#draft"><?php esc_html_e('Draft', 'wetu-importer'); ?> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count('destination', 'draft ')); ?>)</a></li>
171
+					<li><a href="<?php echo esc_attr(admin_url('admin.php').'?page=wetu-importer&tab=destination'); ?>#import"><?php esc_html_e('Wetu Queue', 'wetu-importer'); ?>  (<?php echo esc_attr(\wetu_importer\includes\helpers\get_wetu_queue_count('destination')); ?>)</a></li>
172 172
 				</ul>
173 173
 			</p>
174 174
 		<?php
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function end_block() {
182 182
 		?>
183
-			<h2 class="title"><?php esc_html_e( 'Done! Check out your imported content', 'wetu-importer' ); ?></h2>
184
-			<p><?php esc_html_e( 'If you’ve updated your content on Wetu then you can return to these steps at any stage to import and re-sync any updates', 'wetu-importer' ); ?></p>
183
+			<h2 class="title"><?php esc_html_e('Done! Check out your imported content', 'wetu-importer'); ?></h2>
184
+			<p><?php esc_html_e('If you’ve updated your content on Wetu then you can return to these steps at any stage to import and re-sync any updates', 'wetu-importer'); ?></p>
185 185
 		<?php
186 186
 	}
187 187
 }
Please login to merge, or discard this patch.
includes/helpers.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
  * @return array
18 18
  */
19 19
 function get_options() {
20
-	$options = get_option( 'wetu_importer_settings', array() );
21
-	if ( empty( $options ) ) {
20
+	$options = get_option('wetu_importer_settings', array());
21
+	if (empty($options)) {
22 22
 		// Check for any previous options.
23
-		$temp_options = get_option( '_lsx-to_settings', false );
24
-		if ( false !== $temp_options && isset( $temp_options['wetu-importer'] ) && ! empty( $temp_options['wetu-importer'] ) ) {
23
+		$temp_options = get_option('_lsx-to_settings', false);
24
+		if (false !== $temp_options && isset($temp_options['wetu-importer']) && !empty($temp_options['wetu-importer'])) {
25 25
 			$options = $temp_options['wetu-importer'];		
26 26
 		}
27
-		if ( false !== $temp_options && isset( $temp_options['api']['wetu_api_key'] ) && '' !== $temp_options['api']['wetu_api_key'] ) {
27
+		if (false !== $temp_options && isset($temp_options['api']['wetu_api_key']) && '' !== $temp_options['api']['wetu_api_key']) {
28 28
 			$options['api_key'] = $temp_options['api']['wetu_api_key'];
29 29
 		}
30 30
 
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
  * @param string $post_status
40 40
  * @return void
41 41
  */
42
-function get_post_count( $post_type = '', $post_status = '' ) {
42
+function get_post_count($post_type = '', $post_status = '') {
43 43
 	global $wpdb;
44 44
 	$count = '0';
45
-	if ( '' !== $post_type && '' !== $post_status ) {
45
+	if ('' !== $post_type && '' !== $post_status) {
46 46
 		$result = $wpdb->get_var("
47 47
 			SELECT COUNT(`ID`)
48 48
 			FROM `{$wpdb->posts}`
49 49
 			WHERE `post_status` = '{$post_status}' AND `post_type` = '{$post_type}'
50 50
 		");
51
-		if ( false !== $result && '' !== $result ) {
51
+		if (false !== $result && '' !== $result) {
52 52
 			$count = $result;
53 53
 		}
54 54
 	}
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
  * @param string $post_type
62 62
  * @return void
63 63
  */
64
-function get_wetu_queue_count( $post_type = '' ) {
64
+function get_wetu_queue_count($post_type = '') {
65 65
 	$count = '0';
66
-	$queued_imports = get_option( 'wetu_importer_que', array() );
67
-	if ( isset( $queued_imports[ $post_type ] ) ) {
68
-		$count = count( $queued_imports[ $post_type ] );
66
+	$queued_imports = get_option('wetu_importer_que', array());
67
+	if (isset($queued_imports[$post_type])) {
68
+		$count = count($queued_imports[$post_type]);
69 69
 	}
70 70
 	return $count;
71 71
 }
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
  * @param string $post_type
77 77
  * @return void
78 78
  */
79
-function get_wetu_tour_count( $post_type = '' ) {
79
+function get_wetu_tour_count($post_type = '') {
80 80
 	$count = '0';
81
-	$wetu_tours = get_transient( 'lsx_ti_tours', array() );
82
-	if ( ! empty( $wetu_tours ) ) {
83
-		$count = count( $wetu_tours );
81
+	$wetu_tours = get_transient('lsx_ti_tours', array());
82
+	if (!empty($wetu_tours)) {
83
+		$count = count($wetu_tours);
84 84
 	}
85 85
 	return $count;
86 86
 }
Please login to merge, or discard this patch.
classes/class-wetu-importer.php 1 patch
Spacing   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -197,34 +197,34 @@  discard block
 block discarded – undo
197 197
 	 * @access private
198 198
 	 */
199 199
 	public function __construct() {
200
-		add_action( 'admin_init', array( $this, 'compatible_version_check' ) );
201
-		require_once WETU_IMPORTER_PATH . 'includes/helpers.php';
200
+		add_action('admin_init', array($this, 'compatible_version_check'));
201
+		require_once WETU_IMPORTER_PATH.'includes/helpers.php';
202 202
 
203 203
 		// Don't run anything else in the plugin, if we're on an incompatible PHP version.
204
-		if ( ! self::compatible_version() ) {
204
+		if (!self::compatible_version()) {
205 205
 			return;
206 206
 		}
207 207
 
208 208
 		$this->set_variables();
209 209
 
210
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
211
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) , 11 );
212
-		add_action( 'admin_menu', array( $this, 'register_importer_page' ), 20 );
210
+		add_action('init', array($this, 'load_plugin_textdomain'));
211
+		add_action('admin_enqueue_scripts', array($this, 'admin_scripts'), 11);
212
+		add_action('admin_menu', array($this, 'register_importer_page'), 20);
213 213
 
214
-		require_once WETU_IMPORTER_PATH . 'classes/class-welcome.php';
215
-		require_once WETU_IMPORTER_PATH . 'classes/class-wetu-importer-accommodation.php';
216
-		require_once WETU_IMPORTER_PATH . 'classes/class-wetu-importer-destination.php';
217
-		require_once WETU_IMPORTER_PATH . 'classes/class-wetu-importer-tours.php';
218
-		require_once WETU_IMPORTER_PATH . 'classes/class-settings.php';
214
+		require_once WETU_IMPORTER_PATH.'classes/class-welcome.php';
215
+		require_once WETU_IMPORTER_PATH.'classes/class-wetu-importer-accommodation.php';
216
+		require_once WETU_IMPORTER_PATH.'classes/class-wetu-importer-destination.php';
217
+		require_once WETU_IMPORTER_PATH.'classes/class-wetu-importer-tours.php';
218
+		require_once WETU_IMPORTER_PATH.'classes/class-settings.php';
219 219
 
220
-		add_action( 'init', array( $this, 'load_class' ) );
220
+		add_action('init', array($this, 'load_class'));
221 221
 
222
-		if ( 'default' !== $this->tab_slug ) {
223
-			add_action( 'wp_ajax_lsx_tour_importer', array( $this, 'process_ajax_search' ) );
224
-			add_action( 'wp_ajax_nopriv_lsx_tour_importer', array( $this, 'process_ajax_search' ) );
222
+		if ('default' !== $this->tab_slug) {
223
+			add_action('wp_ajax_lsx_tour_importer', array($this, 'process_ajax_search'));
224
+			add_action('wp_ajax_nopriv_lsx_tour_importer', array($this, 'process_ajax_search'));
225 225
 
226
-			add_action( 'wp_ajax_lsx_import_items', array( $this, 'process_ajax_import' ) );
227
-			add_action( 'wp_ajax_nopriv_lsx_import_items', array( $this, 'process_ajax_import' ) );
226
+			add_action('wp_ajax_lsx_import_items', array($this, 'process_ajax_import'));
227
+			add_action('wp_ajax_nopriv_lsx_import_items', array($this, 'process_ajax_import'));
228 228
 		}
229 229
 	}
230 230
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 	 * @since 1.0.0
237 237
 	 */
238 238
 	public function load_plugin_textdomain() {
239
-		load_plugin_textdomain( 'wetu-importer', false, basename( WETU_IMPORTER_PATH ) . '/languages' );
239
+		load_plugin_textdomain('wetu-importer', false, basename(WETU_IMPORTER_PATH).'/languages');
240 240
 	}
241 241
 
242 242
 	/**
243 243
 	 * Sets the variables used throughout the plugin.
244 244
 	 */
245 245
 	public function set_variables() {
246
-		$this->post_types = array( 'accommodation', 'destination', 'tour' );
246
+		$this->post_types = array('accommodation', 'destination', 'tour');
247 247
 		$options = \wetu_importer\includes\helpers\get_options();
248 248
 
249 249
 		// Set the options.
250
-		if ( ! empty( $options ) ) {
250
+		if (!empty($options)) {
251 251
 			$this->options = $options;
252 252
 
253
-			$temp_options = get_option( '_lsx-to_settings', false );
254
-			if ( false !== $temp_options ) {
253
+			$temp_options = get_option('_lsx-to_settings', false);
254
+			if (false !== $temp_options) {
255 255
 				$this->accommodation_settings = $temp_options['accommodation'];
256 256
 				$this->tour_settings          = $temp_options['tour'];
257 257
 				$this->destination_settings   = $temp_options['destination'];
@@ -259,49 +259,49 @@  discard block
 block discarded – undo
259 259
 
260 260
 			$this->api_key = false;
261 261
 
262
-			if ( ! defined( 'WETU_API_KEY' ) ) {
263
-				if ( isset( $options['api_key'] ) && '' !== $options['api_key'] ) {
262
+			if (!defined('WETU_API_KEY')) {
263
+				if (isset($options['api_key']) && '' !== $options['api_key']) {
264 264
 					$this->api_key = $options['api_key'];
265 265
 				}
266
-			} else {
266
+			}else {
267 267
 				$this->api_key = WETU_API_KEY;
268 268
 			}
269 269
 
270 270
 			// Set the tab slug.
271
-			if ( isset( $_GET['tab'] ) || isset( $_POST['type'] ) ) {
272
-				if ( isset( $_GET['tab'] ) ) {
273
-					$this->tab_slug = wp_unslash( $_GET['tab'] );
274
-				} else {
275
-					$this->tab_slug = wp_unslash( $_POST['type'] );
271
+			if (isset($_GET['tab']) || isset($_POST['type'])) {
272
+				if (isset($_GET['tab'])) {
273
+					$this->tab_slug = wp_unslash($_GET['tab']);
274
+				}else {
275
+					$this->tab_slug = wp_unslash($_POST['type']);
276 276
 				}
277 277
 
278 278
 				// If any tours were queued.
279
-				$this->queued_imports = get_option( 'wetu_importer_que', array() );
279
+				$this->queued_imports = get_option('wetu_importer_que', array());
280 280
 			}
281 281
 
282 282
 			// Set the scaling options.
283
-			if ( isset( $this->options ) && isset( $this->options['image_scaling'] ) ) {
283
+			if (isset($this->options) && isset($this->options['image_scaling'])) {
284 284
 				$this->scale_images = true;
285 285
 
286 286
 				$width = '1024';
287
-				if ( isset( $this->options['width'] ) && '' !== $this->options['width'] ) {
287
+				if (isset($this->options['width']) && '' !== $this->options['width']) {
288 288
 					$width = $this->options['width'];
289 289
 				}
290 290
 
291 291
 				$height = '768';
292
-				if ( isset( $this->options['height'] ) && '' !== $this->options['height'] ) {
292
+				if (isset($this->options['height']) && '' !== $this->options['height']) {
293 293
 					$height = $this->options['height'];
294 294
 				}
295 295
 
296 296
 				$cropping = 'w';
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;
@@ -407,31 +407,31 @@  discard block
 block discarded – undo
407 407
 	 * Registers the admin page which will house the importer form.
408 408
 	 */
409 409
 	public function register_importer_page() {
410
-		add_submenu_page( 'tour-operator', esc_html__( 'Importer', 'tour-operator' ), esc_html__( 'Importer', 'tour-operator' ), 'manage_options', 'wetu-importer', array( $this, 'display_page' ) );
410
+		add_submenu_page('tour-operator', esc_html__('Importer', 'tour-operator'), esc_html__('Importer', 'tour-operator'), 'manage_options', 'wetu-importer', array($this, 'display_page'));
411 411
 	}
412 412
 
413 413
 	/**
414 414
 	 * Enqueue the JS needed to contact wetu and return your result.
415 415
 	 */
416 416
 	public function admin_scripts() {
417
-		if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
417
+		if (defined('WP_DEBUG') && true === WP_DEBUG) {
418 418
 			$min = '';
419
-		} else {
419
+		}else {
420 420
 			$min = '.min';
421 421
 		}
422 422
 
423 423
 		$min = '';
424 424
 
425
-		if ( is_admin() && isset( $_GET['page'] ) && $this->plugin_slug === $_GET['page'] ) {
425
+		if (is_admin() && isset($_GET['page']) && $this->plugin_slug === $_GET['page']) {
426 426
 
427
-			wp_enqueue_style( 'wetu-importer-style', WETU_IMPORTER_URL . 'assets/css/wetu-importer.css', WETU_IMPORTER_VER, true );
428
-			wp_enqueue_script( 'wetu-importers-script', WETU_IMPORTER_URL . 'assets/js/wetu-importer' . $min . '.js', array( 'jquery' ), WETU_IMPORTER_VER, true );
427
+			wp_enqueue_style('wetu-importer-style', WETU_IMPORTER_URL.'assets/css/wetu-importer.css', WETU_IMPORTER_VER, true);
428
+			wp_enqueue_script('wetu-importers-script', WETU_IMPORTER_URL.'assets/js/wetu-importer'.$min.'.js', array('jquery'), WETU_IMPORTER_VER, true);
429 429
 
430 430
 			wp_localize_script(
431 431
 				'wetu-importers-script',
432 432
 				'lsx_tour_importer_params',
433 433
 				array(
434
-					'ajax_url' => admin_url( 'admin-ajax.php' ),
434
+					'ajax_url' => admin_url('admin-ajax.php'),
435 435
 				)
436 436
 			);
437 437
 		}
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 		?>
445 445
 		<div class="wrap">
446 446
 			<?php
447
-			$this->navigation( $this->tab_slug );
448
-			if ( 'default' !== $this->tab_slug && 'settings' !== $this->tab_slug ) {
447
+			$this->navigation($this->tab_slug);
448
+			if ('default' !== $this->tab_slug && 'settings' !== $this->tab_slug) {
449 449
 				$this->wetu_status();
450 450
 				$this->post_status_navigation();
451 451
 			}
@@ -463,15 +463,15 @@  discard block
 block discarded – undo
463 463
 	public function post_status_navigation() {
464 464
 		?>
465 465
 		<ul class="subsubsub">
466
-			<li class="searchform"><a class="current" href="#search"><?php esc_attr_e( 'Search', 'wetu-importer' ); ?></a> | </li>
467
-			<li class="publish"><a href="#publish"><?php esc_attr_e( 'Published', 'wetu-importer' ); ?> <span class="count"> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( $this->tab_slug, 'publish ' ) ); ?>)</span></a> | </li>
468
-			<li class="pending"><a href="#pending"><?php esc_attr_e( 'Pending', 'wetu-importer' ); ?> <span class="count"> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( $this->tab_slug, 'pending ' ) ); ?>)</span></a>| </li> 
469
-			<li class="draft"><a href="#draft"><?php esc_attr_e( 'Draft', 'wetu-importer' ); ?></a> <span class="count"> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_post_count( $this->tab_slug, 'draft ' ) ); ?>)</span></li>
470
-
471
-			<?php if ( 'tour' === $this->tab_slug ) { ?>
472
-				<li class="import"> | <a class="import search-toggle"  href="#import"><?php esc_attr_e( 'WETU', 'wetu-importer' ); ?> <span class="count"> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_wetu_tour_count() ); ?>)</span></a></li>
473
-			<?php } else if ( ! empty( $this->queued_imports ) ) { ?>
474
-				<li class="import"> | <a class="import search-toggle"  href="#import"><?php esc_attr_e( 'WETU Queue', 'wetu-importer' ); ?> <span class="count"> (<?php echo esc_attr( \wetu_importer\includes\helpers\get_wetu_queue_count( $this->tab_slug ) ); ?>)</span></a></li>
466
+			<li class="searchform"><a class="current" href="#search"><?php esc_attr_e('Search', 'wetu-importer'); ?></a> | </li>
467
+			<li class="publish"><a href="#publish"><?php esc_attr_e('Published', 'wetu-importer'); ?> <span class="count"> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count($this->tab_slug, 'publish ')); ?>)</span></a> | </li>
468
+			<li class="pending"><a href="#pending"><?php esc_attr_e('Pending', 'wetu-importer'); ?> <span class="count"> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count($this->tab_slug, 'pending ')); ?>)</span></a>| </li> 
469
+			<li class="draft"><a href="#draft"><?php esc_attr_e('Draft', 'wetu-importer'); ?></a> <span class="count"> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_post_count($this->tab_slug, 'draft ')); ?>)</span></li>
470
+
471
+			<?php if ('tour' === $this->tab_slug) { ?>
472
+				<li class="import"> | <a class="import search-toggle"  href="#import"><?php esc_attr_e('WETU', 'wetu-importer'); ?> <span class="count"> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_wetu_tour_count()); ?>)</span></a></li>
473
+			<?php }else if (!empty($this->queued_imports)) { ?>
474
+				<li class="import"> | <a class="import search-toggle"  href="#import"><?php esc_attr_e('WETU Queue', 'wetu-importer'); ?> <span class="count"> (<?php echo esc_attr(\wetu_importer\includes\helpers\get_wetu_queue_count($this->tab_slug)); ?>)</span></a></li>
475 475
 			<?php } ?>
476 476
 		</ul>
477 477
 		<?php
@@ -482,29 +482,29 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	public function search_form() {
484 484
 		?>
485
-		<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 ); ?>">
486
-			<input type="hidden" name="page" value="<?php echo esc_attr( $this->tab_slug ); ?>" />
485
+		<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); ?>">
486
+			<input type="hidden" name="page" value="<?php echo esc_attr($this->tab_slug); ?>" />
487 487
 
488
-			<?php do_action( 'wetu_importer_search_form',$this ); ?>
488
+			<?php do_action('wetu_importer_search_form', $this); ?>
489 489
 
490 490
 			<div class="normal-search">
491
-				<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' ); ?>" />
491
+				<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'); ?>" />
492 492
 			</div>
493 493
 
494 494
 			<div class="advanced-search hidden" style="display:none;">
495 495
 				<textarea rows="10" cols="40" name="bulk-keywords"></textarea>
496
-				<input class="button button-primary submit" type="submit" value="<?php esc_attr_e( 'Search', 'wetu-importer' ); ?>" />
496
+				<input class="button button-primary submit" type="submit" value="<?php esc_attr_e('Search', 'wetu-importer'); ?>" />
497 497
 			</div>
498 498
 
499 499
 			<div class="ajax-loader" style="display:none;width:100%;text-align:center;">
500
-				<img style="width:64px;" src="<?php echo esc_url( WETU_IMPORTER_URL . 'assets/images/ajaxloader.gif' ); ?>" />
500
+				<img style="width:64px;" src="<?php echo esc_url(WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'); ?>" />
501 501
 			</div>
502 502
 
503 503
 			<div class="ajax-loader-small" style="display:none;width:100%;text-align:center;">
504
-				<img style="width:32px;" src="<?php echo esc_url( WETU_IMPORTER_URL . 'assets/images/ajaxloader.gif' ); ?>" />
504
+				<img style="width:32px;" src="<?php echo esc_url(WETU_IMPORTER_URL.'assets/images/ajaxloader.gif'); ?>" />
505 505
 			</div>
506 506
 
507
-			<a class="button advanced-search-toggle" href="#"><?php esc_html_e( 'Bulk Search', 'wetu-importer' ); ?></a>
507
+			<a class="button advanced-search-toggle" href="#"><?php esc_html_e('Bulk Search', 'wetu-importer'); ?></a>
508 508
 		</form>
509 509
 		<?php
510 510
 	}
@@ -552,43 +552,43 @@  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
-		echo wp_kses_post( '<div class="wp-filter">' );
563
-		echo wp_kses_post( '<ul class="filter-links">' );
564
-		echo wp_kses_post( '<li><a class="' . $this->itemd( $tab, 'default', 'current', false ) . '" href="' . admin_url( 'admin.php' ) . '?page=' . $this->plugin_slug . '">' . esc_attr__( 'Home', 'wetu-importer' ) . '</a></li>' );
562
+		echo wp_kses_post('<div class="wp-filter">');
563
+		echo wp_kses_post('<ul class="filter-links">');
564
+		echo wp_kses_post('<li><a class="'.$this->itemd($tab, 'default', 'current', false).'" href="'.admin_url('admin.php').'?page='.$this->plugin_slug.'">'.esc_attr__('Home', 'wetu-importer').'</a></li>');
565 565
 
566
-		foreach ( $post_types as $post_type => $label ) {
567
-			echo wp_kses_post( ' | <li><a class="' . $this->itemd( $tab, $post_type, 'current', false ) . '" href="' . admin_url( 'admin.php' ) . '?page=' . $this->plugin_slug . '&tab=' . $post_type . '">' . $label . '</a></li>' );
566
+		foreach ($post_types as $post_type => $label) {
567
+			echo wp_kses_post(' | <li><a class="'.$this->itemd($tab, $post_type, 'current', false).'" href="'.admin_url('admin.php').'?page='.$this->plugin_slug.'&tab='.$post_type.'">'.$label.'</a></li>');
568 568
 		}
569 569
 
570
-		echo wp_kses_post( ' | <li><a class="' . $this->itemd( $tab, 'settings', 'current', false ) . '" href="' . admin_url( 'admin.php' ) . '?page=' . $this->plugin_slug . '&tab=settings">' . esc_attr__( 'Settings', 'wetu-importer' ) . '</a></li>' );
571
-		echo wp_kses_post( '</ul> </div>' );
570
+		echo wp_kses_post(' | <li><a class="'.$this->itemd($tab, 'settings', 'current', false).'" href="'.admin_url('admin.php').'?page='.$this->plugin_slug.'&tab=settings">'.esc_attr__('Settings', 'wetu-importer').'</a></li>');
571
+		echo wp_kses_post('</ul> </div>');
572 572
 	}
573 573
 
574 574
 	/**
575 575
 	 * Wetu Status Bar.
576 576
 	 */
577 577
 	public function wetu_status() {
578
-		$tours = get_transient( 'lsx_ti_tours' );
579
-		echo '<div class="wetu-status tour-wetu-status"><h3>' . esc_html__( 'Wetu Status','wetu-importer' ) . ' - ';
578
+		$tours = get_transient('lsx_ti_tours');
579
+		echo '<div class="wetu-status tour-wetu-status"><h3>'.esc_html__('Wetu Status', 'wetu-importer').' - ';
580 580
 
581
-		if ( '' === $tours || false === $tours || isset( $_GET['refresh_tours'] ) ) {
581
+		if ('' === $tours || false === $tours || isset($_GET['refresh_tours'])) {
582 582
 			$result = $this->update_options();
583 583
 
584
-			if ( true === $result ) {
585
-				echo '<span style="color:green;">' . esc_attr( 'Connected','wetu-importer' ) . '</span>';
586
-				echo ' - <small><a href="#">' . esc_attr( 'Refresh','wetu-importer' ) . '</a></small>';
587
-			} else {
588
-				echo '<span style="color:red;">' . wp_kses_post( $result ) . '</span>';
584
+			if (true === $result) {
585
+				echo '<span style="color:green;">'.esc_attr('Connected', 'wetu-importer').'</span>';
586
+				echo ' - <small><a href="#">'.esc_attr('Refresh', 'wetu-importer').'</a></small>';
587
+			}else {
588
+				echo '<span style="color:red;">'.wp_kses_post($result).'</span>';
589 589
 			}
590
-		} else {
591
-			echo '<span style="color:green;">' . esc_attr( 'Connected','wetu-importer' ) . '</span> - <small><a href="#">' . esc_attr( 'Refresh','wetu-importer' ) . '</a></small>';
590
+		}else {
591
+			echo '<span style="color:green;">'.esc_attr('Connected', 'wetu-importer').'</span> - <small><a href="#">'.esc_attr('Refresh', 'wetu-importer').'</a></small>';
592 592
 		}
593 593
 		echo '</h3>';
594 594
 		echo '</div>';
@@ -597,8 +597,8 @@  discard block
 block discarded – undo
597 597
 	/**
598 598
 	 * Set_taxonomy with some terms
599 599
 	 */
600
-	public function team_member_checkboxes( $selected = array() ) {
601
-		if ( post_type_exists( 'team' ) ) { ?>
600
+	public function team_member_checkboxes($selected = array()) {
601
+		if (post_type_exists('team')) { ?>
602 602
 			<ul>
603 603
 				<?php
604 604
 					$team_args = array(
@@ -608,15 +608,15 @@  discard block
 block discarded – undo
608 608
 						'fields' => 'ids',
609 609
 					);
610 610
 
611
-					$team_members = new WP_Query( $team_args );
611
+					$team_members = new WP_Query($team_args);
612 612
 
613
-					if ( $team_members->have_posts() ) {
614
-						foreach ( $team_members->posts as $member ) {
613
+					if ($team_members->have_posts()) {
614
+						foreach ($team_members->posts as $member) {
615 615
 							// @codingStandardsIgnoreLine ?>
616
-							<li><input class="team" <?php $this->checked( $selected, $member ); ?> type="checkbox" value="<?php echo $member; ?>" /> <?php echo get_the_title( $member ); ?></li>
616
+							<li><input class="team" <?php $this->checked($selected, $member); ?> type="checkbox" value="<?php echo $member; ?>" /> <?php echo get_the_title($member); ?></li>
617 617
 						<?php }
618
-					} else { ?>
619
-						<li><input class="team" type="checkbox" value="0" /> <?php esc_html_e( 'None', 'wetu-importer' ); ?></li>
618
+					}else { ?>
619
+						<li><input class="team" type="checkbox" value="0" /> <?php esc_html_e('None', 'wetu-importer'); ?></li>
620 620
 					<?php }
621 621
 				?>
622 622
 			</ul>
@@ -633,14 +633,14 @@  discard block
 block discarded – undo
633 633
 	 * @param $needle string
634 634
 	 * @param $echo bool
635 635
 	 */
636
-	public function checked( $haystack = false, $needle = '', $echo = true ) {
637
-		$return = $this->itemd( $haystack,$needle, 'checked' );
636
+	public function checked($haystack = false, $needle = '', $echo = true) {
637
+		$return = $this->itemd($haystack, $needle, 'checked');
638 638
 
639
-		if ( '' !== $return ) {
640
-			if ( true === $echo ) {
639
+		if ('' !== $return) {
640
+			if (true === $echo) {
641 641
 				// @codingStandardsIgnoreLine
642 642
 				echo $return;
643
-			} else {
643
+			}else {
644 644
 				return $return;
645 645
 			}
646 646
 		}
@@ -653,14 +653,14 @@  discard block
 block discarded – undo
653 653
 	 * @param $needle string
654 654
 	 * @param $echo bool
655 655
 	 */
656
-	public function selected( $haystack = false, $needle = '', $echo = true ) {
657
-		$return = $this->itemd( $haystack, $needle, 'selected' );
656
+	public function selected($haystack = false, $needle = '', $echo = true) {
657
+		$return = $this->itemd($haystack, $needle, 'selected');
658 658
 
659
-		if ( '' !== $return ) {
660
-			if ( true === $echo ) {
659
+		if ('' !== $return) {
660
+			if (true === $echo) {
661 661
 				// @codingStandardsIgnoreLine
662 662
 				echo $return;
663
-			} else {
663
+			}else {
664 664
 				return $return;
665 665
 			}
666 666
 		}
@@ -675,17 +675,17 @@  discard block
 block discarded – undo
675 675
 	 * @param $wrap bool
676 676
 	 * @return $html string
677 677
 	 */
678
-	public function itemd( $haystack = false, $needle = '', $type = '', $wrap = true ) {
678
+	public function itemd($haystack = false, $needle = '', $type = '', $wrap = true) {
679 679
 		$html = '';
680 680
 
681
-		if ( '' !== $type ) {
682
-			if ( ! is_array( $haystack ) ) {
683
-				$haystack = array( $haystack );
681
+		if ('' !== $type) {
682
+			if (!is_array($haystack)) {
683
+				$haystack = array($haystack);
684 684
 			}
685
-			if ( in_array( $needle, $haystack ) ) {
686
-				if ( true === $wrap || 'true' === $wrap ) {
687
-					$html = $type . '="' . $type . '"';
688
-				} else {
685
+			if (in_array($needle, $haystack)) {
686
+				if (true === $wrap || 'true' === $wrap) {
687
+					$html = $type.'="'.$type.'"';
688
+				}else {
689 689
 					$html = $type;
690 690
 				}
691 691
 			}
@@ -697,9 +697,9 @@  discard block
 block discarded – undo
697 697
 	/**
698 698
 	 * Grabs any attachments for the current item
699 699
 	 */
700
-	public function find_attachments( $id = false ) {
701
-		if ( false !== $id ) {
702
-			if ( empty( $this->found_attachments ) ) {
700
+	public function find_attachments($id = false) {
701
+		if (false !== $id) {
702
+			if (empty($this->found_attachments)) {
703 703
 				$attachments_args = array(
704 704
 					'post_parent' => $id,
705 705
 					'post_status' => 'inherit',
@@ -709,11 +709,11 @@  discard block
 block discarded – undo
709 709
 					'posts_per_page' => '-1',
710 710
 				);
711 711
 
712
-				$attachments = new WP_Query( $attachments_args );
712
+				$attachments = new WP_Query($attachments_args);
713 713
 
714
-				if ( $attachments->have_posts() ) {
715
-					foreach ( $attachments->posts as $attachment ) {
716
-						$this->found_attachments[ $attachment->ID ] = str_replace( array( '.jpg', '.png', '.jpeg' ), '', $attachment->post_title );
714
+				if ($attachments->have_posts()) {
715
+					foreach ($attachments->posts as $attachment) {
716
+						$this->found_attachments[$attachment->ID] = str_replace(array('.jpg', '.png', '.jpeg'), '', $attachment->post_title);
717 717
 					}
718 718
 				}
719 719
 			}
@@ -725,19 +725,19 @@  discard block
 block discarded – undo
725 725
 	/**
726 726
 	 * Saves the room data
727 727
 	 */
728
-	public function save_custom_field( $value = false, $meta_key, $id, $decrease = false, $unique = true ) {
729
-		if ( false !== $value ) {
730
-			if ( false !== $decrease ) {
731
-				$value = intval( $value );
728
+	public function save_custom_field($value = false, $meta_key, $id, $decrease = false, $unique = true) {
729
+		if (false !== $value) {
730
+			if (false !== $decrease) {
731
+				$value = intval($value);
732 732
 				$value--;
733 733
 			}
734 734
 
735
-			$prev = get_post_meta( $id, $meta_key, true );
735
+			$prev = get_post_meta($id, $meta_key, true);
736 736
 
737
-			if ( false !== $id && '0' !== $id && false !== $prev && true === $unique ) {
738
-				update_post_meta( $id, $meta_key, $value, $prev );
739
-			} else {
740
-				add_post_meta( $id, $meta_key, $value, $unique );
737
+			if (false !== $id && '0' !== $id && false !== $prev && true === $unique) {
738
+				update_post_meta($id, $meta_key, $value, $prev);
739
+			}else {
740
+				add_post_meta($id, $meta_key, $value, $unique);
741 741
 			}
742 742
 		}
743 743
 	}
@@ -746,15 +746,15 @@  discard block
 block discarded – undo
746 746
 	 * Grabs the custom fields,  and resaves an array of unique items.
747 747
 	 */
748 748
 	public function cleanup_posts() {
749
-		if ( ! empty( $this->cleanup_posts ) ) {
749
+		if (!empty($this->cleanup_posts)) {
750 750
 
751
-			foreach ( $this->cleanup_posts as $id => $key ) {
752
-				$prev_items = get_post_meta( $id, $key, false );
753
-				$new_items = array_unique( $prev_items );
754
-				delete_post_meta( $id, $key );
751
+			foreach ($this->cleanup_posts as $id => $key) {
752
+				$prev_items = get_post_meta($id, $key, false);
753
+				$new_items = array_unique($prev_items);
754
+				delete_post_meta($id, $key);
755 755
 
756
-				foreach ( $new_items as $new_item ) {
757
-					add_post_meta( $id, $key, $new_item, false );
756
+				foreach ($new_items as $new_item) {
757
+					add_post_meta($id, $key, $new_item, false);
758 758
 				}
759 759
 			}
760 760
 		}
@@ -765,27 +765,27 @@  discard block
 block discarded – undo
765 765
 	/**
766 766
 	 * Set_taxonomy with some terms
767 767
 	 */
768
-	public function set_taxonomy( $taxonomy, $terms, $id ) {
768
+	public function set_taxonomy($taxonomy, $terms, $id) {
769 769
 		$result = array();
770 770
 
771
-		if ( ! empty( $data ) ) {
772
-			foreach ( $data as $k ) {
773
-				if ( $id ) {
771
+		if (!empty($data)) {
772
+			foreach ($data as $k) {
773
+				if ($id) {
774 774
 					// @codingStandardsIgnoreLine
775
-					if ( ! $term = term_exists( trim( $k ), $tax ) ) {
776
-						$term = wp_insert_term( trim( $k ), $tax );
775
+					if (!$term = term_exists(trim($k), $tax)) {
776
+						$term = wp_insert_term(trim($k), $tax);
777 777
 
778
-						if ( is_wp_error( $term ) ) {
778
+						if (is_wp_error($term)) {
779 779
 							// @codingStandardsIgnoreLine
780 780
 							echo $term->get_error_message();
781
-						} else {
782
-							wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
781
+						}else {
782
+							wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
783 783
 						}
784
-					} else {
785
-						wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
784
+					}else {
785
+						wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
786 786
 					}
787
-				} else {
788
-					$result[] = trim( $k );
787
+				}else {
788
+					$result[] = trim($k);
789 789
 				}
790 790
 			}
791 791
 		}
@@ -801,25 +801,25 @@  discard block
 block discarded – undo
801 801
 	 * @param boolean $parent
802 802
 	 * @return void
803 803
 	 */
804
-	public function set_term( $id = false, $name = false, $taxonomy = false, $parent = false ) {
804
+	public function set_term($id = false, $name = false, $taxonomy = false, $parent = false) {
805 805
 		// @codingStandardsIgnoreLine
806
-		if ( ! $term = term_exists( $name, $taxonomy ) ) {
807
-			if ( false !== $parent ) {
806
+		if (!$term = term_exists($name, $taxonomy)) {
807
+			if (false !== $parent) {
808 808
 				$parent = array(
809 809
 					'parent' => $parent,
810 810
 				);
811 811
 			}
812 812
 
813
-			$term = wp_insert_term( trim( $name ), $taxonomy,$parent );
813
+			$term = wp_insert_term(trim($name), $taxonomy, $parent);
814 814
 
815
-			if ( is_wp_error( $term ) ) {
815
+			if (is_wp_error($term)) {
816 816
 				// @codingStandardsIgnoreLine
817 817
 				echo $term->get_error_message();
818
-			} else {
819
-				wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
818
+			}else {
819
+				wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
820 820
 			}
821
-		} else {
822
-			wp_set_object_terms( $id, intval( $term['term_id'] ), $taxonomy,true );
821
+		}else {
822
+			wp_set_object_terms($id, intval($term['term_id']), $taxonomy, true);
823 823
 		}
824 824
 
825 825
 		return $term['term_id'];
@@ -828,22 +828,22 @@  discard block
 block discarded – undo
828 828
 	/**
829 829
 	 * set_taxonomy with some terms
830 830
 	 */
831
-	public function taxonomy_checkboxes( $taxonomy = false, $selected = array() ) {
831
+	public function taxonomy_checkboxes($taxonomy = false, $selected = array()) {
832 832
 		$return = '';
833 833
 
834
-		if ( false !== $taxonomy ) {
834
+		if (false !== $taxonomy) {
835 835
 			$return .= '<ul>';
836
-			$terms = get_terms( array(
836
+			$terms = get_terms(array(
837 837
 				'taxonomy' => $taxonomy,
838 838
 				'hide_empty' => false,
839
-			) );
839
+			));
840 840
 
841
-			if ( ! is_wp_error( $terms ) ) {
842
-				foreach ( $terms as $term ) {
843
-					$return .= '<li><input class="' . $taxonomy . '" ' . $this->checked( $selected,$term->term_id,false ) . ' type="checkbox" value="' . $term->term_id . '" /> ' . $term->name . '</li>';
841
+			if (!is_wp_error($terms)) {
842
+				foreach ($terms as $term) {
843
+					$return .= '<li><input class="'.$taxonomy.'" '.$this->checked($selected, $term->term_id, false).' type="checkbox" value="'.$term->term_id.'" /> '.$term->name.'</li>';
844 844
 				}
845
-			} else {
846
-				$return .= '<li><input type="checkbox" value="" /> ' . __( 'None', 'wetu-importer' ) . '</li>';
845
+			}else {
846
+				$return .= '<li><input type="checkbox" value="" /> '.__('None', 'wetu-importer').'</li>';
847 847
 			}
848 848
 
849 849
 			$return .= '</ul>';
@@ -857,44 +857,44 @@  discard block
 block discarded – undo
857 857
 	/**
858 858
 	 * Saves the longitude and lattitude, as well as sets the map marker.
859 859
 	 */
860
-	public function set_map_data( $data, $id, $zoom = '10' ) {
860
+	public function set_map_data($data, $id, $zoom = '10') {
861 861
 		$longitude = false;
862 862
 		$latitude = false;
863 863
 		$address = false;
864 864
 
865
-		if ( isset( $data[0]['position'] ) ) {
866
-			if ( isset( $data[0]['position']['driving_latitude'] ) ) {
865
+		if (isset($data[0]['position'])) {
866
+			if (isset($data[0]['position']['driving_latitude'])) {
867 867
 				$latitude = $data[0]['position']['driving_latitude'];
868
-			} elseif ( isset( $data[0]['position']['latitude'] ) ) {
868
+			} elseif (isset($data[0]['position']['latitude'])) {
869 869
 				$latitude = $data[0]['position']['latitude'];
870 870
 			}
871 871
 
872
-			if ( isset( $data[0]['position']['driving_longitude'] ) ) {
872
+			if (isset($data[0]['position']['driving_longitude'])) {
873 873
 				$longitude = $data[0]['position']['driving_longitude'];
874
-			} elseif ( isset( $data[0]['position']['longitude'] ) ) {
874
+			} elseif (isset($data[0]['position']['longitude'])) {
875 875
 				$longitude = $data[0]['position']['longitude'];
876 876
 			}
877 877
 		}
878 878
 
879
-		if ( isset( $data[0]['content'] ) && isset( $data[0]['content']['contact_information'] ) ) {
880
-			if ( isset( $data[0]['content']['contact_information']['address'] ) ) {
881
-				$address = strip_tags( $data[0]['content']['contact_information']['address'] );
882
-				$address = explode( "\n", $address );
879
+		if (isset($data[0]['content']) && isset($data[0]['content']['contact_information'])) {
880
+			if (isset($data[0]['content']['contact_information']['address'])) {
881
+				$address = strip_tags($data[0]['content']['contact_information']['address']);
882
+				$address = explode("\n", $address);
883 883
 
884
-				foreach ( $address as $bitkey => $bit ) {
885
-					$bit = ltrim( rtrim( $bit ) );
884
+				foreach ($address as $bitkey => $bit) {
885
+					$bit = ltrim(rtrim($bit));
886 886
 
887
-					if ( false === $bit || '' === $bit || null === $bit || empty( $bit ) ) {
888
-						unset( $address[ $bitkey ] );
887
+					if (false === $bit || '' === $bit || null === $bit || empty($bit)) {
888
+						unset($address[$bitkey]);
889 889
 					}
890 890
 				}
891 891
 
892
-				$address = implode( ', ',$address );
893
-				$address = str_replace( ', , ', ', ', $address );
892
+				$address = implode(', ', $address);
893
+				$address = str_replace(', , ', ', ', $address);
894 894
 			}
895 895
 		}
896 896
 
897
-		if ( false !== $longitude ) {
897
+		if (false !== $longitude) {
898 898
 			$location_data = array(
899 899
 				'address'	=> (string) $address,
900 900
 				'lat'		=> (string) $latitude,
@@ -903,11 +903,11 @@  discard block
 block discarded – undo
903 903
 				'elevation'	=> '',
904 904
 			);
905 905
 
906
-			if ( false !== $id && '0' !== $id ) {
907
-				$prev = get_post_meta( $id,'location',true );
908
-				update_post_meta( $id,'location',$location_data,$prev );
909
-			} else {
910
-				add_post_meta( $id,'location',$location_data,true );
906
+			if (false !== $id && '0' !== $id) {
907
+				$prev = get_post_meta($id, 'location', true);
908
+				update_post_meta($id, 'location', $location_data, $prev);
909
+			}else {
910
+				add_post_meta($id, 'location', $location_data, true);
911 911
 			}
912 912
 		}
913 913
 	}
@@ -917,17 +917,17 @@  discard block
 block discarded – undo
917 917
 	/**
918 918
 	 * Creates the main gallery data
919 919
 	 */
920
-	public function set_featured_image( $data, $id ) {
921
-		if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
922
-			$this->featured_image = $this->attach_image( $data[0]['content']['images'][0], $id,  array(
920
+	public function set_featured_image($data, $id) {
921
+		if (is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])) {
922
+			$this->featured_image = $this->attach_image($data[0]['content']['images'][0], $id, array(
923 923
 				'width' => '800',
924 924
 				'height' => '600',
925 925
 				'cropping' => 'h',
926
-			) );
926
+			));
927 927
 
928
-			if ( false !== $this->featured_image ) {
929
-				delete_post_meta( $id,'_thumbnail_id' );
930
-				add_post_meta( $id,'_thumbnail_id',$this->featured_image,true );
928
+			if (false !== $this->featured_image) {
929
+				delete_post_meta($id, '_thumbnail_id');
930
+				add_post_meta($id, '_thumbnail_id', $this->featured_image, true);
931 931
 			}
932 932
 		}
933 933
 	}
@@ -935,26 +935,26 @@  discard block
 block discarded – undo
935 935
 	/**
936 936
 	 * Sets a banner image
937 937
 	 */
938
-	public function set_banner_image( $data, $id, $content = array( 'none' ) ) {
939
-		if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
940
-			if ( in_array( 'unique_banner_image', $content ) && isset( $data[0]['destination_image'] ) && is_array( $data[0]['destination_image'] ) ) {
941
-				$temp_banner = $this->attach_image( $data[0]['destination_image'], $id, array(
938
+	public function set_banner_image($data, $id, $content = array('none')) {
939
+		if (is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])) {
940
+			if (in_array('unique_banner_image', $content) && isset($data[0]['destination_image']) && is_array($data[0]['destination_image'])) {
941
+				$temp_banner = $this->attach_image($data[0]['destination_image'], $id, array(
942 942
 					'width' => '1920',
943 943
 					'height' => '600',
944 944
 					'cropping' => 'c',
945 945
 				));
946
-			} else {
947
-				$temp_banner = $this->attach_image( $data[0]['content']['images'][1], $id, array(
946
+			}else {
947
+				$temp_banner = $this->attach_image($data[0]['content']['images'][1], $id, array(
948 948
 					'width' => '1920',
949 949
 					'height' => '600',
950 950
 					'cropping' => 'c',
951 951
 				));
952 952
 			}
953 953
 
954
-			if ( false !== $temp_banner ) {
954
+			if (false !== $temp_banner) {
955 955
 				$this->banner_image = $temp_banner;
956 956
 
957
-				delete_post_meta( $id,'image_group' );
957
+				delete_post_meta($id, 'image_group');
958 958
 
959 959
 				$new_banner = array(
960 960
 					'banner_image' => array(
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 					),
963 963
 				);
964 964
 
965
-				add_post_meta( $id,'image_group',$new_banner,true );
965
+				add_post_meta($id, 'image_group', $new_banner, true);
966 966
 			}
967 967
 		}
968 968
 	}
@@ -970,17 +970,17 @@  discard block
 block discarded – undo
970 970
 	/**
971 971
 	 * Creates the main gallery data
972 972
 	 */
973
-	public function create_main_gallery( $data, $id ) {
974
-		if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
975
-			if ( isset( $this->options['image_replacing'] ) && 'on' === $this->options['image_replacing'] ) {
976
-				$current_gallery = get_post_meta( $id, 'gallery', false );
973
+	public function create_main_gallery($data, $id) {
974
+		if (is_array($data[0]['content']['images']) && !empty($data[0]['content']['images'])) {
975
+			if (isset($this->options['image_replacing']) && 'on' === $this->options['image_replacing']) {
976
+				$current_gallery = get_post_meta($id, 'gallery', false);
977 977
 
978
-				if ( false !== $current_gallery && ! empty( $current_gallery ) ) {
979
-					foreach ( $current_gallery as $g ) {
980
-						delete_post_meta( $id,'gallery', $g );
978
+				if (false !== $current_gallery && !empty($current_gallery)) {
979
+					foreach ($current_gallery as $g) {
980
+						delete_post_meta($id, 'gallery', $g);
981 981
 
982
-						if ( 'attachment' === get_post_type( $g ) ) {
983
-							wp_delete_attachment( $g, true );
982
+						if ('attachment' === get_post_type($g)) {
983
+							wp_delete_attachment($g, true);
984 984
 						}
985 985
 					}
986 986
 				}
@@ -988,32 +988,32 @@  discard block
 block discarded – undo
988 988
 
989 989
 			$counter = 0;
990 990
 
991
-			foreach ( $data[0]['content']['images'] as $image_data ) {
992
-				if ( ( 0 === $counter && false !== $this->featured_image ) || ( 1 === $counter && false !== $this->banner_image ) ) {
991
+			foreach ($data[0]['content']['images'] as $image_data) {
992
+				if ((0 === $counter && false !== $this->featured_image) || (1 === $counter && false !== $this->banner_image)) {
993 993
 					$counter++;
994 994
 
995
-					if ( false !== $this->image_limit && false !== $this->image_limit ) {
995
+					if (false !== $this->image_limit && false !== $this->image_limit) {
996 996
 						$this->image_limit++;
997 997
 					}
998 998
 
999 999
 					continue;
1000 1000
 				}
1001 1001
 
1002
-				if ( false !== $this->image_limit && $counter >= $this->image_limit ) {
1002
+				if (false !== $this->image_limit && $counter >= $this->image_limit) {
1003 1003
 					continue;
1004 1004
 				}
1005 1005
 
1006
-				$this->gallery_meta[] = $this->attach_image( $image_data,$id );
1006
+				$this->gallery_meta[] = $this->attach_image($image_data, $id);
1007 1007
 				$counter++;
1008 1008
 			}
1009 1009
 
1010
-			if ( ! empty( $this->gallery_meta ) ) {
1011
-				delete_post_meta( $id,'gallery' );
1012
-				$this->gallery_meta = array_unique( $this->gallery_meta );
1010
+			if (!empty($this->gallery_meta)) {
1011
+				delete_post_meta($id, 'gallery');
1012
+				$this->gallery_meta = array_unique($this->gallery_meta);
1013 1013
 
1014
-				foreach ( $this->gallery_meta as $gallery_id ) {
1015
-					if ( false !== $gallery_id && '' !== $gallery_id && ! is_array( $gallery_id ) ) {
1016
-						add_post_meta( $id,'gallery',$gallery_id,false );
1014
+				foreach ($this->gallery_meta as $gallery_id) {
1015
+					if (false !== $gallery_id && '' !== $gallery_id && !is_array($gallery_id)) {
1016
+						add_post_meta($id, 'gallery', $gallery_id, false);
1017 1017
 					}
1018 1018
 				}
1019 1019
 			}
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 	/**
1024 1024
 	 * search_form
1025 1025
 	 */
1026
-	public function get_scaling_url( $args = array() ) {
1026
+	public function get_scaling_url($args = array()) {
1027 1027
 		$defaults = array(
1028 1028
 			'width' => '1024',
1029 1029
 			'height' => '768',
@@ -1031,59 +1031,59 @@  discard block
 block discarded – undo
1031 1031
 			'cropping' => 'h',
1032 1032
 		);
1033 1033
 
1034
-		if ( false !== $this->options ) {
1035
-			if ( isset( $this->options['width'] ) && '' !== $this->options['width'] ) {
1034
+		if (false !== $this->options) {
1035
+			if (isset($this->options['width']) && '' !== $this->options['width']) {
1036 1036
 				$defaults['width'] = $this->options['width'];
1037 1037
 			}
1038 1038
 
1039
-			if ( isset( $this->options['height'] ) && '' !== $this->options['height'] ) {
1039
+			if (isset($this->options['height']) && '' !== $this->options['height']) {
1040 1040
 				$defaults['height'] = $this->options['height'];
1041 1041
 			}
1042 1042
 
1043
-			if ( isset( $this->options['cropping'] ) && '' !== $this->options['cropping'] ) {
1043
+			if (isset($this->options['cropping']) && '' !== $this->options['cropping']) {
1044 1044
 				$defaults['cropping'] = $this->options['cropping'];
1045 1045
 			}
1046 1046
 		}
1047 1047
 
1048
-		$args = wp_parse_args( $args, $defaults );
1048
+		$args = wp_parse_args($args, $defaults);
1049 1049
 		$cropping = $args['cropping'];
1050 1050
 		$width = $args['width'];
1051 1051
 		$height = $args['height'];
1052 1052
 
1053
-		return 'https://wetu.com/ImageHandler/' . $cropping . $width . 'x' . $height . '/';
1053
+		return 'https://wetu.com/ImageHandler/'.$cropping.$width.'x'.$height.'/';
1054 1054
 	}
1055 1055
 
1056 1056
 	/**
1057 1057
 	 * Attaches 1 image
1058 1058
 	 */
1059
-	public function attach_image( $v = false, $parent_id, $image_sizes = false, $banner = false ) {
1060
-		if ( false !== $v ) {
1061
-			$temp_fragment = explode( '/',$v['url_fragment'] );
1062
-			$url_filename = $temp_fragment[ count( $temp_fragment ) -1 ];
1063
-			$url_filename = str_replace( array( '.jpg', '.png', '.jpeg' ),'',$url_filename );
1064
-			$url_filename = trim( $url_filename );
1059
+	public function attach_image($v = false, $parent_id, $image_sizes = false, $banner = false) {
1060
+		if (false !== $v) {
1061
+			$temp_fragment = explode('/', $v['url_fragment']);
1062
+			$url_filename = $temp_fragment[count($temp_fragment) - 1];
1063
+			$url_filename = str_replace(array('.jpg', '.png', '.jpeg'), '', $url_filename);
1064
+			$url_filename = trim($url_filename);
1065 1065
 			$title = $url_filename;
1066
-			$url_filename = str_replace( ' ','_',$url_filename );
1066
+			$url_filename = str_replace(' ', '_', $url_filename);
1067 1067
 
1068
-			if ( ! isset( $this->options['image_replacing'] ) && in_array( $url_filename, $this->found_attachments ) ) {
1069
-				return array_search( $url_filename,$this->found_attachments );
1068
+			if (!isset($this->options['image_replacing']) && in_array($url_filename, $this->found_attachments)) {
1069
+				return array_search($url_filename, $this->found_attachments);
1070 1070
 			}
1071 1071
 
1072 1072
 			$postdata = array();
1073 1073
 
1074
-			if ( empty( $v['label'] ) ) {
1074
+			if (empty($v['label'])) {
1075 1075
 				$v['label'] = '';
1076 1076
 			}
1077 1077
 
1078
-			if ( ! empty( $v['description'] ) ) {
1079
-				$desc = wp_strip_all_tags( $v['description'] );
1078
+			if (!empty($v['description'])) {
1079
+				$desc = wp_strip_all_tags($v['description']);
1080 1080
 				$posdata = array(
1081 1081
 					'post_excerpt' => $desc,
1082 1082
 				);
1083 1083
 			}
1084 1084
 
1085
-			if ( ! empty( $v['section'] ) ) {
1086
-				$desc = wp_strip_all_tags( $v['section'] );
1085
+			if (!empty($v['section'])) {
1086
+				$desc = wp_strip_all_tags($v['section']);
1087 1087
 				$posdata = array(
1088 1088
 					'post_excerpt' => $desc,
1089 1089
 				);
@@ -1091,88 +1091,88 @@  discard block
 block discarded – undo
1091 1091
 
1092 1092
 			$attach_id = null;
1093 1093
 			//Resizor - add option to setting if required
1094
-			$fragment = str_replace( ' ','%20',$v['url_fragment'] );
1095
-			$url = $this->get_scaling_url( $image_sizes ) . $fragment;
1094
+			$fragment = str_replace(' ', '%20', $v['url_fragment']);
1095
+			$url = $this->get_scaling_url($image_sizes).$fragment;
1096 1096
 
1097
-			$attach_id = $this->attach_external_image2( $url,$parent_id,'',$v['label'],$postdata );
1097
+			$attach_id = $this->attach_external_image2($url, $parent_id, '', $v['label'], $postdata);
1098 1098
 
1099
-			$this->found_attachments[ $attach_id ] = $url_filename;
1099
+			$this->found_attachments[$attach_id] = $url_filename;
1100 1100
 
1101 1101
 			//echo($attach_id.' add image');
1102
-			if ( ! empty( $attach_id ) ) {
1102
+			if (!empty($attach_id)) {
1103 1103
 				return $attach_id;
1104 1104
 			}
1105 1105
 		}
1106 1106
 		return 	false;
1107 1107
 	}
1108 1108
 
1109
-	public function attach_external_image2( $url = null, $post_id = null, $thumb = null, $filename = null, $post_data = array() ) {
1110
-		if ( ! $url || ! $post_id ) { return new WP_Error( 'missing', 'Need a valid URL and post ID...' ); }
1109
+	public function attach_external_image2($url = null, $post_id = null, $thumb = null, $filename = null, $post_data = array()) {
1110
+		if (!$url || !$post_id) { return new WP_Error('missing', 'Need a valid URL and post ID...'); }
1111 1111
 
1112
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
1113
-		require_once( ABSPATH . 'wp-admin/includes/media.php' );
1114
-		require_once( ABSPATH . 'wp-admin/includes/image.php' );
1112
+		require_once(ABSPATH.'wp-admin/includes/file.php');
1113
+		require_once(ABSPATH.'wp-admin/includes/media.php');
1114
+		require_once(ABSPATH.'wp-admin/includes/image.php');
1115 1115
 		// Download file to temp location, returns full server path to temp file
1116 1116
 		//$tmp = download_url( $url );
1117 1117
 
1118 1118
 		//var_dump($tmp);
1119
-		$tmp = tempnam( '/tmp', 'FOO' );
1119
+		$tmp = tempnam('/tmp', 'FOO');
1120 1120
 
1121
-		$image = file_get_contents( $url );
1122
-		file_put_contents( $tmp, $image );
1123
-		chmod( $tmp,'777' );
1121
+		$image = file_get_contents($url);
1122
+		file_put_contents($tmp, $image);
1123
+		chmod($tmp, '777');
1124 1124
 
1125
-		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
1126
-		$url_filename = basename( $matches[0] );
1127
-		$url_filename = str_replace( '%20','_',$url_filename );
1125
+		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
1126
+		$url_filename = basename($matches[0]);
1127
+		$url_filename = str_replace('%20', '_', $url_filename);
1128 1128
 		// extract filename from url for title
1129
-		$url_type = wp_check_filetype( $url_filename );                                           // determine file type (ext and mime/type)
1129
+		$url_type = wp_check_filetype($url_filename); // determine file type (ext and mime/type)
1130 1130
 
1131 1131
 		// override filename if given, reconstruct server path
1132
-		if ( ! empty( $filename ) && ' ' != $filename ) {
1133
-			$filename = sanitize_file_name( $filename );
1134
-			$tmppath = pathinfo( $tmp );
1132
+		if (!empty($filename) && ' ' != $filename) {
1133
+			$filename = sanitize_file_name($filename);
1134
+			$tmppath = pathinfo($tmp);
1135 1135
 
1136 1136
 			$extension = '';
1137
-			if ( isset( $tmppath['extension'] ) ) {
1137
+			if (isset($tmppath['extension'])) {
1138 1138
 				$extension = $tmppath['extension'];
1139 1139
 			}
1140 1140
 
1141
-			$new = $tmppath['dirname'] . '/' . $filename . '.' . $extension;
1142
-			rename( $tmp, $new );                                                                 // renames temp file on server
1143
-			$tmp = $new;                                                                        // push new filename (in path) to be used in file array later
1141
+			$new = $tmppath['dirname'].'/'.$filename.'.'.$extension;
1142
+			rename($tmp, $new); // renames temp file on server
1143
+			$tmp = $new; // push new filename (in path) to be used in file array later
1144 1144
 		}
1145 1145
 
1146 1146
 		// assemble file data (should be built like $_FILES since wp_handle_sideload() will be using)
1147
-		$file_array['tmp_name'] = $tmp;                                                         // full server path to temp file
1147
+		$file_array['tmp_name'] = $tmp; // full server path to temp file
1148 1148
 
1149
-		if ( ! empty( $filename ) && ' ' != $filename ) {
1150
-			$file_array['name'] = $filename . '.' . $url_type['ext'];                           // user given filename for title, add original URL extension
1151
-		} else {
1152
-			$file_array['name'] = $url_filename;                                                // just use original URL filename
1149
+		if (!empty($filename) && ' ' != $filename) {
1150
+			$file_array['name'] = $filename.'.'.$url_type['ext']; // user given filename for title, add original URL extension
1151
+		}else {
1152
+			$file_array['name'] = $url_filename; // just use original URL filename
1153 1153
 		}
1154 1154
 
1155 1155
 		// set additional wp_posts columns
1156
-		if ( empty( $post_data['post_title'] ) ) {
1156
+		if (empty($post_data['post_title'])) {
1157 1157
 
1158
-			$url_filename = str_replace( '%20',' ',$url_filename );
1158
+			$url_filename = str_replace('%20', ' ', $url_filename);
1159 1159
 
1160
-			$post_data['post_title'] = basename( $url_filename, '.' . $url_type['ext'] );         // just use the original filename (no extension)
1160
+			$post_data['post_title'] = basename($url_filename, '.'.$url_type['ext']); // just use the original filename (no extension)
1161 1161
 		}
1162 1162
 
1163 1163
 		// make sure gets tied to parent
1164
-		if ( empty( $post_data['post_parent'] ) ) {
1164
+		if (empty($post_data['post_parent'])) {
1165 1165
 			$post_data['post_parent'] = $post_id;
1166 1166
 		}
1167 1167
 
1168 1168
 		// required libraries for media_handle_sideload
1169 1169
 
1170 1170
 		// do the validation and storage stuff
1171
-		$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
1171
+		$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
1172 1172
 
1173 1173
 		// If error storing permanently, unlink
1174
-		if ( is_wp_error( $att_id ) ) {
1175
-			unlink( $file_array['tmp_name'] );   // clean up
1174
+		if (is_wp_error($att_id)) {
1175
+			unlink($file_array['tmp_name']); // clean up
1176 1176
 			return false; // output wp_error
1177 1177
 			//return $att_id; // output wp_error
1178 1178
 		}
@@ -1201,35 +1201,35 @@  discard block
 block discarded – undo
1201 1201
 	/**
1202 1202
 	 * Formats the row for the completed list.
1203 1203
 	 */
1204
-	public function format_completed_row( $response ) {
1204
+	public function format_completed_row($response) {
1205 1205
 		// @codingStandardsIgnoreLine
1206
-		echo '<li class="post-' . $response . '"><span class="dashicons dashicons-yes"></span> <a target="_blank" href="' . get_permalink( $response ) . '">' . get_the_title( $response ) . '</a></li>';
1206
+		echo '<li class="post-'.$response.'"><span class="dashicons dashicons-yes"></span> <a target="_blank" href="'.get_permalink($response).'">'.get_the_title($response).'</a></li>';
1207 1207
 	}
1208 1208
 
1209 1209
 	/**
1210 1210
 	 * Formats the error.
1211 1211
 	 */
1212
-	public function format_error( $response ) {
1212
+	public function format_error($response) {
1213 1213
 		// @codingStandardsIgnoreLine
1214
-		echo '<li class="post-error"><span class="dashicons dashicons-no"></span>' . $response . '</li>';
1214
+		echo '<li class="post-error"><span class="dashicons dashicons-no"></span>'.$response.'</li>';
1215 1215
 	}
1216 1216
 
1217 1217
 	/**
1218 1218
 	 * Does a multine search
1219 1219
 	 */
1220
-	public function multineedle_stripos( $haystack, $needles, $offset = 0 ) {
1220
+	public function multineedle_stripos($haystack, $needles, $offset = 0) {
1221 1221
 		$found = false;
1222
-		$needle_count = count( $needles );
1222
+		$needle_count = count($needles);
1223 1223
 
1224
-		foreach ( $needles as $needle ) {
1225
-			if ( false !== stripos( $haystack, $needle, $offset ) ) {
1224
+		foreach ($needles as $needle) {
1225
+			if (false !== stripos($haystack, $needle, $offset)) {
1226 1226
 				$found[] = true;
1227 1227
 			}
1228 1228
 		}
1229 1229
 
1230
-		if ( false !== $found && count( $found ) === $needle_count ) {
1230
+		if (false !== $found && count($found) === $needle_count) {
1231 1231
 			return true;
1232
-		} else {
1232
+		}else {
1233 1233
 			return false;
1234 1234
 		}
1235 1235
 	}
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
 	/**
1238 1238
 	 * Grab all the current accommodation posts via the lsx_wetu_id field.
1239 1239
 	 */
1240
-	public function find_current_accommodation( $post_type = 'accommodation' ) {
1240
+	public function find_current_accommodation($post_type = 'accommodation') {
1241 1241
 		global $wpdb;
1242 1242
 		$return = array();
1243 1243
 
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
 		");
1257 1257
 		// @codingStandardsIgnoreEnd
1258 1258
 
1259
-		if ( null !== $current_accommodation && ! empty( $current_accommodation ) ) {
1260
-			foreach ( $current_accommodation as $accom ) {
1261
-				$return[ $accom->meta_value ] = $accom;
1259
+		if (null !== $current_accommodation && !empty($current_accommodation)) {
1260
+			foreach ($current_accommodation as $accom) {
1261
+				$return[$accom->meta_value] = $accom;
1262 1262
 			}
1263 1263
 		}
1264 1264
 
@@ -1268,20 +1268,20 @@  discard block
 block discarded – undo
1268 1268
 	/**
1269 1269
 	 * Set the Video date
1270 1270
 	 */
1271
-	public function set_video_data( $data, $id ) {
1272
-		if ( ! empty( $data[0]['content']['youtube_videos'] ) && is_array( $data[0]['content']['youtube_videos'] ) ) {
1271
+	public function set_video_data($data, $id) {
1272
+		if (!empty($data[0]['content']['youtube_videos']) && is_array($data[0]['content']['youtube_videos'])) {
1273 1273
 			$videos = false;
1274 1274
 
1275
-			foreach ( $data[0]['content']['youtube_videos'] as $video ) {
1275
+			foreach ($data[0]['content']['youtube_videos'] as $video) {
1276 1276
 				$temp_video = array();
1277 1277
 
1278
-				if ( isset( $video['label'] ) ) {
1278
+				if (isset($video['label'])) {
1279 1279
 					$temp_video['title'] = $video['label'];
1280 1280
 				}
1281
-				if ( isset( $video['description'] ) ) {
1282
-					$temp_video['description'] = strip_tags( $video['description'] );
1281
+				if (isset($video['description'])) {
1282
+					$temp_video['description'] = strip_tags($video['description']);
1283 1283
 				}
1284
-				if ( isset( $video['url'] ) ) {
1284
+				if (isset($video['url'])) {
1285 1285
 					$temp_video['url'] = $video['url'];
1286 1286
 				}
1287 1287
 
@@ -1289,24 +1289,24 @@  discard block
 block discarded – undo
1289 1289
 				$videos[] = $temp_video;
1290 1290
 			}
1291 1291
 
1292
-			if ( false !== $id && '0' !== $id ) {
1293
-				delete_post_meta( $id, 'videos' );
1292
+			if (false !== $id && '0' !== $id) {
1293
+				delete_post_meta($id, 'videos');
1294 1294
 			}
1295 1295
 
1296
-			foreach ( $videos as $video ) {
1297
-				add_post_meta( $id,'videos',$video,false );
1296
+			foreach ($videos as $video) {
1297
+				add_post_meta($id, 'videos', $video, false);
1298 1298
 			}
1299 1299
 		}
1300 1300
 	}
1301 1301
 
1302
-	public function shuffle_assoc( &$array ) {
1302
+	public function shuffle_assoc(&$array) {
1303 1303
 		$new = array();
1304
-		$keys = array_keys( $array );
1304
+		$keys = array_keys($array);
1305 1305
 
1306
-		shuffle( $keys );
1306
+		shuffle($keys);
1307 1307
 
1308
-		foreach ( $keys as $key ) {
1309
-			$new[ $key ] = $array[ $key ];
1308
+		foreach ($keys as $key) {
1309
+			$new[$key] = $array[$key];
1310 1310
 		}
1311 1311
 
1312 1312
 		$array = $new;
@@ -1320,29 +1320,29 @@  discard block
 block discarded – undo
1320 1320
 	public function update_options() {
1321 1321
 		$own = '';
1322 1322
 		$options = array();
1323
-		delete_option( 'lsx_ti_tours_api_options' );
1323
+		delete_option('lsx_ti_tours_api_options');
1324 1324
 
1325
-		if ( isset( $_GET['own'] ) ) {
1325
+		if (isset($_GET['own'])) {
1326 1326
 			$this->current_importer->url_qs .= '&own=true';
1327 1327
 			$options[] = 'own';
1328 1328
 		}
1329 1329
 
1330
-		if ( isset( $_GET['type'] ) && 'allitineraries' !== $_GET['type'] ) {
1331
-			$this->current_importer->url_qs .= '&type=' . implode( '', $_GET['type'] );
1332
-			$options[] = implode( '', $_GET['type'] );
1330
+		if (isset($_GET['type']) && 'allitineraries' !== $_GET['type']) {
1331
+			$this->current_importer->url_qs .= '&type='.implode('', $_GET['type']);
1332
+			$options[] = implode('', $_GET['type']);
1333 1333
 		}
1334 1334
 
1335 1335
 		$this->current_importer->url_qs .= '&results=2000';
1336 1336
 
1337
-		add_option( 'lsx_ti_tours_api_options', $options );
1337
+		add_option('lsx_ti_tours_api_options', $options);
1338 1338
 
1339
-		$data = wp_remote_get( $this->current_importer->url . '/V8/List?' . $this->current_importer->url_qs );
1340
-		$tours = json_decode( wp_remote_retrieve_body( $data ), true );
1339
+		$data = wp_remote_get($this->current_importer->url.'/V8/List?'.$this->current_importer->url_qs);
1340
+		$tours = json_decode(wp_remote_retrieve_body($data), true);
1341 1341
 
1342
-		if ( isset( $tours['error'] ) ) {
1342
+		if (isset($tours['error'])) {
1343 1343
 			return $tours['error'];
1344
-		} elseif ( isset( $tours['itineraries'] ) && ! empty( $tours['itineraries'] ) ) {
1345
-			set_transient( 'lsx_ti_tours', $tours['itineraries'], 60 * 60 * 2 );
1344
+		} elseif (isset($tours['itineraries']) && !empty($tours['itineraries'])) {
1345
+			set_transient('lsx_ti_tours', $tours['itineraries'], 60 * 60 * 2);
1346 1346
 			return true;
1347 1347
 		}
1348 1348
 	}
Please login to merge, or discard this patch.
classes/class-wetu-importer-destination.php 1 patch
Spacing   +246 added lines, -246 removed lines patch added patch discarded remove patch
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function set_variables() {
72 72
 		parent::set_variables();
73
-		$this->url    = 'https://wetu.com/API/Pins/' . $this->api_key;
73
+		$this->url    = 'https://wetu.com/API/Pins/'.$this->api_key;
74 74
 		$this->url_qs = 'all=include';
75
-		$temp_options = get_option( '_lsx-to_settings', false );
75
+		$temp_options = get_option('_lsx-to_settings', false);
76 76
 
77
-		if ( false !== $temp_options && isset( $temp_options[ $this->plugin_slug ] ) && ! empty( $temp_options[ $this->plugin_slug ] ) ) {
78
-			$this->options = $temp_options[ $this->plugin_slug ];
77
+		if (false !== $temp_options && isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug])) {
78
+			$this->options = $temp_options[$this->plugin_slug];
79 79
 		}
80 80
 
81
-		$destination_options = get_option( 'wetu_importer_destination_settings', false );
81
+		$destination_options = get_option('wetu_importer_destination_settings', false);
82 82
 
83
-		if ( false !== $destination_options ) {
83
+		if (false !== $destination_options) {
84 84
 			$this->destination_options = $destination_options;
85 85
 		}
86 86
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			<?php $this->search_form(); ?>
95 95
 
96 96
 			<form method="get" action="" id="posts-filter">
97
-				<input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr( $this->tab_slug ); ?>"/>
97
+				<input type="hidden" name="post_type" class="post_type" value="<?php echo esc_attr($this->tab_slug); ?>"/>
98 98
 
99 99
 				<table class="wp-list-table widefat fixed posts">
100 100
 					<?php $this->table_header(); ?>
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 					<tr class="post-0 type-tour status-none" id="post-0">
104 104
 						<th class="check-column" scope="row">
105 105
 							<label for="cb-select-0"
106
-								   class="screen-reader-text"><?php esc_html_e( 'Enter a title to search for and press enter', 'wetu-importer' ); ?></label>
106
+								   class="screen-reader-text"><?php esc_html_e('Enter a title to search for and press enter', 'wetu-importer'); ?></label>
107 107
 						</th>
108 108
 						<td class="post-title page-title column-title">
109 109
 							<strong>
110
-								<?php esc_html_e( 'Enter a title to search for', 'wetu-importer' ); ?>
110
+								<?php esc_html_e('Enter a title to search for', 'wetu-importer'); ?>
111 111
 							</strong>
112 112
 						</td>
113 113
 						<td class="date column-date">
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 				</table>
123 123
 
124 124
 				<p><input class="button button-primary add" type="button"
125
-						  value="<?php esc_html_e( 'Add to List', 'wetu-importer' ); ?>"/>
125
+						  value="<?php esc_html_e('Add to List', 'wetu-importer'); ?>"/>
126 126
 					<input class="button button-primary clear" type="button"
127
-						   value="<?php esc_html_e( 'Clear', 'wetu-importer' ); ?>"/>
127
+						   value="<?php esc_html_e('Clear', 'wetu-importer'); ?>"/>
128 128
 				</p>
129 129
 			</form>
130 130
 
@@ -134,118 +134,118 @@  discard block
 block discarded – undo
134 134
 
135 135
 					<div class="row">
136 136
 						<div class="settings-all" style="width:30%;display:block;float:left;">
137
-							<h3><?php esc_html_e( 'What content to Sync from WETU' ); ?></h3>
137
+							<h3><?php esc_html_e('What content to Sync from WETU'); ?></h3>
138 138
 							<ul>
139 139
 								<li>
140
-									<input class="content select-all" <?php $this->checked( $this->destination_options, 'all' ); ?>
140
+									<input class="content select-all" <?php $this->checked($this->destination_options, 'all'); ?>
141 141
 										   type="checkbox" name="content[]"
142
-										   value="all"/> <?php esc_html_e( 'Select All', 'wetu-importer' ); ?></li>
143
-								<?php if ( isset( $this->options ) && 'on' !== $this->options['disable_destination_descriptions'] ) { ?>
142
+										   value="all"/> <?php esc_html_e('Select All', 'wetu-importer'); ?></li>
143
+								<?php if (isset($this->options) && 'on' !== $this->options['disable_destination_descriptions']) { ?>
144 144
 								<li>
145
-									<input class="content" <?php $this->checked( $this->destination_options, 'description' ); ?>
145
+									<input class="content" <?php $this->checked($this->destination_options, 'description'); ?>
146 146
 										   type="checkbox" name="content[]"
147
-										   value="description"/> <?php esc_html_e( 'Description', 'wetu-importer' ); ?></li>
147
+										   value="description"/> <?php esc_html_e('Description', 'wetu-importer'); ?></li>
148 148
 								<?php } ?>
149 149
 
150 150
 								<li>
151
-									<input class="content" <?php $this->checked( $this->destination_options, 'gallery' ); ?>
151
+									<input class="content" <?php $this->checked($this->destination_options, 'gallery'); ?>
152 152
 										   type="checkbox" name="content[]"
153
-										   value="gallery"/> <?php esc_html_e( 'Main Gallery', 'wetu-importer' ); ?></li>
154
-								<?php if ( class_exists( 'LSX_TO_Maps' ) ) { ?>
153
+										   value="gallery"/> <?php esc_html_e('Main Gallery', 'wetu-importer'); ?></li>
154
+								<?php if (class_exists('LSX_TO_Maps')) { ?>
155 155
 									<li>
156
-										<input class="content" <?php $this->checked( $this->destination_options, 'location' ); ?>
156
+										<input class="content" <?php $this->checked($this->destination_options, 'location'); ?>
157 157
 											   type="checkbox" name="content[]"
158
-											   value="location"/> <?php esc_html_e( 'Location', 'wetu-importer' ); ?></li>
158
+											   value="location"/> <?php esc_html_e('Location', 'wetu-importer'); ?></li>
159 159
 								<?php } ?>
160 160
 
161
-								<?php if ( class_exists( 'LSX_TO_Videos' ) ) { ?>
161
+								<?php if (class_exists('LSX_TO_Videos')) { ?>
162 162
 									<li>
163
-										<input class="content" <?php $this->checked( $this->destination_options, 'videos' ); ?>
163
+										<input class="content" <?php $this->checked($this->destination_options, 'videos'); ?>
164 164
 											   type="checkbox" name="content[]"
165
-											   value="videos"/> <?php esc_html_e( 'Videos', 'wetu-importer' ); ?></li>
165
+											   value="videos"/> <?php esc_html_e('Videos', 'wetu-importer'); ?></li>
166 166
 								<?php } ?>
167 167
 
168 168
 							</ul>
169
-							<h4><?php esc_html_e( 'Additional Content' ); ?></h4>
169
+							<h4><?php esc_html_e('Additional Content'); ?></h4>
170 170
 							<ul>
171 171
 								<li>
172
-									<input class="content" <?php $this->checked( $this->destination_options, 'country' ); ?>
172
+									<input class="content" <?php $this->checked($this->destination_options, 'country'); ?>
173 173
 										   type="checkbox" name="content[]"
174
-										   value="country"/> <?php esc_html_e( 'Set Country', 'wetu-importer' ); ?></li>
174
+										   value="country"/> <?php esc_html_e('Set Country', 'wetu-importer'); ?></li>
175 175
 								<li>
176
-									<input class="content" <?php $this->checked( $this->destination_options, 'continent' ); ?>
176
+									<input class="content" <?php $this->checked($this->destination_options, 'continent'); ?>
177 177
 										   type="checkbox" name="content[]"
178
-										   value="continent"/> <?php esc_html_e( 'Set Continent', 'wetu-importer' ); ?></li>
178
+										   value="continent"/> <?php esc_html_e('Set Continent', 'wetu-importer'); ?></li>
179 179
 
180 180
 								<li>
181
-									<input class="content" <?php $this->checked( $this->destination_options, 'featured_image' ); ?>
181
+									<input class="content" <?php $this->checked($this->destination_options, 'featured_image'); ?>
182 182
 										   type="checkbox" name="content[]"
183
-										   value="featured_image"/> <?php esc_html_e( 'Set Featured Image', 'wetu-importer' ); ?>
183
+										   value="featured_image"/> <?php esc_html_e('Set Featured Image', 'wetu-importer'); ?>
184 184
 								</li>
185
-								<?php if ( class_exists( 'LSX_Banners' ) ) { ?>
185
+								<?php if (class_exists('LSX_Banners')) { ?>
186 186
 									<li>
187
-										<input class="content" <?php $this->checked( $this->destination_options, 'banner_image' ); ?>
187
+										<input class="content" <?php $this->checked($this->destination_options, 'banner_image'); ?>
188 188
 											   type="checkbox" name="content[]"
189
-											   value="banner_image"/> <?php esc_html_e( 'Set Banner Image', 'wetu-importer' ); ?>
189
+											   value="banner_image"/> <?php esc_html_e('Set Banner Image', 'wetu-importer'); ?>
190 190
 									</li>
191 191
 									<li>
192
-										<input class="content" <?php $this->checked( $this->destination_options, 'unique_banner_image' ); ?>
192
+										<input class="content" <?php $this->checked($this->destination_options, 'unique_banner_image'); ?>
193 193
 											   type="checkbox" name="content[]"
194
-											   value="unique_banner_image"/> <?php esc_html_e( 'Use the WETU banner field', 'wetu-importer' ); ?>
194
+											   value="unique_banner_image"/> <?php esc_html_e('Use the WETU banner field', 'wetu-importer'); ?>
195 195
 									</li>
196 196
 								<?php } ?>
197 197
 
198 198
 								<li>
199
-									<input class="content" <?php $this->checked( $this->destination_options, 'strip_tags' ); ?>
199
+									<input class="content" <?php $this->checked($this->destination_options, 'strip_tags'); ?>
200 200
 										   type="checkbox" name="content[]"
201
-										   value="strip_tags"/> <?php esc_html_e( 'Strip HTML from the description', 'wetu-importer' ); ?></li>
201
+										   value="strip_tags"/> <?php esc_html_e('Strip HTML from the description', 'wetu-importer'); ?></li>
202 202
 							</ul>
203 203
 						</div>
204 204
 						<div class="settings-all" style="width:30%;display:block;float:left;">
205
-							<h3><?php esc_html_e( 'Travel Information' ); ?></h3>
205
+							<h3><?php esc_html_e('Travel Information'); ?></h3>
206 206
 							<ul>
207 207
 								<li>
208
-									<input class="content" <?php $this->checked( $this->destination_options, 'electricity' ); ?>
208
+									<input class="content" <?php $this->checked($this->destination_options, 'electricity'); ?>
209 209
 										   type="checkbox" name="content[]"
210
-										   value="electricity"/> <?php esc_html_e( 'Electricity', 'wetu-importer' ); ?></li>
210
+										   value="electricity"/> <?php esc_html_e('Electricity', 'wetu-importer'); ?></li>
211 211
 								<li>
212
-									<input class="content" <?php $this->checked( $this->destination_options, 'banking' ); ?>
212
+									<input class="content" <?php $this->checked($this->destination_options, 'banking'); ?>
213 213
 										   type="checkbox" name="content[]"
214
-										   value="banking"/> <?php esc_html_e( 'Banking', 'wetu-importer' ); ?></li>
214
+										   value="banking"/> <?php esc_html_e('Banking', 'wetu-importer'); ?></li>
215 215
 								<li>
216
-									<input class="content" <?php $this->checked( $this->destination_options, 'cuisine' ); ?>
216
+									<input class="content" <?php $this->checked($this->destination_options, 'cuisine'); ?>
217 217
 										   type="checkbox" name="content[]"
218
-										   value="cuisine"/> <?php esc_html_e( 'Cuisine', 'wetu-importer' ); ?></li>
218
+										   value="cuisine"/> <?php esc_html_e('Cuisine', 'wetu-importer'); ?></li>
219 219
 								<li>
220
-									<input class="content" <?php $this->checked( $this->destination_options, 'climate' ); ?>
220
+									<input class="content" <?php $this->checked($this->destination_options, 'climate'); ?>
221 221
 										   type="checkbox" name="content[]"
222
-										   value="climate"/> <?php esc_html_e( 'Climate', 'wetu-importer' ); ?></li>
222
+										   value="climate"/> <?php esc_html_e('Climate', 'wetu-importer'); ?></li>
223 223
 								<li>
224
-									<input class="content" <?php $this->checked( $this->destination_options, 'transport' ); ?>
224
+									<input class="content" <?php $this->checked($this->destination_options, 'transport'); ?>
225 225
 										   type="checkbox" name="content[]"
226
-										   value="transport"/> <?php esc_html_e( 'Transport', 'wetu-importer' ); ?></li>
227
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'dress' ); ?>
226
+										   value="transport"/> <?php esc_html_e('Transport', 'wetu-importer'); ?></li>
227
+								<li><input class="content" <?php $this->checked($this->destination_options, 'dress'); ?>
228 228
 										   type="checkbox" name="content[]"
229
-										   value="dress"/> <?php esc_html_e( 'Dress', 'wetu-importer' ); ?></li>
230
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'health' ); ?>
229
+										   value="dress"/> <?php esc_html_e('Dress', 'wetu-importer'); ?></li>
230
+								<li><input class="content" <?php $this->checked($this->destination_options, 'health'); ?>
231 231
 										   type="checkbox" name="content[]"
232
-										   value="health"/> <?php esc_html_e( 'Health', 'wetu-importer' ); ?></li>
233
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'safety' ); ?>
232
+										   value="health"/> <?php esc_html_e('Health', 'wetu-importer'); ?></li>
233
+								<li><input class="content" <?php $this->checked($this->destination_options, 'safety'); ?>
234 234
 										   type="checkbox" name="content[]"
235
-										   value="safety"/> <?php esc_html_e( 'Safety', 'wetu-importer' ); ?></li>
236
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'visa' ); ?>
235
+										   value="safety"/> <?php esc_html_e('Safety', 'wetu-importer'); ?></li>
236
+								<li><input class="content" <?php $this->checked($this->destination_options, 'visa'); ?>
237 237
 										   type="checkbox" name="content[]"
238
-										   value="visa"/> <?php esc_html_e( 'Visa', 'wetu-importer' ); ?></li>
239
-								<li><input class="content" <?php $this->checked( $this->destination_options, 'additional_info' ); ?>
238
+										   value="visa"/> <?php esc_html_e('Visa', 'wetu-importer'); ?></li>
239
+								<li><input class="content" <?php $this->checked($this->destination_options, 'additional_info'); ?>
240 240
 										   type="checkbox" name="content[]"
241
-										   value="additional_info"/> <?php esc_html_e( 'General', 'wetu-importer' ); ?></li>
241
+										   value="additional_info"/> <?php esc_html_e('General', 'wetu-importer'); ?></li>
242 242
 							</ul>
243 243
 						</div>
244 244
 
245
-						<?php if ( class_exists( 'LSX_TO_Team' ) ) { ?>
245
+						<?php if (class_exists('LSX_TO_Team')) { ?>
246 246
 							<div style="width:30%;display:block;float:left;">
247
-								<h3><?php esc_html_e( 'Assign a Team Member' ); ?></h3>
248
-								<?php $this->team_member_checkboxes( $this->destination_options ); ?>
247
+								<h3><?php esc_html_e('Assign a Team Member'); ?></h3>
248
+								<?php $this->team_member_checkboxes($this->destination_options); ?>
249 249
 							</div>
250 250
 						<?php } ?>
251 251
 
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 					</div>
254 254
 
255 255
 
256
-					<h3><?php esc_html_e( 'Your List' ); ?></h3>
256
+					<h3><?php esc_html_e('Your List'); ?></h3>
257 257
 					<p><input class="button button-primary" type="submit"
258
-							  value="<?php esc_html_e( 'Sync', 'wetu-importer' ); ?>"/></p>
258
+							  value="<?php esc_html_e('Sync', 'wetu-importer'); ?>"/></p>
259 259
 					<table class="wp-list-table widefat fixed posts">
260 260
 						<?php $this->table_header(); ?>
261 261
 
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 					</table>
269 269
 
270 270
 					<p><input class="button button-primary" type="submit"
271
-							  value="<?php esc_html_e( 'Sync', 'wetu-importer' ); ?>"/></p>
271
+							  value="<?php esc_html_e('Sync', 'wetu-importer'); ?>"/></p>
272 272
 				</form>
273 273
 			</div>
274 274
 
275 275
 			<div style="display:none;" class="completed-list-wrapper">
276
-				<h3><?php esc_html_e( 'Completed' ); ?></h3>
276
+				<h3><?php esc_html_e('Completed'); ?></h3>
277 277
 				<ul>
278 278
 				</ul>
279 279
 			</div>
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	/**
285 285
 	 * Grab all the current destination posts via the lsx_wetu_id field.
286 286
 	 */
287
-	public function find_current_destination( $post_type = 'destination' ) {
287
+	public function find_current_destination($post_type = 'destination') {
288 288
 		global $wpdb;
289 289
 		$return = array();
290 290
 
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 		");
304 304
 		// @codingStandardsIgnoreEnd
305 305
 
306
-		if ( null !== $current_destination && ! empty( $current_destination ) ) {
307
-			foreach ( $current_destination as $accom ) {
308
-				$return[ $accom->meta_value ] = $accom;
306
+		if (null !== $current_destination && !empty($current_destination)) {
307
+			foreach ($current_destination as $accom) {
308
+				$return[$accom->meta_value] = $accom;
309 309
 			}
310 310
 		}
311 311
 
@@ -319,119 +319,119 @@  discard block
 block discarded – undo
319 319
 		$return = false;
320 320
 
321 321
 		// @codingStandardsIgnoreLine
322
-		if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_tour_importer' && isset( $_POST['type'] ) && $_POST['type'] === 'destination' ) {
322
+		if (isset($_POST['action']) && $_POST['action'] === 'lsx_tour_importer' && isset($_POST['type']) && $_POST['type'] === 'destination') {
323 323
 
324 324
 			$searched_items = false;
325 325
 
326 326
 			// @codingStandardsIgnoreLine
327
-			if ( isset( $_POST['keyword'] ) ) {
327
+			if (isset($_POST['keyword'])) {
328 328
 				// @codingStandardsIgnoreLine
329 329
 				$keyphrases = $_POST['keyword'];
330
-			} else {
331
-				$keyphrases = array( 0 );
330
+			}else {
331
+				$keyphrases = array(0);
332 332
 			}
333 333
 
334
-			if ( ! is_array( $keyphrases ) ) {
335
-				$keyphrases = array( $keyphrases );
334
+			if (!is_array($keyphrases)) {
335
+				$keyphrases = array($keyphrases);
336 336
 			}
337
-			foreach ( $keyphrases as &$keyword ) {
338
-				$keyword = ltrim( rtrim( $keyword ) );
337
+			foreach ($keyphrases as &$keyword) {
338
+				$keyword = ltrim(rtrim($keyword));
339 339
 			}
340 340
 
341 341
 			$post_status = false;
342 342
 
343
-			if ( in_array( 'publish', $keyphrases ) ) {
343
+			if (in_array('publish', $keyphrases)) {
344 344
 				$post_status = 'publish';
345 345
 			}
346
-			if ( in_array( 'pending', $keyphrases ) ) {
346
+			if (in_array('pending', $keyphrases)) {
347 347
 				$post_status = 'pending';
348 348
 			}
349
-			if ( in_array( 'draft', $keyphrases ) ) {
349
+			if (in_array('draft', $keyphrases)) {
350 350
 				$post_status = 'draft';
351 351
 			}
352
-			if ( in_array( 'import', $keyphrases ) ) {
352
+			if (in_array('import', $keyphrases)) {
353 353
 				$post_status = 'import';
354 354
 			}
355 355
 
356 356
 			// If there is a post status use it.
357
-			if ( false !== $post_status ) {
357
+			if (false !== $post_status) {
358 358
 
359 359
 				$accommodation = array();
360
-				$current_accommodation = $this->find_current_accommodation( 'destination' );
361
-				if ( ! empty( $current_accommodation ) ) {
362
-					foreach ( $current_accommodation as $cs_key => $ccs_id ) {
363
-						$accommodation[] = $this->prepare_row_attributes( $cs_key, $ccs_id->post_id );
360
+				$current_accommodation = $this->find_current_accommodation('destination');
361
+				if (!empty($current_accommodation)) {
362
+					foreach ($current_accommodation as $cs_key => $ccs_id) {
363
+						$accommodation[] = $this->prepare_row_attributes($cs_key, $ccs_id->post_id);
364 364
 					}
365 365
 				}
366 366
 
367 367
 				// Run through each accommodation and use it.
368
-				if ( ! empty( $accommodation ) ) {
369
-					foreach ( $accommodation as $row_key => $row ) {
370
-						if ( 'import' === $post_status ) {
371
-
372
-							if ( is_array( $this->queued_imports ) && in_array( $row['post_id'], $this->queued_imports ) ) {
373
-								$current_status = get_post_status( $row['post_id'] );
374
-								if ( 'draft' === $current_status ) {
375
-									$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
368
+				if (!empty($accommodation)) {
369
+					foreach ($accommodation as $row_key => $row) {
370
+						if ('import' === $post_status) {
371
+
372
+							if (is_array($this->queued_imports) && in_array($row['post_id'], $this->queued_imports)) {
373
+								$current_status = get_post_status($row['post_id']);
374
+								if ('draft' === $current_status) {
375
+									$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
376 376
 								}
377
-							} else {
377
+							}else {
378 378
 								continue;
379 379
 							}
380
-						} else {
381
-							if ( 0 === $row['post_id'] ) {
380
+						}else {
381
+							if (0 === $row['post_id']) {
382 382
 								continue;
383
-							} else {
384
-								$current_status = get_post_status( $row['post_id'] );
383
+							}else {
384
+								$current_status = get_post_status($row['post_id']);
385 385
 
386
-								if ( $current_status !== $post_status ) {
386
+								if ($current_status !== $post_status) {
387 387
 									continue;
388 388
 								}
389 389
 							}
390
-							$searched_items[ sanitize_title( $row['name'] ) . '-' . $row['id'] ] = $this->format_row( $row );
390
+							$searched_items[sanitize_title($row['name']).'-'.$row['id']] = $this->format_row($row);
391 391
 						}
392 392
 					}
393 393
 				}
394
-			} else {
394
+			}else {
395 395
 
396
-				$key_string_search = implode( '+', $keyphrases );
397
-				$search_data = file_get_contents( $this->url . '/Search/' . $key_string_search . '/?all=include' );
398
-				$search_data = json_decode( $search_data, true );
396
+				$key_string_search = implode('+', $keyphrases);
397
+				$search_data = file_get_contents($this->url.'/Search/'.$key_string_search.'/?all=include');
398
+				$search_data = json_decode($search_data, true);
399 399
 
400
-				if ( ! isset( $search_data['error'] ) ) {
401
-					foreach ( $search_data as $sdata ) {
400
+				if (!isset($search_data['error'])) {
401
+					foreach ($search_data as $sdata) {
402 402
 
403
-						if ( 'Destination' !== trim( $sdata['type'] ) ) {
403
+						if ('Destination' !== trim($sdata['type'])) {
404 404
 							continue;
405 405
 						}
406 406
 
407
-						$temp_id = $this->get_post_id_by_key_value( $sdata['id'] );
408
-						if ( false === $temp_id ) {
407
+						$temp_id = $this->get_post_id_by_key_value($sdata['id']);
408
+						if (false === $temp_id) {
409 409
 							$sdata['post_id'] = 0;
410
-						} else {
410
+						}else {
411 411
 							$sdata['post_id'] = $temp_id;
412 412
 						}
413
-						$searched_items[ sanitize_title( $sdata['name'] ) . '-' . $sdata['id'] ] = $this->format_row( $sdata );
413
+						$searched_items[sanitize_title($sdata['name']).'-'.$sdata['id']] = $this->format_row($sdata);
414 414
 					}
415 415
 				}
416 416
 			}
417 417
 
418
-			if ( false !== $searched_items ) {
419
-				ksort( $searched_items );
420
-				$return = implode( $searched_items );
418
+			if (false !== $searched_items) {
419
+				ksort($searched_items);
420
+				$return = implode($searched_items);
421 421
 			}
422 422
 
423
-			print_r( $return );
423
+			print_r($return);
424 424
 		}
425 425
 
426 426
 		die();
427 427
 	}
428 428
 
429
-	public function prepare_row_attributes( $cs_key, $ccs_id ) {
429
+	public function prepare_row_attributes($cs_key, $ccs_id) {
430 430
 		return $row_item = array(
431 431
 			'id' => $cs_key,
432 432
 			'type' => 'Destination',
433
-			'name' => get_the_title( $ccs_id ),
434
-			'last_modified' => date( 'Y-m-d', strtotime( 'now' ) ),
433
+			'name' => get_the_title($ccs_id),
434
+			'last_modified' => date('Y-m-d', strtotime('now')),
435 435
 			'post_id' => $ccs_id,
436 436
 		);
437 437
 	}
@@ -439,28 +439,28 @@  discard block
 block discarded – undo
439 439
 	/**
440 440
 	 * Formats the row for output on the screen.
441 441
 	 */
442
-	public function format_row( $row = false ) {
443
-		if ( false !== $row ) {
442
+	public function format_row($row = false) {
443
+		if (false !== $row) {
444 444
 
445 445
 			$status = 'import';
446
-			if ( 0 !== $row['post_id'] ) {
447
-				$status = '<a href="' . admin_url( '/post.php?post=' . $row['post_id'] . '&action=edit' ) . '" target="_blank">' . get_post_status( $row['post_id'] ) . '</a>';
446
+			if (0 !== $row['post_id']) {
447
+				$status = '<a href="'.admin_url('/post.php?post='.$row['post_id'].'&action=edit').'" target="_blank">'.get_post_status($row['post_id']).'</a>';
448 448
 			}
449 449
 
450 450
 			$row_html = '
451
-			<tr class="post-' . $row['post_id'] . ' type-tour" id="post-' . $row['post_id'] . '">
451
+			<tr class="post-' . $row['post_id'].' type-tour" id="post-'.$row['post_id'].'">
452 452
 				<th class="check-column" scope="row">
453
-					<label for="cb-select-' . $row['id'] . '" class="screen-reader-text">' . $row['name'] . '</label>
454
-					<input type="checkbox" data-identifier="' . $row['id'] . '" value="' . $row['post_id'] . '" name="post[]" id="cb-select-' . $row['id'] . '">
453
+					<label for="cb-select-' . $row['id'].'" class="screen-reader-text">'.$row['name'].'</label>
454
+					<input type="checkbox" data-identifier="' . $row['id'].'" value="'.$row['post_id'].'" name="post[]" id="cb-select-'.$row['id'].'">
455 455
 				</th>
456 456
 				<td class="post-title page-title column-title">
457
-					<strong>' . $row['name'] . '</strong> - ' . $status . '
457
+					<strong>' . $row['name'].'</strong> - '.$status.'
458 458
 				</td>
459 459
 				<td class="date column-date">
460
-					<abbr title="' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '">' . date( 'Y/m/d',strtotime( $row['last_modified'] ) ) . '</abbr><br>Last Modified
460
+					<abbr title="' . date('Y/m/d', strtotime($row['last_modified'])).'">'.date('Y/m/d', strtotime($row['last_modified'])).'</abbr><br>Last Modified
461 461
 				</td>
462 462
 				<td class="ssid column-ssid">
463
-					' . $row['id'] . '
463
+					' . $row['id'].'
464 464
 				</td>
465 465
 			</tr>';
466 466
 			return $row_html;
@@ -474,49 +474,49 @@  discard block
 block discarded – undo
474 474
 		$return = false;
475 475
 
476 476
 		// @codingStandardsIgnoreLine
477
-		if ( isset( $_POST['action'] ) && $_POST['action'] === 'lsx_import_items' && isset( $_POST['type'] ) && $_POST['type'] === 'destination' && isset( $_POST['wetu_id'] ) ) {
477
+		if (isset($_POST['action']) && $_POST['action'] === 'lsx_import_items' && isset($_POST['type']) && $_POST['type'] === 'destination' && isset($_POST['wetu_id'])) {
478 478
 			// @codingStandardsIgnoreLine
479 479
 			$wetu_id = $_POST['wetu_id'];
480 480
 
481 481
 			// @codingStandardsIgnoreLine
482
-			if ( isset( $_POST['post_id'] ) ) {
482
+			if (isset($_POST['post_id'])) {
483 483
 				// @codingStandardsIgnoreLine
484 484
 				$post_id = $_POST['post_id'];
485
-				$this->current_post = get_post( $post_id );
486
-			} else {
485
+				$this->current_post = get_post($post_id);
486
+			}else {
487 487
 				$post_id = 0;
488 488
 			}
489 489
 
490 490
 			// @codingStandardsIgnoreLine
491
-			if ( isset( $_POST['team_members'] ) ) {
491
+			if (isset($_POST['team_members'])) {
492 492
 				// @codingStandardsIgnoreLine
493 493
 				$team_members = $_POST['team_members'];
494
-			} else {
494
+			}else {
495 495
 				$team_members = false;
496 496
 			}
497 497
 
498 498
 			$safari_brands = false;
499 499
 
500
-			delete_option( 'wetu_importer_destination_settings' );
500
+			delete_option('wetu_importer_destination_settings');
501 501
 
502 502
 			// @codingStandardsIgnoreLine
503
-			if ( isset( $_POST['content'] ) && is_array( $_POST['content'] ) && ! empty( $_POST['content'] ) ) {
503
+			if (isset($_POST['content']) && is_array($_POST['content']) && !empty($_POST['content'])) {
504 504
 				// @codingStandardsIgnoreLine
505 505
 				$content = $_POST['content'];
506
-				add_option( 'wetu_importer_destination_settings', $content );
507
-			} else {
506
+				add_option('wetu_importer_destination_settings', $content);
507
+			}else {
508 508
 				$content = false;
509 509
 			}
510 510
 
511
-			$jdata = wp_remote_get( $this->url . '/Get?' . $this->url_qs . '&ids=' . $wetu_id );
511
+			$jdata = wp_remote_get($this->url.'/Get?'.$this->url_qs.'&ids='.$wetu_id);
512 512
 
513
-			if ( ! empty( $jdata ) && isset( $jdata['response'] ) && isset( $jdata['response']['code'] ) && 200 === $jdata['response']['code'] ) {
514
-				$adata = json_decode( $jdata, true );
515
-				$return = $this->import_row( $adata, $wetu_id, $post_id, $team_members, $content, $safari_brands );
516
-				$this->remove_from_queue( $return );
517
-				$this->format_completed_row( $return );
518
-			} else {
519
-				$this->format_error( esc_html__( 'There was a problem importing your destination, please try refreshing the page.', 'wetu-importer' ) );
513
+			if (!empty($jdata) && isset($jdata['response']) && isset($jdata['response']['code']) && 200 === $jdata['response']['code']) {
514
+				$adata = json_decode($jdata, true);
515
+				$return = $this->import_row($adata, $wetu_id, $post_id, $team_members, $content, $safari_brands);
516
+				$this->remove_from_queue($return);
517
+				$this->format_completed_row($return);
518
+			}else {
519
+				$this->format_error(esc_html__('There was a problem importing your destination, please try refreshing the page.', 'wetu-importer'));
520 520
 			}
521 521
 		}
522 522
 	}
@@ -524,14 +524,14 @@  discard block
 block discarded – undo
524 524
 	/**
525 525
 	 * Saves the queue to the option.
526 526
 	 */
527
-	public function remove_from_queue( $id ) {
528
-		if ( ! empty( $this->queued_imports ) ) {
527
+	public function remove_from_queue($id) {
528
+		if (!empty($this->queued_imports)) {
529 529
 			// @codingStandardsIgnoreLine
530
-			if ( ( $key = array_search( $id, $this->queued_imports ) ) !== false ) {
531
-				unset( $this->queued_imports[ $key ] );
530
+			if (($key = array_search($id, $this->queued_imports)) !== false) {
531
+				unset($this->queued_imports[$key]);
532 532
 
533
-				delete_option( 'wetu_importer_que' );
534
-				update_option( 'wetu_importer_que', $this->queued_imports );
533
+				delete_option('wetu_importer_que');
534
+				update_option('wetu_importer_que', $this->queued_imports);
535 535
 			}
536 536
 		}
537 537
 	}
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
 	/**
540 540
 	 * Connect to wetu
541 541
 	 */
542
-	public function import_row( $data, $wetu_id, $id = 0, $team_members = false, $importable_content = array(), $safari_brands = false ) {
543
-		if ( 'Destination' === trim( $data[0]['type'] ) ) {
542
+	public function import_row($data, $wetu_id, $id = 0, $team_members = false, $importable_content = array(), $safari_brands = false) {
543
+		if ('Destination' === trim($data[0]['type'])) {
544 544
 			$post_name = '';
545 545
 			$data_post_content = '';
546 546
 			$data_post_excerpt = '';
@@ -549,132 +549,132 @@  discard block
 block discarded – undo
549 549
 				'post_type' => 'destination',
550 550
 			);
551 551
 
552
-			if ( ! empty( $importable_content ) && in_array( 'country', $importable_content ) ) {
553
-				$parent = $this->check_for_parent( $data );
554
-				if ( false !== $parent ) {
552
+			if (!empty($importable_content) && in_array('country', $importable_content)) {
553
+				$parent = $this->check_for_parent($data);
554
+				if (false !== $parent) {
555 555
 					$post['post_parent'] = $parent;
556 556
 				}
557 557
 			}
558 558
 
559 559
 			// Set the post_content.
560
-			if ( ! empty( $importable_content ) && in_array( 'description', $importable_content ) ) {
561
-				if ( isset( $data[0]['content']['general_description'] ) ) {
560
+			if (!empty($importable_content) && in_array('description', $importable_content)) {
561
+				if (isset($data[0]['content']['general_description'])) {
562 562
 
563
-					if ( in_array( 'strip_tags', $importable_content ) ) {
564
-						$post['post_content'] = wp_strip_all_tags( $data[0]['content']['general_description'] );
565
-					} else {
563
+					if (in_array('strip_tags', $importable_content)) {
564
+						$post['post_content'] = wp_strip_all_tags($data[0]['content']['general_description']);
565
+					}else {
566 566
 						$post['post_content'] = $data[0]['content']['general_description'];
567 567
 					}
568 568
 				}
569 569
 			}
570 570
 
571
-			if ( false !== $id && '0' !== $id ) {
571
+			if (false !== $id && '0' !== $id) {
572 572
 				$post['ID'] = $id;
573 573
 
574
-				if ( isset( $data[0]['name'] ) ) {
574
+				if (isset($data[0]['name'])) {
575 575
 					$post['post_title'] = $data[0]['name'];
576 576
 					$post['post_status'] = 'publish';
577
-					$post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 );
577
+					$post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0);
578 578
 				}
579 579
 
580
-				$id = wp_update_post( $post );
581
-				$prev_date = get_post_meta( $id, 'lsx_wetu_modified_date', true );
582
-				update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date );
583
-			} else {
580
+				$id = wp_update_post($post);
581
+				$prev_date = get_post_meta($id, 'lsx_wetu_modified_date', true);
582
+				update_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']), $prev_date);
583
+			}else {
584 584
 				// Set the name.
585
-				if ( isset( $data[0]['name'] ) ) {
586
-					$post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 );
585
+				if (isset($data[0]['name'])) {
586
+					$post_name = wp_unique_post_slug(sanitize_title($data[0]['name']), $id, 'draft', 'destination', 0);
587 587
 				}
588 588
 
589 589
 				$post['post_name'] = $post_name;
590 590
 				$post['post_title'] = $data[0]['name'];
591 591
 				$post['post_status'] = 'publish';
592
-				$id = wp_insert_post( $post );
592
+				$id = wp_insert_post($post);
593 593
 
594 594
 				// Save the WETU ID and the Last date it was modified.
595
-				if ( false !== $id ) {
596
-					add_post_meta( $id, 'lsx_wetu_id', $wetu_id );
597
-					add_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ) );
595
+				if (false !== $id) {
596
+					add_post_meta($id, 'lsx_wetu_id', $wetu_id);
597
+					add_post_meta($id, 'lsx_wetu_modified_date', strtotime($data[0]['last_modified']));
598 598
 				}
599 599
 			}
600 600
 
601
-			$this->find_attachments( $id );
601
+			$this->find_attachments($id);
602 602
 
603 603
 			// Set the team member if it is there.
604
-			if ( post_type_exists( 'team' ) && false !== $team_members && '' !== $team_members ) {
605
-				$this->set_team_member( $id, $team_members );
604
+			if (post_type_exists('team') && false !== $team_members && '' !== $team_members) {
605
+				$this->set_team_member($id, $team_members);
606 606
 			}
607 607
 
608
-			if ( class_exists( 'LSX_TO_Maps' ) ) {
609
-				$this->set_map_data( $data, $id, 9 );
608
+			if (class_exists('LSX_TO_Maps')) {
609
+				$this->set_map_data($data, $id, 9);
610 610
 			}
611 611
 
612 612
 			// Set the Room Data.
613
-			if ( false !== $importable_content && in_array( 'videos', $importable_content ) ) {
614
-				$this->set_video_data( $data, $id );
613
+			if (false !== $importable_content && in_array('videos', $importable_content)) {
614
+				$this->set_video_data($data, $id);
615 615
 			}
616 616
 
617 617
 			// Set the Electricity.
618
-			if ( false !== $importable_content && in_array( 'electricity', $importable_content ) ) {
619
-				$this->set_travel_info( $data, $id, 'electricity', $importable_content );
618
+			if (false !== $importable_content && in_array('electricity', $importable_content)) {
619
+				$this->set_travel_info($data, $id, 'electricity', $importable_content);
620 620
 			}
621 621
 			// Set the cuisine.
622
-			if ( false !== $importable_content && in_array( 'cuisine', $importable_content ) ) {
623
-				$this->set_travel_info( $data, $id, 'cuisine', $importable_content );
622
+			if (false !== $importable_content && in_array('cuisine', $importable_content)) {
623
+				$this->set_travel_info($data, $id, 'cuisine', $importable_content);
624 624
 			}
625 625
 			// Set the banking.
626
-			if ( false !== $importable_content && in_array( 'banking', $importable_content ) ) {
627
-				$this->set_travel_info( $data, $id, 'banking', $importable_content );
626
+			if (false !== $importable_content && in_array('banking', $importable_content)) {
627
+				$this->set_travel_info($data, $id, 'banking', $importable_content);
628 628
 			}
629 629
 			// Set the transport.
630
-			if ( false !== $importable_content && in_array( 'transport', $importable_content ) ) {
631
-				$this->set_travel_info( $data, $id, 'transport', $importable_content );
630
+			if (false !== $importable_content && in_array('transport', $importable_content)) {
631
+				$this->set_travel_info($data, $id, 'transport', $importable_content);
632 632
 			}
633 633
 			// Set the dress.
634
-			if ( false !== $importable_content && in_array( 'dress', $importable_content ) ) {
635
-				$this->set_travel_info( $data, $id, 'dress', $importable_content );
634
+			if (false !== $importable_content && in_array('dress', $importable_content)) {
635
+				$this->set_travel_info($data, $id, 'dress', $importable_content);
636 636
 			}
637 637
 			// Set the climate.
638
-			if ( false !== $importable_content && in_array( 'climate', $importable_content ) ) {
639
-				$this->set_travel_info( $data, $id, 'climate', $importable_content );
638
+			if (false !== $importable_content && in_array('climate', $importable_content)) {
639
+				$this->set_travel_info($data, $id, 'climate', $importable_content);
640 640
 			}
641 641
 			// Set the Health.
642
-			if ( false !== $importable_content && in_array( 'health', $importable_content ) ) {
643
-				$this->set_travel_info( $data, $id, 'health', $importable_content );
642
+			if (false !== $importable_content && in_array('health', $importable_content)) {
643
+				$this->set_travel_info($data, $id, 'health', $importable_content);
644 644
 			}
645 645
 			// Set the Safety.
646
-			if ( false !== $importable_content && in_array( 'safety', $importable_content ) ) {
647
-				$this->set_travel_info( $data, $id, 'safety', $importable_content );
646
+			if (false !== $importable_content && in_array('safety', $importable_content)) {
647
+				$this->set_travel_info($data, $id, 'safety', $importable_content);
648 648
 			}
649 649
 			// Set the Visa.
650
-			if ( false !== $importable_content && in_array( 'visa', $importable_content ) ) {
651
-				$this->set_travel_info( $data, $id, 'visa', $importable_content );
650
+			if (false !== $importable_content && in_array('visa', $importable_content)) {
651
+				$this->set_travel_info($data, $id, 'visa', $importable_content);
652 652
 			}
653 653
 			// Set the General.
654
-			if ( false !== $importable_content && in_array( 'additional_info', $importable_content ) ) {
655
-				$this->set_travel_info( $data, $id, 'additional_info', $importable_content );
654
+			if (false !== $importable_content && in_array('additional_info', $importable_content)) {
655
+				$this->set_travel_info($data, $id, 'additional_info', $importable_content);
656 656
 			}
657 657
 
658 658
 			// Setup some default for use in the import.
659
-			if ( false !== $importable_content && (in_array( 'gallery', $importable_content ) || in_array( 'banner_image', $importable_content ) || in_array( 'featured_image', $importable_content )) ) {
660
-				$this->find_attachments( $id );
659
+			if (false !== $importable_content && (in_array('gallery', $importable_content) || in_array('banner_image', $importable_content) || in_array('featured_image', $importable_content))) {
660
+				$this->find_attachments($id);
661 661
 
662 662
 				// Set the featured image.
663
-				if ( false !== $importable_content && in_array( 'featured_image', $importable_content ) ) {
664
-					$this->set_featured_image( $data, $id );
663
+				if (false !== $importable_content && in_array('featured_image', $importable_content)) {
664
+					$this->set_featured_image($data, $id);
665 665
 				}
666
-				if ( false !== $importable_content && in_array( 'banner_image', $importable_content ) ) {
667
-					$this->set_banner_image( $data, $id, $importable_content );
666
+				if (false !== $importable_content && in_array('banner_image', $importable_content)) {
667
+					$this->set_banner_image($data, $id, $importable_content);
668 668
 				}
669 669
 				// Import the main gallery.
670
-				if ( false !== $importable_content && in_array( 'gallery', $importable_content ) ) {
671
-					$this->create_main_gallery( $data, $id );
670
+				if (false !== $importable_content && in_array('gallery', $importable_content)) {
671
+					$this->create_main_gallery($data, $id);
672 672
 				}
673 673
 			}
674 674
 
675 675
 			// Set the continent.
676
-			if ( false !== $importable_content && in_array( 'continent', $importable_content ) ) {
677
-				$this->set_continent( $data, $id );
676
+			if (false !== $importable_content && in_array('continent', $importable_content)) {
677
+				$this->set_continent($data, $id);
678 678
 			}
679 679
 		}
680 680
 
@@ -684,49 +684,49 @@  discard block
 block discarded – undo
684 684
 	/**
685 685
 	 * Set the team memberon each item.
686 686
 	 */
687
-	public function set_team_member( $id, $team_members ) {
688
-		delete_post_meta( $id, 'team_to_' . $this->tab_slug );
687
+	public function set_team_member($id, $team_members) {
688
+		delete_post_meta($id, 'team_to_'.$this->tab_slug);
689 689
 
690
-		foreach ( $team_members as $team ) {
691
-			add_post_meta( $id, 'team_to_' . $this->tab_slug, $team );
690
+		foreach ($team_members as $team) {
691
+			add_post_meta($id, 'team_to_'.$this->tab_slug, $team);
692 692
 		}
693 693
 	}
694 694
 
695 695
 	/**
696 696
 	 * Saves the room data
697 697
 	 */
698
-	public function set_travel_info( $data, $id, $meta_key, $importable = array( 'none' ) ) {
699
-		if ( ! empty( $data[0]['travel_information'] ) && isset( $data[0]['travel_information'][ $meta_key ] ) ) {
700
-			$content = $data[0]['travel_information'][ $meta_key ];
698
+	public function set_travel_info($data, $id, $meta_key, $importable = array('none')) {
699
+		if (!empty($data[0]['travel_information']) && isset($data[0]['travel_information'][$meta_key])) {
700
+			$content = $data[0]['travel_information'][$meta_key];
701 701
 
702
-			if ( in_array( 'strip_tags', $importable ) ) {
703
-				$content = strip_tags( $content );
702
+			if (in_array('strip_tags', $importable)) {
703
+				$content = strip_tags($content);
704 704
 			}
705 705
 
706
-			$this->save_custom_field( $content, $meta_key, $id );
706
+			$this->save_custom_field($content, $meta_key, $id);
707 707
 		}
708 708
 	}
709 709
 
710 710
 	/**
711 711
 	 * Set the Travel Style
712 712
 	 */
713
-	public function set_continent( $data, $id ) {
713
+	public function set_continent($data, $id) {
714 714
 
715
-		if ( isset( $data[0]['position']['country'] ) && $data[0]['map_object_id'] === $data[0]['position']['country_content_entity_id'] ) {
715
+		if (isset($data[0]['position']['country']) && $data[0]['map_object_id'] === $data[0]['position']['country_content_entity_id']) {
716 716
 			//get the continent code.
717
-			$continent_code = to_continent_label( to_continent_code( to_country_data( $data[0]['position']['country'], false ) ) );
717
+			$continent_code = to_continent_label(to_continent_code(to_country_data($data[0]['position']['country'], false)));
718 718
 
719
-			if ( '' !== $continent_code ) {
719
+			if ('' !== $continent_code) {
720 720
 				// @codingStandardsIgnoreLine
721
-				if ( ! $term = term_exists( trim( $continent_code ), 'continent' ) ) {
722
-					$term = wp_insert_term( trim( $continent_code ), 'continent' );
721
+				if (!$term = term_exists(trim($continent_code), 'continent')) {
722
+					$term = wp_insert_term(trim($continent_code), 'continent');
723 723
 
724
-					if ( is_wp_error( $term ) ) {
724
+					if (is_wp_error($term)) {
725 725
 						// @codingStandardsIgnoreLine
726 726
 						echo $term->get_error_message();
727 727
 					}
728
-				} else {
729
-					wp_set_object_terms( $id, sanitize_title( $continent_code ), 'continent', true );
728
+				}else {
729
+					wp_set_object_terms($id, sanitize_title($continent_code), 'continent', true);
730 730
 				}
731 731
 			}
732 732
 		}
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
 	 * Save the list of Accommodation into an option
737 737
 	 */
738 738
 	public function update_options() {
739
-		$data = file_get_contents( $this->url . '/List?' . $this->url_qs );
739
+		$data = file_get_contents($this->url.'/List?'.$this->url_qs);
740 740
 
741
-		$accommodation = json_decode( $data, true );
741
+		$accommodation = json_decode($data, true);
742 742
 
743
-		if ( isset( $accommodation['error'] ) ) {
743
+		if (isset($accommodation['error'])) {
744 744
 			return $accommodation['error'];
745
-		} elseif ( isset( $accommodation ) && ! empty( $accommodation ) ) {
746
-			set_transient( 'lsx_ti_accommodation', $accommodation,60 * 60 * 2 );
745
+		} elseif (isset($accommodation) && !empty($accommodation)) {
746
+			set_transient('lsx_ti_accommodation', $accommodation, 60 * 60 * 2);
747 747
 			return true;
748 748
 		}
749 749
 	}
@@ -752,11 +752,11 @@  discard block
 block discarded – undo
752 752
 	 * search_form
753 753
 	 */
754 754
 	public function update_options_form() {
755
-		echo '<div style="display:none;" class="wetu-status"><h3>' . esc_html__( 'Wetu Status', 'wetu-importer' ) . '</h3>';
755
+		echo '<div style="display:none;" class="wetu-status"><h3>'.esc_html__('Wetu Status', 'wetu-importer').'</h3>';
756 756
 
757
-		$accommodation = get_transient( 'lsx_ti_accommodation' );
757
+		$accommodation = get_transient('lsx_ti_accommodation');
758 758
 
759
-		if ( '' === $accommodation || false === $accommodation || isset( $_GET['refresh_accommodation'] ) ) {
759
+		if ('' === $accommodation || false === $accommodation || isset($_GET['refresh_accommodation'])) {
760 760
 			$this->update_options();
761 761
 		}
762 762
 
@@ -766,19 +766,19 @@  discard block
 block discarded – undo
766 766
 	/**
767 767
 	 * Save the list of Accommodation into an option
768 768
 	 */
769
-	public function check_for_parent( $data = array() ) {
769
+	public function check_for_parent($data = array()) {
770 770
 		global $wpdb;
771 771
 
772
-		if ( $data[0]['position']['country_content_entity_id'] !== $data[0]['position']['destination_content_entity_id'] ) {
772
+		if ($data[0]['position']['country_content_entity_id'] !== $data[0]['position']['destination_content_entity_id']) {
773 773
 			$query = "
774 774
 			SELECT post_id
775 775
 			FROM {$wpdb->postmeta}
776 776
 			WHERE meta_key = 'lsx_wetu_id'
777 777
 			AND meta_value = {$data[0]['position']['country_content_entity_id']}";
778 778
 
779
-			$result = $wpdb->get_var( $query );
779
+			$result = $wpdb->get_var($query);
780 780
 
781
-			if ( ! empty( $result ) && '' !== $result && false !== $result ) {
781
+			if (!empty($result) && '' !== $result && false !== $result) {
782 782
 				return $result;
783 783
 			}
784 784
 		}
Please login to merge, or discard this patch.