Passed
Pull Request — master (#254)
by Kiran
10:38
created
geodirectory-admin/admin_functions.php 1 patch
Indentation   +2869 added lines, -2869 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,124 +32,124 @@  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('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
-        wp_enqueue_style('font-awesome');
89
+		wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
+		wp_enqueue_style('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
-    {
107
-        $geodir_map_name = geodir_map_name();
99
+	/**
100
+	 * Enqueue Admin Scripts.
101
+	 *
102
+	 * @since 1.0.0
103
+	 * @package GeoDirectory
104
+	 */
105
+	function geodir_admin_scripts()
106
+	{
107
+		$geodir_map_name = geodir_map_name();
108 108
         
109
-        wp_enqueue_script('jquery');
109
+		wp_enqueue_script('jquery');
110 110
 
111
-        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
+		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);
112 112
 
113
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
114
-        wp_enqueue_script('chosen');
113
+		wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
114
+		wp_enqueue_script('chosen');
115 115
 
116
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
117
-        wp_enqueue_script('geodirectory-choose-ajax');
116
+		wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
117
+		wp_enqueue_script('geodirectory-choose-ajax');
118 118
 
119
-        if (isset($_REQUEST['listing_type'])) {
120
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
121
-        }
119
+		if (isset($_REQUEST['listing_type'])) {
120
+			wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
121
+		}
122 122
 
123
-        wp_enqueue_script('geodirectory-custom-fields-script');
124
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
123
+		wp_enqueue_script('geodirectory-custom-fields-script');
124
+		$plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
125 125
 
126
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
126
+		wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
127 127
 
128
-        if (in_array($geodir_map_name, array('auto', 'google'))) {
129
-            $map_lang = "&language=" . geodir_get_map_default_language();
130
-            /** This filter is documented in geodirectory_template_tags.php */
131
-            $map_extra = apply_filters('geodir_googlemap_script_extra', '');
132
-            wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
133
-        }
128
+		if (in_array($geodir_map_name, array('auto', 'google'))) {
129
+			$map_lang = "&language=" . geodir_get_map_default_language();
130
+			/** This filter is documented in geodirectory_template_tags.php */
131
+			$map_extra = apply_filters('geodir_googlemap_script_extra', '');
132
+			wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
133
+		}
134 134
         
135
-        if ($geodir_map_name == 'osm') {
136
-            // Leaflet OpenStreetMap
137
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
138
-            wp_enqueue_style('geodirectory-leaflet-style');
135
+		if ($geodir_map_name == 'osm') {
136
+			// Leaflet OpenStreetMap
137
+			wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
138
+			wp_enqueue_style('geodirectory-leaflet-style');
139 139
                 
140
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
141
-            wp_enqueue_script('geodirectory-leaflet-script');
140
+			wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
141
+			wp_enqueue_script('geodirectory-leaflet-script');
142 142
             
143
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
144
-            wp_enqueue_script('geodirectory-leaflet-geo-script');
145
-        }
146
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
143
+			wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
144
+			wp_enqueue_script('geodirectory-leaflet-geo-script');
145
+		}
146
+		wp_enqueue_script( 'jquery-ui-autocomplete' );
147 147
         
148
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
149
-        wp_enqueue_script('geodirectory-goMap-script');
148
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
149
+		wp_enqueue_script('geodirectory-goMap-script');
150 150
 
151
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
152
-        wp_enqueue_script('geodirectory-goMap-script');
151
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
152
+		wp_enqueue_script('geodirectory-goMap-script');
153 153
 
154 154
 		// font awesome rating script
155 155
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
@@ -160,167 +160,167 @@  discard block
 block discarded – undo
160 160
 			wp_enqueue_script('geodir-jRating-js');
161 161
 		}
162 162
 
163
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
164
-        wp_enqueue_script('geodir-on-document-load');
165
-
166
-
167
-        // SCRIPT FOR UPLOAD
168
-        wp_enqueue_script('plupload-all');
169
-        wp_enqueue_script('jquery-ui-sortable');
170
-
171
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
172
-        wp_enqueue_script('geodirectory-plupload-script');
173
-
174
-        // SCRIPT FOR UPLOAD END
175
-
176
-
177
-        // place js config array for plupload
178
-        $plupload_init = array(
179
-            'runtimes' => 'html5,silverlight,flash,html4',
180
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
181
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
182
-            'drop_element' => 'dropbox', // will be adjusted per uploader
183
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
184
-            'multiple_queues' => true,
185
-            'max_file_size' => geodir_max_upload_size(),
186
-            'url' => admin_url('admin-ajax.php'),
187
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
188
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
189
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
190
-            'multipart' => true,
191
-            'urlstream_upload' => true,
192
-            'multi_selection' => false, // will be added per uploader
193
-            // additional post data to send to our ajax hook
194
-            'multipart_params' => array(
195
-                '_ajax_nonce' => "", // will be added per uploader
196
-                'action' => 'plupload_action', // the ajax action name
197
-                'imgid' => 0 // will be added per uploader
198
-            )
199
-        );
200
-        $base_plupload_config = json_encode($plupload_init);
201
-
202
-
203
-        $thumb_img_arr = array();
204
-
205
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
206
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
207
-
208
-        $totImg = '';
209
-        $image_limit = '';
210
-        if (!empty($thumb_img_arr)) {
211
-            $totImg = count($thumb_img_arr);
212
-        }
163
+		wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
164
+		wp_enqueue_script('geodir-on-document-load');
165
+
166
+
167
+		// SCRIPT FOR UPLOAD
168
+		wp_enqueue_script('plupload-all');
169
+		wp_enqueue_script('jquery-ui-sortable');
170
+
171
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
172
+		wp_enqueue_script('geodirectory-plupload-script');
173
+
174
+		// SCRIPT FOR UPLOAD END
175
+
176
+
177
+		// place js config array for plupload
178
+		$plupload_init = array(
179
+			'runtimes' => 'html5,silverlight,flash,html4',
180
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
181
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
182
+			'drop_element' => 'dropbox', // will be adjusted per uploader
183
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
184
+			'multiple_queues' => true,
185
+			'max_file_size' => geodir_max_upload_size(),
186
+			'url' => admin_url('admin-ajax.php'),
187
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
188
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
189
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
190
+			'multipart' => true,
191
+			'urlstream_upload' => true,
192
+			'multi_selection' => false, // will be added per uploader
193
+			// additional post data to send to our ajax hook
194
+			'multipart_params' => array(
195
+				'_ajax_nonce' => "", // will be added per uploader
196
+				'action' => 'plupload_action', // the ajax action name
197
+				'imgid' => 0 // will be added per uploader
198
+			)
199
+		);
200
+		$base_plupload_config = json_encode($plupload_init);
201
+
202
+
203
+		$thumb_img_arr = array();
204
+
205
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
206
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
207
+
208
+		$totImg = '';
209
+		$image_limit = '';
210
+		if (!empty($thumb_img_arr)) {
211
+			$totImg = count($thumb_img_arr);
212
+		}
213 213
 
214
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
215
-            'totalImg' => $totImg,
216
-            'image_limit' => $image_limit,
217
-            'upload_img_size' => geodir_max_upload_size());
214
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
215
+			'totalImg' => $totImg,
216
+			'image_limit' => $image_limit,
217
+			'upload_img_size' => geodir_max_upload_size());
218 218
 
219
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
219
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
220 220
 
221
-        $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
222
-        wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
221
+		$ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
222
+		wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
223 223
 
224 224
 
225
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
226
-        wp_enqueue_script('geodirectory-admin-script');
225
+		wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
226
+		wp_enqueue_script('geodirectory-admin-script');
227 227
 
228
-        wp_enqueue_style('farbtastic');
229
-        wp_enqueue_script('farbtastic');
228
+		wp_enqueue_style('farbtastic');
229
+		wp_enqueue_script('farbtastic');
230 230
 
231
-        $screen = get_current_screen();
232
-        if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
233
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
234
-        }
231
+		$screen = get_current_screen();
232
+		if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
233
+			wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
234
+		}
235 235
 
236
-        $ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
237
-        wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
236
+		$ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
237
+		wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
238 238
 
239
-    }
239
+	}
240 240
 }
241 241
 
242 242
 if (!function_exists('geodir_admin_menu')) {
243
-    /**
244
-     * Admin Menus
245
-     *
246
-     * Sets up the admin menus in wordpress.
247
-     *
248
-     * @since 1.0.0
249
-     * @package GeoDirectory
250
-     * @global array $menu Menu array.
251
-     * @global object $geodirectory GeoDirectory plugin object.
252
-     */
253
-    function geodir_admin_menu()
254
-    {
255
-        global $menu, $geodirectory;
243
+	/**
244
+	 * Admin Menus
245
+	 *
246
+	 * Sets up the admin menus in wordpress.
247
+	 *
248
+	 * @since 1.0.0
249
+	 * @package GeoDirectory
250
+	 * @global array $menu Menu array.
251
+	 * @global object $geodirectory GeoDirectory plugin object.
252
+	 */
253
+	function geodir_admin_menu()
254
+	{
255
+		global $menu, $geodirectory;
256 256
 
257
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
257
+		if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
258 258
 
259
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
259
+		add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
260 260
 
261 261
 
262
-    }
262
+	}
263 263
 }
264 264
 
265 265
 if (!function_exists('geodir_admin_menu_order')) {
266
-    /**
267
-     * Order admin menus.
268
-     *
269
-     * @since 1.0.0
270
-     * @package GeoDirectory
271
-     * @param array $menu_order Menu order array.
272
-     * @return array Modified menu order array.
273
-     */
274
-    function geodir_admin_menu_order($menu_order)
275
-    {
276
-
277
-        // Initialize our custom order array
278
-        $geodir_menu_order = array();
279
-
280
-        // Get the index of our custom separator
281
-        $geodir_separator = array_search('separator-geodirectory', $menu_order);
282
-
283
-        // Get index of posttype menu
284
-        $post_types = geodir_get_posttypes();
285
-
286
-        // Loop through menu order and do some rearranging
287
-        foreach ($menu_order as $index => $item) :
288
-
289
-            if ((('geodirectory') == $item)) :
290
-                $geodir_menu_order[] = 'separator-geodirectory';
291
-                if (!empty($post_types)) {
292
-                    foreach ($post_types as $post_type) {
293
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
294
-                    }
295
-                }
296
-                $geodir_menu_order[] = $item;
266
+	/**
267
+	 * Order admin menus.
268
+	 *
269
+	 * @since 1.0.0
270
+	 * @package GeoDirectory
271
+	 * @param array $menu_order Menu order array.
272
+	 * @return array Modified menu order array.
273
+	 */
274
+	function geodir_admin_menu_order($menu_order)
275
+	{
297 276
 
298
-                unset($menu_order[$geodir_separator]);
299
-            //unset( $menu_order[$geodir_places] );
300
-            elseif (!in_array($item, array('separator-geodirectory'))) :
301
-                $geodir_menu_order[] = $item;
302
-            endif;
277
+		// Initialize our custom order array
278
+		$geodir_menu_order = array();
303 279
 
304
-        endforeach;
280
+		// Get the index of our custom separator
281
+		$geodir_separator = array_search('separator-geodirectory', $menu_order);
305 282
 
306
-        // Return order
307
-        return $geodir_menu_order;
308
-    }
283
+		// Get index of posttype menu
284
+		$post_types = geodir_get_posttypes();
285
+
286
+		// Loop through menu order and do some rearranging
287
+		foreach ($menu_order as $index => $item) :
288
+
289
+			if ((('geodirectory') == $item)) :
290
+				$geodir_menu_order[] = 'separator-geodirectory';
291
+				if (!empty($post_types)) {
292
+					foreach ($post_types as $post_type) {
293
+						$geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
294
+					}
295
+				}
296
+				$geodir_menu_order[] = $item;
297
+
298
+				unset($menu_order[$geodir_separator]);
299
+			//unset( $menu_order[$geodir_places] );
300
+			elseif (!in_array($item, array('separator-geodirectory'))) :
301
+				$geodir_menu_order[] = $item;
302
+			endif;
303
+
304
+		endforeach;
305
+
306
+		// Return order
307
+		return $geodir_menu_order;
308
+	}
309 309
 }
310 310
 
311 311
 if (!function_exists('geodir_admin_custom_menu_order')) {
312
-    /**
313
-     * Enables custom menu order.
314
-     *
315
-     * @since 1.0.0
316
-     * @package GeoDirectory
317
-     * @return bool
318
-     */
319
-    function geodir_admin_custom_menu_order()
320
-    {
321
-        if (!current_user_can('manage_options')) return false;
322
-        return true;
323
-    }
312
+	/**
313
+	 * Enables custom menu order.
314
+	 *
315
+	 * @since 1.0.0
316
+	 * @package GeoDirectory
317
+	 * @return bool
318
+	 */
319
+	function geodir_admin_custom_menu_order()
320
+	{
321
+		if (!current_user_can('manage_options')) return false;
322
+		return true;
323
+	}
324 324
 }
325 325
 
326 326
 /**
@@ -331,41 +331,41 @@  discard block
 block discarded – undo
331 331
  */
332 332
 function geodir_before_admin_panel()
333 333
 {
334
-    if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
335
-        echo '<div id="message" class="updated fade">
334
+	if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
335
+		echo '<div id="message" class="updated fade">
336 336
                         <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>
337 337
                         <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
338 338
                 </div>';
339 339
 
340
-    }
340
+	}
341 341
 
342
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
343
-        switch ($_REQUEST['msg']) {
344
-            case 'success':
345
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
346
-                flush_rewrite_rules(false);
342
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
343
+		switch ($_REQUEST['msg']) {
344
+			case 'success':
345
+				echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
346
+				flush_rewrite_rules(false);
347 347
 
348
-                break;
348
+				break;
349 349
 			case 'fail':
350 350
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
351 351
 				
352 352
 				if ($gderr == 21)
353
-			    	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>';
353
+					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>';
354 354
 				else
355 355
 					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
356
-                break;
357
-        }
358
-    }
356
+				break;
357
+		}
358
+	}
359 359
 
360
-    if (!geodir_is_default_location_set()) {
361
-        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>';
360
+	if (!geodir_is_default_location_set()) {
361
+		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>';
362 362
 
363
-    }
363
+	}
364 364
 
365
-    if (!function_exists('curl_init')) {
366
-        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>';
365
+	if (!function_exists('curl_init')) {
366
+		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>';
367 367
 
368
-    }
368
+	}
369 369
 }
370 370
 
371 371
 /**
@@ -378,19 +378,19 @@  discard block
 block discarded – undo
378 378
  */
379 379
 function geodir_handle_option_form_submit($current_tab)
380 380
 {
381
-    global $geodir_settings;
382
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
383
-        /**
384
-         * Contains settings array for current tab.
385
-         *
386
-         * @since 1.0.0
387
-         * @package GeoDirectory
388
-         */
389
-        include_once('option-pages/' . $current_tab . '_array.php');
390
-    }
391
-    if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
392
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
393
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
381
+	global $geodir_settings;
382
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
383
+		/**
384
+		 * Contains settings array for current tab.
385
+		 *
386
+		 * @since 1.0.0
387
+		 * @package GeoDirectory
388
+		 */
389
+		include_once('option-pages/' . $current_tab . '_array.php');
390
+	}
391
+	if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
392
+		if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
393
+		if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
394 394
 		
395 395
 		/**
396 396
 		 * Fires before updating geodirectory admin settings.
@@ -402,98 +402,98 @@  discard block
 block discarded – undo
402 402
 		 */
403 403
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
404 404
 		
405
-        if (!empty($geodir_settings[$current_tab]))
406
-            geodir_update_options($geodir_settings[$current_tab]);
405
+		if (!empty($geodir_settings[$current_tab]))
406
+			geodir_update_options($geodir_settings[$current_tab]);
407 407
 
408
-        /**
409
-         * Called after GeoDirectory options settings are updated.
410
-         *
411
-         * @since 1.0.0
412
-         * @param array $geodir_settings The array of GeoDirectory settings.
413
-         * @see 'geodir_before_update_options'
414
-         */
415
-        do_action('geodir_update_options', $geodir_settings);
408
+		/**
409
+		 * Called after GeoDirectory options settings are updated.
410
+		 *
411
+		 * @since 1.0.0
412
+		 * @param array $geodir_settings The array of GeoDirectory settings.
413
+		 * @see 'geodir_before_update_options'
414
+		 */
415
+		do_action('geodir_update_options', $geodir_settings);
416 416
 
417
-        /**
418
-         * Called after GeoDirectory options settings are updated.
419
-         *
420
-         * Provides tab specific settings.
421
-         *
422
-         * @since 1.0.0
423
-         * @param string $current_tab The current settings tab name.
424
-         * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
425
-         */
426
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
417
+		/**
418
+		 * Called after GeoDirectory options settings are updated.
419
+		 *
420
+		 * Provides tab specific settings.
421
+		 *
422
+		 * @since 1.0.0
423
+		 * @param string $current_tab The current settings tab name.
424
+		 * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
425
+		 */
426
+		do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
427 427
 
428
-        flush_rewrite_rules(false);
428
+		flush_rewrite_rules(false);
429 429
 
430
-        $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
430
+		$current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
431 431
 
432
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
432
+		$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
433 433
 
434
-        wp_redirect($redirect_url);
435
-        exit();
436
-    endif;
434
+		wp_redirect($redirect_url);
435
+		exit();
436
+	endif;
437 437
 
438 438
 
439 439
 }
440 440
 
441 441
 
442 442
 if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
443
-    /**
444
-     * GeoDirectory dummy data installation.
445
-     *
446
-     * @since 1.0.0
447
-     * @package GeoDirectory
448
-     * @global object $wpdb WordPress Database object.
449
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
450
-     * @param string $post_type The post type.
451
-     */
452
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
453
-    {
443
+	/**
444
+	 * GeoDirectory dummy data installation.
445
+	 *
446
+	 * @since 1.0.0
447
+	 * @package GeoDirectory
448
+	 * @global object $wpdb WordPress Database object.
449
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
450
+	 * @param string $post_type The post type.
451
+	 */
452
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
453
+	{
454 454
 
455
-        global $wpdb, $plugin_prefix;
455
+		global $wpdb, $plugin_prefix;
456 456
 
457
-        if (!geodir_is_default_location_set()) {
458
-            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>';
459
-        } else {
457
+		if (!geodir_is_default_location_set()) {
458
+			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>';
459
+		} else {
460 460
 
461
-            $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
461
+			$geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
462 462
 
463
-            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
463
+			$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
464 464
 
465
-            if ($post_counts > 0) {
466
-                $nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
465
+			if ($post_counts > 0) {
466
+				$nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
467 467
 
468
-                $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>';
469
-                $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>';
470
-            } else {
471
-                $options_list = '';
472
-                for ($option = 1; $option <= 30; $option++) {
473
-                    $selected = '';
474
-                    if ($option == 10)
475
-                        $selected = 'selected="selected"';
468
+				$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>';
469
+				$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>';
470
+			} else {
471
+				$options_list = '';
472
+				for ($option = 1; $option <= 30; $option++) {
473
+					$selected = '';
474
+					if ($option == 10)
475
+						$selected = 'selected="selected"';
476 476
 
477
-                    $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
478
-                }
477
+					$options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
478
+				}
479 479
 
480
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
480
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
481 481
 
482
-                $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>';
483
-                $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>';
482
+				$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>';
483
+				$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>';
484 484
 
485
-            }
486
-            echo $dummy_msg;
487
-            ?>
485
+			}
486
+			echo $dummy_msg;
487
+			?>
488 488
             <script>
489 489
                 <?php
490
-                  $default_location = geodir_get_default_location();
491
-                  $city =  isset($default_location->city) ? $default_location->city : '';
492
-                  $region =isset($default_location->region) ? $default_location->region : '';
493
-                  $country =isset($default_location->country) ? $default_location->country : '';
494
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
495
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
496
-                ?>
490
+				  $default_location = geodir_get_default_location();
491
+				  $city =  isset($default_location->city) ? $default_location->city : '';
492
+				  $region =isset($default_location->region) ? $default_location->region : '';
493
+				  $country =isset($default_location->country) ? $default_location->country : '';
494
+				  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
495
+				  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
496
+				?>
497 497
                 var geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
498 498
                 var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
499 499
                 var bound_lat_lng;
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
                 }
585 585
             </script>
586 586
         <?php
587
-        }
588
-    }
587
+		}
588
+	}
589 589
 }
590 590
 
591 591
 /**
@@ -598,20 +598,20 @@  discard block
 block discarded – undo
598 598
  */
599 599
 function geodir_insert_dummy_posts()
600 600
 {
601
-    geodir_default_taxonomies();
601
+	geodir_default_taxonomies();
602 602
 
603
-    ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
603
+	ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
604 604
 
605
-    global $wpdb, $current_user;
605
+	global $wpdb, $current_user;
606 606
 
607
-    /**
608
-     * Contains dummy post content.
609
-     *
610
-     * @since 1.0.0
611
-     * @package GeoDirectory
612
-     */
613
-    include_once('place_dummy_post.php');
614
-    delete_transient( 'cached_dummy_images' );
607
+	/**
608
+	 * Contains dummy post content.
609
+	 *
610
+	 * @since 1.0.0
611
+	 * @package GeoDirectory
612
+	 */
613
+	include_once('place_dummy_post.php');
614
+	delete_transient( 'cached_dummy_images' );
615 615
 
616 616
 }
617 617
 
@@ -625,18 +625,18 @@  discard block
 block discarded – undo
625 625
  */
626 626
 function geodir_delete_dummy_posts()
627 627
 {
628
-    global $wpdb, $plugin_prefix;
628
+	global $wpdb, $plugin_prefix;
629 629
 
630 630
 
631
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
631
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
632 632
 
633 633
 
634
-    foreach ($post_ids as $post_ids_obj) {
635
-        wp_delete_post($post_ids_obj->post_id);
636
-    }
634
+	foreach ($post_ids as $post_ids_obj) {
635
+		wp_delete_post($post_ids_obj->post_id);
636
+	}
637 637
 
638
-    //double check posts are deleted
639
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
638
+	//double check posts are deleted
639
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
640 640
 }
641 641
 
642 642
 /**
@@ -650,114 +650,114 @@  discard block
 block discarded – undo
650 650
  * @global string $dummy_image_path The dummy image path.
651 651
  */
652 652
 function geodir_default_taxonomies() {
653
-    global $wpdb, $dummy_image_path;
653
+	global $wpdb, $dummy_image_path;
654 654
 
655
-    $category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
655
+	$category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
656 656
 
657
-    $last_catid = '';
657
+	$last_catid = '';
658 658
 
659
-    $uploads = wp_upload_dir(); // Array of key => value pairs
659
+	$uploads = wp_upload_dir(); // Array of key => value pairs
660 660
 
661
-    for ($i = 0; $i < count($category_array); $i++) {
662
-        $parent_catid = 0;
663
-        if (is_array($category_array[$i])) {
664
-            $cat_name_arr = $category_array[$i];
665
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
666
-                $catname = $cat_name_arr[$j];
661
+	for ($i = 0; $i < count($category_array); $i++) {
662
+		$parent_catid = 0;
663
+		if (is_array($category_array[$i])) {
664
+			$cat_name_arr = $category_array[$i];
665
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
666
+				$catname = $cat_name_arr[$j];
667 667
 
668
-                if (!term_exists($catname, 'gd_placecategory')) {
669
-                    $last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
668
+				if (!term_exists($catname, 'gd_placecategory')) {
669
+					$last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
670 670
 
671
-                    if ($j == 0) {
672
-                        $parent_catid = $last_catid;
673
-                    }
671
+					if ($j == 0) {
672
+						$parent_catid = $last_catid;
673
+					}
674 674
 
675 675
 
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';
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 680
 
681
-                    $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
681
+					$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
682 682
 
683
-                    $catname = str_replace(' ', '_', $catname);
684
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
683
+					$catname = str_replace(' ', '_', $catname);
684
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
685 685
 
686
-                    if (empty($uploaded['error'])) {
687
-                        $new_path = $uploaded['file'];
688
-                        $new_url = $uploaded['url'];
689
-                    }
686
+					if (empty($uploaded['error'])) {
687
+						$new_path = $uploaded['file'];
688
+						$new_url = $uploaded['url'];
689
+					}
690 690
 
691
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
692
-
693
-                    $attachment = array(
694
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
695
-                        'post_mime_type' => $wp_filetype['type'],
696
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
697
-                        'post_content' => '',
698
-                        'post_status' => 'inherit'
699
-                    );
700
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
701
-
702
-                    // you must first include the image.php file
703
-                    // for the function wp_generate_attachment_metadata() to work
704
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
705
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
706
-                    wp_update_attachment_metadata($attach_id, $attach_data);
707
-
708
-                    if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
709
-                        update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
710
-                    }
711
-                }
712
-            }
691
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
692
+
693
+					$attachment = array(
694
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
695
+						'post_mime_type' => $wp_filetype['type'],
696
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
697
+						'post_content' => '',
698
+						'post_status' => 'inherit'
699
+					);
700
+					$attach_id = wp_insert_attachment($attachment, $new_path);
701
+
702
+					// you must first include the image.php file
703
+					// for the function wp_generate_attachment_metadata() to work
704
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
705
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
706
+					wp_update_attachment_metadata($attach_id, $attach_data);
707
+
708
+					if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
709
+						update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
710
+					}
711
+				}
712
+			}
713 713
 
714
-        } else {
715
-            $catname = $category_array[$i];
714
+		} else {
715
+			$catname = $category_array[$i];
716 716
 
717
-            if (!term_exists($catname, 'gd_placecategory')) {
718
-                $last_catid = wp_insert_term($catname, 'gd_placecategory');
717
+			if (!term_exists($catname, 'gd_placecategory')) {
718
+				$last_catid = wp_insert_term($catname, 'gd_placecategory');
719 719
 
720
-                if (geodir_dummy_folder_exists())
721
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
722
-                else
723
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
720
+				if (geodir_dummy_folder_exists())
721
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
722
+				else
723
+					$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
724 724
 
725
-                $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
725
+				$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
726 726
 
727
-                $catname = str_replace(' ', '_', $catname);
728
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
727
+				$catname = str_replace(' ', '_', $catname);
728
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
729 729
 
730
-                if (empty($uploaded['error'])) {
731
-                    $new_path = $uploaded['file'];
732
-                    $new_url = $uploaded['url'];
733
-                }
730
+				if (empty($uploaded['error'])) {
731
+					$new_path = $uploaded['file'];
732
+					$new_url = $uploaded['url'];
733
+				}
734 734
 
735
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
735
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
736 736
 
737
-                $attachment = array(
738
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
739
-                    'post_mime_type' => $wp_filetype['type'],
740
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
741
-                    'post_content' => '',
742
-                    'post_status' => 'inherit'
743
-                );
737
+				$attachment = array(
738
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
739
+					'post_mime_type' => $wp_filetype['type'],
740
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
741
+					'post_content' => '',
742
+					'post_status' => 'inherit'
743
+				);
744 744
 
745
-                $attach_id = wp_insert_attachment($attachment, $new_path);
745
+				$attach_id = wp_insert_attachment($attachment, $new_path);
746 746
 
747 747
 
748
-                // you must first include the image.php file
749
-                // for the function wp_generate_attachment_metadata() to work
750
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
751
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
752
-                wp_update_attachment_metadata($attach_id, $attach_data);
748
+				// you must first include the image.php file
749
+				// for the function wp_generate_attachment_metadata() to work
750
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
751
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
752
+				wp_update_attachment_metadata($attach_id, $attach_data);
753 753
 
754
-                if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
755
-                    update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
756
-                }
757
-            }
758
-        }
754
+				if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
755
+					update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
756
+				}
757
+			}
758
+		}
759 759
 
760
-    }
760
+	}
761 761
 }
762 762
 
763 763
 /**
@@ -772,144 +772,144 @@  discard block
 block discarded – undo
772 772
  * @return bool Returns true if saved.
773 773
  */
