Completed
Pull Request — master (#214)
by Kiran
04:53
created
geodirectory-functions/ajax_handler_functions.php 1 patch
Indentation   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Functions that are called via ajax.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+			   * Functions that are called via ajax.
4
+			   *
5
+			   * @since 1.0.0
6
+			   * @package GeoDirectory
7
+			   */
8 8
 
9 9
 
10 10
 /**
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_on_wp_loaded()
18 18
 {
19
-    /**
20
-     * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
-     *
22
-     * @since 1.0.0
23
-     */
24
-    do_action('giodir_handle_request_plugins_loaded');
25
-    global $wpdb;
19
+	/**
20
+	 * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
+	 *
22
+	 * @since 1.0.0
23
+	 */
24
+	do_action('giodir_handle_request_plugins_loaded');
25
+	global $wpdb;
26 26
 
27 27
 
28
-    if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
-        geodir_send_inquiry($_REQUEST); // function in custom_functions.php
28
+	if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
+		geodir_send_inquiry($_REQUEST); // function in custom_functions.php
30 30
 
31
-    } elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
-        geodir_send_friend($_REQUEST); // function in custom_functions.php
31
+	} elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
+		geodir_send_friend($_REQUEST); // function in custom_functions.php
33 33
 
34
-    }
34
+	}
35 35
 
36 36
 }
37 37
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
48
-        geodir_user_signup();
49
-    }
47
+	if(geodir_is_page('login')) {
48
+		geodir_user_signup();
49
+	}
50 50
 
51 51
 }
52 52
 
@@ -59,47 +59,47 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function geodir_on_init()
61 61
 {
62
-    /**
63
-     * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
-     *
65
-     * @since 1.0.0
66
-     */
67
-    do_action('giodir_handle_request');
68
-    global $wpdb;
69
-
70
-
71
-
72
-
73
-    if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options')) {
74
-        show_admin_bar(false);
75
-    }
76
-
77
-
78
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
-        /**
80
-         * Contains map marker functions.
81
-         *
82
-         * @since 1.0.0
83
-         * @package GeoDirectory
84
-         */
85
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
-        die;
87
-    }
88
-
89
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') {
90
-        if (isset($_REQUEST['ga_start'])) {
91
-            $ga_start = $_REQUEST['ga_start'];
92
-        } else {
93
-            $ga_start = '';
94
-        }
95
-        if (isset($_REQUEST['ga_end'])) {
96
-            $ga_end = $_REQUEST['ga_end'];
97
-        } else {
98
-            $ga_end = '';
99
-        }
100
-        geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
101
-        die;
102
-    }
62
+	/**
63
+	 * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
+	 *
65
+	 * @since 1.0.0
66
+	 */
67
+	do_action('giodir_handle_request');
68
+	global $wpdb;
69
+
70
+
71
+
72
+
73
+	if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options')) {
74
+		show_admin_bar(false);
75
+	}
76
+
77
+
78
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
+		/**
80
+		 * Contains map marker functions.
81
+		 *
82
+		 * @since 1.0.0
83
+		 * @package GeoDirectory
84
+		 */
85
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
+		die;
87
+	}
88
+
89
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') {
90
+		if (isset($_REQUEST['ga_start'])) {
91
+			$ga_start = $_REQUEST['ga_start'];
92
+		} else {
93
+			$ga_start = '';
94
+		}
95
+		if (isset($_REQUEST['ga_end'])) {
96
+			$ga_end = $_REQUEST['ga_end'];
97
+		} else {
98
+			$ga_end = '';
99
+		}
100
+		geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
101
+		die;
102
+	}
103 103
 
104 104
 
105 105
 }
@@ -118,241 +118,241 @@  discard block
 block discarded – undo
118 118
  * @todo check if nonce is required here and if so add one.
119 119
  */
120 120
 function geodir_ajax_handler() {
121
-    global $wpdb, $gd_session;
121
+	global $wpdb, $gd_session;
122 122
 
123
-    if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
123
+	if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
124 124
 		$gd_session->set('gd_listing_view', $_REQUEST['gd_listing_view']);
125
-        echo '1';
126
-    }
127
-
128
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
-    }
134
-
135
-    if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
136
-        if (current_user_can('manage_options')) {
137
-            /**
138
-             * Contains admin ajax handling functions.
139
-             *
140
-             * @since 1.0.0
141
-             * @package GeoDirectory
142
-             */
143
-            include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
144
-        } else {
145
-            wp_redirect(geodir_login_url());
146
-            exit();
147
-        }
148
-    }
149
-
150
-    if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
151
-        if (current_user_can('manage_options')) {
152
-            switch ($_REQUEST['geodir_autofill']):
153
-                case "geodir_dummy_delete" :
154
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
-                        return;
156
-
157
-                    if (isset($_REQUEST['posttype']))
158
-                        /**
159
-                         * Used to delete the dummy post data per post type.
160
-                         *
161
-                         * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162
-                         *
163
-                         * @since 1.0.0
164
-                         */
165
-                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
166
-                    break;
167
-                case "geodir_dummy_insert" :
168
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
-                        return;
170
-
171
-                    global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172
-                    $dummy_post_index = $_REQUEST['insert_dummy_post_index'];
173
-                    $city_bound_lat1 = $_REQUEST['city_bound_lat1'];
174
-                    $city_bound_lng1 = $_REQUEST['city_bound_lng1'];
175
-                    $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176
-                    $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177
-
178
-                    if (isset($_REQUEST['posttype']))
179
-                        /**
180
-                         * Used to insert the dummy post data per post type.
181
-                         *
182
-                         * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183
-                         *
184
-                         * @since 1.0.0
185
-                         */
186
-                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
187
-
188
-                    break;
189
-            endswitch;
190
-        } else {
191
-            wp_redirect(geodir_login_url());
192
-            exit();
193
-        }
194
-    }
195
-
196
-    if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
197
-
198
-        if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend')
199
-            require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php');
200
-
201
-        exit;
202
-    }
203
-
204
-    /*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
125
+		echo '1';
126
+	}
127
+
128
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
+		if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
+			geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
+		else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
+			geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
+	}
134
+
135
+	if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
136
+		if (current_user_can('manage_options')) {
137
+			/**
138
+			 * Contains admin ajax handling functions.
139
+			 *
140
+			 * @since 1.0.0
141
+			 * @package GeoDirectory
142
+			 */
143
+			include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
144
+		} else {
145
+			wp_redirect(geodir_login_url());
146
+			exit();
147
+		}
148
+	}
149
+
150
+	if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
151
+		if (current_user_can('manage_options')) {
152
+			switch ($_REQUEST['geodir_autofill']):
153
+				case "geodir_dummy_delete" :
154
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
+						return;
156
+
157
+					if (isset($_REQUEST['posttype']))
158
+						/**
159
+						 * Used to delete the dummy post data per post type.
160
+						 *
161
+						 * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162
+						 *
163
+						 * @since 1.0.0
164
+						 */
165
+						do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
166
+					break;
167
+				case "geodir_dummy_insert" :
168
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
+						return;
170
+
171
+					global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172
+					$dummy_post_index = $_REQUEST['insert_dummy_post_index'];
173
+					$city_bound_lat1 = $_REQUEST['city_bound_lat1'];
174
+					$city_bound_lng1 = $_REQUEST['city_bound_lng1'];
175
+					$city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176
+					$city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177
+
178
+					if (isset($_REQUEST['posttype']))
179
+						/**
180
+						 * Used to insert the dummy post data per post type.
181
+						 *
182
+						 * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183
+						 *
184
+						 * @since 1.0.0
185
+						 */
186
+						do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
187
+
188
+					break;
189
+			endswitch;
190
+		} else {
191
+			wp_redirect(geodir_login_url());
192
+			exit();
193
+		}
194
+	}
195
+
196
+	if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
197
+
198
+		if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend')
199
+			require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php');
200
+
201
+		exit;
202
+	}
203
+
204
+	/*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
205 205
         include_once ( geodir_plugin_path() . '/geodirectory-templates/advance-search-form.php');
206 206
     }*/
207 207
 
208
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
209
-        /**
210
-         * Contains map marker functions.
211
-         *
212
-         * @since 1.0.0
213
-         * @package GeoDirectory
214
-         */
215
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
216
-    }
217
-
218
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
219
-        if (is_user_logged_in()) {
220
-            switch ($_REQUEST['ajax_action']):
221
-                case "add" :
222
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
223
-                    break;
224
-                case "remove" :
225
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
226
-                    break;
227
-            endswitch;
228
-        } else {
229
-            wp_redirect(geodir_login_url());
230
-            exit();
231
-        }
232
-    }
233
-
234
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
235
-
236
-        $is_current_user_owner = true;
237
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
238
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
239
-        }
240
-
241
-        $request = $gd_session->get('listing');
242
-
243
-        if (is_user_logged_in() && $is_current_user_owner) {
244
-
245
-            switch ($_REQUEST['ajax_action']):
246
-                case "add":
247
-                case "update":
248
-
249
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
250
-                        $last_id = geodir_save_listing();
251
-
252
-                        if ($last_id) {
253
-                            //$redirect_to = get_permalink( $last_id );
254
-                            $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
255
-
256
-                        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
257
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
258
-                            $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
259
-                        } else
260
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
261
-
262
-                        wp_redirect($redirect_to);
263
-                    } else {
264
-                        $gd_session->un_set('listing');
265
-                        wp_redirect(home_url());
266
-                    }
267
-
268
-                    break;
269
-                case "cancel" :
270
-
271
-                    $gd_session->un_set('listing');
272
-
273
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
274
-                        wp_redirect(get_permalink($_REQUEST['pid']));
275
-                    else {
276
-                        geodir_remove_temp_images();
277
-                        wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
278
-                    }
279
-
280
-                    break;
281
-
282
-                case "publish" :
283
-
284
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
285
-
286
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
287
-                            $new_post = array();
288
-                            $new_post['ID'] = $_REQUEST['pid'];
289
-
290
-                            $lastid = wp_update_post($new_post);
291
-
292
-                            $gd_session->un_set('listing');
293
-                            wp_redirect(get_permalink($lastid));
294
-                        } else {
295
-                            $last_id = geodir_save_listing();
296
-
297
-                            if ($last_id) {
298
-                                //$redirect_to = get_permalink( $last_id );
299
-                                $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
300
-                            } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
301
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
302
-                                $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
303
-                            } else
304
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
305
-
306
-                            $gd_session->un_set('listing');
307
-                            wp_redirect($redirect_to);
308
-                        }
309
-                    } else {
310
-                        $gd_session->un_set('listing');
311
-                        wp_redirect(home_url());
312
-                    }
313
-
314
-                    break;
315
-                case "delete" :
316
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
317
-                        global $current_user;
318
-                        get_currentuserinfo();
319
-
320
-                        if (get_option('geodir_disable_perm_delete')) {
321
-                            $lastid = wp_trash_post($_REQUEST['pid']);
322
-                        } else {
323
-                            $lastid = wp_delete_post($_REQUEST['pid']);
324
-                        }
325
-
326
-                        if ($lastid && !is_wp_error($lastid))
327
-                            wp_redirect($_SERVER['HTTP_REFERER']);
328
-
329
-                        //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
330
-                    }
331
-                    break;
332
-            endswitch;
333
-
334
-            $gd_session->un_set('listing');
335
-        } else {
336
-            $gd_session->un_set('listing');
337
-            wp_redirect(geodir_login_url());
338
-            exit();
339
-        }
340
-    }
341
-
342
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
343
-        /**
344
-         * Contains registration and login functions.
345
-         * @todo Fix the file path.
346
-         *
347
-         * @since 1.0.0
348
-         * @package GeoDirectory
349
-         */
350
-        include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
351
-    }
352
-
353
-
354
-    if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
355
-        $terms_o = get_terms(sanitize_text_field($_REQUEST['term']));
208
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
209
+		/**
210
+		 * Contains map marker functions.
211
+		 *
212
+		 * @since 1.0.0
213
+		 * @package GeoDirectory
214
+		 */
215
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
216
+	}
217
+
218
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
219
+		if (is_user_logged_in()) {
220
+			switch ($_REQUEST['ajax_action']):
221
+				case "add" :
222
+					geodir_add_to_favorite((int)$_REQUEST['pid']);
223
+					break;
224
+				case "remove" :
225
+					geodir_remove_from_favorite((int)$_REQUEST['pid']);
226
+					break;
227
+			endswitch;
228
+		} else {
229
+			wp_redirect(geodir_login_url());
230
+			exit();
231
+		}
232
+	}
233
+
234
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
235
+
236
+		$is_current_user_owner = true;
237
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
238
+			$is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
239
+		}
240
+
241
+		$request = $gd_session->get('listing');
242
+
243
+		if (is_user_logged_in() && $is_current_user_owner) {
244
+
245
+			switch ($_REQUEST['ajax_action']):
246
+				case "add":
247
+				case "update":
248
+
249
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
250
+						$last_id = geodir_save_listing();
251
+
252
+						if ($last_id) {
253
+							//$redirect_to = get_permalink( $last_id );
254
+							$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
255
+
256
+						} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
257
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
258
+							$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
259
+						} else
260
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
261
+
262
+						wp_redirect($redirect_to);
263
+					} else {
264
+						$gd_session->un_set('listing');
265
+						wp_redirect(home_url());
266
+					}
267
+
268
+					break;
269
+				case "cancel" :
270
+
271
+					$gd_session->un_set('listing');
272
+
273
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
274
+						wp_redirect(get_permalink($_REQUEST['pid']));
275
+					else {
276
+						geodir_remove_temp_images();
277
+						wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
278
+					}
279
+
280
+					break;
281
+
282
+				case "publish" :
283
+
284
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
285
+
286
+						if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
287
+							$new_post = array();
288
+							$new_post['ID'] = $_REQUEST['pid'];
289
+
290
+							$lastid = wp_update_post($new_post);
291
+
292
+							$gd_session->un_set('listing');
293
+							wp_redirect(get_permalink($lastid));
294
+						} else {
295
+							$last_id = geodir_save_listing();
296
+
297
+							if ($last_id) {
298
+								//$redirect_to = get_permalink( $last_id );
299
+								$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
300
+							} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
301
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
302
+								$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
303
+							} else
304
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
305
+
306
+							$gd_session->un_set('listing');
307
+							wp_redirect($redirect_to);
308
+						}
309
+					} else {
310
+						$gd_session->un_set('listing');
311
+						wp_redirect(home_url());
312
+					}
313
+
314
+					break;
315
+				case "delete" :
316
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
317
+						global $current_user;
318
+						get_currentuserinfo();
319
+
320
+						if (get_option('geodir_disable_perm_delete')) {
321
+							$lastid = wp_trash_post($_REQUEST['pid']);
322
+						} else {
323
+							$lastid = wp_delete_post($_REQUEST['pid']);
324
+						}
325
+
326
+						if ($lastid && !is_wp_error($lastid))
327
+							wp_redirect($_SERVER['HTTP_REFERER']);
328
+
329
+						//wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
330
+					}
331
+					break;
332
+			endswitch;
333
+
334
+			$gd_session->un_set('listing');
335
+		} else {
336
+			$gd_session->un_set('listing');
337
+			wp_redirect(geodir_login_url());
338
+			exit();
339
+		}
340
+	}
341
+
342
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
343
+		/**
344
+		 * Contains registration and login functions.
345
+		 * @todo Fix the file path.
346
+		 *
347
+		 * @since 1.0.0
348
+		 * @package GeoDirectory
349
+		 */
350
+		include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
351
+	}
352
+
353
+
354
+	if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
355
+		$terms_o = get_terms(sanitize_text_field($_REQUEST['term']));
356 356
 		
357 357
 		// Skip terms which has no listing
358 358
 		if (!empty($terms_o)) {
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
 			$terms_o = $filter_terms;
367 367
 		}
368 368
 		
369
-        $terms = geodir_sort_terms($terms_o, 'count');
370
-        geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
371
-        exit();
369
+		$terms = geodir_sort_terms($terms_o, 'count');
370
+		geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
371
+		exit();
372 372
 
373
-    }
373
+	}
374 374
     
375
-    die;
375
+	die;
376 376
 }
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 3 patches
Indentation   +2632 added lines, -2632 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 function geodir_deactivation()
16 16
 {
17 17
 
18
-    // Update installed variable
19
-    update_option("geodir_installed", 0);
18
+	// Update installed variable
19
+	update_option("geodir_installed", 0);
20 20
 
21
-    // Remove rewrite rules and then recreate rewrite rules.
22
-    flush_rewrite_rules();
21
+	// Remove rewrite rules and then recreate rewrite rules.
22
+	flush_rewrite_rules();
23 23
 }
24 24
 
25 25
 
@@ -32,105 +32,105 @@  discard block
 block discarded – undo
32 32
 function geodir_uninstall()
33 33
 {
34 34
 
35
-    delete_option('geodir_default_data_installed');
35
+	delete_option('geodir_default_data_installed');
36 36
 
37 37
 }
38 38
 
39 39
 if (!function_exists('geodir_admin_styles')) {
40
-    /**
41
-     * Enqueue Admin Styles.
42
-     *
43
-     * @since 1.0.0
44
-     * @package GeoDirectory
45
-     */
46
-    function geodir_admin_styles()
47
-    {
40
+	/**
41
+	 * Enqueue Admin Styles.
42
+	 *
43
+	 * @since 1.0.0
44
+	 * @package GeoDirectory
45
+	 */
46
+	function geodir_admin_styles()
47
+	{
48 48
 
49
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
-        wp_enqueue_style('geodirectory-admin-css');
49
+		wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
+		wp_enqueue_style('geodirectory-admin-css');
51 51
 
52
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
-        wp_enqueue_style('geodirectory-frontend-style');
52
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
+		wp_enqueue_style('geodirectory-frontend-style');
54 54
 
55
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
-        wp_enqueue_style('geodir-chosen-style');
55
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
+		wp_enqueue_style('geodir-chosen-style');
57 57
 
58
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
58
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
60 60
 
61
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
-        wp_enqueue_style('geodirectory-jquery-ui-css');
61
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
+		wp_enqueue_style('geodirectory-jquery-ui-css');
63 63
 
64
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
-        wp_enqueue_style('geodirectory-custom-fields-css');
64
+		wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
+		wp_enqueue_style('geodirectory-custom-fields-css');
66 66
 
67
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
-        wp_enqueue_style('geodirectory-pluplodar-css');
67
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
+		wp_enqueue_style('geodirectory-pluplodar-css');
69 69
 
70
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
-        wp_enqueue_style('geodir-rating-style');
70
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
+		wp_enqueue_style('geodir-rating-style');
72 72
 
73
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
-        wp_enqueue_style('geodir-rtl-style');
73
+		wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
+		wp_enqueue_style('geodir-rtl-style');
75 75
 
76
-    }
76
+	}
77 77
 }
78 78
 
79 79
 if (!function_exists('geodir_admin_styles_req')) {
80
-    /**
81
-     * Loads stylesheets from CDN.
82
-     *
83
-     * @since 1.0.0
84
-     * @package GeoDirectory
85
-     */
86
-    function geodir_admin_styles_req()
87
-    {
80
+	/**
81
+	 * Loads stylesheets from CDN.
82
+	 *
83
+	 * @since 1.0.0
84
+	 * @package GeoDirectory
85
+	 */
86
+	function geodir_admin_styles_req()
87
+	{
88 88
 
89
-        wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
-        wp_enqueue_style('geodirectory-font-awesome');
89
+		wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
+		wp_enqueue_style('geodirectory-font-awesome');
91 91
 
92
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93
-        wp_enqueue_script('geodirectory-admin');
92
+		wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93
+		wp_enqueue_script('geodirectory-admin');
94 94
 
95
-    }
95
+	}
96 96
 }
97 97
 
98 98
 if (!function_exists('geodir_admin_scripts')) {
99
-    /**
100
-     * Enqueue Admin Scripts.
101
-     *
102
-     * @since 1.0.0
103
-     * @package GeoDirectory
104
-     */
105
-    function geodir_admin_scripts()
106
-    {
99
+	/**
100
+	 * Enqueue Admin Scripts.
101
+	 *
102
+	 * @since 1.0.0
103
+	 * @package GeoDirectory
104
+	 */
105
+	function geodir_admin_scripts()
106
+	{
107 107
 
108
-        wp_enqueue_script('jquery');
108
+		wp_enqueue_script('jquery');
109 109
 
110
-        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
110
+		wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
111 111
 
112
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
113
-        wp_enqueue_script('chosen');
112
+		wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
113
+		wp_enqueue_script('chosen');
114 114
 
115
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
-        wp_enqueue_script('geodirectory-choose-ajax');
115
+		wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
+		wp_enqueue_script('geodirectory-choose-ajax');
117 117
 
118
-        if (isset($_REQUEST['listing_type'])) {
119
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
-        }
118
+		if (isset($_REQUEST['listing_type'])) {
119
+			wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
+		}
121 121
 
122
-        wp_enqueue_script('geodirectory-custom-fields-script');
123
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
122
+		wp_enqueue_script('geodirectory-custom-fields-script');
123
+		$plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
124 124
 
125
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
125
+		wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
126 126
 
127
-        $map_lang = "&language=" . geodir_get_map_default_language();
128
-        /** This filter is documented in geodirectory_template_tags.php */
129
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
130
-        wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
127
+		$map_lang = "&language=" . geodir_get_map_default_language();
128
+		/** This filter is documented in geodirectory_template_tags.php */
129
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
130
+		wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
131 131
 
132
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133
-        wp_enqueue_script('geodirectory-goMap-script');
132
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133
+		wp_enqueue_script('geodirectory-goMap-script');
134 134
 
135 135
 		// font awesome rating script
136 136
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
@@ -141,177 +141,177 @@  discard block
 block discarded – undo
141 141
 			wp_enqueue_script('geodir-jRating-js');
142 142
 		}
143 143
 
144
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145
-        wp_enqueue_script('geodir-on-document-load');
146
-
147
-
148
-        // SCRIPT FOR UPLOAD
149
-        wp_enqueue_script('plupload-all');
150
-        wp_enqueue_script('jquery-ui-sortable');
151
-
152
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
153
-        wp_enqueue_script('geodirectory-plupload-script');
154
-
155
-        // SCRIPT FOR UPLOAD END
156
-
157
-
158
-        // place js config array for plupload
159
-        $plupload_init = array(
160
-            'runtimes' => 'html5,silverlight,flash,html4',
161
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
162
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
163
-            'drop_element' => 'dropbox', // will be adjusted per uploader
164
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
165
-            'multiple_queues' => true,
166
-            'max_file_size' => geodir_max_upload_size(),
167
-            'url' => admin_url('admin-ajax.php'),
168
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
169
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
170
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
171
-            'multipart' => true,
172
-            'urlstream_upload' => true,
173
-            'multi_selection' => false, // will be added per uploader
174
-            // additional post data to send to our ajax hook
175
-            'multipart_params' => array(
176
-                '_ajax_nonce' => "", // will be added per uploader
177
-                'action' => 'plupload_action', // the ajax action name
178
-                'imgid' => 0 // will be added per uploader
179
-            )
180
-        );
181
-        $base_plupload_config = json_encode($plupload_init);
182
-
183
-
184
-        $thumb_img_arr = array();
185
-
186
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
-
189
-        $totImg = '';
190
-        $image_limit = '';
191
-        if (!empty($thumb_img_arr)) {
192
-            foreach ($thumb_img_arr as $img) {
193
-                $curImages = $img->src . ",";
194
-            }
144
+		wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145
+		wp_enqueue_script('geodir-on-document-load');
146
+
147
+
148
+		// SCRIPT FOR UPLOAD
149
+		wp_enqueue_script('plupload-all');
150
+		wp_enqueue_script('jquery-ui-sortable');
151
+
152
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
153
+		wp_enqueue_script('geodirectory-plupload-script');
154
+
155
+		// SCRIPT FOR UPLOAD END
156
+
157
+
158
+		// place js config array for plupload
159
+		$plupload_init = array(
160
+			'runtimes' => 'html5,silverlight,flash,html4',
161
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
162
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
163
+			'drop_element' => 'dropbox', // will be adjusted per uploader
164
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
165
+			'multiple_queues' => true,
166
+			'max_file_size' => geodir_max_upload_size(),
167
+			'url' => admin_url('admin-ajax.php'),
168
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
169
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
170
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
171
+			'multipart' => true,
172
+			'urlstream_upload' => true,
173
+			'multi_selection' => false, // will be added per uploader
174
+			// additional post data to send to our ajax hook
175
+			'multipart_params' => array(
176
+				'_ajax_nonce' => "", // will be added per uploader
177
+				'action' => 'plupload_action', // the ajax action name
178
+				'imgid' => 0 // will be added per uploader
179
+			)
180
+		);
181
+		$base_plupload_config = json_encode($plupload_init);
182
+
183
+
184
+		$thumb_img_arr = array();
185
+
186
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
+
189
+		$totImg = '';
190
+		$image_limit = '';
191
+		if (!empty($thumb_img_arr)) {
192
+			foreach ($thumb_img_arr as $img) {
193
+				$curImages = $img->src . ",";
194
+			}
195 195
 
196
-            $totImg = count($thumb_img_arr);
197
-        }
196
+			$totImg = count($thumb_img_arr);
197
+		}
198 198
 
199 199
 
200
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
201
-            'totalImg' => $totImg,
202
-            'image_limit' => $image_limit,
203
-            'upload_img_size' => geodir_max_upload_size());
200
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
201
+			'totalImg' => $totImg,
202
+			'image_limit' => $image_limit,
203
+			'upload_img_size' => geodir_max_upload_size());
204 204
 
205
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
205
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
206 206
 
207
-        $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
208
-        wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
207
+		$ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
208
+		wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
209 209
 
210 210
 
211
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
212
-        wp_enqueue_script('geodirectory-admin-script');
211
+		wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
212
+		wp_enqueue_script('geodirectory-admin-script');
213 213
 
214
-        wp_enqueue_style('farbtastic');
215
-        wp_enqueue_script('farbtastic');
214
+		wp_enqueue_style('farbtastic');
215
+		wp_enqueue_script('farbtastic');
216 216
 
217
-        $screen = get_current_screen();
218
-        if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
219
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
220
-        }
217
+		$screen = get_current_screen();
218
+		if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
219
+			wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
220
+		}
221 221
 
222
-        $ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
223
-        wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
222
+		$ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
223
+		wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
224 224
 
225
-    }
225
+	}
226 226
 }
227 227
 
228 228
 if (!function_exists('geodir_admin_menu')) {
229
-    /**
230
-     * Admin Menus
231
-     *
232
-     * Sets up the admin menus in wordpress.
233
-     *
234
-     * @since 1.0.0
235
-     * @package GeoDirectory
236
-     * @global array $menu Menu array.
237
-     * @global object $geodirectory GeoDirectory plugin object.
238
-     */
239
-    function geodir_admin_menu()
240
-    {
241
-        global $menu, $geodirectory;
229
+	/**
230
+	 * Admin Menus
231
+	 *
232
+	 * Sets up the admin menus in wordpress.
233
+	 *
234
+	 * @since 1.0.0
235
+	 * @package GeoDirectory
236
+	 * @global array $menu Menu array.
237
+	 * @global object $geodirectory GeoDirectory plugin object.
238
+	 */
239
+	function geodir_admin_menu()
240
+	{
241
+		global $menu, $geodirectory;
242 242
 
243
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
243
+		if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
244 244
 
245
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
245
+		add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
246 246
 
247 247
 
248
-    }
248
+	}
249 249
 }
250 250
 
251 251
 if (!function_exists('geodir_admin_menu_order')) {
252
-    /**
253
-     * Order admin menus.
254
-     *
255
-     * @since 1.0.0
256
-     * @package GeoDirectory
257
-     * @param array $menu_order Menu order array.
258
-     * @return array Modified menu order array.
259
-     */
260
-    function geodir_admin_menu_order($menu_order)
261
-    {
262
-
263
-        // Initialize our custom order array
264
-        $geodir_menu_order = array();
265
-
266
-        // Get the index of our custom separator
267
-        $geodir_separator = array_search('separator-geodirectory', $menu_order);
268
-
269
-        // Get index of posttype menu
270
-        $post_types = geodir_get_posttypes();
271
-        if (!empty($post_types)) {
272
-            foreach ($post_types as $post_type) {
273
-                $geodir_posts = array_search("edit.php?post_type={$post_type}", $menu_order);
274
-            }
275
-        }
252
+	/**
253
+	 * Order admin menus.
254
+	 *
255
+	 * @since 1.0.0
256
+	 * @package GeoDirectory
257
+	 * @param array $menu_order Menu order array.
258
+	 * @return array Modified menu order array.
259
+	 */
260
+	function geodir_admin_menu_order($menu_order)
261
+	{
276 262
 
277
-        // Loop through menu order and do some rearranging
278
-        foreach ($menu_order as $index => $item) :
263
+		// Initialize our custom order array
264
+		$geodir_menu_order = array();
279 265
 
280
-            if ((('geodirectory') == $item)) :
281
-                $geodir_menu_order[] = 'separator-geodirectory';
282
-                if (!empty($post_types)) {
283
-                    foreach ($post_types as $post_type) {
284
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
285
-                    }
286
-                }
287
-                $geodir_menu_order[] = $item;
266
+		// Get the index of our custom separator
267
+		$geodir_separator = array_search('separator-geodirectory', $menu_order);
288 268
 
289
-                unset($menu_order[$geodir_separator]);
290
-            //unset( $menu_order[$geodir_places] );
291
-            elseif (!in_array($item, array('separator-geodirectory'))) :
292
-                $geodir_menu_order[] = $item;
293
-            endif;
269
+		// Get index of posttype menu
270
+		$post_types = geodir_get_posttypes();
271
+		if (!empty($post_types)) {
272
+			foreach ($post_types as $post_type) {
273
+				$geodir_posts = array_search("edit.php?post_type={$post_type}", $menu_order);
274
+			}
275
+		}
294 276
 
295
-        endforeach;
277
+		// Loop through menu order and do some rearranging
278
+		foreach ($menu_order as $index => $item) :
296 279
 
297
-        // Return order
298
-        return $geodir_menu_order;
299
-    }
280
+			if ((('geodirectory') == $item)) :
281
+				$geodir_menu_order[] = 'separator-geodirectory';
282
+				if (!empty($post_types)) {
283
+					foreach ($post_types as $post_type) {
284
+						$geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
285
+					}
286
+				}
287
+				$geodir_menu_order[] = $item;
288
+
289
+				unset($menu_order[$geodir_separator]);
290
+			//unset( $menu_order[$geodir_places] );
291
+			elseif (!in_array($item, array('separator-geodirectory'))) :
292
+				$geodir_menu_order[] = $item;
293
+			endif;
294
+
295
+		endforeach;
296
+
297
+		// Return order
298
+		return $geodir_menu_order;
299
+	}
300 300
 }
301 301
 
302 302
 if (!function_exists('geodir_admin_custom_menu_order')) {
303
-    /**
304
-     * Enables custom menu order.
305
-     *
306
-     * @since 1.0.0
307
-     * @package GeoDirectory
308
-     * @return bool
309
-     */
310
-    function geodir_admin_custom_menu_order()
311
-    {
312
-        if (!current_user_can('manage_options')) return false;
313
-        return true;
314
-    }
303
+	/**
304
+	 * Enables custom menu order.
305
+	 *
306
+	 * @since 1.0.0
307
+	 * @package GeoDirectory
308
+	 * @return bool
309
+	 */
310
+	function geodir_admin_custom_menu_order()
311
+	{
312
+		if (!current_user_can('manage_options')) return false;
313
+		return true;
314
+	}
315 315
 }
316 316
 
317 317
 /**
@@ -322,41 +322,41 @@  discard block
 block discarded – undo
322 322
  */
323 323
 function geodir_before_admin_panel()
324 324
 {
325
-    if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326
-        echo '<div id="message" class="updated fade">
325
+	if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326
+		echo '<div id="message" class="updated fade">
327 327
                         <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
328 328
                         <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
329 329
                 </div>';
330 330
 
331
-    }
331
+	}
332 332
 
333
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334
-        switch ($_REQUEST['msg']) {
335
-            case 'success':
336
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
337
-                flush_rewrite_rules(false);
333
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334
+		switch ($_REQUEST['msg']) {
335
+			case 'success':
336
+				echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
337
+				flush_rewrite_rules(false);
338 338
 
339
-                break;
339
+				break;
340 340
 			case 'fail':
341 341
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
342 342
 				
343 343
 				if ($gderr == 21)
344
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
344
+					echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
345 345
 				else
346 346
 					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
347
-                break;
348
-        }
349
-    }
347
+				break;
348
+		}
349
+	}
350 350
 
351
-    if (!geodir_is_default_location_set()) {
352
-        echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
351
+	if (!geodir_is_default_location_set()) {
352
+		echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
353 353
 
354
-    }
354
+	}
355 355
 
356
-    if (!function_exists('curl_init')) {
357
-        echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
356
+	if (!function_exists('curl_init')) {
357
+		echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
358 358
 
359
-    }
359
+	}
360 360
 }
361 361
 
362 362
 /**
@@ -369,19 +369,19 @@  discard block
 block discarded – undo
369 369
  */
370 370
 function geodir_handle_option_form_submit($current_tab)
371 371
 {
372
-    global $geodir_settings;
373
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
374
-        /**
375
-         * Contains settings array for current tab.
376
-         *
377
-         * @since 1.0.0
378
-         * @package GeoDirectory
379
-         */
380
-        include_once('option-pages/' . $current_tab . '_array.php');
381
-    }
382
-    if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
383
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
372
+	global $geodir_settings;
373
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
374
+		/**
375
+		 * Contains settings array for current tab.
376
+		 *
377
+		 * @since 1.0.0
378
+		 * @package GeoDirectory
379
+		 */
380
+		include_once('option-pages/' . $current_tab . '_array.php');
381
+	}
382
+	if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
383
+		if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384
+		if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
385 385
 		
386 386
 		/**
387 387
 		 * Fires before updating geodirectory admin settings.
@@ -393,100 +393,100 @@  discard block
 block discarded – undo
393 393
 		 */
394 394
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
395 395
 		
396
-        if (!empty($geodir_settings[$current_tab]))
397
-            geodir_update_options($geodir_settings[$current_tab]);
396
+		if (!empty($geodir_settings[$current_tab]))
397
+			geodir_update_options($geodir_settings[$current_tab]);
398 398
 
399
-        /**
400
-         * Called after GeoDirectory options settings are updated.
401
-         *
402
-         * @since 1.0.0
403
-         * @param array $geodir_settings The array of GeoDirectory settings.
404
-         * @see 'geodir_before_update_options'
405
-         */
406
-        do_action('geodir_update_options', $geodir_settings);
399
+		/**
400
+		 * Called after GeoDirectory options settings are updated.
401
+		 *
402
+		 * @since 1.0.0
403
+		 * @param array $geodir_settings The array of GeoDirectory settings.
404
+		 * @see 'geodir_before_update_options'
405
+		 */
406
+		do_action('geodir_update_options', $geodir_settings);
407 407
 
408
-        /**
409
-         * Called after GeoDirectory options settings are updated.
410
-         *
411
-         * Provides tab specific settings.
412
-         *
413
-         * @since 1.0.0
414
-         * @param string $current_tab The current settings tab name.
415
-         * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
416
-         */
417
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
408
+		/**
409
+		 * Called after GeoDirectory options settings are updated.
410
+		 *
411
+		 * Provides tab specific settings.
412
+		 *
413
+		 * @since 1.0.0
414
+		 * @param string $current_tab The current settings tab name.
415
+		 * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
416
+		 */
417
+		do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
418 418
 
419
-        flush_rewrite_rules(false);
419
+		flush_rewrite_rules(false);
420 420
 
421
-        $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
421
+		$current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
422 422
 
423
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
423
+		$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
424 424
 
425
-        wp_redirect($redirect_url);
426
-        exit();
427
-    endif;
425
+		wp_redirect($redirect_url);
426
+		exit();
427
+	endif;
428 428
 
429 429
 
430 430
 }
431 431
 
432 432
 
433 433
 if (!function_exists('geodir_autoinstall_admin_header') && get_option('geodir_installed')) {
434
-    /**
435
-     * GeoDirectory dummy data installation.
436
-     *
437
-     * @since 1.0.0
438
-     * @package GeoDirectory
439
-     * @global object $wpdb WordPress Database object.
440
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
441
-     * @param string $post_type The post type.
442
-     */
443
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
444
-    {
434
+	/**
435
+	 * GeoDirectory dummy data installation.
436
+	 *
437
+	 * @since 1.0.0
438
+	 * @package GeoDirectory
439
+	 * @global object $wpdb WordPress Database object.
440
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
441
+	 * @param string $post_type The post type.
442
+	 */
443
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
444
+	{
445 445
 
446
-        global $wpdb, $plugin_prefix;
446
+		global $wpdb, $plugin_prefix;
447 447
 
448
-        if (!geodir_is_default_location_set()) {
449
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
450
-        } else {
448
+		if (!geodir_is_default_location_set()) {
449
+			echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
450
+		} else {
451 451
 
452
-            $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
452
+			$geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
453 453
 
454
-            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
454
+			$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
455 455
 
456
-            if ($post_counts > 0) {
457
-                $nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
456
+			if ($post_counts > 0) {
457
+				$nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
458 458
 
459
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
460
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
461
-            } else {
462
-                $options_list = '';
463
-                for ($option = 1; $option <= 30; $option++) {
464
-                    $selected = '';
465
-                    if ($option == 10)
466
-                        $selected = 'selected="selected"';
459
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
460
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
461
+			} else {
462
+				$options_list = '';
463
+				for ($option = 1; $option <= 30; $option++) {
464
+					$selected = '';
465
+					if ($option == 10)
466
+						$selected = 'selected="selected"';
467 467
 
468
-                    $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
469
-                }
468
+					$options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
469
+				}
470 470
 
471
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
471
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
472 472
 
473
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
474
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
473
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
474
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
475 475
 
476
-            }
477
-            echo $dummy_msg;
478
-            ?>
476
+			}
477
+			echo $dummy_msg;
478
+			?>
479 479
             <script>
480 480
                 <?php
481 481
 
482
-                    $default_location = geodir_get_default_location();
483
-                  $city =  isset($default_location->city) ? $default_location->city : '';
484
-                  $region =isset($default_location->region) ? $default_location->region : '';
485
-                  $country =isset($default_location->country) ? $default_location->country : '';
486
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
482
+					$default_location = geodir_get_default_location();
483
+				  $city =  isset($default_location->city) ? $default_location->city : '';
484
+				  $region =isset($default_location->region) ? $default_location->region : '';
485
+				  $country =isset($default_location->country) ? $default_location->country : '';
486
+				  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
+				  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
488 488
 
489
-                ?>
489
+				?>
490 490
                 var geocoder = new google.maps.Geocoder();
491 491
                 var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
492 492
                 var bound_lat_lng;
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
                 }
572 572
             </script>
573 573
         <?php
574
-        }
575
-    }
574
+		}
575
+	}
576 576
 }
577 577
 
578 578
 /**
@@ -585,19 +585,19 @@  discard block
 block discarded – undo
585 585
  */
586 586
 function geodir_insert_dummy_posts()
587 587
 {
588
-    geodir_default_taxonomies();
588
+	geodir_default_taxonomies();
589 589
 
590
-    ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
590
+	ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
591 591
 
592
-    global $wpdb, $current_user;
592
+	global $wpdb, $current_user;
593 593
 
594
-    /**
595
-     * Contains dumy post content.
596
-     *
597
-     * @since 1.0.0
598
-     * @package GeoDirectory
599
-     */
600
-    include_once('place_dummy_post.php');
594
+	/**
595
+	 * Contains dumy post content.
596
+	 *
597
+	 * @since 1.0.0
598
+	 * @package GeoDirectory
599
+	 */
600
+	include_once('place_dummy_post.php');
601 601
 
602 602
 }
603 603
 
@@ -611,18 +611,18 @@  discard block
 block discarded – undo
611 611
  */
612 612
 function geodir_delete_dummy_posts()
613 613
 {
614
-    global $wpdb, $plugin_prefix;
614
+	global $wpdb, $plugin_prefix;
615 615
 
616 616
 
617
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
617
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
618 618
 
619 619
 
620
-    foreach ($post_ids as $post_ids_obj) {
621
-        wp_delete_post($post_ids_obj->post_id);
622
-    }
620
+	foreach ($post_ids as $post_ids_obj) {
621
+		wp_delete_post($post_ids_obj->post_id);
622
+	}
623 623
 
624
-    //double check posts are deleted
625
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
624
+	//double check posts are deleted
625
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
626 626
 }
627 627
 
628 628
 /**
@@ -636,110 +636,110 @@  discard block
 block discarded – undo
636 636
  * @global string $dummy_image_path The dummy image path.
637 637
  */
638 638
 function geodir_default_taxonomies() {
639
-    global $wpdb, $dummy_image_path;
639
+	global $wpdb, $dummy_image_path;
640 640
 
641
-    $category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
641
+	$category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
642 642
 
643
-    $last_catid = isset($last_catid) ? $last_catid : '';
643
+	$last_catid = isset($last_catid) ? $last_catid : '';
644 644
 
645
-    $last_term = get_term($last_catid, 'gd_placecategory');
645
+	$last_term = get_term($last_catid, 'gd_placecategory');
646 646
 
647
-    $uploads = wp_upload_dir(); // Array of key => value pairs
647
+	$uploads = wp_upload_dir(); // Array of key => value pairs
648 648
 
649
-    for ($i = 0; $i < count($category_array); $i++) {
650
-        $parent_catid = 0;
651
-        if (is_array($category_array[$i])) {
652
-            $cat_name_arr = $category_array[$i];
653
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
654
-                $catname = $cat_name_arr[$j];
649
+	for ($i = 0; $i < count($category_array); $i++) {
650
+		$parent_catid = 0;
651
+		if (is_array($category_array[$i])) {
652
+			$cat_name_arr = $category_array[$i];
653
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
654
+				$catname = $cat_name_arr[$j];
655 655
 
656
-                if (!term_exists($catname, 'gd_placecategory')) {
657
-                    $last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
656
+				if (!term_exists($catname, 'gd_placecategory')) {
657
+					$last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
658 658
 
659
-                    if ($j == 0) {
660
-                        $parent_catid = $last_catid;
661
-                    }
659
+					if ($j == 0) {
660
+						$parent_catid = $last_catid;
661
+					}
662 662
 
663 663
 
664
-                    if (geodir_dummy_folder_exists())
665
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
666
-                    else
667
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
668
-                    $catname = str_replace(' ', '_', $catname);
669
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
664
+					if (geodir_dummy_folder_exists())
665
+						$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
666
+					else
667
+						$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
668
+					$catname = str_replace(' ', '_', $catname);
669
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
670 670
 
671
-                    if (empty($uploaded['error'])) {
672
-                        $new_path = $uploaded['file'];
673
-                        $new_url = $uploaded['url'];
674
-                    }
671
+					if (empty($uploaded['error'])) {
672
+						$new_path = $uploaded['file'];
673
+						$new_url = $uploaded['url'];
674
+					}
675 675
 
676
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
677
-
678
-                    $attachment = array(
679
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
680
-                        'post_mime_type' => $wp_filetype['type'],
681
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
682
-                        'post_content' => '',
683
-                        'post_status' => 'inherit'
684
-                    );
685
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
686
-
687
-                    // you must first include the image.php file
688
-                    // for the function wp_generate_attachment_metadata() to work
689
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
690
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
691
-                    wp_update_attachment_metadata($attach_id, $attach_data);
692
-
693
-                    if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
694
-                        update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
695
-                    }
696
-                }
697
-            }
676
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
677
+
678
+					$attachment = array(
679
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
680
+						'post_mime_type' => $wp_filetype['type'],
681
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
682
+						'post_content' => '',
683
+						'post_status' => 'inherit'
684
+					);
685
+					$attach_id = wp_insert_attachment($attachment, $new_path);
686
+
687
+					// you must first include the image.php file
688
+					// for the function wp_generate_attachment_metadata() to work
689
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
690
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
691
+					wp_update_attachment_metadata($attach_id, $attach_data);
692
+
693
+					if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
694
+						update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
695
+					}
696
+				}
697
+			}
698 698
 
699
-        } else {
700
-            $catname = $category_array[$i];
699
+		} else {
700
+			$catname = $category_array[$i];
701 701
 
702
-            if (!term_exists($catname, 'gd_placecategory')) {
703
-                $last_catid = wp_insert_term($catname, 'gd_placecategory');
702
+			if (!term_exists($catname, 'gd_placecategory')) {
703
+				$last_catid = wp_insert_term($catname, 'gd_placecategory');
704 704
 
705
-                if (geodir_dummy_folder_exists())
706
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
707
-                else
708
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
709
-                $catname = str_replace(' ', '_', $catname);
710
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
705
+				if (geodir_dummy_folder_exists())
706
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
707
+				else
708
+					$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
709
+				$catname = str_replace(' ', '_', $catname);
710
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
711 711
 
712
-                if (empty($uploaded['error'])) {
713
-                    $new_path = $uploaded['file'];
714
-                    $new_url = $uploaded['url'];
715
-                }
712
+				if (empty($uploaded['error'])) {
713
+					$new_path = $uploaded['file'];
714
+					$new_url = $uploaded['url'];
715
+				}
716 716
 
717
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
717
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
718 718
 
719
-                $attachment = array(
720
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
721
-                    'post_mime_type' => $wp_filetype['type'],
722
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
723
-                    'post_content' => '',
724
-                    'post_status' => 'inherit'
725
-                );
719
+				$attachment = array(
720
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
721
+					'post_mime_type' => $wp_filetype['type'],
722
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
723
+					'post_content' => '',
724
+					'post_status' => 'inherit'
725
+				);
726 726
 
727
-                $attach_id = wp_insert_attachment($attachment, $new_path);
727
+				$attach_id = wp_insert_attachment($attachment, $new_path);
728 728
 
729 729
 
730
-                // you must first include the image.php file
731
-                // for the function wp_generate_attachment_metadata() to work
732
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
733
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
734
-                wp_update_attachment_metadata($attach_id, $attach_data);
730
+				// you must first include the image.php file
731
+				// for the function wp_generate_attachment_metadata() to work
732
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
733
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
734
+				wp_update_attachment_metadata($attach_id, $attach_data);
735 735
 
736
-                if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
737
-                    update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
738
-                }
739
-            }
740
-        }
736
+				if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
737
+					update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
738
+				}
739
+			}
740
+		}
741 741
 
742
-    }
742
+	}
743 743
 }
744 744
 
745 745
 /**
@@ -754,145 +754,145 @@  discard block
 block discarded – undo
754 754
  * @return bool Returns true if saved.
755 755
  */
756 756
 function geodir_update_options($options, $dummy = false) {
757
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
757
+	if ((!isset($_POST) || !$_POST) && !$dummy) return false;
758 758
 
759
-    foreach ($options as $value) {
760
-        if ($dummy && isset($value['std']))
761
-            $_POST[$value['id']] = $value['std'];
759
+	foreach ($options as $value) {
760
+		if ($dummy && isset($value['std']))
761
+			$_POST[$value['id']] = $value['std'];
762 762
 
763 763
 
764
-        if (isset($value['type']) && $value['type'] == 'checkbox') :
764
+		if (isset($value['type']) && $value['type'] == 'checkbox') :
765 765
 
766
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
767
-                update_option($value['id'], $_POST[$value['id']]);
768
-            } else {
769
-                update_option($value['id'], 0);
770
-            }
766
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
767
+				update_option($value['id'], $_POST[$value['id']]);
768
+			} else {
769
+				update_option($value['id'], 0);
770
+			}
771 771
 
772
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
772
+		elseif (isset($value['type']) && $value['type'] == 'image_width') :
773 773
 
774
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
775
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
776
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
777
-                if (isset($_POST[$value['id'] . '_crop'])) :
778
-                    update_option($value['id'] . '_crop', 1);
779
-                else :
780
-                    update_option($value['id'] . '_crop', 0);
781
-                endif;
782
-            } else {
783
-                update_option($value['id'] . '_width', $value['std']);
784
-                update_option($value['id'] . '_height', $value['std']);
785
-                update_option($value['id'] . '_crop', 1);
786
-            }
774
+			if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
775
+				update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
776
+				update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
777
+				if (isset($_POST[$value['id'] . '_crop'])) :
778
+					update_option($value['id'] . '_crop', 1);
779
+				else :
780
+					update_option($value['id'] . '_crop', 0);
781
+				endif;
782
+			} else {
783
+				update_option($value['id'] . '_width', $value['std']);
784
+				update_option($value['id'] . '_height', $value['std']);
785
+				update_option($value['id'] . '_crop', 1);
786
+			}
787 787
 
788
-        elseif (isset($value['type']) && $value['type'] == 'map') :
789
-            $post_types = array();
790
-            $categories = array();
791
-            $i = 0;
788
+		elseif (isset($value['type']) && $value['type'] == 'map') :
789
+			$post_types = array();
790
+			$categories = array();
791
+			$i = 0;
792 792
 
793
-            if (!empty($_POST['home_map_post_types'])) :
794
-                foreach ($_POST['home_map_post_types'] as $post_type) :
795
-                    $post_types[] = $post_type;
796
-                endforeach;
797
-            endif;
793
+			if (!empty($_POST['home_map_post_types'])) :
794
+				foreach ($_POST['home_map_post_types'] as $post_type) :
795
+					$post_types[] = $post_type;
796
+				endforeach;
797
+			endif;
798 798
 
799
-            update_option('geodir_exclude_post_type_on_map', $post_types);
799
+			update_option('geodir_exclude_post_type_on_map', $post_types);
800 800
 
801
-            if (!empty($_POST['post_category'])) :
802
-                foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
803
-                    $categories[$texonomy] = array();
804
-                    foreach ($cat_arr as $category) :
805
-                        $categories[$texonomy][] = $category;
806
-                    endforeach;
807
-                    $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
808
-                endforeach;
809
-            endif;
810
-            update_option('geodir_exclude_cat_on_map', $categories);
811
-            update_option('geodir_exclude_cat_on_map_upgrade', 1);
812
-        elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
801
+			if (!empty($_POST['post_category'])) :
802
+				foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
803
+					$categories[$texonomy] = array();
804
+					foreach ($cat_arr as $category) :
805
+						$categories[$texonomy][] = $category;
806
+					endforeach;
807
+					$categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
808
+				endforeach;
809
+			endif;
810
+			update_option('geodir_exclude_cat_on_map', $categories);
811
+			update_option('geodir_exclude_cat_on_map_upgrade', 1);
812
+		elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
813 813
 
814 814
 
815
-            if (!empty($_POST['geodir_default_map_language'])):
816
-                update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
817
-            endif;
815
+			if (!empty($_POST['geodir_default_map_language'])):
816
+				update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
817
+			endif;
818 818
 
819 819
 
820
-            if (!empty($_POST['geodir_default_map_search_pt'])):
821
-                update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
822
-            endif;
820
+			if (!empty($_POST['geodir_default_map_search_pt'])):
821
+				update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
822
+			endif;
823 823
 
824 824
 
825
-        elseif (isset($value['type']) && $value['type'] == 'file') :
825
+		elseif (isset($value['type']) && $value['type'] == 'file') :
826 826
 
827 827
 
828
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
828
+			if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
829 829
 
830
-                if (get_option($value['id'])) {
831
-                    $image_name_arr = explode('/', get_option($value['id']));
832
-                    $noimg_name = end($image_name_arr);
833
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
834
-                    if (file_exists($img_path))
835
-                        unlink($img_path);
836
-                }
830
+				if (get_option($value['id'])) {
831
+					$image_name_arr = explode('/', get_option($value['id']));
832
+					$noimg_name = end($image_name_arr);
833
+					$img_path = $uploads['path'] . '/' . $noimg_name;
834
+					if (file_exists($img_path))
835
+						unlink($img_path);
836
+				}
837 837
 
838
-                update_option($value['id'], '');
839
-            }
838
+				update_option($value['id'], '');
839
+			}
840 840
 
841
-            $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
842
-            $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
843
-
844
-            if (!empty($filename)):
845
-                $ext = pathinfo($filename, PATHINFO_EXTENSION);
846
-                $uplaods = array();
847
-
848
-                foreach ($uploadedfile as $key => $uplaod):
849
-                    if ($key == 'name'):
850
-                        $uplaods[$key] = $filename;
851
-                    else :
852
-                        $uplaods[$key] = $uplaod;
853
-                    endif;
854
-                endforeach;
855
-
856
-                $uploads = wp_upload_dir();
857
-
858
-                if (get_option($value['id'])) {
859
-                    $image_name_arr = explode('/', get_option($value['id']));
860
-                    $noimg_name = end($image_name_arr);
861
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
862
-                    if (file_exists($img_path))
863
-                        unlink($img_path);
864
-                }
841
+			$uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
842
+			$filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
843
+
844
+			if (!empty($filename)):
845
+				$ext = pathinfo($filename, PATHINFO_EXTENSION);
846
+				$uplaods = array();
847
+
848
+				foreach ($uploadedfile as $key => $uplaod):
849
+					if ($key == 'name'):
850
+						$uplaods[$key] = $filename;
851
+					else :
852
+						$uplaods[$key] = $uplaod;
853
+					endif;
854
+				endforeach;
855
+
856
+				$uploads = wp_upload_dir();
857
+
858
+				if (get_option($value['id'])) {
859
+					$image_name_arr = explode('/', get_option($value['id']));
860
+					$noimg_name = end($image_name_arr);
861
+					$img_path = $uploads['path'] . '/' . $noimg_name;
862
+					if (file_exists($img_path))
863
+						unlink($img_path);
864
+				}
865 865
 
866
-                $upload_overrides = array('test_form' => false);
867
-                $movefile = wp_handle_upload($uplaods, $upload_overrides);
866
+				$upload_overrides = array('test_form' => false);
867
+				$movefile = wp_handle_upload($uplaods, $upload_overrides);
868 868
 
869
-                update_option($value['id'], $movefile['url']);
869
+				update_option($value['id'], $movefile['url']);
870 870
 
871
-            endif;
871
+			endif;
872 872
 
873
-            if (!get_option($value['id']) && isset($value['value'])):
874
-                update_option($value['id'], $value['value']);
875
-            endif;
873
+			if (!get_option($value['id']) && isset($value['value'])):
874
+				update_option($value['id'], $value['value']);
875
+			endif;
876 876
 
877 877
 
878
-        else :
879
-            // same menu setting per theme.
880
-            if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
881
-                $theme = wp_get_theme();
882
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
883
-            }
878
+		else :
879
+			// same menu setting per theme.
880
+			if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
881
+				$theme = wp_get_theme();
882
+				update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
883
+			}
884 884
 
885
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
886
-                update_option($value['id'], $_POST[$value['id']]);
887
-            } else {
888
-                delete_option($value['id']);
889
-            }
885
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
886
+				update_option($value['id'], $_POST[$value['id']]);
887
+			} else {
888
+				delete_option($value['id']);
889
+			}
890 890
 
891
-        endif;
892
-    }
893
-    if ($dummy)
894
-        $_POST = array();
895
-    return true;
891
+		endif;
892
+	}
893
+	if ($dummy)
894
+		$_POST = array();
895
+	return true;
896 896
 
897 897
 }
898 898
 
@@ -941,33 +941,33 @@  discard block
 block discarded – undo
941 941
 function places_custom_fields_tab($tabs)
942 942
 {
943 943
 
944
-    $geodir_post_types = get_option('geodir_post_types');
944
+	$geodir_post_types = get_option('geodir_post_types');
945 945
 
946
-    if (!empty($geodir_post_types)) {
946
+	if (!empty($geodir_post_types)) {
947 947
 
948
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
948
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
949 949
 
950
-            $listing_slug = $geodir_posttype_info['labels']['singular_name'];
950
+			$listing_slug = $geodir_posttype_info['labels']['singular_name'];
951 951
 
952
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
953
-                'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
954
-                'subtabs' => array(
955
-                    array('subtab' => 'custom_fields',
956
-                        'label' => __('Custom Fields', 'geodirectory'),
957
-                        'request' => array('listing_type' => $geodir_post_type)),
958
-                    array('subtab' => 'sorting_options',
959
-                        'label' => __('Sorting Options', 'geodirectory'),
960
-                        'request' => array('listing_type' => $geodir_post_type)),
961
-                ),
962
-                'tab_index' => 9,
963
-                'request' => array('listing_type' => $geodir_post_type)
964
-            );
952
+			$tabs[$geodir_post_type . '_fields_settings'] = array(
953
+				'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
954
+				'subtabs' => array(
955
+					array('subtab' => 'custom_fields',
956
+						'label' => __('Custom Fields', 'geodirectory'),
957
+						'request' => array('listing_type' => $geodir_post_type)),
958
+					array('subtab' => 'sorting_options',
959
+						'label' => __('Sorting Options', 'geodirectory'),
960
+						'request' => array('listing_type' => $geodir_post_type)),
961
+				),
962
+				'tab_index' => 9,
963
+				'request' => array('listing_type' => $geodir_post_type)
964
+			);
965 965
 
966
-        endforeach;
966
+		endforeach;
967 967
 
968
-    }
968
+	}
969 969
 
970
-    return $tabs;
970
+	return $tabs;
971 971
 }
972 972
 
973 973
 
@@ -983,8 +983,8 @@  discard block
 block discarded – undo
983 983
  */
984 984
 function geodir_tools_setting_tab($tabs)
985 985
 {
986
-    $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
987
-    return $tabs;
986
+	$tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
987
+	return $tabs;
988 988
 }
989 989
 
990 990
 /**
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
  */
1000 1000
 function geodir_compatibility_setting_tab($tabs)
1001 1001
 {
1002
-    $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1003
-    return $tabs;
1002
+	$tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1003
+	return $tabs;
1004 1004
 }
1005 1005
 
1006 1006
 
@@ -1016,144 +1016,144 @@  discard block
 block discarded – undo
1016 1016
  */
1017 1017
 function geodir_extend_geodirectory_setting_tab($tabs)
1018 1018
 {
1019
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1020
-    return $tabs;
1019
+	$tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1020
+	return $tabs;
1021 1021
 }
1022 1022
 
1023 1023
 
1024 1024
 if (!function_exists('geodir_edit_post_columns')) {
1025
-    /**
1026
-     * Modify admin post listing page columns.
1027
-     *
1028
-     * @since 1.0.0
1029
-     * @package GeoDirectory
1030
-     * @param array $columns The column array.
1031
-     * @return array Altered column array.
1032
-     */
1033
-    function geodir_edit_post_columns($columns)
1034
-    {
1035
-
1036
-        $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1037
-            'categorys' => __('Categories', 'geodirectory'));
1038
-
1039
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1040
-        {
1041
-            $offset = 0; // should we prepend $array with $data?
1042
-            $offset = count($columns); // or should we append $array with $data? lets pick this one...
1043
-        }
1025
+	/**
1026
+	 * Modify admin post listing page columns.
1027
+	 *
1028
+	 * @since 1.0.0
1029
+	 * @package GeoDirectory
1030
+	 * @param array $columns The column array.
1031
+	 * @return array Altered column array.
1032
+	 */
1033
+	function geodir_edit_post_columns($columns)
1034
+	{
1035
+
1036
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1037
+			'categorys' => __('Categories', 'geodirectory'));
1044 1038
 
1045
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1039
+		if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1040
+		{
1041
+			$offset = 0; // should we prepend $array with $data?
1042
+			$offset = count($columns); // or should we append $array with $data? lets pick this one...
1043
+		}
1046 1044
 
1047
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1045
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1048 1046
 
1049
-        return $columns;
1050
-    }
1047
+		$columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1048
+
1049
+		return $columns;
1050
+	}
1051 1051
 }
1052 1052
 
1053 1053
 
1054 1054
 if (!function_exists('geodir_manage_post_columns')) {
1055
-    /**
1056
-     * Adds content to our custom post listing page columns.
1057
-     *
1058
-     * @since 1.0.0
1059
-     * @package GeoDirectory
1060
-     * @global object $wpdb WordPress Database object.
1061
-     * @global object $post WordPress Post object.
1062
-     * @param string $column The column name.
1063
-     * @param int $post_id The post ID.
1064
-     */
1065
-    function geodir_manage_post_columns($column, $post_id)
1066
-    {
1067
-        global $post, $wpdb;
1068
-
1069
-        switch ($column):
1070
-            /* If displaying the 'city' column. */
1071
-            case 'location' :
1072
-                $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1073
-                $location = geodir_get_location($location_id);
1074
-                /* If no city is found, output a default message. */
1075
-                if (empty($location)) {
1076
-                    _e('Unknown', 'geodirectory');
1077
-                } else {
1078
-                    /* If there is a city id, append 'city name' to the text string. */
1079
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1080
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1081
-                }
1082
-                break;
1083
-
1084
-            /* If displaying the 'expire' column. */
1085
-            case 'expire' :
1086
-                $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1087
-                $d1 = $expire_date; // get expire_date
1088
-                $d2 = date('Y-m-d'); // get current date
1089
-                $state = __('days left', 'geodirectory');
1090
-                $date_diff_text = '';
1091
-                $expire_class = 'expire_left';
1092
-                if ($expire_date != 'Never') {
1093
-                    if (strtotime($d1) < strtotime($d2)) {
1094
-                        $state = __('days overdue', 'geodirectory');
1095
-                        $expire_class = 'expire_over';
1096
-                    }
1097
-                    $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the differance in days
1098
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1099
-                }
1100
-                /* If no expire_date is found, output a default message. */
1101
-                if (empty($expire_date))
1102
-                    echo __('Unknown', 'geodirectory');
1103
-                /* If there is a expire_date, append 'days left' to the text string. */
1104
-                else
1105
-                    echo $expire_date . $date_diff_text;
1106
-                break;
1107
-
1108
-            /* If displaying the 'categorys' column. */
1109
-            case 'categorys' :
1110
-
1111
-                /* Get the categorys for the post. */
1112
-
1113
-
1114
-                $terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1115
-
1116
-                /* If terms were found. */
1117
-                if (!empty($terms)) {
1118
-                    $out = array();
1119
-                    /* Loop through each term, linking to the 'edit posts' page for the specific term. */
1120
-                    foreach ($terms as $term) {
1121
-                        if (!strstr($term->taxonomy, 'tag')) {
1122
-                            $out[] = sprintf('<a href="%s">%s</a>',
1123
-                                esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1124
-                                esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1125
-                            );
1126
-                        }
1127
-                    }
1128
-                    /* Join the terms, separating them with a comma. */
1129
-                    echo(join(', ', $out));
1130
-                } /* If no terms were found, output a default message. */
1131
-                else {
1132
-                    _e('No Categories', 'geodirectory');
1133
-                }
1134
-                break;
1055
+	/**
1056
+	 * Adds content to our custom post listing page columns.
1057
+	 *
1058
+	 * @since 1.0.0
1059
+	 * @package GeoDirectory
1060
+	 * @global object $wpdb WordPress Database object.
1061
+	 * @global object $post WordPress Post object.
1062
+	 * @param string $column The column name.
1063
+	 * @param int $post_id The post ID.
1064
+	 */
1065
+	function geodir_manage_post_columns($column, $post_id)
1066
+	{
1067
+		global $post, $wpdb;
1068
+
1069
+		switch ($column):
1070
+			/* If displaying the 'city' column. */
1071
+			case 'location' :
1072
+				$location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1073
+				$location = geodir_get_location($location_id);
1074
+				/* If no city is found, output a default message. */
1075
+				if (empty($location)) {
1076
+					_e('Unknown', 'geodirectory');
1077
+				} else {
1078
+					/* If there is a city id, append 'city name' to the text string. */
1079
+					$add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1080
+					echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1081
+				}
1082
+				break;
1083
+
1084
+			/* If displaying the 'expire' column. */
1085
+			case 'expire' :
1086
+				$expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1087
+				$d1 = $expire_date; // get expire_date
1088
+				$d2 = date('Y-m-d'); // get current date
1089
+				$state = __('days left', 'geodirectory');
1090
+				$date_diff_text = '';
1091
+				$expire_class = 'expire_left';
1092
+				if ($expire_date != 'Never') {
1093
+					if (strtotime($d1) < strtotime($d2)) {
1094
+						$state = __('days overdue', 'geodirectory');
1095
+						$expire_class = 'expire_over';
1096
+					}
1097
+					$date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the differance in days
1098
+					$date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1099
+				}
1100
+				/* If no expire_date is found, output a default message. */
1101
+				if (empty($expire_date))
1102
+					echo __('Unknown', 'geodirectory');
1103
+				/* If there is a expire_date, append 'days left' to the text string. */
1104
+				else
1105
+					echo $expire_date . $date_diff_text;
1106
+				break;
1135 1107
 
1136
-        endswitch;
1137
-    }
1108
+			/* If displaying the 'categorys' column. */
1109
+			case 'categorys' :
1110
+
1111
+				/* Get the categorys for the post. */
1112
+
1113
+
1114
+				$terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1115
+
1116
+				/* If terms were found. */
1117
+				if (!empty($terms)) {
1118
+					$out = array();
1119
+					/* Loop through each term, linking to the 'edit posts' page for the specific term. */
1120
+					foreach ($terms as $term) {
1121
+						if (!strstr($term->taxonomy, 'tag')) {
1122
+							$out[] = sprintf('<a href="%s">%s</a>',
1123
+								esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1124
+								esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1125
+							);
1126
+						}
1127
+					}
1128
+					/* Join the terms, separating them with a comma. */
1129
+					echo(join(', ', $out));
1130
+				} /* If no terms were found, output a default message. */
1131
+				else {
1132
+					_e('No Categories', 'geodirectory');
1133
+				}
1134
+				break;
1135
+
1136
+		endswitch;
1137
+	}
1138 1138
 }
1139 1139
 
1140 1140
 
1141 1141
 if (!function_exists('geodir_post_sortable_columns')) {
1142
-    /**
1143
-     * Makes admin post listing page columns sortable.
1144
-     *
1145
-     * @since 1.0.0
1146
-     * @package GeoDirectory
1147
-     * @param array $columns The column array.
1148
-     * @return array Altered column array.
1149
-     */
1150
-    function geodir_post_sortable_columns($columns)
1151
-    {
1152
-
1153
-        $columns['expire'] = 'expire';
1154
-
1155
-        return $columns;
1156
-    }
1142
+	/**
1143
+	 * Makes admin post listing page columns sortable.
1144
+	 *
1145
+	 * @since 1.0.0
1146
+	 * @package GeoDirectory
1147
+	 * @param array $columns The column array.
1148
+	 * @return array Altered column array.
1149
+	 */
1150
+	function geodir_post_sortable_columns($columns)
1151
+	{
1152
+
1153
+		$columns['expire'] = 'expire';
1154
+
1155
+		return $columns;
1156
+	}
1157 1157
 }
1158 1158
 
1159 1159
 /**
@@ -1167,32 +1167,32 @@  discard block
 block discarded – undo
1167 1167
  * @param int $post_id The post ID.
1168 1168
  */
1169 1169
 function geodir_post_information_save($post_id, $post) {
1170
-    global $wpdb, $current_user;
1170
+	global $wpdb, $current_user;
1171 1171
 
1172
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1173
-        return;
1174
-    }
1172
+	if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1173
+		return;
1174
+	}
1175 1175
 
1176
-    $geodir_posttypes = geodir_get_posttypes();
1176
+	$geodir_posttypes = geodir_get_posttypes();
1177 1177
 
1178
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1179
-        return;
1178
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1179
+		return;
1180 1180
 
1181
-    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1182
-        if (isset($_REQUEST['_status']))
1183
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1181
+	if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1182
+		if (isset($_REQUEST['_status']))
1183
+			geodir_change_post_status($post_id, $_REQUEST['_status']);
1184 1184
 
1185
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1186
-            return;
1185
+		if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1186
+			return;
1187 1187
 
1188
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1189
-            return;
1188
+		if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1189
+			return;
1190 1190
 
1191
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1192
-            return;
1191
+		if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1192
+			return;
1193 1193
 
1194
-        geodir_save_listing($_REQUEST);
1195
-    }
1194
+		geodir_save_listing($_REQUEST);
1195
+	}
1196 1196
 }
1197 1197
 
1198 1198
 /**
@@ -1208,102 +1208,102 @@  discard block
 block discarded – undo
1208 1208
  */
1209 1209
 function geodir_admin_fields($options)
1210 1210
 {
1211
-    global $geodirectory;
1212
-
1213
-    $first_title = true;
1214
-    $tab_id = '';
1215
-    $i = 0;
1216
-    foreach ($options as $value) :
1217
-        if (!isset($value['name'])) $value['name'] = '';
1218
-        if (!isset($value['class'])) $value['class'] = '';
1219
-        if (!isset($value['css'])) $value['css'] = '';
1220
-        if (!isset($value['std'])) $value['std'] = '';
1221
-        $desc = '';
1222
-        switch ($value['type']) :
1223
-            case 'dummy_installer':
1224
-                $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1225
-                geodir_autoinstall_admin_header($post_type);
1226
-                break;
1227
-            case 'title':
1228
-
1229
-                if ($i == 0) {
1230
-                    echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1231
-                    echo '<div class="inner_content_tab_main">';
1232
-                }
1211
+	global $geodirectory;
1212
+
1213
+	$first_title = true;
1214
+	$tab_id = '';
1215
+	$i = 0;
1216
+	foreach ($options as $value) :
1217
+		if (!isset($value['name'])) $value['name'] = '';
1218
+		if (!isset($value['class'])) $value['class'] = '';
1219
+		if (!isset($value['css'])) $value['css'] = '';
1220
+		if (!isset($value['std'])) $value['std'] = '';
1221
+		$desc = '';
1222
+		switch ($value['type']) :
1223
+			case 'dummy_installer':
1224
+				$post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1225
+				geodir_autoinstall_admin_header($post_type);
1226
+				break;
1227
+			case 'title':
1228
+
1229
+				if ($i == 0) {
1230
+					echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1231
+					echo '<div class="inner_content_tab_main">';
1232
+				}
1233 1233
 
1234
-                $i++;
1234
+				$i++;
1235 1235
 
1236
-                if (isset($value['id']) && $value['id'])
1237
-                    $tab_id = $value['id'];
1236
+				if (isset($value['id']) && $value['id'])
1237
+					$tab_id = $value['id'];
1238 1238
 
1239
-                if (isset($value['desc']) && $value['desc'])
1240
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1239
+				if (isset($value['desc']) && $value['desc'])
1240
+					$desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1241 1241
 
1242
-                if (isset($value['name']) && $value['name']) {
1243
-                    if ($first_title === true) {
1244
-                        $first_title = false;
1245
-                    } else {
1246
-                        echo '</div>';
1247
-                    }
1248
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1242
+				if (isset($value['name']) && $value['name']) {
1243
+					if ($first_title === true) {
1244
+						$first_title = false;
1245
+					} else {
1246
+						echo '</div>';
1247
+					}
1248
+					echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1249 1249
 
1250
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1251
-                }
1250
+					echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1251
+				}
1252 1252
 
1253
-                /**
1254
-                 * Called after a GeoDirectory settings title is output in the GD settings page.
1255
-                 *
1256
-                 * The action is called dynamically geodir_settings_$value['id'].
1257
-                 *
1258
-                 * @since 1.0.0
1259
-                 */
1260
-                do_action('geodir_settings_' . sanitize_title($value['id']));
1261
-                break;
1262
-
1263
-            case 'no_tabs':
1264
-
1265
-                echo '<div class="inner_content_tab_main">';
1266
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1267
-
1268
-                break;
1269
-
1270
-            case 'sectionstart':
1271
-                if (isset($value['desc']) && $value['desc'])
1272
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1273
-                if (isset($value['name']) && $value['name'])
1274
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1275
-                /**
1276
-                 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1277
-                 *
1278
-                 * The action is called dynamically geodir_settings_$value['id']_start.
1279
-                 *
1280
-                 * @since 1.0.0
1281
-                 */
1282
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1283
-                echo '<table class="form-table">' . "\n\n";
1284
-
1285
-                break;
1286
-            case 'sectionend':
1287
-                /**
1288
-                 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1289
-                 *
1290
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1291
-                 *
1292
-                 * @since 1.0.0
1293
-                 */
1294
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1295
-                echo '</table>';
1296
-                /**
1297
-                 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1298
-                 *
1299
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1300
-                 *
1301
-                 * @since 1.0.0
1302
-                 */
1303
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1304
-                break;
1305
-            case 'text':
1306
-                ?>
1253
+				/**
1254
+				 * Called after a GeoDirectory settings title is output in the GD settings page.
1255
+				 *
1256
+				 * The action is called dynamically geodir_settings_$value['id'].
1257
+				 *
1258
+				 * @since 1.0.0
1259
+				 */
1260
+				do_action('geodir_settings_' . sanitize_title($value['id']));
1261
+				break;
1262
+
1263
+			case 'no_tabs':
1264
+
1265
+				echo '<div class="inner_content_tab_main">';
1266
+				echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1267
+
1268
+				break;
1269
+
1270
+			case 'sectionstart':
1271
+				if (isset($value['desc']) && $value['desc'])
1272
+					$desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1273
+				if (isset($value['name']) && $value['name'])
1274
+					echo '<h3>' . $value['name'] . $desc . '</h3>';
1275
+				/**
1276
+				 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1277
+				 *
1278
+				 * The action is called dynamically geodir_settings_$value['id']_start.
1279
+				 *
1280
+				 * @since 1.0.0
1281
+				 */
1282
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1283
+				echo '<table class="form-table">' . "\n\n";
1284
+
1285
+				break;
1286
+			case 'sectionend':
1287
+				/**
1288
+				 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1289
+				 *
1290
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1291
+				 *
1292
+				 * @since 1.0.0
1293
+				 */
1294
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1295
+				echo '</table>';
1296
+				/**
1297
+				 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1298
+				 *
1299
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1300
+				 *
1301
+				 * @since 1.0.0
1302
+				 */
1303
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1304
+				break;
1305
+			case 'text':
1306
+				?>
1307 1307
                 <tr valign="top">
1308 1308
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1309 1309
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1312,15 +1312,15 @@  discard block
 block discarded – undo
1312 1312
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1313 1313
                                            style=" <?php echo esc_attr($value['css']); ?>"
1314 1314
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1315
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1316
-                                           } else {
1317
-                                               echo esc_attr($value['std']);
1318
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1315
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1316
+										   } else {
1317
+											   echo esc_attr($value['std']);
1318
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1319 1319
                 </tr><?php
1320
-                break;
1320
+				break;
1321 1321
 
1322
-            case 'password':
1323
-                ?>
1322
+			case 'password':
1323
+				?>
1324 1324
                 <tr valign="top">
1325 1325
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1326 1326
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1329,42 +1329,42 @@  discard block
 block discarded – undo
1329 1329
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1330 1330
                                            style="<?php echo esc_attr($value['css']); ?>"
1331 1331
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1332
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1333
-                                           } else {
1334
-                                               echo esc_attr($value['std']);
1335
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1332
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1333
+										   } else {
1334
+											   echo esc_attr($value['std']);
1335
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1336 1336
                 </tr><?php
1337
-                break;
1337
+				break;
1338 1338
 
1339
-            case 'html_content':
1340
-                ?>
1339
+			case 'html_content':
1340
+				?>
1341 1341
                 <tr valign="top">
1342 1342
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1343 1343
                 <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td>
1344 1344
                 </tr><?php
1345
-                break;
1345
+				break;
1346 1346
 
1347
-            case 'color' :
1348
-                ?>
1347
+			case 'color' :
1348
+				?>
1349 1349
                 <tr valign="top">
1350 1350
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1351 1351
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1352 1352
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
1353 1353
                                            style="<?php echo esc_attr($value['css']); ?>"
1354 1354
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1355
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1356
-                                           } else {
1357
-                                               echo esc_attr($value['std']);
1358
-                                           } ?>" class="colorpick"/> <span
1355
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1356
+										   } else {
1357
+											   echo esc_attr($value['std']);
1358
+										   } ?>" class="colorpick"/> <span
1359 1359
                         class="description"><?php echo $value['desc']; ?></span>
1360 1360
 
1361 1361
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
1362 1362
                          style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
1363 1363
                 </td>
1364 1364
                 </tr><?php
1365
-                break;
1366
-            case 'image_width' :
1367
-                ?>
1365
+				break;
1366
+			case 'image_width' :
1367
+				?>
1368 1368
                 <tr valign="top">
1369 1369
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1370 1370
                 <td class="forminp">
@@ -1386,11 +1386,11 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1388 1388
                 </tr><?php
1389
-                break;
1390
-            case 'select':
1391
-                $option_value = get_option($value['id']);
1392
-                $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1393
-                ?>
1389
+				break;
1390
+			case 'select':
1391
+				$option_value = get_option($value['id']);
1392
+				$option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1393
+				?>
1394 1394
                 <tr valign="top">
1395 1395
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1396 1396
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1399,33 +1399,33 @@  discard block
 block discarded – undo
1399 1399
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1400 1400
                                             option-ajaxchosen="false">
1401 1401
                         <?php
1402
-                        foreach ($value['options'] as $key => $val) {
1403
-                            $geodir_select_value = '';
1404
-                            if ($option_value != '') {
1405
-                                if ($option_value != '' && $option_value == $key)
1406
-                                    $geodir_select_value = ' selected="selected" ';
1407
-                            } else {
1408
-                                if ($value['std'] == $key)
1409
-                                    $geodir_select_value = ' selected="selected" ';
1410
-                            }
1411
-                            ?>
1402
+						foreach ($value['options'] as $key => $val) {
1403
+							$geodir_select_value = '';
1404
+							if ($option_value != '') {
1405
+								if ($option_value != '' && $option_value == $key)
1406
+									$geodir_select_value = ' selected="selected" ';
1407
+							} else {
1408
+								if ($value['std'] == $key)
1409
+									$geodir_select_value = ' selected="selected" ';
1410
+							}
1411
+							?>
1412 1412
                             <option
1413 1413
                                 value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo ucfirst($val) ?></option>
1414 1414
                         <?php
1415
-                        }
1416
-                        ?>
1415
+						}
1416
+						?>
1417 1417
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1418 1418
                 </td>
1419 1419
                 </tr><?php
1420
-                break;
1420
+				break;
1421 1421
 
1422
-            case 'multiselect':
1423
-                $option_values = get_option($value['id']);
1424
-                if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1425
-                   $option_values = $value['std'];
1426
-                }
1427
-                $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1428
-                ?>
1422
+			case 'multiselect':
1423
+				$option_values = get_option($value['id']);
1424
+				if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1425
+				   $option_values = $value['std'];
1426
+				}
1427
+				$option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1428
+				?>
1429 1429
                 <tr valign="top">
1430 1430
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1431 1431
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
@@ -1435,25 +1435,25 @@  discard block
 block discarded – undo
1435 1435
                                             data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1436 1436
                                             option-ajaxchosen="false">
1437 1437
                         <?php
1438
-                        foreach ($value['options'] as $key => $val) {
1439
-                            if (strpos($key, 'optgroup_start-') === 0) {
1440
-                                ?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1441
-                            } else if (strpos($key, 'optgroup_end-') === 0) {
1442
-                                ?></optgroup><?php
1443
-                            } else {
1444
-                                ?>
1438
+						foreach ($value['options'] as $key => $val) {
1439
+							if (strpos($key, 'optgroup_start-') === 0) {
1440
+								?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1441
+							} else if (strpos($key, 'optgroup_end-') === 0) {
1442
+								?></optgroup><?php
1443
+							} else {
1444
+								?>
1445 1445
                                 <option
1446 1446
                                     value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option>
1447 1447
                             <?php
1448
-                            }
1449
-                        }
1450
-                        ?>
1448
+							}
1449
+						}
1450
+						?>
1451 1451
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1452 1452
                 </td>
1453 1453
                 </tr><?php
1454
-                break;
1455
-            case 'file':
1456
-                ?>
1454
+				break;
1455
+			case 'file':
1456
+				?>
1457 1457
                 <tr valign="top">
1458 1458
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1459 1459
                 <td class="forminp">
@@ -1473,87 +1473,87 @@  discard block
 block discarded – undo
1473 1473
                     <?php } ?>
1474 1474
                 </td>
1475 1475
                 </tr><?php
1476
-                break;
1477
-            case 'map_default_settings' :
1478
-                ?>
1476
+				break;
1477
+			case 'map_default_settings' :
1478
+				?>
1479 1479
 
1480 1480
                 <tr valign="top">
1481 1481
                     <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1482 1482
                     <td width="60%">
1483 1483
                         <select name="geodir_default_map_language" style="width:60%">
1484 1484
                             <?php
1485
-                            $arr_map_langages = array(
1486
-                                'ar' => __('ARABIC', 'geodirectory'),
1487
-                                'eu' => __('BASQUE', 'geodirectory'),
1488
-                                'bg' => __('BULGARIAN', 'geodirectory'),
1489
-                                'bn' => __('BENGALI', 'geodirectory'),
1490
-                                'ca' => __('CATALAN', 'geodirectory'),
1491
-                                'cs' => __('CZECH', 'geodirectory'),
1492
-                                'da' => __('DANISH', 'geodirectory'),
1493
-                                'de' => __('GERMAN', 'geodirectory'),
1494
-                                'el' => __('GREEK', 'geodirectory'),
1495
-                                'en' => __('ENGLISH', 'geodirectory'),
1496
-                                'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1497
-                                'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1498
-                                'es' => __('SPANISH', 'geodirectory'),
1499
-                                'eu' => __('BASQUE', 'geodirectory'),
1500
-                                'fa' => __('FARSI', 'geodirectory'),
1501
-                                'fi' => __('FINNISH', 'geodirectory'),
1502
-                                'fil' => __('FILIPINO', 'geodirectory'),
1503
-                                'fr' => __('FRENCH', 'geodirectory'),
1504
-                                'gl' => __('GALICIAN', 'geodirectory'),
1505
-                                'gu' => __('GUJARATI', 'geodirectory'),
1506
-                                'hi' => __('HINDI', 'geodirectory'),
1507
-                                'hr' => __('CROATIAN', 'geodirectory'),
1508
-                                'hu' => __('HUNGARIAN', 'geodirectory'),
1509
-                                'id' => __('INDONESIAN', 'geodirectory'),
1510
-                                'it' => __('ITALIAN', 'geodirectory'),
1511
-                                'iw' => __('HEBREW', 'geodirectory'),
1512
-                                'ja' => __('JAPANESE', 'geodirectory'),
1513
-                                'kn' => __('KANNADA', 'geodirectory'),
1514
-                                'ko' => __('KOREAN', 'geodirectory'),
1515
-                                'lt' => __('LITHUANIAN', 'geodirectory'),
1516
-                                'lv' => __('LATVIAN', 'geodirectory'),
1517
-                                'ml' => __('MALAYALAM', 'geodirectory'),
1518
-                                'mr' => __('MARATHI', 'geodirectory'),
1519
-                                'nl' => __('DUTCH', 'geodirectory'),
1520
-                                'no' => __('NORWEGIAN', 'geodirectory'),
1521
-                                'pl' => __('POLISH', 'geodirectory'),
1522
-                                'pt' => __('PORTUGUESE', 'geodirectory'),
1523
-                                'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1524
-                                'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1525
-                                'ro' => __('ROMANIAN', 'geodirectory'),
1526
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1527
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1528
-                                'sk' => __('SLOVAK', 'geodirectory'),
1529
-                                'sl' => __('SLOVENIAN', 'geodirectory'),
1530
-                                'sr' => __('SERBIAN', 'geodirectory'),
1531
-                                'sv' => __('	SWEDISH', 'geodirectory'),
1532
-                                'tl' => __('TAGALOG', 'geodirectory'),
1533
-                                'ta' => __('TAMIL', 'geodirectory'),
1534
-                                'te' => __('TELUGU', 'geodirectory'),
1535
-                                'th' => __('THAI', 'geodirectory'),
1536
-                                'tr' => __('TURKISH', 'geodirectory'),
1537
-                                'uk' => __('UKRAINIAN', 'geodirectory'),
1538
-                                'vi' => __('VIETNAMESE', 'geodirectory'),
1539
-                                'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1540
-                                'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1541
-                            );
1542
-                            $geodir_default_map_language = get_option('geodir_default_map_language');
1543
-                            if (empty($geodir_default_map_language))
1544
-                                $geodir_default_map_language = 'en';
1545
-                            foreach ($arr_map_langages as $language_key => $language_txt) {
1546
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1547
-                                    $geodir_default_language_selected = "selected='selected'";
1548
-                                else
1549
-                                    $geodir_default_language_selected = '';
1550
-
1551
-                                ?>
1485
+							$arr_map_langages = array(
1486
+								'ar' => __('ARABIC', 'geodirectory'),
1487
+								'eu' => __('BASQUE', 'geodirectory'),
1488
+								'bg' => __('BULGARIAN', 'geodirectory'),
1489
+								'bn' => __('BENGALI', 'geodirectory'),
1490
+								'ca' => __('CATALAN', 'geodirectory'),
1491
+								'cs' => __('CZECH', 'geodirectory'),
1492
+								'da' => __('DANISH', 'geodirectory'),
1493
+								'de' => __('GERMAN', 'geodirectory'),
1494
+								'el' => __('GREEK', 'geodirectory'),
1495
+								'en' => __('ENGLISH', 'geodirectory'),
1496
+								'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1497
+								'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1498
+								'es' => __('SPANISH', 'geodirectory'),
1499
+								'eu' => __('BASQUE', 'geodirectory'),
1500
+								'fa' => __('FARSI', 'geodirectory'),
1501
+								'fi' => __('FINNISH', 'geodirectory'),
1502
+								'fil' => __('FILIPINO', 'geodirectory'),
1503
+								'fr' => __('FRENCH', 'geodirectory'),
1504
+								'gl' => __('GALICIAN', 'geodirectory'),
1505
+								'gu' => __('GUJARATI', 'geodirectory'),
1506
+								'hi' => __('HINDI', 'geodirectory'),
1507
+								'hr' => __('CROATIAN', 'geodirectory'),
1508
+								'hu' => __('HUNGARIAN', 'geodirectory'),
1509
+								'id' => __('INDONESIAN', 'geodirectory'),
1510
+								'it' => __('ITALIAN', 'geodirectory'),
1511
+								'iw' => __('HEBREW', 'geodirectory'),
1512
+								'ja' => __('JAPANESE', 'geodirectory'),
1513
+								'kn' => __('KANNADA', 'geodirectory'),
1514
+								'ko' => __('KOREAN', 'geodirectory'),
1515
+								'lt' => __('LITHUANIAN', 'geodirectory'),
1516
+								'lv' => __('LATVIAN', 'geodirectory'),
1517
+								'ml' => __('MALAYALAM', 'geodirectory'),
1518
+								'mr' => __('MARATHI', 'geodirectory'),
1519
+								'nl' => __('DUTCH', 'geodirectory'),
1520
+								'no' => __('NORWEGIAN', 'geodirectory'),
1521
+								'pl' => __('POLISH', 'geodirectory'),
1522
+								'pt' => __('PORTUGUESE', 'geodirectory'),
1523
+								'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1524
+								'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1525
+								'ro' => __('ROMANIAN', 'geodirectory'),
1526
+								'ru' => __('RUSSIAN', 'geodirectory'),
1527
+								'ru' => __('RUSSIAN', 'geodirectory'),
1528
+								'sk' => __('SLOVAK', 'geodirectory'),
1529
+								'sl' => __('SLOVENIAN', 'geodirectory'),
1530
+								'sr' => __('SERBIAN', 'geodirectory'),
1531
+								'sv' => __('	SWEDISH', 'geodirectory'),
1532
+								'tl' => __('TAGALOG', 'geodirectory'),
1533
+								'ta' => __('TAMIL', 'geodirectory'),
1534
+								'te' => __('TELUGU', 'geodirectory'),
1535
+								'th' => __('THAI', 'geodirectory'),
1536
+								'tr' => __('TURKISH', 'geodirectory'),
1537
+								'uk' => __('UKRAINIAN', 'geodirectory'),
1538
+								'vi' => __('VIETNAMESE', 'geodirectory'),
1539
+								'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1540
+								'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1541
+							);
1542
+							$geodir_default_map_language = get_option('geodir_default_map_language');
1543
+							if (empty($geodir_default_map_language))
1544
+								$geodir_default_map_language = 'en';
1545
+							foreach ($arr_map_langages as $language_key => $language_txt) {
1546
+								if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1547
+									$geodir_default_language_selected = "selected='selected'";
1548
+								else
1549
+									$geodir_default_language_selected = '';
1550
+
1551
+								?>
1552 1552
                                 <option
1553 1553
                                     value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option>
1554 1554
 
1555 1555
                             <?php }
1556
-                            ?>
1556
+							?>
1557 1557
                         </select>
1558 1558
                     </td>
1559 1559
                 </tr>
@@ -1564,46 +1564,46 @@  discard block
 block discarded – undo
1564 1564
                     <td width="60%">
1565 1565
                         <select name="geodir_default_map_search_pt" style="width:60%">
1566 1566
                             <?php
1567
-                            $post_types = geodir_get_posttypes('array');
1568
-                            $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1569
-                            if (empty($geodir_default_map_search_pt))
1570
-                                $geodir_default_map_search_pt = 'gd_place';
1571
-                            if (is_array($post_types)) {
1572
-                                foreach ($post_types as $key => $post_types_obj) {
1573
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1574
-                                        $geodir_search_pt_selected = "selected='selected'";
1575
-                                    else
1576
-                                        $geodir_search_pt_selected = '';
1577
-
1578
-                                    ?>
1567
+							$post_types = geodir_get_posttypes('array');
1568
+							$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1569
+							if (empty($geodir_default_map_search_pt))
1570
+								$geodir_default_map_search_pt = 'gd_place';
1571
+							if (is_array($post_types)) {
1572
+								foreach ($post_types as $key => $post_types_obj) {
1573
+									if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1574
+										$geodir_search_pt_selected = "selected='selected'";
1575
+									else
1576
+										$geodir_search_pt_selected = '';
1577
+
1578
+									?>
1579 1579
                                     <option
1580 1580
                                         value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo $post_types_obj['labels']['singular_name']; ?></option>
1581 1581
 
1582 1582
                                 <?php }
1583 1583
 
1584
-                            }
1584
+							}
1585 1585
 
1586
-                            ?>
1586
+							?>
1587 1587
                         </select>
1588 1588
                     </td>
1589 1589
                 </tr>
1590 1590
 
1591 1591
                 <?php
1592
-                break;
1592
+				break;
1593 1593
 
1594
-            case 'map':
1595
-                ?>
1594
+			case 'map':
1595
+				?>
1596 1596
                 <tr valign="top">
1597 1597
                     <td class="forminp">
1598 1598
                         <?php
1599
-                        global $post_cat, $cat_display;
1600
-                        $post_types = geodir_get_posttypes('object');
1601
-                        $cat_display = 'checkbox';
1602
-                        $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1603
-                        $gd_cats = get_option('geodir_exclude_cat_on_map');
1604
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1605
-                        $count = 1;
1606
-                        ?>
1599
+						global $post_cat, $cat_display;
1600
+						$post_types = geodir_get_posttypes('object');
1601
+						$cat_display = 'checkbox';
1602
+						$gd_post_types = get_option('geodir_exclude_post_type_on_map');
1603
+						$gd_cats = get_option('geodir_exclude_cat_on_map');
1604
+						$gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1605
+						$count = 1;
1606
+						?>
1607 1607
                         <table width="70%" class="widefat">
1608 1608
                             <thead>
1609 1609
                             <tr>
@@ -1612,18 +1612,18 @@  discard block
 block discarded – undo
1612 1612
                                 <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th>
1613 1613
                             </tr>
1614 1614
                             <?php
1615
-                            $gd_categs = $gd_cats;
1616
-                            foreach ($post_types as $key => $post_types_obj) :
1617
-                                $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1618
-                                $gd_taxonomy = geodir_get_taxonomies($key);
1619
-                                if ($gd_cats_upgrade) {
1620
-                                    $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1621
-                                    $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1622
-                                    $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1623
-                                }
1624
-                                $post_cat = implode(',', $gd_cats);
1625
-                                $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1626
-                                ?>
1615
+							$gd_categs = $gd_cats;
1616
+							foreach ($post_types as $key => $post_types_obj) :
1617
+								$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1618
+								$gd_taxonomy = geodir_get_taxonomies($key);
1619
+								if ($gd_cats_upgrade) {
1620
+									$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1621
+									$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1622
+									$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1623
+								}
1624
+								$post_cat = implode(',', $gd_cats);
1625
+								$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1626
+								?>
1627 1627
                                 <tr>
1628 1628
                                     <td valign="top" width="5%"><?php echo $count; ?></td>
1629 1629
                                     <td valign="top" width="25%" id="td_post_types"><input type="checkbox"
@@ -1644,19 +1644,19 @@  discard block
 block discarded – undo
1644 1644
                     </td>
1645 1645
                 </tr>
1646 1646
                 <?php
1647
-                break;
1647
+				break;
1648 1648
 
1649
-            case 'checkbox' :
1649
+			case 'checkbox' :
1650 1650
 
1651
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1652
-                    ?>
1651
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1652
+					?>
1653 1653
                     <tr valign="top">
1654 1654
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1655 1655
                     <td class="forminp">
1656 1656
                 <?php
1657
-                endif;
1657
+				endif;
1658 1658
 
1659
-                ?>
1659
+				?>
1660 1660
                 <fieldset>
1661 1661
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1662 1662
                     <label for="<?php echo $value['id'] ?>">
@@ -1666,49 +1666,49 @@  discard block
 block discarded – undo
1666 1666
                 </fieldset>
1667 1667
                 <?php
1668 1668
 
1669
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1670
-                    ?>
1669
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1670
+					?>
1671 1671
                     </td>
1672 1672
                     </tr>
1673 1673
                 <?php
1674
-                endif;
1674
+				endif;
1675 1675
 
1676
-                break;
1676
+				break;
1677 1677
 
1678
-            case 'radio' :
1678
+			case 'radio' :
1679 1679
 
1680
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1681
-                    ?>
1680
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1681
+					?>
1682 1682
                     <tr valign="top">
1683 1683
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1684 1684
                     <td class="forminp">
1685 1685
                 <?php
1686
-                endif;
1686
+				endif;
1687 1687
 
1688
-                ?>
1688
+				?>
1689 1689
                 <fieldset>
1690 1690
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1691 1691
                     <label for="<?php echo $value['id'];?>">
1692 1692
                         <input name="<?php echo esc_attr($value['id']); ?>"
1693 1693
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1694 1694
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1695
-                            echo 'checked="checked"';
1696
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1695
+							echo 'checked="checked"';
1696
+						}elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1697 1697
                         <?php echo $value['desc']; ?></label><br>
1698 1698
                 </fieldset>
1699 1699
                 <?php
1700 1700
 
1701
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1702
-                    ?>
1701
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1702
+					?>
1703 1703
                     </td>
1704 1704
                     </tr>
1705 1705
                 <?php
1706
-                endif;
1706
+				endif;
1707 1707
 
1708
-                break;
1708
+				break;
1709 1709
 
1710
-            case 'textarea':
1711
-                ?>
1710
+			case 'textarea':
1711
+				?>
1712 1712
                 <tr valign="top">
1713 1713
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1714 1714
                 <td class="forminp">
@@ -1721,32 +1721,32 @@  discard block
 block discarded – undo
1721 1721
 
1722 1722
                 </td>
1723 1723
                 </tr><?php
1724
-                break;
1724
+				break;
1725 1725
 
1726
-            case 'editor':
1727
-                ?>
1726
+			case 'editor':
1727
+				?>
1728 1728
                 <tr valign="top">
1729 1729
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1730 1730
                 <td class="forminp"><?php
1731 1731
 
1732
-                    $content = '';
1733
-                    if (get_option($value['id']))
1734
-                        $content = stripslashes(get_option($value['id']));
1735
-                    else
1736
-                        $content = $value['std'];
1732
+					$content = '';
1733
+					if (get_option($value['id']))
1734
+						$content = stripslashes(get_option($value['id']));
1735
+					else
1736
+						$content = $value['std'];
1737 1737
 
1738
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1738
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1739 1739
 
1740
-                    wp_editor($content, esc_attr($value['id']), $editor_settings);
1740
+					wp_editor($content, esc_attr($value['id']), $editor_settings);
1741 1741
 
1742
-                    ?> <span class="description"><?php echo $value['desc'] ?></span>
1742
+					?> <span class="description"><?php echo $value['desc'] ?></span>
1743 1743
 
1744 1744
                 </td>
1745 1745
                 </tr><?php
1746
-                break;
1746
+				break;
1747 1747
 
1748
-            case 'single_select_page' :
1749
-                // WPML
1748
+			case 'single_select_page' :
1749
+				// WPML
1750 1750
 				$switch_lang = false;
1751 1751
 				$disabled = '';
1752 1752
 				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -1764,18 +1764,18 @@  discard block
 block discarded – undo
1764 1764
 				//
1765 1765
 				$page_setting = (int)get_option($value['id']);
1766 1766
 
1767
-                $args = array('name' => $value['id'],
1768
-                    'id' => $value['id'],
1769
-                    'sort_column' => 'menu_order',
1770
-                    'sort_order' => 'ASC',
1771
-                    'show_option_none' => ' ',
1772
-                    'class' => $value['class'],
1773
-                    'echo' => false,
1774
-                    'selected' => $page_setting);
1767
+				$args = array('name' => $value['id'],
1768
+					'id' => $value['id'],
1769
+					'sort_column' => 'menu_order',
1770
+					'sort_order' => 'ASC',
1771
+					'show_option_none' => ' ',
1772
+					'class' => $value['class'],
1773
+					'echo' => false,
1774
+					'selected' => $page_setting);
1775 1775
 
1776
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1776
+				if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1777 1777
 
1778
-                ?>
1778
+				?>
1779 1779
                 <tr valign="top" class="single_select_page">
1780 1780
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1781 1781
                 <td class="forminp">
@@ -1786,18 +1786,18 @@  discard block
 block discarded – undo
1786 1786
 				if ($switch_lang) {
1787 1787
 					$sitepress->switch_lang($switch_lang, true);
1788 1788
 				}
1789
-                break;
1790
-            case 'single_select_country' :
1791
-                $countries = $geodirectory->countries->countries;
1792
-                $country_setting = (string)get_option($value['id']);
1793
-                if (strstr($country_setting, ':')) :
1794
-                    $country = current(explode(':', $country_setting));
1795
-                    $state = end(explode(':', $country_setting));
1796
-                else :
1797
-                    $country = $country_setting;
1798
-                    $state = '*';
1799
-                endif;
1800
-                ?>
1789
+				break;
1790
+			case 'single_select_country' :
1791
+				$countries = $geodirectory->countries->countries;
1792
+				$country_setting = (string)get_option($value['id']);
1793
+				if (strstr($country_setting, ':')) :
1794
+					$country = current(explode(':', $country_setting));
1795
+					$state = end(explode(':', $country_setting));
1796
+				else :
1797
+					$country = $country_setting;
1798
+					$state = '*';
1799
+				endif;
1800
+				?>
1801 1801
                 <tr valign="top">
1802 1802
                 <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
1803 1803
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1808,12 +1808,12 @@  discard block
 block discarded – undo
1808 1808
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1809 1809
                 </td>
1810 1810
                 </tr><?php
1811
-                break;
1812
-            case 'multi_select_countries' :
1813
-                $countries = $geodirectory->countries->countries;
1814
-                asort($countries);
1815
-                $selections = (array)get_option($value['id']);
1816
-                ?>
1811
+				break;
1812
+			case 'multi_select_countries' :
1813
+				$countries = $geodirectory->countries->countries;
1814
+				asort($countries);
1815
+				$selections = (array)get_option($value['id']);
1816
+				?>
1817 1817
                 <tr valign="top">
1818 1818
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1819 1819
                 <td class="forminp">
@@ -1821,22 +1821,22 @@  discard block
 block discarded – undo
1821 1821
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1822 1822
                             title="Country" class="chosen_select">
1823 1823
                         <?php
1824
-                        if ($countries) foreach ($countries as $key => $val) :
1825
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1826
-                        endforeach;
1827
-                        ?>
1824
+						if ($countries) foreach ($countries as $key => $val) :
1825
+							echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1826
+						endforeach;
1827
+						?>
1828 1828
                     </select>
1829 1829
                 </td>
1830 1830
                 </tr>
1831 1831
 
1832 1832
                 <?php
1833 1833
 
1834
-                break;
1834
+				break;
1835 1835
 
1836
-            case 'google_analytics' :
1837
-                $selections = (array)get_option($value['id']);
1838
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1839
-                    ?>
1836
+			case 'google_analytics' :
1837
+				$selections = (array)get_option($value['id']);
1838
+				if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1839
+					?>
1840 1840
                     <tr valign="top">
1841 1841
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1842 1842
                         <td class="forminp">
@@ -1844,19 +1844,19 @@  discard block
 block discarded – undo
1844 1844
 
1845 1845
                             <?php
1846 1846
 
1847
-                            $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1848
-                            $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1849
-                            $state = "&state=123";//any string
1850
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1851
-                            $response_type = "&response_type=code";
1852
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1853
-                            $access_type = "&access_type=offline";
1854
-                            $approval_prompt = "&approval_prompt=force";
1847
+							$oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1848
+							$scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1849
+							$state = "&state=123";//any string
1850
+							$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1851
+							$response_type = "&response_type=code";
1852
+							$client_id = "&client_id=".get_option('geodir_ga_client_id');
1853
+							$access_type = "&access_type=offline";
1854
+							$approval_prompt = "&approval_prompt=force";
1855 1855
 
1856
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1856
+							$auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1857 1857
 
1858 1858
 
1859
-                            ?>
1859
+							?>
1860 1860
                             <script>
1861 1861
                                 function gd_ga_popup() {
1862 1862
                                     var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
@@ -1871,47 +1871,47 @@  discard block
 block discarded – undo
1871 1871
                             </script>
1872 1872
 
1873 1873
                             <?php
1874
-                            if (get_option('gd_ga_refresh_token')) {
1875
-                                ?>
1874
+							if (get_option('gd_ga_refresh_token')) {
1875
+								?>
1876 1876
                                 <span class="button-primary"
1877 1877
                                       onclick="gd_ga_popup();"><?php _e('Re-authorize', 'geodirectory'); ?></span>
1878 1878
                                 <span
1879 1879
                                     style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1880 1880
                             <?php
1881
-                            } else {
1882
-                                ?>
1881
+							} else {
1882
+								?>
1883 1883
                                 <span class="button-primary"
1884 1884
                                       onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
1885 1885
                             <?php
1886
-                            }
1887
-                            ?>
1886
+							}
1887
+							?>
1888 1888
                         </td>
1889 1889
                     </tr>
1890 1890
 
1891 1891
                 <?php
1892
-                }
1892
+				}
1893 1893
 
1894
-                break;
1894
+				break;
1895 1895
 
1896
-            case 'field_seperator' :
1896
+			case 'field_seperator' :
1897 1897
 
1898
-                ?>
1898
+				?>
1899 1899
                 <tr valign="top">
1900 1900
                     <td colspan="2" class="forminp geodir_line_seperator"></td>
1901 1901
                 </tr>
1902 1902
                 <?php
1903 1903
 
1904
-                break;
1904
+				break;
1905 1905
 
1906
-        endswitch;
1906
+		endswitch;
1907 1907
 
1908
-    endforeach;
1908
+	endforeach;
1909 1909
 
1910
-    if ($first_title === false) {
1911
-        echo "</div>";
1912
-    }
1910
+	if ($first_title === false) {
1911
+		echo "</div>";
1912
+	}
1913 1913
 
1914
-    ?>
1914
+	?>
1915 1915
 
1916 1916
     <script type="text/javascript">
1917 1917
 
@@ -1971,33 +1971,33 @@  discard block
 block discarded – undo
1971 1971
  */
1972 1972
 function geodir_post_info_setting()
1973 1973
 {
1974
-    global $post, $post_id;
1975
-
1976
-    $post_type = get_post_type();
1977
-
1978
-    $package_info = array();
1979
-
1980
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1981
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1982
-    echo '<div id="geodir_wrapper">';
1983
-    /**
1984
-     * Called before the GD custom fields are output in the wp-admin area.
1985
-     *
1986
-     * @since 1.0.0
1987
-     * @see 'geodir_after_default_field_in_meta_box'
1988
-     */
1989
-    do_action('geodir_before_default_field_in_meta_box');
1990
-    //geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1991
-    // to display all fields in one information box
1992
-    geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1993
-    /**
1994
-     * Called after the GD custom fields are output in the wp-admin area.
1995
-     *
1996
-     * @since 1.0.0
1997
-     * @see 'geodir_before_default_field_in_meta_box'
1998
-     */
1999
-    do_action('geodir_after_default_field_in_meta_box');
2000
-    echo '</div>';
1974
+	global $post, $post_id;
1975
+
1976
+	$post_type = get_post_type();
1977
+
1978
+	$package_info = array();
1979
+
1980
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1981
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1982
+	echo '<div id="geodir_wrapper">';
1983
+	/**
1984
+	 * Called before the GD custom fields are output in the wp-admin area.
1985
+	 *
1986
+	 * @since 1.0.0
1987
+	 * @see 'geodir_after_default_field_in_meta_box'
1988
+	 */
1989
+	do_action('geodir_before_default_field_in_meta_box');
1990
+	//geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1991
+	// to display all fields in one information box
1992
+	geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1993
+	/**
1994
+	 * Called after the GD custom fields are output in the wp-admin area.
1995
+	 *
1996
+	 * @since 1.0.0
1997
+	 * @see 'geodir_before_default_field_in_meta_box'
1998
+	 */
1999
+	do_action('geodir_after_default_field_in_meta_box');
2000
+	echo '</div>';
2001 2001
 }
2002 2002
 
2003 2003
 /**
@@ -2010,18 +2010,18 @@  discard block
 block discarded – undo
2010 2010
  */
2011 2011
 function geodir_post_addinfo_setting()
2012 2012
 {
2013
-    global $post, $post_id;
2013
+	global $post, $post_id;
2014 2014
 
2015
-    $post_type = get_post_type();
2015
+	$post_type = get_post_type();
2016 2016
 
2017
-    $package_info = array();
2017
+	$package_info = array();
2018 2018
 
2019
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
2019
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
2020 2020
 
2021
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2022
-    echo '<div id="geodir_wrapper">';
2023
-    geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2024
-    echo '</div>';
2021
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2022
+	echo '<div id="geodir_wrapper">';
2023
+	geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2024
+	echo '</div>';
2025 2025
 
2026 2026
 }
2027 2027
 
@@ -2035,60 +2035,60 @@  discard block
 block discarded – undo
2035 2035
  */
2036 2036
 function geodir_post_attachments()
2037 2037
 {
2038
-    global $post, $post_id;
2038
+	global $post, $post_id;
2039 2039
 
2040
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2040
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2041 2041
 
2042
-    if (geodir_get_featured_image($post_id, 'thumbnail')) {
2043
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2044
-        geodir_show_featured_image($post_id, 'thumbnail');
2045
-    }
2042
+	if (geodir_get_featured_image($post_id, 'thumbnail')) {
2043
+		echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2044
+		geodir_show_featured_image($post_id, 'thumbnail');
2045
+	}
2046 2046
 
2047
-    $image_limit = 0;
2047
+	$image_limit = 0;
2048 2048
 
2049
-    ?>
2049
+	?>
2050 2050
 
2051 2051
 
2052 2052
     <h5 class="form_title">
2053 2053
         <?php if ($image_limit != 0 && $image_limit == 1) {
2054
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2055
-        } ?>
2054
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2055
+		} ?>
2056 2056
         <?php if ($image_limit != 0 && $image_limit > 1) {
2057
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2058
-        } ?>
2057
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2058
+		} ?>
2059 2059
         <?php if ($image_limit == 0) {
2060
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2061
-        } ?>
2060
+			echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2061
+		} ?>
2062 2062
     </h5>
2063 2063
 
2064 2064
 
2065 2065
     <?php
2066 2066
 
2067
-    $curImages = geodir_get_images($post_id);
2068
-    $place_img_array = array();
2067
+	$curImages = geodir_get_images($post_id);
2068
+	$place_img_array = array();
2069 2069
 
2070
-    if (!empty($curImages)):
2071
-        foreach ($curImages as $p_img):
2072
-            $place_img_array[] = $p_img->src;
2073
-        endforeach;
2074
-    endif;
2070
+	if (!empty($curImages)):
2071
+		foreach ($curImages as $p_img):
2072
+			$place_img_array[] = $p_img->src;
2073
+		endforeach;
2074
+	endif;
2075 2075
 
2076
-    if (!empty($place_img_array))
2077
-        $curImages = implode(',', $place_img_array);
2076
+	if (!empty($place_img_array))
2077
+		$curImages = implode(',', $place_img_array);
2078 2078
 
2079 2079
 
2080
-    // adjust values here
2081
-    $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2080
+	// adjust values here
2081
+	$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2082 2082
 
2083
-    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2083
+	$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2084 2084
 
2085
-    $multiple = true; // allow multiple files upload
2085
+	$multiple = true; // allow multiple files upload
2086 2086
 
2087
-    $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2087
+	$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2088 2088
 
2089
-    $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2089
+	$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2090 2090
 
2091
-    ?>
2091
+	?>
2092 2092
 
2093 2093
     <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;">
2094 2094
         <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/>
@@ -2130,13 +2130,13 @@  discard block
 block discarded – undo
2130 2130
  */
2131 2131
 function geodir_action_post_updated($post_ID, $post_after, $post_before)
2132 2132
 {
2133
-    $post_type = get_post_type($post_ID);
2133
+	$post_type = get_post_type($post_ID);
2134 2134
 
2135
-    if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2136
-        if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
2137
-            geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2138
-        }
2139
-    }
2135
+	if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2136
+		if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
2137
+			geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2138
+		}
2139
+	}
2140 2140
 }
2141 2141
 
2142 2142
 /**
@@ -2151,39 +2151,39 @@  discard block
 block discarded – undo
2151 2151
  */
2152 2152
 function geodir_notification_add_bcc_option($settings)
2153 2153
 {
2154
-    if (!empty($settings)) {
2155
-        $new_settings = array();
2156
-        foreach ($settings as $setting) {
2157
-            if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2158
-                $geodir_bcc_listing_published_yes = array(
2159
-                    'name' => __('Listing published', 'geodirectory'),
2160
-                    'desc' => __('Yes', 'geodirectory'),
2161
-                    'id' => 'geodir_bcc_listing_published',
2162
-                    'std' => 'yes',
2163
-                    'type' => 'radio',
2164
-                    'value' => '1',
2165
-                    'radiogroup' => 'start'
2166
-                );
2167
-
2168
-                $geodir_bcc_listing_published_no = array(
2169
-                    'name' => __('Listing published', 'geodirectory'),
2170
-                    'desc' => __('No', 'geodirectory'),
2171
-                    'id' => 'geodir_bcc_listing_published',
2172
-                    'std' => 'yes',
2173
-                    'type' => 'radio',
2174
-                    'value' => '0',
2175
-                    'radiogroup' => 'end'
2176
-                );
2177
-
2178
-                $new_settings[] = $geodir_bcc_listing_published_yes;
2179
-                $new_settings[] = $geodir_bcc_listing_published_no;
2180
-            }
2181
-            $new_settings[] = $setting;
2182
-        }
2183
-        $settings = $new_settings;
2184
-    }
2154
+	if (!empty($settings)) {
2155
+		$new_settings = array();
2156
+		foreach ($settings as $setting) {
2157
+			if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2158
+				$geodir_bcc_listing_published_yes = array(
2159
+					'name' => __('Listing published', 'geodirectory'),
2160
+					'desc' => __('Yes', 'geodirectory'),
2161
+					'id' => 'geodir_bcc_listing_published',
2162
+					'std' => 'yes',
2163
+					'type' => 'radio',
2164
+					'value' => '1',
2165
+					'radiogroup' => 'start'
2166
+				);
2167
+
2168
+				$geodir_bcc_listing_published_no = array(
2169
+					'name' => __('Listing published', 'geodirectory'),
2170
+					'desc' => __('No', 'geodirectory'),
2171
+					'id' => 'geodir_bcc_listing_published',
2172
+					'std' => 'yes',
2173
+					'type' => 'radio',
2174
+					'value' => '0',
2175
+					'radiogroup' => 'end'
2176
+				);
2177
+
2178
+				$new_settings[] = $geodir_bcc_listing_published_yes;
2179
+				$new_settings[] = $geodir_bcc_listing_published_no;
2180
+			}
2181
+			$new_settings[] = $setting;
2182
+		}
2183
+		$settings = $new_settings;
2184
+	}
2185 2185
 
2186
-    return $settings;
2186
+	return $settings;
2187 2187
 }
2188 2188
 
2189 2189
 
@@ -2198,19 +2198,19 @@  discard block
 block discarded – undo
2198 2198
  */
2199 2199
 function get_gd_theme_compat_callback()
2200 2200
 {
2201
-    global $wpdb;
2202
-    $themes = get_option('gd_theme_compats');
2203
-
2204
-    if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2205
-        if (isset($_POST['export'])) {
2206
-            echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2207
-        } else {
2208
-            echo json_encode($themes[$_POST['theme']]);
2209
-        }
2201
+	global $wpdb;
2202
+	$themes = get_option('gd_theme_compats');
2210 2203
 
2211
-    }
2204
+	if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2205
+		if (isset($_POST['export'])) {
2206
+			echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2207
+		} else {
2208
+			echo json_encode($themes[$_POST['theme']]);
2209
+		}
2210
+
2211
+	}
2212 2212
 
2213
-    die();
2213
+	die();
2214 2214
 }
2215 2215
 
2216 2216
 add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
@@ -2224,20 +2224,20 @@  discard block
 block discarded – undo
2224 2224
  */
2225 2225
 function get_gd_theme_compat_import_callback()
2226 2226
 {
2227
-    global $wpdb;
2228
-    $themes = get_option('gd_theme_compats');
2229
-    if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2230
-        $json = json_decode(stripslashes($_POST['theme']), true);
2231
-        if (!empty($json) && is_array($json)) {
2232
-            $key = sanitize_text_field(key($json));
2233
-            $themes[$key] = $json[$key];
2234
-            update_option('gd_theme_compats', $themes);
2235
-            echo $key;
2236
-            die();
2237
-        }
2238
-    }
2239
-    echo '0';
2240
-    die();
2227
+	global $wpdb;
2228
+	$themes = get_option('gd_theme_compats');
2229
+	if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2230
+		$json = json_decode(stripslashes($_POST['theme']), true);
2231
+		if (!empty($json) && is_array($json)) {
2232
+			$key = sanitize_text_field(key($json));
2233
+			$themes[$key] = $json[$key];
2234
+			update_option('gd_theme_compats', $themes);
2235
+			echo $key;
2236
+			die();
2237
+		}
2238
+	}
2239
+	echo '0';
2240
+	die();
2241 2241
 }
2242 2242
 
2243 2243
 
@@ -2250,39 +2250,39 @@  discard block
 block discarded – undo
2250 2250
  */
2251 2251
 function gd_set_theme_compat()
2252 2252
 {
2253
-    global $wpdb;
2254
-    $theme = wp_get_theme();
2253
+	global $wpdb;
2254
+	$theme = wp_get_theme();
2255 2255
 
2256
-    if ($theme->parent()) {
2257
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2258
-    } else {
2259
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
2260
-    }
2256
+	if ($theme->parent()) {
2257
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2258
+	} else {
2259
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
2260
+	}
2261 2261
 
2262
-    $theme_compats = get_option('gd_theme_compats');
2263
-    $current_compat = get_option('gd_theme_compat');
2264
-    $current_compat = str_replace("_custom", "", $current_compat);
2262
+	$theme_compats = get_option('gd_theme_compats');
2263
+	$current_compat = get_option('gd_theme_compat');
2264
+	$current_compat = str_replace("_custom", "", $current_compat);
2265 2265
 
2266
-    if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2267
-        return;
2268
-    }// if already running corect compat then bail
2266
+	if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2267
+		return;
2268
+	}// if already running corect compat then bail
2269 2269
 
2270
-    if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2271
-        update_option('gd_theme_compat', $theme_name);
2272
-        update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2270
+	if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2271
+		update_option('gd_theme_compat', $theme_name);
2272
+		update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2273 2273
 
2274
-        // if there are default options to set then set them
2275
-        if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2274
+		// if there are default options to set then set them
2275
+		if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2276 2276
 
2277
-            foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2278
-                update_option($key, $val);
2279
-            }
2280
-        }
2277
+			foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2278
+				update_option($key, $val);
2279
+			}
2280
+		}
2281 2281
 
2282
-    } else {
2283
-        update_option('gd_theme_compat', '');
2284
-        update_option('theme_compatibility_setting', '');
2285
-    }
2282
+	} else {
2283
+		update_option('gd_theme_compat', '');
2284
+		update_option('theme_compatibility_setting', '');
2285
+	}
2286 2286
 
2287 2287
 
2288 2288
 }
@@ -2297,9 +2297,9 @@  discard block
 block discarded – undo
2297 2297
  */
2298 2298
 function gd_check_avada_compat()
2299 2299
 {
2300
-    if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2301
-        add_action('admin_notices', 'gd_avada_compat_warning');
2302
-    }
2300
+	if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2301
+		add_action('admin_notices', 'gd_avada_compat_warning');
2302
+	}
2303 2303
 }
2304 2304
 
2305 2305
 
@@ -2312,22 +2312,22 @@  discard block
 block discarded – undo
2312 2312
 function gd_avada_compat_warning()
2313 2313
 {
2314 2314
 
2315
-    /*
2315
+	/*
2316 2316
     $msg_type = error
2317 2317
     $msg_type = updated fade
2318 2318
     $msg_type = update-nag
2319 2319
     */
2320 2320
 
2321
-    $plugin = 'avada-nag';
2322
-    $timestamp = 'avada-nag1234';
2323
-    $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2324
-    echo '<div id="' . $timestamp . '"  class="error">';
2325
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2326
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2327
-    echo "<p>$message</p>";
2328
-    echo "</div>";
2321
+	$plugin = 'avada-nag';
2322
+	$timestamp = 'avada-nag1234';
2323
+	$message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2324
+	echo '<div id="' . $timestamp . '"  class="error">';
2325
+	echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2326
+	echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2327
+	echo "<p>$message</p>";
2328
+	echo "</div>";
2329 2329
 
2330
-    ?>
2330
+	?>
2331 2331
     <script>
2332 2332
         function gdRemoveANotification($plugin, $timestamp) {
2333 2333
 
@@ -2395,10 +2395,10 @@  discard block
 block discarded – undo
2395 2395
  */
2396 2396
 function geodir_avada_remove_notification()
2397 2397
 {
2398
-    update_option('avada_nag', TRUE);
2398
+	update_option('avada_nag', TRUE);
2399 2399
 
2400
-    // Always die in functions echoing ajax content
2401
-    die();
2400
+	// Always die in functions echoing ajax content
2401
+	die();
2402 2402
 }
2403 2403
 
2404 2404
 
@@ -2457,7 +2457,7 @@  discard block
 block discarded – undo
2457 2457
 		// Don't allow same slug url for listing and location
2458 2458
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2459 2459
 			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2460
-        	wp_redirect($redirect_url);
2460
+			wp_redirect($redirect_url);
2461 2461
 			exit;
2462 2462
 		}
2463 2463
 		
@@ -2487,10 +2487,10 @@  discard block
 block discarded – undo
2487 2487
  * @package GeoDirectory
2488 2488
  */
2489 2489
 function geodir_hide_admin_preview_button() {
2490
-    global $post_type;
2491
-    $post_types = geodir_get_posttypes();
2492
-    if(in_array($post_type, $post_types))
2493
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2490
+	global $post_type;
2491
+	$post_types = geodir_get_posttypes();
2492
+	if(in_array($post_type, $post_types))
2493
+		echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2494 2494
 }
2495 2495
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2496 2496
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
  */
2506 2506
 function geodir_import_export_tab( $tabs ) {
2507 2507
 	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2508
-    return $tabs;
2508
+	return $tabs;
2509 2509
 }
2510 2510
 
2511 2511
 /**
@@ -2520,26 +2520,26 @@  discard block
 block discarded – undo
2520 2520
 function geodir_import_export_page() {
2521 2521
 	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2522 2522
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2523
-    /**
2524
-     * Filter sample category data csv file url.
2525
-     *
2526
-     * @since 1.0.0
2527
-     * @package GeoDirectory
2528
-     *
2529
-     * @param string $gd_cats_sample_csv Sample category data csv file url.
2530
-     */
2523
+	/**
2524
+	 * Filter sample category data csv file url.
2525
+	 *
2526
+	 * @since 1.0.0
2527
+	 * @package GeoDirectory
2528
+	 *
2529
+	 * @param string $gd_cats_sample_csv Sample category data csv file url.
2530
+	 */
2531 2531
 	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2532 2532
 	
2533 2533
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2534
-    /**
2535
-     * Filter sample post data csv file url.
2536
-     *
2537
-     * @since 1.0.0
2538
-     * @package GeoDirectory
2539
-     *
2540
-     * @param string $gd_posts_sample_csv Sample post data csv file url.
2541
-     */
2542
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2534
+	/**
2535
+	 * Filter sample post data csv file url.
2536
+	 *
2537
+	 * @since 1.0.0
2538
+	 * @package GeoDirectory
2539
+	 *
2540
+	 * @param string $gd_posts_sample_csv Sample post data csv file url.
2541
+	 */
2542
+	$gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2543 2543
 	
2544 2544
 	$gd_posttypes = geodir_get_posttypes( 'array' );
2545 2545
 	
@@ -2562,14 +2562,14 @@  discard block
 block discarded – undo
2562 2562
 	$gd_chunksize_options[100000] = 100000;
2563 2563
 	 
2564 2564
 	 /**
2565
-     * Filter max entries per export csv file.
2566
-     *
2567
-     * @since 1.5.6
2568
-     * @package GeoDirectory
2569
-     *
2570
-     * @param string $gd_chunksize_options Entries options.
2571
-     */
2572
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2565
+	  * Filter max entries per export csv file.
2566
+	  *
2567
+	  * @since 1.5.6
2568
+	  * @package GeoDirectory
2569
+	  *
2570
+	  * @param string $gd_chunksize_options Entries options.
2571
+	  */
2572
+	$gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2573 2573
 	
2574 2574
 	$gd_chunksize_option = '';
2575 2575
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2585,12 +2585,12 @@  discard block
 block discarded – undo
2585 2585
   <div class="gd-content-heading">
2586 2586
 
2587 2587
   <?php
2588
-    ini_set('max_execution_time', 999999);
2589
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2590
-    ini_restore('max_execution_time');
2588
+	ini_set('max_execution_time', 999999);
2589
+	$ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2590
+	ini_restore('max_execution_time');
2591 2591
 
2592
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2593
-        ?>
2592
+	if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2593
+		?>
2594 2594
 	<div id="gd_ie_reqs" class="metabox-holder">
2595 2595
       <div class="meta-box-sortables ui-sortable">
2596 2596
         <div class="postbox">
@@ -2759,7 +2759,7 @@  discard block
 block discarded – undo
2759 2759
 						 * Called just after the sample CSV download link.
2760 2760
 						 *
2761 2761
 						 * @since 1.0.0
2762
-                         * @package GeoDirectory
2762
+						 * @package GeoDirectory
2763 2763
 						 */
2764 2764
 						do_action('geodir_sample_cats_csv_download_link');
2765 2765
 						?>
@@ -2844,11 +2844,11 @@  discard block
 block discarded – undo
2844 2844
 	 *
2845 2845
 	 * Called after the last setting on the GD > Import & Export page.
2846 2846
 	 * @since 1.4.6
2847
-     * @package GeoDirectory
2847
+	 * @package GeoDirectory
2848 2848
 	 *
2849 2849
 	 * @param array $gd_posttypes GD post types.
2850
-     * @param array $gd_chunksize_options File chunk size options.
2851
-     * @param string $nonce Wordpress security token for GD import & export.
2850
+	 * @param array $gd_chunksize_options File chunk size options.
2851
+	 * @param string $nonce Wordpress security token for GD import & export.
2852 2852
 	 */
2853 2853
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2854 2854
 	?>
@@ -3513,44 +3513,44 @@  discard block
 block discarded – undo
3513 3513
 function geodir_init_filesystem()
3514 3514
 {
3515 3515
 
3516
-    if(!function_exists('get_filesystem_method')){
3517
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3518
-    }
3519
-    $access_type = get_filesystem_method();
3520
-    if ($access_type === 'direct') {
3521
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3522
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3523
-
3524
-        /* initialize the API */
3525
-        if (!WP_Filesystem($creds)) {
3526
-            /* any problems and we exit */
3527
-            //return '@@@3';
3528
-            return false;
3529
-        }
3530
-
3531
-        global $wp_filesystem;
3532
-        return $wp_filesystem;
3533
-        /* do our file manipulations below */
3534
-    } elseif (defined('FTP_USER')) {
3535
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3516
+	if(!function_exists('get_filesystem_method')){
3517
+		require_once(ABSPATH."/wp-admin/includes/file.php");
3518
+	}
3519
+	$access_type = get_filesystem_method();
3520
+	if ($access_type === 'direct') {
3521
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3522
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3523
+
3524
+		/* initialize the API */
3525
+		if (!WP_Filesystem($creds)) {
3526
+			/* any problems and we exit */
3527
+			//return '@@@3';
3528
+			return false;
3529
+		}
3536 3530
 
3537
-        /* initialize the API */
3538
-        if (!WP_Filesystem($creds)) {
3539
-            /* any problems and we exit */
3540
-            //return '@@@33';
3541
-            return false;
3542
-        }
3531
+		global $wp_filesystem;
3532
+		return $wp_filesystem;
3533
+		/* do our file manipulations below */
3534
+	} elseif (defined('FTP_USER')) {
3535
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3536
+
3537
+		/* initialize the API */
3538
+		if (!WP_Filesystem($creds)) {
3539
+			/* any problems and we exit */
3540
+			//return '@@@33';
3541
+			return false;
3542
+		}
3543 3543
 
3544
-        global $wp_filesystem;
3545
-        //return '@@@1';
3546
-        return $wp_filesystem;
3544
+		global $wp_filesystem;
3545
+		//return '@@@1';
3546
+		return $wp_filesystem;
3547 3547
 
3548
-    } else {
3549
-        //return '@@@2';
3550
-        /* don't have direct write access. Prompt user with our notice */
3551
-        add_action('admin_notice', 'geodir_filesystem_notice');
3552
-        return false;
3553
-    }
3548
+	} else {
3549
+		//return '@@@2';
3550
+		/* don't have direct write access. Prompt user with our notice */
3551
+		add_action('admin_notice', 'geodir_filesystem_notice');
3552
+		return false;
3553
+	}
3554 3554
 
3555 3555
 }
3556 3556
 
@@ -3568,10 +3568,10 @@  discard block
 block discarded – undo
3568 3568
  */
3569 3569
 function geodir_filesystem_notice()
3570 3570
 {   if ( defined( 'DOING_AJAX' ) ){return;}
3571
-    $access_type = get_filesystem_method();
3572
-    if ($access_type === 'direct') {
3573
-    } elseif (!defined('FTP_USER')) {
3574
-        ?>
3571
+	$access_type = get_filesystem_method();
3572
+	if ($access_type === 'direct') {
3573
+	} elseif (!defined('FTP_USER')) {
3574
+		?>
3575 3575
         <div class="error">
3576 3576
             <p><?php _e('GeoDirectory does not have access to your filesystem, thing like import/export will not work. Please define your details in wp-config.php as explained here', 'geodirectory'); ?>
3577 3577
                 <a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants</a>
@@ -3597,1448 +3597,1448 @@  discard block
 block discarded – undo
3597 3597
  * @return string Json data.
3598 3598
  */
3599 3599
 function geodir_ajax_import_export() {
3600
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3600
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3601 3601
     
3602
-    error_reporting(0);
3602
+	error_reporting(0);
3603 3603
 
3604
-    // try to set higher limits for import
3605
-    $max_input_time = ini_get('max_input_time');
3606
-    $max_execution_time = ini_get('max_execution_time');
3607
-    $memory_limit= ini_get('memory_limit');
3604
+	// try to set higher limits for import
3605
+	$max_input_time = ini_get('max_input_time');
3606
+	$max_execution_time = ini_get('max_execution_time');
3607
+	$memory_limit= ini_get('memory_limit');
3608 3608
 
3609
-    if(!$max_input_time || $max_input_time<3000){
3610
-        ini_set('max_input_time', 3000);
3611
-    }
3609
+	if(!$max_input_time || $max_input_time<3000){
3610
+		ini_set('max_input_time', 3000);
3611
+	}
3612 3612
 
3613
-    if(!$max_execution_time || $max_execution_time<3000){
3614
-        ini_set('max_execution_time', 3000);
3615
-    }
3613
+	if(!$max_execution_time || $max_execution_time<3000){
3614
+		ini_set('max_execution_time', 3000);
3615
+	}
3616 3616
 
3617
-    if($memory_limit && str_replace('M','',$memory_limit)){
3618
-        if(str_replace('M','',$memory_limit)<256){
3619
-            ini_set('memory_limit', '256M');
3620
-        }
3621
-    }
3617
+	if($memory_limit && str_replace('M','',$memory_limit)){
3618
+		if(str_replace('M','',$memory_limit)<256){
3619
+			ini_set('memory_limit', '256M');
3620
+		}
3621
+	}
3622 3622
 
3623
-    $json = array();
3623
+	$json = array();
3624 3624
 
3625
-    if ( !current_user_can( 'manage_options' ) ) {
3626
-        wp_send_json( $json );
3627
-    }
3625
+	if ( !current_user_can( 'manage_options' ) ) {
3626
+		wp_send_json( $json );
3627
+	}
3628 3628
 
3629
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3630
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3631
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3629
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3630
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3631
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3632 3632
 
3633
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3634
-        wp_send_json( $json );
3635
-    }
3633
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3634
+		wp_send_json( $json );
3635
+	}
3636 3636
 
3637
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3638
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3639
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3640
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3637
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3638
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3639
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3640
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3641 3641
 
3642
-    $wp_filesystem = geodir_init_filesystem();
3643
-    if (!$wp_filesystem) {
3644
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3645
-        wp_send_json( $json );
3646
-    }
3642
+	$wp_filesystem = geodir_init_filesystem();
3643
+	if (!$wp_filesystem) {
3644
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3645
+		wp_send_json( $json );
3646
+	}
3647 3647
 
3648
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3649
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3650
-        wp_send_json( $json );
3651
-    }
3648
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3649
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3650
+		wp_send_json( $json );
3651
+	}
3652 3652
 
3653
-    $csv_file_dir = geodir_path_import_export( false );
3654
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3655
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3656
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3657
-            wp_send_json( $json );
3658
-        }
3659
-    }
3653
+	$csv_file_dir = geodir_path_import_export( false );
3654
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3655
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3656
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3657
+			wp_send_json( $json );
3658
+		}
3659
+	}
3660 3660
     
3661
-    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3662
-    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3663
-
3664
-    switch ( $task ) {
3665
-        case 'export_posts': {
3666
-            // WPML
3667
-            $is_wpml = geodir_is_wpml();
3668
-            if ($is_wpml) {
3669
-                global $sitepress;
3670
-                $active_lang = ICL_LANGUAGE_CODE;
3661
+	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3662
+	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3663
+
3664
+	switch ( $task ) {
3665
+		case 'export_posts': {
3666
+			// WPML
3667
+			$is_wpml = geodir_is_wpml();
3668
+			if ($is_wpml) {
3669
+				global $sitepress;
3670
+				$active_lang = ICL_LANGUAGE_CODE;
3671 3671
                 
3672
-                $sitepress->switch_lang('all', true);
3673
-            }
3674
-            // WPML
3675
-            if ( $post_type == 'gd_event' ) {
3676
-                //add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 );
3677
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3678
-            }
3679
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3680
-            $posts_count = geodir_get_posts_count( $post_type );
3681
-            $file_url_base = geodir_path_import_export() . '/';
3682
-            $file_url = $file_url_base . $file_name . '.csv';
3683
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3684
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3672
+				$sitepress->switch_lang('all', true);
3673
+			}
3674
+			// WPML
3675
+			if ( $post_type == 'gd_event' ) {
3676
+				//add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 );
3677
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3678
+			}
3679
+			$file_name = $post_type . '_' . date( 'dmyHi' );
3680
+			$posts_count = geodir_get_posts_count( $post_type );
3681
+			$file_url_base = geodir_path_import_export() . '/';
3682
+			$file_url = $file_url_base . $file_name . '.csv';
3683
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3684
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3685 3685
             
3686
-            $chunk_file_paths = array();
3686
+			$chunk_file_paths = array();
3687 3687
 
3688
-            if ( isset( $_REQUEST['_st'] ) ) {
3689
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3690
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3691
-                $percentage = min( $percentage, 100 );
3688
+			if ( isset( $_REQUEST['_st'] ) ) {
3689
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3690
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3691
+				$percentage = min( $percentage, 100 );
3692 3692
                 
3693
-                $json['percentage'] = $percentage;
3694
-                // WPML
3695
-                if ($is_wpml) {
3696
-                    $sitepress->switch_lang($active_lang, true);
3697
-                }
3698
-                // WPML
3699
-                wp_send_json( $json );
3700
-                exit;
3701
-            } else {
3702
-                if ( !$posts_count > 0 ) {
3703
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3704
-                } else {
3705
-                    $total_posts = $posts_count;
3706
-                    if ($chunk_per_page > $total_posts) {
3707
-                        $chunk_per_page = $total_posts;
3708
-                    }
3709
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3693
+				$json['percentage'] = $percentage;
3694
+				// WPML
3695
+				if ($is_wpml) {
3696
+					$sitepress->switch_lang($active_lang, true);
3697
+				}
3698
+				// WPML
3699
+				wp_send_json( $json );
3700
+				exit;
3701
+			} else {
3702
+				if ( !$posts_count > 0 ) {
3703
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3704
+				} else {
3705
+					$total_posts = $posts_count;
3706
+					if ($chunk_per_page > $total_posts) {
3707
+						$chunk_per_page = $total_posts;
3708
+					}
3709
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3710 3710
                     
3711
-                    $j = $chunk_page_no;
3712
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3711
+					$j = $chunk_page_no;
3712
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3713 3713
                     
3714
-                    $per_page = 500;
3715
-                    if ($per_page > $chunk_per_page) {
3716
-                        $per_page = $chunk_per_page;
3717
-                    }
3718
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3714
+					$per_page = 500;
3715
+					if ($per_page > $chunk_per_page) {
3716
+						$per_page = $chunk_per_page;
3717
+					}
3718
+					$total_pages = ceil( $chunk_per_page / $per_page );
3719 3719
                     
3720
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3721
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3720
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3721
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3722 3722
                         
3723
-                        $clear = $i == 0 ? true : false;
3724
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3725
-                    }
3723
+						$clear = $i == 0 ? true : false;
3724
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3725
+					}
3726 3726
                         
3727
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3728
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3729
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3730
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3731
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3727
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3728
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3729
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3730
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3731
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3732 3732
                         
3733
-                        $file_url = $file_url_base . $chunk_file_name;
3734
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3735
-                    }
3733
+						$file_url = $file_url_base . $chunk_file_name;
3734
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3735
+					}
3736 3736
                     
3737
-                    if ( !empty($chunk_file_paths) ) {
3738
-                        $json['total'] = $posts_count;
3739
-                        $json['files'] = $chunk_file_paths;
3740
-                    } else {
3741
-                        if ($j > 1) {
3742
-                            $json['total'] = $items_count;
3743
-                            $json['files'] = array();
3744
-                        } else {
3745
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3746
-                        }
3747
-                    }
3748
-                }
3749
-                // WPML
3750
-                if ($is_wpml) {
3751
-                    $sitepress->switch_lang($active_lang, true);
3752
-                }
3753
-                // WPML
3754
-                wp_send_json( $json );
3755
-            }
3756
-        }
3757
-        break;
3758
-        case 'export_cats': {
3759
-            // WPML
3760
-            $is_wpml = geodir_is_wpml();
3761
-            if ($is_wpml) {
3762
-                global $sitepress;
3763
-                $active_lang = ICL_LANGUAGE_CODE;
3737
+					if ( !empty($chunk_file_paths) ) {
3738
+						$json['total'] = $posts_count;
3739
+						$json['files'] = $chunk_file_paths;
3740
+					} else {
3741
+						if ($j > 1) {
3742
+							$json['total'] = $items_count;
3743
+							$json['files'] = array();
3744
+						} else {
3745
+							$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3746
+						}
3747
+					}
3748
+				}
3749
+				// WPML
3750
+				if ($is_wpml) {
3751
+					$sitepress->switch_lang($active_lang, true);
3752
+				}
3753
+				// WPML
3754
+				wp_send_json( $json );
3755
+			}
3756
+		}
3757
+		break;
3758
+		case 'export_cats': {
3759
+			// WPML
3760
+			$is_wpml = geodir_is_wpml();
3761
+			if ($is_wpml) {
3762
+				global $sitepress;
3763
+				$active_lang = ICL_LANGUAGE_CODE;
3764 3764
                 
3765
-                $sitepress->switch_lang('all', true);
3766
-            }
3767
-            // WPML
3768
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3765
+				$sitepress->switch_lang('all', true);
3766
+			}
3767
+			// WPML
3768
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
3769 3769
             
3770
-            $terms_count = geodir_get_terms_count( $post_type );
3771
-            $file_url_base = geodir_path_import_export() . '/';
3772
-            $file_url = $file_url_base . $file_name . '.csv';
3773
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3774
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3770
+			$terms_count = geodir_get_terms_count( $post_type );
3771
+			$file_url_base = geodir_path_import_export() . '/';
3772
+			$file_url = $file_url_base . $file_name . '.csv';
3773
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3774
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3775 3775
             
3776
-            $chunk_file_paths = array();
3776
+			$chunk_file_paths = array();
3777 3777
             
3778
-            if ( isset( $_REQUEST['_st'] ) ) {
3779
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3780
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3781
-                $percentage = min( $percentage, 100 );
3778
+			if ( isset( $_REQUEST['_st'] ) ) {
3779
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3780
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3781
+				$percentage = min( $percentage, 100 );
3782 3782
                 
3783
-                $json['percentage'] = $percentage;
3784
-                // WPML
3785
-                if ($is_wpml) {
3786
-                    $sitepress->switch_lang($active_lang, true);
3787
-                }
3788
-                // WPML
3789
-                wp_send_json( $json );
3790
-            } else {
3791
-                if ( !$terms_count > 0 ) {
3792
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3793
-                } else {
3794
-                    $total_terms = $terms_count;
3795
-                    if ($chunk_per_page > $terms_count) {
3796
-                        $chunk_per_page = $terms_count;
3797
-                    }
3798
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3783
+				$json['percentage'] = $percentage;
3784
+				// WPML
3785
+				if ($is_wpml) {
3786
+					$sitepress->switch_lang($active_lang, true);
3787
+				}
3788
+				// WPML
3789
+				wp_send_json( $json );
3790
+			} else {
3791
+				if ( !$terms_count > 0 ) {
3792
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3793
+				} else {
3794
+					$total_terms = $terms_count;
3795
+					if ($chunk_per_page > $terms_count) {
3796
+						$chunk_per_page = $terms_count;
3797
+					}
3798
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3799 3799
                     
3800
-                    $j = $chunk_page_no;
3801
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3800
+					$j = $chunk_page_no;
3801
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3802 3802
                     
3803
-                    $per_page = 500;
3804
-                    if ($per_page > $chunk_per_page) {
3805
-                        $per_page = $chunk_per_page;
3806
-                    }
3807
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3803
+					$per_page = 500;
3804
+					if ($per_page > $chunk_per_page) {
3805
+						$per_page = $chunk_per_page;
3806
+					}
3807
+					$total_pages = ceil( $chunk_per_page / $per_page );
3808 3808
                     
3809
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3810
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3809
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3810
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3811 3811
                         
3812
-                        $clear = $i == 0 ? true : false;
3813
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3814
-                    }
3812
+						$clear = $i == 0 ? true : false;
3813
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3814
+					}
3815 3815
                     
3816
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3817
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3818
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3819
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3820
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3816
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3817
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3818
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3819
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3820
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3821 3821
                         
3822
-                        $file_url = $file_url_base . $chunk_file_name;
3823
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3824
-                    }
3822
+						$file_url = $file_url_base . $chunk_file_name;
3823
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3824
+					}
3825 3825
                     
3826
-                    if ( !empty($chunk_file_paths) ) {
3827
-                        $json['total'] = $terms_count;
3828
-                        $json['files'] = $chunk_file_paths;
3829
-                    } else {
3830
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3831
-                    }
3832
-                }
3833
-                // WPML
3834
-                if ($is_wpml) {
3835
-                    $sitepress->switch_lang($active_lang, true);
3836
-                }
3837
-                // WPML
3838
-                wp_send_json( $json );
3839
-            }
3840
-        }
3841
-        break;
3842
-        case 'export_locations': {
3843
-            $file_url_base = geodir_path_import_export() . '/';
3844
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3845
-            $file_url = $file_url_base . $file_name . '.csv';
3846
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3847
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3826
+					if ( !empty($chunk_file_paths) ) {
3827
+						$json['total'] = $terms_count;
3828
+						$json['files'] = $chunk_file_paths;
3829
+					} else {
3830
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3831
+					}
3832
+				}
3833
+				// WPML
3834
+				if ($is_wpml) {
3835
+					$sitepress->switch_lang($active_lang, true);
3836
+				}
3837
+				// WPML
3838
+				wp_send_json( $json );
3839
+			}
3840
+		}
3841
+		break;
3842
+		case 'export_locations': {
3843
+			$file_url_base = geodir_path_import_export() . '/';
3844
+			$file_name = 'gd_locations_' . date( 'dmyHi' );
3845
+			$file_url = $file_url_base . $file_name . '.csv';
3846
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3847
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3848 3848
             
3849
-            $items_count = (int)geodir_location_imex_count_locations();
3849
+			$items_count = (int)geodir_location_imex_count_locations();
3850 3850
             
3851
-            if ( isset( $_REQUEST['_st'] ) ) {
3852
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3853
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3854
-                $percentage = min( $percentage, 100 );
3851
+			if ( isset( $_REQUEST['_st'] ) ) {
3852
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3853
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3854
+				$percentage = min( $percentage, 100 );
3855 3855
                 
3856
-                $json['percentage'] = $percentage;
3857
-                wp_send_json( $json );
3858
-            } else {
3859
-                $chunk_file_paths = array();
3856
+				$json['percentage'] = $percentage;
3857
+				wp_send_json( $json );
3858
+			} else {
3859
+				$chunk_file_paths = array();
3860 3860
                 
3861
-                if ( !$items_count > 0 ) {
3862
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3863
-                } else {
3864
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3865
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3861
+				if ( !$items_count > 0 ) {
3862
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3863
+				} else {
3864
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3865
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3866 3866
                     
3867
-                    $j = $chunk_page_no;
3868
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3867
+					$j = $chunk_page_no;
3868
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3869 3869
                     
3870
-                    $per_page = 500;
3871
-                    $per_page = min( $per_page, $chunk_per_page );
3872
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3870
+					$per_page = 500;
3871
+					$per_page = min( $per_page, $chunk_per_page );
3872
+					$total_pages = ceil( $chunk_per_page / $per_page );
3873 3873
                     
3874
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3875
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3874
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3875
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3876 3876
                         
3877
-                        $clear = $i == 0 ? true : false;
3878
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3879
-                    }
3877
+						$clear = $i == 0 ? true : false;
3878
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3879
+					}
3880 3880
                     
3881
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3882
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3883
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3884
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3885
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3881
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3882
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3883
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3884
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3885
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3886 3886
                         
3887
-                        $file_url = $file_url_base . $chunk_file_name;
3888
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3889
-                    }
3887
+						$file_url = $file_url_base . $chunk_file_name;
3888
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3889
+					}
3890 3890
                     
3891
-                    if ( !empty($chunk_file_paths) ) {
3892
-                        $json['total'] = $items_count;
3893
-                        $json['files'] = $chunk_file_paths;
3894
-                    } else {
3895
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3896
-                    }
3897
-                }
3898
-                wp_send_json( $json );
3899
-            }
3900
-        }
3901
-        break;
3902
-        case 'export_hoods': {
3903
-            $file_url_base = geodir_path_import_export() . '/';
3904
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3905
-            $file_url = $file_url_base . $file_name . '.csv';
3906
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3907
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3891
+					if ( !empty($chunk_file_paths) ) {
3892
+						$json['total'] = $items_count;
3893
+						$json['files'] = $chunk_file_paths;
3894
+					} else {
3895
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3896
+					}
3897
+				}
3898
+				wp_send_json( $json );
3899
+			}
3900
+		}
3901
+		break;
3902
+		case 'export_hoods': {
3903
+			$file_url_base = geodir_path_import_export() . '/';
3904
+			$file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3905
+			$file_url = $file_url_base . $file_name . '.csv';
3906
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3907
+			$file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3908 3908
             
3909
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3909
+			$items_count = (int)geodir_location_imex_count_neighbourhoods();
3910 3910
             
3911
-            if ( isset( $_REQUEST['_st'] ) ) {
3912
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3913
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3914
-                $percentage = min( $percentage, 100 );
3911
+			if ( isset( $_REQUEST['_st'] ) ) {
3912
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3913
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3914
+				$percentage = min( $percentage, 100 );
3915 3915
                 
3916
-                $json['percentage'] = $percentage;
3917
-                wp_send_json( $json );
3918
-            } else {
3919
-                $chunk_file_paths = array();
3916
+				$json['percentage'] = $percentage;
3917
+				wp_send_json( $json );
3918
+			} else {
3919
+				$chunk_file_paths = array();
3920 3920
                 
3921
-                if ( !$items_count > 0 ) {
3922
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3923
-                } else {
3924
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3925
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3921
+				if ( !$items_count > 0 ) {
3922
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3923
+				} else {
3924
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3925
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3926 3926
                     
3927
-                    $j = $chunk_page_no;
3928
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3927
+					$j = $chunk_page_no;
3928
+					$chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3929 3929
                     
3930
-                    $per_page = 500;
3931
-                    $per_page = min( $per_page, $chunk_per_page );
3932
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3930
+					$per_page = 500;
3931
+					$per_page = min( $per_page, $chunk_per_page );
3932
+					$total_pages = ceil( $chunk_per_page / $per_page );
3933 3933
                     
3934
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3935
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3934
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3935
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3936 3936
                         
3937
-                        $clear = $i == 0 ? true : false;
3938
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3939
-                    }
3937
+						$clear = $i == 0 ? true : false;
3938
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3939
+					}
3940 3940
                     
3941
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3942
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3943
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3944
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3945
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3941
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3942
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3943
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3944
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3945
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3946 3946
                         
3947
-                        $file_url = $file_url_base . $chunk_file_name;
3948
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3949
-                    }
3947
+						$file_url = $file_url_base . $chunk_file_name;
3948
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3949
+					}
3950 3950
                     
3951
-                    if ( !empty($chunk_file_paths) ) {
3952
-                        $json['total'] = $items_count;
3953
-                        $json['files'] = $chunk_file_paths;
3954
-                    } else {
3955
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3956
-                    }
3957
-                }
3958
-                wp_send_json( $json );
3959
-            }
3960
-        }
3961
-        break;
3962
-        case 'prepare_import':
3963
-        case 'import_cat':
3964
-        case 'import_post':
3965
-        case 'import_loc':
3966
-        case 'import_hood': {
3967
-            // WPML
3968
-            $is_wpml = geodir_is_wpml();
3969
-            if ($is_wpml) {
3970
-                global $sitepress;
3971
-                $active_lang = ICL_LANGUAGE_CODE;
3972
-            }
3973
-            // WPML
3951
+					if ( !empty($chunk_file_paths) ) {
3952
+						$json['total'] = $items_count;
3953
+						$json['files'] = $chunk_file_paths;
3954
+					} else {
3955
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3956
+					}
3957
+				}
3958
+				wp_send_json( $json );
3959
+			}
3960
+		}
3961
+		break;
3962
+		case 'prepare_import':
3963
+		case 'import_cat':
3964
+		case 'import_post':
3965
+		case 'import_loc':
3966
+		case 'import_hood': {
3967
+			// WPML
3968
+			$is_wpml = geodir_is_wpml();
3969
+			if ($is_wpml) {
3970
+				global $sitepress;
3971
+				$active_lang = ICL_LANGUAGE_CODE;
3972
+			}
3973
+			// WPML
3974 3974
             
3975
-            ini_set( 'auto_detect_line_endings', true );
3975
+			ini_set( 'auto_detect_line_endings', true );
3976 3976
             
3977
-            $uploads = wp_upload_dir();
3978
-            $uploads_dir = $uploads['path'];
3979
-            $uploads_subdir = $uploads['subdir'];
3977
+			$uploads = wp_upload_dir();
3978
+			$uploads_dir = $uploads['path'];
3979
+			$uploads_subdir = $uploads['subdir'];
3980 3980
             
3981
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3982
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3981
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3982
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3983 3983
             
3984
-            $csv_file_arr = explode( '/', $csv_file );
3985
-            $csv_filename = end( $csv_file_arr );
3986
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3984
+			$csv_file_arr = explode( '/', $csv_file );
3985
+			$csv_filename = end( $csv_file_arr );
3986
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3987 3987
             
3988
-            $json['file'] = $csv_file;
3989
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3988
+			$json['file'] = $csv_file;
3989
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3990 3990
 
3991
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3992
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3991
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3992
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3993 3993
                 
3994
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3995
-                    $json['error'] = NULL;
3996
-                    $json['rows'] = 0;
3994
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3995
+					$json['error'] = NULL;
3996
+					$json['rows'] = 0;
3997 3997
                     
3998
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3999
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4000
-                            if ( !empty( $data ) ) {
4001
-                                $file[] = $data;
4002
-                            }
4003
-                        }
4004
-                        fclose($handle);
4005
-                    }
3998
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3999
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4000
+							if ( !empty( $data ) ) {
4001
+								$file[] = $data;
4002
+							}
4003
+						}
4004
+						fclose($handle);
4005
+					}
4006 4006
 
4007
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4007
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4008 4008
                     
4009
-                    if (!$json['rows'] > 0) {
4010
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
4011
-                    }
4012
-                } else {
4013
-                    wp_send_json( $json );
4014
-                }
4015
-            } else {
4016
-                wp_send_json( $json );
4017
-            }
4009
+					if (!$json['rows'] > 0) {
4010
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
4011
+					}
4012
+				} else {
4013
+					wp_send_json( $json );
4014
+				}
4015
+			} else {
4016
+				wp_send_json( $json );
4017
+			}
4018 4018
             
4019
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4020
-                wp_send_json( $json );
4021
-            }
4019
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4020
+				wp_send_json( $json );
4021
+			}
4022 4022
             
4023
-            $total = $json['rows'];
4024
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4025
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4023
+			$total = $json['rows'];
4024
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4025
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4026 4026
             
4027
-            $count = $limit;
4028
-            $requested_limit = $limit;
4027
+			$count = $limit;
4028
+			$requested_limit = $limit;
4029 4029
             
4030
-            if ($count < $total) {
4031
-                $count = $processed + $count;
4032
-                if ($count > $total) {
4033
-                    $count = $total;
4034
-                }
4035
-            } else {
4036
-                $count = $total;
4037
-            }
4030
+			if ($count < $total) {
4031
+				$count = $processed + $count;
4032
+				if ($count > $total) {
4033
+					$count = $total;
4034
+				}
4035
+			} else {
4036
+				$count = $total;
4037
+			}
4038 4038
             
4039
-            $created = 0;
4040
-            $updated = 0;
4041
-            $skipped = 0;
4042
-            $invalid = 0;
4043
-            $invalid_addr = 0;
4044
-            $images = 0;
4039
+			$created = 0;
4040
+			$updated = 0;
4041
+			$skipped = 0;
4042
+			$invalid = 0;
4043
+			$invalid_addr = 0;
4044
+			$images = 0;
4045 4045
             
4046
-            $invalid_title = 0;
4047
-            $customKeyarray = array();
4048
-            $gd_post_info = array();
4049
-            $post_location = array();
4050
-            $countpost = 0;
4046
+			$invalid_title = 0;
4047
+			$customKeyarray = array();
4048
+			$gd_post_info = array();
4049
+			$post_location = array();
4050
+			$countpost = 0;
4051 4051
             
4052
-            $post_types = geodir_get_posttypes();
4052
+			$post_types = geodir_get_posttypes();
4053 4053
 
4054
-            if ( $task == 'import_cat' ) {				
4055
-                if (!empty($file)) {
4056
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4054
+			if ( $task == 'import_cat' ) {				
4055
+				if (!empty($file)) {
4056
+					$columns = isset($file[0]) ? $file[0] : NULL;
4057 4057
                     
4058
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4059
-                        $json['error'] = CSV_INVAILD_FILE;
4060
-                        wp_send_json( $json );
4061
-                        exit;
4062
-                    }
4058
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4059
+						$json['error'] = CSV_INVAILD_FILE;
4060
+						wp_send_json( $json );
4061
+						exit;
4062
+					}
4063 4063
                     
4064
-                    for ($i = 1; $i <= $limit; $i++) {
4065
-                        $index = $processed + $i;
4064
+					for ($i = 1; $i <= $limit; $i++) {
4065
+						$index = $processed + $i;
4066 4066
                         
4067
-                        if (isset($file[$index])) {
4068
-                            $row = $file[$index];
4069
-                            $row = array_map( 'trim', $row );
4070
-                            //$row = array_map( 'utf8_encode', $row );
4067
+						if (isset($file[$index])) {
4068
+							$row = $file[$index];
4069
+							$row = array_map( 'trim', $row );
4070
+							//$row = array_map( 'utf8_encode', $row );
4071 4071
                             
4072
-                            $cat_id = '';
4073
-                            $cat_name = '';
4074
-                            $cat_slug = '';
4075
-                            $cat_posttype = '';
4076
-                            $cat_parent = '';
4077
-                            $cat_description = '';
4078
-                            $cat_schema = '';
4079
-                            $cat_top_description = '';
4080
-                            $cat_image = '';
4081
-                            $cat_icon = '';
4082
-                            $cat_language = '';
4072
+							$cat_id = '';
4073
+							$cat_name = '';
4074
+							$cat_slug = '';
4075
+							$cat_posttype = '';
4076
+							$cat_parent = '';
4077
+							$cat_description = '';
4078
+							$cat_schema = '';
4079
+							$cat_top_description = '';
4080
+							$cat_image = '';
4081
+							$cat_icon = '';
4082
+							$cat_language = '';
4083 4083
                             
4084
-                            $c = 0;
4085
-                            foreach ($columns as $column ) {
4086
-                                if ( $column == 'cat_id' ) {
4087
-                                    $cat_id = (int)$row[$c];
4088
-                                } else if ( $column == 'cat_name' ) {
4089
-                                    $cat_name = $row[$c];
4090
-                                } else if ( $column == 'cat_slug' ) {
4091
-                                    $cat_slug = $row[$c];
4092
-                                } else if ( $column == 'cat_posttype' ) {
4093
-                                    $cat_posttype = $row[$c];
4094
-                                } else if ( $column == 'cat_parent' ) {
4095
-                                    $cat_parent = trim($row[$c]);
4096
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4097
-                                    $cat_schema = $row[$c];
4098
-                                } else if ( $column == 'cat_description' ) {
4099
-                                    $cat_description = $row[$c];
4100
-                                } else if ( $column == 'cat_top_description' ) {
4101
-                                    $cat_top_description = $row[$c];
4102
-                                } else if ( $column == 'cat_image' ) {
4103
-                                    $cat_image = $row[$c];
4104
-                                } else if ( $column == 'cat_icon' ) {
4105
-                                    $cat_icon = $row[$c];
4106
-                                }
4107
-                                // WPML
4108
-                                if ($is_wpml && $column == 'cat_language') {
4109
-                                    $cat_language = geodir_strtolower(trim($row[$c]));
4110
-                                }
4111
-                                // WPML
4112
-                                $c++;
4113
-                            }
4084
+							$c = 0;
4085
+							foreach ($columns as $column ) {
4086
+								if ( $column == 'cat_id' ) {
4087
+									$cat_id = (int)$row[$c];
4088
+								} else if ( $column == 'cat_name' ) {
4089
+									$cat_name = $row[$c];
4090
+								} else if ( $column == 'cat_slug' ) {
4091
+									$cat_slug = $row[$c];
4092
+								} else if ( $column == 'cat_posttype' ) {
4093
+									$cat_posttype = $row[$c];
4094
+								} else if ( $column == 'cat_parent' ) {
4095
+									$cat_parent = trim($row[$c]);
4096
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4097
+									$cat_schema = $row[$c];
4098
+								} else if ( $column == 'cat_description' ) {
4099
+									$cat_description = $row[$c];
4100
+								} else if ( $column == 'cat_top_description' ) {
4101
+									$cat_top_description = $row[$c];
4102
+								} else if ( $column == 'cat_image' ) {
4103
+									$cat_image = $row[$c];
4104
+								} else if ( $column == 'cat_icon' ) {
4105
+									$cat_icon = $row[$c];
4106
+								}
4107
+								// WPML
4108
+								if ($is_wpml && $column == 'cat_language') {
4109
+									$cat_language = geodir_strtolower(trim($row[$c]));
4110
+								}
4111
+								// WPML
4112
+								$c++;
4113
+							}
4114 4114
                             
4115
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4116
-                                $invalid++;
4117
-                                continue;
4118
-                            }
4115
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4116
+								$invalid++;
4117
+								continue;
4118
+							}
4119 4119
                             
4120
-                            // WPML
4121
-                            if ($is_wpml && $cat_language != '') {
4122
-                                $sitepress->switch_lang($cat_language, true);
4123
-                            }
4124
-                            // WPML
4120
+							// WPML
4121
+							if ($is_wpml && $cat_language != '') {
4122
+								$sitepress->switch_lang($cat_language, true);
4123
+							}
4124
+							// WPML
4125 4125
                                                         
4126
-                            $term_data = array();
4127
-                            $term_data['name'] = $cat_name;
4128
-                            $term_data['slug'] = $cat_slug;
4129
-                            $term_data['description'] = $cat_description;
4130
-                            $term_data['cat_schema'] = $cat_schema;
4131
-                            $term_data['top_description'] = $cat_top_description;
4132
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4133
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4126
+							$term_data = array();
4127
+							$term_data['name'] = $cat_name;
4128
+							$term_data['slug'] = $cat_slug;
4129
+							$term_data['description'] = $cat_description;
4130
+							$term_data['cat_schema'] = $cat_schema;
4131
+							$term_data['top_description'] = $cat_top_description;
4132
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4133
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4134 4134
                             
4135
-                            //$term_data = array_map( 'utf8_encode', $term_data );
4135
+							//$term_data = array_map( 'utf8_encode', $term_data );
4136 4136
                             
4137
-                            $taxonomy = $cat_posttype . 'category';
4137
+							$taxonomy = $cat_posttype . 'category';
4138 4138
                             
4139
-                            $term_data['taxonomy'] = $taxonomy;
4139
+							$term_data['taxonomy'] = $taxonomy;
4140 4140
 
4141
-                            $term_parent_id = 0;
4142
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4143
-                                $term_parent = '';
4141
+							$term_parent_id = 0;
4142
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
4143
+								$term_parent = '';
4144 4144
                                 
4145
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4146
-                                    $term_parent = $term_parent;
4147
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4148
-                                    $term_parent = $term_parent;
4149
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4150
-                                    $term_parent = $term_parent;
4151
-                                } else {
4152
-                                    $term_parent_data = array();
4153
-                                    $term_parent_data['name'] = $cat_parent;											
4154
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );										
4155
-                                    $term_parent_data['taxonomy'] = $taxonomy;
4145
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4146
+									$term_parent = $term_parent;
4147
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4148
+									$term_parent = $term_parent;
4149
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4150
+									$term_parent = $term_parent;
4151
+								} else {
4152
+									$term_parent_data = array();
4153
+									$term_parent_data['name'] = $cat_parent;											
4154
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );										
4155
+									$term_parent_data['taxonomy'] = $taxonomy;
4156 4156
                                     
4157
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4158
-                                }
4157
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4158
+								}
4159 4159
                                 
4160
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4161
-                                    $term_parent_id = (int)$term_parent->term_id;
4162
-                                }
4163
-                            }
4164
-                            $term_data['parent'] = (int)$term_parent_id;
4160
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4161
+									$term_parent_id = (int)$term_parent->term_id;
4162
+								}
4163
+							}
4164
+							$term_data['parent'] = (int)$term_parent_id;
4165 4165
 
4166
-                            $term_id = NULL;
4167
-                            if ( $import_choice == 'update' ) {
4168
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4169
-                                    $term_data['term_id'] = $term['term_id'];
4166
+							$term_id = NULL;
4167
+							if ( $import_choice == 'update' ) {
4168
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4169
+									$term_data['term_id'] = $term['term_id'];
4170 4170
                                     
4171
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4172
-                                        $updated++;
4173
-                                    } else {
4174
-                                        $invalid++;
4175
-                                    }
4176
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4177
-                                    $term_data['term_id'] = $term['term_id'];
4171
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4172
+										$updated++;
4173
+									} else {
4174
+										$invalid++;
4175
+									}
4176
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4177
+									$term_data['term_id'] = $term['term_id'];
4178 4178
                                     
4179
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4180
-                                        $updated++;
4181
-                                    } else {
4182
-                                        $invalid++;
4183
-                                    }
4184
-                                } else {
4185
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4186
-                                        $created++;
4187
-                                    } else {
4188
-                                        $invalid++;
4189
-                                    }
4190
-                                }
4191
-                            } else if ( $import_choice == 'skip' ) {
4192
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4193
-                                    $skipped++;
4194
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4195
-                                    $skipped++;
4196
-                                } else {
4197
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
4198
-                                        $created++;
4199
-                                    } else {
4200
-                                        $invalid++;
4201
-                                    }
4202
-                                }
4203
-                            } else {
4204
-                                $invalid++;
4205
-                            }
4179
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4180
+										$updated++;
4181
+									} else {
4182
+										$invalid++;
4183
+									}
4184
+								} else {
4185
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4186
+										$created++;
4187
+									} else {
4188
+										$invalid++;
4189
+									}
4190
+								}
4191
+							} else if ( $import_choice == 'skip' ) {
4192
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4193
+									$skipped++;
4194
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4195
+									$skipped++;
4196
+								} else {
4197
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
4198
+										$created++;
4199
+									} else {
4200
+										$invalid++;
4201
+									}
4202
+								}
4203
+							} else {
4204
+								$invalid++;
4205
+							}
4206 4206
                             
4207
-                            if ( $term_id ) {
4208
-                                if ( isset( $term_data['top_description'] ) ) {
4209
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4210
-                                }
4207
+							if ( $term_id ) {
4208
+								if ( isset( $term_data['top_description'] ) ) {
4209
+									update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4210
+								}
4211 4211
                                 
4212
-                                if ( isset( $term_data['cat_schema'] ) ) {
4213
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4214
-                                }
4212
+								if ( isset( $term_data['cat_schema'] ) ) {
4213
+									update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4214
+								}
4215 4215
             
4216
-                                $attachment = false;
4217
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4218
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4219
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4216
+								$attachment = false;
4217
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4218
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4219
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4220 4220
                                     
4221
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4222
-                                        $attachment = true;
4223
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4224
-                                    }
4225
-                                }
4221
+									if ( basename($cat_image) != $term_data['image'] ) {
4222
+										$attachment = true;
4223
+										update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4224
+									}
4225
+								}
4226 4226
                                 
4227
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4228
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4229
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4227
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4228
+									$cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4229
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4230 4230
                                         
4231
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4232
-                                        $attachment = true;
4233
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4234
-                                    }
4235
-                                }
4231
+									if ( basename($cat_icon) != $term_data['icon'] ) {
4232
+										$attachment = true;
4233
+										update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4234
+									}
4235
+								}
4236 4236
                                 
4237
-                                if ( $attachment ) {
4238
-                                    $images++;
4239
-                                }
4240
-                            }
4237
+								if ( $attachment ) {
4238
+									$images++;
4239
+								}
4240
+							}
4241 4241
                             
4242
-                            // WPML
4243
-                            if ($is_wpml && $cat_language != '') {
4244
-                                $sitepress->switch_lang($active_lang, true);
4245
-                            }
4246
-                            // WPML
4247
-                        }
4248
-                    }
4249
-                }
4242
+							// WPML
4243
+							if ($is_wpml && $cat_language != '') {
4244
+								$sitepress->switch_lang($active_lang, true);
4245
+							}
4246
+							// WPML
4247
+						}
4248
+					}
4249
+				}
4250 4250
                 
4251
-                $json = array();
4252
-                $json['processed'] = $limit;
4253
-                $json['created'] = $created;
4254
-                $json['updated'] = $updated;
4255
-                $json['skipped'] = $skipped;
4256
-                $json['invalid'] = $invalid;
4257
-                $json['images'] = $images;
4251
+				$json = array();
4252
+				$json['processed'] = $limit;
4253
+				$json['created'] = $created;
4254
+				$json['updated'] = $updated;
4255
+				$json['skipped'] = $skipped;
4256
+				$json['invalid'] = $invalid;
4257
+				$json['images'] = $images;
4258 4258
                 
4259
-                wp_send_json( $json );
4260
-                exit;
4261
-            } else if ( $task == 'import_post' ) {
4262
-
4263
-                //run some stuff to make the import quicker
4264
-                wp_defer_term_counting( true );
4265
-                wp_defer_comment_counting( true );
4266
-                $wpdb->query( 'SET autocommit = 0;' );
4267
-
4268
-                //remove_all_actions('publish_post');
4269
-                //remove_all_actions('transition_post_status');
4270
-                //remove_all_actions('publish_future_post');
4271
-
4272
-                if (!empty($file)) {
4273
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4274
-                    $default_status = 'publish';
4275
-                    $current_date = date_i18n( 'Y-m-d', time() );
4259
+				wp_send_json( $json );
4260
+				exit;
4261
+			} else if ( $task == 'import_post' ) {
4262
+
4263
+				//run some stuff to make the import quicker
4264
+				wp_defer_term_counting( true );
4265
+				wp_defer_comment_counting( true );
4266
+				$wpdb->query( 'SET autocommit = 0;' );
4267
+
4268
+				//remove_all_actions('publish_post');
4269
+				//remove_all_actions('transition_post_status');
4270
+				//remove_all_actions('publish_future_post');
4271
+
4272
+				if (!empty($file)) {
4273
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4274
+					$default_status = 'publish';
4275
+					$current_date = date_i18n( 'Y-m-d', time() );
4276 4276
                     
4277
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4277
+					$columns = isset($file[0]) ? $file[0] : NULL;
4278 4278
                     
4279
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4280
-                        $json['error'] = CSV_INVAILD_FILE;
4281
-                        wp_send_json( $json );
4282
-                        exit;
4283
-                    }
4279
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4280
+						$json['error'] = CSV_INVAILD_FILE;
4281
+						wp_send_json( $json );
4282
+						exit;
4283
+					}
4284 4284
 
4285
-                    $processed_actual=0;
4286
-                    for ($i = 1; $i <= $limit; $i++) {
4287
-                        $index = $processed + $i;
4288
-                        $gd_post = array();
4285
+					$processed_actual=0;
4286
+					for ($i = 1; $i <= $limit; $i++) {
4287
+						$index = $processed + $i;
4288
+						$gd_post = array();
4289 4289
                         
4290
-                        if (isset($file[$index])) {$processed_actual++;
4291
-                            $row = $file[$index];
4292
-                            $row = array_map( 'trim', $row );
4293
-                            //$row = array_map( 'utf8_encode', $row );
4294
-                            $row = array_map( 'addslashes_gpc', $row );
4290
+						if (isset($file[$index])) {$processed_actual++;
4291
+							$row = $file[$index];
4292
+							$row = array_map( 'trim', $row );
4293
+							//$row = array_map( 'utf8_encode', $row );
4294
+							$row = array_map( 'addslashes_gpc', $row );
4295 4295
                             
4296
-                            $post_id = '';
4297
-                            $post_title = '';
4298
-                            $post_author = '';
4299
-                            $post_content = '';
4300
-                            $post_category_arr = array();
4301
-                            $default_category = '';
4302
-                            $post_tags = array();
4303
-                            $post_type = '';
4304
-                            $post_status = '';
4305
-                            $geodir_video = '';
4306
-                            $post_address = '';
4307
-                            $post_city = '';
4308
-                            $post_region = '';
4309
-                            $post_country = '';
4310
-                            $post_zip = '';
4311
-                            $post_latitude = '';
4312
-                            $post_longitude = '';
4313
-                            $post_neighbourhood = '';
4314
-                            $neighbourhood_latitude = '';
4315
-                            $neighbourhood_longitude = '';
4316
-                            $geodir_timing = '';
4317
-                            $geodir_contact = '';
4318
-                            $geodir_email = '';
4319
-                            $geodir_website = '';
4320
-                            $geodir_twitter = '';
4321
-                            $geodir_facebook = '';
4322
-                            $geodir_twitter = '';
4323
-                            $post_images = array();
4296
+							$post_id = '';
4297
+							$post_title = '';
4298
+							$post_author = '';
4299
+							$post_content = '';
4300
+							$post_category_arr = array();
4301
+							$default_category = '';
4302
+							$post_tags = array();
4303
+							$post_type = '';
4304
+							$post_status = '';
4305
+							$geodir_video = '';
4306
+							$post_address = '';
4307
+							$post_city = '';
4308
+							$post_region = '';
4309
+							$post_country = '';
4310
+							$post_zip = '';
4311
+							$post_latitude = '';
4312
+							$post_longitude = '';
4313
+							$post_neighbourhood = '';
4314
+							$neighbourhood_latitude = '';
4315
+							$neighbourhood_longitude = '';
4316
+							$geodir_timing = '';
4317
+							$geodir_contact = '';
4318
+							$geodir_email = '';
4319
+							$geodir_website = '';
4320
+							$geodir_twitter = '';
4321
+							$geodir_facebook = '';
4322
+							$geodir_twitter = '';
4323
+							$post_images = array();
4324 4324
                             
4325
-                            $expire_date = 'Never';
4325
+							$expire_date = 'Never';
4326 4326
                             
4327
-                            $language = '';
4328
-                            $original_post_id = '';
4327
+							$language = '';
4328
+							$original_post_id = '';
4329 4329
                                                         
4330
-                            $c = 0;
4331
-                            foreach ($columns as $column ) {
4332
-                                $gd_post[$column] = $row[$c];
4330
+							$c = 0;
4331
+							foreach ($columns as $column ) {
4332
+								$gd_post[$column] = $row[$c];
4333 4333
                                 
4334
-                                if ( $column == 'post_id' ) {
4335
-                                    $post_id = $row[$c];
4336
-                                } else if ( $column == 'post_title' ) {
4337
-                                    $post_title = sanitize_text_field($row[$c]);
4338
-                                } else if ( $column == 'post_author' ) {
4339
-                                    $post_author = $row[$c];
4340
-                                } else if ( $column == 'post_content' ) {
4341
-                                    $post_content = $row[$c];
4342
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4343
-                                    $post_category_arr = explode( ',', $row[$c] );
4344
-                                } else if ( $column == 'default_category' ) {
4345
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
4346
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4347
-                                    $post_tags = explode( ',', $row[$c] );
4348
-                                } else if ( $column == 'post_type' ) {
4349
-                                    $post_type = $row[$c];
4350
-                                } else if ( $column == 'post_status' ) {
4351
-                                    $post_status = sanitize_key( $row[$c] );
4352
-                                } else if ( $column == 'is_featured' ) {
4353
-                                    $is_featured = (int)$row[$c];
4354
-                                } else if ( $column == 'geodir_video' ) {
4355
-                                    $geodir_video = $row[$c];
4356
-                                } else if ( $column == 'post_address' ) {
4357
-                                    $post_address = $row[$c];
4358
-                                } else if ( $column == 'post_city' ) {
4359
-                                    $post_city = $row[$c];
4360
-                                } else if ( $column == 'post_region' ) {
4361
-                                    $post_region = $row[$c];
4362
-                                } else if ( $column == 'post_country' ) {
4363
-                                    $post_country = $row[$c];
4364
-                                } else if ( $column == 'post_zip' ) {
4365
-                                    $post_zip = $row[$c];
4366
-                                } else if ( $column == 'post_latitude' ) {
4367
-                                    $post_latitude = $row[$c];
4368
-                                } else if ( $column == 'post_longitude' ) {
4369
-                                    $post_longitude = $row[$c];
4370
-                                } else if ( $column == 'post_neighbourhood' ) {
4371
-                                    $post_neighbourhood = $row[$c];
4372
-                                    unset($gd_post[$column]);
4373
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4374
-                                    $neighbourhood_latitude = $row[$c];
4375
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4376
-                                    $neighbourhood_longitude = $row[$c];
4377
-                                } else if ( $column == 'geodir_timing' ) {
4378
-                                    $geodir_timing = $row[$c];
4379
-                                } else if ( $column == 'geodir_contact' ) {
4380
-                                    $geodir_contact = $row[$c];
4381
-                                } else if ( $column == 'geodir_email' ) {
4382
-                                    $geodir_email = $row[$c];
4383
-                                } else if ( $column == 'geodir_website' ) {
4384
-                                    $geodir_website = $row[$c];
4385
-                                } else if ( $column == 'geodir_twitter' ) {
4386
-                                    $geodir_twitter = $row[$c];
4387
-                                } else if ( $column == 'geodir_facebook' ) {
4388
-                                    $geodir_facebook = $row[$c];
4389
-                                } else if ( $column == 'geodir_twitter' ) {
4390
-                                    $geodir_twitter = $row[$c];
4391
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4392
-                                    $post_images[] = $row[$c];
4393
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4394
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4395
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4396
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
4397
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4398
-                                }
4399
-                                // WPML
4400
-                                if ($is_wpml) {
4401
-                                    if ($column == 'language') {
4402
-                                        $language = geodir_strtolower(trim($row[$c]));
4403
-                                    } else if ($column == 'original_post_id') {
4404
-                                        $original_post_id = (int)$row[$c];
4405
-                                    }
4406
-                                }
4407
-                                // WPML
4408
-                                $c++;
4409
-                            }
4334
+								if ( $column == 'post_id' ) {
4335
+									$post_id = $row[$c];
4336
+								} else if ( $column == 'post_title' ) {
4337
+									$post_title = sanitize_text_field($row[$c]);
4338
+								} else if ( $column == 'post_author' ) {
4339
+									$post_author = $row[$c];
4340
+								} else if ( $column == 'post_content' ) {
4341
+									$post_content = $row[$c];
4342
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
4343
+									$post_category_arr = explode( ',', $row[$c] );
4344
+								} else if ( $column == 'default_category' ) {
4345
+									$default_category = wp_kses_normalize_entities($row[$c]);
4346
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
4347
+									$post_tags = explode( ',', $row[$c] );
4348
+								} else if ( $column == 'post_type' ) {
4349
+									$post_type = $row[$c];
4350
+								} else if ( $column == 'post_status' ) {
4351
+									$post_status = sanitize_key( $row[$c] );
4352
+								} else if ( $column == 'is_featured' ) {
4353
+									$is_featured = (int)$row[$c];
4354
+								} else if ( $column == 'geodir_video' ) {
4355
+									$geodir_video = $row[$c];
4356
+								} else if ( $column == 'post_address' ) {
4357
+									$post_address = $row[$c];
4358
+								} else if ( $column == 'post_city' ) {
4359
+									$post_city = $row[$c];
4360
+								} else if ( $column == 'post_region' ) {
4361
+									$post_region = $row[$c];
4362
+								} else if ( $column == 'post_country' ) {
4363
+									$post_country = $row[$c];
4364
+								} else if ( $column == 'post_zip' ) {
4365
+									$post_zip = $row[$c];
4366
+								} else if ( $column == 'post_latitude' ) {
4367
+									$post_latitude = $row[$c];
4368
+								} else if ( $column == 'post_longitude' ) {
4369
+									$post_longitude = $row[$c];
4370
+								} else if ( $column == 'post_neighbourhood' ) {
4371
+									$post_neighbourhood = $row[$c];
4372
+									unset($gd_post[$column]);
4373
+								} else if ( $column == 'neighbourhood_latitude' ) {
4374
+									$neighbourhood_latitude = $row[$c];
4375
+								} else if ( $column == 'neighbourhood_longitude' ) {
4376
+									$neighbourhood_longitude = $row[$c];
4377
+								} else if ( $column == 'geodir_timing' ) {
4378
+									$geodir_timing = $row[$c];
4379
+								} else if ( $column == 'geodir_contact' ) {
4380
+									$geodir_contact = $row[$c];
4381
+								} else if ( $column == 'geodir_email' ) {
4382
+									$geodir_email = $row[$c];
4383
+								} else if ( $column == 'geodir_website' ) {
4384
+									$geodir_website = $row[$c];
4385
+								} else if ( $column == 'geodir_twitter' ) {
4386
+									$geodir_twitter = $row[$c];
4387
+								} else if ( $column == 'geodir_facebook' ) {
4388
+									$geodir_facebook = $row[$c];
4389
+								} else if ( $column == 'geodir_twitter' ) {
4390
+									$geodir_twitter = $row[$c];
4391
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4392
+									$post_images[] = $row[$c];
4393
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4394
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4395
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4396
+									$row[$c] = str_replace('/', '-', $row[$c]);
4397
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4398
+								}
4399
+								// WPML
4400
+								if ($is_wpml) {
4401
+									if ($column == 'language') {
4402
+										$language = geodir_strtolower(trim($row[$c]));
4403
+									} else if ($column == 'original_post_id') {
4404
+										$original_post_id = (int)$row[$c];
4405
+									}
4406
+								}
4407
+								// WPML
4408
+								$c++;
4409
+							}
4410 4410
                             
4411
-                            // WPML
4412
-                            if ($is_wpml && $language != '') {
4413
-                                $sitepress->switch_lang($language, true);
4414
-                            }
4415
-                            // WPML
4411
+							// WPML
4412
+							if ($is_wpml && $language != '') {
4413
+								$sitepress->switch_lang($language, true);
4414
+							}
4415
+							// WPML
4416 4416
 
4417
-                            $gd_post['IMAGE'] = $post_images;
4417
+							$gd_post['IMAGE'] = $post_images;
4418 4418
                             
4419
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4420
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4419
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4420
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4421 4421
                                                                                                                 
4422
-                            $valid = true;
4422
+							$valid = true;
4423 4423
                             
4424
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4425
-                                $invalid++;
4426
-                                $valid = false;
4427
-                            }
4424
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4425
+								$invalid++;
4426
+								$valid = false;
4427
+							}
4428 4428
                             
4429
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4430
-                            if ( $location_allowed ) {
4431
-                                $location_result = geodir_get_default_location();
4432
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4433
-                                    $invalid_addr++;
4434
-                                    $valid = false;
4435
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4436
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4437
-                                        $invalid_addr++;
4438
-                                        $valid = false;
4439
-                                    } else {
4440
-                                        if (!$location_manager) {
4441
-                                            $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4442
-                                        }
4443
-                                    }
4444
-                                }
4445
-                            }
4429
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4430
+							if ( $location_allowed ) {
4431
+								$location_result = geodir_get_default_location();
4432
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4433
+									$invalid_addr++;
4434
+									$valid = false;
4435
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4436
+									if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4437
+										$invalid_addr++;
4438
+										$valid = false;
4439
+									} else {
4440
+										if (!$location_manager) {
4441
+											$gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4442
+										}
4443
+									}
4444
+								}
4445
+							}
4446 4446
                             
4447
-                            if ( !$valid ) {
4448
-                                continue;
4449
-                            }
4447
+							if ( !$valid ) {
4448
+								continue;
4449
+							}
4450 4450
 
4451
-                            $cat_taxonomy = $post_type . 'category';
4452
-                            $tags_taxonomy = $post_type . '_tags';
4451
+							$cat_taxonomy = $post_type . 'category';
4452
+							$tags_taxonomy = $post_type . '_tags';
4453 4453
                             
4454
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4455
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
4456
-                            }
4454
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4455
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
4456
+							}
4457 4457
 
4458
-                            $post_category = array();
4459
-                            $default_category_id = NULL;
4460
-                            if ( !empty( $post_category_arr ) ) {
4461
-                                foreach ( $post_category_arr as $value ) {
4462
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4458
+							$post_category = array();
4459
+							$default_category_id = NULL;
4460
+							if ( !empty( $post_category_arr ) ) {
4461
+								foreach ( $post_category_arr as $value ) {
4462
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
4463 4463
                                     
4464
-                                    if ( $category_name != '' ) {
4465
-                                        $term_category = array();
4464
+									if ( $category_name != '' ) {
4465
+										$term_category = array();
4466 4466
                                         
4467
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4468
-                                            $term_category = $term;
4469
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4470
-                                            $term_category = $term;
4471
-                                        } else {
4472
-                                            $term_data = array();
4473
-                                            $term_data['name'] = $category_name;
4474
-                                            $term_data['taxonomy'] = $cat_taxonomy;
4467
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4468
+											$term_category = $term;
4469
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4470
+											$term_category = $term;
4471
+										} else {
4472
+											$term_data = array();
4473
+											$term_data['name'] = $category_name;
4474
+											$term_data['taxonomy'] = $cat_taxonomy;
4475 4475
                                             
4476
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4477
-                                            if ( $term_id ) {
4478
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4479
-                                            }
4480
-                                        }
4476
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4477
+											if ( $term_id ) {
4478
+												$term_category = get_term( $term_id, $cat_taxonomy );
4479
+											}
4480
+										}
4481 4481
                                         
4482
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4483
-                                            $post_category[] = intval($term_category->term_id);
4482
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4483
+											$post_category[] = intval($term_category->term_id);
4484 4484
                                             
4485
-                                            if ($category_name == $default_category) {
4486
-                                                $default_category_id = intval($term_category->term_id);
4487
-                                            }
4488
-                                        }
4489
-                                    }
4490
-                                }
4491
-                            }
4485
+											if ($category_name == $default_category) {
4486
+												$default_category_id = intval($term_category->term_id);
4487
+											}
4488
+										}
4489
+									}
4490
+								}
4491
+							}
4492 4492
 
4493
-                            $save_post = array();
4494
-                            $save_post['post_title'] = $post_title;
4495
-                            $save_post['post_content'] = $post_content;
4496
-                            $save_post['post_type'] = $post_type;
4497
-                            $save_post['post_author'] = $post_author;
4498
-                            $save_post['post_status'] = $post_status;
4499
-                            $save_post['post_category'] = $post_category;
4500
-                            $save_post['post_tags'] = $post_tags;
4501
-
4502
-                            $saved_post_id = NULL;
4503
-                            if ( $import_choice == 'update' ) {
4504
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4505
-                                    $save_post['ID'] = $post_id;
4493
+							$save_post = array();
4494
+							$save_post['post_title'] = $post_title;
4495
+							$save_post['post_content'] = $post_content;
4496
+							$save_post['post_type'] = $post_type;
4497
+							$save_post['post_author'] = $post_author;
4498
+							$save_post['post_status'] = $post_status;
4499
+							$save_post['post_category'] = $post_category;
4500
+							$save_post['post_tags'] = $post_tags;
4501
+
4502
+							$saved_post_id = NULL;
4503
+							if ( $import_choice == 'update' ) {
4504
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4505
+									$save_post['ID'] = $post_id;
4506 4506
                                     
4507
-                                    if ( wp_update_post( $save_post ) ) {
4508
-                                        $saved_post_id = $post_id;
4509
-                                        $updated++;
4510
-                                    }
4511
-                                } else {
4512
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4513
-                                        $created++;
4514
-                                    }
4515
-                                }
4507
+									if ( wp_update_post( $save_post ) ) {
4508
+										$saved_post_id = $post_id;
4509
+										$updated++;
4510
+									}
4511
+								} else {
4512
+									if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4513
+										$created++;
4514
+									}
4515
+								}
4516 4516
                                 
4517
-                                if ( !$saved_post_id > 0 ) {
4518
-                                    $invalid++;
4519
-                                }
4520
-                            } else if ( $import_choice == 'skip' ) {
4521
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4522
-                                    $skipped++;	
4523
-                                } else {
4524
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4525
-                                        $created++;	
4526
-                                    } else {
4527
-                                        $invalid++;
4528
-                                    }
4529
-                                }
4530
-                            } else {
4531
-                                $invalid++;
4532
-                            }
4517
+								if ( !$saved_post_id > 0 ) {
4518
+									$invalid++;
4519
+								}
4520
+							} else if ( $import_choice == 'skip' ) {
4521
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4522
+									$skipped++;	
4523
+								} else {
4524
+									if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4525
+										$created++;	
4526
+									} else {
4527
+										$invalid++;
4528
+									}
4529
+								}
4530
+							} else {
4531
+								$invalid++;
4532
+							}
4533 4533
 
4534
-                            if ( (int)$saved_post_id > 0 ) {
4535
-                                // WPML
4536
-                                if ($is_wpml && $original_post_id > 0 && $language != '') {
4537
-                                    $wpml_post_type = 'post_' . $post_type;
4538
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4539
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4534
+							if ( (int)$saved_post_id > 0 ) {
4535
+								// WPML
4536
+								if ($is_wpml && $original_post_id > 0 && $language != '') {
4537
+									$wpml_post_type = 'post_' . $post_type;
4538
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4539
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4540 4540
 
4541
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4541
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4542 4542
                                     
4543
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4544
-                                }
4545
-                                // WPML
4546
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4543
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4544
+								}
4545
+								// WPML
4546
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
4547 4547
                                 
4548
-                                $gd_post['post_id'] = $saved_post_id;
4549
-                                $gd_post['ID'] = $saved_post_id;
4550
-                                $gd_post['post_tags'] = $post_tags;
4551
-                                $gd_post['post_title'] = $post_title;
4552
-                                $gd_post['post_status'] = $post_status;
4553
-                                $gd_post['submit_time'] = time();
4554
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4548
+								$gd_post['post_id'] = $saved_post_id;
4549
+								$gd_post['ID'] = $saved_post_id;
4550
+								$gd_post['post_tags'] = $post_tags;
4551
+								$gd_post['post_title'] = $post_title;
4552
+								$gd_post['post_status'] = $post_status;
4553
+								$gd_post['submit_time'] = time();
4554
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4555 4555
                                                     
4556
-                                // post location
4557
-                                $post_location_id = 0;
4558
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4559
-                                    $gd_post['post_neighbourhood'] = '';
4556
+								// post location
4557
+								$post_location_id = 0;
4558
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4559
+									$gd_post['post_neighbourhood'] = '';
4560 4560
                                     
4561
-                                    $post_location_info = array(
4562
-                                                                'city' => $post_city,
4563
-                                                                'region' => $post_region,
4564
-                                                                'country' => $post_country,
4565
-                                                                'geo_lat' => $post_latitude,
4566
-                                                                'geo_lng' => $post_longitude
4567
-                                                            );
4568
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4569
-                                        $post_location_id = $location_id;
4570
-                                    }
4561
+									$post_location_info = array(
4562
+																'city' => $post_city,
4563
+																'region' => $post_region,
4564
+																'country' => $post_country,
4565
+																'geo_lat' => $post_latitude,
4566
+																'geo_lng' => $post_longitude
4567
+															);
4568
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4569
+										$post_location_id = $location_id;
4570
+									}
4571 4571
                                     
4572
-                                    if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4573
-                                        $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4572
+									if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4573
+										$neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4574 4574
 
4575
-                                        $hood_data = array();
4576
-                                        $hood_data['hood_location_id'] = $post_location_id;
4577
-                                        $hood_data['hood_name'] = $post_neighbourhood;
4575
+										$hood_data = array();
4576
+										$hood_data['hood_location_id'] = $post_location_id;
4577
+										$hood_data['hood_name'] = $post_neighbourhood;
4578 4578
                                         
4579
-                                        if (!empty($neighbourhood_info)) {
4580
-                                            $hood_data['hood_id'] = $neighbourhood_info->hood_id;
4581
-                                            $hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4579
+										if (!empty($neighbourhood_info)) {
4580
+											$hood_data['hood_id'] = $neighbourhood_info->hood_id;
4581
+											$hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4582 4582
                                             
4583
-                                            if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4584
-                                                $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4585
-                                                $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4586
-                                            }
4587
-                                        }
4583
+											if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4584
+												$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4585
+												$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4586
+											}
4587
+										}
4588 4588
                                         
4589
-                                        if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4590
-                                            $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4591
-                                            $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4592
-                                        }
4589
+										if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4590
+											$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4591
+											$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4592
+										}
4593 4593
                                         
4594
-                                        $hood_data['hood_latitude'] = $post_latitude;
4595
-                                        $hood_data['hood_longitude'] = $post_longitude;
4594
+										$hood_data['hood_latitude'] = $post_latitude;
4595
+										$hood_data['hood_longitude'] = $post_longitude;
4596 4596
 
4597
-                                        $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4598
-                                        if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4599
-                                            $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4600
-                                        }
4601
-                                    }
4602
-                                }
4603
-                                $gd_post['post_location_id'] = $post_location_id;
4597
+										$neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4598
+										if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4599
+											$gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4600
+										}
4601
+									}
4602
+								}
4603
+								$gd_post['post_location_id'] = $post_location_id;
4604 4604
                                 
4605
-                                // post package info
4606
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4607
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4608
-                                    $package_id = $gd_post_info->package_id;
4609
-                                }
4605
+								// post package info
4606
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4607
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4608
+									$package_id = $gd_post_info->package_id;
4609
+								}
4610 4610
                                 
4611
-                                $package_info = array();
4612
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4613
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4611
+								$package_info = array();
4612
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4613
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
4614 4614
                                     
4615
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4616
-                                        $package_info = array();
4617
-                                    }
4618
-                                }
4615
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4616
+										$package_info = array();
4617
+									}
4618
+								}
4619 4619
                                 
4620
-                                if (empty($package_info)) {
4621
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4622
-                                }
4620
+								if (empty($package_info)) {
4621
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
4622
+								}
4623 4623
                                  
4624
-                                if (!empty($package_info))	 {
4625
-                                    $package_id = $package_info['pid'];
4624
+								if (!empty($package_info))	 {
4625
+									$package_id = $package_info['pid'];
4626 4626
                                     
4627
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4628
-                                        $gd_post['expire_date'] = $expire_date;
4629
-                                    } else {
4630
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4631
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4632
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4633
-                                        } else {
4634
-                                            $gd_post['expire_date'] = 'Never';
4635
-                                        }
4636
-                                    }
4627
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4628
+										$gd_post['expire_date'] = $expire_date;
4629
+									} else {
4630
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4631
+											$gd_post['alive_days'] = (int)$package_info['days'];
4632
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4633
+										} else {
4634
+											$gd_post['expire_date'] = 'Never';
4635
+										}
4636
+									}
4637 4637
                                     
4638
-                                    $gd_post['package_id'] = $package_id;
4639
-                                }
4638
+									$gd_post['package_id'] = $package_id;
4639
+								}
4640 4640
 
4641
-                                $table = $plugin_prefix . $post_type . '_detail';
4641
+								$table = $plugin_prefix . $post_type . '_detail';
4642 4642
                                 
4643
-                                if ($post_type == 'gd_event') {
4644
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
4645
-                                }
4643
+								if ($post_type == 'gd_event') {
4644
+									$gd_post = geodir_imex_process_event_data($gd_post);
4645
+								}
4646 4646
                                 
4647
-                                if (isset($gd_post['post_id'])) {
4648
-                                    unset($gd_post['post_id']);
4649
-                                }
4647
+								if (isset($gd_post['post_id'])) {
4648
+									unset($gd_post['post_id']);
4649
+								}
4650 4650
 
4651
-                                // Export franchise fields
4652
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4653
-                                if ($is_franchise_active) {
4654
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4655
-                                        $gd_franchise_lock = array();
4651
+								// Export franchise fields
4652
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4653
+								if ($is_franchise_active) {
4654
+									if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4655
+										$gd_franchise_lock = array();
4656 4656
                                         
4657
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4658
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4659
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4660
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4661
-                                        }
4657
+										if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4658
+											$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4659
+											$gd_franchise_lock = trim( $gd_franchise_lock );
4660
+											$gd_franchise_lock = explode( ",", $gd_franchise_lock );
4661
+										}
4662 4662
                                         
4663
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4664
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4665
-                                    } else {
4666
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4667
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4668
-                                        }
4669
-                                    }
4670
-                                }
4663
+										update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4664
+										update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4665
+									} else {
4666
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4667
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4668
+										}
4669
+									}
4670
+								}
4671 4671
                                 
4672
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4673
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4674
-                                    if ($default_category_id) {
4675
-                                        $save_post['post_default_category'] = $default_category_id;
4676
-                                        $gd_post['default_category'] = $default_category_id;
4677
-                                    }
4678
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
4679
-                                }
4672
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4673
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4674
+									if ($default_category_id) {
4675
+										$save_post['post_default_category'] = $default_category_id;
4676
+										$gd_post['default_category'] = $default_category_id;
4677
+									}
4678
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
4679
+								}
4680 4680
                                 
4681
-                                // Save post info
4682
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4683
-                                // post taxonomies
4684
-                                if ( !empty( $save_post['post_category'] ) ) {
4685
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4681
+								// Save post info
4682
+								geodir_save_post_info( $saved_post_id, $gd_post );
4683
+								// post taxonomies
4684
+								if ( !empty( $save_post['post_category'] ) ) {
4685
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4686 4686
                                     
4687
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4688
-                                    if ($default_category_id) {
4689
-                                        $post_default_category = $default_category_id;
4690
-                                    }
4691
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4692
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4693
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4687
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4688
+									if ($default_category_id) {
4689
+										$post_default_category = $default_category_id;
4690
+									}
4691
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4692
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4693
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4694 4694
                                     
4695
-                                    if ($post_category_str != '' && $post_default_category) {
4696
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4697
-                                    }
4695
+									if ($post_category_str != '' && $post_default_category) {
4696
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4697
+									}
4698 4698
                                     
4699
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4699
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4700 4700
                                     
4701
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4702
-                                }
4701
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4702
+								}
4703 4703
 
4704
-                                if ( !empty( $save_post['post_tags'] ) ) {
4705
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4706
-                                }
4704
+								if ( !empty( $save_post['post_tags'] ) ) {
4705
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4706
+								}
4707 4707
 
4708
-                                // Post images
4709
-                                if ( !empty( $post_images ) ) {
4710
-                                    $post_images = array_unique($post_images);
4708
+								// Post images
4709
+								if ( !empty( $post_images ) ) {
4710
+									$post_images = array_unique($post_images);
4711 4711
                                     
4712
-                                    $old_post_images_arr = array();
4713
-                                    $saved_post_images_arr = array();
4712
+									$old_post_images_arr = array();
4713
+									$saved_post_images_arr = array();
4714 4714
                                     
4715
-                                    $order = 1;
4715
+									$order = 1;
4716 4716
                                     
4717
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4718
-                                    if (!empty($old_post_images)) {
4719
-                                        foreach( $old_post_images as $old_post_image ) {
4720
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4721
-                                                $old_post_images_arr[] = $old_post_image->file;
4722
-                                            }
4723
-                                        }
4724
-                                    }
4717
+									$old_post_images = geodir_get_images( $saved_post_id );
4718
+									if (!empty($old_post_images)) {
4719
+										foreach( $old_post_images as $old_post_image ) {
4720
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4721
+												$old_post_images_arr[] = $old_post_image->file;
4722
+											}
4723
+										}
4724
+									}
4725 4725
                                     
4726
-                                    foreach ( $post_images as $post_image ) {
4727
-                                        $image_name = basename( $post_image );
4728
-                                        $saved_post_images_arr[] = $image_name;
4726
+									foreach ( $post_images as $post_image ) {
4727
+										$image_name = basename( $post_image );
4728
+										$saved_post_images_arr[] = $image_name;
4729 4729
                                         
4730
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4731
-                                            continue; // Skip if image already exists.
4732
-                                        }
4730
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4731
+											continue; // Skip if image already exists.
4732
+										}
4733 4733
                                         
4734
-                                        $image_name_parts = explode( '.', $image_name );
4735
-                                        array_pop( $image_name_parts );
4736
-                                        $proper_image_name = implode( '.', $image_name_parts );
4734
+										$image_name_parts = explode( '.', $image_name );
4735
+										array_pop( $image_name_parts );
4736
+										$proper_image_name = implode( '.', $image_name_parts );
4737 4737
                                         
4738
-                                        $arr_file_type = wp_check_filetype( $image_name );
4738
+										$arr_file_type = wp_check_filetype( $image_name );
4739 4739
                                         
4740
-                                        if ( !empty( $arr_file_type ) ) {
4741
-                                            $uploaded_file_type = $arr_file_type['type'];
4740
+										if ( !empty( $arr_file_type ) ) {
4741
+											$uploaded_file_type = $arr_file_type['type'];
4742 4742
                                             
4743
-                                            $attachment = array();
4744
-                                            $attachment['post_id'] = $saved_post_id;
4745
-                                            $attachment['title'] = $proper_image_name;
4746
-                                            $attachment['content'] = '';
4747
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4748
-                                            $attachment['mime_type'] = $uploaded_file_type;
4749
-                                            $attachment['menu_order'] = $order;
4750
-                                            $attachment['is_featured'] = 0;
4751
-
4752
-                                            $attachment_set = '';
4753
-                                            foreach ( $attachment as $key => $val ) {
4754
-                                                if ( $val != '' ) {
4755
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4756
-                                                }
4757
-                                            }
4758
-                                            $attachment_set = trim( $attachment_set, ", " );
4743
+											$attachment = array();
4744
+											$attachment['post_id'] = $saved_post_id;
4745
+											$attachment['title'] = $proper_image_name;
4746
+											$attachment['content'] = '';
4747
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
4748
+											$attachment['mime_type'] = $uploaded_file_type;
4749
+											$attachment['menu_order'] = $order;
4750
+											$attachment['is_featured'] = 0;
4751
+
4752
+											$attachment_set = '';
4753
+											foreach ( $attachment as $key => $val ) {
4754
+												if ( $val != '' ) {
4755
+													$attachment_set .= $key . " = '" . $val . "', ";
4756
+												}
4757
+											}
4758
+											$attachment_set = trim( $attachment_set, ", " );
4759 4759
                                                                                         
4760
-                                            // Add new attachment
4761
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4760
+											// Add new attachment
4761
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4762 4762
                                                                                         
4763
-                                            $order++;
4764
-                                        }
4765
-                                    }
4763
+											$order++;
4764
+										}
4765
+									}
4766 4766
 
4767
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4768
-                                    // Remove previous attachment
4769
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4767
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4768
+									// Remove previous attachment
4769
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4770 4770
                                     
4771
-                                    if ( !empty( $saved_post_images_arr ) ) {
4772
-                                        $menu_order = 1;
4771
+									if ( !empty( $saved_post_images_arr ) ) {
4772
+										$menu_order = 1;
4773 4773
                                         
4774
-                                        foreach ( $saved_post_images_arr as $img_name ) {
4775
-                                            $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
4774
+										foreach ( $saved_post_images_arr as $img_name ) {
4775
+											$wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
4776 4776
                                             
4777
-                                            if( $menu_order == 1 ) {
4778
-                                                if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
4779
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4780
-                                                }
4781
-                                            }
4782
-                                            $menu_order++;
4783
-                                        }
4784
-                                    }
4777
+											if( $menu_order == 1 ) {
4778
+												if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
4779
+													$wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4780
+												}
4781
+											}
4782
+											$menu_order++;
4783
+										}
4784
+									}
4785 4785
                                     
4786
-                                    if ( $order > 1 ) {
4787
-                                        $images++;
4788
-                                    }
4789
-                                }
4786
+									if ( $order > 1 ) {
4787
+										$images++;
4788
+									}
4789
+								}
4790 4790
 
4791
-                                /** This action is documented in geodirectory-functions/post-functions.php */
4792
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4791
+								/** This action is documented in geodirectory-functions/post-functions.php */
4792
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4793 4793
                                 
4794
-                                if (isset($is_featured)) {
4795
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4796
-                                }
4797
-                                if (isset($gd_post['expire_date'])) {
4798
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4799
-                                }
4800
-                            }
4794
+								if (isset($is_featured)) {
4795
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4796
+								}
4797
+								if (isset($gd_post['expire_date'])) {
4798
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4799
+								}
4800
+							}
4801 4801
                             
4802
-                            // WPML
4803
-                            if ($is_wpml && $language != '') {
4804
-                                $sitepress->switch_lang($active_lang, true);
4805
-                            }
4806
-                            // WPML
4807
-                        }
4808
-                    }
4809
-                }
4802
+							// WPML
4803
+							if ($is_wpml && $language != '') {
4804
+								$sitepress->switch_lang($active_lang, true);
4805
+							}
4806
+							// WPML
4807
+						}
4808
+					}
4809
+				}
4810 4810
 
4811
-                //undo some stuff to make the import quicker
4812
-                wp_defer_term_counting( false );
4813
-                wp_defer_comment_counting( false );
4814
-                $wpdb->query( 'COMMIT;' );
4815
-                $wpdb->query( 'SET autocommit = 1;' );
4816
-
4817
-                $json = array();
4818
-                $json['processed'] = $processed_actual;
4819
-                $json['created'] = $created;
4820
-                $json['updated'] = $updated;
4821
-                $json['skipped'] = $skipped;
4822
-                $json['invalid'] = $invalid;
4823
-                $json['invalid_addr'] = $invalid_addr;
4824
-                $json['images'] = $images;
4811
+				//undo some stuff to make the import quicker
4812
+				wp_defer_term_counting( false );
4813
+				wp_defer_comment_counting( false );
4814
+				$wpdb->query( 'COMMIT;' );
4815
+				$wpdb->query( 'SET autocommit = 1;' );
4816
+
4817
+				$json = array();
4818
+				$json['processed'] = $processed_actual;
4819
+				$json['created'] = $created;
4820
+				$json['updated'] = $updated;
4821
+				$json['skipped'] = $skipped;
4822
+				$json['invalid'] = $invalid;
4823
+				$json['invalid_addr'] = $invalid_addr;
4824
+				$json['images'] = $images;
4825 4825
                 
4826
-                wp_send_json( $json );
4827
-                exit;
4828
-            } else if ( $task == 'import_loc' ) {
4829
-                global $gd_post_types;
4830
-                $gd_post_types = $post_types;
4826
+				wp_send_json( $json );
4827
+				exit;
4828
+			} else if ( $task == 'import_loc' ) {
4829
+				global $gd_post_types;
4830
+				$gd_post_types = $post_types;
4831 4831
                 
4832
-                if (!empty($file)) {
4833
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4832
+				if (!empty($file)) {
4833
+					$columns = isset($file[0]) ? $file[0] : NULL;
4834 4834
                     
4835
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4836
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4837
-                        wp_send_json( $json );
4838
-                    }
4835
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4836
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4837
+						wp_send_json( $json );
4838
+					}
4839 4839
                     
4840
-                    for ($i = 1; $i <= $limit; $i++) {
4841
-                        $index = $processed + $i;
4840
+					for ($i = 1; $i <= $limit; $i++) {
4841
+						$index = $processed + $i;
4842 4842
                         
4843
-                        if (isset($file[$index])) {
4844
-                            $row = $file[$index];
4845
-                            $row = array_map( 'trim', $row );
4846
-                            $data = array();
4843
+						if (isset($file[$index])) {
4844
+							$row = $file[$index];
4845
+							$row = array_map( 'trim', $row );
4846
+							$data = array();
4847 4847
                             
4848
-                            foreach ($columns as $c => $column ) {
4849
-                                if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4850
-                                    $data[$column] = $row[$c];
4851
-                                }
4852
-                            }
4848
+							foreach ($columns as $c => $column ) {
4849
+								if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4850
+									$data[$column] = $row[$c];
4851
+								}
4852
+							}
4853 4853
 
4854
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4855
-                                $invalid++;
4856
-                                continue;
4857
-                            }
4854
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4855
+								$invalid++;
4856
+								continue;
4857
+							}
4858 4858
                             
4859
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4859
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4860 4860
                             
4861
-                            if ( $import_choice == 'update' ) {
4862
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4863
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4864
-                                        $updated++;
4865
-                                    } else {
4866
-                                        $invalid++;
4867
-                                    }
4868
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4869
-                                    $data['location_id'] = (int)$location->location_id;
4861
+							if ( $import_choice == 'update' ) {
4862
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4863
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4864
+										$updated++;
4865
+									} else {
4866
+										$invalid++;
4867
+									}
4868
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4869
+									$data['location_id'] = (int)$location->location_id;
4870 4870
                                     
4871
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4872
-                                        $data['location_id'] = (int)$location->location_id;
4873
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4874
-                                        $data['location_id'] = (int)$location->location_id;
4875
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4876
-                                        $data['location_id'] = (int)$location->location_id;
4877
-                                    }
4871
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4872
+										$data['location_id'] = (int)$location->location_id;
4873
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4874
+										$data['location_id'] = (int)$location->location_id;
4875
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4876
+										$data['location_id'] = (int)$location->location_id;
4877
+									}
4878 4878
                                     
4879
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4880
-                                        $updated++;
4881
-                                    } else {
4882
-                                        $invalid++;
4883
-                                    }
4884
-                                } else {
4885
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4886
-                                        $created++;
4887
-                                    } else {
4888
-                                        $invalid++;
4889
-                                    }
4890
-                                }
4891
-                            } elseif ( $import_choice == 'skip' ) {
4892
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4893
-                                    $skipped++;
4894
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4895
-                                    $skipped++;
4896
-                                } else {
4897
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4898
-                                        $created++;
4899
-                                    } else {
4900
-                                        $invalid++;
4901
-                                    }
4902
-                                }
4903
-                            } else {
4904
-                                $invalid++;
4905
-                            }
4906
-                        }
4907
-                    }
4908
-                }
4879
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4880
+										$updated++;
4881
+									} else {
4882
+										$invalid++;
4883
+									}
4884
+								} else {
4885
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4886
+										$created++;
4887
+									} else {
4888
+										$invalid++;
4889
+									}
4890
+								}
4891
+							} elseif ( $import_choice == 'skip' ) {
4892
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4893
+									$skipped++;
4894
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4895
+									$skipped++;
4896
+								} else {
4897
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4898
+										$created++;
4899
+									} else {
4900
+										$invalid++;
4901
+									}
4902
+								}
4903
+							} else {
4904
+								$invalid++;
4905
+							}
4906
+						}
4907
+					}
4908
+				}
4909 4909
                 
4910
-                $json = array();
4911
-                $json['processed'] = $limit;
4912
-                $json['created'] = $created;
4913
-                $json['updated'] = $updated;
4914
-                $json['skipped'] = $skipped;
4915
-                $json['invalid'] = $invalid;
4916
-                $json['images'] = $images;
4910
+				$json = array();
4911
+				$json['processed'] = $limit;
4912
+				$json['created'] = $created;
4913
+				$json['updated'] = $updated;
4914
+				$json['skipped'] = $skipped;
4915
+				$json['invalid'] = $invalid;
4916
+				$json['images'] = $images;
4917 4917
                 
4918
-                wp_send_json( $json );
4919
-            } else if ( $task == 'import_hood' ) {               
4920
-                if (!empty($file)) {
4921
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4918
+				wp_send_json( $json );
4919
+			} else if ( $task == 'import_hood' ) {               
4920
+				if (!empty($file)) {
4921
+					$columns = isset($file[0]) ? $file[0] : NULL;
4922 4922
                     
4923
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4924
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4925
-                        wp_send_json( $json );
4926
-                    }
4923
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4924
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4925
+						wp_send_json( $json );
4926
+					}
4927 4927
                     
4928
-                    for ($i = 1; $i <= $limit; $i++) {
4929
-                        $index = $processed + $i;
4928
+					for ($i = 1; $i <= $limit; $i++) {
4929
+						$index = $processed + $i;
4930 4930
                         
4931
-                        if (isset($file[$index])) {
4932
-                            $row = $file[$index];
4933
-                            $row = array_map( 'trim', $row );
4934
-                            $data = array();
4931
+						if (isset($file[$index])) {
4932
+							$row = $file[$index];
4933
+							$row = array_map( 'trim', $row );
4934
+							$data = array();
4935 4935
                             
4936
-                            foreach ($columns as $c => $column) {
4937
-                                if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4938
-                                    $data[$column] = sanitize_text_field($row[$c]);
4939
-                                }
4940
-                            }
4936
+							foreach ($columns as $c => $column) {
4937
+								if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4938
+									$data[$column] = sanitize_text_field($row[$c]);
4939
+								}
4940
+							}
4941 4941
 
4942
-                            if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4943
-                                $invalid++;
4944
-                                continue;
4945
-                            }
4942
+							if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4943
+								$invalid++;
4944
+								continue;
4945
+							}
4946 4946
                             
4947
-                            $location_info = array();
4948
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4949
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4950
-                            } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4951
-                                $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4952
-                            }
4947
+							$location_info = array();
4948
+							if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4949
+								$location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4950
+							} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4951
+								$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4952
+							}
4953 4953
 
4954
-                            if (empty($location_info)) {
4955
-                                $invalid++;
4956
-                                continue;
4957
-                            }
4954
+							if (empty($location_info)) {
4955
+								$invalid++;
4956
+								continue;
4957
+							}
4958 4958
                             
4959
-                            $location_id = $location_info->location_id;
4959
+							$location_id = $location_info->location_id;
4960 4960
 
4961
-                            $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4961
+							$data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4962 4962
                             
4963
-                            $hood_data = array();
4964
-                            $hood_data['hood_name'] = $data['neighbourhood_name'];
4965
-                            $hood_data['hood_slug'] = $data['neighbourhood_slug'];
4966
-                            $hood_data['hood_latitude'] = $data['longitude'];
4967
-                            $hood_data['hood_longitude'] = $data['longitude'];
4968
-                            $hood_data['hood_location_id'] = $location_id;
4963
+							$hood_data = array();
4964
+							$hood_data['hood_name'] = $data['neighbourhood_name'];
4965
+							$hood_data['hood_slug'] = $data['neighbourhood_slug'];
4966
+							$hood_data['hood_latitude'] = $data['longitude'];
4967
+							$hood_data['hood_longitude'] = $data['longitude'];
4968
+							$hood_data['hood_location_id'] = $location_id;
4969 4969
                                     
4970
-                            if ( $import_choice == 'update' ) {
4971
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4972
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4970
+							if ( $import_choice == 'update' ) {
4971
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4972
+									$hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4973 4973
                                     
4974
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4975
-                                        $updated++;
4976
-                                    } else {
4977
-                                        $invalid++;
4978
-                                    }
4979
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4980
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4974
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4975
+										$updated++;
4976
+									} else {
4977
+										$invalid++;
4978
+									}
4979
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4980
+									$hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4981 4981
                                     
4982
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4983
-                                        $updated++;
4984
-                                    } else {
4985
-                                        $invalid++;
4986
-                                    }
4987
-                                } else {
4988
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4989
-                                        $created++;
4990
-                                    } else {
4991
-                                        $invalid++;
4992
-                                    }
4993
-                                }
4994
-                            } elseif ( $import_choice == 'skip' ) {
4995
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4996
-                                    $skipped++;
4997
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4998
-                                    $skipped++;
4999
-                                } else {
4982
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4983
+										$updated++;
4984
+									} else {
4985
+										$invalid++;
4986
+									}
4987
+								} else {
4988
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4989
+										$created++;
4990
+									} else {
4991
+										$invalid++;
4992
+									}
4993
+								}
4994
+							} elseif ( $import_choice == 'skip' ) {
4995
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4996
+									$skipped++;
4997
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4998
+									$skipped++;
4999
+								} else {
5000 5000
                                     
5001
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5002
-                                        $created++;
5003
-                                    } else {
5004
-                                        $invalid++;
5005
-                                    }
5006
-                                }
5007
-                            } else {
5008
-                                $invalid++;
5009
-                            }
5010
-                        }
5011
-                    }
5012
-                }
5001
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5002
+										$created++;
5003
+									} else {
5004
+										$invalid++;
5005
+									}
5006
+								}
5007
+							} else {
5008
+								$invalid++;
5009
+							}
5010
+						}
5011
+					}
5012
+				}
5013 5013
                 
5014
-                $json = array();
5015
-                $json['processed'] = $limit;
5016
-                $json['created'] = $created;
5017
-                $json['updated'] = $updated;
5018
-                $json['skipped'] = $skipped;
5019
-                $json['invalid'] = $invalid;
5020
-                $json['images'] = $images;
5014
+				$json = array();
5015
+				$json['processed'] = $limit;
5016
+				$json['created'] = $created;
5017
+				$json['updated'] = $updated;
5018
+				$json['skipped'] = $skipped;
5019
+				$json['invalid'] = $invalid;
5020
+				$json['images'] = $images;
5021 5021
                 
5022
-                wp_send_json( $json );
5023
-            }
5024
-        }
5025
-        break;
5026
-        case 'import_finish':{
5027
-            /**
5028
-             * Run an action when an import finishes.
5029
-             *
5030
-             * This action can be used to fire functions after an import ends.
5031
-             *
5032
-             * @since 1.5.3
5033
-             * @package GeoDirectory
5034
-             */
5035
-            do_action('geodir_import_finished');
5036
-        }
5037
-        break;
5022
+				wp_send_json( $json );
5023
+			}
5024
+		}
5025
+		break;
5026
+		case 'import_finish':{
5027
+			/**
5028
+			 * Run an action when an import finishes.
5029
+			 *
5030
+			 * This action can be used to fire functions after an import ends.
5031
+			 *
5032
+			 * @since 1.5.3
5033
+			 * @package GeoDirectory
5034
+			 */
5035
+			do_action('geodir_import_finished');
5036
+		}
5037
+		break;
5038 5038
 
5039
-    }
5040
-    echo '0';
5041
-    wp_die();
5039
+	}
5040
+	echo '0';
5041
+	wp_die();
5042 5042
 }
5043 5043
 
5044 5044
 /**
@@ -5082,12 +5082,12 @@  discard block
 block discarded – undo
5082 5082
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5083 5083
 	}
5084 5084
 	
5085
-    if( !empty( $term ) ) {
5085
+	if( !empty( $term ) ) {
5086 5086
 		$result = wp_insert_term( $term, $taxonomy, $args );
5087
-        if( !is_wp_error( $result ) ) {
5088
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5089
-        }
5090
-    }
5087
+		if( !is_wp_error( $result ) ) {
5088
+			return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5089
+		}
5090
+	}
5091 5091
 	
5092 5092
 	return false;
5093 5093
 }
@@ -5134,16 +5134,16 @@  discard block
 block discarded – undo
5134 5134
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5135 5135
 		
5136 5136
 		if( !is_wp_error( $result ) ) {
5137
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5138
-        }
5137
+			return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5138
+		}
5139 5139
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5140 5140
 		$term_data['term_id'] = $term_info['term_id'];
5141 5141
 		
5142 5142
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5143 5143
 		
5144 5144
 		if( !is_wp_error( $result ) ) {
5145
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5146
-        }
5145
+			return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5146
+		}
5147 5147
 	} else {
5148 5148
 		return geodir_imex_insert_term( $taxonomy, $term_data );
5149 5149
 	}
@@ -5168,7 +5168,7 @@  discard block
 block discarded – undo
5168 5168
 	 * Modify returned post counts for the current post type.
5169 5169
 	 *
5170 5170
 	 * @since 1.4.6
5171
-     * @package GeoDirectory
5171
+	 * @package GeoDirectory
5172 5172
 	 *
5173 5173
 	 * @param int $posts_count Post counts.
5174 5174
 	 * @param string $post_type Post type.
@@ -5231,9 +5231,9 @@  discard block
 block discarded – undo
5231 5231
 	
5232 5232
 	if ( !empty( $posts ) ) {
5233 5233
 		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5234
-        $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5235
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5236
-        $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5234
+		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5235
+		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5236
+		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5237 5237
 		
5238 5238
 		$csv_row = array();
5239 5239
 		$csv_row[] = 'post_id';
@@ -5277,11 +5277,11 @@  discard block
 block discarded – undo
5277 5277
 		$csv_row[] = 'post_zip';
5278 5278
 		$csv_row[] = 'post_latitude';
5279 5279
 		$csv_row[] = 'post_longitude';
5280
-        if ($neighbourhood_active) {
5281
-            $csv_row[] = 'post_neighbourhood';
5282
-            $csv_row[] = 'neighbourhood_latitude';
5283
-            $csv_row[] = 'neighbourhood_longitude';
5284
-        }
5280
+		if ($neighbourhood_active) {
5281
+			$csv_row[] = 'post_neighbourhood';
5282
+			$csv_row[] = 'neighbourhood_latitude';
5283
+			$csv_row[] = 'neighbourhood_longitude';
5284
+		}
5285 5285
 		$csv_row[] = 'geodir_timing';
5286 5286
 		$csv_row[] = 'geodir_contact';
5287 5287
 		$csv_row[] = 'geodir_email';
@@ -5316,7 +5316,7 @@  discard block
 block discarded – undo
5316 5316
 		$csv_rows[] = $csv_row;
5317 5317
 
5318 5318
 		$images_count = 5;
5319
-        $xx=0;
5319
+		$xx=0;
5320 5320
 		foreach ( $posts as $post ) {$xx++;
5321 5321
 			$post_id = $post['ID'];
5322 5322
 			
@@ -5463,21 +5463,21 @@  discard block
 block discarded – undo
5463 5463
 			$csv_row[] = $post_info['post_zip']; // post_zip
5464 5464
 			$csv_row[] = $post_info['post_latitude']; // post_latitude
5465 5465
 			$csv_row[] = $post_info['post_longitude']; // post_longitude
5466
-            if ($neighbourhood_active) {
5467
-                $post_neighbourhood = '';
5468
-                $neighbourhood_latitude = '';
5469
-                $neighbourhood_longitude = '';
5470
-                if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5471
-                    if (!empty($hood_info)) {
5472
-                        $post_neighbourhood = $hood_info->hood_name;
5473
-                        $neighbourhood_latitude = $hood_info->hood_latitude;
5474
-                        $neighbourhood_longitude = $hood_info->hood_longitude;
5475
-                    }
5476
-                }
5477
-                $csv_row[] = $post_neighbourhood; // post_neighbourhood
5478
-                $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5479
-                $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5480
-            }
5466
+			if ($neighbourhood_active) {
5467
+				$post_neighbourhood = '';
5468
+				$neighbourhood_latitude = '';
5469
+				$neighbourhood_longitude = '';
5470
+				if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5471
+					if (!empty($hood_info)) {
5472
+						$post_neighbourhood = $hood_info->hood_name;
5473
+						$neighbourhood_latitude = $hood_info->hood_latitude;
5474
+						$neighbourhood_longitude = $hood_info->hood_longitude;
5475
+					}
5476
+				}
5477
+				$csv_row[] = $post_neighbourhood; // post_neighbourhood
5478
+				$csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5479
+				$csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5480
+			}
5481 5481
 			$csv_row[] = $post_info['geodir_timing']; // geodir_timing
5482 5482
 			$csv_row[] = $post_info['geodir_contact']; // geodir_contact
5483 5483
 			$csv_row[] = $post_info['geodir_email']; // geodir_email
@@ -5571,7 +5571,7 @@  discard block
 block discarded – undo
5571 5571
 	 * Modify returned posts SQL query for the current post type.
5572 5572
 	 *
5573 5573
 	 * @since 1.4.6
5574
-     * @package GeoDirectory
5574
+	 * @package GeoDirectory
5575 5575
 	 *
5576 5576
 	 * @param int $query The SQL query.
5577 5577
 	 * @param string $post_type Post type.
@@ -5584,7 +5584,7 @@  discard block
 block discarded – undo
5584 5584
 	 * Modify returned post results for the current post type.
5585 5585
 	 *
5586 5586
 	 * @since 1.4.6
5587
-     * @package GeoDirectory
5587
+	 * @package GeoDirectory
5588 5588
 	 *
5589 5589
 	 * @param object $results An object containing all post ids.
5590 5590
 	 * @param string $post_type Post type.
@@ -6309,43 +6309,43 @@  discard block
 block discarded – undo
6309 6309
  * @param string $status Post status.
6310 6310
  */
6311 6311
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
6312
-    global $wpdb, $current_user;
6313
-
6314
-    $option_value = get_option($option);
6315
-
6316
-    if ($option_value > 0) :
6317
-        if (get_post($option_value)) :
6318
-            // Page exists
6319
-            return;
6320
-        endif;
6321
-    endif;
6322
-
6323
-    $page_found = $wpdb->get_var(
6324
-        $wpdb->prepare(
6325
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6326
-            array($slug)
6327
-        )
6328
-    );
6329
-
6330
-    if ($page_found) :
6331
-        // Page exists
6332
-        if (!$option_value) update_option($option, $page_found);
6333
-        return;
6334
-    endif;
6335
-
6336
-    $page_data = array(
6337
-        'post_status' => $status,
6338
-        'post_type' => 'page',
6339
-        'post_author' => $current_user->ID,
6340
-        'post_name' => $slug,
6341
-        'post_title' => $page_title,
6342
-        'post_content' => $page_content,
6343
-        'post_parent' => $post_parent,
6344
-        'comment_status' => 'closed'
6345
-    );
6346
-    $page_id = wp_insert_post($page_data);
6347
-
6348
-    add_option($option, $page_id);
6312
+	global $wpdb, $current_user;
6313
+
6314
+	$option_value = get_option($option);
6315
+
6316
+	if ($option_value > 0) :
6317
+		if (get_post($option_value)) :
6318
+			// Page exists
6319
+			return;
6320
+		endif;
6321
+	endif;
6322
+
6323
+	$page_found = $wpdb->get_var(
6324
+		$wpdb->prepare(
6325
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6326
+			array($slug)
6327
+		)
6328
+	);
6329
+
6330
+	if ($page_found) :
6331
+		// Page exists
6332
+		if (!$option_value) update_option($option, $page_found);
6333
+		return;
6334
+	endif;
6335
+
6336
+	$page_data = array(
6337
+		'post_status' => $status,
6338
+		'post_type' => 'page',
6339
+		'post_author' => $current_user->ID,
6340
+		'post_name' => $slug,
6341
+		'post_title' => $page_title,
6342
+		'post_content' => $page_content,
6343
+		'post_parent' => $post_parent,
6344
+		'comment_status' => 'closed'
6345
+	);
6346
+	$page_id = wp_insert_post($page_data);
6347
+
6348
+	add_option($option, $page_id);
6349 6349
 
6350 6350
 }
6351 6351
 
@@ -6376,9 +6376,9 @@  discard block
 block discarded – undo
6376 6376
  * @package GeoDirectory
6377 6377
  */
6378 6378
 function geodir_admin_upgrade_notice() {
6379
-    $class = "error";
6380
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6381
-    echo"<div class=\"$class\"> <p>$message</p></div>";
6379
+	$class = "error";
6380
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6381
+	echo"<div class=\"$class\"> <p>$message</p></div>";
6382 6382
 }
6383 6383
 
6384 6384
 /**
@@ -6391,18 +6391,18 @@  discard block
 block discarded – undo
6391 6391
  */
6392 6392
 function geodire_admin_upgrade_notice( $plugin_data, $r )
6393 6393
 {
6394
-    // readme contents
6395
-    $args = array(
6396
-        'timeout'     => 15,
6397
-        'redirection' => 5
6398
-    );
6399
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6400
-    $data       = wp_remote_get( $url, $args );
6394
+	// readme contents
6395
+	$args = array(
6396
+		'timeout'     => 15,
6397
+		'redirection' => 5
6398
+	);
6399
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6400
+	$data       = wp_remote_get( $url, $args );
6401 6401
 
6402
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
6402
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
6403 6403
 
6404
-        geodir_in_plugin_update_message($data['body']);
6405
-    }
6404
+		geodir_in_plugin_update_message($data['body']);
6405
+	}
6406 6406
 }
6407 6407
 
6408 6408
 
@@ -6410,28 +6410,28 @@  discard block
 block discarded – undo
6410 6410
 * @param string $body http response body
6411 6411
 */
6412 6412
 function geodir_in_plugin_update_message($content) {
6413
-    // Output Upgrade Notice
6414
-    $matches        = null;
6415
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6416
-    $upgrade_notice = '';
6417
-    if ( preg_match( $regexp, $content, $matches ) ) {
6418
-        if(empty($matches)){return;}
6419
-
6420
-        $version = trim( $matches[1] );
6421
-        if($version && $version>GEODIRECTORY_VERSION){
6422
-
6423
-
6424
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6425
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6426
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6427
-            foreach ( $notices as $index => $line ) {
6428
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6429
-            }
6430
-            $upgrade_notice .= '</div> ';
6431
-        }
6432
-        }
6433
-    }
6434
-    echo $upgrade_notice;
6413
+	// Output Upgrade Notice
6414
+	$matches        = null;
6415
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6416
+	$upgrade_notice = '';
6417
+	if ( preg_match( $regexp, $content, $matches ) ) {
6418
+		if(empty($matches)){return;}
6419
+
6420
+		$version = trim( $matches[1] );
6421
+		if($version && $version>GEODIRECTORY_VERSION){
6422
+
6423
+
6424
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6425
+		if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6426
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6427
+			foreach ( $notices as $index => $line ) {
6428
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6429
+			}
6430
+			$upgrade_notice .= '</div> ';
6431
+		}
6432
+		}
6433
+	}
6434
+	echo $upgrade_notice;
6435 6435
 }
6436 6436
 
6437 6437
 /**
Please login to merge, or discard this patch.
Spacing   +668 added lines, -668 removed lines patch added patch discarded remove patch
@@ -480,15 +480,15 @@  discard block
 block discarded – undo
480 480
                 <?php
481 481
 
482 482
                     $default_location = geodir_get_default_location();
483
-                  $city =  isset($default_location->city) ? $default_location->city : '';
484
-                  $region =isset($default_location->region) ? $default_location->region : '';
485
-                  $country =isset($default_location->country) ? $default_location->country : '';
486
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
483
+                  $city = isset($default_location->city) ? $default_location->city : '';
484
+                  $region = isset($default_location->region) ? $default_location->region : '';
485
+                  $country = isset($default_location->country) ? $default_location->country : '';
486
+                  $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
+                  $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
488 488
 
489 489
                 ?>
490 490
                 var geocoder = new google.maps.Geocoder();
491
-                var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
491
+                var CITY_ADDRESS = '<?php echo $city . ',' . $region . ',' . $country; ?>';
492 492
                 var bound_lat_lng;
493 493
                 var lat = <?php echo $city_latitude; ?>;
494 494
                 var lng = <?php echo $city_longitude; ?>;
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                             );
526 526
 
527 527
                         } else {
528
-                            alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
528
+                            alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
529 529
                         }
530 530
                     });
531 531
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
                     var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val();
539 539
 
540 540
                     if (id == 'geodir_dummy_delete') {
541
-                        if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
541
+                        if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
542 542
                             jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide();
543 543
                             jQuery('#sub_' + active_tab).find('.geodir_show_progress').show();
544 544
                             jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce,
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&insert_dummy_post_index=' + dummy_post_index + '&city_bound_lat1=' + bound_lat_lng[0] + '&city_bound_lng1=' + bound_lat_lng[1] + '&city_bound_lat2=' + bound_lat_lng[2] + '&city_bound_lng2=' + bound_lat_lng[3] + '&_wpnonce=' + nonce,
558 558
                             function (data) {
559 559
 
560
-                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:','geodirectory');?> ' + dummy_post_index + ' <?php _e('of' ,'geodirectory'); ?> ' + total_dummy_post_count + '');
560
+                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:', 'geodirectory'); ?> ' + dummy_post_index + ' <?php _e('of', 'geodirectory'); ?> ' + total_dummy_post_count + '');
561 561
                                 dummy_post_index++;
562 562
                                 if (dummy_post_index <= total_dummy_post_count)
563 563
                                     geodir_autoinstall(obj, id, nonce, posttype);
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                     else
667 667
                         $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
668 668
                     $catname = str_replace(' ', '_', $catname);
669
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
669
+                    $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
670 670
 
671 671
                     if (empty($uploaded['error'])) {
672 672
                         $new_path = $uploaded['file'];
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
                 else
708 708
                     $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
709 709
                 $catname = str_replace(' ', '_', $catname);
710
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
710
+                $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
711 711
 
712 712
                 if (empty($uploaded['error'])) {
713 713
                     $new_path = $uploaded['file'];
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
  */
1017 1017
 function geodir_extend_geodirectory_setting_tab($tabs)
1018 1018
 {
1019
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1019
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory') . ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1020 1020
     return $tabs;
1021 1021
 }
1022 1022
 
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 function geodir_post_information_save($post_id, $post) {
1170 1170
     global $wpdb, $current_user;
1171 1171
 
1172
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1172
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
1173 1173
         return;
1174 1174
     }
1175 1175
 
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1310 1310
                                            id="<?php echo esc_attr($value['id']); ?>"
1311 1311
                                            type="<?php echo esc_attr($value['type']); ?>"
1312
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1312
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1313 1313
                                            style=" <?php echo esc_attr($value['css']); ?>"
1314 1314
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1315 1315
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1327 1327
                                            id="<?php echo esc_attr($value['id']); ?>"
1328 1328
                                            type="<?php echo esc_attr($value['type']); ?>"
1329
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1329
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1330 1330
                                            style="<?php echo esc_attr($value['css']); ?>"
1331 1331
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1332 1332
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
                                             id="<?php echo esc_attr($value['id']); ?>"
1433 1433
                                             style="<?php echo esc_attr($value['css']); ?>"
1434 1434
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1435
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1435
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
1436 1436
                                             option-ajaxchosen="false">
1437 1437
                         <?php
1438 1438
                         foreach ($value['options'] as $key => $val) {
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
                             } else {
1444 1444
                                 ?>
1445 1445
                                 <option
1446
-                                    value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option>
1446
+                                    value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>><?php echo ucfirst($val) ?></option>
1447 1447
                             <?php
1448 1448
                             }
1449 1449
                         }
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
                 ?>
1479 1479
 
1480 1480
                 <tr valign="top">
1481
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1481
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
1482 1482
                     <td width="60%">
1483 1483
                         <select name="geodir_default_map_language" style="width:60%">
1484 1484
                             <?php
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
 
1561 1561
                 <tr valign="top">
1562 1562
                     <th class="titledesc"
1563
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
1563
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
1564 1564
                     <td width="60%">
1565 1565
                         <select name="geodir_default_map_search_pt" style="width:60%">
1566 1566
                             <?php
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
                         $cat_display = 'checkbox';
1602 1602
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1603 1603
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
1604
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1604
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
1605 1605
                         $count = 1;
1606 1606
                         ?>
1607 1607
                         <table width="70%" class="widefat">
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
                                                                                            name="home_map_post_types[]"
1631 1631
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
1632 1632
                                                                                            value="<?php echo $key; ?>"
1633
-                                                                                           class="map_post_type" <?php echo $checked;?> />
1633
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
1634 1634
                                         <?php echo $post_types_obj->labels->singular_name; ?></td>
1635 1635
                                     <td width="40%">
1636 1636
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -1688,12 +1688,12 @@  discard block
 block discarded – undo
1688 1688
                 ?>
1689 1689
                 <fieldset>
1690 1690
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1691
-                    <label for="<?php echo $value['id'];?>">
1691
+                    <label for="<?php echo $value['id']; ?>">
1692 1692
                         <input name="<?php echo esc_attr($value['id']); ?>"
1693 1693
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1694 1694
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1695 1695
                             echo 'checked="checked"';
1696
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1696
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
1697 1697
                         <?php echo $value['desc']; ?></label><br>
1698 1698
                 </fieldset>
1699 1699
                 <?php
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
                     <textarea
1716 1716
                         <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1717 1717
                         id="<?php echo esc_attr($value['id']); ?>"
1718
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1718
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1719 1719
                         style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
1720 1720
                         class="description"><?php echo $value['desc'] ?></span>
1721 1721
 
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
 					}
1763 1763
 				}
1764 1764
 				//
1765
-				$page_setting = (int)get_option($value['id']);
1765
+				$page_setting = (int) get_option($value['id']);
1766 1766
 
1767 1767
                 $args = array('name' => $value['id'],
1768 1768
                     'id' => $value['id'],
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
                 break;
1790 1790
             case 'single_select_country' :
1791 1791
                 $countries = $geodirectory->countries->countries;
1792
-                $country_setting = (string)get_option($value['id']);
1792
+                $country_setting = (string) get_option($value['id']);
1793 1793
                 if (strstr($country_setting, ':')) :
1794 1794
                     $country = current(explode(':', $country_setting));
1795 1795
                     $state = end(explode(':', $country_setting));
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
             case 'multi_select_countries' :
1813 1813
                 $countries = $geodirectory->countries->countries;
1814 1814
                 asort($countries);
1815
-                $selections = (array)get_option($value['id']);
1815
+                $selections = (array) get_option($value['id']);
1816 1816
                 ?>
1817 1817
                 <tr valign="top">
1818 1818
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1834,8 +1834,8 @@  discard block
 block discarded – undo
1834 1834
                 break;
1835 1835
 
1836 1836
             case 'google_analytics' :
1837
-                $selections = (array)get_option($value['id']);
1838
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1837
+                $selections = (array) get_option($value['id']);
1838
+                if (get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret')) {
1839 1839
                     ?>
1840 1840
                     <tr valign="top">
1841 1841
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1846,10 +1846,10 @@  discard block
 block discarded – undo
1846 1846
 
1847 1847
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1848 1848
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1849
-                            $state = "&state=123";//any string
1849
+                            $state = "&state=123"; //any string
1850 1850
                             $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1851 1851
                             $response_type = "&response_type=code";
1852
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1852
+                            $client_id = "&client_id=" . get_option('geodir_ga_client_id');
1853 1853
                             $access_type = "&access_type=offline";
1854 1854
                             $approval_prompt = "&approval_prompt=force";
1855 1855
 
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
                             ?>
1860 1860
                             <script>
1861 1861
                                 function gd_ga_popup() {
1862
-                                    var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
1862
+                                    var win = window.open("<?php echo $auth_url; ?>", "Google Analytics", "");
1863 1863
                                     var pollTimer = window.setInterval(function () {
1864 1864
                                         if (win.closed !== false) { // !== is required for compatibility with Opera
1865 1865
                                             window.clearInterval(pollTimer);
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
                             } else {
1882 1882
                                 ?>
1883 1883
                                 <span class="button-primary"
1884
-                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
1884
+                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory'); ?></span>
1885 1885
                             <?php
1886 1886
                             }
1887 1887
                             ?>
@@ -1952,9 +1952,9 @@  discard block
 block discarded – undo
1952 1952
 
1953 1953
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
1954 1954
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
1955
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
1955
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
1956 1956
             jQuery('.gd-content-heading').hide();
1957
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
1957
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
1958 1958
             <?php } ?>
1959 1959
         });
1960 1960
     </script>
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
         <div
2097 2097
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2098 2098
             id="<?php echo $id; ?>plupload-upload-ui">
2099
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
2099
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
2100 2100
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2101 2101
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
2102 2102
             <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2112 2112
         </div>
2113 2113
         <span
2114
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2114
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2115 2115
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2116 2116
     </div>
2117 2117
 
@@ -2489,11 +2489,11 @@  discard block
 block discarded – undo
2489 2489
 function geodir_hide_admin_preview_button() {
2490 2490
     global $post_type;
2491 2491
     $post_types = geodir_get_posttypes();
2492
-    if(in_array($post_type, $post_types))
2492
+    if (in_array($post_type, $post_types))
2493 2493
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2494 2494
 }
2495
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2496
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2495
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
2496
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
2497 2497
 
2498 2498
 /**
2499 2499
  * Add the tab in left sidebar menu fro import & export page.
@@ -2503,8 +2503,8 @@  discard block
 block discarded – undo
2503 2503
  *
2504 2504
  * @return array Array of tab data.
2505 2505
  */
2506
-function geodir_import_export_tab( $tabs ) {
2507
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2506
+function geodir_import_export_tab($tabs) {
2507
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
2508 2508
     return $tabs;
2509 2509
 }
2510 2510
 
@@ -2518,7 +2518,7 @@  discard block
 block discarded – undo
2518 2518
  * @return string Html content.
2519 2519
  */
2520 2520
 function geodir_import_export_page() {
2521
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2521
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
2522 2522
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2523 2523
     /**
2524 2524
      * Filter sample category data csv file url.
@@ -2528,7 +2528,7 @@  discard block
 block discarded – undo
2528 2528
      *
2529 2529
      * @param string $gd_cats_sample_csv Sample category data csv file url.
2530 2530
      */
2531
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2531
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
2532 2532
 	
2533 2533
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2534 2534
     /**
@@ -2539,15 +2539,15 @@  discard block
 block discarded – undo
2539 2539
      *
2540 2540
      * @param string $gd_posts_sample_csv Sample post data csv file url.
2541 2541
      */
2542
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2542
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
2543 2543
 	
2544
-	$gd_posttypes = geodir_get_posttypes( 'array' );
2544
+	$gd_posttypes = geodir_get_posttypes('array');
2545 2545
 	
2546 2546
 	$gd_posttypes_option = '';
2547
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
2548
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
2547
+	foreach ($gd_posttypes as $gd_posttype => $row) {
2548
+		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int) geodir_get_terms_count($gd_posttype) . '" data-posts="' . (int) geodir_get_posts_count($gd_posttype) . '">' . __($row['labels']['name'], 'geodirectory') . '</option>';
2549 2549
 	}
2550
-	wp_enqueue_script( 'jquery-ui-progressbar' );
2550
+	wp_enqueue_script('jquery-ui-progressbar');
2551 2551
 	
2552 2552
 	$gd_chunksize_options = array();
2553 2553
 	$gd_chunksize_options[100] = 100;
@@ -2569,7 +2569,7 @@  discard block
 block discarded – undo
2569 2569
      *
2570 2570
      * @param string $gd_chunksize_options Entries options.
2571 2571
      */
2572
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2572
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
2573 2573
 	
2574 2574
 	$gd_chunksize_option = '';
2575 2575
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2580,38 +2580,38 @@  discard block
 block discarded – undo
2580 2580
 ?>
2581 2581
 </form>
2582 2582
 <div class="inner_content_tab_main gd-import-export">
2583
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
2584
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
2583
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
2584
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
2585 2585
   <div class="gd-content-heading">
2586 2586
 
2587 2587
   <?php
2588 2588
     ini_set('max_execution_time', 999999);
2589
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2589
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
2590 2590
     ini_restore('max_execution_time');
2591 2591
 
2592
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2592
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
2593 2593
         ?>
2594 2594
 	<div id="gd_ie_reqs" class="metabox-holder">
2595 2595
       <div class="meta-box-sortables ui-sortable">
2596 2596
         <div class="postbox">
2597
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
2597
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
2598 2598
           <div class="inside">
2599
-            <span class="description"><?php echo __( 'Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory' );?></span>
2599
+            <span class="description"><?php echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory'); ?></span>
2600 2600
 			<table class="form-table">
2601 2601
 				<thead>
2602 2602
 				  <tr>
2603
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
2603
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
2604 2604
 				  </tr>
2605 2605
 				</thead>
2606 2606
 				<tbody>
2607 2607
 				  <tr>
2608
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
2608
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
2609 2609
 				  </tr>
2610 2610
 				  <tr>
2611
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
2611
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
2612 2612
 				  </tr>
2613 2613
 				  <tr>
2614
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
2614
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
2615 2615
 				  </tr>
2616 2616
 				</tbody>
2617 2617
 		    </table>
@@ -2623,21 +2623,21 @@  discard block
 block discarded – undo
2623 2623
 	<div id="gd_ie_imposts" class="metabox-holder">
2624 2624
       <div class="meta-box-sortables ui-sortable">
2625 2625
         <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox">
2626
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Listings: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2627
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
2626
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Listings: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2627
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
2628 2628
           <div class="inside">
2629 2629
             <table class="form-table">
2630 2630
 				<tbody>
2631 2631
 				  <tr>
2632 2632
 					<td class="gd-imex-box">
2633 2633
 						<div class="gd-im-choices">
2634
-						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e( 'Update listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2635
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2634
+						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e('Update listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2635
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e('Ignore listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2636 2636
 						</div>
2637 2637
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
2638 2638
 							<input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
2639
-							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2640
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
2639
+							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2640
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
2641 2641
 							<?php
2642 2642
 							/**
2643 2643
 							 * Called just after the sample CSV download link.
@@ -2646,7 +2646,7 @@  discard block
 block discarded – undo
2646 2646
 							 */
2647 2647
 							do_action('geodir_sample_csv_download_link');
2648 2648
 							?>
2649
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
2649
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
2650 2650
 							<div class="filelist"></div>
2651 2651
 						</div>
2652 2652
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2665 2665
 						</div>
2666 2666
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2667
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2667
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2668 2668
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2669 2669
 									id="gd-import-perc">0%</font> )
2670 2670
 								<div class="gd-fileprogress"></div>
@@ -2676,10 +2676,10 @@  discard block
 block discarded – undo
2676 2676
                     	<div class="gd-imex-btns" style="display:none;">
2677 2677
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2678 2678
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2679
-                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2680
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2679
+                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2680
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2681 2681
 							<div id="gd_process_data" style="display:none">
2682
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2682
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2683 2683
 							</div>
2684 2684
 						</div>
2685 2685
 					</td>
@@ -2693,26 +2693,26 @@  discard block
 block discarded – undo
2693 2693
 	<div id="gd_ie_excategs" class="metabox-holder">
2694 2694
 	  <div class="meta-box-sortables ui-sortable">
2695 2695
 		<div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox">
2696
-		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - Listings: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2697
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
2696
+		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - Listings: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2697
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
2698 2698
 		  <div class="inside">
2699 2699
 			<table class="form-table">
2700 2700
 			  <tbody>
2701 2701
 				<tr>
2702 2702
 				  <td class="fld"><label for="gd_post_type">
2703
-					<?php _e( 'Post Type:', 'geodirectory' );?>
2703
+					<?php _e('Post Type:', 'geodirectory'); ?>
2704 2704
 					</label></td>
2705 2705
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
2706
-					  <?php echo $gd_posttypes_option;?>
2706
+					  <?php echo $gd_posttypes_option; ?>
2707 2707
 					</select></td>
2708 2708
 				</tr>
2709 2709
 				<tr>
2710
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2711
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2710
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2711
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2712 2712
 				  </tr>
2713 2713
 				<tr>
2714 2714
 				  <td class="fld" style="vertical-align:top"><label>
2715
-					<?php _e( 'Progress:', 'geodirectory' );?>
2715
+					<?php _e('Progress:', 'geodirectory'); ?>
2716 2716
 					</label></td>
2717 2717
 				  <td><div id='gd_progressbar_box'>
2718 2718
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -2720,13 +2720,13 @@  discard block
 block discarded – undo
2720 2720
 					  </div>
2721 2721
 					</div>
2722 2722
 					<p style="display:inline-block">
2723
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
2723
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
2724 2724
 					</p>
2725 2725
 					  
2726 2726
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2727 2727
 				</tr>
2728 2728
 				<tr class="gd-ie-actions">
2729
-				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2729
+				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2730 2730
 				  </td>
2731 2731
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
2732 2732
 				</tr>
@@ -2739,21 +2739,21 @@  discard block
 block discarded – undo
2739 2739
 	<div id="gd_ie_imcategs" class="metabox-holder">
2740 2740
       <div class="meta-box-sortables ui-sortable">
2741 2741
         <div id="gd_ie_imcats" class="postbox gd-hndle-pbox">
2742
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2743
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
2742
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2743
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
2744 2744
           <div class="inside">
2745 2745
             <table class="form-table">
2746 2746
 				<tbody>
2747 2747
 				  <tr>
2748 2748
 					<td class="gd-imex-box">
2749 2749
 						<div class="gd-im-choices">
2750
-						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2751
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2750
+						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2751
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2752 2752
 						</div>
2753 2753
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
2754 2754
 							<input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
2755
-							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2756
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
2755
+							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2756
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
2757 2757
 						<?php
2758 2758
 						/**
2759 2759
 						 * Called just after the sample CSV download link.
@@ -2763,7 +2763,7 @@  discard block
 block discarded – undo
2763 2763
 						 */
2764 2764
 						do_action('geodir_sample_cats_csv_download_link');
2765 2765
 						?>
2766
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
2766
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
2767 2767
 							<div class="filelist"></div>
2768 2768
 						</div>
2769 2769
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2780,7 +2780,7 @@  discard block
 block discarded – undo
2780 2780
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2781 2781
 						</div>
2782 2782
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2783
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2783
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2784 2784
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2785 2785
 									id="gd-import-perc">0%</font> )
2786 2786
 								<div class="gd-fileprogress"></div>
@@ -2792,10 +2792,10 @@  discard block
 block discarded – undo
2792 2792
                     	<div class="gd-imex-btns" style="display:none;">
2793 2793
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2794 2794
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2795
-                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2796
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2795
+                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2796
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2797 2797
 							<div id="gd_process_data" style="display:none">
2798
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2798
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2799 2799
 							</div>
2800 2800
 						</div>
2801 2801
 					</td>
@@ -2809,26 +2809,26 @@  discard block
 block discarded – undo
2809 2809
 	<div id="gd_ie_excategs" class="metabox-holder">
2810 2810
       <div class="meta-box-sortables ui-sortable">
2811 2811
         <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox">
2812
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2813
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
2812
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2813
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
2814 2814
           <div class="inside">
2815 2815
             <table class="form-table">
2816 2816
 				<tbody>
2817 2817
 				  <tr>
2818
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
2819
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
2818
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
2819
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
2820 2820
 				  </tr>
2821 2821
 				   <tr>
2822
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2823
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2822
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2823
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2824 2824
 				  </tr>
2825 2825
 				  <tr>
2826
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
2827
-					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2826
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
2827
+					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2828 2828
 				  </tr>
2829 2829
 				  <tr class="gd-ie-actions">
2830 2830
 					<td style="vertical-align:top">
2831
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2831
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2832 2832
 					</td>
2833 2833
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
2834 2834
 				  </tr>
@@ -2850,7 +2850,7 @@  discard block
 block discarded – undo
2850 2850
      * @param array $gd_chunksize_options File chunk size options.
2851 2851
      * @param string $nonce Wordpress security token for GD import & export.
2852 2852
 	 */
2853
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2853
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
2854 2854
 	?>
2855 2855
   </div>
2856 2856
 </div>
@@ -2869,7 +2869,7 @@  discard block
 block discarded – undo
2869 2869
         jQuery.ajax({
2870 2870
             url: ajaxurl,
2871 2871
             type: "POST",
2872
-            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
2872
+            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
2873 2873
             dataType: 'json',
2874 2874
             cache: false,
2875 2875
             success: function(data) {
@@ -2921,7 +2921,7 @@  discard block
 block discarded – undo
2921 2921
 
2922 2922
         jQuery(cont).find('.filelist .file').remove();
2923 2923
         
2924
-        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
2924
+        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
2925 2925
         jQuery('#gd-import-msg', cont).show();
2926 2926
         
2927 2927
         return false;
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
     jQuery.ajax({
2981 2981
         url: ajaxurl,
2982 2982
         type: "POST",
2983
-        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
2983
+        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
2984 2984
         dataType : 'json',
2985 2985
         cache: false,
2986 2986
         success: function (data) {
@@ -3169,27 +3169,27 @@  discard block
 block discarded – undo
3169 3169
 
3170 3170
     var gdMsg = '<p></p>';
3171 3171
     if ( processed > 0 ) {
3172
-        var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
3172
+        var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
3173 3173
         msgParse = msgParse.replace("%s", processed);
3174 3174
         gdMsg += msgParse;
3175 3175
     }
3176 3176
 
3177 3177
     if ( updated > 0 ) {
3178
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3178
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
3179 3179
         msgParse = msgParse.replace("%s", updated);
3180 3180
         msgParse = msgParse.replace("%d", processed);
3181 3181
         gdMsg += msgParse;
3182 3182
     }
3183 3183
 
3184 3184
     if ( created > 0 ) {
3185
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3185
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
3186 3186
         msgParse = msgParse.replace("%s", created);
3187 3187
         msgParse = msgParse.replace("%d", processed);
3188 3188
         gdMsg += msgParse;
3189 3189
     }
3190 3190
 
3191 3191
     if ( skipped > 0 ) {
3192
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3192
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
3193 3193
         msgParse = msgParse.replace("%s", skipped);
3194 3194
         msgParse = msgParse.replace("%d", processed);
3195 3195
         gdMsg += msgParse;
@@ -3199,17 +3199,17 @@  discard block
 block discarded – undo
3199 3199
         if (type=='loc') {
3200 3200
             invalid_addr = invalid;
3201 3201
         }
3202
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>';
3202
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
3203 3203
         msgParse = msgParse.replace("%s", invalid_addr);
3204 3204
         msgParse = msgParse.replace("%d", total);
3205 3205
         gdMsg += msgParse;
3206 3206
     }
3207 3207
 
3208 3208
     if (invalid > 0 && type!='loc') {
3209
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3209
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory'), '%s', '%d')); ?></p>';
3210 3210
         
3211 3211
         if (type=='hood') {
3212
-            msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ), '%s', '%d' ) );?></p>';
3212
+            msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory'), '%s', '%d')); ?></p>';
3213 3213
         }
3214 3214
         msgParse = msgParse.replace("%s", invalid);
3215 3215
         msgParse = msgParse.replace("%d", total);
@@ -3217,7 +3217,7 @@  discard block
 block discarded – undo
3217 3217
     }
3218 3218
 
3219 3219
     if (images > 0) {
3220
-        gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>';
3220
+        gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>';
3221 3221
     }
3222 3222
     gdMsg += '<p></p>';
3223 3223
     jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -3374,7 +3374,7 @@  discard block
 block discarded – undo
3374 3374
         
3375 3375
     function gd_process_export_posts(el, post_type, total_posts, chunk_size, pages, page) {
3376 3376
         if (page < 2) {
3377
-            gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3377
+            gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3378 3378
             jQuery(el).find('#gd_timer').text('00:00:01');
3379 3379
             jQuery('#gd_ie_ex_files', el).html('');
3380 3380
         }
@@ -3382,7 +3382,7 @@  discard block
 block discarded – undo
3382 3382
         jQuery.ajax({
3383 3383
             url: ajaxurl,
3384 3384
             type: "POST",
3385
-            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3385
+            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3386 3386
             dataType : 'json',
3387 3387
             cache: false,
3388 3388
             beforeSend: function (jqXHR, settings) {},
@@ -3396,11 +3396,11 @@  discard block
 block discarded – undo
3396 3396
                     } else {
3397 3397
                         if (pages < page || pages == page) {
3398 3398
                             window.clearInterval(timer_posts);
3399
-                            gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3399
+                            gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3400 3400
                         } else {
3401 3401
                             var percentage = Math.round(((page * chunk_size) / total_posts) * 100);
3402 3402
                             percentage = percentage > 100 ? 100 : percentage;
3403
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3403
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3404 3404
                         }
3405 3405
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3406 3406
                             var obj_files = data.files;
@@ -3430,7 +3430,7 @@  discard block
 block discarded – undo
3430 3430
 
3431 3431
     function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
3432 3432
         if (page < 2) {
3433
-            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3433
+            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3434 3434
             jQuery(el).find('#gd_timer').text('00:00:01');
3435 3435
             jQuery('#gd_ie_ex_files', el).html('');
3436 3436
         }
@@ -3438,7 +3438,7 @@  discard block
 block discarded – undo
3438 3438
         jQuery.ajax({
3439 3439
             url: ajaxurl,
3440 3440
             type: "POST",
3441
-            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3441
+            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3442 3442
             dataType : 'json',
3443 3443
             cache: false,
3444 3444
             beforeSend: function (jqXHR, settings) {},
@@ -3452,11 +3452,11 @@  discard block
 block discarded – undo
3452 3452
                     } else {
3453 3453
                         if (pages < page || pages == page) {
3454 3454
                             window.clearInterval(timer_cats);
3455
-                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3455
+                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3456 3456
                         } else {
3457 3457
                             var percentage = Math.round(((page * chunk_size) / total_cats) * 100);
3458 3458
                             percentage = percentage > 100 ? 100 : percentage;
3459
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
3459
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
3460 3460
                         }
3461 3461
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3462 3462
                             var obj_files = data.files;
@@ -3513,8 +3513,8 @@  discard block
 block discarded – undo
3513 3513
 function geodir_init_filesystem()
3514 3514
 {
3515 3515
 
3516
-    if(!function_exists('get_filesystem_method')){
3517
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3516
+    if (!function_exists('get_filesystem_method')) {
3517
+        require_once(ABSPATH . "/wp-admin/includes/file.php");
3518 3518
     }
3519 3519
     $access_type = get_filesystem_method();
3520 3520
     if ($access_type === 'direct') {
@@ -3567,7 +3567,7 @@  discard block
 block discarded – undo
3567 3567
  * @package GeoDirectory
3568 3568
  */
3569 3569
 function geodir_filesystem_notice()
3570
-{   if ( defined( 'DOING_AJAX' ) ){return;}
3570
+{   if (defined('DOING_AJAX')) {return; }
3571 3571
     $access_type = get_filesystem_method();
3572 3572
     if ($access_type === 'direct') {
3573 3573
     } elseif (!defined('FTP_USER')) {
@@ -3604,64 +3604,64 @@  discard block
 block discarded – undo
3604 3604
     // try to set higher limits for import
3605 3605
     $max_input_time = ini_get('max_input_time');
3606 3606
     $max_execution_time = ini_get('max_execution_time');
3607
-    $memory_limit= ini_get('memory_limit');
3607
+    $memory_limit = ini_get('memory_limit');
3608 3608
 
3609
-    if(!$max_input_time || $max_input_time<3000){
3609
+    if (!$max_input_time || $max_input_time < 3000) {
3610 3610
         ini_set('max_input_time', 3000);
3611 3611
     }
3612 3612
 
3613
-    if(!$max_execution_time || $max_execution_time<3000){
3613
+    if (!$max_execution_time || $max_execution_time < 3000) {
3614 3614
         ini_set('max_execution_time', 3000);
3615 3615
     }
3616 3616
 
3617
-    if($memory_limit && str_replace('M','',$memory_limit)){
3618
-        if(str_replace('M','',$memory_limit)<256){
3617
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
3618
+        if (str_replace('M', '', $memory_limit) < 256) {
3619 3619
             ini_set('memory_limit', '256M');
3620 3620
         }
3621 3621
     }
3622 3622
 
3623 3623
     $json = array();
3624 3624
 
3625
-    if ( !current_user_can( 'manage_options' ) ) {
3626
-        wp_send_json( $json );
3625
+    if (!current_user_can('manage_options')) {
3626
+        wp_send_json($json);
3627 3627
     }
3628 3628
 
3629
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3630
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3631
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3629
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
3630
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
3631
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
3632 3632
 
3633
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3634
-        wp_send_json( $json );
3633
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
3634
+        wp_send_json($json);
3635 3635
     }
3636 3636
 
3637
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3638
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3637
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
3638
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
3639 3639
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3640
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3640
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
3641 3641
 
3642 3642
     $wp_filesystem = geodir_init_filesystem();
3643 3643
     if (!$wp_filesystem) {
3644
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3645
-        wp_send_json( $json );
3644
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
3645
+        wp_send_json($json);
3646 3646
     }
3647 3647
 
3648 3648
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3649
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3650
-        wp_send_json( $json );
3649
+        $json['error'] = __('Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory');
3650
+        wp_send_json($json);
3651 3651
     }
3652 3652
 
3653
-    $csv_file_dir = geodir_path_import_export( false );
3654
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3655
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3656
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3657
-            wp_send_json( $json );
3653
+    $csv_file_dir = geodir_path_import_export(false);
3654
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
3655
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
3656
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
3657
+            wp_send_json($json);
3658 3658
         }
3659 3659
     }
3660 3660
     
3661 3661
     $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3662 3662
     $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3663 3663
 
3664
-    switch ( $task ) {
3664
+    switch ($task) {
3665 3665
         case 'export_posts': {
3666 3666
             // WPML
3667 3667
             $is_wpml = geodir_is_wpml();
@@ -3672,12 +3672,12 @@  discard block
 block discarded – undo
3672 3672
                 $sitepress->switch_lang('all', true);
3673 3673
             }
3674 3674
             // WPML
3675
-            if ( $post_type == 'gd_event' ) {
3675
+            if ($post_type == 'gd_event') {
3676 3676
                 //add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 );
3677
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3677
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
3678 3678
             }
3679
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3680
-            $posts_count = geodir_get_posts_count( $post_type );
3679
+            $file_name = $post_type . '_' . date('dmyHi');
3680
+            $posts_count = geodir_get_posts_count($post_type);
3681 3681
             $file_url_base = geodir_path_import_export() . '/';
3682 3682
             $file_url = $file_url_base . $file_name . '.csv';
3683 3683
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
@@ -3685,10 +3685,10 @@  discard block
 block discarded – undo
3685 3685
             
3686 3686
             $chunk_file_paths = array();
3687 3687
 
3688
-            if ( isset( $_REQUEST['_st'] ) ) {
3689
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3690
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3691
-                $percentage = min( $percentage, 100 );
3688
+            if (isset($_REQUEST['_st'])) {
3689
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3690
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
3691
+                $percentage = min($percentage, 100);
3692 3692
                 
3693 3693
                 $json['percentage'] = $percentage;
3694 3694
                 // WPML
@@ -3696,45 +3696,45 @@  discard block
 block discarded – undo
3696 3696
                     $sitepress->switch_lang($active_lang, true);
3697 3697
                 }
3698 3698
                 // WPML
3699
-                wp_send_json( $json );
3699
+                wp_send_json($json);
3700 3700
                 exit;
3701 3701
             } else {
3702
-                if ( !$posts_count > 0 ) {
3703
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3702
+                if (!$posts_count > 0) {
3703
+                    $json['error'] = __('No records to export.', 'geodirectory');
3704 3704
                 } else {
3705 3705
                     $total_posts = $posts_count;
3706 3706
                     if ($chunk_per_page > $total_posts) {
3707 3707
                         $chunk_per_page = $total_posts;
3708 3708
                     }
3709
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3709
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
3710 3710
                     
3711 3711
                     $j = $chunk_page_no;
3712
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3712
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
3713 3713
                     
3714 3714
                     $per_page = 500;
3715 3715
                     if ($per_page > $chunk_per_page) {
3716 3716
                         $per_page = $chunk_per_page;
3717 3717
                     }
3718
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3718
+                    $total_pages = ceil($chunk_per_page / $per_page);
3719 3719
                     
3720
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3721
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3720
+                    for ($i = 0; $i <= $total_pages; $i++) {
3721
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
3722 3722
                         
3723 3723
                         $clear = $i == 0 ? true : false;
3724
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3724
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
3725 3725
                     }
3726 3726
                         
3727
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3727
+                    if ($wp_filesystem->exists($file_path_temp)) {
3728 3728
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3729 3729
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3730 3730
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
3731
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3731
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3732 3732
                         
3733 3733
                         $file_url = $file_url_base . $chunk_file_name;
3734 3734
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3735 3735
                     }
3736 3736
                     
3737
-                    if ( !empty($chunk_file_paths) ) {
3737
+                    if (!empty($chunk_file_paths)) {
3738 3738
                         $json['total'] = $posts_count;
3739 3739
                         $json['files'] = $chunk_file_paths;
3740 3740
                     } else {
@@ -3742,7 +3742,7 @@  discard block
 block discarded – undo
3742 3742
                             $json['total'] = $items_count;
3743 3743
                             $json['files'] = array();
3744 3744
                         } else {
3745
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3745
+                            $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3746 3746
                         }
3747 3747
                     }
3748 3748
                 }
@@ -3751,7 +3751,7 @@  discard block
 block discarded – undo
3751 3751
                     $sitepress->switch_lang($active_lang, true);
3752 3752
                 }
3753 3753
                 // WPML
3754
-                wp_send_json( $json );
3754
+                wp_send_json($json);
3755 3755
             }
3756 3756
         }
3757 3757
         break;
@@ -3765,9 +3765,9 @@  discard block
 block discarded – undo
3765 3765
                 $sitepress->switch_lang('all', true);
3766 3766
             }
3767 3767
             // WPML
3768
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3768
+            $file_name = $post_type . 'category_' . date('dmyHi');
3769 3769
             
3770
-            $terms_count = geodir_get_terms_count( $post_type );
3770
+            $terms_count = geodir_get_terms_count($post_type);
3771 3771
             $file_url_base = geodir_path_import_export() . '/';
3772 3772
             $file_url = $file_url_base . $file_name . '.csv';
3773 3773
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
@@ -3775,10 +3775,10 @@  discard block
 block discarded – undo
3775 3775
             
3776 3776
             $chunk_file_paths = array();
3777 3777
             
3778
-            if ( isset( $_REQUEST['_st'] ) ) {
3779
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3780
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3781
-                $percentage = min( $percentage, 100 );
3778
+            if (isset($_REQUEST['_st'])) {
3779
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3780
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
3781
+                $percentage = min($percentage, 100);
3782 3782
                 
3783 3783
                 $json['percentage'] = $percentage;
3784 3784
                 // WPML
@@ -3786,48 +3786,48 @@  discard block
 block discarded – undo
3786 3786
                     $sitepress->switch_lang($active_lang, true);
3787 3787
                 }
3788 3788
                 // WPML
3789
-                wp_send_json( $json );
3789
+                wp_send_json($json);
3790 3790
             } else {
3791
-                if ( !$terms_count > 0 ) {
3792
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3791
+                if (!$terms_count > 0) {
3792
+                    $json['error'] = __('No records to export.', 'geodirectory');
3793 3793
                 } else {
3794 3794
                     $total_terms = $terms_count;
3795 3795
                     if ($chunk_per_page > $terms_count) {
3796 3796
                         $chunk_per_page = $terms_count;
3797 3797
                     }
3798
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3798
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
3799 3799
                     
3800 3800
                     $j = $chunk_page_no;
3801
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3801
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
3802 3802
                     
3803 3803
                     $per_page = 500;
3804 3804
                     if ($per_page > $chunk_per_page) {
3805 3805
                         $per_page = $chunk_per_page;
3806 3806
                     }
3807
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3807
+                    $total_pages = ceil($chunk_per_page / $per_page);
3808 3808
                     
3809
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3810
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3809
+                    for ($i = 0; $i <= $total_pages; $i++) {
3810
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
3811 3811
                         
3812 3812
                         $clear = $i == 0 ? true : false;
3813
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3813
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
3814 3814
                     }
3815 3815
                     
3816
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3816
+                    if ($wp_filesystem->exists($file_path_temp)) {
3817 3817
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3818 3818
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3819 3819
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
3820
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3820
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3821 3821
                         
3822 3822
                         $file_url = $file_url_base . $chunk_file_name;
3823 3823
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3824 3824
                     }
3825 3825
                     
3826
-                    if ( !empty($chunk_file_paths) ) {
3826
+                    if (!empty($chunk_file_paths)) {
3827 3827
                         $json['total'] = $terms_count;
3828 3828
                         $json['files'] = $chunk_file_paths;
3829 3829
                     } else {
3830
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3830
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3831 3831
                     }
3832 3832
                 }
3833 3833
                 // WPML
@@ -3835,127 +3835,127 @@  discard block
 block discarded – undo
3835 3835
                     $sitepress->switch_lang($active_lang, true);
3836 3836
                 }
3837 3837
                 // WPML
3838
-                wp_send_json( $json );
3838
+                wp_send_json($json);
3839 3839
             }
3840 3840
         }
3841 3841
         break;
3842 3842
         case 'export_locations': {
3843 3843
             $file_url_base = geodir_path_import_export() . '/';
3844
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3844
+            $file_name = 'gd_locations_' . date('dmyHi');
3845 3845
             $file_url = $file_url_base . $file_name . '.csv';
3846 3846
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3847 3847
             $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3848 3848
             
3849
-            $items_count = (int)geodir_location_imex_count_locations();
3849
+            $items_count = (int) geodir_location_imex_count_locations();
3850 3850
             
3851
-            if ( isset( $_REQUEST['_st'] ) ) {
3852
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3853
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3854
-                $percentage = min( $percentage, 100 );
3851
+            if (isset($_REQUEST['_st'])) {
3852
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3853
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3854
+                $percentage = min($percentage, 100);
3855 3855
                 
3856 3856
                 $json['percentage'] = $percentage;
3857
-                wp_send_json( $json );
3857
+                wp_send_json($json);
3858 3858
             } else {
3859 3859
                 $chunk_file_paths = array();
3860 3860
                 
3861
-                if ( !$items_count > 0 ) {
3862
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3861
+                if (!$items_count > 0) {
3862
+                    $json['error'] = __('No records to export.', 'geodirectory');
3863 3863
                 } else {
3864
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3865
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3864
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3865
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3866 3866
                     
3867 3867
                     $j = $chunk_page_no;
3868
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3868
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
3869 3869
                     
3870 3870
                     $per_page = 500;
3871
-                    $per_page = min( $per_page, $chunk_per_page );
3872
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3871
+                    $per_page = min($per_page, $chunk_per_page);
3872
+                    $total_pages = ceil($chunk_per_page / $per_page);
3873 3873
                     
3874
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3875
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3874
+                    for ($i = 0; $i <= $total_pages; $i++) {
3875
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3876 3876
                         
3877 3877
                         $clear = $i == 0 ? true : false;
3878
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3878
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3879 3879
                     }
3880 3880
                     
3881
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3881
+                    if ($wp_filesystem->exists($file_path_temp)) {
3882 3882
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3883 3883
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3884 3884
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
3885
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3885
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3886 3886
                         
3887 3887
                         $file_url = $file_url_base . $chunk_file_name;
3888 3888
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3889 3889
                     }
3890 3890
                     
3891
-                    if ( !empty($chunk_file_paths) ) {
3891
+                    if (!empty($chunk_file_paths)) {
3892 3892
                         $json['total'] = $items_count;
3893 3893
                         $json['files'] = $chunk_file_paths;
3894 3894
                     } else {
3895
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3895
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3896 3896
                     }
3897 3897
                 }
3898
-                wp_send_json( $json );
3898
+                wp_send_json($json);
3899 3899
             }
3900 3900
         }
3901 3901
         break;
3902 3902
         case 'export_hoods': {
3903 3903
             $file_url_base = geodir_path_import_export() . '/';
3904
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3904
+            $file_name = 'gd_neighbourhoods_' . date('dmyHi');
3905 3905
             $file_url = $file_url_base . $file_name . '.csv';
3906 3906
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3907 3907
             $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3908 3908
             
3909
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3909
+            $items_count = (int) geodir_location_imex_count_neighbourhoods();
3910 3910
             
3911
-            if ( isset( $_REQUEST['_st'] ) ) {
3912
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3913
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3914
-                $percentage = min( $percentage, 100 );
3911
+            if (isset($_REQUEST['_st'])) {
3912
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3913
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3914
+                $percentage = min($percentage, 100);
3915 3915
                 
3916 3916
                 $json['percentage'] = $percentage;
3917
-                wp_send_json( $json );
3917
+                wp_send_json($json);
3918 3918
             } else {
3919 3919
                 $chunk_file_paths = array();
3920 3920
                 
3921
-                if ( !$items_count > 0 ) {
3922
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3921
+                if (!$items_count > 0) {
3922
+                    $json['error'] = __('No records to export.', 'geodirectory');
3923 3923
                 } else {
3924
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3925
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3924
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3925
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3926 3926
                     
3927 3927
                     $j = $chunk_page_no;
3928
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3928
+                    $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j);
3929 3929
                     
3930 3930
                     $per_page = 500;
3931
-                    $per_page = min( $per_page, $chunk_per_page );
3932
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3931
+                    $per_page = min($per_page, $chunk_per_page);
3932
+                    $total_pages = ceil($chunk_per_page / $per_page);
3933 3933
                     
3934
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3935
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3934
+                    for ($i = 0; $i <= $total_pages; $i++) {
3935
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3936 3936
                         
3937 3937
                         $clear = $i == 0 ? true : false;
3938
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3938
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3939 3939
                     }
3940 3940
                     
3941
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3941
+                    if ($wp_filesystem->exists($file_path_temp)) {
3942 3942
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3943 3943
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3944 3944
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
3945
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3945
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3946 3946
                         
3947 3947
                         $file_url = $file_url_base . $chunk_file_name;
3948 3948
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3949 3949
                     }
3950 3950
                     
3951
-                    if ( !empty($chunk_file_paths) ) {
3951
+                    if (!empty($chunk_file_paths)) {
3952 3952
                         $json['total'] = $items_count;
3953 3953
                         $json['files'] = $chunk_file_paths;
3954 3954
                     } else {
3955
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3955
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3956 3956
                     }
3957 3957
                 }
3958
-                wp_send_json( $json );
3958
+                wp_send_json($json);
3959 3959
             }
3960 3960
         }
3961 3961
         break;
@@ -3972,32 +3972,32 @@  discard block
 block discarded – undo
3972 3972
             }
3973 3973
             // WPML
3974 3974
             
3975
-            ini_set( 'auto_detect_line_endings', true );
3975
+            ini_set('auto_detect_line_endings', true);
3976 3976
             
3977 3977
             $uploads = wp_upload_dir();
3978 3978
             $uploads_dir = $uploads['path'];
3979 3979
             $uploads_subdir = $uploads['subdir'];
3980 3980
             
3981
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3982
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3981
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
3982
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
3983 3983
             
3984
-            $csv_file_arr = explode( '/', $csv_file );
3985
-            $csv_filename = end( $csv_file_arr );
3984
+            $csv_file_arr = explode('/', $csv_file);
3985
+            $csv_filename = end($csv_file_arr);
3986 3986
             $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3987 3987
             
3988 3988
             $json['file'] = $csv_file;
3989
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3989
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
3990 3990
 
3991
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3992
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3991
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
3992
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
3993 3993
                 
3994 3994
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3995 3995
                     $json['error'] = NULL;
3996 3996
                     $json['rows'] = 0;
3997 3997
                     
3998
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3999
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4000
-                            if ( !empty( $data ) ) {
3998
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
3999
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
4000
+                            if (!empty($data)) {
4001 4001
                                 $file[] = $data;
4002 4002
                             }
4003 4003
                         }
@@ -4010,19 +4010,19 @@  discard block
 block discarded – undo
4010 4010
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
4011 4011
                     }
4012 4012
                 } else {
4013
-                    wp_send_json( $json );
4013
+                    wp_send_json($json);
4014 4014
                 }
4015 4015
             } else {
4016
-                wp_send_json( $json );
4016
+                wp_send_json($json);
4017 4017
             }
4018 4018
             
4019
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4020
-                wp_send_json( $json );
4019
+            if ($task == 'prepare_import' || !empty($json['error'])) {
4020
+                wp_send_json($json);
4021 4021
             }
4022 4022
             
4023 4023
             $total = $json['rows'];
4024
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4025
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4024
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
4025
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
4026 4026
             
4027 4027
             $count = $limit;
4028 4028
             $requested_limit = $limit;
@@ -4051,13 +4051,13 @@  discard block
 block discarded – undo
4051 4051
             
4052 4052
             $post_types = geodir_get_posttypes();
4053 4053
 
4054
-            if ( $task == 'import_cat' ) {				
4054
+            if ($task == 'import_cat') {				
4055 4055
                 if (!empty($file)) {
4056 4056
                     $columns = isset($file[0]) ? $file[0] : NULL;
4057 4057
                     
4058 4058
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4059 4059
                         $json['error'] = CSV_INVAILD_FILE;
4060
-                        wp_send_json( $json );
4060
+                        wp_send_json($json);
4061 4061
                         exit;
4062 4062
                     }
4063 4063
                     
@@ -4066,7 +4066,7 @@  discard block
 block discarded – undo
4066 4066
                         
4067 4067
                         if (isset($file[$index])) {
4068 4068
                             $row = $file[$index];
4069
-                            $row = array_map( 'trim', $row );
4069
+                            $row = array_map('trim', $row);
4070 4070
                             //$row = array_map( 'utf8_encode', $row );
4071 4071
                             
4072 4072
                             $cat_id = '';
@@ -4082,26 +4082,26 @@  discard block
 block discarded – undo
4082 4082
                             $cat_language = '';
4083 4083
                             
4084 4084
                             $c = 0;
4085
-                            foreach ($columns as $column ) {
4086
-                                if ( $column == 'cat_id' ) {
4087
-                                    $cat_id = (int)$row[$c];
4088
-                                } else if ( $column == 'cat_name' ) {
4085
+                            foreach ($columns as $column) {
4086
+                                if ($column == 'cat_id') {
4087
+                                    $cat_id = (int) $row[$c];
4088
+                                } else if ($column == 'cat_name') {
4089 4089
                                     $cat_name = $row[$c];
4090
-                                } else if ( $column == 'cat_slug' ) {
4090
+                                } else if ($column == 'cat_slug') {
4091 4091
                                     $cat_slug = $row[$c];
4092
-                                } else if ( $column == 'cat_posttype' ) {
4092
+                                } else if ($column == 'cat_posttype') {
4093 4093
                                     $cat_posttype = $row[$c];
4094
-                                } else if ( $column == 'cat_parent' ) {
4094
+                                } else if ($column == 'cat_parent') {
4095 4095
                                     $cat_parent = trim($row[$c]);
4096
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4096
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
4097 4097
                                     $cat_schema = $row[$c];
4098
-                                } else if ( $column == 'cat_description' ) {
4098
+                                } else if ($column == 'cat_description') {
4099 4099
                                     $cat_description = $row[$c];
4100
-                                } else if ( $column == 'cat_top_description' ) {
4100
+                                } else if ($column == 'cat_top_description') {
4101 4101
                                     $cat_top_description = $row[$c];
4102
-                                } else if ( $column == 'cat_image' ) {
4102
+                                } else if ($column == 'cat_image') {
4103 4103
                                     $cat_image = $row[$c];
4104
-                                } else if ( $column == 'cat_icon' ) {
4104
+                                } else if ($column == 'cat_icon') {
4105 4105
                                     $cat_icon = $row[$c];
4106 4106
                                 }
4107 4107
                                 // WPML
@@ -4112,7 +4112,7 @@  discard block
 block discarded – undo
4112 4112
                                 $c++;
4113 4113
                             }
4114 4114
                             
4115
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4115
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
4116 4116
                                 $invalid++;
4117 4117
                                 continue;
4118 4118
                             }
@@ -4129,8 +4129,8 @@  discard block
 block discarded – undo
4129 4129
                             $term_data['description'] = $cat_description;
4130 4130
                             $term_data['cat_schema'] = $cat_schema;
4131 4131
                             $term_data['top_description'] = $cat_top_description;
4132
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4133
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4132
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
4133
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
4134 4134
                             
4135 4135
                             //$term_data = array_map( 'utf8_encode', $term_data );
4136 4136
                             
@@ -4139,14 +4139,14 @@  discard block
 block discarded – undo
4139 4139
                             $term_data['taxonomy'] = $taxonomy;
4140 4140
 
4141 4141
                             $term_parent_id = 0;
4142
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4142
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
4143 4143
                                 $term_parent = '';
4144 4144
                                 
4145
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4145
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
4146 4146
                                     $term_parent = $term_parent;
4147
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4147
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
4148 4148
                                     $term_parent = $term_parent;
4149
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4149
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
4150 4150
                                     $term_parent = $term_parent;
4151 4151
                                 } else {
4152 4152
                                     $term_parent_data = array();
@@ -4154,47 +4154,47 @@  discard block
 block discarded – undo
4154 4154
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );										
4155 4155
                                     $term_parent_data['taxonomy'] = $taxonomy;
4156 4156
                                     
4157
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4157
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
4158 4158
                                 }
4159 4159
                                 
4160
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4161
-                                    $term_parent_id = (int)$term_parent->term_id;
4160
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
4161
+                                    $term_parent_id = (int) $term_parent->term_id;
4162 4162
                                 }
4163 4163
                             }
4164
-                            $term_data['parent'] = (int)$term_parent_id;
4164
+                            $term_data['parent'] = (int) $term_parent_id;
4165 4165
 
4166 4166
                             $term_id = NULL;
4167
-                            if ( $import_choice == 'update' ) {
4168
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4167
+                            if ($import_choice == 'update') {
4168
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
4169 4169
                                     $term_data['term_id'] = $term['term_id'];
4170 4170
                                     
4171
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4171
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
4172 4172
                                         $updated++;
4173 4173
                                     } else {
4174 4174
                                         $invalid++;
4175 4175
                                     }
4176
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4176
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
4177 4177
                                     $term_data['term_id'] = $term['term_id'];
4178 4178
                                     
4179
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4179
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
4180 4180
                                         $updated++;
4181 4181
                                     } else {
4182 4182
                                         $invalid++;
4183 4183
                                     }
4184 4184
                                 } else {
4185
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4185
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
4186 4186
                                         $created++;
4187 4187
                                     } else {
4188 4188
                                         $invalid++;
4189 4189
                                     }
4190 4190
                                 }
4191
-                            } else if ( $import_choice == 'skip' ) {
4192
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4191
+                            } else if ($import_choice == 'skip') {
4192
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
4193 4193
                                     $skipped++;
4194
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4194
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
4195 4195
                                     $skipped++;
4196 4196
                                 } else {
4197
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
4197
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {										
4198 4198
                                         $created++;
4199 4199
                                     } else {
4200 4200
                                         $invalid++;
@@ -4204,37 +4204,37 @@  discard block
 block discarded – undo
4204 4204
                                 $invalid++;
4205 4205
                             }
4206 4206
                             
4207
-                            if ( $term_id ) {
4208
-                                if ( isset( $term_data['top_description'] ) ) {
4209
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4207
+                            if ($term_id) {
4208
+                                if (isset($term_data['top_description'])) {
4209
+                                    update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
4210 4210
                                 }
4211 4211
                                 
4212
-                                if ( isset( $term_data['cat_schema'] ) ) {
4213
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4212
+                                if (isset($term_data['cat_schema'])) {
4213
+                                    update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
4214 4214
                                 }
4215 4215
             
4216 4216
                                 $attachment = false;
4217
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4218
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4219
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4217
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
4218
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
4219
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
4220 4220
                                     
4221
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4221
+                                    if (basename($cat_image) != $term_data['image']) {
4222 4222
                                         $attachment = true;
4223
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4223
+                                        update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image']), $cat_posttype);
4224 4224
                                     }
4225 4225
                                 }
4226 4226
                                 
4227
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4228
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4229
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4227
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
4228
+                                    $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
4229
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
4230 4230
                                         
4231
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4231
+                                    if (basename($cat_icon) != $term_data['icon']) {
4232 4232
                                         $attachment = true;
4233
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4233
+                                        update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon']), $cat_posttype);
4234 4234
                                     }
4235 4235
                                 }
4236 4236
                                 
4237
-                                if ( $attachment ) {
4237
+                                if ($attachment) {
4238 4238
                                     $images++;
4239 4239
                                 }
4240 4240
                             }
@@ -4256,14 +4256,14 @@  discard block
 block discarded – undo
4256 4256
                 $json['invalid'] = $invalid;
4257 4257
                 $json['images'] = $images;
4258 4258
                 
4259
-                wp_send_json( $json );
4259
+                wp_send_json($json);
4260 4260
                 exit;
4261
-            } else if ( $task == 'import_post' ) {
4261
+            } else if ($task == 'import_post') {
4262 4262
 
4263 4263
                 //run some stuff to make the import quicker
4264
-                wp_defer_term_counting( true );
4265
-                wp_defer_comment_counting( true );
4266
-                $wpdb->query( 'SET autocommit = 0;' );
4264
+                wp_defer_term_counting(true);
4265
+                wp_defer_comment_counting(true);
4266
+                $wpdb->query('SET autocommit = 0;');
4267 4267
 
4268 4268
                 //remove_all_actions('publish_post');
4269 4269
                 //remove_all_actions('transition_post_status');
@@ -4272,26 +4272,26 @@  discard block
 block discarded – undo
4272 4272
                 if (!empty($file)) {
4273 4273
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4274 4274
                     $default_status = 'publish';
4275
-                    $current_date = date_i18n( 'Y-m-d', time() );
4275
+                    $current_date = date_i18n('Y-m-d', time());
4276 4276
                     
4277 4277
                     $columns = isset($file[0]) ? $file[0] : NULL;
4278 4278
                     
4279 4279
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4280 4280
                         $json['error'] = CSV_INVAILD_FILE;
4281
-                        wp_send_json( $json );
4281
+                        wp_send_json($json);
4282 4282
                         exit;
4283 4283
                     }
4284 4284
 
4285
-                    $processed_actual=0;
4285
+                    $processed_actual = 0;
4286 4286
                     for ($i = 1; $i <= $limit; $i++) {
4287 4287
                         $index = $processed + $i;
4288 4288
                         $gd_post = array();
4289 4289
                         
4290 4290
                         if (isset($file[$index])) {$processed_actual++;
4291 4291
                             $row = $file[$index];
4292
-                            $row = array_map( 'trim', $row );
4292
+                            $row = array_map('trim', $row);
4293 4293
                             //$row = array_map( 'utf8_encode', $row );
4294
-                            $row = array_map( 'addslashes_gpc', $row );
4294
+                            $row = array_map('addslashes_gpc', $row);
4295 4295
                             
4296 4296
                             $post_id = '';
4297 4297
                             $post_title = '';
@@ -4328,80 +4328,80 @@  discard block
 block discarded – undo
4328 4328
                             $original_post_id = '';
4329 4329
                                                         
4330 4330
                             $c = 0;
4331
-                            foreach ($columns as $column ) {
4331
+                            foreach ($columns as $column) {
4332 4332
                                 $gd_post[$column] = $row[$c];
4333 4333
                                 
4334
-                                if ( $column == 'post_id' ) {
4334
+                                if ($column == 'post_id') {
4335 4335
                                     $post_id = $row[$c];
4336
-                                } else if ( $column == 'post_title' ) {
4336
+                                } else if ($column == 'post_title') {
4337 4337
                                     $post_title = sanitize_text_field($row[$c]);
4338
-                                } else if ( $column == 'post_author' ) {
4338
+                                } else if ($column == 'post_author') {
4339 4339
                                     $post_author = $row[$c];
4340
-                                } else if ( $column == 'post_content' ) {
4340
+                                } else if ($column == 'post_content') {
4341 4341
                                     $post_content = $row[$c];
4342
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4343
-                                    $post_category_arr = explode( ',', $row[$c] );
4344
-                                } else if ( $column == 'default_category' ) {
4342
+                                } else if ($column == 'post_category' && $row[$c] != '') {
4343
+                                    $post_category_arr = explode(',', $row[$c]);
4344
+                                } else if ($column == 'default_category') {
4345 4345
                                     $default_category = wp_kses_normalize_entities($row[$c]);
4346
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4347
-                                    $post_tags = explode( ',', $row[$c] );
4348
-                                } else if ( $column == 'post_type' ) {
4346
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
4347
+                                    $post_tags = explode(',', $row[$c]);
4348
+                                } else if ($column == 'post_type') {
4349 4349
                                     $post_type = $row[$c];
4350
-                                } else if ( $column == 'post_status' ) {
4351
-                                    $post_status = sanitize_key( $row[$c] );
4352
-                                } else if ( $column == 'is_featured' ) {
4353
-                                    $is_featured = (int)$row[$c];
4354
-                                } else if ( $column == 'geodir_video' ) {
4350
+                                } else if ($column == 'post_status') {
4351
+                                    $post_status = sanitize_key($row[$c]);
4352
+                                } else if ($column == 'is_featured') {
4353
+                                    $is_featured = (int) $row[$c];
4354
+                                } else if ($column == 'geodir_video') {
4355 4355
                                     $geodir_video = $row[$c];
4356
-                                } else if ( $column == 'post_address' ) {
4356
+                                } else if ($column == 'post_address') {
4357 4357
                                     $post_address = $row[$c];
4358
-                                } else if ( $column == 'post_city' ) {
4358
+                                } else if ($column == 'post_city') {
4359 4359
                                     $post_city = $row[$c];
4360
-                                } else if ( $column == 'post_region' ) {
4360
+                                } else if ($column == 'post_region') {
4361 4361
                                     $post_region = $row[$c];
4362
-                                } else if ( $column == 'post_country' ) {
4362
+                                } else if ($column == 'post_country') {
4363 4363
                                     $post_country = $row[$c];
4364
-                                } else if ( $column == 'post_zip' ) {
4364
+                                } else if ($column == 'post_zip') {
4365 4365
                                     $post_zip = $row[$c];
4366
-                                } else if ( $column == 'post_latitude' ) {
4366
+                                } else if ($column == 'post_latitude') {
4367 4367
                                     $post_latitude = $row[$c];
4368
-                                } else if ( $column == 'post_longitude' ) {
4368
+                                } else if ($column == 'post_longitude') {
4369 4369
                                     $post_longitude = $row[$c];
4370
-                                } else if ( $column == 'post_neighbourhood' ) {
4370
+                                } else if ($column == 'post_neighbourhood') {
4371 4371
                                     $post_neighbourhood = $row[$c];
4372 4372
                                     unset($gd_post[$column]);
4373
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4373
+                                } else if ($column == 'neighbourhood_latitude') {
4374 4374
                                     $neighbourhood_latitude = $row[$c];
4375
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4375
+                                } else if ($column == 'neighbourhood_longitude') {
4376 4376
                                     $neighbourhood_longitude = $row[$c];
4377
-                                } else if ( $column == 'geodir_timing' ) {
4377
+                                } else if ($column == 'geodir_timing') {
4378 4378
                                     $geodir_timing = $row[$c];
4379
-                                } else if ( $column == 'geodir_contact' ) {
4379
+                                } else if ($column == 'geodir_contact') {
4380 4380
                                     $geodir_contact = $row[$c];
4381
-                                } else if ( $column == 'geodir_email' ) {
4381
+                                } else if ($column == 'geodir_email') {
4382 4382
                                     $geodir_email = $row[$c];
4383
-                                } else if ( $column == 'geodir_website' ) {
4383
+                                } else if ($column == 'geodir_website') {
4384 4384
                                     $geodir_website = $row[$c];
4385
-                                } else if ( $column == 'geodir_twitter' ) {
4385
+                                } else if ($column == 'geodir_twitter') {
4386 4386
                                     $geodir_twitter = $row[$c];
4387
-                                } else if ( $column == 'geodir_facebook' ) {
4387
+                                } else if ($column == 'geodir_facebook') {
4388 4388
                                     $geodir_facebook = $row[$c];
4389
-                                } else if ( $column == 'geodir_twitter' ) {
4389
+                                } else if ($column == 'geodir_twitter') {
4390 4390
                                     $geodir_twitter = $row[$c];
4391
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4391
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
4392 4392
                                     $post_images[] = $row[$c];
4393
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4394
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4395
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4393
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
4394
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $row[$c] . ' days'));
4395
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
4396 4396
                                     $row[$c] = str_replace('/', '-', $row[$c]);
4397
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4397
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
4398 4398
                                 }
4399 4399
                                 // WPML
4400 4400
                                 if ($is_wpml) {
4401 4401
                                     if ($column == 'language') {
4402 4402
                                         $language = geodir_strtolower(trim($row[$c]));
4403 4403
                                     } else if ($column == 'original_post_id') {
4404
-                                        $original_post_id = (int)$row[$c];
4404
+                                        $original_post_id = (int) $row[$c];
4405 4405
                                     }
4406 4406
                                 }
4407 4407
                                 // WPML
@@ -4416,24 +4416,24 @@  discard block
 block discarded – undo
4416 4416
 
4417 4417
                             $gd_post['IMAGE'] = $post_images;
4418 4418
                             
4419
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4420
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4419
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
4420
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
4421 4421
                                                                                                                 
4422 4422
                             $valid = true;
4423 4423
                             
4424
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4424
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
4425 4425
                                 $invalid++;
4426 4426
                                 $valid = false;
4427 4427
                             }
4428 4428
                             
4429
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4430
-                            if ( $location_allowed ) {
4429
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
4430
+                            if ($location_allowed) {
4431 4431
                                 $location_result = geodir_get_default_location();
4432
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4432
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
4433 4433
                                     $invalid_addr++;
4434 4434
                                     $valid = false;
4435
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4436
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4435
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
4436
+                                    if ((geodir_strtolower($post_city) != geodir_strtolower($location_result->city)) || (geodir_strtolower($post_region) != geodir_strtolower($location_result->region)) || (geodir_strtolower($post_country) != geodir_strtolower($location_result->country))) {
4437 4437
                                         $invalid_addr++;
4438 4438
                                         $valid = false;
4439 4439
                                     } else {
@@ -4444,7 +4444,7 @@  discard block
 block discarded – undo
4444 4444
                                 }
4445 4445
                             }
4446 4446
                             
4447
-                            if ( !$valid ) {
4447
+                            if (!$valid) {
4448 4448
                                 continue;
4449 4449
                             }
4450 4450
 
@@ -4457,29 +4457,29 @@  discard block
 block discarded – undo
4457 4457
 
4458 4458
                             $post_category = array();
4459 4459
                             $default_category_id = NULL;
4460
-                            if ( !empty( $post_category_arr ) ) {
4461
-                                foreach ( $post_category_arr as $value ) {
4462
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4460
+                            if (!empty($post_category_arr)) {
4461
+                                foreach ($post_category_arr as $value) {
4462
+                                    $category_name = wp_kses_normalize_entities(trim($value));
4463 4463
                                     
4464
-                                    if ( $category_name != '' ) {
4464
+                                    if ($category_name != '') {
4465 4465
                                         $term_category = array();
4466 4466
                                         
4467
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4467
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
4468 4468
                                             $term_category = $term;
4469
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4469
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
4470 4470
                                             $term_category = $term;
4471 4471
                                         } else {
4472 4472
                                             $term_data = array();
4473 4473
                                             $term_data['name'] = $category_name;
4474 4474
                                             $term_data['taxonomy'] = $cat_taxonomy;
4475 4475
                                             
4476
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4477
-                                            if ( $term_id ) {
4478
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4476
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
4477
+                                            if ($term_id) {
4478
+                                                $term_category = get_term($term_id, $cat_taxonomy);
4479 4479
                                             }
4480 4480
                                         }
4481 4481
                                         
4482
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4482
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
4483 4483
                                             $post_category[] = intval($term_category->term_id);
4484 4484
                                             
4485 4485
                                             if ($category_name == $default_category) {
@@ -4500,28 +4500,28 @@  discard block
 block discarded – undo
4500 4500
                             $save_post['post_tags'] = $post_tags;
4501 4501
 
4502 4502
                             $saved_post_id = NULL;
4503
-                            if ( $import_choice == 'update' ) {
4504
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4503
+                            if ($import_choice == 'update') {
4504
+                                if ($post_id > 0 && get_post($post_id)) {
4505 4505
                                     $save_post['ID'] = $post_id;
4506 4506
                                     
4507
-                                    if ( wp_update_post( $save_post ) ) {
4507
+                                    if (wp_update_post($save_post)) {
4508 4508
                                         $saved_post_id = $post_id;
4509 4509
                                         $updated++;
4510 4510
                                     }
4511 4511
                                 } else {
4512
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4512
+                                    if ($saved_post_id = wp_insert_post($save_post)) {
4513 4513
                                         $created++;
4514 4514
                                     }
4515 4515
                                 }
4516 4516
                                 
4517
-                                if ( !$saved_post_id > 0 ) {
4517
+                                if (!$saved_post_id > 0) {
4518 4518
                                     $invalid++;
4519 4519
                                 }
4520
-                            } else if ( $import_choice == 'skip' ) {
4521
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4520
+                            } else if ($import_choice == 'skip') {
4521
+                                if ($post_id > 0 && get_post($post_id)) {
4522 4522
                                     $skipped++;	
4523 4523
                                 } else {
4524
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4524
+                                    if ($saved_post_id = wp_insert_post($save_post)) {
4525 4525
                                         $created++;	
4526 4526
                                     } else {
4527 4527
                                         $invalid++;
@@ -4531,19 +4531,19 @@  discard block
 block discarded – undo
4531 4531
                                 $invalid++;
4532 4532
                             }
4533 4533
 
4534
-                            if ( (int)$saved_post_id > 0 ) {
4534
+                            if ((int) $saved_post_id > 0) {
4535 4535
                                 // WPML
4536 4536
                                 if ($is_wpml && $original_post_id > 0 && $language != '') {
4537 4537
                                     $wpml_post_type = 'post_' . $post_type;
4538
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4538
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
4539 4539
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4540 4540
 
4541
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4541
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
4542 4542
                                     
4543
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4543
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
4544 4544
                                 }
4545 4545
                                 // WPML
4546
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4546
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
4547 4547
                                 
4548 4548
                                 $gd_post['post_id'] = $saved_post_id;
4549 4549
                                 $gd_post['ID'] = $saved_post_id;
@@ -4555,7 +4555,7 @@  discard block
 block discarded – undo
4555 4555
                                                     
4556 4556
                                 // post location
4557 4557
                                 $post_location_id = 0;
4558
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4558
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
4559 4559
                                     $gd_post['post_neighbourhood'] = '';
4560 4560
                                     
4561 4561
                                     $post_location_info = array(
@@ -4565,7 +4565,7 @@  discard block
 block discarded – undo
4565 4565
                                                                 'geo_lat' => $post_latitude,
4566 4566
                                                                 'geo_lng' => $post_longitude
4567 4567
                                                             );
4568
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4568
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
4569 4569
                                         $post_location_id = $location_id;
4570 4570
                                     }
4571 4571
                                     
@@ -4603,14 +4603,14 @@  discard block
 block discarded – undo
4603 4603
                                 $gd_post['post_location_id'] = $post_location_id;
4604 4604
                                 
4605 4605
                                 // post package info
4606
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4606
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
4607 4607
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4608 4608
                                     $package_id = $gd_post_info->package_id;
4609 4609
                                 }
4610 4610
                                 
4611 4611
                                 $package_info = array();
4612 4612
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4613
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4613
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
4614 4614
                                     
4615 4615
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4616 4616
                                         $package_info = array();
@@ -4618,18 +4618,18 @@  discard block
 block discarded – undo
4618 4618
                                 }
4619 4619
                                 
4620 4620
                                 if (empty($package_info)) {
4621
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4621
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
4622 4622
                                 }
4623 4623
                                  
4624
-                                if (!empty($package_info))	 {
4624
+                                if (!empty($package_info)) {
4625 4625
                                     $package_id = $package_info['pid'];
4626 4626
                                     
4627 4627
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4628 4628
                                         $gd_post['expire_date'] = $expire_date;
4629 4629
                                     } else {
4630
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4631
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4632
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4630
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
4631
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
4632
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $package_info['days'] . ' days'));
4633 4633
                                         } else {
4634 4634
                                             $gd_post['expire_date'] = 'Never';
4635 4635
                                         }
@@ -4649,28 +4649,28 @@  discard block
 block discarded – undo
4649 4649
                                 }
4650 4650
 
4651 4651
                                 // Export franchise fields
4652
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4652
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
4653 4653
                                 if ($is_franchise_active) {
4654
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4654
+                                    if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
4655 4655
                                         $gd_franchise_lock = array();
4656 4656
                                         
4657
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4658
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4659
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4660
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4657
+                                        if (isset($gd_post['gd_franchise_lock'])) {
4658
+                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
4659
+                                            $gd_franchise_lock = trim($gd_franchise_lock);
4660
+                                            $gd_franchise_lock = explode(",", $gd_franchise_lock);
4661 4661
                                         }
4662 4662
                                         
4663
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4664
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4663
+                                        update_post_meta($saved_post_id, 'gd_is_franchise', 1);
4664
+                                        update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
4665 4665
                                     } else {
4666
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4667
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4666
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
4667
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
4668 4668
                                         }
4669 4669
                                     }
4670 4670
                                 }
4671 4671
                                 
4672 4672
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4673
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4673
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
4674 4674
                                     if ($default_category_id) {
4675 4675
                                         $save_post['post_default_category'] = $default_category_id;
4676 4676
                                         $gd_post['default_category'] = $default_category_id;
@@ -4679,12 +4679,12 @@  discard block
 block discarded – undo
4679 4679
                                 }
4680 4680
                                 
4681 4681
                                 // Save post info
4682
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4682
+                                geodir_save_post_info($saved_post_id, $gd_post);
4683 4683
                                 // post taxonomies
4684
-                                if ( !empty( $save_post['post_category'] ) ) {
4685
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4684
+                                if (!empty($save_post['post_category'])) {
4685
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
4686 4686
                                     
4687
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4687
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
4688 4688
                                     if ($default_category_id) {
4689 4689
                                         $post_default_category = $default_category_id;
4690 4690
                                     }
@@ -4698,15 +4698,15 @@  discard block
 block discarded – undo
4698 4698
                                     
4699 4699
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4700 4700
                                     
4701
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4701
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
4702 4702
                                 }
4703 4703
 
4704
-                                if ( !empty( $save_post['post_tags'] ) ) {
4705
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4704
+                                if (!empty($save_post['post_tags'])) {
4705
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
4706 4706
                                 }
4707 4707
 
4708 4708
                                 // Post images
4709
-                                if ( !empty( $post_images ) ) {
4709
+                                if (!empty($post_images)) {
4710 4710
                                     $post_images = array_unique($post_images);
4711 4711
                                     
4712 4712
                                     $old_post_images_arr = array();
@@ -4714,30 +4714,30 @@  discard block
 block discarded – undo
4714 4714
                                     
4715 4715
                                     $order = 1;
4716 4716
                                     
4717
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4717
+                                    $old_post_images = geodir_get_images($saved_post_id);
4718 4718
                                     if (!empty($old_post_images)) {
4719
-                                        foreach( $old_post_images as $old_post_image ) {
4719
+                                        foreach ($old_post_images as $old_post_image) {
4720 4720
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4721 4721
                                                 $old_post_images_arr[] = $old_post_image->file;
4722 4722
                                             }
4723 4723
                                         }
4724 4724
                                     }
4725 4725
                                     
4726
-                                    foreach ( $post_images as $post_image ) {
4727
-                                        $image_name = basename( $post_image );
4726
+                                    foreach ($post_images as $post_image) {
4727
+                                        $image_name = basename($post_image);
4728 4728
                                         $saved_post_images_arr[] = $image_name;
4729 4729
                                         
4730
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4730
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
4731 4731
                                             continue; // Skip if image already exists.
4732 4732
                                         }
4733 4733
                                         
4734
-                                        $image_name_parts = explode( '.', $image_name );
4735
-                                        array_pop( $image_name_parts );
4736
-                                        $proper_image_name = implode( '.', $image_name_parts );
4734
+                                        $image_name_parts = explode('.', $image_name);
4735
+                                        array_pop($image_name_parts);
4736
+                                        $proper_image_name = implode('.', $image_name_parts);
4737 4737
                                         
4738
-                                        $arr_file_type = wp_check_filetype( $image_name );
4738
+                                        $arr_file_type = wp_check_filetype($image_name);
4739 4739
                                         
4740
-                                        if ( !empty( $arr_file_type ) ) {
4740
+                                        if (!empty($arr_file_type)) {
4741 4741
                                             $uploaded_file_type = $arr_file_type['type'];
4742 4742
                                             
4743 4743
                                             $attachment = array();
@@ -4750,46 +4750,46 @@  discard block
 block discarded – undo
4750 4750
                                             $attachment['is_featured'] = 0;
4751 4751
 
4752 4752
                                             $attachment_set = '';
4753
-                                            foreach ( $attachment as $key => $val ) {
4754
-                                                if ( $val != '' ) {
4753
+                                            foreach ($attachment as $key => $val) {
4754
+                                                if ($val != '') {
4755 4755
                                                     $attachment_set .= $key . " = '" . $val . "', ";
4756 4756
                                                 }
4757 4757
                                             }
4758
-                                            $attachment_set = trim( $attachment_set, ", " );
4758
+                                            $attachment_set = trim($attachment_set, ", ");
4759 4759
                                                                                         
4760 4760
                                             // Add new attachment
4761
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4761
+                                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
4762 4762
                                                                                         
4763 4763
                                             $order++;
4764 4764
                                         }
4765 4765
                                     }
4766 4766
 
4767
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4767
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
4768 4768
                                     // Remove previous attachment
4769
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4769
+                                    $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int) $saved_post_id . " " . $saved_post_images_sql);
4770 4770
                                     
4771
-                                    if ( !empty( $saved_post_images_arr ) ) {
4771
+                                    if (!empty($saved_post_images_arr)) {
4772 4772
                                         $menu_order = 1;
4773 4773
                                         
4774
-                                        foreach ( $saved_post_images_arr as $img_name ) {
4775
-                                            $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
4774
+                                        foreach ($saved_post_images_arr as $img_name) {
4775
+                                            $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array($menu_order, $saved_post_id, '%/' . $img_name)));
4776 4776
                                             
4777
-                                            if( $menu_order == 1 ) {
4778
-                                                if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
4779
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4777
+                                            if ($menu_order == 1) {
4778
+                                                if ($featured_image = $wpdb->get_var($wpdb->prepare("SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array($saved_post_id, '%/' . $img_name)))) {
4779
+                                                    $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array($featured_image, $saved_post_id)));
4780 4780
                                                 }
4781 4781
                                             }
4782 4782
                                             $menu_order++;
4783 4783
                                         }
4784 4784
                                     }
4785 4785
                                     
4786
-                                    if ( $order > 1 ) {
4786
+                                    if ($order > 1) {
4787 4787
                                         $images++;
4788 4788
                                     }
4789 4789
                                 }
4790 4790
 
4791 4791
                                 /** This action is documented in geodirectory-functions/post-functions.php */
4792
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4792
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
4793 4793
                                 
4794 4794
                                 if (isset($is_featured)) {
4795 4795
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
@@ -4809,10 +4809,10 @@  discard block
 block discarded – undo
4809 4809
                 }
4810 4810
 
4811 4811
                 //undo some stuff to make the import quicker
4812
-                wp_defer_term_counting( false );
4813
-                wp_defer_comment_counting( false );
4814
-                $wpdb->query( 'COMMIT;' );
4815
-                $wpdb->query( 'SET autocommit = 1;' );
4812
+                wp_defer_term_counting(false);
4813
+                wp_defer_comment_counting(false);
4814
+                $wpdb->query('COMMIT;');
4815
+                $wpdb->query('SET autocommit = 1;');
4816 4816
 
4817 4817
                 $json = array();
4818 4818
                 $json['processed'] = $processed_actual;
@@ -4823,9 +4823,9 @@  discard block
 block discarded – undo
4823 4823
                 $json['invalid_addr'] = $invalid_addr;
4824 4824
                 $json['images'] = $images;
4825 4825
                 
4826
-                wp_send_json( $json );
4826
+                wp_send_json($json);
4827 4827
                 exit;
4828
-            } else if ( $task == 'import_loc' ) {
4828
+            } else if ($task == 'import_loc') {
4829 4829
                 global $gd_post_types;
4830 4830
                 $gd_post_types = $post_types;
4831 4831
                 
@@ -4834,7 +4834,7 @@  discard block
 block discarded – undo
4834 4834
                     
4835 4835
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4836 4836
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4837
-                        wp_send_json( $json );
4837
+                        wp_send_json($json);
4838 4838
                     }
4839 4839
                     
4840 4840
                     for ($i = 1; $i <= $limit; $i++) {
@@ -4842,59 +4842,59 @@  discard block
 block discarded – undo
4842 4842
                         
4843 4843
                         if (isset($file[$index])) {
4844 4844
                             $row = $file[$index];
4845
-                            $row = array_map( 'trim', $row );
4845
+                            $row = array_map('trim', $row);
4846 4846
                             $data = array();
4847 4847
                             
4848
-                            foreach ($columns as $c => $column ) {
4848
+                            foreach ($columns as $c => $column) {
4849 4849
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4850 4850
                                     $data[$column] = $row[$c];
4851 4851
                                 }
4852 4852
                             }
4853 4853
 
4854
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4854
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
4855 4855
                                 $invalid++;
4856 4856
                                 continue;
4857 4857
                             }
4858 4858
                             
4859 4859
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4860 4860
                             
4861
-                            if ( $import_choice == 'update' ) {
4862
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4863
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4861
+                            if ($import_choice == 'update') {
4862
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4863
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4864 4864
                                         $updated++;
4865 4865
                                     } else {
4866 4866
                                         $invalid++;
4867 4867
                                     }
4868
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4869
-                                    $data['location_id'] = (int)$location->location_id;
4868
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4869
+                                    $data['location_id'] = (int) $location->location_id;
4870 4870
                                     
4871
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4872
-                                        $data['location_id'] = (int)$location->location_id;
4873
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4874
-                                        $data['location_id'] = (int)$location->location_id;
4875
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4876
-                                        $data['location_id'] = (int)$location->location_id;
4871
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
4872
+                                        $data['location_id'] = (int) $location->location_id;
4873
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
4874
+                                        $data['location_id'] = (int) $location->location_id;
4875
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
4876
+                                        $data['location_id'] = (int) $location->location_id;
4877 4877
                                     }
4878 4878
                                     
4879
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4879
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4880 4880
                                         $updated++;
4881 4881
                                     } else {
4882 4882
                                         $invalid++;
4883 4883
                                     }
4884 4884
                                 } else {
4885
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4885
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4886 4886
                                         $created++;
4887 4887
                                     } else {
4888 4888
                                         $invalid++;
4889 4889
                                     }
4890 4890
                                 }
4891
-                            } elseif ( $import_choice == 'skip' ) {
4892
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4891
+                            } elseif ($import_choice == 'skip') {
4892
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4893 4893
                                     $skipped++;
4894
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4894
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4895 4895
                                     $skipped++;
4896 4896
                                 } else {
4897
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4897
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4898 4898
                                         $created++;
4899 4899
                                     } else {
4900 4900
                                         $invalid++;
@@ -4915,14 +4915,14 @@  discard block
 block discarded – undo
4915 4915
                 $json['invalid'] = $invalid;
4916 4916
                 $json['images'] = $images;
4917 4917
                 
4918
-                wp_send_json( $json );
4919
-            } else if ( $task == 'import_hood' ) {               
4918
+                wp_send_json($json);
4919
+            } else if ($task == 'import_hood') {               
4920 4920
                 if (!empty($file)) {
4921 4921
                     $columns = isset($file[0]) ? $file[0] : NULL;
4922 4922
                     
4923 4923
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4924 4924
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4925
-                        wp_send_json( $json );
4925
+                        wp_send_json($json);
4926 4926
                     }
4927 4927
                     
4928 4928
                     for ($i = 1; $i <= $limit; $i++) {
@@ -4930,7 +4930,7 @@  discard block
 block discarded – undo
4930 4930
                         
4931 4931
                         if (isset($file[$index])) {
4932 4932
                             $row = $file[$index];
4933
-                            $row = array_map( 'trim', $row );
4933
+                            $row = array_map('trim', $row);
4934 4934
                             $data = array();
4935 4935
                             
4936 4936
                             foreach ($columns as $c => $column) {
@@ -4945,8 +4945,8 @@  discard block
 block discarded – undo
4945 4945
                             }
4946 4946
                             
4947 4947
                             $location_info = array();
4948
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4949
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4948
+                            if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
4949
+                                $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
4950 4950
                             } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4951 4951
                                 $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4952 4952
                             }
@@ -4967,9 +4967,9 @@  discard block
 block discarded – undo
4967 4967
                             $hood_data['hood_longitude'] = $data['longitude'];
4968 4968
                             $hood_data['hood_location_id'] = $location_id;
4969 4969
                                     
4970
-                            if ( $import_choice == 'update' ) {
4971
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4972
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4970
+                            if ($import_choice == 'update') {
4971
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4972
+                                    $hood_data['hood_id'] = (int) $data['neighbourhood_id'];
4973 4973
                                     
4974 4974
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4975 4975
                                         $updated++;
@@ -4977,7 +4977,7 @@  discard block
 block discarded – undo
4977 4977
                                         $invalid++;
4978 4978
                                     }
4979 4979
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4980
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4980
+                                    $hood_data['hood_id'] = (int) $neighbourhood->hood_id;
4981 4981
                                     
4982 4982
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4983 4983
                                         $updated++;
@@ -4991,8 +4991,8 @@  discard block
 block discarded – undo
4991 4991
                                         $invalid++;
4992 4992
                                     }
4993 4993
                                 }
4994
-                            } elseif ( $import_choice == 'skip' ) {
4995
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4994
+                            } elseif ($import_choice == 'skip') {
4995
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4996 4996
                                     $skipped++;
4997 4997
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4998 4998
                                     $skipped++;
@@ -5019,7 +5019,7 @@  discard block
 block discarded – undo
5019 5019
                 $json['invalid'] = $invalid;
5020 5020
                 $json['images'] = $images;
5021 5021
                 
5022
-                wp_send_json( $json );
5022
+                wp_send_json($json);
5023 5023
             }
5024 5024
         }
5025 5025
         break;
@@ -5063,29 +5063,29 @@  discard block
 block discarded – undo
5063 5063
  * }
5064 5064
  * @return int|bool Term id when success, false when fail.
5065 5065
  */
5066
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
5067
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5066
+function geodir_imex_insert_term($taxonomy, $term_data) {
5067
+	if (empty($taxonomy) || empty($term_data)) {
5068 5068
 		return false;
5069 5069
 	}
5070 5070
 	
5071
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5071
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
5072 5072
 	$args = array();
5073
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5074
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5075
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5073
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5074
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5075
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5076 5076
 	
5077
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5078
-		$term_args = array_merge( $term_data, $args );
5079
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5080
-		$term_args = wp_parse_args( $term_args, $defaults );
5081
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5082
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5077
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
5078
+		$term_args = array_merge($term_data, $args);
5079
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5080
+		$term_args = wp_parse_args($term_args, $defaults);
5081
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
5082
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
5083 5083
 	}
5084 5084
 	
5085
-    if( !empty( $term ) ) {
5086
-		$result = wp_insert_term( $term, $taxonomy, $args );
5087
-        if( !is_wp_error( $result ) ) {
5088
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5085
+    if (!empty($term)) {
5086
+		$result = wp_insert_term($term, $taxonomy, $args);
5087
+        if (!is_wp_error($result)) {
5088
+            return $term_id = isset($result['term_id']) ? $result['term_id'] : 0;
5089 5089
         }
5090 5090
     }
5091 5091
 	
@@ -5115,37 +5115,37 @@  discard block
 block discarded – undo
5115 5115
  * }
5116 5116
  * @return int|bool Term id when success, false when fail.
5117 5117
  */
5118
-function geodir_imex_update_term( $taxonomy, $term_data ) {
5119
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5118
+function geodir_imex_update_term($taxonomy, $term_data) {
5119
+	if (empty($taxonomy) || empty($term_data)) {
5120 5120
 		return false;
5121 5121
 	}
5122 5122
 	
5123
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5124
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5123
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
5124
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
5125 5125
 	
5126 5126
 	$args = array();
5127
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5128
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5129
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5127
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5128
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5129
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5130 5130
 	
5131
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5131
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
5132 5132
 		$term_data['term_id'] = $term_info['term_id'];
5133 5133
 		
5134
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5134
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5135 5135
 		
5136
-		if( !is_wp_error( $result ) ) {
5137
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5136
+		if (!is_wp_error($result)) {
5137
+            return $term_id = isset($result['term_id']) ? $result['term_id'] : 0;
5138 5138
         }
5139
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5139
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
5140 5140
 		$term_data['term_id'] = $term_info['term_id'];
5141 5141
 		
5142
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5142
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5143 5143
 		
5144
-		if( !is_wp_error( $result ) ) {
5145
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5144
+		if (!is_wp_error($result)) {
5145
+            return $term_id = isset($result['term_id']) ? $result['term_id'] : 0;
5146 5146
         }
5147 5147
 	} else {
5148
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5148
+		return geodir_imex_insert_term($taxonomy, $term_data);
5149 5149
 	}
5150 5150
 	
5151 5151
 	return false;
@@ -5160,9 +5160,9 @@  discard block
 block discarded – undo
5160 5160
  * @param string $post_type Post type.
5161 5161
  * @return int Posts count.
5162 5162
  */
5163
-function geodir_get_posts_count( $post_type ) {
5164
-	$posts_count = wp_count_posts( $post_type );
5165
-	$posts_count = array_sum( (array)$posts_count );
5163
+function geodir_get_posts_count($post_type) {
5164
+	$posts_count = wp_count_posts($post_type);
5165
+	$posts_count = array_sum((array) $posts_count);
5166 5166
 	
5167 5167
 	/**
5168 5168
 	 * Modify returned post counts for the current post type.
@@ -5173,7 +5173,7 @@  discard block
 block discarded – undo
5173 5173
 	 * @param int $posts_count Post counts.
5174 5174
 	 * @param string $post_type Post type.
5175 5175
 	 */
5176
-	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );	 
5176
+	$posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);	 
5177 5177
 	
5178 5178
 	return $posts_count;
5179 5179
 }
@@ -5191,8 +5191,8 @@  discard block
 block discarded – undo
5191 5191
  * @param string $post_type Post type.
5192 5192
  * @return int Posts count.
5193 5193
  */
5194
-function geodir_imex_count_events( $posts_count, $post_type ) {
5195
-	if ( $post_type == 'gd_event' ) {
5194
+function geodir_imex_count_events($posts_count, $post_type) {
5195
+	if ($post_type == 'gd_event') {
5196 5196
 		global $wpdb, $plugin_prefix;
5197 5197
 		
5198 5198
 		$table = $plugin_prefix . $post_type . '_detail';
@@ -5200,7 +5200,7 @@  discard block
 block discarded – undo
5200 5200
 
5201 5201
 		$query = "SELECT COUNT({$wpdb->posts}.ID) AS total FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s";
5202 5202
 		
5203
-		$posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) );
5203
+		$posts_count = (int) $wpdb->get_var($wpdb->prepare($query, $post_type));
5204 5204
 	}
5205 5205
 	
5206 5206
 	return $posts_count;
@@ -5222,17 +5222,17 @@  discard block
 block discarded – undo
5222 5222
  * @param int $page_no Page number. Default 0.
5223 5223
  * @return array Array of posts data.
5224 5224
  */
5225
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5225
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5226 5226
 	global $wp_filesystem;
5227 5227
 
5228
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5228
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5229 5229
 
5230 5230
 	$csv_rows = array();
5231 5231
 	
5232
-	if ( !empty( $posts ) ) {
5233
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5232
+	if (!empty($posts)) {
5233
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5234 5234
         $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5235
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5235
+        $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5236 5236
         $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5237 5237
 		
5238 5238
 		$csv_row = array();
@@ -5244,7 +5244,7 @@  discard block
 block discarded – undo
5244 5244
 		$csv_row[] = 'default_category';
5245 5245
 		$csv_row[] = 'post_tags';
5246 5246
 		$csv_row[] = 'post_type';
5247
-		if ( $post_type == 'gd_event' ) {
5247
+		if ($post_type == 'gd_event') {
5248 5248
 			$csv_row[] = 'event_date';
5249 5249
 			$csv_row[] = 'event_enddate';
5250 5250
 			$csv_row[] = 'starttime';
@@ -5298,15 +5298,15 @@  discard block
 block discarded – undo
5298 5298
 		}
5299 5299
 		// WPML
5300 5300
 
5301
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5302
-		if ( !empty( $custom_fields ) ) {
5303
-			foreach ( $custom_fields as $custom_field ) {
5301
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5302
+		if (!empty($custom_fields)) {
5303
+			foreach ($custom_fields as $custom_field) {
5304 5304
 				$csv_row[] = $custom_field->htmlvar_name;
5305 5305
 			}
5306 5306
 		}
5307 5307
 
5308 5308
 		// Export franchise fields
5309
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5309
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5310 5310
 		if ($is_franchise_active) {
5311 5311
 			$csv_row[] = 'gd_is_franchise';
5312 5312
 			$csv_row[] = 'gd_franchise_lock';
@@ -5316,12 +5316,12 @@  discard block
 block discarded – undo
5316 5316
 		$csv_rows[] = $csv_row;
5317 5317
 
5318 5318
 		$images_count = 5;
5319
-        $xx=0;
5320
-		foreach ( $posts as $post ) {$xx++;
5319
+        $xx = 0;
5320
+		foreach ($posts as $post) {$xx++;
5321 5321
 			$post_id = $post['ID'];
5322 5322
 			
5323
-			$gd_post_info = geodir_get_post_info( $post_id );
5324
-			$post_info = (array)$gd_post_info;
5323
+			$gd_post_info = geodir_get_post_info($post_id);
5324
+			$post_info = (array) $gd_post_info;
5325 5325
 						
5326 5326
 			$taxonomy_category = $post_type . 'category';
5327 5327
 			$taxonomy_tags = $post_type . '_tags';
@@ -5330,14 +5330,14 @@  discard block
 block discarded – undo
5330 5330
 			$default_category_id = $gd_post_info->default_category;
5331 5331
 			$default_category = '';
5332 5332
 			$post_tags = '';
5333
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
5333
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
5334 5334
 			
5335
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
5335
+			if (!empty($terms) && !is_wp_error($terms)) {
5336 5336
 				$post_category = array();
5337 5337
 				$post_tags = array();
5338 5338
 			
5339
-				foreach ( $terms as $term ) {
5340
-					if ( $term->taxonomy == $taxonomy_category ) {
5339
+				foreach ($terms as $term) {
5340
+					if ($term->taxonomy == $taxonomy_category) {
5341 5341
 						$post_category[] = $term->name;
5342 5342
 						
5343 5343
 						if ($default_category_id == $term->term_id) {
@@ -5345,7 +5345,7 @@  discard block
 block discarded – undo
5345 5345
 						}
5346 5346
 					}
5347 5347
 					
5348
-					if ( $term->taxonomy == $taxonomy_tags ) {
5348
+					if ($term->taxonomy == $taxonomy_tags) {
5349 5349
 						$post_tags[] = $term->name;
5350 5350
 					}
5351 5351
 				}
@@ -5353,8 +5353,8 @@  discard block
 block discarded – undo
5353 5353
 				if (empty($default_category) && !empty($post_category)) {
5354 5354
 					$default_category = $post_category[0]; // Set first one as default category.
5355 5355
 				}
5356
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
5357
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
5356
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
5357
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
5358 5358
 			}
5359 5359
 
5360 5360
 			// Franchise data
@@ -5362,42 +5362,42 @@  discard block
 block discarded – undo
5362 5362
 			$franchise_info = array();
5363 5363
 			$locked_fields = array();
5364 5364
 			
5365
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
5365
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
5366 5366
 				$franchise_id = $post_info['franchise'];
5367 5367
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
5368 5368
 
5369 5369
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
5370
-					$franchise_info = (array)$gd_franchise_info;
5370
+					$franchise_info = (array) $gd_franchise_info;
5371 5371
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
5372 5372
 					
5373 5373
 					if (!empty($locked_fields)) {
5374
-						foreach( $locked_fields as $locked_field) {
5374
+						foreach ($locked_fields as $locked_field) {
5375 5375
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
5376 5376
 								$post_info[$locked_field] = $franchise_info[$locked_field];
5377 5377
 							}
5378 5378
 							
5379 5379
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
5380
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
5380
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
5381 5381
 			
5382
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
5382
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
5383 5383
 									$franchise_post_category = array();
5384 5384
 									$franchise_post_tags = array();
5385 5385
 								
5386
-									foreach ( $franchise_terms as $franchise_term ) {
5387
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
5386
+									foreach ($franchise_terms as $franchise_term) {
5387
+										if ($franchise_term->taxonomy == $taxonomy_category) {
5388 5388
 											$franchise_post_category[] = $franchise_term->name;
5389 5389
 										}
5390 5390
 										
5391
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
5391
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
5392 5392
 											$franchise_post_tags[] = $franchise_term->name;
5393 5393
 										}
5394 5394
 									}
5395 5395
 									
5396 5396
 									if (in_array($taxonomy_category, $locked_fields)) {
5397
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
5397
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
5398 5398
 									}
5399 5399
 									if (in_array('post_tags', $locked_fields)) {
5400
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
5400
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
5401 5401
 									}
5402 5402
 								}
5403 5403
 							}
@@ -5406,18 +5406,18 @@  discard block
 block discarded – undo
5406 5406
 				}
5407 5407
 			}
5408 5408
 						
5409
-			$post_images = geodir_get_images( $post_id );
5409
+			$post_images = geodir_get_images($post_id);
5410 5410
 			$current_images = array();
5411
-			if ( !empty( $post_images ) ) {
5412
-				foreach ( $post_images as $post_image ) {
5413
-					$post_image = (array)$post_image;
5414
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
5415
-					if ( $image ) {
5411
+			if (!empty($post_images)) {
5412
+				foreach ($post_images as $post_image) {
5413
+					$post_image = (array) $post_image;
5414
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
5415
+					if ($image) {
5416 5416
 						$current_images[] = $image;
5417 5417
 					}
5418 5418
 				}
5419 5419
 				
5420
-				$images_count = max( $images_count, count( $current_images ) );
5420
+				$images_count = max($images_count, count($current_images));
5421 5421
 			}
5422 5422
 
5423 5423
 			$csv_row = array();
@@ -5429,7 +5429,7 @@  discard block
 block discarded – undo
5429 5429
 			$csv_row[] = $default_category; // default_category
5430 5430
 			$csv_row[] = $post_tags; // post_tags
5431 5431
 			$csv_row[] = $post_type; // post_type
5432
-			if ( $post_type == 'gd_event' ) {
5432
+			if ($post_type == 'gd_event') {
5433 5433
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
5434 5434
 				$csv_row[] = $event_data['event_date']; // event_date
5435 5435
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -5450,9 +5450,9 @@  discard block
 block discarded – undo
5450 5450
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
5451 5451
 			}
5452 5452
 			$csv_row[] = $post_info['post_status']; // post_status
5453
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5453
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5454 5454
 			if ($is_payment_plugin) {
5455
-				$csv_row[] = (int)$post_info['package_id']; // package_id
5455
+				$csv_row[] = (int) $post_info['package_id']; // package_id
5456 5456
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
5457 5457
 			}
5458 5458
 			$csv_row[] = $post_info['geodir_video']; // geodir_video
@@ -5488,14 +5488,14 @@  discard block
 block discarded – undo
5488 5488
 			$csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
5489 5489
 			// WPML
5490 5490
 			if ($is_wpml) {
5491
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
5492
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
5491
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_' . $post_type);
5492
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_' . $post_type);
5493 5493
 			}
5494 5494
 			// WPML
5495 5495
 			
5496
-			if ( !empty( $custom_fields ) ) {
5497
-				foreach ( $custom_fields as $custom_field ) {
5498
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
5496
+			if (!empty($custom_fields)) {
5497
+				foreach ($custom_fields as $custom_field) {
5498
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
5499 5499
 				}
5500 5500
 			}
5501 5501
 			
@@ -5506,26 +5506,26 @@  discard block
 block discarded – undo
5506 5506
 				$franchise = '';
5507 5507
 					
5508 5508
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
5509
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
5510
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
5509
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
5510
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
5511 5511
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
5512
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
5512
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
5513 5513
 				}
5514 5514
 				
5515
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
5515
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
5516 5516
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
5517
-				$csv_row[] = (int)$franchise; // franchise id
5517
+				$csv_row[] = (int) $franchise; // franchise id
5518 5518
 			}
5519 5519
 			
5520
-			for ( $c = 0; $c < $images_count; $c++ ) {
5521
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
5520
+			for ($c = 0; $c < $images_count; $c++) {
5521
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
5522 5522
 			}
5523 5523
 			
5524 5524
 			$csv_rows[] = $csv_row;
5525 5525
 
5526 5526
 		}
5527 5527
 
5528
-		for ( $c = 0; $c < $images_count; $c++ ) {
5528
+		for ($c = 0; $c < $images_count; $c++) {
5529 5529
 			$csv_rows[0][] = 'IMAGE';
5530 5530
 		}
5531 5531
 	}
@@ -5547,19 +5547,19 @@  discard block
 block discarded – undo
5547 5547
  * @param int $page_no Page number. Default 0.
5548 5548
  * @return array Array of posts data.
5549 5549
  */
5550
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5550
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
5551 5551
 	global $wpdb, $plugin_prefix;
5552 5552
 
5553
-	if ( ! post_type_exists( $post_type ) )
5553
+	if (!post_type_exists($post_type))
5554 5554
 		return new stdClass;
5555 5555
 		
5556 5556
 	$table = $plugin_prefix . $post_type . '_detail';
5557 5557
 	
5558 5558
 	$limit = '';
5559
-	if ( $per_page > 0 && $page_no > 0 ) {
5560
-		$offset = ( $page_no - 1 ) * $per_page;
5559
+	if ($per_page > 0 && $page_no > 0) {
5560
+		$offset = ($page_no - 1) * $per_page;
5561 5561
 		
5562
-		if ( $offset > 0 ) {
5562
+		if ($offset > 0) {
5563 5563
 			$limit = " LIMIT " . $offset . "," . $per_page;
5564 5564
 		} else {
5565 5565
 			$limit = " LIMIT " . $per_page;
@@ -5576,9 +5576,9 @@  discard block
 block discarded – undo
5576 5576
 	 * @param int $query The SQL query.
5577 5577
 	 * @param string $post_type Post type.
5578 5578
 	 */
5579
-	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5579
+	$query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
5580 5580
 
5581
-	$results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5581
+	$results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A);
5582 5582
 
5583 5583
 	/**
5584 5584
 	 * Modify returned post results for the current post type.
@@ -5589,7 +5589,7 @@  discard block
 block discarded – undo
5589 5589
 	 * @param object $results An object containing all post ids.
5590 5590
 	 * @param string $post_type Post type.
5591 5591
 	 */
5592
-	return apply_filters( 'geodir_export_posts', $results, $post_type );
5592
+	return apply_filters('geodir_export_posts', $results, $post_type);
5593 5593
 }
5594 5594
 
5595 5595
 /**
@@ -5606,8 +5606,8 @@  discard block
 block discarded – undo
5606 5606
  * @param string $post_type Post type.
5607 5607
  * @return string The SQL query.
5608 5608
  */
5609
-function geodir_imex_get_events_query( $query, $post_type ) {
5610
-	if ( $post_type == 'gd_event' ) {
5609
+function geodir_imex_get_events_query($query, $post_type) {
5610
+	if ($post_type == 'gd_event') {
5611 5611
 		global $wpdb, $plugin_prefix;
5612 5612
 		
5613 5613
 		$table = $plugin_prefix . $post_type . '_detail';
@@ -5628,15 +5628,15 @@  discard block
 block discarded – undo
5628 5628
  * @param  string $post_type Post type.
5629 5629
  * @return int Total terms count.
5630 5630
  */
5631
-function geodir_get_terms_count( $post_type ) {
5632
-	$args = array( 'hide_empty' => 0 );
5631
+function geodir_get_terms_count($post_type) {
5632
+	$args = array('hide_empty' => 0);
5633 5633
 	
5634
-	remove_all_filters( 'get_terms' );
5634
+	remove_all_filters('get_terms');
5635 5635
 	
5636 5636
 	$taxonomy = $post_type . 'category';
5637 5637
 
5638
-	$count_terms = wp_count_terms( $taxonomy, $args );
5639
-	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5638
+	$count_terms = wp_count_terms($taxonomy, $args);
5639
+	$count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
5640 5640
 	 
5641 5641
 	return $count_terms;
5642 5642
 }
@@ -5653,23 +5653,23 @@  discard block
 block discarded – undo
5653 5653
  * @param int $page_no Page number. Default 0.
5654 5654
  * @return array Array of terms data.
5655 5655
  */
5656
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
5657
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
5656
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
5657
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
5658 5658
 	
5659
-	remove_all_filters( 'get_terms' );
5659
+	remove_all_filters('get_terms');
5660 5660
 	
5661 5661
 	$taxonomy = $post_type . 'category';
5662 5662
 	
5663
-	if ( $per_page > 0 && $page_no > 0 ) {
5664
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
5663
+	if ($per_page > 0 && $page_no > 0) {
5664
+		$args['offset'] = ($page_no - 1) * $per_page;
5665 5665
 		$args['number'] = $per_page;
5666 5666
 	}
5667 5667
 	
5668
-	$terms = get_terms( $taxonomy, $args );
5668
+	$terms = get_terms($taxonomy, $args);
5669 5669
 
5670 5670
 	$csv_rows = array();
5671 5671
 	
5672
-	if ( !empty( $terms ) ) {
5672
+	if (!empty($terms)) {
5673 5673
 		$csv_row = array();
5674 5674
 		$csv_row[] = 'cat_id';
5675 5675
 		$csv_row[] = 'cat_name';
@@ -5690,16 +5690,16 @@  discard block
 block discarded – undo
5690 5690
 		
5691 5691
 		$csv_rows[] = $csv_row;
5692 5692
 		
5693
-		foreach ( $terms as $term ) {			
5694
-			$cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
5695
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5693
+		foreach ($terms as $term) {			
5694
+			$cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
5695
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5696 5696
 			
5697
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
5698
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
5697
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
5698
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
5699 5699
 			
5700 5700
 			$cat_parent = '';
5701
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
5702
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
5701
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
5702
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
5703 5703
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
5704 5704
 			}
5705 5705
 			
@@ -5709,14 +5709,14 @@  discard block
 block discarded – undo
5709 5709
 			$csv_row[] = $term->slug;
5710 5710
 			$csv_row[] = $post_type;
5711 5711
 			$csv_row[] = $cat_parent;
5712
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5712
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
5713 5713
 			$csv_row[] = $term->description;
5714
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
5714
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
5715 5715
 			$csv_row[] = $cat_image;
5716 5716
 			$csv_row[] = $cat_icon;
5717 5717
 			// WPML
5718 5718
 			if ($is_wpml) {
5719
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5719
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_' . $taxonomy);
5720 5720
 			}
5721 5721
 			// WPML
5722 5722
 			
@@ -5735,7 +5735,7 @@  discard block
 block discarded – undo
5735 5735
  * @param  bool $relative True for relative path & False for absolute path.
5736 5736
  * @return string Path to the cache directory.
5737 5737
  */
5738
-function geodir_path_import_export( $relative = true ) {
5738
+function geodir_path_import_export($relative = true) {
5739 5739
 	$upload_dir = wp_upload_dir();
5740 5740
 	
5741 5741
 	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
@@ -5754,8 +5754,8 @@  discard block
 block discarded – undo
5754 5754
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
5755 5755
  * @return bool true if success otherwise false.
5756 5756
  */
5757
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
5758
-	if ( empty( $csv_data ) ) {
5757
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
5758
+	if (empty($csv_data)) {
5759 5759
 		return false;
5760 5760
 	}
5761 5761
 	
@@ -5763,17 +5763,17 @@  discard block
 block discarded – undo
5763 5763
 	
5764 5764
 	$mode = $clear ? 'w+' : 'a+';
5765 5765
 	
5766
-	if ( function_exists( 'fputcsv' ) ) {
5767
-		$file = fopen( $file_path, $mode );
5768
-		foreach( $csv_data as $csv_row ) {
5766
+	if (function_exists('fputcsv')) {
5767
+		$file = fopen($file_path, $mode);
5768
+		foreach ($csv_data as $csv_row) {
5769 5769
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5770
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
5770
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
5771 5771
 		}
5772
-		fclose( $file );
5772
+		fclose($file);
5773 5773
 	} else {
5774
-		foreach( $csv_data as $csv_row ) {
5774
+		foreach ($csv_data as $csv_row) {
5775 5775
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5776
-			$wp_filesystem->put_contents( $file_path, $csv_row );
5776
+			$wp_filesystem->put_contents($file_path, $csv_row);
5777 5777
 		}
5778 5778
 	}
5779 5779
 		
@@ -5791,14 +5791,14 @@  discard block
 block discarded – undo
5791 5791
  * @param  string $file Full path to file.
5792 5792
  * @return int No of file rows.
5793 5793
  */
5794
-function geodir_import_export_line_count( $file ) {
5794
+function geodir_import_export_line_count($file) {
5795 5795
 	global $wp_filesystem;
5796 5796
 	
5797
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
5798
-		$contents = $wp_filesystem->get_contents_array( $file );
5797
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
5798
+		$contents = $wp_filesystem->get_contents_array($file);
5799 5799
 		
5800
-		if ( !empty( $contents ) && is_array( $contents ) ) {
5801
-			return count( $contents ) - 1;
5800
+		if (!empty($contents) && is_array($contents)) {
5801
+			return count($contents) - 1;
5802 5802
 		}
5803 5803
 	}
5804 5804
 	
@@ -5815,11 +5815,11 @@  discard block
 block discarded – undo
5815 5815
  * @param string $post_type The post type.
5816 5816
  * @return object Queried object.
5817 5817
  */
5818
-function geodir_imex_get_custom_fields( $post_type ) {
5818
+function geodir_imex_get_custom_fields($post_type) {
5819 5819
 	global $wpdb;
5820 5820
 	 
5821
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
5822
-	$rows = $wpdb->get_results( $sql );
5821
+	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array($post_type));
5822
+	$rows = $wpdb->get_results($sql);
5823 5823
 	 
5824 5824
 	return $rows;
5825 5825
 }
@@ -5901,9 +5901,9 @@  discard block
 block discarded – undo
5901 5901
 	$post_table = $plugin_prefix . $post_type . '_detail';
5902 5902
 	
5903 5903
 	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
5904
-	$data = (array)$wpdb->get_row($query);
5904
+	$data = (array) $wpdb->get_row($query);
5905 5905
 	
5906
-	if ( !empty( $data ) ) {
5906
+	if (!empty($data)) {
5907 5907
 		$data['post_id'] = $tr_post_id;
5908 5908
 		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
5909 5909
 		
@@ -5931,7 +5931,7 @@  discard block
 block discarded – undo
5931 5931
 	global $sitepress, $wpdb;
5932 5932
 	$post_type = get_post_type($master_post_id);
5933 5933
 	
5934
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
5934
+	remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
5935 5935
 
5936 5936
 	$taxonomies = get_object_taxonomies($post_type);
5937 5937
 	foreach ($taxonomies as $taxonomy) {
@@ -5940,9 +5940,9 @@  discard block
 block discarded – undo
5940 5940
 		
5941 5941
 		if ($terms) {
5942 5942
 			foreach ($terms as $term) {
5943
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
5943
+				$tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
5944 5944
 				
5945
-				if (!is_null($tr_id)){
5945
+				if (!is_null($tr_id)) {
5946 5946
 					// not using get_term - unfiltered get_term
5947 5947
 					$translated_term = $wpdb->get_row($wpdb->prepare("
5948 5948
 						SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -5951,8 +5951,8 @@  discard block
 block discarded – undo
5951 5951
 				}
5952 5952
 			}
5953 5953
 
5954
-			if (!is_taxonomy_hierarchical($taxonomy)){
5955
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
5954
+			if (!is_taxonomy_hierarchical($taxonomy)) {
5955
+				$terms_array = array_unique(array_map('intval', $terms_array));
5956 5956
 			}
5957 5957
 
5958 5958
 			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
@@ -5985,9 +5985,9 @@  discard block
 block discarded – undo
5985 5985
 	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
5986 5986
 	$post_images = $wpdb->get_results($query);
5987 5987
 	
5988
-	if ( !empty( $post_images ) ) {
5989
-		foreach ( $post_images as $post_image) {
5990
-			$image_data = (array)$post_image;
5988
+	if (!empty($post_images)) {
5989
+		foreach ($post_images as $post_image) {
5990
+			$image_data = (array) $post_image;
5991 5991
 			unset($image_data['ID']);
5992 5992
 			$image_data['post_id'] = $tr_post_id;
5993 5993
 			
@@ -6013,10 +6013,10 @@  discard block
 block discarded – undo
6013 6013
  * @return array Event data array.
6014 6014
  */
6015 6015
 function geodir_imex_get_event_data($post, $gd_post_info) {
6016
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
6016
+	$event_date = isset($post['event_date']) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($post['event_date'])) : '';
6017 6017
 	$event_enddate = $event_date;
6018
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6019
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6018
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
6019
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
6020 6020
 	
6021 6021
 	$is_recurring_event = '';
6022 6022
 	$event_duration_days = '';
@@ -6034,15 +6034,15 @@  discard block
 block discarded – undo
6034 6034
 		
6035 6035
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6036 6036
 	if (!empty($recurring_data)) {
6037
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
6038
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
6039
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6040
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6037
+		$event_date = isset($recurring_data['event_start']) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_start'])) : $event_date;
6038
+		$event_enddate = isset($recurring_data['event_end']) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_end'])) : $event_date;
6039
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
6040
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
6041 6041
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6042 6042
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
6043 6043
 	
6044
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6045
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6044
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
6045
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
6046 6046
 			
6047 6047
 		if ($recurring_pkg && $is_recurring) {
6048 6048
 			$recurring_dates = $event_date;
@@ -6052,13 +6052,13 @@  discard block
 block discarded – undo
6052 6052
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6053 6053
 			
6054 6054
 			if (!empty($recurring_data['event_recurring_dates'])) {
6055
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6055
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
6056 6056
 				
6057 6057
 				if (!empty($event_recurring_dates)) {
6058 6058
 					$recurring_dates = array();
6059 6059
 					
6060 6060
 					foreach ($event_recurring_dates as $date) {
6061
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6061
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
6062 6062
 					}
6063 6063
 					
6064 6064
 					$recurring_dates = implode(",", $recurring_dates);
@@ -6074,7 +6074,7 @@  discard block
 block discarded – undo
6074 6074
 						$times = array();
6075 6075
 						
6076 6076
 						foreach ($recurring_data['starttimes'] as $time) {
6077
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6077
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6078 6078
 						}
6079 6079
 						
6080 6080
 						$event_starttimes = implode(",", $times);
@@ -6084,7 +6084,7 @@  discard block
 block discarded – undo
6084 6084
 						$times = array();
6085 6085
 						
6086 6086
 						foreach ($recurring_data['endtimes'] as $time) {
6087
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6087
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6088 6088
 						}
6089 6089
 						
6090 6090
 						$event_endtimes = implode(",", $times);
@@ -6096,8 +6096,8 @@  discard block
 block discarded – undo
6096 6096
 					}
6097 6097
 				}
6098 6098
 			} else {
6099
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6100
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6099
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
6100
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6101 6101
 				
6102 6102
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6103 6103
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -6113,11 +6113,11 @@  discard block
 block discarded – undo
6113 6113
 				}
6114 6114
 				
6115 6115
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6116
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6117
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
6116
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
6117
+					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
6118 6118
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
6119 6119
 				} else {
6120
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6120
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
6121 6121
 				}
6122 6122
 			}
6123 6123
 		}
@@ -6181,9 +6181,9 @@  discard block
 block discarded – undo
6181 6181
  * @return array Event data array.
6182 6182
  */
6183 6183
 function geodir_imex_process_event_data($gd_post) {
6184
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6184
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
6185 6185
 
6186
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6186
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
6187 6187
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6188 6188
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6189 6189
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -6230,17 +6230,17 @@  discard block
 block discarded – undo
6230 6230
 				$event_recurring_dates = implode(",", $event_recurring_dates);
6231 6231
 			}
6232 6232
 		} else {
6233
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6234
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6235
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6236
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6233
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6234
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6235
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6236
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6237 6237
 			
6238 6238
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6239 6239
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6240 6240
 			
6241 6241
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6242 6242
 			
6243
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6243
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6244 6244
 			$repeat_days = array();
6245 6245
 			if (!empty($a_repeat_days)) {
6246 6246
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6258,7 +6258,7 @@  discard block
 block discarded – undo
6258 6258
 			$repeat_weeks = array();
6259 6259
 			if (!empty($a_repeat_weeks)) {
6260 6260
 				foreach ($a_repeat_weeks as $repeat_week) {
6261
-					$repeat_weeks[] = (int)$repeat_week;
6261
+					$repeat_weeks[] = (int) $repeat_week;
6262 6262
 				}
6263 6263
 				
6264 6264
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -6377,7 +6377,7 @@  discard block
 block discarded – undo
6377 6377
  */
6378 6378
 function geodir_admin_upgrade_notice() {
6379 6379
     $class = "error";
6380
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6380
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
6381 6381
     echo"<div class=\"$class\"> <p>$message</p></div>";
6382 6382
 }
6383 6383
 
@@ -6389,7 +6389,7 @@  discard block
 block discarded – undo
6389 6389
  * @param (object) $r
6390 6390
  * @return (string) $output
6391 6391
  */
6392
-function geodire_admin_upgrade_notice( $plugin_data, $r )
6392
+function geodire_admin_upgrade_notice($plugin_data, $r)
6393 6393
 {
6394 6394
     // readme contents
6395 6395
     $args = array(
@@ -6397,7 +6397,7 @@  discard block
 block discarded – undo
6397 6397
         'redirection' => 5
6398 6398
     );
6399 6399
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6400
-    $data       = wp_remote_get( $url, $args );
6400
+    $data = wp_remote_get($url, $args);
6401 6401
 
6402 6402
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
6403 6403
 
@@ -6412,20 +6412,20 @@  discard block
 block discarded – undo
6412 6412
 function geodir_in_plugin_update_message($content) {
6413 6413
     // Output Upgrade Notice
6414 6414
     $matches        = null;
6415
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6415
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote(GEODIRECTORY_VERSION) . '\s*=|$)~Uis';
6416 6416
     $upgrade_notice = '';
6417
-    if ( preg_match( $regexp, $content, $matches ) ) {
6418
-        if(empty($matches)){return;}
6417
+    if (preg_match($regexp, $content, $matches)) {
6418
+        if (empty($matches)) {return; }
6419 6419
 
6420
-        $version = trim( $matches[1] );
6421
-        if($version && $version>GEODIRECTORY_VERSION){
6420
+        $version = trim($matches[1]);
6421
+        if ($version && $version > GEODIRECTORY_VERSION) {
6422 6422
 
6423 6423
 
6424
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6425
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6424
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
6425
+        if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
6426 6426
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6427
-            foreach ( $notices as $index => $line ) {
6428
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6427
+            foreach ($notices as $index => $line) {
6428
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
6429 6429
             }
6430 6430
             $upgrade_notice .= '</div> ';
6431 6431
         }
@@ -6449,7 +6449,7 @@  discard block
 block discarded – undo
6449 6449
 		$default_language = $sitepress->get_default_language();
6450 6450
 		if ($current_language != 'all' && $current_language != $default_language) {
6451 6451
 	?>
6452
-	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
6452
+	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?></strong></p></div>
6453 6453
 	<?php
6454 6454
 		}
6455 6455
 	}
Please login to merge, or discard this patch.
Braces   +231 added lines, -127 removed lines patch added patch discarded remove patch
@@ -183,8 +183,9 @@  discard block
 block discarded – undo
183 183
 
184 184
         $thumb_img_arr = array();
185 185
 
186
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
186
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
187
+                    $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
+        }
188 189
 
189 190
         $totImg = '';
190 191
         $image_limit = '';
@@ -240,7 +241,9 @@  discard block
 block discarded – undo
240 241
     {
241 242
         global $menu, $geodirectory;
242 243
 
243
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
244
+        if (current_user_can('manage_options')) {
245
+        	$menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
246
+        }
244 247
 
245 248
         add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
246 249
 
@@ -309,7 +312,9 @@  discard block
 block discarded – undo
309 312
      */
310 313
     function geodir_admin_custom_menu_order()
311 314
     {
312
-        if (!current_user_can('manage_options')) return false;
315
+        if (!current_user_can('manage_options')) {
316
+        	return false;
317
+        }
313 318
         return true;
314 319
     }
315 320
 }
@@ -340,10 +345,11 @@  discard block
 block discarded – undo
340 345
 			case 'fail':
341 346
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
342 347
 				
343
-				if ($gderr == 21)
344
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
345
-				else
346
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
348
+				if ($gderr == 21) {
349
+							    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
350
+				} else {
351
+									echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
352
+				}
347 353
                 break;
348 354
         }
349 355
     }
@@ -380,8 +386,12 @@  discard block
 block discarded – undo
380 386
         include_once('option-pages/' . $current_tab . '_array.php');
381 387
     }
382 388
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
383
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
389
+        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) {
390
+        	die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
391
+        }
392
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) {
393
+        	die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
394
+        }
385 395
 		
386 396
 		/**
387 397
 		 * Fires before updating geodirectory admin settings.
@@ -393,8 +403,9 @@  discard block
 block discarded – undo
393 403
 		 */
394 404
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
395 405
 		
396
-        if (!empty($geodir_settings[$current_tab]))
397
-            geodir_update_options($geodir_settings[$current_tab]);
406
+        if (!empty($geodir_settings[$current_tab])) {
407
+                    geodir_update_options($geodir_settings[$current_tab]);
408
+        }
398 409
 
399 410
         /**
400 411
          * Called after GeoDirectory options settings are updated.
@@ -462,8 +473,9 @@  discard block
 block discarded – undo
462 473
                 $options_list = '';
463 474
                 for ($option = 1; $option <= 30; $option++) {
464 475
                     $selected = '';
465
-                    if ($option == 10)
466
-                        $selected = 'selected="selected"';
476
+                    if ($option == 10) {
477
+                                            $selected = 'selected="selected"';
478
+                    }
467 479
 
468 480
                     $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
469 481
                 }
@@ -661,10 +673,11 @@  discard block
 block discarded – undo
661 673
                     }
662 674
 
663 675
 
664
-                    if (geodir_dummy_folder_exists())
665
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
666
-                    else
667
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
676
+                    if (geodir_dummy_folder_exists()) {
677
+                                            $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
678
+                    } else {
679
+                                            $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
680
+                    }
668 681
                     $catname = str_replace(' ', '_', $catname);
669 682
                     $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
670 683
 
@@ -702,10 +715,11 @@  discard block
 block discarded – undo
702 715
             if (!term_exists($catname, 'gd_placecategory')) {
703 716
                 $last_catid = wp_insert_term($catname, 'gd_placecategory');
704 717
 
705
-                if (geodir_dummy_folder_exists())
706
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
707
-                else
708
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
718
+                if (geodir_dummy_folder_exists()) {
719
+                                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
720
+                } else {
721
+                                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
722
+                }
709 723
                 $catname = str_replace(' ', '_', $catname);
710 724
                 $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
711 725
 
@@ -754,11 +768,14 @@  discard block
 block discarded – undo
754 768
  * @return bool Returns true if saved.
755 769
  */
756 770
 function geodir_update_options($options, $dummy = false) {
757
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
771
+    if ((!isset($_POST) || !$_POST) && !$dummy) {
772
+    	return false;
773
+    }
758 774
 
759 775
     foreach ($options as $value) {
760
-        if ($dummy && isset($value['std']))
761
-            $_POST[$value['id']] = $value['std'];
776
+        if ($dummy && isset($value['std'])) {
777
+                    $_POST[$value['id']] = $value['std'];
778
+        }
762 779
 
763 780
 
764 781
         if (isset($value['type']) && $value['type'] == 'checkbox') :
@@ -767,25 +784,23 @@  discard block
 block discarded – undo
767 784
                 update_option($value['id'], $_POST[$value['id']]);
768 785
             } else {
769 786
                 update_option($value['id'], 0);
770
-            }
771
-
772
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
787
+            } elseif (isset($value['type']) && $value['type'] == 'image_width') :
773 788
 
774 789
             if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
775 790
                 update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
776 791
                 update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
777 792
                 if (isset($_POST[$value['id'] . '_crop'])) :
778 793
                     update_option($value['id'] . '_crop', 1);
779
-                else :
780
-                    update_option($value['id'] . '_crop', 0);
794
+                else {
795
+                	:
796
+                    update_option($value['id'] . '_crop', 0);
797
+                }
781 798
                 endif;
782 799
             } else {
783 800
                 update_option($value['id'] . '_width', $value['std']);
784 801
                 update_option($value['id'] . '_height', $value['std']);
785 802
                 update_option($value['id'] . '_crop', 1);
786
-            }
787
-
788
-        elseif (isset($value['type']) && $value['type'] == 'map') :
803
+            } elseif (isset($value['type']) && $value['type'] == 'map') :
789 804
             $post_types = array();
790 805
             $categories = array();
791 806
             $i = 0;
@@ -831,8 +846,9 @@  discard block
 block discarded – undo
831 846
                     $image_name_arr = explode('/', get_option($value['id']));
832 847
                     $noimg_name = end($image_name_arr);
833 848
                     $img_path = $uploads['path'] . '/' . $noimg_name;
834
-                    if (file_exists($img_path))
835
-                        unlink($img_path);
849
+                    if (file_exists($img_path)) {
850
+                                            unlink($img_path);
851
+                    }
836 852
                 }
837 853
 
838 854
                 update_option($value['id'], '');
@@ -848,8 +864,10 @@  discard block
 block discarded – undo
848 864
                 foreach ($uploadedfile as $key => $uplaod):
849 865
                     if ($key == 'name'):
850 866
                         $uplaods[$key] = $filename;
851
-                    else :
852
-                        $uplaods[$key] = $uplaod;
867
+                    else {
868
+                    	:
869
+                        $uplaods[$key] = $uplaod;
870
+                    }
853 871
                     endif;
854 872
                 endforeach;
855 873
 
@@ -859,8 +877,9 @@  discard block
 block discarded – undo
859 877
                     $image_name_arr = explode('/', get_option($value['id']));
860 878
                     $noimg_name = end($image_name_arr);
861 879
                     $img_path = $uploads['path'] . '/' . $noimg_name;
862
-                    if (file_exists($img_path))
863
-                        unlink($img_path);
880
+                    if (file_exists($img_path)) {
881
+                                            unlink($img_path);
882
+                    }
864 883
                 }
865 884
 
866 885
                 $upload_overrides = array('test_form' => false);
@@ -875,10 +894,12 @@  discard block
 block discarded – undo
875 894
             endif;
876 895
 
877 896
 
878
-        else :
897
+        else {
898
+        	:
879 899
             // same menu setting per theme.
880 900
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
881
-                $theme = wp_get_theme();
901
+                $theme = wp_get_theme();
902
+        }
882 903
                 update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
883 904
             }
884 905
 
@@ -890,8 +911,9 @@  discard block
 block discarded – undo
890 911
 
891 912
         endif;
892 913
     }
893
-    if ($dummy)
894
-        $_POST = array();
914
+    if ($dummy) {
915
+            $_POST = array();
916
+    }
895 917
     return true;
896 918
 
897 919
 }
@@ -1036,9 +1058,12 @@  discard block
 block discarded – undo
1036 1058
         $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1037 1059
             'categorys' => __('Categories', 'geodirectory'));
1038 1060
 
1039
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1061
+        if (($offset = array_search('author', array_keys($columns))) === false) {
1062
+        	// if the key doesn't exist
1040 1063
         {
1041
-            $offset = 0; // should we prepend $array with $data?
1064
+            $offset = 0;
1065
+        }
1066
+        // should we prepend $array with $data?
1042 1067
             $offset = count($columns); // or should we append $array with $data? lets pick this one...
1043 1068
         }
1044 1069
 
@@ -1098,11 +1123,13 @@  discard block
 block discarded – undo
1098 1123
                     $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1099 1124
                 }
1100 1125
                 /* If no expire_date is found, output a default message. */
1101
-                if (empty($expire_date))
1102
-                    echo __('Unknown', 'geodirectory');
1126
+                if (empty($expire_date)) {
1127
+                                    echo __('Unknown', 'geodirectory');
1128
+                }
1103 1129
                 /* If there is a expire_date, append 'days left' to the text string. */
1104
-                else
1105
-                    echo $expire_date . $date_diff_text;
1130
+                else {
1131
+                                    echo $expire_date . $date_diff_text;
1132
+                }
1106 1133
                 break;
1107 1134
 
1108 1135
             /* If displaying the 'categorys' column. */
@@ -1175,21 +1202,26 @@  discard block
 block discarded – undo
1175 1202
 
1176 1203
     $geodir_posttypes = geodir_get_posttypes();
1177 1204
 
1178
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1179
-        return;
1205
+    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
1206
+            return;
1207
+    }
1180 1208
 
1181 1209
     if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1182
-        if (isset($_REQUEST['_status']))
1183
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1210
+        if (isset($_REQUEST['_status'])) {
1211
+                    geodir_change_post_status($post_id, $_REQUEST['_status']);
1212
+        }
1184 1213
 
1185
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1186
-            return;
1214
+        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) {
1215
+                    return;
1216
+        }
1187 1217
 
1188
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1189
-            return;
1218
+        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) {
1219
+                    return;
1220
+        }
1190 1221
 
1191
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1192
-            return;
1222
+        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) {
1223
+                    return;
1224
+        }
1193 1225
 
1194 1226
         geodir_save_listing($_REQUEST);
1195 1227
     }
@@ -1214,10 +1246,18 @@  discard block
 block discarded – undo
1214 1246
     $tab_id = '';
1215 1247
     $i = 0;
1216 1248
     foreach ($options as $value) :
1217
-        if (!isset($value['name'])) $value['name'] = '';
1218
-        if (!isset($value['class'])) $value['class'] = '';
1219
-        if (!isset($value['css'])) $value['css'] = '';
1220
-        if (!isset($value['std'])) $value['std'] = '';
1249
+        if (!isset($value['name'])) {
1250
+        	$value['name'] = '';
1251
+        }
1252
+        if (!isset($value['class'])) {
1253
+        	$value['class'] = '';
1254
+        }
1255
+        if (!isset($value['css'])) {
1256
+        	$value['css'] = '';
1257
+        }
1258
+        if (!isset($value['std'])) {
1259
+        	$value['std'] = '';
1260
+        }
1221 1261
         $desc = '';
1222 1262
         switch ($value['type']) :
1223 1263
             case 'dummy_installer':
@@ -1233,11 +1273,13 @@  discard block
 block discarded – undo
1233 1273
 
1234 1274
                 $i++;
1235 1275
 
1236
-                if (isset($value['id']) && $value['id'])
1237
-                    $tab_id = $value['id'];
1276
+                if (isset($value['id']) && $value['id']) {
1277
+                                    $tab_id = $value['id'];
1278
+                }
1238 1279
 
1239
-                if (isset($value['desc']) && $value['desc'])
1240
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1280
+                if (isset($value['desc']) && $value['desc']) {
1281
+                                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1282
+                }
1241 1283
 
1242 1284
                 if (isset($value['name']) && $value['name']) {
1243 1285
                     if ($first_title === true) {
@@ -1268,10 +1310,12 @@  discard block
 block discarded – undo
1268 1310
                 break;
1269 1311
 
1270 1312
             case 'sectionstart':
1271
-                if (isset($value['desc']) && $value['desc'])
1272
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1273
-                if (isset($value['name']) && $value['name'])
1274
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1313
+                if (isset($value['desc']) && $value['desc']) {
1314
+                                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1315
+                }
1316
+                if (isset($value['name']) && $value['name']) {
1317
+                                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1318
+                }
1275 1319
                 /**
1276 1320
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1277 1321
                  *
@@ -1279,7 +1323,9 @@  discard block
 block discarded – undo
1279 1323
                  *
1280 1324
                  * @since 1.0.0
1281 1325
                  */
1282
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1326
+                if (isset($value['id']) && $value['id']) {
1327
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1328
+                }
1283 1329
                 echo '<table class="form-table">' . "\n\n";
1284 1330
 
1285 1331
                 break;
@@ -1291,7 +1337,9 @@  discard block
 block discarded – undo
1291 1337
                  *
1292 1338
                  * @since 1.0.0
1293 1339
                  */
1294
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1340
+                if (isset($value['id']) && $value['id']) {
1341
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1342
+                }
1295 1343
                 echo '</table>';
1296 1344
                 /**
1297 1345
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -1300,7 +1348,9 @@  discard block
 block discarded – undo
1300 1348
                  *
1301 1349
                  * @since 1.0.0
1302 1350
                  */
1303
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1351
+                if (isset($value['id']) && $value['id']) {
1352
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1353
+                }
1304 1354
                 break;
1305 1355
             case 'text':
1306 1356
                 ?>
@@ -1372,17 +1422,32 @@  discard block
 block discarded – undo
1372 1422
                     <?php _e('Width', 'geodirectory'); ?> <input
1373 1423
                         name="<?php echo esc_attr($value['id']); ?>_width"
1374 1424
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1375
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1425
+                        value="<?php if ($size = get_option($value['id'] . '_width')) {
1426
+	echo stripslashes($size);
1427
+} else {
1428
+	echo $value['std'];
1429
+}
1430
+?>"/>
1376 1431
 
1377 1432
                     <?php _e('Height', 'geodirectory'); ?> <input
1378 1433
                         name="<?php echo esc_attr($value['id']); ?>_height"
1379 1434
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1380
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1435
+                        value="<?php if ($size = get_option($value['id'] . '_height')) {
1436
+	echo stripslashes($size);
1437
+} else {
1438
+	echo $value['std'];
1439
+}
1440
+?>"/>
1381 1441
 
1382 1442
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1383 1443
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1384 1444
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1385
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1445
+                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') {
1446
+	checked(get_option($value['id'] . '_crop'), 1);
1447
+} else {
1448
+	checked(1);
1449
+}
1450
+?> /></label>
1386 1451
 
1387 1452
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1388 1453
                 </tr><?php
@@ -1396,17 +1461,22 @@  discard block
 block discarded – undo
1396 1461
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
1397 1462
                                             id="<?php echo esc_attr($value['id']); ?>"
1398 1463
                                             style="<?php echo esc_attr($value['css']); ?>"
1399
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1464
+                                            class="<?php if (isset($value['class'])) {
1465
+	echo $value['class'];
1466
+}
1467
+?>"
1400 1468
                                             option-ajaxchosen="false">
1401 1469
                         <?php
1402 1470
                         foreach ($value['options'] as $key => $val) {
1403 1471
                             $geodir_select_value = '';
1404 1472
                             if ($option_value != '') {
1405
-                                if ($option_value != '' && $option_value == $key)
1406
-                                    $geodir_select_value = ' selected="selected" ';
1473
+                                if ($option_value != '' && $option_value == $key) {
1474
+                                                                    $geodir_select_value = ' selected="selected" ';
1475
+                                }
1407 1476
                             } else {
1408
-                                if ($value['std'] == $key)
1409
-                                    $geodir_select_value = ' selected="selected" ';
1477
+                                if ($value['std'] == $key) {
1478
+                                                                    $geodir_select_value = ' selected="selected" ';
1479
+                                }
1410 1480
                             }
1411 1481
                             ?>
1412 1482
                             <option
@@ -1431,8 +1501,14 @@  discard block
 block discarded – undo
1431 1501
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
1432 1502
                                             id="<?php echo esc_attr($value['id']); ?>"
1433 1503
                                             style="<?php echo esc_attr($value['css']); ?>"
1434
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1435
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1504
+                                            class="<?php if (isset($value['class'])) {
1505
+	echo $value['class'];
1506
+}
1507
+?>"
1508
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) {
1509
+	echo $value['placeholder_text'];
1510
+}
1511
+?>"
1436 1512
                                             option-ajaxchosen="false">
1437 1513
                         <?php
1438 1514
                         foreach ($value['options'] as $key => $val) {
@@ -1459,7 +1535,10 @@  discard block
 block discarded – undo
1459 1535
                 <td class="forminp">
1460 1536
                     <input type="file" name="<?php echo esc_attr($value['id']); ?>"
1461 1537
                            id="<?php echo esc_attr($value['id']); ?>" style="<?php echo esc_attr($value['css']); ?>"
1462
-                           class="<?php if (isset($value['class'])) echo $value['class']; ?>"/>
1538
+                           class="<?php if (isset($value['class'])) {
1539
+	echo $value['class'];
1540
+}
1541
+?>"/>
1463 1542
                     <?php if (get_option($value['id'])) { ?>
1464 1543
                         <input type="hidden" name="<?php echo esc_attr($value['id']); ?>_remove"
1465 1544
                                id="<?php echo esc_attr($value['id']); ?>_remove" value="0">
@@ -1540,13 +1619,15 @@  discard block
 block discarded – undo
1540 1619
                                 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1541 1620
                             );
1542 1621
                             $geodir_default_map_language = get_option('geodir_default_map_language');
1543
-                            if (empty($geodir_default_map_language))
1544
-                                $geodir_default_map_language = 'en';
1622
+                            if (empty($geodir_default_map_language)) {
1623
+                                                            $geodir_default_map_language = 'en';
1624
+                            }
1545 1625
                             foreach ($arr_map_langages as $language_key => $language_txt) {
1546
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1547
-                                    $geodir_default_language_selected = "selected='selected'";
1548
-                                else
1549
-                                    $geodir_default_language_selected = '';
1626
+                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) {
1627
+                                                                    $geodir_default_language_selected = "selected='selected'";
1628
+                                } else {
1629
+                                                                    $geodir_default_language_selected = '';
1630
+                                }
1550 1631
 
1551 1632
                                 ?>
1552 1633
                                 <option
@@ -1566,14 +1647,16 @@  discard block
 block discarded – undo
1566 1647
                             <?php
1567 1648
                             $post_types = geodir_get_posttypes('array');
1568 1649
                             $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1569
-                            if (empty($geodir_default_map_search_pt))
1570
-                                $geodir_default_map_search_pt = 'gd_place';
1650
+                            if (empty($geodir_default_map_search_pt)) {
1651
+                                                            $geodir_default_map_search_pt = 'gd_place';
1652
+                            }
1571 1653
                             if (is_array($post_types)) {
1572 1654
                                 foreach ($post_types as $key => $post_types_obj) {
1573
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1574
-                                        $geodir_search_pt_selected = "selected='selected'";
1575
-                                    else
1576
-                                        $geodir_search_pt_selected = '';
1655
+                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) {
1656
+                                                                            $geodir_search_pt_selected = "selected='selected'";
1657
+                                    } else {
1658
+                                                                            $geodir_search_pt_selected = '';
1659
+                                    }
1577 1660
 
1578 1661
                                     ?>
1579 1662
                                     <option
@@ -1693,7 +1776,7 @@  discard block
 block discarded – undo
1693 1776
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1694 1777
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1695 1778
                             echo 'checked="checked"';
1696
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1779
+                        } elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1697 1780
                         <?php echo $value['desc']; ?></label><br>
1698 1781
                 </fieldset>
1699 1782
                 <?php
@@ -1713,10 +1796,18 @@  discard block
 block discarded – undo
1713 1796
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1714 1797
                 <td class="forminp">
1715 1798
                     <textarea
1716
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1799
+                        <?php if (isset($value['args'])) {
1800
+	echo $value['args'] . ' ';
1801
+}
1802
+?>name="<?php echo esc_attr($value['id']); ?>"
1717 1803
                         id="<?php echo esc_attr($value['id']); ?>"
1718 1804
                         <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1719
-                        style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
1805
+                        style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) {
1806
+	echo esc_textarea(stripslashes(get_option($value['id'])));
1807
+} else {
1808
+	echo esc_textarea($value['std']);
1809
+}
1810
+?></textarea><span
1720 1811
                         class="description"><?php echo $value['desc'] ?></span>
1721 1812
 
1722 1813
                 </td>
@@ -1730,10 +1821,11 @@  discard block
 block discarded – undo
1730 1821
                 <td class="forminp"><?php
1731 1822
 
1732 1823
                     $content = '';
1733
-                    if (get_option($value['id']))
1734
-                        $content = stripslashes(get_option($value['id']));
1735
-                    else
1736
-                        $content = $value['std'];
1824
+                    if (get_option($value['id'])) {
1825
+                                            $content = stripslashes(get_option($value['id']));
1826
+                    } else {
1827
+                                            $content = $value['std'];
1828
+                    }
1737 1829
 
1738 1830
                     $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1739 1831
 
@@ -1773,7 +1865,9 @@  discard block
 block discarded – undo
1773 1865
                     'echo' => false,
1774 1866
                     'selected' => $page_setting);
1775 1867
 
1776
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1868
+                if (isset($value['args'])) {
1869
+                	$args = wp_parse_args($value['args'], $args);
1870
+                }
1777 1871
 
1778 1872
                 ?>
1779 1873
                 <tr valign="top" class="single_select_page">
@@ -1793,8 +1887,10 @@  discard block
 block discarded – undo
1793 1887
                 if (strstr($country_setting, ':')) :
1794 1888
                     $country = current(explode(':', $country_setting));
1795 1889
                     $state = end(explode(':', $country_setting));
1796
-                else :
1797
-                    $country = $country_setting;
1890
+                else {
1891
+                	:
1892
+                    $country = $country_setting;
1893
+                }
1798 1894
                     $state = '*';
1799 1895
                 endif;
1800 1896
                 ?>
@@ -1821,8 +1917,10 @@  discard block
 block discarded – undo
1821 1917
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1822 1918
                             title="Country" class="chosen_select">
1823 1919
                         <?php
1824
-                        if ($countries) foreach ($countries as $key => $val) :
1825
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1920
+                        if ($countries) {
1921
+                        	foreach ($countries as $key => $val) :
1922
+                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1923
+                        }
1826 1924
                         endforeach;
1827 1925
                         ?>
1828 1926
                     </select>
@@ -2073,8 +2171,9 @@  discard block
 block discarded – undo
2073 2171
         endforeach;
2074 2172
     endif;
2075 2173
 
2076
-    if (!empty($place_img_array))
2077
-        $curImages = implode(',', $place_img_array);
2174
+    if (!empty($place_img_array)) {
2175
+            $curImages = implode(',', $place_img_array);
2176
+    }
2078 2177
 
2079 2178
 
2080 2179
     // adjust values here
@@ -2421,16 +2520,17 @@  discard block
 block discarded – undo
2421 2520
 	
2422 2521
 	$post_type = NULL;
2423 2522
 	
2424
-	if ($post && isset($post->post_type))
2425
-		$post_type = $post->post_type;
2426
-	elseif ($typenow)
2427
-		$post_type = $typenow;
2428
-	elseif ($current_screen && isset($current_screen->post_type))
2429
-		$post_type = $current_screen->post_type;
2430
-	elseif (isset($_REQUEST['post_type']))
2431
-		$post_type = sanitize_key($_REQUEST['post_type']);
2432
-	elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2433
-		$post_type = get_post_type($_REQUEST['post']);
2523
+	if ($post && isset($post->post_type)) {
2524
+			$post_type = $post->post_type;
2525
+	} elseif ($typenow) {
2526
+			$post_type = $typenow;
2527
+	} elseif ($current_screen && isset($current_screen->post_type)) {
2528
+			$post_type = $current_screen->post_type;
2529
+	} elseif (isset($_REQUEST['post_type'])) {
2530
+			$post_type = sanitize_key($_REQUEST['post_type']);
2531
+	} elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) {
2532
+			$post_type = get_post_type($_REQUEST['post']);
2533
+	}
2434 2534
 
2435 2535
 	return $post_type;
2436 2536
 }
@@ -2489,9 +2589,10 @@  discard block
 block discarded – undo
2489 2589
 function geodir_hide_admin_preview_button() {
2490 2590
     global $post_type;
2491 2591
     $post_types = geodir_get_posttypes();
2492
-    if(in_array($post_type, $post_types))
2493
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2494
-}
2592
+    if(in_array($post_type, $post_types)) {
2593
+            echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2594
+    }
2595
+    }
2495 2596
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2496 2597
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2497 2598
 
@@ -5550,8 +5651,9 @@  discard block
 block discarded – undo
5550 5651
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5551 5652
 	global $wpdb, $plugin_prefix;
5552 5653
 
5553
-	if ( ! post_type_exists( $post_type ) )
5554
-		return new stdClass;
5654
+	if ( ! post_type_exists( $post_type ) ) {
5655
+			return new stdClass;
5656
+	}
5555 5657
 		
5556 5658
 	$table = $plugin_prefix . $post_type . '_detail';
5557 5659
 	
@@ -6329,7 +6431,9 @@  discard block
 block discarded – undo
6329 6431
 
6330 6432
     if ($page_found) :
6331 6433
         // Page exists
6332
-        if (!$option_value) update_option($option, $page_found);
6434
+        if (!$option_value) {
6435
+        	update_option($option, $page_found);
6436
+        }
6333 6437
         return;
6334 6438
     endif;
6335 6439
 
Please login to merge, or discard this patch.