774 774
 function geodir_update_options($options, $dummy = false) {
775
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
775
+	if ((!isset($_POST) || !$_POST) && !$dummy) return false;
776 776
 
777
-    foreach ($options as $value) {
778
-        if ($dummy && isset($value['std']))
779
-            $_POST[$value['id']] = $value['std'];
777
+	foreach ($options as $value) {
778
+		if ($dummy && isset($value['std']))
779
+			$_POST[$value['id']] = $value['std'];
780 780
 
781 781
 
782
-        if (isset($value['type']) && $value['type'] == 'checkbox') :
782
+		if (isset($value['type']) && $value['type'] == 'checkbox') :
783 783
 
784
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
785
-                update_option($value['id'], $_POST[$value['id']]);
786
-            } else {
787
-                update_option($value['id'], 0);
788
-            }
784
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
785
+				update_option($value['id'], $_POST[$value['id']]);
786
+			} else {
787
+				update_option($value['id'], 0);
788
+			}
789 789
 
790
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
790
+		elseif (isset($value['type']) && $value['type'] == 'image_width') :
791 791
 
792
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
793
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
794
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
795
-                if (isset($_POST[$value['id'] . '_crop'])) :
796
-                    update_option($value['id'] . '_crop', 1);
797
-                else :
798
-                    update_option($value['id'] . '_crop', 0);
799
-                endif;
800
-            } else {
801
-                update_option($value['id'] . '_width', $value['std']);
802
-                update_option($value['id'] . '_height', $value['std']);
803
-                update_option($value['id'] . '_crop', 1);
804
-            }
792
+			if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
793
+				update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
794
+				update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
795
+				if (isset($_POST[$value['id'] . '_crop'])) :
796
+					update_option($value['id'] . '_crop', 1);
797
+				else :
798
+					update_option($value['id'] . '_crop', 0);
799
+				endif;
800
+			} else {
801
+				update_option($value['id'] . '_width', $value['std']);
802
+				update_option($value['id'] . '_height', $value['std']);
803
+				update_option($value['id'] . '_crop', 1);
804
+			}
805 805
 
806
-        elseif (isset($value['type']) && $value['type'] == 'map') :
807
-            $post_types = array();
808
-            $categories = array();
806
+		elseif (isset($value['type']) && $value['type'] == 'map') :
807
+			$post_types = array();
808
+			$categories = array();
809 809
 
810
-            if (!empty($_POST['home_map_post_types'])) :
811
-                foreach ($_POST['home_map_post_types'] as $post_type) :
812
-                    $post_types[] = $post_type;
813
-                endforeach;
814
-            endif;
810
+			if (!empty($_POST['home_map_post_types'])) :
811
+				foreach ($_POST['home_map_post_types'] as $post_type) :
812
+					$post_types[] = $post_type;
813
+				endforeach;
814
+			endif;
815 815
 
816
-            update_option('geodir_exclude_post_type_on_map', $post_types);
816
+			update_option('geodir_exclude_post_type_on_map', $post_types);
817 817
 
818
-            if (!empty($_POST['post_category'])) :
819
-                foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
820
-                    $categories[$texonomy] = array();
821
-                    foreach ($cat_arr as $category) :
822
-                        $categories[$texonomy][] = $category;
823
-                    endforeach;
824
-                    $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
825
-                endforeach;
826
-            endif;
827
-            update_option('geodir_exclude_cat_on_map', $categories);
828
-            update_option('geodir_exclude_cat_on_map_upgrade', 1);
829
-        elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
818
+			if (!empty($_POST['post_category'])) :
819
+				foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
820
+					$categories[$texonomy] = array();
821
+					foreach ($cat_arr as $category) :
822
+						$categories[$texonomy][] = $category;
823
+					endforeach;
824
+					$categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
825
+				endforeach;
826
+			endif;
827
+			update_option('geodir_exclude_cat_on_map', $categories);
828
+			update_option('geodir_exclude_cat_on_map_upgrade', 1);
829
+		elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
830 830
 
831 831
 
832
-            if (!empty($_POST['geodir_default_map_language'])):
833
-                update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
834
-            endif;
832
+			if (!empty($_POST['geodir_default_map_language'])):
833
+				update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
834
+			endif;
835 835
 
836 836
 
837
-            if (!empty($_POST['geodir_default_map_search_pt'])):
838
-                update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
839
-            endif;
837
+			if (!empty($_POST['geodir_default_map_search_pt'])):
838
+				update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
839
+			endif;
840 840
 
841 841
 
842
-        elseif (isset($value['type']) && $value['type'] == 'file') :
842
+		elseif (isset($value['type']) && $value['type'] == 'file') :
843 843
 
844 844
 
845
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
845
+			if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
846 846
 
847
-                if (get_option($value['id'])) {
848
-                    $image_name_arr = explode('/', get_option($value['id']));
849
-                    $noimg_name = end($image_name_arr);
850
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
851
-                    if (file_exists($img_path))
852
-                        unlink($img_path);
853
-                }
847
+				if (get_option($value['id'])) {
848
+					$image_name_arr = explode('/', get_option($value['id']));
849
+					$noimg_name = end($image_name_arr);
850
+					$img_path = $uploads['path'] . '/' . $noimg_name;
851
+					if (file_exists($img_path))
852
+						unlink($img_path);
853
+				}
854 854
 
855
-                update_option($value['id'], '');
856
-            }
855
+				update_option($value['id'], '');
856
+			}
857 857
 
858
-            $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
859
-            $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
860
-
861
-            if (!empty($filename)):
862
-                $ext = pathinfo($filename, PATHINFO_EXTENSION);
863
-                $uplaods = array();
864
-
865
-                foreach ($uploadedfile as $key => $uplaod):
866
-                    if ($key == 'name'):
867
-                        $uplaods[$key] = $filename;
868
-                    else :
869
-                        $uplaods[$key] = $uplaod;
870
-                    endif;
871
-                endforeach;
872
-
873
-                $uploads = wp_upload_dir();
874
-
875
-                if (get_option($value['id'])) {
876
-                    $image_name_arr = explode('/', get_option($value['id']));
877
-                    $noimg_name = end($image_name_arr);
878
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
879
-                    if (file_exists($img_path))
880
-                        unlink($img_path);
881
-                }
858
+			$uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
859
+			$filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
860
+
861
+			if (!empty($filename)):
862
+				$ext = pathinfo($filename, PATHINFO_EXTENSION);
863
+				$uplaods = array();
864
+
865
+				foreach ($uploadedfile as $key => $uplaod):
866
+					if ($key == 'name'):
867
+						$uplaods[$key] = $filename;
868
+					else :
869
+						$uplaods[$key] = $uplaod;
870
+					endif;
871
+				endforeach;
872
+
873
+				$uploads = wp_upload_dir();
874
+
875
+				if (get_option($value['id'])) {
876
+					$image_name_arr = explode('/', get_option($value['id']));
877
+					$noimg_name = end($image_name_arr);
878
+					$img_path = $uploads['path'] . '/' . $noimg_name;
879
+					if (file_exists($img_path))
880
+						unlink($img_path);
881
+				}
882 882
 
883
-                $upload_overrides = array('test_form' => false);
884
-                $movefile = wp_handle_upload($uplaods, $upload_overrides);
883
+				$upload_overrides = array('test_form' => false);
884
+				$movefile = wp_handle_upload($uplaods, $upload_overrides);
885 885
 
886
-                update_option($value['id'], $movefile['url']);
886
+				update_option($value['id'], $movefile['url']);
887 887
 
888
-            endif;
888
+			endif;
889 889
 
890
-            if (!get_option($value['id']) && isset($value['value'])):
891
-                update_option($value['id'], $value['value']);
892
-            endif;
890
+			if (!get_option($value['id']) && isset($value['value'])):
891
+				update_option($value['id'], $value['value']);
892
+			endif;
893 893
 
894 894
 
895
-        else :
896
-            // same menu setting per theme.
897
-            if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
898
-                $theme = wp_get_theme();
899
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
900
-            }
895
+		else :
896
+			// same menu setting per theme.
897
+			if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
898
+				$theme = wp_get_theme();
899
+				update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
900
+			}
901 901
 
902
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
903
-                update_option($value['id'], $_POST[$value['id']]);
904
-            } else {
905
-                delete_option($value['id']);
906
-            }
902
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
903
+				update_option($value['id'], $_POST[$value['id']]);
904
+			} else {
905
+				delete_option($value['id']);
906
+			}
907 907
 
908
-        endif;
909
-    }
910
-    if ($dummy)
911
-        $_POST = array();
912
-    return true;
908
+		endif;
909
+	}
910
+	if ($dummy)
911
+		$_POST = array();
912
+	return true;
913 913
 
914 914
 }
915 915
 
@@ -958,33 +958,33 @@  discard block
 block discarded – undo
958 958
 function places_custom_fields_tab($tabs)
959 959
 {
960 960
 
961
-    $geodir_post_types = get_option('geodir_post_types');
961
+	$geodir_post_types = get_option('geodir_post_types');
962 962
 
963
-    if (!empty($geodir_post_types)) {
963
+	if (!empty($geodir_post_types)) {
964 964
 
965
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
965
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
966 966
 
967
-            $listing_slug = $geodir_posttype_info['labels']['singular_name'];
967
+			$listing_slug = $geodir_posttype_info['labels']['singular_name'];
968 968
 
969
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
970
-                'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
971
-                'subtabs' => array(
972
-                    array('subtab' => 'custom_fields',
973
-                        'label' => __('Custom Fields', 'geodirectory'),
974
-                        'request' => array('listing_type' => $geodir_post_type)),
975
-                    array('subtab' => 'sorting_options',
976
-                        'label' => __('Sorting Options', 'geodirectory'),
977
-                        'request' => array('listing_type' => $geodir_post_type)),
978
-                ),
979
-                'tab_index' => 9,
980
-                'request' => array('listing_type' => $geodir_post_type)
981
-            );
969
+			$tabs[$geodir_post_type . '_fields_settings'] = array(
970
+				'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
971
+				'subtabs' => array(
972
+					array('subtab' => 'custom_fields',
973
+						'label' => __('Custom Fields', 'geodirectory'),
974
+						'request' => array('listing_type' => $geodir_post_type)),
975
+					array('subtab' => 'sorting_options',
976
+						'label' => __('Sorting Options', 'geodirectory'),
977
+						'request' => array('listing_type' => $geodir_post_type)),
978
+				),
979
+				'tab_index' => 9,
980
+				'request' => array('listing_type' => $geodir_post_type)
981
+			);
982 982
 
983
-        endforeach;
983
+		endforeach;
984 984
 
985
-    }
985
+	}
986 986
 
987
-    return $tabs;
987
+	return $tabs;
988 988
 }
989 989
 
990 990
 
@@ -1000,9 +1000,9 @@  discard block
 block discarded – undo
1000 1000
  */
1001 1001
 function geodir_tools_setting_tab($tabs)
1002 1002
 {
1003
-    wp_enqueue_script( 'jquery-ui-progressbar' );
1004
-    $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
1005
-    return $tabs;
1003
+	wp_enqueue_script( 'jquery-ui-progressbar' );
1004
+	$tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
1005
+	return $tabs;
1006 1006
 }
1007 1007
 
1008 1008
 /**
@@ -1017,8 +1017,8 @@  discard block
 block discarded – undo
1017 1017
  */
1018 1018
 function geodir_compatibility_setting_tab($tabs)
1019 1019
 {
1020
-    $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1021
-    return $tabs;
1020
+	$tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1021
+	return $tabs;
1022 1022
 }
1023 1023
 
1024 1024
 
@@ -1034,144 +1034,144 @@  discard block
 block discarded – undo
1034 1034
  */
1035 1035
 function geodir_extend_geodirectory_setting_tab($tabs)
1036 1036
 {
1037
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1038
-    return $tabs;
1037
+	$tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1038
+	return $tabs;
1039 1039
 }
1040 1040
 
1041 1041
 
1042 1042
 if (!function_exists('geodir_edit_post_columns')) {
1043
-    /**
1044
-     * Modify admin post listing page columns.
1045
-     *
1046
-     * @since 1.0.0
1047
-     * @package GeoDirectory
1048
-     * @param array $columns The column array.
1049
-     * @return array Altered column array.
1050
-     */
1051
-    function geodir_edit_post_columns($columns)
1052
-    {
1053
-
1054
-        $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1055
-            'categorys' => __('Categories', 'geodirectory'));
1056
-
1057
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1058
-        {
1059
-            $offset = 0; // should we prepend $array with $data?
1060
-            $offset = count($columns); // or should we append $array with $data? lets pick this one...
1061
-        }
1043
+	/**
1044
+	 * Modify admin post listing page columns.
1045
+	 *
1046
+	 * @since 1.0.0
1047
+	 * @package GeoDirectory
1048
+	 * @param array $columns The column array.
1049
+	 * @return array Altered column array.
1050
+	 */
1051
+	function geodir_edit_post_columns($columns)
1052
+	{
1053
+
1054
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1055
+			'categorys' => __('Categories', 'geodirectory'));
1062 1056
 
1063
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1057
+		if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1058
+		{
1059
+			$offset = 0; // should we prepend $array with $data?
1060
+			$offset = count($columns); // or should we append $array with $data? lets pick this one...
1061
+		}
1064 1062
 
1065
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1063
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1066 1064
 
1067
-        return $columns;
1068
-    }
1065
+		$columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1066
+
1067
+		return $columns;
1068
+	}
1069 1069
 }
1070 1070
 
1071 1071
 
1072 1072
 if (!function_exists('geodir_manage_post_columns')) {
1073
-    /**
1074
-     * Adds content to our custom post listing page columns.
1075
-     *
1076
-     * @since 1.0.0
1077
-     * @package GeoDirectory
1078
-     * @global object $wpdb WordPress Database object.
1079
-     * @global object $post WordPress Post object.
1080
-     * @param string $column The column name.
1081
-     * @param int $post_id The post ID.
1082
-     */
1083
-    function geodir_manage_post_columns($column, $post_id)
1084
-    {
1085
-        global $post, $wpdb;
1086
-
1087
-        switch ($column):
1088
-            /* If displaying the 'city' column. */
1089
-            case 'location' :
1090
-                $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1091
-                $location = geodir_get_location($location_id);
1092
-                /* If no city is found, output a default message. */
1093
-                if (empty($location)) {
1094
-                    _e('Unknown', 'geodirectory');
1095
-                } else {
1096
-                    /* If there is a city id, append 'city name' to the text string. */
1097
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1098
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1099
-                }
1100
-                break;
1101
-
1102
-            /* If displaying the 'expire' column. */
1103
-            case 'expire' :
1104
-                $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1105
-                $d1 = $expire_date; // get expire_date
1106
-                $d2 = date('Y-m-d'); // get current date
1107
-                $state = __('days left', 'geodirectory');
1108
-                $date_diff_text = '';
1109
-                $expire_class = 'expire_left';
1110
-                if ($expire_date != 'Never') {
1111
-                    if (strtotime($d1) < strtotime($d2)) {
1112
-                        $state = __('days overdue', 'geodirectory');
1113
-                        $expire_class = 'expire_over';
1114
-                    }
1115
-                    $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
1116
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1117
-                }
1118
-                /* If no expire_date is found, output a default message. */
1119
-                if (empty($expire_date))
1120
-                    echo __('Unknown', 'geodirectory');
1121
-                /* If there is a expire_date, append 'days left' to the text string. */
1122
-                else
1123
-                    echo $expire_date . $date_diff_text;
1124
-                break;
1125
-
1126
-            /* If displaying the 'categorys' column. */
1127
-            case 'categorys' :
1128
-
1129
-                /* Get the categorys for the post. */
1130
-
1131
-
1132
-                $terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1133
-
1134
-                /* If terms were found. */
1135
-                if (!empty($terms)) {
1136
-                    $out = array();
1137
-                    /* Loop through each term, linking to the 'edit posts' page for the specific term. */
1138
-                    foreach ($terms as $term) {
1139
-                        if (!strstr($term->taxonomy, 'tag')) {
1140
-                            $out[] = sprintf('<a href="%s">%s</a>',
1141
-                                esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1142
-                                esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1143
-                            );
1144
-                        }
1145
-                    }
1146
-                    /* Join the terms, separating them with a comma. */
1147
-                    echo(join(', ', $out));
1148
-                } /* If no terms were found, output a default message. */
1149
-                else {
1150
-                    _e('No Categories', 'geodirectory');
1151
-                }
1152
-                break;
1073
+	/**
1074
+	 * Adds content to our custom post listing page columns.
1075
+	 *
1076
+	 * @since 1.0.0
1077
+	 * @package GeoDirectory
1078
+	 * @global object $wpdb WordPress Database object.
1079
+	 * @global object $post WordPress Post object.
1080
+	 * @param string $column The column name.
1081
+	 * @param int $post_id The post ID.
1082
+	 */
1083
+	function geodir_manage_post_columns($column, $post_id)
1084
+	{
1085
+		global $post, $wpdb;
1086
+
1087
+		switch ($column):
1088
+			/* If displaying the 'city' column. */
1089
+			case 'location' :
1090
+				$location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1091
+				$location = geodir_get_location($location_id);
1092
+				/* If no city is found, output a default message. */
1093
+				if (empty($location)) {
1094
+					_e('Unknown', 'geodirectory');
1095
+				} else {
1096
+					/* If there is a city id, append 'city name' to the text string. */
1097
+					$add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1098
+					echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1099
+				}
1100
+				break;
1101
+
1102
+			/* If displaying the 'expire' column. */
1103
+			case 'expire' :
1104
+				$expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1105
+				$d1 = $expire_date; // get expire_date
1106
+				$d2 = date('Y-m-d'); // get current date
1107
+				$state = __('days left', 'geodirectory');
1108
+				$date_diff_text = '';
1109
+				$expire_class = 'expire_left';
1110
+				if ($expire_date != 'Never') {
1111
+					if (strtotime($d1) < strtotime($d2)) {
1112
+						$state = __('days overdue', 'geodirectory');
1113
+						$expire_class = 'expire_over';
1114
+					}
1115
+					$date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
1116
+					$date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1117
+				}
1118
+				/* If no expire_date is found, output a default message. */
1119
+				if (empty($expire_date))
1120
+					echo __('Unknown', 'geodirectory');
1121
+				/* If there is a expire_date, append 'days left' to the text string. */
1122
+				else
1123
+					echo $expire_date . $date_diff_text;
1124
+				break;
1153 1125
 
1154
-        endswitch;
1155
-    }
1126
+			/* If displaying the 'categorys' column. */
1127
+			case 'categorys' :
1128
+
1129
+				/* Get the categorys for the post. */
1130
+
1131
+
1132
+				$terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1133
+
1134
+				/* If terms were found. */
1135
+				if (!empty($terms)) {
1136
+					$out = array();
1137
+					/* Loop through each term, linking to the 'edit posts' page for the specific term. */
1138
+					foreach ($terms as $term) {
1139
+						if (!strstr($term->taxonomy, 'tag')) {
1140
+							$out[] = sprintf('<a href="%s">%s</a>',
1141
+								esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1142
+								esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1143
+							);
1144
+						}
1145
+					}
1146
+					/* Join the terms, separating them with a comma. */
1147
+					echo(join(', ', $out));
1148
+				} /* If no terms were found, output a default message. */
1149
+				else {
1150
+					_e('No Categories', 'geodirectory');
1151
+				}
1152
+				break;
1153
+
1154
+		endswitch;
1155
+	}
1156 1156
 }
1157 1157
 
1158 1158
 
1159 1159
 if (!function_exists('geodir_post_sortable_columns')) {
1160
-    /**
1161
-     * Makes admin post listing page columns sortable.
1162
-     *
1163
-     * @since 1.0.0
1164
-     * @package GeoDirectory
1165
-     * @param array $columns The column array.
1166
-     * @return array Altered column array.
1167
-     */
1168
-    function geodir_post_sortable_columns($columns)
1169
-    {
1170
-
1171
-        $columns['expire'] = 'expire';
1172
-
1173
-        return $columns;
1174
-    }
1160
+	/**
1161
+	 * Makes admin post listing page columns sortable.
1162
+	 *
1163
+	 * @since 1.0.0
1164
+	 * @package GeoDirectory
1165
+	 * @param array $columns The column array.
1166
+	 * @return array Altered column array.
1167
+	 */
1168
+	function geodir_post_sortable_columns($columns)
1169
+	{
1170
+
1171
+		$columns['expire'] = 'expire';
1172
+
1173
+		return $columns;
1174
+	}
1175 1175
 }
1176 1176
 
1177 1177
 /**
@@ -1185,32 +1185,32 @@  discard block
 block discarded – undo
1185 1185
  * @param int $post_id The post ID.
1186 1186
  */
1187 1187
 function geodir_post_information_save($post_id, $post) {
1188
-    global $wpdb, $current_user;
1188
+	global $wpdb, $current_user;
1189 1189
 
1190
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1191
-        return;
1192
-    }
1190
+	if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1191
+		return;
1192
+	}
1193 1193
 
1194
-    $geodir_posttypes = geodir_get_posttypes();
1194
+	$geodir_posttypes = geodir_get_posttypes();
1195 1195
 
1196
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1197
-        return;
1196
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1197
+		return;
1198 1198
 
1199
-    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1200
-        if (isset($_REQUEST['_status']))
1201
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1199
+	if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1200
+		if (isset($_REQUEST['_status']))
1201
+			geodir_change_post_status($post_id, $_REQUEST['_status']);
1202 1202
 
1203
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1204
-            return;
1203
+		if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1204
+			return;
1205 1205
 
1206
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1207
-            return;
1206
+		if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1207
+			return;
1208 1208
 
1209
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1210
-            return;
1209
+		if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1210
+			return;
1211 1211
 
1212
-        geodir_save_listing($_REQUEST);
1213
-    }
1212
+		geodir_save_listing($_REQUEST);
1213
+	}
1214 1214
 }
1215 1215
 
1216 1216
 /**
@@ -1226,102 +1226,102 @@  discard block
 block discarded – undo
1226 1226
  */
1227 1227
 function geodir_admin_fields($options)
1228 1228
 {
1229
-    global $geodirectory;
1230
-
1231
-    $first_title = true;
1232
-    $tab_id = '';
1233
-    $i = 0;
1234
-    foreach ($options as $value) :
1235
-        if (!isset($value['name'])) $value['name'] = '';
1236
-        if (!isset($value['class'])) $value['class'] = '';
1237
-        if (!isset($value['css'])) $value['css'] = '';
1238
-        if (!isset($value['std'])) $value['std'] = '';
1239
-        $desc = '';
1240
-        switch ($value['type']) :
1241
-            case 'dummy_installer':
1242
-                $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1243
-                geodir_autoinstall_admin_header($post_type);
1244
-                break;
1245
-            case 'title':
1246
-
1247
-                if ($i == 0) {
1248
-                    echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1249
-                    echo '<div class="inner_content_tab_main">';
1250
-                }
1229
+	global $geodirectory;
1230
+
1231
+	$first_title = true;
1232
+	$tab_id = '';
1233
+	$i = 0;
1234
+	foreach ($options as $value) :
1235
+		if (!isset($value['name'])) $value['name'] = '';
1236
+		if (!isset($value['class'])) $value['class'] = '';
1237
+		if (!isset($value['css'])) $value['css'] = '';
1238
+		if (!isset($value['std'])) $value['std'] = '';
1239
+		$desc = '';
1240
+		switch ($value['type']) :
1241
+			case 'dummy_installer':
1242
+				$post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1243
+				geodir_autoinstall_admin_header($post_type);
1244
+				break;
1245
+			case 'title':
1246
+
1247
+				if ($i == 0) {
1248
+					echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1249
+					echo '<div class="inner_content_tab_main">';
1250
+				}
1251 1251
 
1252
-                $i++;
1252
+				$i++;
1253 1253
 
1254
-                if (isset($value['id']) && $value['id'])
1255
-                    $tab_id = $value['id'];
1254
+				if (isset($value['id']) && $value['id'])
1255
+					$tab_id = $value['id'];
1256 1256
 
1257
-                if (isset($value['desc']) && $value['desc'])
1258
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1257
+				if (isset($value['desc']) && $value['desc'])
1258
+					$desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1259 1259
 
1260
-                if (isset($value['name']) && $value['name']) {
1261
-                    if ($first_title === true) {
1262
-                        $first_title = false;
1263
-                    } else {
1264
-                        echo '</div>';
1265
-                    }
1266
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1260
+				if (isset($value['name']) && $value['name']) {
1261
+					if ($first_title === true) {
1262
+						$first_title = false;
1263
+					} else {
1264
+						echo '</div>';
1265
+					}
1266
+					echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1267 1267
 
1268
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1269
-                }
1268
+					echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1269
+				}
1270 1270
 
1271
-                /**
1272
-                 * Called after a GeoDirectory settings title is output in the GD settings page.
1273
-                 *
1274
-                 * The action is called dynamically geodir_settings_$value['id'].
1275
-                 *
1276
-                 * @since 1.0.0
1277
-                 */
1278
-                do_action('geodir_settings_' . sanitize_title($value['id']));
1279
-                break;
1280
-
1281
-            case 'no_tabs':
1282
-
1283
-                echo '<div class="inner_content_tab_main">';
1284
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1285
-
1286
-                break;
1287
-
1288
-            case 'sectionstart':
1289
-                if (isset($value['desc']) && $value['desc'])
1290
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1291
-                if (isset($value['name']) && $value['name'])
1292
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1293
-                /**
1294
-                 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1295
-                 *
1296
-                 * The action is called dynamically geodir_settings_$value['id']_start.
1297
-                 *
1298
-                 * @since 1.0.0
1299
-                 */
1300
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1301
-                echo '<table class="form-table">' . "\n\n";
1302
-
1303
-                break;
1304
-            case 'sectionend':
1305
-                /**
1306
-                 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1307
-                 *
1308
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1309
-                 *
1310
-                 * @since 1.0.0
1311
-                 */
1312
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1313
-                echo '</table>';
1314
-                /**
1315
-                 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1316
-                 *
1317
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1318
-                 *
1319
-                 * @since 1.0.0
1320
-                 */
1321
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1322
-                break;
1323
-            case 'text':
1324
-                ?>
1271
+				/**
1272
+				 * Called after a GeoDirectory settings title is output in the GD settings page.
1273
+				 *
1274
+				 * The action is called dynamically geodir_settings_$value['id'].
1275
+				 *
1276
+				 * @since 1.0.0
1277
+				 */
1278
+				do_action('geodir_settings_' . sanitize_title($value['id']));
1279
+				break;
1280
+
1281
+			case 'no_tabs':
1282
+
1283
+				echo '<div class="inner_content_tab_main">';
1284
+				echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1285
+
1286
+				break;
1287
+
1288
+			case 'sectionstart':
1289
+				if (isset($value['desc']) && $value['desc'])
1290
+					$desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1291
+				if (isset($value['name']) && $value['name'])
1292
+					echo '<h3>' . $value['name'] . $desc . '</h3>';
1293
+				/**
1294
+				 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1295
+				 *
1296
+				 * The action is called dynamically geodir_settings_$value['id']_start.
1297
+				 *
1298
+				 * @since 1.0.0
1299
+				 */
1300
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1301
+				echo '<table class="form-table">' . "\n\n";
1302
+
1303
+				break;
1304
+			case 'sectionend':
1305
+				/**
1306
+				 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1307
+				 *
1308
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1309
+				 *
1310
+				 * @since 1.0.0
1311
+				 */
1312
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1313
+				echo '</table>';
1314
+				/**
1315
+				 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1316
+				 *
1317
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1318
+				 *
1319
+				 * @since 1.0.0
1320
+				 */
1321
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1322
+				break;
1323
+			case 'text':
1324
+				?>
1325 1325
                 <tr valign="top">
1326 1326
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1327 1327
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1330,15 +1330,15 @@  discard block
 block discarded – undo
1330 1330
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1331 1331
                                            style=" <?php echo esc_attr($value['css']); ?>"
1332 1332
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1333
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1334
-                                           } else {
1335
-                                               echo esc_attr($value['std']);
1336
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1333
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1334
+										   } else {
1335
+											   echo esc_attr($value['std']);
1336
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1337 1337
                 </tr><?php
1338
-                break;
1338
+				break;
1339 1339
 
1340
-            case 'password':
1341
-                ?>
1340
+			case 'password':
1341
+				?>
1342 1342
                 <tr valign="top">
1343 1343
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1344 1344
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1347,42 +1347,42 @@  discard block
 block discarded – undo
1347 1347
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1348 1348
                                            style="<?php echo esc_attr($value['css']); ?>"
1349 1349
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1350
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1351
-                                           } else {
1352
-                                               echo esc_attr($value['std']);
1353
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1350
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1351
+										   } else {
1352
+											   echo esc_attr($value['std']);
1353
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1354 1354
                 </tr><?php
1355
-                break;
1355
+				break;
1356 1356
 
1357
-            case 'html_content':
1358
-                ?>
1357
+			case 'html_content':
1358
+				?>
1359 1359
                 <tr valign="top">
1360 1360
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1361 1361
                 <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td>
1362 1362
                 </tr><?php
1363
-                break;
1363
+				break;
1364 1364
 
1365
-            case 'color' :
1366
-                ?>
1365
+			case 'color' :
1366
+				?>
1367 1367
                 <tr valign="top">
1368 1368
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1369 1369
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1370 1370
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
1371 1371
                                            style="<?php echo esc_attr($value['css']); ?>"
1372 1372
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1373
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1374
-                                           } else {
1375
-                                               echo esc_attr($value['std']);
1376
-                                           } ?>" class="colorpick"/> <span
1373
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1374
+										   } else {
1375
+											   echo esc_attr($value['std']);
1376
+										   } ?>" class="colorpick"/> <span
1377 1377
                         class="description"><?php echo $value['desc']; ?></span>
1378 1378
 
1379 1379
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
1380 1380
                          style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
1381 1381
                 </td>
1382 1382
                 </tr><?php
1383
-                break;
1384
-            case 'image_width' :
1385
-                ?>
1383
+				break;
1384
+			case 'image_width' :
1385
+				?>
1386 1386
                 <tr valign="top">
1387 1387
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1388 1388
                 <td class="forminp">
@@ -1404,11 +1404,11 @@  discard block
 block discarded – undo
1404 1404
 
1405 1405
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1406 1406
                 </tr><?php
1407
-                break;
1408
-            case 'select':
1409
-                $option_value = get_option($value['id']);
1410
-                $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1411
-                ?>
1407
+				break;
1408
+			case 'select':
1409
+				$option_value = get_option($value['id']);
1410
+				$option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1411
+				?>
1412 1412
                 <tr valign="top">
1413 1413
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1414 1414
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1417,33 +1417,33 @@  discard block
 block discarded – undo
1417 1417
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1418 1418
                                             option-ajaxchosen="false">
1419 1419
                         <?php
1420
-                        foreach ($value['options'] as $key => $val) {
1421
-                            $geodir_select_value = '';
1422
-                            if ($option_value != '') {
1423
-                                if ($option_value != '' && $option_value == $key)
1424
-                                    $geodir_select_value = ' selected="selected" ';
1425
-                            } else {
1426
-                                if ($value['std'] == $key)
1427
-                                    $geodir_select_value = ' selected="selected" ';
1428
-                            }
1429
-                            ?>
1420
+						foreach ($value['options'] as $key => $val) {
1421
+							$geodir_select_value = '';
1422
+							if ($option_value != '') {
1423
+								if ($option_value != '' && $option_value == $key)
1424
+									$geodir_select_value = ' selected="selected" ';
1425
+							} else {
1426
+								if ($value['std'] == $key)
1427
+									$geodir_select_value = ' selected="selected" ';
1428
+							}
1429
+							?>
1430 1430
                             <option
1431 1431
                                 value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo ucfirst($val) ?></option>
1432 1432
                         <?php
1433
-                        }
1434
-                        ?>
1433
+						}
1434
+						?>
1435 1435
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1436 1436
                 </td>
1437 1437
                 </tr><?php
1438
-                break;
1438
+				break;
1439 1439
 
1440
-            case 'multiselect':
1441
-                $option_values = get_option($value['id']);
1442
-                if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1443
-                   $option_values = $value['std'];
1444
-                }
1445
-                $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1446
-                ?>
1440
+			case 'multiselect':
1441
+				$option_values = get_option($value['id']);
1442
+				if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1443
+				   $option_values = $value['std'];
1444
+				}
1445
+				$option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1446
+				?>
1447 1447
                 <tr valign="top">
1448 1448
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1449 1449
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
@@ -1453,25 +1453,25 @@  discard block
 block discarded – undo
1453 1453
                                             data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1454 1454
                                             option-ajaxchosen="false">
1455 1455
                         <?php
1456
-                        foreach ($value['options'] as $key => $val) {
1457
-                            if (strpos($key, 'optgroup_start-') === 0) {
1458
-                                ?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1459
-                            } else if (strpos($key, 'optgroup_end-') === 0) {
1460
-                                ?></optgroup><?php
1461
-                            } else {
1462
-                                ?>
1456
+						foreach ($value['options'] as $key => $val) {
1457
+							if (strpos($key, 'optgroup_start-') === 0) {
1458
+								?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1459
+							} else if (strpos($key, 'optgroup_end-') === 0) {
1460
+								?></optgroup><?php
1461
+							} else {
1462
+								?>
1463 1463
                                 <option
1464 1464
                                     value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option>
1465 1465
                             <?php
1466
-                            }
1467
-                        }
1468
-                        ?>
1466
+							}
1467
+						}
1468
+						?>
1469 1469
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1470 1470
                 </td>
1471 1471
                 </tr><?php
1472
-                break;
1473
-            case 'file':
1474
-                ?>
1472
+				break;
1473
+			case 'file':
1474
+				?>
1475 1475
                 <tr valign="top">
1476 1476
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1477 1477
                 <td class="forminp">
@@ -1491,87 +1491,87 @@  discard block
 block discarded – undo
1491 1491
                     <?php } ?>
1492 1492
                 </td>
1493 1493
                 </tr><?php
1494
-                break;
1495
-            case 'map_default_settings' :
1496
-                ?>
1494
+				break;
1495
+			case 'map_default_settings' :
1496
+				?>
1497 1497
 
1498 1498
                 <tr valign="top">
1499 1499
                     <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1500 1500
                     <td width="60%">
1501 1501
                         <select name="geodir_default_map_language" style="width:60%">
1502 1502
                             <?php
1503
-                            $arr_map_langages = array(
1504
-                                'ar' => __('ARABIC', 'geodirectory'),
1505
-                                'eu' => __('BASQUE', 'geodirectory'),
1506
-                                'bg' => __('BULGARIAN', 'geodirectory'),
1507
-                                'bn' => __('BENGALI', 'geodirectory'),
1508
-                                'ca' => __('CATALAN', 'geodirectory'),
1509
-                                'cs' => __('CZECH', 'geodirectory'),
1510
-                                'da' => __('DANISH', 'geodirectory'),
1511
-                                'de' => __('GERMAN', 'geodirectory'),
1512
-                                'el' => __('GREEK', 'geodirectory'),
1513
-                                'en' => __('ENGLISH', 'geodirectory'),
1514
-                                'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1515
-                                'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1516
-                                'es' => __('SPANISH', 'geodirectory'),
1517
-                                'eu' => __('BASQUE', 'geodirectory'),
1518
-                                'fa' => __('FARSI', 'geodirectory'),
1519
-                                'fi' => __('FINNISH', 'geodirectory'),
1520
-                                'fil' => __('FILIPINO', 'geodirectory'),
1521
-                                'fr' => __('FRENCH', 'geodirectory'),
1522
-                                'gl' => __('GALICIAN', 'geodirectory'),
1523
-                                'gu' => __('GUJARATI', 'geodirectory'),
1524
-                                'hi' => __('HINDI', 'geodirectory'),
1525
-                                'hr' => __('CROATIAN', 'geodirectory'),
1526
-                                'hu' => __('HUNGARIAN', 'geodirectory'),
1527
-                                'id' => __('INDONESIAN', 'geodirectory'),
1528
-                                'it' => __('ITALIAN', 'geodirectory'),
1529
-                                'iw' => __('HEBREW', 'geodirectory'),
1530
-                                'ja' => __('JAPANESE', 'geodirectory'),
1531
-                                'kn' => __('KANNADA', 'geodirectory'),
1532
-                                'ko' => __('KOREAN', 'geodirectory'),
1533
-                                'lt' => __('LITHUANIAN', 'geodirectory'),
1534
-                                'lv' => __('LATVIAN', 'geodirectory'),
1535
-                                'ml' => __('MALAYALAM', 'geodirectory'),
1536
-                                'mr' => __('MARATHI', 'geodirectory'),
1537
-                                'nl' => __('DUTCH', 'geodirectory'),
1538
-                                'no' => __('NORWEGIAN', 'geodirectory'),
1539
-                                'pl' => __('POLISH', 'geodirectory'),
1540
-                                'pt' => __('PORTUGUESE', 'geodirectory'),
1541
-                                'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1542
-                                'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1543
-                                'ro' => __('ROMANIAN', 'geodirectory'),
1544
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1545
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1546
-                                'sk' => __('SLOVAK', 'geodirectory'),
1547
-                                'sl' => __('SLOVENIAN', 'geodirectory'),
1548
-                                'sr' => __('SERBIAN', 'geodirectory'),
1549
-                                'sv' => __('	SWEDISH', 'geodirectory'),
1550
-                                'tl' => __('TAGALOG', 'geodirectory'),
1551
-                                'ta' => __('TAMIL', 'geodirectory'),
1552
-                                'te' => __('TELUGU', 'geodirectory'),
1553
-                                'th' => __('THAI', 'geodirectory'),
1554
-                                'tr' => __('TURKISH', 'geodirectory'),
1555
-                                'uk' => __('UKRAINIAN', 'geodirectory'),
1556
-                                'vi' => __('VIETNAMESE', 'geodirectory'),
1557
-                                'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1558
-                                'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1559
-                            );
1560
-                            $geodir_default_map_language = get_option('geodir_default_map_language');
1561
-                            if (empty($geodir_default_map_language))
1562
-                                $geodir_default_map_language = 'en';
1563
-                            foreach ($arr_map_langages as $language_key => $language_txt) {
1564
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1565
-                                    $geodir_default_language_selected = "selected='selected'";
1566
-                                else
1567
-                                    $geodir_default_language_selected = '';
1568
-
1569
-                                ?>
1503
+							$arr_map_langages = array(
1504
+								'ar' => __('ARABIC', 'geodirectory'),
1505
+								'eu' => __('BASQUE', 'geodirectory'),
1506
+								'bg' => __('BULGARIAN', 'geodirectory'),
1507
+								'bn' => __('BENGALI', 'geodirectory'),
1508
+								'ca' => __('CATALAN', 'geodirectory'),
1509
+								'cs' => __('CZECH', 'geodirectory'),
1510
+								'da' => __('DANISH', 'geodirectory'),
1511
+								'de' => __('GERMAN', 'geodirectory'),
1512
+								'el' => __('GREEK', 'geodirectory'),
1513
+								'en' => __('ENGLISH', 'geodirectory'),
1514
+								'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1515
+								'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1516
+								'es' => __('SPANISH', 'geodirectory'),
1517
+								'eu' => __('BASQUE', 'geodirectory'),
1518
+								'fa' => __('FARSI', 'geodirectory'),
1519
+								'fi' => __('FINNISH', 'geodirectory'),
1520
+								'fil' => __('FILIPINO', 'geodirectory'),
1521
+								'fr' => __('FRENCH', 'geodirectory'),
1522
+								'gl' => __('GALICIAN', 'geodirectory'),
1523
+								'gu' => __('GUJARATI', 'geodirectory'),
1524
+								'hi' => __('HINDI', 'geodirectory'),
1525
+								'hr' => __('CROATIAN', 'geodirectory'),
1526
+								'hu' => __('HUNGARIAN', 'geodirectory'),
1527
+								'id' => __('INDONESIAN', 'geodirectory'),
1528
+								'it' => __('ITALIAN', 'geodirectory'),
1529
+								'iw' => __('HEBREW', 'geodirectory'),
1530
+								'ja' => __('JAPANESE', 'geodirectory'),
1531
+								'kn' => __('KANNADA', 'geodirectory'),
1532
+								'ko' => __('KOREAN', 'geodirectory'),
1533
+								'lt' => __('LITHUANIAN', 'geodirectory'),
1534
+								'lv' => __('LATVIAN', 'geodirectory'),
1535
+								'ml' => __('MALAYALAM', 'geodirectory'),
1536
+								'mr' => __('MARATHI', 'geodirectory'),
1537
+								'nl' => __('DUTCH', 'geodirectory'),
1538
+								'no' => __('NORWEGIAN', 'geodirectory'),
1539
+								'pl' => __('POLISH', 'geodirectory'),
1540
+								'pt' => __('PORTUGUESE', 'geodirectory'),
1541
+								'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1542
+								'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1543
+								'ro' => __('ROMANIAN', 'geodirectory'),
1544
+								'ru' => __('RUSSIAN', 'geodirectory'),
1545
+								'ru' => __('RUSSIAN', 'geodirectory'),
1546
+								'sk' => __('SLOVAK', 'geodirectory'),
1547
+								'sl' => __('SLOVENIAN', 'geodirectory'),
1548
+								'sr' => __('SERBIAN', 'geodirectory'),
1549
+								'sv' => __('	SWEDISH', 'geodirectory'),
1550
+								'tl' => __('TAGALOG', 'geodirectory'),
1551
+								'ta' => __('TAMIL', 'geodirectory'),
1552
+								'te' => __('TELUGU', 'geodirectory'),
1553
+								'th' => __('THAI', 'geodirectory'),
1554
+								'tr' => __('TURKISH', 'geodirectory'),
1555
+								'uk' => __('UKRAINIAN', 'geodirectory'),
1556
+								'vi' => __('VIETNAMESE', 'geodirectory'),
1557
+								'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1558
+								'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1559
+							);
1560
+							$geodir_default_map_language = get_option('geodir_default_map_language');
1561
+							if (empty($geodir_default_map_language))
1562
+								$geodir_default_map_language = 'en';
1563
+							foreach ($arr_map_langages as $language_key => $language_txt) {
1564
+								if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1565
+									$geodir_default_language_selected = "selected='selected'";
1566
+								else
1567
+									$geodir_default_language_selected = '';
1568
+
1569
+								?>
1570 1570
                                 <option
1571 1571
                                     value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option>
1572 1572
 
1573 1573
                             <?php }
1574
-                            ?>
1574
+							?>
1575 1575
                         </select>
1576 1576
                     </td>
1577 1577
                 </tr>
@@ -1582,46 +1582,46 @@  discard block
 block discarded – undo
1582 1582
                     <td width="60%">
1583 1583
                         <select name="geodir_default_map_search_pt" style="width:60%">
1584 1584
                             <?php
1585
-                            $post_types = geodir_get_posttypes('array');
1586
-                            $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1587
-                            if (empty($geodir_default_map_search_pt))
1588
-                                $geodir_default_map_search_pt = 'gd_place';
1589
-                            if (is_array($post_types)) {
1590
-                                foreach ($post_types as $key => $post_types_obj) {
1591
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1592
-                                        $geodir_search_pt_selected = "selected='selected'";
1593
-                                    else
1594
-                                        $geodir_search_pt_selected = '';
1595
-
1596
-                                    ?>
1585
+							$post_types = geodir_get_posttypes('array');
1586
+							$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1587
+							if (empty($geodir_default_map_search_pt))
1588
+								$geodir_default_map_search_pt = 'gd_place';
1589
+							if (is_array($post_types)) {
1590
+								foreach ($post_types as $key => $post_types_obj) {
1591
+									if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1592
+										$geodir_search_pt_selected = "selected='selected'";
1593
+									else
1594
+										$geodir_search_pt_selected = '';
1595
+
1596
+									?>
1597 1597
                                     <option
1598 1598
                                         value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo $post_types_obj['labels']['singular_name']; ?></option>
1599 1599
 
1600 1600
                                 <?php }
1601 1601
 
1602
-                            }
1602
+							}
1603 1603
 
1604
-                            ?>
1604
+							?>
1605 1605
                         </select>
1606 1606
                     </td>
1607 1607
                 </tr>
1608 1608
 
1609 1609
                 <?php
1610
-                break;
1610
+				break;
1611 1611
 
1612
-            case 'map':
1613
-                ?>
1612
+			case 'map':
1613
+				?>
1614 1614
                 <tr valign="top">
1615 1615
                     <td class="forminp">
1616 1616
                         <?php
1617
-                        global $post_cat, $cat_display;
1618
-                        $post_types = geodir_get_posttypes('object');
1619
-                        $cat_display = 'checkbox';
1620
-                        $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1621
-                        $gd_cats = get_option('geodir_exclude_cat_on_map');
1622
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1623
-                        $count = 1;
1624
-                        ?>
1617
+						global $post_cat, $cat_display;
1618
+						$post_types = geodir_get_posttypes('object');
1619
+						$cat_display = 'checkbox';
1620
+						$gd_post_types = get_option('geodir_exclude_post_type_on_map');
1621
+						$gd_cats = get_option('geodir_exclude_cat_on_map');
1622
+						$gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1623
+						$count = 1;
1624
+						?>
1625 1625
                         <table width="70%" class="widefat">
1626 1626
                             <thead>
1627 1627
                             <tr>
@@ -1630,18 +1630,18 @@  discard block
 block discarded – undo
1630 1630
                                 <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th>
1631 1631
                             </tr>
1632 1632
                             <?php
1633
-                            $gd_categs = $gd_cats;
1634
-                            foreach ($post_types as $key => $post_types_obj) :
1635
-                                $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1636
-                                $gd_taxonomy = geodir_get_taxonomies($key);
1637
-                                if ($gd_cats_upgrade) {
1638
-                                    $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1639
-                                    $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1640
-                                    $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1641
-                                }
1642
-                                $post_cat = implode(',', $gd_cats);
1643
-                                $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1644
-                                ?>
1633
+							$gd_categs = $gd_cats;
1634
+							foreach ($post_types as $key => $post_types_obj) :
1635
+								$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1636
+								$gd_taxonomy = geodir_get_taxonomies($key);
1637
+								if ($gd_cats_upgrade) {
1638
+									$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1639
+									$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1640
+									$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1641
+								}
1642
+								$post_cat = implode(',', $gd_cats);
1643
+								$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1644
+								?>
1645 1645
                                 <tr>
1646 1646
                                     <td valign="top" width="5%"><?php echo $count; ?></td>
1647 1647
                                     <td valign="top" width="25%" id="td_post_types"><input type="checkbox"
@@ -1662,19 +1662,19 @@  discard block
 block discarded – undo
1662 1662
                     </td>
1663 1663
                 </tr>
1664 1664
                 <?php
1665
-                break;
1665
+				break;
1666 1666
 
1667
-            case 'checkbox' :
1667
+			case 'checkbox' :
1668 1668
 
1669
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1670
-                    ?>
1669
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1670
+					?>
1671 1671
                     <tr valign="top">
1672 1672
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1673 1673
                     <td class="forminp">
1674 1674
                 <?php
1675
-                endif;
1675
+				endif;
1676 1676
 
1677
-                ?>
1677
+				?>
1678 1678
                 <fieldset>
1679 1679
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1680 1680
                     <label for="<?php echo $value['id'] ?>">
@@ -1684,49 +1684,49 @@  discard block
 block discarded – undo
1684 1684
                 </fieldset>
1685 1685
                 <?php
1686 1686
 
1687
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1688
-                    ?>
1687
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1688
+					?>
1689 1689
                     </td>
1690 1690
                     </tr>
1691 1691
                 <?php
1692
-                endif;
1692
+				endif;
1693 1693
 
1694
-                break;
1694
+				break;
1695 1695
 
1696
-            case 'radio' :
1696
+			case 'radio' :
1697 1697
 
1698
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1699
-                    ?>
1698
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1699
+					?>
1700 1700
                     <tr valign="top">
1701 1701
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1702 1702
                     <td class="forminp">
1703 1703
                 <?php
1704
-                endif;
1704
+				endif;
1705 1705
 
1706
-                ?>
1706
+				?>
1707 1707
                 <fieldset>
1708 1708
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1709 1709
                     <label for="<?php echo $value['id'];?>">
1710 1710
                         <input name="<?php echo esc_attr($value['id']); ?>"
1711 1711
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1712 1712
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1713
-                            echo 'checked="checked"';
1714
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1713
+							echo 'checked="checked"';
1714
+						}elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1715 1715
                         <?php echo $value['desc']; ?></label><br>
1716 1716
                 </fieldset>
1717 1717
                 <?php
1718 1718
 
1719
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1720
-                    ?>
1719
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1720
+					?>
1721 1721
                     </td>
1722 1722
                     </tr>
1723 1723
                 <?php
1724
-                endif;
1724
+				endif;
1725 1725
 
1726
-                break;
1726
+				break;
1727 1727
 
1728
-            case 'textarea':
1729
-                ?>
1728
+			case 'textarea':
1729
+				?>
1730 1730
                 <tr valign="top">
1731 1731
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1732 1732
                 <td class="forminp">
@@ -1739,30 +1739,30 @@  discard block
 block discarded – undo
1739 1739
 
1740 1740
                 </td>
1741 1741
                 </tr><?php
1742
-                break;
1742
+				break;
1743 1743
 
1744
-            case 'editor':
1745
-                ?>
1744
+			case 'editor':
1745
+				?>
1746 1746
                 <tr valign="top">
1747 1747
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1748 1748
                 <td class="forminp"><?php
1749
-                    if (get_option($value['id']))
1750
-                        $content = stripslashes(get_option($value['id']));
1751
-                    else
1752
-                        $content = $value['std'];
1749
+					if (get_option($value['id']))
1750
+						$content = stripslashes(get_option($value['id']));
1751
+					else
1752
+						$content = $value['std'];
1753 1753
 
1754
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1754
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1755 1755
 
1756
-                    wp_editor($content, esc_attr($value['id']), $editor_settings);
1756
+					wp_editor($content, esc_attr($value['id']), $editor_settings);
1757 1757
 
1758
-                    ?> <span class="description"><?php echo $value['desc'] ?></span>
1758
+					?> <span class="description"><?php echo $value['desc'] ?></span>
1759 1759
 
1760 1760
                 </td>
1761 1761
                 </tr><?php
1762
-                break;
1762
+				break;
1763 1763
 
1764
-            case 'single_select_page' :
1765
-                // WPML
1764
+			case 'single_select_page' :
1765
+				// WPML
1766 1766
 				$switch_lang = false;
1767 1767
 				$disabled = '';
1768 1768
 				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -1780,18 +1780,18 @@  discard block
 block discarded – undo
1780 1780
 				//
1781 1781
 				$page_setting = (int)get_option($value['id']);
1782 1782
 
1783
-                $args = array('name' => $value['id'],
1784
-                    'id' => $value['id'],
1785
-                    'sort_column' => 'menu_order',
1786
-                    'sort_order' => 'ASC',
1787
-                    'show_option_none' => ' ',
1788
-                    'class' => $value['class'],
1789
-                    'echo' => false,
1790
-                    'selected' => $page_setting);
1783
+				$args = array('name' => $value['id'],
1784
+					'id' => $value['id'],
1785
+					'sort_column' => 'menu_order',
1786
+					'sort_order' => 'ASC',
1787
+					'show_option_none' => ' ',
1788
+					'class' => $value['class'],
1789
+					'echo' => false,
1790
+					'selected' => $page_setting);
1791 1791
 
1792
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1792
+				if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1793 1793
 
1794
-                ?>
1794
+				?>
1795 1795
                 <tr valign="top" class="single_select_page">
1796 1796
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1797 1797
                 <td class="forminp">
@@ -1802,17 +1802,17 @@  discard block
 block discarded – undo
1802 1802
 				if ($switch_lang) {
1803 1803
 					$sitepress->switch_lang($switch_lang, true);
1804 1804
 				}
1805
-                break;
1806
-            case 'single_select_country' :
1807
-                $country_setting = (string)get_option($value['id']);
1808
-                if (strstr($country_setting, ':')) :
1809
-                    $country = current(explode(':', $country_setting));
1810
-                    $state = end(explode(':', $country_setting));
1811
-                else :
1812
-                    $country = $country_setting;
1813
-                    $state = '*';
1814
-                endif;
1815
-                ?>
1805
+				break;
1806
+			case 'single_select_country' :
1807
+				$country_setting = (string)get_option($value['id']);
1808
+				if (strstr($country_setting, ':')) :
1809
+					$country = current(explode(':', $country_setting));
1810
+					$state = end(explode(':', $country_setting));
1811
+				else :
1812
+					$country = $country_setting;
1813
+					$state = '*';
1814
+				endif;
1815
+				?>
1816 1816
                 <tr valign="top">
1817 1817
                 <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
1818 1818
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1823,12 +1823,12 @@  discard block
 block discarded – undo
1823 1823
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1824 1824
                 </td>
1825 1825
                 </tr><?php
1826
-                break;
1827
-            case 'multi_select_countries' :
1828
-                $countries = $geodirectory->countries->countries;
1829
-                asort($countries);
1830
-                $selections = (array)get_option($value['id']);
1831
-                ?>
1826
+				break;
1827
+			case 'multi_select_countries' :
1828
+				$countries = $geodirectory->countries->countries;
1829
+				asort($countries);
1830
+				$selections = (array)get_option($value['id']);
1831
+				?>
1832 1832
                 <tr valign="top">
1833 1833
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1834 1834
                 <td class="forminp">
@@ -1836,22 +1836,22 @@  discard block
 block discarded – undo
1836 1836
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1837 1837
                             title="Country" class="chosen_select">
1838 1838
                         <?php
1839
-                        if ($countries) foreach ($countries as $key => $val) :
1840
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1841
-                        endforeach;
1842
-                        ?>
1839
+						if ($countries) foreach ($countries as $key => $val) :
1840
+							echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1841
+						endforeach;
1842
+						?>
1843 1843
                     </select>
1844 1844
                 </td>
1845 1845
                 </tr>
1846 1846
 
1847 1847
                 <?php
1848 1848
 
1849
-                break;
1849
+				break;
1850 1850
 
1851
-            case 'google_analytics' :
1852
-                $selections = (array)get_option($value['id']);
1853
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1854
-                    ?>
1851
+			case 'google_analytics' :
1852
+				$selections = (array)get_option($value['id']);
1853
+				if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1854
+					?>
1855 1855
                     <tr valign="top">
1856 1856
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1857 1857
                         <td class="forminp">
@@ -1859,19 +1859,19 @@  discard block
 block discarded – undo
1859 1859
 
1860 1860
                             <?php
1861 1861
 
1862
-                            $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1863
-                            $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1864
-                            $state = "&state=123";//any string
1865
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1866
-                            $response_type = "&response_type=code";
1867
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1868
-                            $access_type = "&access_type=offline";
1869
-                            $approval_prompt = "&approval_prompt=force";
1862
+							$oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1863
+							$scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1864
+							$state = "&state=123";//any string
1865
+							$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1866
+							$response_type = "&response_type=code";
1867
+							$client_id = "&client_id=".get_option('geodir_ga_client_id');
1868
+							$access_type = "&access_type=offline";
1869
+							$approval_prompt = "&approval_prompt=force";
1870 1870
 
1871
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1871
+							$auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1872 1872
 
1873 1873
 
1874
-                            ?>
1874
+							?>
1875 1875
                             <script>
1876 1876
                                 function gd_ga_popup() {
1877 1877
                                     var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
@@ -1886,47 +1886,47 @@  discard block
 block discarded – undo
1886 1886
                             </script>
1887 1887
 
1888 1888
                             <?php
1889
-                            if (get_option('gd_ga_refresh_token')) {
1890
-                                ?>
1889
+							if (get_option('gd_ga_refresh_token')) {
1890
+								?>
1891 1891
                                 <span class="button-primary"
1892 1892
                                       onclick="gd_ga_popup();"><?php _e('Re-authorize', 'geodirectory'); ?></span>
1893 1893
                                 <span
1894 1894
                                     style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1895 1895
                             <?php
1896
-                            } else {
1897
-                                ?>
1896
+							} else {
1897
+								?>
1898 1898
                                 <span class="button-primary"
1899 1899
                                       onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
1900 1900
                             <?php
1901
-                            }
1902
-                            ?>
1901
+							}
1902
+							?>
1903 1903
                         </td>
1904 1904
                     </tr>
1905 1905
 
1906 1906
                 <?php
1907
-                }
1907
+				}
1908 1908
 
1909
-                break;
1909
+				break;
1910 1910
 
1911
-            case 'field_seperator' :
1911
+			case 'field_seperator' :
1912 1912
 
1913
-                ?>
1913
+				?>
1914 1914
                 <tr valign="top">
1915 1915
                     <td colspan="2" class="forminp geodir_line_seperator"></td>
1916 1916
                 </tr>
1917 1917
                 <?php
1918 1918
 
1919
-                break;
1919
+				break;
1920 1920
 
1921
-        endswitch;
1921
+		endswitch;
1922 1922
 
1923
-    endforeach;
1923
+	endforeach;
1924 1924
 
1925
-    if ($first_title === false) {
1926
-        echo "</div>";
1927
-    }
1925
+	if ($first_title === false) {
1926
+		echo "</div>";
1927
+	}
1928 1928
 
1929
-    ?>
1929
+	?>
1930 1930
 
1931 1931
     <script type="text/javascript">
1932 1932
 
@@ -1986,33 +1986,33 @@  discard block
 block discarded – undo
1986 1986
  */
1987 1987
 function geodir_post_info_setting()
1988 1988
 {
1989
-    global $post, $post_id;
1990
-
1991
-    $post_type = get_post_type();
1992
-
1993
-    $package_info = array();
1994
-
1995
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1996
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1997
-    echo '<div id="geodir_wrapper">';
1998
-    /**
1999
-     * Called before the GD custom fields are output in the wp-admin area.
2000
-     *
2001
-     * @since 1.0.0
2002
-     * @see 'geodir_after_default_field_in_meta_box'
2003
-     */
2004
-    do_action('geodir_before_default_field_in_meta_box');
2005
-    //geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
2006
-    // to display all fields in one information box
2007
-    geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
2008
-    /**
2009
-     * Called after the GD custom fields are output in the wp-admin area.
2010
-     *
2011
-     * @since 1.0.0
2012
-     * @see 'geodir_before_default_field_in_meta_box'
2013
-     */
2014
-    do_action('geodir_after_default_field_in_meta_box');
2015
-    echo '</div>';
1989
+	global $post, $post_id;
1990
+
1991
+	$post_type = get_post_type();
1992
+
1993
+	$package_info = array();
1994
+
1995
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1996
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1997
+	echo '<div id="geodir_wrapper">';
1998
+	/**
1999
+	 * Called before the GD custom fields are output in the wp-admin area.
2000
+	 *
2001
+	 * @since 1.0.0
2002
+	 * @see 'geodir_after_default_field_in_meta_box'
2003
+	 */
2004
+	do_action('geodir_before_default_field_in_meta_box');
2005
+	//geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
2006
+	// to display all fields in one information box
2007
+	geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
2008
+	/**
2009
+	 * Called after the GD custom fields are output in the wp-admin area.
2010
+	 *
2011
+	 * @since 1.0.0
2012
+	 * @see 'geodir_before_default_field_in_meta_box'
2013
+	 */
2014
+	do_action('geodir_after_default_field_in_meta_box');
2015
+	echo '</div>';
2016 2016
 }
2017 2017
 
2018 2018
 /**
@@ -2025,18 +2025,18 @@  discard block
 block discarded – undo
2025 2025
  */
2026 2026
 function geodir_post_addinfo_setting()
2027 2027
 {
2028
-    global $post, $post_id;
2028
+	global $post, $post_id;
2029 2029
 
2030
-    $post_type = get_post_type();
2030
+	$post_type = get_post_type();
2031 2031
 
2032
-    $package_info = array();
2032
+	$package_info = array();
2033 2033
 
2034
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
2034
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
2035 2035
 
2036
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2037
-    echo '<div id="geodir_wrapper">';
2038
-    geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2039
-    echo '</div>';
2036
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2037
+	echo '<div id="geodir_wrapper">';
2038
+	geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2039
+	echo '</div>';
2040 2040
 
2041 2041
 }
2042 2042
 
@@ -2050,60 +2050,60 @@  discard block
 block discarded – undo
2050 2050
  */
2051 2051
 function geodir_post_attachments()
2052 2052
 {
2053
-    global $post, $post_id;
2053
+	global $post, $post_id;
2054 2054
 
2055
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2055
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2056 2056
 
2057
-    if (geodir_get_featured_image($post_id, 'thumbnail')) {
2058
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2059
-        geodir_show_featured_image($post_id, 'thumbnail');
2060
-    }
2057
+	if (geodir_get_featured_image($post_id, 'thumbnail')) {
2058
+		echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2059
+		geodir_show_featured_image($post_id, 'thumbnail');
2060
+	}
2061 2061
 
2062
-    $image_limit = 0;
2062
+	$image_limit = 0;
2063 2063
 
2064
-    ?>
2064
+	?>
2065 2065
 
2066 2066
 
2067 2067
     <h5 class="form_title">
2068 2068
         <?php if ($image_limit != 0 && $image_limit == 1) {
2069
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2070
-        } ?>
2069
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2070
+		} ?>
2071 2071
         <?php if ($image_limit != 0 && $image_limit > 1) {
2072
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2073
-        } ?>
2072
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2073
+		} ?>
2074 2074
         <?php if ($image_limit == 0) {
2075
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2076
-        } ?>
2075
+			echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2076
+		} ?>
2077 2077
     </h5>
2078 2078
 
2079 2079
 
2080 2080
     <?php
2081 2081
 
2082
-    $curImages = geodir_get_images($post_id);
2083
-    $place_img_array = array();
2082
+	$curImages = geodir_get_images($post_id);
2083
+	$place_img_array = array();
2084 2084
 
2085
-    if (!empty($curImages)):
2086
-        foreach ($curImages as $p_img):
2087
-            $place_img_array[] = $p_img->src;
2088
-        endforeach;
2089
-    endif;
2085
+	if (!empty($curImages)):
2086
+		foreach ($curImages as $p_img):
2087
+			$place_img_array[] = $p_img->src;
2088
+		endforeach;
2089
+	endif;
2090 2090
 
2091
-    if (!empty($place_img_array))
2092
-        $curImages = implode(',', $place_img_array);
2091
+	if (!empty($place_img_array))
2092
+		$curImages = implode(',', $place_img_array);
2093 2093
 
2094 2094
 
2095
-    // adjust values here
2096
-    $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
2095
+	// adjust values here
2096
+	$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
2097 2097
 
2098
-    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2098
+	$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2099 2099
 
2100
-    $multiple = true; // allow multiple files upload
2100
+	$multiple = true; // allow multiple files upload
2101 2101
 
2102
-    $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2102
+	$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2103 2103
 
2104
-    $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2104
+	$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2105 2105
 
2106
-    ?>
2106
+	?>
2107 2107
 
2108 2108
     <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;">
2109 2109
         <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/>
@@ -2145,13 +2145,13 @@  discard block
 block discarded – undo
2145 2145
  */
2146 2146
 function geodir_action_post_updated($post_ID, $post_after, $post_before)
2147 2147
 {
2148
-    $post_type = get_post_type($post_ID);
2148
+	$post_type = get_post_type($post_ID);
2149 2149
 
2150
-    if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2151
-        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) {
2152
-            geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2153
-        }
2154
-    }
2150
+	if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2151
+		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) {
2152
+			geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2153
+		}
2154
+	}
2155 2155
 }
2156 2156
 
2157 2157
 /**
@@ -2166,39 +2166,39 @@  discard block
 block discarded – undo
2166 2166
  */
2167 2167
 function geodir_notification_add_bcc_option($settings)
2168 2168
 {
2169
-    if (!empty($settings)) {
2170
-        $new_settings = array();
2171
-        foreach ($settings as $setting) {
2172
-            if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2173
-                $geodir_bcc_listing_published_yes = array(
2174
-                    'name' => __('Listing published', 'geodirectory'),
2175
-                    'desc' => __('Yes', 'geodirectory'),
2176
-                    'id' => 'geodir_bcc_listing_published',
2177
-                    'std' => 'yes',
2178
-                    'type' => 'radio',
2179
-                    'value' => '1',
2180
-                    'radiogroup' => 'start'
2181
-                );
2182
-
2183
-                $geodir_bcc_listing_published_no = array(
2184
-                    'name' => __('Listing published', 'geodirectory'),
2185
-                    'desc' => __('No', 'geodirectory'),
2186
-                    'id' => 'geodir_bcc_listing_published',
2187
-                    'std' => 'yes',
2188
-                    'type' => 'radio',
2189
-                    'value' => '0',
2190
-                    'radiogroup' => 'end'
2191
-                );
2192
-
2193
-                $new_settings[] = $geodir_bcc_listing_published_yes;
2194
-                $new_settings[] = $geodir_bcc_listing_published_no;
2195
-            }
2196
-            $new_settings[] = $setting;
2197
-        }
2198
-        $settings = $new_settings;
2199
-    }
2169
+	if (!empty($settings)) {
2170
+		$new_settings = array();
2171
+		foreach ($settings as $setting) {
2172
+			if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2173
+				$geodir_bcc_listing_published_yes = array(
2174
+					'name' => __('Listing published', 'geodirectory'),
2175
+					'desc' => __('Yes', 'geodirectory'),
2176
+					'id' => 'geodir_bcc_listing_published',
2177
+					'std' => 'yes',
2178
+					'type' => 'radio',
2179
+					'value' => '1',
2180
+					'radiogroup' => 'start'
2181
+				);
2182
+
2183
+				$geodir_bcc_listing_published_no = array(
2184
+					'name' => __('Listing published', 'geodirectory'),
2185
+					'desc' => __('No', 'geodirectory'),
2186
+					'id' => 'geodir_bcc_listing_published',
2187
+					'std' => 'yes',
2188
+					'type' => 'radio',
2189
+					'value' => '0',
2190
+					'radiogroup' => 'end'
2191
+				);
2192
+
2193
+				$new_settings[] = $geodir_bcc_listing_published_yes;
2194
+				$new_settings[] = $geodir_bcc_listing_published_no;
2195
+			}
2196
+			$new_settings[] = $setting;
2197
+		}
2198
+		$settings = $new_settings;
2199
+	}
2200 2200
 
2201
-    return $settings;
2201
+	return $settings;
2202 2202
 }
2203 2203
 
2204 2204
 
@@ -2213,19 +2213,19 @@  discard block
 block discarded – undo
2213 2213
  */
2214 2214
 function get_gd_theme_compat_callback()
2215 2215
 {
2216
-    global $wpdb;
2217
-    $themes = get_option('gd_theme_compats');
2218
-
2219
-    if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2220
-        if (isset($_POST['export'])) {
2221
-            echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2222
-        } else {
2223
-            echo json_encode($themes[$_POST['theme']]);
2224
-        }
2216
+	global $wpdb;
2217
+	$themes = get_option('gd_theme_compats');
2225 2218
 
2226
-    }
2219
+	if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2220
+		if (isset($_POST['export'])) {
2221
+			echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2222
+		} else {
2223
+			echo json_encode($themes[$_POST['theme']]);
2224
+		}
2225
+
2226
+	}
2227 2227
 
2228
-    die();
2228
+	die();
2229 2229
 }
2230 2230
 
2231 2231
 add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
@@ -2239,20 +2239,20 @@  discard block
 block discarded – undo
2239 2239
  */
2240 2240
 function get_gd_theme_compat_import_callback()
2241 2241
 {
2242
-    global $wpdb;
2243
-    $themes = get_option('gd_theme_compats');
2244
-    if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2245
-        $json = json_decode(stripslashes($_POST['theme']), true);
2246
-        if (!empty($json) && is_array($json)) {
2247
-            $key = sanitize_text_field(key($json));
2248
-            $themes[$key] = $json[$key];
2249
-            update_option('gd_theme_compats', $themes);
2250
-            echo $key;
2251
-            die();
2252
-        }
2253
-    }
2254
-    echo '0';
2255
-    die();
2242
+	global $wpdb;
2243
+	$themes = get_option('gd_theme_compats');
2244
+	if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2245
+		$json = json_decode(stripslashes($_POST['theme']), true);
2246
+		if (!empty($json) && is_array($json)) {
2247
+			$key = sanitize_text_field(key($json));
2248
+			$themes[$key] = $json[$key];
2249
+			update_option('gd_theme_compats', $themes);
2250
+			echo $key;
2251
+			die();
2252
+		}
2253
+	}
2254
+	echo '0';
2255
+	die();
2256 2256
 }
2257 2257
 
2258 2258
 
@@ -2265,39 +2265,39 @@  discard block
 block discarded – undo
2265 2265
  */
2266 2266
 function gd_set_theme_compat()
2267 2267
 {
2268
-    global $wpdb;
2269
-    $theme = wp_get_theme();
2268
+	global $wpdb;
2269
+	$theme = wp_get_theme();
2270 2270
 
2271
-    if ($theme->parent()) {
2272
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2273
-    } else {
2274
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
2275
-    }
2271
+	if ($theme->parent()) {
2272
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2273
+	} else {
2274
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
2275
+	}
2276 2276
 
2277
-    $theme_compats = get_option('gd_theme_compats');
2278
-    $current_compat = get_option('gd_theme_compat');
2279
-    $current_compat = str_replace("_custom", "", $current_compat);
2277
+	$theme_compats = get_option('gd_theme_compats');
2278
+	$current_compat = get_option('gd_theme_compat');
2279
+	$current_compat = str_replace("_custom", "", $current_compat);
2280 2280
 
2281
-    if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2282
-        return;
2283
-    }// if already running correct compat then bail
2281
+	if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2282
+		return;
2283
+	}// if already running correct compat then bail
2284 2284
 
2285
-    if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2286
-        update_option('gd_theme_compat', $theme_name);
2287
-        update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2285
+	if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2286
+		update_option('gd_theme_compat', $theme_name);
2287
+		update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2288 2288
 
2289
-        // if there are default options to set then set them
2290
-        if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2289
+		// if there are default options to set then set them
2290
+		if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2291 2291
 
2292
-            foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2293
-                update_option($key, $val);
2294
-            }
2295
-        }
2292
+			foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2293
+				update_option($key, $val);
2294
+			}
2295
+		}
2296 2296
 
2297
-    } else {
2298
-        update_option('gd_theme_compat', '');
2299
-        update_option('theme_compatibility_setting', '');
2300
-    }
2297
+	} else {
2298
+		update_option('gd_theme_compat', '');
2299
+		update_option('theme_compatibility_setting', '');
2300
+	}
2301 2301
 
2302 2302
 
2303 2303
 }
@@ -2312,9 +2312,9 @@  discard block
 block discarded – undo
2312 2312
  */
2313 2313
 function gd_check_avada_compat()
2314 2314
 {
2315
-    if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2316
-        add_action('admin_notices', 'gd_avada_compat_warning');
2317
-    }
2315
+	if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2316
+		add_action('admin_notices', 'gd_avada_compat_warning');
2317
+	}
2318 2318
 }
2319 2319
 
2320 2320
 
@@ -2327,22 +2327,22 @@  discard block
 block discarded – undo
2327 2327
 function gd_avada_compat_warning()
2328 2328
 {
2329 2329
 
2330
-    /*
2330
+	/*
2331 2331
     $msg_type = error
2332 2332
     $msg_type = updated fade
2333 2333
     $msg_type = update-nag
2334 2334
     */
2335 2335
 
2336
-    $plugin = 'avada-nag';
2337
-    $timestamp = 'avada-nag1234';
2338
-    $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');
2339
-    echo '<div id="' . $timestamp . '"  class="error">';
2340
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2341
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2342
-    echo "<p>$message</p>";
2343
-    echo "</div>";
2336
+	$plugin = 'avada-nag';
2337
+	$timestamp = 'avada-nag1234';
2338
+	$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');
2339
+	echo '<div id="' . $timestamp . '"  class="error">';
2340
+	echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2341
+	echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2342
+	echo "<p>$message</p>";
2343
+	echo "</div>";
2344 2344
 
2345
-    ?>
2345
+	?>
2346 2346
     <script>
2347 2347
         function gdRemoveANotification($plugin, $timestamp) {
2348 2348
 
@@ -2410,10 +2410,10 @@  discard block
 block discarded – undo
2410 2410
  */
2411 2411
 function geodir_avada_remove_notification()
2412 2412
 {
2413
-    update_option('avada_nag', TRUE);
2413
+	update_option('avada_nag', TRUE);
2414 2414
 
2415
-    // Always die in functions echoing ajax content
2416
-    die();
2415
+	// Always die in functions echoing ajax content
2416
+	die();
2417 2417
 }
2418 2418
 
2419 2419
 
@@ -2435,9 +2435,9 @@  discard block
 block discarded – undo
2435 2435
 	global $post, $typenow, $current_screen;
2436 2436
 	
2437 2437
 	$post_type = NULL;
2438
-    if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2438
+	if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2439 2439
 		$post_type = get_post_type($_REQUEST['post']);
2440
-    elseif ($post && isset($post->post_type))
2440
+	elseif ($post && isset($post->post_type))
2441 2441
 		$post_type = $post->post_type;
2442 2442
 	elseif ($typenow)
2443 2443
 		$post_type = $typenow;
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
 		// Don't allow same slug url for listing and location
2473 2473
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2474 2474
 			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2475
-        	wp_redirect($redirect_url);
2475
+			wp_redirect($redirect_url);
2476 2476
 			exit;
2477 2477
 		}
2478 2478
 		
@@ -2502,10 +2502,10 @@  discard block
 block discarded – undo
2502 2502
  * @package GeoDirectory
2503 2503
  */
2504 2504
 function geodir_hide_admin_preview_button() {
2505
-    global $post_type;
2506
-    $post_types = geodir_get_posttypes();
2507
-    if(in_array($post_type, $post_types))
2508
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2505
+	global $post_type;
2506
+	$post_types = geodir_get_posttypes();
2507
+	if(in_array($post_type, $post_types))
2508
+		echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2509 2509
 }
2510 2510
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2511 2511
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
@@ -2520,7 +2520,7 @@  discard block
 block discarded – undo
2520 2520
  */
2521 2521
 function geodir_import_export_tab( $tabs ) {
2522 2522
 	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2523
-    return $tabs;
2523
+	return $tabs;
2524 2524
 }
2525 2525
 
2526 2526
 /**
@@ -2535,26 +2535,26 @@  discard block
 block discarded – undo
2535 2535
 function geodir_import_export_page() {
2536 2536
 	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2537 2537
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2538
-    /**
2539
-     * Filter sample category data csv file url.
2540
-     *
2541
-     * @since 1.0.0
2542
-     * @package GeoDirectory
2543
-     *
2544
-     * @param string $gd_cats_sample_csv Sample category data csv file url.
2545
-     */
2538
+	/**
2539
+	 * Filter sample category data csv file url.
2540
+	 *
2541
+	 * @since 1.0.0
2542
+	 * @package GeoDirectory
2543
+	 *
2544
+	 * @param string $gd_cats_sample_csv Sample category data csv file url.
2545
+	 */
2546 2546
 	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2547 2547
 	
2548 2548
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2549
-    /**
2550
-     * Filter sample post data csv file url.
2551
-     *
2552
-     * @since 1.0.0
2553
-     * @package GeoDirectory
2554
-     *
2555
-     * @param string $gd_posts_sample_csv Sample post data csv file url.
2556
-     */
2557
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2549
+	/**
2550
+	 * Filter sample post data csv file url.
2551
+	 *
2552
+	 * @since 1.0.0
2553
+	 * @package GeoDirectory
2554
+	 *
2555
+	 * @param string $gd_posts_sample_csv Sample post data csv file url.
2556
+	 */
2557
+	$gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2558 2558
 	
2559 2559
 	$gd_posttypes = geodir_get_posttypes( 'array' );
2560 2560
 	
@@ -2577,14 +2577,14 @@  discard block
 block discarded – undo
2577 2577
 	$gd_chunksize_options[100000] = 100000;
2578 2578
 	 
2579 2579
 	 /**
2580
-     * Filter max entries per export csv file.
2581
-     *
2582
-     * @since 1.5.6
2583
-     * @package GeoDirectory
2584
-     *
2585
-     * @param string $gd_chunksize_options Entries options.
2586
-     */
2587
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2580
+	  * Filter max entries per export csv file.
2581
+	  *
2582
+	  * @since 1.5.6
2583
+	  * @package GeoDirectory
2584
+	  *
2585
+	  * @param string $gd_chunksize_options Entries options.
2586
+	  */
2587
+	$gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2588 2588
 	
2589 2589
 	$gd_chunksize_option = '';
2590 2590
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2600,12 +2600,12 @@  discard block
 block discarded – undo
2600 2600
   <div class="gd-content-heading">
2601 2601
 
2602 2602
   <?php
2603
-    ini_set('max_execution_time', 999999);
2604
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2605
-    ini_restore('max_execution_time');
2603
+	ini_set('max_execution_time', 999999);
2604
+	$ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2605
+	ini_restore('max_execution_time');
2606 2606
 
2607
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2608
-        ?>
2607
+	if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2608
+		?>
2609 2609
 	<div id="gd_ie_reqs" class="metabox-holder">
2610 2610
       <div class="meta-box-sortables ui-sortable">
2611 2611
         <div class="postbox">
@@ -2778,7 +2778,7 @@  discard block
 block discarded – undo
2778 2778
 						 * Called just after the sample CSV download link.
2779 2779
 						 *
2780 2780
 						 * @since 1.0.0
2781
-                         * @package GeoDirectory
2781
+						 * @package GeoDirectory
2782 2782
 						 */
2783 2783
 						do_action('geodir_sample_cats_csv_download_link');
2784 2784
 						?>
@@ -2863,11 +2863,11 @@  discard block
 block discarded – undo
2863 2863
 	 *
2864 2864
 	 * Called after the last setting on the GD > Import & Export page.
2865 2865
 	 * @since 1.4.6
2866
-     * @package GeoDirectory
2866
+	 * @package GeoDirectory
2867 2867
 	 *
2868 2868
 	 * @param array $gd_posttypes GD post types.
2869
-     * @param array $gd_chunksize_options File chunk size options.
2870
-     * @param string $nonce Wordpress security token for GD import & export.
2869
+	 * @param array $gd_chunksize_options File chunk size options.
2870
+	 * @param string $nonce Wordpress security token for GD import & export.
2871 2871
 	 */
2872 2872
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2873 2873
 	?>
@@ -3554,44 +3554,44 @@  discard block
 block discarded – undo
3554 3554
 function geodir_init_filesystem()
3555 3555
 {
3556 3556
 
3557
-    if(!function_exists('get_filesystem_method')){
3558
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3559
-    }
3560
-    $access_type = get_filesystem_method();
3561
-    if ($access_type === 'direct') {
3562
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3563
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3564
-
3565
-        /* initialize the API */
3566
-        if (!WP_Filesystem($creds)) {
3567
-            /* any problems and we exit */
3568
-            //return '@@@3';
3569
-            return false;
3570
-        }
3571
-
3572
-        global $wp_filesystem;
3573
-        return $wp_filesystem;
3574
-        /* do our file manipulations below */
3575
-    } elseif (defined('FTP_USER')) {
3576
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3557
+	if(!function_exists('get_filesystem_method')){
3558
+		require_once(ABSPATH."/wp-admin/includes/file.php");
3559
+	}
3560
+	$access_type = get_filesystem_method();
3561
+	if ($access_type === 'direct') {
3562
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3563
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3564
+
3565
+		/* initialize the API */
3566
+		if (!WP_Filesystem($creds)) {
3567
+			/* any problems and we exit */
3568
+			//return '@@@3';
3569
+			return false;
3570
+		}
3577 3571
 
3578
-        /* initialize the API */
3579
-        if (!WP_Filesystem($creds)) {
3580
-            /* any problems and we exit */
3581
-            //return '@@@33';
3582
-            return false;
3583
-        }
3572
+		global $wp_filesystem;
3573
+		return $wp_filesystem;
3574
+		/* do our file manipulations below */
3575
+	} elseif (defined('FTP_USER')) {
3576
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3577
+
3578
+		/* initialize the API */
3579
+		if (!WP_Filesystem($creds)) {
3580
+			/* any problems and we exit */
3581
+			//return '@@@33';
3582
+			return false;
3583
+		}
3584 3584
 
3585
-        global $wp_filesystem;
3586
-        //return '@@@1';
3587
-        return $wp_filesystem;
3585
+		global $wp_filesystem;
3586
+		//return '@@@1';
3587
+		return $wp_filesystem;
3588 3588
 
3589
-    } else {
3590
-        //return '@@@2';
3591
-        /* don't have direct write access. Prompt user with our notice */
3592
-        add_action('admin_notice', 'geodir_filesystem_notice');
3593
-        return false;
3594
-    }
3589
+	} else {
3590
+		//return '@@@2';
3591
+		/* don't have direct write access. Prompt user with our notice */
3592
+		add_action('admin_notice', 'geodir_filesystem_notice');
3593
+		return false;
3594
+	}
3595 3595
 
3596 3596
 }
3597 3597
 
@@ -3609,10 +3609,10 @@  discard block
 block discarded – undo
3609 3609
  */
3610 3610
 function geodir_filesystem_notice()
3611 3611
 {   if ( defined( 'DOING_AJAX' ) ){return;}
3612
-    $access_type = get_filesystem_method();
3613
-    if ($access_type === 'direct') {
3614
-    } elseif (!defined('FTP_USER')) {
3615
-        ?>
3612
+	$access_type = get_filesystem_method();
3613
+	if ($access_type === 'direct') {
3614
+	} elseif (!defined('FTP_USER')) {
3615
+		?>
3616 3616
         <div class="error">
3617 3617
             <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'); ?>
3618 3618
                 <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>
@@ -3638,1243 +3638,1243 @@  discard block
 block discarded – undo
3638 3638
  * @return string Json data.
3639 3639
  */
3640 3640
 function geodir_ajax_import_export() {
3641
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3641
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3642 3642
     
3643
-    error_reporting(0);
3643
+	error_reporting(0);
3644 3644
 
3645
-    // try to set higher limits for import
3646
-    $max_input_time = ini_get('max_input_time');
3647
-    $max_execution_time = ini_get('max_execution_time');
3648
-    $memory_limit= ini_get('memory_limit');
3645
+	// try to set higher limits for import
3646
+	$max_input_time = ini_get('max_input_time');
3647
+	$max_execution_time = ini_get('max_execution_time');
3648
+	$memory_limit= ini_get('memory_limit');
3649 3649
 
3650
-    if(!$max_input_time || $max_input_time<3000){
3651
-        ini_set('max_input_time', 3000);
3652
-    }
3650
+	if(!$max_input_time || $max_input_time<3000){
3651
+		ini_set('max_input_time', 3000);
3652
+	}
3653 3653
 
3654
-    if(!$max_execution_time || $max_execution_time<3000){
3655
-        ini_set('max_execution_time', 3000);
3656
-    }
3654
+	if(!$max_execution_time || $max_execution_time<3000){
3655
+		ini_set('max_execution_time', 3000);
3656
+	}
3657 3657
 
3658
-    if($memory_limit && str_replace('M','',$memory_limit)){
3659
-        if(str_replace('M','',$memory_limit)<256){
3660
-            ini_set('memory_limit', '256M');
3661
-        }
3662
-    }
3658
+	if($memory_limit && str_replace('M','',$memory_limit)){
3659
+		if(str_replace('M','',$memory_limit)<256){
3660
+			ini_set('memory_limit', '256M');
3661
+		}
3662
+	}
3663 3663
 
3664
-    $json = array();
3664
+	$json = array();
3665 3665
 
3666
-    if ( !current_user_can( 'manage_options' ) ) {
3667
-        wp_send_json( $json );
3668
-    }
3666
+	if ( !current_user_can( 'manage_options' ) ) {
3667
+		wp_send_json( $json );
3668
+	}
3669 3669
 
3670
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3671
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3672
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3670
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3671
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3672
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3673 3673
 
3674
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3675
-        wp_send_json( $json );
3676
-    }
3674
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3675
+		wp_send_json( $json );
3676
+	}
3677 3677
 
3678
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3679
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3680
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3681
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3678
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3679
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3680
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3681
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3682 3682
 
3683
-    $wp_filesystem = geodir_init_filesystem();
3684
-    if (!$wp_filesystem) {
3685
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3686
-        wp_send_json( $json );
3687
-    }
3683
+	$wp_filesystem = geodir_init_filesystem();
3684
+	if (!$wp_filesystem) {
3685
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3686
+		wp_send_json( $json );
3687
+	}
3688 3688
 
3689
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3690
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3691
-        wp_send_json( $json );
3692
-    }
3689
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3690
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3691
+		wp_send_json( $json );
3692
+	}
3693 3693
 
3694
-    $csv_file_dir = geodir_path_import_export( false );
3695
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3696
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3697
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3698
-            wp_send_json( $json );
3699
-        }
3700
-    }
3694
+	$csv_file_dir = geodir_path_import_export( false );
3695
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3696
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3697
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3698
+			wp_send_json( $json );
3699
+		}
3700
+	}
3701 3701
     
3702
-    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3703
-    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3704
-
3705
-    switch ( $task ) {
3706
-        case 'export_posts': {
3707
-            // WPML
3708
-            $is_wpml = geodir_is_wpml();
3709
-            if ($is_wpml) {
3710
-                global $sitepress;
3711
-                $active_lang = ICL_LANGUAGE_CODE;
3702
+	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3703
+	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3704
+
3705
+	switch ( $task ) {
3706
+		case 'export_posts': {
3707
+			// WPML
3708
+			$is_wpml = geodir_is_wpml();
3709
+			if ($is_wpml) {
3710
+				global $sitepress;
3711
+				$active_lang = ICL_LANGUAGE_CODE;
3712 3712
                 
3713
-                $sitepress->switch_lang('all', true);
3714
-            }
3715
-            // WPML
3716
-            if ( $post_type == 'gd_event' ) {
3717
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3718
-            }
3719
-            $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3713
+				$sitepress->switch_lang('all', true);
3714
+			}
3715
+			// WPML
3716
+			if ( $post_type == 'gd_event' ) {
3717
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3718
+			}
3719
+			$filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3720 3720
             
3721
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3722
-            if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3723
-                $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3724
-            }
3725
-            $posts_count = geodir_get_posts_count( $post_type );
3726
-            $file_url_base = geodir_path_import_export() . '/';
3727
-            $file_url = $file_url_base . $file_name . '.csv';
3728
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3729
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3721
+			$file_name = $post_type . '_' . date( 'dmyHi' );
3722
+			if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3723
+				$file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3724
+			}
3725
+			$posts_count = geodir_get_posts_count( $post_type );
3726
+			$file_url_base = geodir_path_import_export() . '/';
3727
+			$file_url = $file_url_base . $file_name . '.csv';
3728
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3729
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3730 3730
             
3731
-            $chunk_file_paths = array();
3731
+			$chunk_file_paths = array();
3732 3732
 
3733
-            if ( isset( $_REQUEST['_c'] ) ) {
3734
-                $json['total'] = $posts_count;
3735
-                // WPML
3736
-                if ($is_wpml) {
3737
-                    $sitepress->switch_lang($active_lang, true);
3738
-                }
3739
-                // WPML
3740
-                wp_send_json( $json );
3741
-                gd_die();
3742
-            } else if ( isset( $_REQUEST['_st'] ) ) {
3743
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3744
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3745
-                $percentage = min( $percentage, 100 );
3733
+			if ( isset( $_REQUEST['_c'] ) ) {
3734
+				$json['total'] = $posts_count;
3735
+				// WPML
3736
+				if ($is_wpml) {
3737
+					$sitepress->switch_lang($active_lang, true);
3738
+				}
3739
+				// WPML
3740
+				wp_send_json( $json );
3741
+				gd_die();
3742
+			} else if ( isset( $_REQUEST['_st'] ) ) {
3743
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3744
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3745
+				$percentage = min( $percentage, 100 );
3746 3746
                 
3747
-                $json['percentage'] = $percentage;
3748
-                // WPML
3749
-                if ($is_wpml) {
3750
-                    $sitepress->switch_lang($active_lang, true);
3751
-                }
3752
-                // WPML
3753
-                wp_send_json( $json );
3754
-                gd_die();
3755
-            } else {
3756
-                if ( !$posts_count > 0 ) {
3757
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3758
-                } else {
3759
-                    $total_posts = $posts_count;
3760
-                    if ($chunk_per_page > $total_posts) {
3761
-                        $chunk_per_page = $total_posts;
3762
-                    }
3763
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3747
+				$json['percentage'] = $percentage;
3748
+				// WPML
3749
+				if ($is_wpml) {
3750
+					$sitepress->switch_lang($active_lang, true);
3751
+				}
3752
+				// WPML
3753
+				wp_send_json( $json );
3754
+				gd_die();
3755
+			} else {
3756
+				if ( !$posts_count > 0 ) {
3757
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3758
+				} else {
3759
+					$total_posts = $posts_count;
3760
+					if ($chunk_per_page > $total_posts) {
3761
+						$chunk_per_page = $total_posts;
3762
+					}
3763
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3764 3764
                     
3765
-                    $j = $chunk_page_no;
3766
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3765
+					$j = $chunk_page_no;
3766
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3767 3767
                     
3768
-                    $per_page = 500;
3769
-                    if ($per_page > $chunk_per_page) {
3770
-                        $per_page = $chunk_per_page;
3771
-                    }
3772
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3768
+					$per_page = 500;
3769
+					if ($per_page > $chunk_per_page) {
3770
+						$per_page = $chunk_per_page;
3771
+					}
3772
+					$total_pages = ceil( $chunk_per_page / $per_page );
3773 3773
                     
3774
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3775
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3774
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3775
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3776 3776
                         
3777
-                        $clear = $i == 0 ? true : false;
3778
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3779
-                    }
3777
+						$clear = $i == 0 ? true : false;
3778
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3779
+					}
3780 3780
                         
3781
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3782
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3783
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3784
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3785
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3781
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3782
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3783
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3784
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3785
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3786 3786
                         
3787
-                        $file_url = $file_url_base . $chunk_file_name;
3788
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3789
-                    }
3787
+						$file_url = $file_url_base . $chunk_file_name;
3788
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3789
+					}
3790 3790
                     
3791
-                    if ( !empty($chunk_file_paths) ) {
3792
-                        $json['total'] = $posts_count;
3793
-                        $json['files'] = $chunk_file_paths;
3794
-                    } else {
3795
-                        if ($j > 1) {
3796
-                            $json['total'] = $posts_count;
3797
-                            $json['files'] = array();
3798
-                        } else {
3799
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3800
-                        }
3801
-                    }
3802
-                }
3803
-                // WPML
3804
-                if ($is_wpml) {
3805
-                    $sitepress->switch_lang($active_lang, true);
3806
-                }
3807
-                // WPML
3808
-                wp_send_json( $json );
3809
-            }
3810
-        }
3811
-        break;
3812
-        case 'export_cats': {
3813
-            // WPML
3814
-            $is_wpml = geodir_is_wpml();
3815
-            if ($is_wpml) {
3816
-                global $sitepress;
3817
-                $active_lang = ICL_LANGUAGE_CODE;
3791
+					if ( !empty($chunk_file_paths) ) {
3792
+						$json['total'] = $posts_count;
3793
+						$json['files'] = $chunk_file_paths;
3794
+					} else {
3795
+						if ($j > 1) {
3796
+							$json['total'] = $posts_count;
3797
+							$json['files'] = array();
3798
+						} else {
3799
+							$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3800
+						}
3801
+					}
3802
+				}
3803
+				// WPML
3804
+				if ($is_wpml) {
3805
+					$sitepress->switch_lang($active_lang, true);
3806
+				}
3807
+				// WPML
3808
+				wp_send_json( $json );
3809
+			}
3810
+		}
3811
+		break;
3812
+		case 'export_cats': {
3813
+			// WPML
3814
+			$is_wpml = geodir_is_wpml();
3815
+			if ($is_wpml) {
3816
+				global $sitepress;
3817
+				$active_lang = ICL_LANGUAGE_CODE;
3818 3818
                 
3819
-                $sitepress->switch_lang('all', true);
3820
-            }
3821
-            // WPML
3822
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3819
+				$sitepress->switch_lang('all', true);
3820
+			}
3821
+			// WPML
3822
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
3823 3823
             
3824
-            $terms_count = geodir_get_terms_count( $post_type );
3825
-            $file_url_base = geodir_path_import_export() . '/';
3826
-            $file_url = $file_url_base . $file_name . '.csv';
3827
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3828
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3824
+			$terms_count = geodir_get_terms_count( $post_type );
3825
+			$file_url_base = geodir_path_import_export() . '/';
3826
+			$file_url = $file_url_base . $file_name . '.csv';
3827
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3828
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3829 3829
             
3830
-            $chunk_file_paths = array();
3830
+			$chunk_file_paths = array();
3831 3831
             
3832
-            if ( isset( $_REQUEST['_st'] ) ) {
3833
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3834
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3835
-                $percentage = min( $percentage, 100 );
3832
+			if ( isset( $_REQUEST['_st'] ) ) {
3833
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3834
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3835
+				$percentage = min( $percentage, 100 );
3836 3836
                 
3837
-                $json['percentage'] = $percentage;
3838
-                // WPML
3839
-                if ($is_wpml) {
3840
-                    $sitepress->switch_lang($active_lang, true);
3841
-                }
3842
-                // WPML
3843
-                wp_send_json( $json );
3844
-            } else {
3845
-                if ( !$terms_count > 0 ) {
3846
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3847
-                } else {
3848
-                    $total_terms = $terms_count;
3849
-                    if ($chunk_per_page > $terms_count) {
3850
-                        $chunk_per_page = $terms_count;
3851
-                    }
3852
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3837
+				$json['percentage'] = $percentage;
3838
+				// WPML
3839
+				if ($is_wpml) {
3840
+					$sitepress->switch_lang($active_lang, true);
3841
+				}
3842
+				// WPML
3843
+				wp_send_json( $json );
3844
+			} else {
3845
+				if ( !$terms_count > 0 ) {
3846
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3847
+				} else {
3848
+					$total_terms = $terms_count;
3849
+					if ($chunk_per_page > $terms_count) {
3850
+						$chunk_per_page = $terms_count;
3851
+					}
3852
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3853 3853
                     
3854
-                    $j = $chunk_page_no;
3855
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3854
+					$j = $chunk_page_no;
3855
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3856 3856
                     
3857
-                    $per_page = 500;
3858
-                    if ($per_page > $chunk_per_page) {
3859
-                        $per_page = $chunk_per_page;
3860
-                    }
3861
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3857
+					$per_page = 500;
3858
+					if ($per_page > $chunk_per_page) {
3859
+						$per_page = $chunk_per_page;
3860
+					}
3861
+					$total_pages = ceil( $chunk_per_page / $per_page );
3862 3862
                     
3863
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3864
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3863
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3864
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3865 3865
                         
3866
-                        $clear = $i == 0 ? true : false;
3867
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3868
-                    }
3866
+						$clear = $i == 0 ? true : false;
3867
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3868
+					}
3869 3869
                     
3870
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3871
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3872
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3873
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3874
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3870
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3871
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3872
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3873
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3874
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3875 3875
                         
3876
-                        $file_url = $file_url_base . $chunk_file_name;
3877
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3878
-                    }
3876
+						$file_url = $file_url_base . $chunk_file_name;
3877
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3878
+					}
3879 3879
                     
3880
-                    if ( !empty($chunk_file_paths) ) {
3881
-                        $json['total'] = $terms_count;
3882
-                        $json['files'] = $chunk_file_paths;
3883
-                    } else {
3884
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3885
-                    }
3886
-                }
3887
-                // WPML
3888
-                if ($is_wpml) {
3889
-                    $sitepress->switch_lang($active_lang, true);
3890
-                }
3891
-                // WPML
3892
-                wp_send_json( $json );
3893
-            }
3894
-        }
3895
-        break;
3896
-        case 'export_locations': {
3897
-            $file_url_base = geodir_path_import_export() . '/';
3898
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3899
-            $file_url = $file_url_base . $file_name . '.csv';
3900
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3901
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3880
+					if ( !empty($chunk_file_paths) ) {
3881
+						$json['total'] = $terms_count;
3882
+						$json['files'] = $chunk_file_paths;
3883
+					} else {
3884
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3885
+					}
3886
+				}
3887
+				// WPML
3888
+				if ($is_wpml) {
3889
+					$sitepress->switch_lang($active_lang, true);
3890
+				}
3891
+				// WPML
3892
+				wp_send_json( $json );
3893
+			}
3894
+		}
3895
+		break;
3896
+		case 'export_locations': {
3897
+			$file_url_base = geodir_path_import_export() . '/';
3898
+			$file_name = 'gd_locations_' . date( 'dmyHi' );
3899
+			$file_url = $file_url_base . $file_name . '.csv';
3900
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3901
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3902 3902
             
3903
-            $items_count = (int)geodir_location_imex_count_locations();
3903
+			$items_count = (int)geodir_location_imex_count_locations();
3904 3904
             
3905
-            if ( isset( $_REQUEST['_st'] ) ) {
3906
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3907
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3908
-                $percentage = min( $percentage, 100 );
3905
+			if ( isset( $_REQUEST['_st'] ) ) {
3906
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3907
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3908
+				$percentage = min( $percentage, 100 );
3909 3909
                 
3910
-                $json['percentage'] = $percentage;
3911
-                wp_send_json( $json );
3912
-            } else {
3913
-                $chunk_file_paths = array();
3910
+				$json['percentage'] = $percentage;
3911
+				wp_send_json( $json );
3912
+			} else {
3913
+				$chunk_file_paths = array();
3914 3914
                 
3915
-                if ( !$items_count > 0 ) {
3916
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3917
-                } else {
3918
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3919
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3915
+				if ( !$items_count > 0 ) {
3916
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3917
+				} else {
3918
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3919
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3920 3920
                     
3921
-                    $j = $chunk_page_no;
3922
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3921
+					$j = $chunk_page_no;
3922
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3923 3923
                     
3924
-                    $per_page = 500;
3925
-                    $per_page = min( $per_page, $chunk_per_page );
3926
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3924
+					$per_page = 500;
3925
+					$per_page = min( $per_page, $chunk_per_page );
3926
+					$total_pages = ceil( $chunk_per_page / $per_page );
3927 3927
                     
3928
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3929
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3928
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3929
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3930 3930
                         
3931
-                        $clear = $i == 0 ? true : false;
3932
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3933
-                    }
3931
+						$clear = $i == 0 ? true : false;
3932
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3933
+					}
3934 3934
                     
3935
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3936
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3937
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3938
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3939
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3935
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3936
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3937
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3938
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3939
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3940 3940
                         
3941
-                        $file_url = $file_url_base . $chunk_file_name;
3942
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3943
-                    }
3941
+						$file_url = $file_url_base . $chunk_file_name;
3942
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3943
+					}
3944 3944
                     
3945
-                    if ( !empty($chunk_file_paths) ) {
3946
-                        $json['total'] = $items_count;
3947
-                        $json['files'] = $chunk_file_paths;
3948
-                    } else {
3949
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3950
-                    }
3951
-                }
3952
-                wp_send_json( $json );
3953
-            }
3954
-        }
3955
-        break;
3956
-        case 'export_hoods': {
3957
-            $file_url_base = geodir_path_import_export() . '/';
3958
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3959
-            $file_url = $file_url_base . $file_name . '.csv';
3960
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3961
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3945
+					if ( !empty($chunk_file_paths) ) {
3946
+						$json['total'] = $items_count;
3947
+						$json['files'] = $chunk_file_paths;
3948
+					} else {
3949
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3950
+					}
3951
+				}
3952
+				wp_send_json( $json );
3953
+			}
3954
+		}
3955
+		break;
3956
+		case 'export_hoods': {
3957
+			$file_url_base = geodir_path_import_export() . '/';
3958
+			$file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3959
+			$file_url = $file_url_base . $file_name . '.csv';
3960
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3961
+			$file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3962 3962
             
3963
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3963
+			$items_count = (int)geodir_location_imex_count_neighbourhoods();
3964 3964
             
3965
-            if ( isset( $_REQUEST['_st'] ) ) {
3966
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3967
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3968
-                $percentage = min( $percentage, 100 );
3965
+			if ( isset( $_REQUEST['_st'] ) ) {
3966
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3967
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3968
+				$percentage = min( $percentage, 100 );
3969 3969
                 
3970
-                $json['percentage'] = $percentage;
3971
-                wp_send_json( $json );
3972
-            } else {
3973
-                $chunk_file_paths = array();
3970
+				$json['percentage'] = $percentage;
3971
+				wp_send_json( $json );
3972
+			} else {
3973
+				$chunk_file_paths = array();
3974 3974
                 
3975
-                if ( !$items_count > 0 ) {
3976
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3977
-                } else {
3978
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3979
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3975
+				if ( !$items_count > 0 ) {
3976
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3977
+				} else {
3978
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3979
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3980 3980
                     
3981
-                    $j = $chunk_page_no;
3982
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3981
+					$j = $chunk_page_no;
3982
+					$chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3983 3983
                     
3984
-                    $per_page = 500;
3985
-                    $per_page = min( $per_page, $chunk_per_page );
3986
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3984
+					$per_page = 500;
3985
+					$per_page = min( $per_page, $chunk_per_page );
3986
+					$total_pages = ceil( $chunk_per_page / $per_page );
3987 3987
                     
3988
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3989
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3988
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3989
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3990 3990
                         
3991
-                        $clear = $i == 0 ? true : false;
3992
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3993
-                    }
3991
+						$clear = $i == 0 ? true : false;
3992
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3993
+					}
3994 3994
                     
3995
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3996
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3997
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3998
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3999
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3995
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3996
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3997
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3998
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3999
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
4000 4000
                         
4001
-                        $file_url = $file_url_base . $chunk_file_name;
4002
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4003
-                    }
4001
+						$file_url = $file_url_base . $chunk_file_name;
4002
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4003
+					}
4004 4004
                     
4005
-                    if ( !empty($chunk_file_paths) ) {
4006
-                        $json['total'] = $items_count;
4007
-                        $json['files'] = $chunk_file_paths;
4008
-                    } else {
4009
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
4010
-                    }
4011
-                }
4012
-                wp_send_json( $json );
4013
-            }
4014
-        }
4015
-        break;
4016
-        case 'prepare_import':
4017
-        case 'import_cat':
4018
-        case 'import_post':
4019
-        case 'import_loc':
4020
-        case 'import_hood': {
4021
-            // WPML
4022
-            $is_wpml = geodir_is_wpml();
4023
-            if ($is_wpml) {
4024
-                global $sitepress;
4025
-                $active_lang = ICL_LANGUAGE_CODE;
4026
-            }
4027
-            // WPML
4005
+					if ( !empty($chunk_file_paths) ) {
4006
+						$json['total'] = $items_count;
4007
+						$json['files'] = $chunk_file_paths;
4008
+					} else {
4009
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
4010
+					}
4011
+				}
4012
+				wp_send_json( $json );
4013
+			}
4014
+		}
4015
+		break;
4016
+		case 'prepare_import':
4017
+		case 'import_cat':
4018
+		case 'import_post':
4019
+		case 'import_loc':
4020
+		case 'import_hood': {
4021
+			// WPML
4022
+			$is_wpml = geodir_is_wpml();
4023
+			if ($is_wpml) {
4024
+				global $sitepress;
4025
+				$active_lang = ICL_LANGUAGE_CODE;
4026
+			}
4027
+			// WPML
4028 4028
             
4029
-            ini_set( 'auto_detect_line_endings', true );
4029
+			ini_set( 'auto_detect_line_endings', true );
4030 4030
             
4031
-            $uploads = wp_upload_dir();
4032
-            $uploads_dir = $uploads['path'];
4033
-            $uploads_subdir = $uploads['subdir'];
4031
+			$uploads = wp_upload_dir();
4032
+			$uploads_dir = $uploads['path'];
4033
+			$uploads_subdir = $uploads['subdir'];
4034 4034
             
4035
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
4036
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
4035
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
4036
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
4037 4037
             
4038
-            $csv_file_arr = explode( '/', $csv_file );
4039
-            $csv_filename = end( $csv_file_arr );
4040
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
4038
+			$csv_file_arr = explode( '/', $csv_file );
4039
+			$csv_filename = end( $csv_file_arr );
4040
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
4041 4041
             
4042
-            $json['file'] = $csv_file;
4043
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
4044
-            $file = array();
4042
+			$json['file'] = $csv_file;
4043
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
4044
+			$file = array();
4045 4045
 
4046
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
4047
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
4046
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
4047
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
4048 4048
                 
4049
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4050
-                    $json['error'] = NULL;
4051
-                    $json['rows'] = 0;
4049
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4050
+					$json['error'] = NULL;
4051
+					$json['rows'] = 0;
4052 4052
                     
4053
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4054
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4055
-                            if ( !empty( $data ) ) {
4056
-                                $file[] = $data;
4057
-                            }
4058
-                        }
4059
-                        fclose($handle);
4060
-                    }
4053
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4054
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4055
+							if ( !empty( $data ) ) {
4056
+								$file[] = $data;
4057
+							}
4058
+						}
4059
+						fclose($handle);
4060
+					}
4061 4061
 
4062
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4062
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4063 4063
                     
4064
-                    if (!$json['rows'] > 0) {
4065
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
4066
-                    }
4067
-                } else {
4068
-                    wp_send_json( $json );
4069
-                }
4070
-            } else {
4071
-                wp_send_json( $json );
4072
-            }
4064
+					if (!$json['rows'] > 0) {
4065
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
4066
+					}
4067
+				} else {
4068
+					wp_send_json( $json );
4069
+				}
4070
+			} else {
4071
+				wp_send_json( $json );
4072
+			}
4073 4073
             
4074
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4075
-                wp_send_json( $json );
4076
-            }
4074
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4075
+				wp_send_json( $json );
4076
+			}
4077 4077
             
4078
-            $total = $json['rows'];
4079
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4080
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4078
+			$total = $json['rows'];
4079
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4080
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4081 4081
             
4082
-            $count = $limit;
4082
+			$count = $limit;
4083 4083
             
4084
-            if ($count < $total) {
4085
-                $count = $processed + $count;
4086
-                if ($count > $total) {
4087
-                    $count = $total;
4088
-                }
4089
-            } else {
4090
-                $count = $total;
4091
-            }
4084
+			if ($count < $total) {
4085
+				$count = $processed + $count;
4086
+				if ($count > $total) {
4087
+					$count = $total;
4088
+				}
4089
+			} else {
4090
+				$count = $total;
4091
+			}
4092 4092
             
4093
-            $created = 0;
4094
-            $updated = 0;
4095
-            $skipped = 0;
4096
-            $invalid = 0;
4097
-            $invalid_addr = 0;
4098
-            $images = 0;
4093
+			$created = 0;
4094
+			$updated = 0;
4095
+			$skipped = 0;
4096
+			$invalid = 0;
4097
+			$invalid_addr = 0;
4098
+			$images = 0;
4099 4099
             
4100
-            $gd_post_info = array();
4101
-            $countpost = 0;
4100
+			$gd_post_info = array();
4101
+			$countpost = 0;
4102 4102
             
4103
-            $post_types = geodir_get_posttypes();
4103
+			$post_types = geodir_get_posttypes();
4104 4104
 
4105
-            if ( $task == 'import_cat' ) {
4106
-                if (!empty($file)) {
4107
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4105
+			if ( $task == 'import_cat' ) {
4106
+				if (!empty($file)) {
4107
+					$columns = isset($file[0]) ? $file[0] : NULL;
4108 4108
                     
4109
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4110
-                        $json['error'] = CSV_INVAILD_FILE;
4111
-                        wp_send_json( $json );
4112
-                        exit;
4113
-                    }
4109
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4110
+						$json['error'] = CSV_INVAILD_FILE;
4111
+						wp_send_json( $json );
4112
+						exit;
4113
+					}
4114 4114
                     
4115
-                    $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
4115
+					$gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
4116 4116
                     
4117
-                    for ($i = 1; $i <= $limit; $i++) {
4118
-                        $index = $processed + $i;
4117
+					for ($i = 1; $i <= $limit; $i++) {
4118
+						$index = $processed + $i;
4119 4119
                         
4120
-                        if (isset($file[$index])) {
4121
-                            $row = $file[$index];
4122
-                            $row = array_map( 'trim', $row );
4123
-                            //$row = array_map( 'utf8_encode', $row );
4120
+						if (isset($file[$index])) {
4121
+							$row = $file[$index];
4122
+							$row = array_map( 'trim', $row );
4123
+							//$row = array_map( 'utf8_encode', $row );
4124 4124
                             
4125
-                            $cat_id = '';
4126
-                            $cat_name = '';
4127
-                            $cat_slug = '';
4128
-                            $cat_posttype = '';
4129
-                            $cat_parent = '';
4130
-                            $cat_description = '';
4131
-                            $cat_schema = '';
4132
-                            $cat_top_description = '';
4133
-                            $cat_image = '';
4134
-                            $cat_icon = '';
4135
-                            $cat_language = '';
4136
-                            $cat_id_original = '';
4125
+							$cat_id = '';
4126
+							$cat_name = '';
4127
+							$cat_slug = '';
4128
+							$cat_posttype = '';
4129
+							$cat_parent = '';
4130
+							$cat_description = '';
4131
+							$cat_schema = '';
4132
+							$cat_top_description = '';
4133
+							$cat_image = '';
4134
+							$cat_icon = '';
4135
+							$cat_language = '';
4136
+							$cat_id_original = '';
4137 4137
                             
4138
-                            $c = 0;
4139
-                            foreach ($columns as $column ) {
4140
-                                if ( $column == 'cat_id' ) {
4141
-                                    $cat_id = (int)$row[$c];
4142
-                                } else if ( $column == 'cat_name' ) {
4143
-                                    $cat_name = $row[$c];
4144
-                                } else if ( $column == 'cat_slug' ) {
4145
-                                    $cat_slug = $row[$c];
4146
-                                } else if ( $column == 'cat_posttype' ) {
4147
-                                    $cat_posttype = $row[$c];
4148
-                                } else if ( $column == 'cat_parent' ) {
4149
-                                    $cat_parent = trim($row[$c]);
4150
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4151
-                                    $cat_schema = $row[$c];
4152
-                                } else if ( $column == 'cat_description' ) {
4153
-                                    $cat_description = $row[$c];
4154
-                                } else if ( $column == 'cat_top_description' ) {
4155
-                                    $cat_top_description = $row[$c];
4156
-                                } else if ( $column == 'cat_image' ) {
4157
-                                    $cat_image = $row[$c];
4158
-                                } else if ( $column == 'cat_icon' ) {
4159
-                                    $cat_icon = $row[$c];
4160
-                                }
4161
-                                // WPML
4162
-                                if ( $is_wpml ) {
4163
-                                    if ( $column == 'cat_language' ) {
4164
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
4165
-                                    } else if ( $column == 'cat_id_original' ) {
4166
-                                        $cat_id_original = (int)$row[$c];
4167
-                                    }
4168
-                                }
4169
-                                // WPML
4170
-                                $c++;
4171
-                            }
4138
+							$c = 0;
4139
+							foreach ($columns as $column ) {
4140
+								if ( $column == 'cat_id' ) {
4141
+									$cat_id = (int)$row[$c];
4142
+								} else if ( $column == 'cat_name' ) {
4143
+									$cat_name = $row[$c];
4144
+								} else if ( $column == 'cat_slug' ) {
4145
+									$cat_slug = $row[$c];
4146
+								} else if ( $column == 'cat_posttype' ) {
4147
+									$cat_posttype = $row[$c];
4148
+								} else if ( $column == 'cat_parent' ) {
4149
+									$cat_parent = trim($row[$c]);
4150
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4151
+									$cat_schema = $row[$c];
4152
+								} else if ( $column == 'cat_description' ) {
4153
+									$cat_description = $row[$c];
4154
+								} else if ( $column == 'cat_top_description' ) {
4155
+									$cat_top_description = $row[$c];
4156
+								} else if ( $column == 'cat_image' ) {
4157
+									$cat_image = $row[$c];
4158
+								} else if ( $column == 'cat_icon' ) {
4159
+									$cat_icon = $row[$c];
4160
+								}
4161
+								// WPML
4162
+								if ( $is_wpml ) {
4163
+									if ( $column == 'cat_language' ) {
4164
+										$cat_language = geodir_strtolower( trim( $row[$c] ) );
4165
+									} else if ( $column == 'cat_id_original' ) {
4166
+										$cat_id_original = (int)$row[$c];
4167
+									}
4168
+								}
4169
+								// WPML
4170
+								$c++;
4171
+							}
4172 4172
                             
4173
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4174
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4173
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4174
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4175 4175
                                 
4176
-                                $invalid++;
4177
-                                continue;
4178
-                            }
4176
+								$invalid++;
4177
+								continue;
4178
+							}
4179 4179
                             
4180
-                            // WPML
4181
-                            if ($is_wpml && $cat_language != '') {
4182
-                                $sitepress->switch_lang($cat_language, true);
4183
-                            }
4184
-                            // WPML
4180
+							// WPML
4181
+							if ($is_wpml && $cat_language != '') {
4182
+								$sitepress->switch_lang($cat_language, true);
4183
+							}
4184
+							// WPML
4185 4185
                                                         
4186
-                            $term_data = array();
4187
-                            $term_data['name'] = $cat_name;
4188
-                            $term_data['slug'] = $cat_slug;
4189
-                            $term_data['description'] = $cat_description;
4190
-                            $term_data['cat_schema'] = $cat_schema;
4191
-                            $term_data['top_description'] = $cat_top_description;
4192
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4193
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4186
+							$term_data = array();
4187
+							$term_data['name'] = $cat_name;
4188
+							$term_data['slug'] = $cat_slug;
4189
+							$term_data['description'] = $cat_description;
4190
+							$term_data['cat_schema'] = $cat_schema;
4191
+							$term_data['top_description'] = $cat_top_description;
4192
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4193
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4194 4194
                             
4195
-                            //$term_data = array_map( 'utf8_encode', $term_data );
4195
+							//$term_data = array_map( 'utf8_encode', $term_data );
4196 4196
                             
4197
-                            $taxonomy = $cat_posttype . 'category';
4197
+							$taxonomy = $cat_posttype . 'category';
4198 4198
                             
4199
-                            $term_data['taxonomy'] = $taxonomy;
4199
+							$term_data['taxonomy'] = $taxonomy;
4200 4200
 
4201
-                            $term_parent_id = 0;
4202
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4203
-                                $term_parent = '';
4201
+							$term_parent_id = 0;
4202
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
4203
+								$term_parent = '';
4204 4204
                                 
4205
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4206
-                                    //
4207
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4208
-                                    //
4209
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4210
-                                    //
4211
-                                } else {
4212
-                                    $term_parent_data = array();
4213
-                                    $term_parent_data['name'] = $cat_parent;
4214
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4215
-                                    $term_parent_data['taxonomy'] = $taxonomy;
4205
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4206
+									//
4207
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4208
+									//
4209
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4210
+									//
4211
+								} else {
4212
+									$term_parent_data = array();
4213
+									$term_parent_data['name'] = $cat_parent;
4214
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4215
+									$term_parent_data['taxonomy'] = $taxonomy;
4216 4216
                                     
4217
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4218
-                                }
4217
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4218
+								}
4219 4219
                                 
4220
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4221
-                                    $term_parent_id = (int)$term_parent->term_id;
4222
-                                }
4223
-                            }
4224
-                            $term_data['parent'] = (int)$term_parent_id;
4220
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4221
+									$term_parent_id = (int)$term_parent->term_id;
4222
+								}
4223
+							}
4224
+							$term_data['parent'] = (int)$term_parent_id;
4225 4225
 
4226
-                            $term_id = NULL;
4227
-                            if ( $import_choice == 'update' ) {
4228
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4229
-                                    $term_data['term_id'] = $term['term_id'];
4226
+							$term_id = NULL;
4227
+							if ( $import_choice == 'update' ) {
4228
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4229
+									$term_data['term_id'] = $term['term_id'];
4230 4230
                                     
4231
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4232
-                                        $updated++;
4233
-                                    } else {
4234
-                                        $invalid++;
4235
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4236
-                                    }
4237
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4238
-                                    $term_data['term_id'] = $term['term_id'];
4231
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4232
+										$updated++;
4233
+									} else {
4234
+										$invalid++;
4235
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4236
+									}
4237
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4238
+									$term_data['term_id'] = $term['term_id'];
4239 4239
                                     
4240
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4241
-                                        $updated++;
4242
-                                    } else {
4243
-                                        $invalid++;
4244
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4245
-                                    }
4246
-                                } else {
4247
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4248
-                                        $created++;
4249
-                                    } else {
4250
-                                        $invalid++;
4251
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4252
-                                    }
4253
-                                }
4254
-                            } else if ( $import_choice == 'skip' ) {
4255
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4256
-                                    $skipped++;
4257
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4258
-                                    $skipped++;
4259
-                                } else {
4260
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4261
-                                        $created++;
4262
-                                    } else {
4263
-                                        $invalid++;
4264
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4265
-                                    }
4266
-                                }
4267
-                            } else {
4268
-                                $invalid++;
4269
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4270
-                            }
4240
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4241
+										$updated++;
4242
+									} else {
4243
+										$invalid++;
4244
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4245
+									}
4246
+								} else {
4247
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4248
+										$created++;
4249
+									} else {
4250
+										$invalid++;
4251
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4252
+									}
4253
+								}
4254
+							} else if ( $import_choice == 'skip' ) {
4255
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4256
+									$skipped++;
4257
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4258
+									$skipped++;
4259
+								} else {
4260
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4261
+										$created++;
4262
+									} else {
4263
+										$invalid++;
4264
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4265
+									}
4266
+								}
4267
+							} else {
4268
+								$invalid++;
4269
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4270
+							}
4271 4271
                             
4272
-                            if ( $term_id ) {
4273
-                                // WPML
4274
-                                if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
4275
-                                    $wpml_element_type = 'tax_' . $taxonomy;
4276
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
4277
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4278
-
4279
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
4272
+							if ( $term_id ) {
4273
+								// WPML
4274
+								if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
4275
+									$wpml_element_type = 'tax_' . $taxonomy;
4276
+									$source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
4277
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4278
+
4279
+									$trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
4280 4280
                                     
4281
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
4282
-                                }
4283
-                                // WPML
4281
+									$sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
4282
+								}
4283
+								// WPML
4284 4284
                                 
4285
-                                if ( isset( $term_data['top_description'] ) ) {
4286
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4287
-                                }
4285
+								if ( isset( $term_data['top_description'] ) ) {
4286
+									update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4287
+								}
4288 4288
                                 
4289
-                                if ( isset( $term_data['cat_schema'] ) ) {
4290
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4291
-                                }
4289
+								if ( isset( $term_data['cat_schema'] ) ) {
4290
+									update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4291
+								}
4292 4292
             
4293
-                                $attachment = false;
4294
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4295
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4296
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4293
+								$attachment = false;
4294
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4295
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4296
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4297 4297
                                     
4298
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4299
-                                        $attachment = true;
4300
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4301
-                                    }
4302
-                                }
4298
+									if ( basename($cat_image) != $term_data['image'] ) {
4299
+										$attachment = true;
4300
+										update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4301
+									}
4302
+								}
4303 4303
                                 
4304
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4305
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4306
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4304
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4305
+									$cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4306
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4307 4307
                                         
4308
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4309
-                                        $attachment = true;
4310
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4311
-                                    }
4312
-                                }
4308
+									if ( basename($cat_icon) != $term_data['icon'] ) {
4309
+										$attachment = true;
4310
+										update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4311
+									}
4312
+								}
4313 4313
                                 
4314
-                                if ( $attachment ) {
4315
-                                    $images++;
4316
-                                }
4317
-                            }
4314
+								if ( $attachment ) {
4315
+									$images++;
4316
+								}
4317
+							}
4318 4318
                             
4319
-                            // WPML
4320
-                            if ($is_wpml && $cat_language != '') {
4321
-                                $sitepress->switch_lang($active_lang, true);
4322
-                            }
4323
-                            // WPML
4324
-                        }
4325
-                    }
4326
-                }
4319
+							// WPML
4320
+							if ($is_wpml && $cat_language != '') {
4321
+								$sitepress->switch_lang($active_lang, true);
4322
+							}
4323
+							// WPML
4324
+						}
4325
+					}
4326
+				}
4327 4327
                 
4328
-                $json = array();
4329
-                $json['processed'] = $limit;
4330
-                $json['created'] = $created;
4331
-                $json['updated'] = $updated;
4332
-                $json['skipped'] = $skipped;
4333
-                $json['invalid'] = $invalid;
4334
-                $json['images'] = $images;
4328
+				$json = array();
4329
+				$json['processed'] = $limit;
4330
+				$json['created'] = $created;
4331
+				$json['updated'] = $updated;
4332
+				$json['skipped'] = $skipped;
4333
+				$json['invalid'] = $invalid;
4334
+				$json['images'] = $images;
4335 4335
                 
4336
-                wp_send_json( $json );
4337
-                exit;
4338
-            } else if ( $task == 'import_post' ) {
4339
-                //run some stuff to make the import quicker
4340
-                wp_defer_term_counting( true );
4341
-                wp_defer_comment_counting( true );
4342
-                $wpdb->query( 'SET autocommit = 0;' );
4343
-
4344
-                //remove_all_actions('publish_post');
4345
-                //remove_all_actions('transition_post_status');
4346
-                //remove_all_actions('publish_future_post');
4347
-
4348
-                if (!empty($file)) {
4349
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4350
-                    $default_status = 'publish';
4351
-                    $current_date = date_i18n( 'Y-m-d', time() );
4336
+				wp_send_json( $json );
4337
+				exit;
4338
+			} else if ( $task == 'import_post' ) {
4339
+				//run some stuff to make the import quicker
4340
+				wp_defer_term_counting( true );
4341
+				wp_defer_comment_counting( true );
4342
+				$wpdb->query( 'SET autocommit = 0;' );
4343
+
4344
+				//remove_all_actions('publish_post');
4345
+				//remove_all_actions('transition_post_status');
4346
+				//remove_all_actions('publish_future_post');
4347
+
4348
+				if (!empty($file)) {
4349
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4350
+					$default_status = 'publish';
4351
+					$current_date = date_i18n( 'Y-m-d', time() );
4352 4352
                     
4353
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4353
+					$columns = isset($file[0]) ? $file[0] : NULL;
4354 4354
                     
4355
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4356
-                        $json['error'] = CSV_INVAILD_FILE;
4357
-                        wp_send_json( $json );
4358
-                        exit;
4359
-                    }
4355
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4356
+						$json['error'] = CSV_INVAILD_FILE;
4357
+						wp_send_json( $json );
4358
+						exit;
4359
+					}
4360 4360
 
4361
-                    $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4362
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4363
-                    $processed_actual = 0;
4364
-                    for ($i = 1; $i <= $limit; $i++) {
4365
-                        $index = $processed + $i;
4366
-                        $gd_post = array();
4361
+					$gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4362
+					$wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4363
+					$processed_actual = 0;
4364
+					for ($i = 1; $i <= $limit; $i++) {
4365
+						$index = $processed + $i;
4366
+						$gd_post = array();
4367 4367
                         
4368
-                        if (isset($file[$index])) {
4369
-                            $processed_actual++;
4370
-                            $row = $file[$index];
4371
-                            $row = array_map( 'trim', $row );
4372
-                            //$row = array_map( 'utf8_encode', $row );
4373
-                            $row = array_map( 'addslashes_gpc', $row );
4368
+						if (isset($file[$index])) {
4369
+							$processed_actual++;
4370
+							$row = $file[$index];
4371
+							$row = array_map( 'trim', $row );
4372
+							//$row = array_map( 'utf8_encode', $row );
4373
+							$row = array_map( 'addslashes_gpc', $row );
4374 4374
                             
4375
-                            $post_id = '';
4376
-                            $post_title = '';
4377
-                            $post_author = '';
4378
-                            $post_content = '';
4379
-                            $post_category_arr = array();
4380
-                            $default_category = '';
4381
-                            $post_tags = array();
4382
-                            $post_type = '';
4383
-                            $post_status = '';
4384
-                            $geodir_video = '';
4385
-                            $post_address = '';
4386
-                            $post_city = '';
4387
-                            $post_region = '';
4388
-                            $post_country = '';
4389
-                            $post_zip = '';
4390
-                            $post_latitude = '';
4391
-                            $post_longitude = '';
4392
-                            $post_neighbourhood = '';
4393
-                            $neighbourhood_latitude = '';
4394
-                            $neighbourhood_longitude = '';
4395
-                            $geodir_timing = '';
4396
-                            $geodir_contact = '';
4397
-                            $geodir_email = '';
4398
-                            $geodir_website = '';
4399
-                            $geodir_twitter = '';
4400
-                            $geodir_facebook = '';
4401
-                            $geodir_twitter = '';
4402
-                            $post_images = array();
4375
+							$post_id = '';
4376
+							$post_title = '';
4377
+							$post_author = '';
4378
+							$post_content = '';
4379
+							$post_category_arr = array();
4380
+							$default_category = '';
4381
+							$post_tags = array();
4382
+							$post_type = '';
4383
+							$post_status = '';
4384
+							$geodir_video = '';
4385
+							$post_address = '';
4386
+							$post_city = '';
4387
+							$post_region = '';
4388
+							$post_country = '';
4389
+							$post_zip = '';
4390
+							$post_latitude = '';
4391
+							$post_longitude = '';
4392
+							$post_neighbourhood = '';
4393
+							$neighbourhood_latitude = '';
4394
+							$neighbourhood_longitude = '';
4395
+							$geodir_timing = '';
4396
+							$geodir_contact = '';
4397
+							$geodir_email = '';
4398
+							$geodir_website = '';
4399
+							$geodir_twitter = '';
4400
+							$geodir_facebook = '';
4401
+							$geodir_twitter = '';
4402
+							$post_images = array();
4403 4403
                             
4404
-                            $expire_date = 'Never';
4404
+							$expire_date = 'Never';
4405 4405
                             
4406
-                            $language = '';
4407
-                            $original_post_id = '';
4406
+							$language = '';
4407
+							$original_post_id = '';
4408 4408
                                                         
4409
-                            $c = 0;
4410
-                            foreach ($columns as $column ) {
4411
-                                $gd_post[$column] = $row[$c];
4409
+							$c = 0;
4410
+							foreach ($columns as $column ) {
4411
+								$gd_post[$column] = $row[$c];
4412 4412
                                 
4413
-                                if ( $column == 'post_id' ) {
4414
-                                    $post_id = $row[$c];
4415
-                                } else if ( $column == 'post_title' ) {
4416
-                                    $post_title = sanitize_text_field($row[$c]);
4417
-                                } else if ( $column == 'post_author' ) {
4418
-                                    $post_author = $row[$c];
4419
-                                } else if ( $column == 'post_content' ) {
4420
-                                    $post_content = $row[$c];
4421
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4422
-                                    $post_category_arr = explode( ',', $row[$c] );
4423
-                                } else if ( $column == 'default_category' ) {
4424
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
4425
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4426
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4427
-                                } else if ( $column == 'post_type' ) {
4428
-                                    $post_type = $row[$c];
4429
-                                } else if ( $column == 'post_status' ) {
4430
-                                    $post_status = sanitize_key( $row[$c] );
4431
-                                } else if ( $column == 'is_featured' ) {
4432
-                                    $is_featured = (int)$row[$c];
4433
-                                } else if ( $column == 'geodir_video' ) {
4434
-                                    $geodir_video = $row[$c];
4435
-                                } else if ( $column == 'post_address' ) {
4436
-                                    $post_address = sanitize_text_field($row[$c]);
4437
-                                } else if ( $column == 'post_city' ) {
4438
-                                    $post_city = sanitize_text_field($row[$c]);
4439
-                                } else if ( $column == 'post_region' ) {
4440
-                                    $post_region = sanitize_text_field($row[$c]);
4441
-                                } else if ( $column == 'post_country' ) {
4442
-                                    $post_country = sanitize_text_field($row[$c]);
4443
-                                } else if ( $column == 'post_zip' ) {
4444
-                                    $post_zip = sanitize_text_field($row[$c]);
4445
-                                } else if ( $column == 'post_latitude' ) {
4446
-                                    $post_latitude = sanitize_text_field($row[$c]);
4447
-                                } else if ( $column == 'post_longitude' ) {
4448
-                                    $post_longitude = sanitize_text_field($row[$c]);
4449
-                                } else if ( $column == 'post_neighbourhood' ) {
4450
-                                    $post_neighbourhood = sanitize_text_field($row[$c]);
4451
-                                    unset($gd_post[$column]);
4452
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4453
-                                    $neighbourhood_latitude = sanitize_text_field($row[$c]);
4454
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4455
-                                    $neighbourhood_longitude = sanitize_text_field($row[$c]);
4456
-                                } else if ( $column == 'geodir_timing' ) {
4457
-                                    $geodir_timing = sanitize_text_field($row[$c]);
4458
-                                } else if ( $column == 'geodir_contact' ) {
4459
-                                    $geodir_contact = sanitize_text_field($row[$c]);
4460
-                                } else if ( $column == 'geodir_email' ) {
4461
-                                    $geodir_email = sanitize_email($row[$c]);
4462
-                                } else if ( $column == 'geodir_website' ) {
4463
-                                    $geodir_website = sanitize_text_field($row[$c]);
4464
-                                } else if ( $column == 'geodir_twitter' ) {
4465
-                                    $geodir_twitter = sanitize_text_field($row[$c]);
4466
-                                } else if ( $column == 'geodir_facebook' ) {
4467
-                                    $geodir_facebook = sanitize_text_field($row[$c]);
4468
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4469
-                                    $post_images[] = $row[$c];
4470
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4471
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4472
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4473
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
4474
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4475
-                                }
4476
-                                // WPML
4477
-                                if ($is_wpml) {
4478
-                                    if ($column == 'language') {
4479
-                                        $language = geodir_strtolower(trim($row[$c]));
4480
-                                    } else if ($column == 'original_post_id') {
4481
-                                        $original_post_id = (int)$row[$c];
4482
-                                    }
4483
-                                }
4484
-                                // WPML
4485
-                                $c++;
4486
-                            }
4413
+								if ( $column == 'post_id' ) {
4414
+									$post_id = $row[$c];
4415
+								} else if ( $column == 'post_title' ) {
4416
+									$post_title = sanitize_text_field($row[$c]);
4417
+								} else if ( $column == 'post_author' ) {
4418
+									$post_author = $row[$c];
4419
+								} else if ( $column == 'post_content' ) {
4420
+									$post_content = $row[$c];
4421
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
4422
+									$post_category_arr = explode( ',', $row[$c] );
4423
+								} else if ( $column == 'default_category' ) {
4424
+									$default_category = wp_kses_normalize_entities($row[$c]);
4425
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
4426
+									$post_tags = explode( ',', sanitize_text_field($row[$c]) );
4427
+								} else if ( $column == 'post_type' ) {
4428
+									$post_type = $row[$c];
4429
+								} else if ( $column == 'post_status' ) {
4430
+									$post_status = sanitize_key( $row[$c] );
4431
+								} else if ( $column == 'is_featured' ) {
4432
+									$is_featured = (int)$row[$c];
4433
+								} else if ( $column == 'geodir_video' ) {
4434
+									$geodir_video = $row[$c];
4435
+								} else if ( $column == 'post_address' ) {
4436
+									$post_address = sanitize_text_field($row[$c]);
4437
+								} else if ( $column == 'post_city' ) {
4438
+									$post_city = sanitize_text_field($row[$c]);
4439
+								} else if ( $column == 'post_region' ) {
4440
+									$post_region = sanitize_text_field($row[$c]);
4441
+								} else if ( $column == 'post_country' ) {
4442
+									$post_country = sanitize_text_field($row[$c]);
4443
+								} else if ( $column == 'post_zip' ) {
4444
+									$post_zip = sanitize_text_field($row[$c]);
4445
+								} else if ( $column == 'post_latitude' ) {
4446
+									$post_latitude = sanitize_text_field($row[$c]);
4447
+								} else if ( $column == 'post_longitude' ) {
4448
+									$post_longitude = sanitize_text_field($row[$c]);
4449
+								} else if ( $column == 'post_neighbourhood' ) {
4450
+									$post_neighbourhood = sanitize_text_field($row[$c]);
4451
+									unset($gd_post[$column]);
4452
+								} else if ( $column == 'neighbourhood_latitude' ) {
4453
+									$neighbourhood_latitude = sanitize_text_field($row[$c]);
4454
+								} else if ( $column == 'neighbourhood_longitude' ) {
4455
+									$neighbourhood_longitude = sanitize_text_field($row[$c]);
4456
+								} else if ( $column == 'geodir_timing' ) {
4457
+									$geodir_timing = sanitize_text_field($row[$c]);
4458
+								} else if ( $column == 'geodir_contact' ) {
4459
+									$geodir_contact = sanitize_text_field($row[$c]);
4460
+								} else if ( $column == 'geodir_email' ) {
4461
+									$geodir_email = sanitize_email($row[$c]);
4462
+								} else if ( $column == 'geodir_website' ) {
4463
+									$geodir_website = sanitize_text_field($row[$c]);
4464
+								} else if ( $column == 'geodir_twitter' ) {
4465
+									$geodir_twitter = sanitize_text_field($row[$c]);
4466
+								} else if ( $column == 'geodir_facebook' ) {
4467
+									$geodir_facebook = sanitize_text_field($row[$c]);
4468
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4469
+									$post_images[] = $row[$c];
4470
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4471
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4472
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4473
+									$row[$c] = str_replace('/', '-', $row[$c]);
4474
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4475
+								}
4476
+								// WPML
4477
+								if ($is_wpml) {
4478
+									if ($column == 'language') {
4479
+										$language = geodir_strtolower(trim($row[$c]));
4480
+									} else if ($column == 'original_post_id') {
4481
+										$original_post_id = (int)$row[$c];
4482
+									}
4483
+								}
4484
+								// WPML
4485
+								$c++;
4486
+							}
4487 4487
                             
4488
-                            // WPML
4489
-                            if ($is_wpml && $language != '') {
4490
-                                $sitepress->switch_lang($language, true);
4491
-                            }
4492
-                            // WPML
4488
+							// WPML
4489
+							if ($is_wpml && $language != '') {
4490
+								$sitepress->switch_lang($language, true);
4491
+							}
4492
+							// WPML
4493 4493
 
4494
-                            $gd_post['IMAGE'] = $post_images;
4494
+							$gd_post['IMAGE'] = $post_images;
4495 4495
                             
4496
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4497
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4496
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4497
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4498 4498
                                                                                                                 
4499
-                            $valid = true;
4499
+							$valid = true;
4500 4500
                             
4501
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4502
-                                $invalid++;
4503
-                                $valid = false;
4504
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4505
-                            }
4501
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4502
+								$invalid++;
4503
+								$valid = false;
4504
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4505
+							}
4506 4506
                             
4507
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4508
-                            if ( $location_allowed ) {
4509
-                                $location_result = geodir_get_default_location();
4510
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4511
-                                    $invalid_addr++;
4512
-                                    $valid = false;
4513
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4514
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4515
-                                    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 ) ) ) {
4516
-                                        $invalid_addr++;
4517
-                                        $valid = false;
4518
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4519
-                                    } else {
4520
-                                        if (!$location_manager) {
4521
-                                            $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.
4522
-                                        }
4523
-                                    }
4524
-                                }
4525
-                            }
4507
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4508
+							if ( $location_allowed ) {
4509
+								$location_result = geodir_get_default_location();
4510
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4511
+									$invalid_addr++;
4512
+									$valid = false;
4513
+									geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4514
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4515
+									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 ) ) ) {
4516
+										$invalid_addr++;
4517
+										$valid = false;
4518
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4519
+									} else {
4520
+										if (!$location_manager) {
4521
+											$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.
4522
+										}
4523
+									}
4524
+								}
4525
+							}
4526 4526
                             
4527
-                            if ( !$valid ) {
4528
-                                continue;
4529
-                            }
4527
+							if ( !$valid ) {
4528
+								continue;
4529
+							}
4530 4530
 
4531
-                            $cat_taxonomy = $post_type . 'category';
4532
-                            $tags_taxonomy = $post_type . '_tags';
4531
+							$cat_taxonomy = $post_type . 'category';
4532
+							$tags_taxonomy = $post_type . '_tags';
4533 4533
                             
4534
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4535
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
4536
-                            }
4534
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4535
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
4536
+							}
4537 4537
 
4538
-                            $post_category = array();
4539
-                            $default_category_id = NULL;
4540
-                            if ( !empty( $post_category_arr ) ) {
4541
-                                foreach ( $post_category_arr as $value ) {
4542
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4538
+							$post_category = array();
4539
+							$default_category_id = NULL;
4540
+							if ( !empty( $post_category_arr ) ) {
4541
+								foreach ( $post_category_arr as $value ) {
4542
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
4543 4543
                                     
4544
-                                    if ( $category_name != '' ) {
4545
-                                        $term_category = array();
4544
+									if ( $category_name != '' ) {
4545
+										$term_category = array();
4546 4546
                                         
4547
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4548
-                                            $term_category = $term;
4549
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4550
-                                            $term_category = $term;
4551
-                                        } else {
4552
-                                            $term_data = array();
4553
-                                            $term_data['name'] = $category_name;
4554
-                                            $term_data['taxonomy'] = $cat_taxonomy;
4547
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4548
+											$term_category = $term;
4549
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4550
+											$term_category = $term;
4551
+										} else {
4552
+											$term_data = array();
4553
+											$term_data['name'] = $category_name;
4554
+											$term_data['taxonomy'] = $cat_taxonomy;
4555 4555
                                             
4556
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4557
-                                            if ( $term_id ) {
4558
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4559
-                                            }
4560
-                                        }
4556
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4557
+											if ( $term_id ) {
4558
+												$term_category = get_term( $term_id, $cat_taxonomy );
4559
+											}
4560
+										}
4561 4561
                                         
4562
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4563
-                                            $post_category[] = intval($term_category->term_id);
4562
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4563
+											$post_category[] = intval($term_category->term_id);
4564 4564
                                             
4565
-                                            if ($category_name == $default_category) {
4566
-                                                $default_category_id = intval($term_category->term_id);
4567
-                                            }
4568
-                                        }
4569
-                                    }
4570
-                                }
4571
-                            }
4565
+											if ($category_name == $default_category) {
4566
+												$default_category_id = intval($term_category->term_id);
4567
+											}
4568
+										}
4569
+									}
4570
+								}
4571
+							}
4572 4572
 
4573
-                            $save_post = array();
4574
-                            $save_post['post_title'] = $post_title;
4575
-                            $save_post['post_content'] = $post_content;
4576
-                            $save_post['post_type'] = $post_type;
4577
-                            $save_post['post_author'] = $post_author;
4578
-                            $save_post['post_status'] = $post_status;
4579
-                            $save_post['post_category'] = $post_category;
4580
-                            $save_post['post_tags'] = $post_tags;
4581
-
4582
-                            $saved_post_id = NULL;
4583
-                            if ( $import_choice == 'update' ) {
4584
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4573
+							$save_post = array();
4574
+							$save_post['post_title'] = $post_title;
4575
+							$save_post['post_content'] = $post_content;
4576
+							$save_post['post_type'] = $post_type;
4577
+							$save_post['post_author'] = $post_author;
4578
+							$save_post['post_status'] = $post_status;
4579
+							$save_post['post_category'] = $post_category;
4580
+							$save_post['post_tags'] = $post_tags;
4581
+
4582
+							$saved_post_id = NULL;
4583
+							if ( $import_choice == 'update' ) {
4584
+								$gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4585 4585
                                 
4586
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4587
-                                    $save_post['ID'] = $post_id;
4586
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4587
+									$save_post['ID'] = $post_id;
4588 4588
                                     
4589
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4590
-                                        if ( is_wp_error( $saved_post_id ) ) {
4591
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4592
-                                            $saved_post_id = 0;
4593
-                                        } else {
4594
-                                            $saved_post_id = $post_id;
4595
-                                            $updated++;
4596
-                                        }
4597
-                                    }
4598
-                                } else {
4599
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4600
-                                        if ( is_wp_error( $saved_post_id ) ) {
4601
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4602
-                                            $saved_post_id = 0;
4603
-                                        } else {
4604
-                                            $created++;
4605
-                                        }
4606
-                                    }
4607
-                                }
4589
+									if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4590
+										if ( is_wp_error( $saved_post_id ) ) {
4591
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4592
+											$saved_post_id = 0;
4593
+										} else {
4594
+											$saved_post_id = $post_id;
4595
+											$updated++;
4596
+										}
4597
+									}
4598
+								} else {
4599
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4600
+										if ( is_wp_error( $saved_post_id ) ) {
4601
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4602
+											$saved_post_id = 0;
4603
+										} else {
4604
+											$created++;
4605
+										}
4606
+									}
4607
+								}
4608 4608
                                 
4609
-                                if ( !$saved_post_id > 0 ) {
4610
-                                    $invalid++;
4611
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4612
-                                }
4613
-                            } else if ( $import_choice == 'skip' ) {
4614
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4615
-                                    $skipped++;	
4616
-                                } else {
4617
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4618
-                                        if ( is_wp_error( $saved_post_id ) ) {
4619
-                                            $invalid++;
4609
+								if ( !$saved_post_id > 0 ) {
4610
+									$invalid++;
4611
+									geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4612
+								}
4613
+							} else if ( $import_choice == 'skip' ) {
4614
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4615
+									$skipped++;	
4616
+								} else {
4617
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4618
+										if ( is_wp_error( $saved_post_id ) ) {
4619
+											$invalid++;
4620 4620
                                             
4621
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4622
-                                            $saved_post_id = 0;
4623
-                                        } else {
4624
-                                            $created++;
4625
-                                        }
4626
-                                    } else {
4627
-                                        $invalid++;
4621
+											geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4622
+											$saved_post_id = 0;
4623
+										} else {
4624
+											$created++;
4625
+										}
4626
+									} else {
4627
+										$invalid++;
4628 4628
                                         
4629
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4630
-                                    }
4631
-                                }
4632
-                            } else {
4633
-                                $invalid++;
4629
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4630
+									}
4631
+								}
4632
+							} else {
4633
+								$invalid++;
4634 4634
                                 
4635
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4636
-                            }
4635
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4636
+							}
4637 4637
 
4638
-                            if ( (int)$saved_post_id > 0 ) {
4639
-                                // WPML
4640
-                                if ($is_wpml && $original_post_id > 0 && $language != '') {
4641
-                                    $wpml_post_type = 'post_' . $post_type;
4642
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4643
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4638
+							if ( (int)$saved_post_id > 0 ) {
4639
+								// WPML
4640
+								if ($is_wpml && $original_post_id > 0 && $language != '') {
4641
+									$wpml_post_type = 'post_' . $post_type;
4642
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4643
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4644 4644
 
4645
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4645
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4646 4646
                                     
4647
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4648
-                                }
4649
-                                // WPML
4650
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4647
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4648
+								}
4649
+								// WPML
4650
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
4651 4651
                                 
4652
-                                $gd_post['post_id'] = $saved_post_id;
4653
-                                $gd_post['ID'] = $saved_post_id;
4654
-                                $gd_post['post_tags'] = $post_tags;
4655
-                                $gd_post['post_title'] = $post_title;
4656
-                                $gd_post['post_status'] = $post_status;
4657
-                                $gd_post['submit_time'] = time();
4658
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4652
+								$gd_post['post_id'] = $saved_post_id;
4653
+								$gd_post['ID'] = $saved_post_id;
4654
+								$gd_post['post_tags'] = $post_tags;
4655
+								$gd_post['post_title'] = $post_title;
4656
+								$gd_post['post_status'] = $post_status;
4657
+								$gd_post['submit_time'] = time();
4658
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4659 4659
                                                     
4660
-                                // post location
4661
-                                $post_location_id = 0;
4662
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4663
-                                    $gd_post['post_neighbourhood'] = '';
4660
+								// post location
4661
+								$post_location_id = 0;
4662
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4663
+									$gd_post['post_neighbourhood'] = '';
4664 4664
                                     
4665
-                                    $post_location_info = array(
4666
-                                                                'city' => $post_city,
4667
-                                                                'region' => $post_region,
4668
-                                                                'country' => $post_country,
4669
-                                                                'geo_lat' => $post_latitude,
4670
-                                                                'geo_lng' => $post_longitude
4671
-                                                            );
4672
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4673
-                                        $post_location_id = $location_id;
4674
-                                    }
4665
+									$post_location_info = array(
4666
+																'city' => $post_city,
4667
+																'region' => $post_region,
4668
+																'country' => $post_country,
4669
+																'geo_lat' => $post_latitude,
4670
+																'geo_lng' => $post_longitude
4671
+															);
4672
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4673
+										$post_location_id = $location_id;
4674
+									}
4675 4675
                                     
4676
-                                    if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4677
-                                        $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4676
+									if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4677
+										$neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4678 4678
 
4679
-                                        $hood_data = array();
4680
-                                        $hood_data['hood_location_id'] = $post_location_id;
4681
-                                        $hood_data['hood_name'] = $post_neighbourhood;
4679
+										$hood_data = array();
4680
+										$hood_data['hood_location_id'] = $post_location_id;
4681
+										$hood_data['hood_name'] = $post_neighbourhood;
4682 4682
                                         
4683
-                                        if (!empty($neighbourhood_info)) {
4684
-                                            $hood_data['hood_id'] = $neighbourhood_info->hood_id;
4685
-                                            $hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4683
+										if (!empty($neighbourhood_info)) {
4684
+											$hood_data['hood_id'] = $neighbourhood_info->hood_id;
4685
+											$hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4686 4686
                                             
4687
-                                            if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4688
-                                                $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4689
-                                                $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4690
-                                            }
4691
-                                        }
4687
+											if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4688
+												$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4689
+												$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4690
+											}
4691
+										}
4692 4692
                                         
4693
-                                        if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4694
-                                            $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4695
-                                            $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4696
-                                        }
4693
+										if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4694
+											$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4695
+											$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4696
+										}
4697 4697
                                         
4698
-                                        $hood_data['hood_latitude'] = $post_latitude;
4699
-                                        $hood_data['hood_longitude'] = $post_longitude;
4698
+										$hood_data['hood_latitude'] = $post_latitude;
4699
+										$hood_data['hood_longitude'] = $post_longitude;
4700 4700
 
4701
-                                        $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4702
-                                        if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4703
-                                            $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4704
-                                        }
4705
-                                    }
4706
-                                }
4707
-                                $gd_post['post_location_id'] = $post_location_id;
4701
+										$neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4702
+										if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4703
+											$gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4704
+										}
4705
+									}
4706
+								}
4707
+								$gd_post['post_location_id'] = $post_location_id;
4708 4708
                                 
4709
-                                // post package info
4710
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4711
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4712
-                                    $package_id = $gd_post_info->package_id;
4713
-                                }
4709
+								// post package info
4710
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4711
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4712
+									$package_id = $gd_post_info->package_id;
4713
+								}
4714 4714
                                 
4715
-                                $package_info = array();
4716
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4717
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4715
+								$package_info = array();
4716
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4717
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
4718 4718
                                     
4719
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4720
-                                        $package_info = array();
4721
-                                    }
4722
-                                }
4719
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4720
+										$package_info = array();
4721
+									}
4722
+								}
4723 4723
                                 
4724
-                                if (empty($package_info)) {
4725
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4726
-                                }
4724
+								if (empty($package_info)) {
4725
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
4726
+								}
4727 4727
                                  
4728
-                                if (!empty($package_info))	 {
4729
-                                    $package_id = $package_info['pid'];
4728
+								if (!empty($package_info))	 {
4729
+									$package_id = $package_info['pid'];
4730 4730
                                     
4731
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4732
-                                        $gd_post['expire_date'] = $expire_date;
4733
-                                    } else {
4734
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4735
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4736
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4737
-                                        } else {
4738
-                                            $gd_post['expire_date'] = 'Never';
4739
-                                        }
4740
-                                    }
4731
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4732
+										$gd_post['expire_date'] = $expire_date;
4733
+									} else {
4734
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4735
+											$gd_post['alive_days'] = (int)$package_info['days'];
4736
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4737
+										} else {
4738
+											$gd_post['expire_date'] = 'Never';
4739
+										}
4740
+									}
4741 4741
                                     
4742
-                                    $gd_post['package_id'] = $package_id;
4743
-                                }
4742
+									$gd_post['package_id'] = $package_id;
4743
+								}
4744 4744
 
4745
-                                $table = $plugin_prefix . $post_type . '_detail';
4745
+								$table = $plugin_prefix . $post_type . '_detail';
4746 4746
                                 
4747
-                                if ($post_type == 'gd_event') {
4748
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
4749
-                                }
4747
+								if ($post_type == 'gd_event') {
4748
+									$gd_post = geodir_imex_process_event_data($gd_post);
4749
+								}
4750 4750
                                 
4751
-                                if (isset($gd_post['post_id'])) {
4752
-                                    unset($gd_post['post_id']);
4753
-                                }
4751
+								if (isset($gd_post['post_id'])) {
4752
+									unset($gd_post['post_id']);
4753
+								}
4754 4754
 
4755
-                                // Export franchise fields
4756
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4757
-                                if ($is_franchise_active) {
4758
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4759
-                                        $gd_franchise_lock = array();
4755
+								// Export franchise fields
4756
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4757
+								if ($is_franchise_active) {
4758
+									if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4759
+										$gd_franchise_lock = array();
4760 4760
                                         
4761
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4762
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4763
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4764
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4765
-                                        }
4761
+										if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4762
+											$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4763
+											$gd_franchise_lock = trim( $gd_franchise_lock );
4764
+											$gd_franchise_lock = explode( ",", $gd_franchise_lock );
4765
+										}
4766 4766
                                         
4767
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4768
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4769
-                                    } else {
4770
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4771
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4772
-                                        }
4773
-                                    }
4774
-                                }
4767
+										update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4768
+										update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4769
+									} else {
4770
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4771
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4772
+										}
4773
+									}
4774
+								}
4775 4775
                                 
4776
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4777
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4778
-                                    if ($default_category_id) {
4779
-                                        $save_post['post_default_category'] = $default_category_id;
4780
-                                        $gd_post['default_category'] = $default_category_id;
4781
-                                    }
4782
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
4783
-                                }
4776
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4777
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4778
+									if ($default_category_id) {
4779
+										$save_post['post_default_category'] = $default_category_id;
4780
+										$gd_post['default_category'] = $default_category_id;
4781
+									}
4782
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
4783
+								}
4784 4784
                                 
4785
-                                // Save post info
4786
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4787
-                                // post taxonomies
4788
-                                if ( !empty( $save_post['post_category'] ) ) {
4789
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4785
+								// Save post info
4786
+								geodir_save_post_info( $saved_post_id, $gd_post );
4787
+								// post taxonomies
4788
+								if ( !empty( $save_post['post_category'] ) ) {
4789
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4790 4790
                                     
4791
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4792
-                                    if ($default_category_id) {
4793
-                                        $post_default_category = $default_category_id;
4794
-                                    }
4795
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4796
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4797
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4791
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4792
+									if ($default_category_id) {
4793
+										$post_default_category = $default_category_id;
4794
+									}
4795
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4796
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4797
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4798 4798
                                     
4799
-                                    if ($post_category_str != '' && $post_default_category) {
4800
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4801
-                                    }
4799
+									if ($post_category_str != '' && $post_default_category) {
4800
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4801
+									}
4802 4802
                                     
4803
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4803
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4804 4804
                                     
4805
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4806
-                                }
4805
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4806
+								}
4807 4807
 
4808
-                                if ( !empty( $save_post['post_tags'] ) ) {
4809
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4810
-                                }
4808
+								if ( !empty( $save_post['post_tags'] ) ) {
4809
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4810
+								}
4811 4811
 
4812
-                                // Post images
4813
-                                if ( !empty( $post_images ) ) {
4814
-                                    $post_images = array_unique($post_images);
4812
+								// Post images
4813
+								if ( !empty( $post_images ) ) {
4814
+									$post_images = array_unique($post_images);
4815 4815
                                     
4816
-                                    $old_post_images_arr = array();
4817
-                                    $saved_post_images_arr = array();
4816
+									$old_post_images_arr = array();
4817
+									$saved_post_images_arr = array();
4818 4818
                                     
4819
-                                    $order = 1;
4819
+									$order = 1;
4820 4820
                                     
4821
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4822
-                                    if (!empty($old_post_images)) {
4823
-                                        foreach( $old_post_images as $old_post_image ) {
4824
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4825
-                                                $old_post_images_arr[] = $old_post_image->file;
4826
-                                            }
4827
-                                        }
4828
-                                    }
4821
+									$old_post_images = geodir_get_images( $saved_post_id );
4822
+									if (!empty($old_post_images)) {
4823
+										foreach( $old_post_images as $old_post_image ) {
4824
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4825
+												$old_post_images_arr[] = $old_post_image->file;
4826
+											}
4827
+										}
4828
+									}
4829 4829
 
4830
-                                    foreach ( $post_images as $post_image ) {
4831
-                                        $image_name = basename( $post_image );
4832
-                                        $saved_post_images_arr[] = $image_name;
4830
+									foreach ( $post_images as $post_image ) {
4831
+										$image_name = basename( $post_image );
4832
+										$saved_post_images_arr[] = $image_name;
4833 4833
                                         
4834
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4835
-                                            continue; // Skip if image already exists.
4836
-                                        }
4834
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4835
+											continue; // Skip if image already exists.
4836
+										}
4837 4837
                                         
4838
-                                        $image_name_parts = explode( '.', $image_name );
4839
-                                        array_pop( $image_name_parts );
4840
-                                        $proper_image_name = implode( '.', $image_name_parts );
4838
+										$image_name_parts = explode( '.', $image_name );
4839
+										array_pop( $image_name_parts );
4840
+										$proper_image_name = implode( '.', $image_name_parts );
4841 4841
                                         
4842
-                                        $arr_file_type = wp_check_filetype( $image_name );
4842
+										$arr_file_type = wp_check_filetype( $image_name );
4843 4843
                                         
4844
-                                        if ( !empty( $arr_file_type ) ) {
4845
-                                            $uploaded_file_type = $arr_file_type['type'];
4844
+										if ( !empty( $arr_file_type ) ) {
4845
+											$uploaded_file_type = $arr_file_type['type'];
4846 4846
                                             
4847
-                                            $attachment = array();
4848
-                                            $attachment['post_id'] = $saved_post_id;
4849
-                                            $attachment['title'] = $proper_image_name;
4850
-                                            $attachment['content'] = '';
4851
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4852
-                                            $attachment['mime_type'] = $uploaded_file_type;
4853
-                                            $attachment['menu_order'] = $order;
4854
-                                            $attachment['is_featured'] = 0;
4855
-
4856
-                                            $attachment_set = '';
4857
-                                            foreach ( $attachment as $key => $val ) {
4858
-                                                if ( $val != '' ) {
4859
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4860
-                                                }
4861
-                                            }
4862
-                                            $attachment_set = trim( $attachment_set, ", " );
4847
+											$attachment = array();
4848
+											$attachment['post_id'] = $saved_post_id;
4849
+											$attachment['title'] = $proper_image_name;
4850
+											$attachment['content'] = '';
4851
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
4852
+											$attachment['mime_type'] = $uploaded_file_type;
4853
+											$attachment['menu_order'] = $order;
4854
+											$attachment['is_featured'] = 0;
4855
+
4856
+											$attachment_set = '';
4857
+											foreach ( $attachment as $key => $val ) {
4858
+												if ( $val != '' ) {
4859
+													$attachment_set .= $key . " = '" . $val . "', ";
4860
+												}
4861
+											}
4862
+											$attachment_set = trim( $attachment_set, ", " );
4863 4863
                                                                                         
4864
-                                            // Add new attachment
4865
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4864
+											// Add new attachment
4865
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4866 4866
                                                                                         
4867
-                                            $order++;
4868
-                                        }
4869
-                                    }
4867
+											$order++;
4868
+										}
4869
+									}
4870 4870
 
4871
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4872
-                                    // Remove previous attachment
4873
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4871
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4872
+									// Remove previous attachment
4873
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4874 4874
                                     
4875
-                                    if ( !empty( $saved_post_images_arr ) ) {
4876
-                                        geodir_set_wp_featured_image($saved_post_id);
4877
-                                        /*
4875
+									if ( !empty( $saved_post_images_arr ) ) {
4876
+										geodir_set_wp_featured_image($saved_post_id);
4877
+										/*
4878 4878
                                         $menu_order = 1;
4879 4879
                                         
4880 4880
                                         foreach ( $saved_post_images_arr as $img_name ) {
@@ -4887,281 +4887,281 @@  discard block
 block discarded – undo
4887 4887
                                             }
4888 4888
                                             $menu_order++;
4889 4889
                                         }*/
4890
-                                    }
4890
+									}
4891 4891
                                     
4892
-                                    if ( $order > 1 ) {
4893
-                                        $images++;
4894
-                                    }
4895
-                                }
4892
+									if ( $order > 1 ) {
4893
+										$images++;
4894
+									}
4895
+								}
4896 4896
 
4897
-                                /** This action is documented in geodirectory-functions/post-functions.php */
4898
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4897
+								/** This action is documented in geodirectory-functions/post-functions.php */
4898
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4899 4899
                                 
4900
-                                if (isset($is_featured)) {
4901
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4902
-                                }
4903
-                                if (isset($gd_post['expire_date'])) {
4904
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4905
-                                }
4906
-                            }
4900
+								if (isset($is_featured)) {
4901
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4902
+								}
4903
+								if (isset($gd_post['expire_date'])) {
4904
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4905
+								}
4906
+							}
4907 4907
                             
4908
-                            // WPML
4909
-                            if ($is_wpml && $language != '') {
4910
-                                $sitepress->switch_lang($active_lang, true);
4911
-                            }
4912
-                            // WPML
4913
-                        }
4914
-                    }
4915
-                }
4908
+							// WPML
4909
+							if ($is_wpml && $language != '') {
4910
+								$sitepress->switch_lang($active_lang, true);
4911
+							}
4912
+							// WPML
4913
+						}
4914
+					}
4915
+				}
4916 4916
 
4917
-                //undo some stuff to make the import quicker
4918
-                wp_defer_term_counting( false );
4919
-                wp_defer_comment_counting( false );
4920
-                $wpdb->query( 'COMMIT;' );
4921
-                $wpdb->query( 'SET autocommit = 1;' );
4922
-
4923
-                $json = array();
4924
-                $json['processed'] = $processed_actual;
4925
-                $json['created'] = $created;
4926
-                $json['updated'] = $updated;
4927
-                $json['skipped'] = $skipped;
4928
-                $json['invalid'] = $invalid;
4929
-                $json['invalid_addr'] = $invalid_addr;
4930
-                $json['images'] = $images;
4917
+				//undo some stuff to make the import quicker
4918
+				wp_defer_term_counting( false );
4919
+				wp_defer_comment_counting( false );
4920
+				$wpdb->query( 'COMMIT;' );
4921
+				$wpdb->query( 'SET autocommit = 1;' );
4922
+
4923
+				$json = array();
4924
+				$json['processed'] = $processed_actual;
4925
+				$json['created'] = $created;
4926
+				$json['updated'] = $updated;
4927
+				$json['skipped'] = $skipped;
4928
+				$json['invalid'] = $invalid;
4929
+				$json['invalid_addr'] = $invalid_addr;
4930
+				$json['images'] = $images;
4931 4931
                 
4932
-                wp_send_json( $json );
4933
-                exit;
4934
-            } else if ( $task == 'import_loc' ) {
4935
-                global $gd_post_types;
4936
-                $gd_post_types = $post_types;
4932
+				wp_send_json( $json );
4933
+				exit;
4934
+			} else if ( $task == 'import_loc' ) {
4935
+				global $gd_post_types;
4936
+				$gd_post_types = $post_types;
4937 4937
                 
4938
-                if (!empty($file)) {
4939
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4938
+				if (!empty($file)) {
4939
+					$columns = isset($file[0]) ? $file[0] : NULL;
4940 4940
                     
4941
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4942
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4943
-                        wp_send_json( $json );
4944
-                    }
4941
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4942
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4943
+						wp_send_json( $json );
4944
+					}
4945 4945
                     
4946
-                    $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4947
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4948
-                    for ($i = 1; $i <= $limit; $i++) {
4949
-                        $index = $processed + $i;
4946
+					$gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4947
+					$gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4948
+					for ($i = 1; $i <= $limit; $i++) {
4949
+						$index = $processed + $i;
4950 4950
                         
4951
-                        if (isset($file[$index])) {
4952
-                            $row = $file[$index];
4953
-                            $row = array_map( 'trim', $row );
4954
-                            $data = array();
4951
+						if (isset($file[$index])) {
4952
+							$row = $file[$index];
4953
+							$row = array_map( 'trim', $row );
4954
+							$data = array();
4955 4955
                             
4956
-                            foreach ($columns as $c => $column ) {
4957
-                                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'))) {
4958
-                                    $data[$column] = $row[$c];
4959
-                                }
4960
-                            }
4956
+							foreach ($columns as $c => $column ) {
4957
+								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'))) {
4958
+									$data[$column] = $row[$c];
4959
+								}
4960
+							}
4961 4961
 
4962
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4963
-                                $invalid++;
4964
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4965
-                                continue;
4966
-                            }
4962
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4963
+								$invalid++;
4964
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4965
+								continue;
4966
+							}
4967 4967
                             
4968
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4968
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4969 4969
                             
4970
-                            if ( $import_choice == 'update' ) {
4971
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4972
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4973
-                                        $updated++;
4974
-                                    } else {
4975
-                                        $invalid++;
4976
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4977
-                                    }
4978
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4979
-                                    $data['location_id'] = (int)$location->location_id;
4970
+							if ( $import_choice == 'update' ) {
4971
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4972
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4973
+										$updated++;
4974
+									} else {
4975
+										$invalid++;
4976
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4977
+									}
4978
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4979
+									$data['location_id'] = (int)$location->location_id;
4980 4980
                                     
4981
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4982
-                                        $data['location_id'] = (int)$location->location_id;
4983
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4984
-                                        $data['location_id'] = (int)$location->location_id;
4985
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4986
-                                        $data['location_id'] = (int)$location->location_id;
4987
-                                    }
4981
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4982
+										$data['location_id'] = (int)$location->location_id;
4983
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4984
+										$data['location_id'] = (int)$location->location_id;
4985
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4986
+										$data['location_id'] = (int)$location->location_id;
4987
+									}
4988 4988
                                     
4989
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4990
-                                        $updated++;
4991
-                                    } else {
4992
-                                        $invalid++;
4993
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4994
-                                    }
4995
-                                } else {
4996
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4997
-                                        $created++;
4998
-                                    } else {
4999
-                                        $invalid++;
5000
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
5001
-                                    }
5002
-                                }
5003
-                            } elseif ( $import_choice == 'skip' ) {
5004
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5005
-                                    $skipped++;
5006
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5007
-                                    $skipped++;
5008
-                                } else {
5009
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
5010
-                                        $created++;
5011
-                                    } else {
5012
-                                        $invalid++;
5013
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
5014
-                                    }
5015
-                                }
5016
-                            } else {
5017
-                                $invalid++;
5018
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
5019
-                            }
5020
-                        }
5021
-                    }
5022
-                }
4989
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4990
+										$updated++;
4991
+									} else {
4992
+										$invalid++;
4993
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4994
+									}
4995
+								} else {
4996
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4997
+										$created++;
4998
+									} else {
4999
+										$invalid++;
5000
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
5001
+									}
5002
+								}
5003
+							} elseif ( $import_choice == 'skip' ) {
5004
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5005
+									$skipped++;
5006
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5007
+									$skipped++;
5008
+								} else {
5009
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
5010
+										$created++;
5011
+									} else {
5012
+										$invalid++;
5013
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
5014
+									}
5015
+								}
5016
+							} else {
5017
+								$invalid++;
5018
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
5019
+							}
5020
+						}
5021
+					}
5022
+				}
5023 5023
                 
5024
-                $json = array();
5025
-                $json['processed'] = $limit;
5026
-                $json['created'] = $created;
5027
-                $json['updated'] = $updated;
5028
-                $json['skipped'] = $skipped;
5029
-                $json['invalid'] = $invalid;
5030
-                $json['images'] = $images;
5024
+				$json = array();
5025
+				$json['processed'] = $limit;
5026
+				$json['created'] = $created;
5027
+				$json['updated'] = $updated;
5028
+				$json['skipped'] = $skipped;
5029
+				$json['invalid'] = $invalid;
5030
+				$json['images'] = $images;
5031 5031
                 
5032
-                wp_send_json( $json );
5033
-            } else if ( $task == 'import_hood' ) {               
5034
-                if (!empty($file)) {
5035
-                    $columns = isset($file[0]) ? $file[0] : NULL;
5032
+				wp_send_json( $json );
5033
+			} else if ( $task == 'import_hood' ) {               
5034
+				if (!empty($file)) {
5035
+					$columns = isset($file[0]) ? $file[0] : NULL;
5036 5036
                     
5037
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5038
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
5039
-                        wp_send_json( $json );
5040
-                    }
5037
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5038
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
5039
+						wp_send_json( $json );
5040
+					}
5041 5041
                     
5042
-                    $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
5043
-                    $gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' );
5044
-                    for ($i = 1; $i <= $limit; $i++) {
5045
-                        $index = $processed + $i;
5042
+					$gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
5043
+					$gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' );
5044
+					for ($i = 1; $i <= $limit; $i++) {
5045
+						$index = $processed + $i;
5046 5046
                         
5047
-                        if (isset($file[$index])) {
5048
-                            $row = $file[$index];
5049
-                            $row = array_map( 'trim', $row );
5050
-                            $data = array();
5047
+						if (isset($file[$index])) {
5048
+							$row = $file[$index];
5049
+							$row = array_map( 'trim', $row );
5050
+							$data = array();
5051 5051
                             
5052
-                            foreach ($columns as $c => $column) {
5053
-                                if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
5054
-                                    $data[$column] = sanitize_text_field($row[$c]);
5055
-                                }
5056
-                            }
5052
+							foreach ($columns as $c => $column) {
5053
+								if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
5054
+									$data[$column] = sanitize_text_field($row[$c]);
5055
+								}
5056
+							}
5057 5057
 
5058
-                            if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
5059
-                                $invalid++;
5060
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5061
-                                continue;
5062
-                            }
5058
+							if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
5059
+								$invalid++;
5060
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5061
+								continue;
5062
+							}
5063 5063
                             
5064
-                            $location_info = array();
5065
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
5066
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
5067
-                            } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
5068
-                                $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
5069
-                            }
5064
+							$location_info = array();
5065
+							if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
5066
+								$location_info = geodir_get_location_by_id('', (int)$data['location_id']);
5067
+							} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
5068
+								$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
5069
+							}
5070 5070
 
5071
-                            if (empty($location_info)) {
5072
-                                $invalid++;
5073
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5074
-                                continue;
5075
-                            }
5071
+							if (empty($location_info)) {
5072
+								$invalid++;
5073
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5074
+								continue;
5075
+							}
5076 5076
                             
5077
-                            $location_id = $location_info->location_id;
5077
+							$location_id = $location_info->location_id;
5078 5078
 
5079
-                            $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
5079
+							$data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
5080 5080
                             
5081
-                            $hood_data = array();
5082
-                            $hood_data['hood_name'] = $data['neighbourhood_name'];
5083
-                            $hood_data['hood_slug'] = $data['neighbourhood_slug'];
5084
-                            $hood_data['hood_latitude'] = $data['latitude'];
5085
-                            $hood_data['hood_longitude'] = $data['longitude'];
5086
-                            $hood_data['hood_location_id'] = $location_id;
5081
+							$hood_data = array();
5082
+							$hood_data['hood_name'] = $data['neighbourhood_name'];
5083
+							$hood_data['hood_slug'] = $data['neighbourhood_slug'];
5084
+							$hood_data['hood_latitude'] = $data['latitude'];
5085
+							$hood_data['hood_longitude'] = $data['longitude'];
5086
+							$hood_data['hood_location_id'] = $location_id;
5087 5087
                                     
5088
-                            if ( $import_choice == 'update' ) {
5089
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5090
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
5088
+							if ( $import_choice == 'update' ) {
5089
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5090
+									$hood_data['hood_id'] = (int)$data['neighbourhood_id'];
5091 5091
                                     
5092
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5093
-                                        $updated++;
5094
-                                    } else {
5095
-                                        $invalid++;
5096
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5097
-                                    }
5098
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5099
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
5092
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5093
+										$updated++;
5094
+									} else {
5095
+										$invalid++;
5096
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5097
+									}
5098
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5099
+									$hood_data['hood_id'] = (int)$neighbourhood->hood_id;
5100 5100
                                     
5101
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5102
-                                        $updated++;
5103
-                                    } else {
5104
-                                        $invalid++;
5105
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5106
-                                    }
5107
-                                } else {
5108
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5109
-                                        $created++;
5110
-                                    } else {
5111
-                                        $invalid++;
5112
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5113
-                                    }
5114
-                                }
5115
-                            } elseif ( $import_choice == 'skip' ) {
5116
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5117
-                                    $skipped++;
5118
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5119
-                                    $skipped++;
5120
-                                } else {
5101
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5102
+										$updated++;
5103
+									} else {
5104
+										$invalid++;
5105
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5106
+									}
5107
+								} else {
5108
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5109
+										$created++;
5110
+									} else {
5111
+										$invalid++;
5112
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5113
+									}
5114
+								}
5115
+							} elseif ( $import_choice == 'skip' ) {
5116
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5117
+									$skipped++;
5118
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5119
+									$skipped++;
5120
+								} else {
5121 5121
                                     
5122
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5123
-                                        $created++;
5124
-                                    } else {
5125
-                                        $invalid++;
5126
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5127
-                                    }
5128
-                                }
5129
-                            } else {
5130
-                                $invalid++;
5131
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5132
-                            }
5133
-                        }
5134
-                    }
5135
-                }
5122
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5123
+										$created++;
5124
+									} else {
5125
+										$invalid++;
5126
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5127
+									}
5128
+								}
5129
+							} else {
5130
+								$invalid++;
5131
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5132
+							}
5133
+						}
5134
+					}
5135
+				}
5136 5136
                 
5137
-                $json = array();
5138
-                $json['processed'] = $limit;
5139
-                $json['created'] = $created;
5140
-                $json['updated'] = $updated;
5141
-                $json['skipped'] = $skipped;
5142
-                $json['invalid'] = $invalid;
5143
-                $json['images'] = $images;
5137
+				$json = array();
5138
+				$json['processed'] = $limit;
5139
+				$json['created'] = $created;
5140
+				$json['updated'] = $updated;
5141
+				$json['skipped'] = $skipped;
5142
+				$json['invalid'] = $invalid;
5143
+				$json['images'] = $images;
5144 5144
                 
5145
-                wp_send_json( $json );
5146
-            }
5147
-        }
5148
-        break;
5149
-        case 'import_finish':{
5150
-            /**
5151
-             * Run an action when an import finishes.
5152
-             *
5153
-             * This action can be used to fire functions after an import ends.
5154
-             *
5155
-             * @since 1.5.3
5156
-             * @package GeoDirectory
5157
-             */
5158
-            do_action('geodir_import_finished');
5159
-        }
5160
-        break;
5145
+				wp_send_json( $json );
5146
+			}
5147
+		}
5148
+		break;
5149
+		case 'import_finish':{
5150
+			/**
5151
+			 * Run an action when an import finishes.
5152
+			 *
5153
+			 * This action can be used to fire functions after an import ends.
5154
+			 *
5155
+			 * @since 1.5.3
5156
+			 * @package GeoDirectory
5157
+			 */
5158
+			do_action('geodir_import_finished');
5159
+		}
5160
+		break;
5161 5161
 
5162
-    }
5163
-    echo '0';
5164
-    gd_die();
5162
+	}
5163
+	echo '0';
5164
+	gd_die();
5165 5165
 }
5166 5166
 
5167 5167
 /**
@@ -5205,12 +5205,12 @@  discard block
 block discarded – undo
5205 5205
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5206 5206
 	}
5207 5207
 	
5208
-    if( !empty( $term ) ) {
5208
+	if( !empty( $term ) ) {
5209 5209
 		$result = wp_insert_term( $term, $taxonomy, $args );
5210
-        if( !is_wp_error( $result ) ) {
5211
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5212
-        }
5213
-    }
5210
+		if( !is_wp_error( $result ) ) {
5211
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5212
+		}
5213
+	}
5214 5214
 	
5215 5215
 	return false;
5216 5216
 }
@@ -5256,16 +5256,16 @@  discard block
 block discarded – undo
5256 5256
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5257 5257
 		
5258 5258
 		if( !is_wp_error( $result ) ) {
5259
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5260
-        }
5259
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5260
+		}
5261 5261
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5262 5262
 		$term_data['term_id'] = $term_info['term_id'];
5263 5263
 		
5264 5264
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5265 5265
 		
5266 5266
 		if( !is_wp_error( $result ) ) {
5267
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5268
-        }
5267
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5268
+		}
5269 5269
 	} else {
5270 5270
 		return geodir_imex_insert_term( $taxonomy, $term_data );
5271 5271
 	}
@@ -5287,47 +5287,47 @@  discard block
 block discarded – undo
5287 5287
  * @return int Posts count.
5288 5288
  */
5289 5289
 function geodir_get_posts_count( $post_type ) {
5290
-    global $wpdb, $plugin_prefix;
5290
+	global $wpdb, $plugin_prefix;
5291 5291
 
5292
-    if ( !post_type_exists( $post_type ) ) {
5293
-        return 0;
5294
-    }
5292
+	if ( !post_type_exists( $post_type ) ) {
5293
+		return 0;
5294
+	}
5295 5295
         
5296
-    $table = $plugin_prefix . $post_type . '_detail';
5296
+	$table = $plugin_prefix . $post_type . '_detail';
5297 5297
 
5298
-    // Skip listing with statuses trash, auto-draft etc...
5299
-    $skip_statuses = geodir_imex_export_skip_statuses();
5300
-    $where_statuses = '';
5301
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5302
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5303
-    }
5298
+	// Skip listing with statuses trash, auto-draft etc...
5299
+	$skip_statuses = geodir_imex_export_skip_statuses();
5300
+	$where_statuses = '';
5301
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5302
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5303
+	}
5304 5304
     
5305
-    /**
5306
-     * Filter the SQL where clause part to filter posts count in import/export.
5307
-     *
5308
-     * @since 1.6.4
5309
-     * @package GeoDirectory
5310
-     *
5311
-     * @param string $where SQL where clause part.
5312
-     */
5313
-    $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5314
-
5315
-    $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5316
-
5317
-    $posts_count = (int)$wpdb->get_var( $query );
5305
+	/**
5306
+	 * Filter the SQL where clause part to filter posts count in import/export.
5307
+	 *
5308
+	 * @since 1.6.4
5309
+	 * @package GeoDirectory
5310
+	 *
5311
+	 * @param string $where SQL where clause part.
5312
+	 */
5313
+	$where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5314
+
5315
+	$query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5316
+
5317
+	$posts_count = (int)$wpdb->get_var( $query );
5318 5318
     
5319
-    /**
5320
-     * Modify returned post counts for the current post type.
5321
-     *
5322
-     * @since 1.4.6
5323
-     * @package GeoDirectory
5324
-     *
5325
-     * @param int $posts_count Post counts.
5326
-     * @param string $post_type Post type.
5327
-     */
5328
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5329
-
5330
-    return $posts_count;
5319
+	/**
5320
+	 * Modify returned post counts for the current post type.
5321
+	 *
5322
+	 * @since 1.4.6
5323
+	 * @package GeoDirectory
5324
+	 *
5325
+	 * @param int $posts_count Post counts.
5326
+	 * @param string $post_type Post type.
5327
+	 */
5328
+	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5329
+
5330
+	return $posts_count;
5331 5331
 }
5332 5332
 
5333 5333
 /**
@@ -5355,9 +5355,9 @@  discard block
 block discarded – undo
5355 5355
 	
5356 5356
 	if ( !empty( $posts ) ) {
5357 5357
 		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5358
-        $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5359
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5360
-        $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5358
+		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5359
+		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5360
+		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5361 5361
 		
5362 5362
 		$csv_row = array();
5363 5363
 		$csv_row[] = 'post_id';
@@ -5393,7 +5393,7 @@  discard block
 block discarded – undo
5393 5393
 			$csv_row[] = 'package_id';
5394 5394
 			$csv_row[] = 'expire_date';
5395 5395
 		}
5396
-        $csv_row[] = 'post_date';
5396
+		$csv_row[] = 'post_date';
5397 5397
 		$csv_row[] = 'geodir_video';
5398 5398
 		$csv_row[] = 'post_address';
5399 5399
 		$csv_row[] = 'post_city';
@@ -5402,11 +5402,11 @@  discard block
 block discarded – undo
5402 5402
 		$csv_row[] = 'post_zip';
5403 5403
 		$csv_row[] = 'post_latitude';
5404 5404
 		$csv_row[] = 'post_longitude';
5405
-        if ($neighbourhood_active) {
5406
-            $csv_row[] = 'post_neighbourhood';
5407
-            $csv_row[] = 'neighbourhood_latitude';
5408
-            $csv_row[] = 'neighbourhood_longitude';
5409
-        }
5405
+		if ($neighbourhood_active) {
5406
+			$csv_row[] = 'post_neighbourhood';
5407
+			$csv_row[] = 'neighbourhood_latitude';
5408
+			$csv_row[] = 'neighbourhood_longitude';
5409
+		}
5410 5410
 		$csv_row[] = 'geodir_timing';
5411 5411
 		$csv_row[] = 'geodir_contact';
5412 5412
 		$csv_row[] = 'geodir_email';
@@ -5441,7 +5441,7 @@  discard block
 block discarded – undo
5441 5441
 		$csv_rows[] = $csv_row;
5442 5442
 
5443 5443
 		$images_count = 5;
5444
-        $xx=0;
5444
+		$xx=0;
5445 5445
 		foreach ( $posts as $post ) {$xx++;
5446 5446
 			$post_id = $post['ID'];
5447 5447
 			
@@ -5576,7 +5576,7 @@  discard block
 block discarded – undo
5576 5576
 				$csv_row[] = (int)$post_info['package_id']; // package_id
5577 5577
 				$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
5578 5578
 			}
5579
-            $csv_row[] = $post_info['post_date']; // post_date
5579
+			$csv_row[] = $post_info['post_date']; // post_date
5580 5580
 			$csv_row[] = $post_info['geodir_video']; // geodir_video
5581 5581
 			$csv_row[] = $post_info['post_address']; // post_address
5582 5582
 			$csv_row[] = $post_info['post_city']; // post_city
@@ -5585,21 +5585,21 @@  discard block
 block discarded – undo
5585 5585
 			$csv_row[] = $post_info['post_zip']; // post_zip
5586 5586
 			$csv_row[] = $post_info['post_latitude']; // post_latitude
5587 5587
 			$csv_row[] = $post_info['post_longitude']; // post_longitude
5588
-            if ($neighbourhood_active) {
5589
-                $post_neighbourhood = '';
5590
-                $neighbourhood_latitude = '';
5591
-                $neighbourhood_longitude = '';
5592
-                if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5593
-                    if (!empty($hood_info)) {
5594
-                        $post_neighbourhood = $hood_info->hood_name;
5595
-                        $neighbourhood_latitude = $hood_info->hood_latitude;
5596
-                        $neighbourhood_longitude = $hood_info->hood_longitude;
5597
-                    }
5598
-                }
5599
-                $csv_row[] = $post_neighbourhood; // post_neighbourhood
5600
-                $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5601
-                $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5602
-            }
5588
+			if ($neighbourhood_active) {
5589
+				$post_neighbourhood = '';
5590
+				$neighbourhood_latitude = '';
5591
+				$neighbourhood_longitude = '';
5592
+				if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5593
+					if (!empty($hood_info)) {
5594
+						$post_neighbourhood = $hood_info->hood_name;
5595
+						$neighbourhood_latitude = $hood_info->hood_latitude;
5596
+						$neighbourhood_longitude = $hood_info->hood_longitude;
5597
+					}
5598
+				}
5599
+				$csv_row[] = $post_neighbourhood; // post_neighbourhood
5600
+				$csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5601
+				$csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5602
+			}
5603 5603
 			$csv_row[] = $post_info['geodir_timing']; // geodir_timing
5604 5604
 			$csv_row[] = $post_info['geodir_contact']; // geodir_contact
5605 5605
 			$csv_row[] = $post_info['geodir_email']; // geodir_email
@@ -5670,64 +5670,64 @@  discard block
 block discarded – undo
5670 5670
  * @return array Array of posts data.
5671 5671
  */
5672 5672
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5673
-    global $wpdb, $plugin_prefix;
5673
+	global $wpdb, $plugin_prefix;
5674 5674
 
5675
-    if ( ! post_type_exists( $post_type ) )
5676
-        return new stdClass;
5675
+	if ( ! post_type_exists( $post_type ) )
5676
+		return new stdClass;
5677 5677
         
5678
-    $table = $plugin_prefix . $post_type . '_detail';
5678
+	$table = $plugin_prefix . $post_type . '_detail';
5679 5679
 
5680
-    $limit = '';
5681
-    if ( $per_page > 0 && $page_no > 0 ) {
5682
-        $offset = ( $page_no - 1 ) * $per_page;
5680
+	$limit = '';
5681
+	if ( $per_page > 0 && $page_no > 0 ) {
5682
+		$offset = ( $page_no - 1 ) * $per_page;
5683 5683
         
5684
-        if ( $offset > 0 ) {
5685
-            $limit = " LIMIT " . $offset . "," . $per_page;
5686
-        } else {
5687
-            $limit = " LIMIT " . $per_page;
5688
-        }
5689
-    }
5684
+		if ( $offset > 0 ) {
5685
+			$limit = " LIMIT " . $offset . "," . $per_page;
5686
+		} else {
5687
+			$limit = " LIMIT " . $per_page;
5688
+		}
5689
+	}
5690 5690
 
5691
-    // Skip listing with statuses trash, auto-draft etc...
5692
-    $skip_statuses = geodir_imex_export_skip_statuses();
5693
-    $where_statuses = '';
5694
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5695
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5696
-    }
5691
+	// Skip listing with statuses trash, auto-draft etc...
5692
+	$skip_statuses = geodir_imex_export_skip_statuses();
5693
+	$where_statuses = '';
5694
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5695
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5696
+	}
5697 5697
     
5698
-    /**
5699
-     * Filter the SQL where clause part to filter posts in import/export.
5700
-     *
5701
-     * @since 1.6.4
5702
-     * @package GeoDirectory
5703
-     *
5704
-     * @param string $where SQL where clause part.
5705
-     */
5706
-    $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5707
-
5708
-    $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
5709
-    /**
5710
-     * Modify returned posts SQL query for the current post type.
5711
-     *
5712
-     * @since 1.4.6
5713
-     * @package GeoDirectory
5714
-     *
5715
-     * @param int $query The SQL query.
5716
-     * @param string $post_type Post type.
5717
-     */
5718
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5719
-    $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5720
-
5721
-    /**
5722
-     * Modify returned post results for the current post type.
5723
-     *
5724
-     * @since 1.4.6
5725
-     * @package GeoDirectory
5726
-     *
5727
-     * @param object $results An object containing all post ids.
5728
-     * @param string $post_type Post type.
5729
-     */
5730
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5698
+	/**
5699
+	 * Filter the SQL where clause part to filter posts in import/export.
5700
+	 *
5701
+	 * @since 1.6.4
5702
+	 * @package GeoDirectory
5703
+	 *
5704
+	 * @param string $where SQL where clause part.
5705
+	 */
5706
+	$where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5707
+
5708
+	$query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
5709
+	/**
5710
+	 * Modify returned posts SQL query for the current post type.
5711
+	 *
5712
+	 * @since 1.4.6
5713
+	 * @package GeoDirectory
5714
+	 *
5715
+	 * @param int $query The SQL query.
5716
+	 * @param string $post_type Post type.
5717
+	 */
5718
+	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5719
+	$results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5720
+
5721
+	/**
5722
+	 * Modify returned post results for the current post type.
5723
+	 *
5724
+	 * @since 1.4.6
5725
+	 * @package GeoDirectory
5726
+	 *
5727
+	 * @param object $results An object containing all post ids.
5728
+	 * @param string $post_type Post type.
5729
+	 */
5730
+	return apply_filters( 'geodir_export_posts', $results, $post_type );
5731 5731
 }
5732 5732
 
5733 5733
 /**
@@ -5746,26 +5746,26 @@  discard block
 block discarded – undo
5746 5746
  * @return string The SQL query.
5747 5747
  */
5748 5748
 function geodir_imex_get_events_query( $query, $post_type ) {
5749
-    if ( $post_type == 'gd_event' ) {
5750
-        global $wpdb, $plugin_prefix;
5749
+	if ( $post_type == 'gd_event' ) {
5750
+		global $wpdb, $plugin_prefix;
5751 5751
         
5752
-        $table = $plugin_prefix . $post_type . '_detail';
5753
-        $schedule_table = EVENT_SCHEDULE;
5752
+		$table = $plugin_prefix . $post_type . '_detail';
5753
+		$schedule_table = EVENT_SCHEDULE;
5754 5754
         
5755
-        // Skip listing with statuses trash, auto-draft etc...
5756
-        $skip_statuses = geodir_imex_export_skip_statuses();
5757
-        $where_statuses = '';
5758
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5759
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5760
-        }
5755
+		// Skip listing with statuses trash, auto-draft etc...
5756
+		$skip_statuses = geodir_imex_export_skip_statuses();
5757
+		$where_statuses = '';
5758
+		if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5759
+			$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5760
+		}
5761 5761
         
5762
-        /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5763
-        $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5762
+		/** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5763
+		$where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5764 5764
 
5765
-        $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime 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 " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
5766
-    }
5765
+		$query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime 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 " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
5766
+	}
5767 5767
 
5768
-    return $query;
5768
+	return $query;
5769 5769
 }
5770 5770
 
5771 5771
 /**
@@ -5787,36 +5787,36 @@  discard block
 block discarded – undo
5787 5787
  * @return int Total terms count.
5788 5788
  */
5789 5789
 function geodir_get_terms_count( $post_type ) {
5790
-    $args = array( 'hide_empty' => 0 );
5790
+	$args = array( 'hide_empty' => 0 );
5791 5791
 
5792
-    remove_all_filters( 'get_terms' );
5792
+	remove_all_filters( 'get_terms' );
5793 5793
 
5794
-    $taxonomy = $post_type . 'category';
5794
+	$taxonomy = $post_type . 'category';
5795 5795
 
5796
-    // WPML
5797
-    $is_wpml = geodir_is_wpml();
5798
-    $active_lang = 'all';
5799
-    if ( $is_wpml ) {
5800
-        global $sitepress;
5801
-        $active_lang = $sitepress->get_current_language();
5796
+	// WPML
5797
+	$is_wpml = geodir_is_wpml();
5798
+	$active_lang = 'all';
5799
+	if ( $is_wpml ) {
5800
+		global $sitepress;
5801
+		$active_lang = $sitepress->get_current_language();
5802 5802
         
5803
-        if ( $active_lang != 'all' ) {
5804
-            $sitepress->switch_lang( 'all', true );
5805
-        }
5806
-    }
5807
-    // WPML
5803
+		if ( $active_lang != 'all' ) {
5804
+			$sitepress->switch_lang( 'all', true );
5805
+		}
5806
+	}
5807
+	// WPML
5808 5808
             
5809
-    $count_terms = wp_count_terms( $taxonomy, $args );
5809
+	$count_terms = wp_count_terms( $taxonomy, $args );
5810 5810
 
5811
-    // WPML
5812
-    if ( $is_wpml && $active_lang !== 'all' ) {
5813
-        global $sitepress;
5814
-        $sitepress->switch_lang( $active_lang, true );
5815
-    }
5816
-    // WPML
5817
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5811
+	// WPML
5812
+	if ( $is_wpml && $active_lang !== 'all' ) {
5813
+		global $sitepress;
5814
+		$sitepress->switch_lang( $active_lang, true );
5815
+	}
5816
+	// WPML
5817
+	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5818 5818
      
5819
-    return $count_terms;
5819
+	return $count_terms;
5820 5820
 }
5821 5821
 
5822 5822
 /**
@@ -5855,11 +5855,11 @@  discard block
 block discarded – undo
5855 5855
 		$csv_row[] = 'cat_posttype';
5856 5856
 		$csv_row[] = 'cat_parent';
5857 5857
 		$csv_row[] = 'cat_schema';
5858
-        // WPML
5858
+		// WPML
5859 5859
 		$is_wpml = geodir_is_wpml();
5860 5860
 		if ($is_wpml) {
5861 5861
 			$csv_row[] = 'cat_language';
5862
-            $csv_row[] = 'cat_id_original';
5862
+			$csv_row[] = 'cat_id_original';
5863 5863
 		}
5864 5864
 		// WPML
5865 5865
 		$csv_row[] = 'cat_description';
@@ -5889,10 +5889,10 @@  discard block
 block discarded – undo
5889 5889
 			$csv_row[] = $post_type;
5890 5890
 			$csv_row[] = $cat_parent;
5891 5891
 			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5892
-            // WPML
5892
+			// WPML
5893 5893
 			if ($is_wpml) {
5894 5894
 				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5895
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5895
+				$csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5896 5896
 			}
5897 5897
 			// WPML
5898 5898
 			$csv_row[] = $term->description;
@@ -6488,43 +6488,43 @@  discard block
 block discarded – undo
6488 6488
  * @param string $status Post status.
6489 6489
  */
6490 6490
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
6491
-    global $wpdb, $current_user;
6492
-
6493
-    $option_value = get_option($option);
6494
-
6495
-    if ($option_value > 0) :
6496
-        if (get_post($option_value)) :
6497
-            // Page exists
6498
-            return;
6499
-        endif;
6500
-    endif;
6501
-
6502
-    $page_found = $wpdb->get_var(
6503
-        $wpdb->prepare(
6504
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6505
-            array($slug)
6506
-        )
6507
-    );
6508
-
6509
-    if ($page_found) :
6510
-        // Page exists
6511
-        if (!$option_value) update_option($option, $page_found);
6512
-        return;
6513
-    endif;
6514
-
6515
-    $page_data = array(
6516
-        'post_status' => $status,
6517
-        'post_type' => 'page',
6518
-        'post_author' => $current_user->ID,
6519
-        'post_name' => $slug,
6520
-        'post_title' => $page_title,
6521
-        'post_content' => $page_content,
6522
-        'post_parent' => $post_parent,
6523
-        'comment_status' => 'closed'
6524
-    );
6525
-    $page_id = wp_insert_post($page_data);
6526
-
6527
-    add_option($option, $page_id);
6491
+	global $wpdb, $current_user;
6492
+
6493
+	$option_value = get_option($option);
6494
+
6495
+	if ($option_value > 0) :
6496
+		if (get_post($option_value)) :
6497
+			// Page exists
6498
+			return;
6499
+		endif;
6500
+	endif;
6501
+
6502
+	$page_found = $wpdb->get_var(
6503
+		$wpdb->prepare(
6504
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6505
+			array($slug)
6506
+		)
6507
+	);
6508
+
6509
+	if ($page_found) :
6510
+		// Page exists
6511
+		if (!$option_value) update_option($option, $page_found);
6512
+		return;
6513
+	endif;
6514
+
6515
+	$page_data = array(
6516
+		'post_status' => $status,
6517
+		'post_type' => 'page',
6518
+		'post_author' => $current_user->ID,
6519
+		'post_name' => $slug,
6520
+		'post_title' => $page_title,
6521
+		'post_content' => $page_content,
6522
+		'post_parent' => $post_parent,
6523
+		'comment_status' => 'closed'
6524
+	);
6525
+	$page_id = wp_insert_post($page_data);
6526
+
6527
+	add_option($option, $page_id);
6528 6528
 
6529 6529
 }
6530 6530
 
@@ -6555,9 +6555,9 @@  discard block
 block discarded – undo
6555 6555
  * @package GeoDirectory
6556 6556
  */
6557 6557
 function geodir_admin_upgrade_notice() {
6558
-    $class = "error";
6559
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6560
-    echo"<div class=\"$class\"> <p>$message</p></div>";
6558
+	$class = "error";
6559
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6560
+	echo"<div class=\"$class\"> <p>$message</p></div>";
6561 6561
 }
6562 6562
 
6563 6563
 /**
@@ -6570,18 +6570,18 @@  discard block
 block discarded – undo
6570 6570
  */
6571 6571
 function geodire_admin_upgrade_notice( $plugin_data, $r )
6572 6572
 {
6573
-    // readme contents
6574
-    $args = array(
6575
-        'timeout'     => 15,
6576
-        'redirection' => 5
6577
-    );
6578
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6579
-    $data       = wp_remote_get( $url, $args );
6573
+	// readme contents
6574
+	$args = array(
6575
+		'timeout'     => 15,
6576
+		'redirection' => 5
6577
+	);
6578
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6579
+	$data       = wp_remote_get( $url, $args );
6580 6580
 
6581
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
6581
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
6582 6582
 
6583
-        geodir_in_plugin_update_message($data['body']);
6584
-    }
6583
+		geodir_in_plugin_update_message($data['body']);
6584
+	}
6585 6585
 }
6586 6586
 
6587 6587
 
@@ -6589,28 +6589,28 @@  discard block
 block discarded – undo
6589 6589
 * @param string $content http response body
6590 6590
 */
6591 6591
 function geodir_in_plugin_update_message($content) {
6592
-    // Output Upgrade Notice
6593
-    $matches        = null;
6594
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6595
-    $upgrade_notice = '';
6596
-    if ( preg_match( $regexp, $content, $matches ) ) {
6597
-        if(empty($matches)){return;}
6598
-
6599
-        $version = trim( $matches[1] );
6600
-        if($version && $version>GEODIRECTORY_VERSION){
6601
-
6602
-
6603
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6604
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6605
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6606
-            foreach ( $notices as $index => $line ) {
6607
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6608
-            }
6609
-            $upgrade_notice .= '</div> ';
6610
-        }
6611
-        }
6612
-    }
6613
-    echo $upgrade_notice;
6592
+	// Output Upgrade Notice
6593
+	$matches        = null;
6594
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6595
+	$upgrade_notice = '';
6596
+	if ( preg_match( $regexp, $content, $matches ) ) {
6597
+		if(empty($matches)){return;}
6598
+
6599
+		$version = trim( $matches[1] );
6600
+		if($version && $version>GEODIRECTORY_VERSION){
6601
+
6602
+
6603
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6604
+		if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6605
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6606
+			foreach ( $notices as $index => $line ) {
6607
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6608
+			}
6609
+			$upgrade_notice .= '</div> ';
6610
+		}
6611
+		}
6612
+	}
6613
+	echo $upgrade_notice;
6614 6614
 }
6615 6615
 
6616 6616
 /**
@@ -6643,19 +6643,19 @@  discard block
 block discarded – undo
6643 6643
  * @param array Listing statuses to be skipped.
6644 6644
  */
6645 6645
 function geodir_imex_export_skip_statuses() {
6646
-    $statuses = array( 'trash', 'auto-draft' );
6646
+	$statuses = array( 'trash', 'auto-draft' );
6647 6647
     
6648
-    /**
6649
-     * Filter the statuses to skip during GD export listings.
6650
-     *
6651
-     * @since 1.6.0
6652
-     * @package GeoDirectory
6653
-     *
6654
-     * @param array $statuses Listing statuses to be skipped.
6655
-     */
6656
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6648
+	/**
6649
+	 * Filter the statuses to skip during GD export listings.
6650
+	 *
6651
+	 * @since 1.6.0
6652
+	 * @package GeoDirectory
6653
+	 *
6654
+	 * @param array $statuses Listing statuses to be skipped.
6655
+	 */
6656
+	$statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6657 6657
      
6658
-    return $statuses;
6658
+	return $statuses;
6659 6659
 }
6660 6660
 
6661 6661
 /**
@@ -6667,15 +6667,15 @@  discard block
 block discarded – undo
6667 6667
  * @since 1.6.3
6668 6668
  */
6669 6669
 function geodir_admin_dequeue_scripts() {
6670
-    // EDD
6671
-    if (wp_script_is('jquery-chosen', 'enqueued')) {
6672
-        wp_dequeue_script('jquery-chosen');
6673
-    }
6670
+	// EDD
6671
+	if (wp_script_is('jquery-chosen', 'enqueued')) {
6672
+		wp_dequeue_script('jquery-chosen');
6673
+	}
6674 6674
     
6675
-    // Ultimate Addons for Visual Composer
6676
-    if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6677
-        wp_dequeue_script('ultimate-vc-backend-script');
6678
-    }
6675
+	// Ultimate Addons for Visual Composer
6676
+	if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6677
+		wp_dequeue_script('ultimate-vc-backend-script');
6678
+	}
6679 6679
 }
6680 6680
 
6681 6681
 /**
@@ -6691,24 +6691,24 @@  discard block
 block discarded – undo
6691 6691
  * @return string SQL where clause part.
6692 6692
  */
6693 6693
 function geodir_imex_get_filter_where($where = '', $post_type = '') {
6694
-    global $wpdb;
6694
+	global $wpdb;
6695 6695
     
6696
-    $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6696
+	$filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6697 6697
     
6698
-    if ( !empty( $filters ) ) {
6699
-        foreach ( $filters as $field => $value ) {
6700
-            switch ($field) {
6701
-                case 'start_date':
6702
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 23:59:59'";
6703
-                break;
6704
-                case 'end_date':
6705
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6706
-                break;
6707
-            }
6708
-        }
6709
-    }
6698
+	if ( !empty( $filters ) ) {
6699
+		foreach ( $filters as $field => $value ) {
6700
+			switch ($field) {
6701
+				case 'start_date':
6702
+					$where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 23:59:59'";
6703
+				break;
6704
+				case 'end_date':
6705
+					$where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6706
+				break;
6707
+			}
6708
+		}
6709
+	}
6710 6710
     
6711
-    return $where;
6711
+	return $where;
6712 6712
 }
6713 6713
 add_filter('geodir_get_posts_count', 'geodir_imex_get_filter_where', 10, 2);
6714 6714
 add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
Please login to merge, or discard this patch.