Passed
Push — master ( fa1018...826c8f )
by Stiofan
10:57
created
geodirectory_template_tags.php 1 patch
Indentation   +321 added lines, -321 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function geodir_core_dequeue_script()
24 24
 {
25
-    wp_dequeue_script('flexslider');
25
+	wp_dequeue_script('flexslider');
26 26
 }
27 27
 
28 28
 add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100);
@@ -35,159 +35,159 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_templates_scripts()
37 37
 {
38
-    $is_detail_page = false;
39
-    $geodir_map_name = geodir_map_name();
40
-
41
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
-        $is_detail_page = true;
43
-    }
44
-
45
-    wp_enqueue_script('jquery');
46
-
47
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
48
-    wp_enqueue_script('geodirectory-script');
49
-
50
-    $geodir_vars_data = array(
51
-        'siteurl' => get_option('siteurl'),
52
-        'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
-        'geodir_ajax_url' => geodir_get_ajax_url(),
55
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
-    );
58
-
59
-    /**
60
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
-     *
62
-     * This is used by addons to add JS translatable variables.
63
-     *
64
-     * @since 1.4.4
65
-     * @param array $geodir_vars_data {
66
-     *    geodir var data used by addons to add JS translatable variables.
67
-     *
68
-     *    @type string $siteurl Site url.
69
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
-     *    @type int $is_rtl Checks if current locale is RTL.
73
-     *
74
-     * }
75
-     */
76
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
-
78
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
-
80
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
-
83
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
-    wp_enqueue_script('geodirectory-lightbox-jquery');
85
-
86
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
-    if ($is_detail_page) {
88
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
89
-    }
90
-
91
-    if (in_array($geodir_map_name, array('auto', 'google'))) {
92
-        $map_lang = "&language=" . geodir_get_map_default_language();
93
-        /**
94
-         * Filter the variables that are added to the end of the google maps script call.
95
-         *
96
-         * This i used to change things like google maps language etc.
97
-         *
98
-         * @since 1.0.0
99
-         * @param string $var The string to filter, default is empty string.
100
-         */
101
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
102
-        wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
103
-    }
38
+	$is_detail_page = false;
39
+	$geodir_map_name = geodir_map_name();
40
+
41
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
+		$is_detail_page = true;
43
+	}
44
+
45
+	wp_enqueue_script('jquery');
46
+
47
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
48
+	wp_enqueue_script('geodirectory-script');
49
+
50
+	$geodir_vars_data = array(
51
+		'siteurl' => get_option('siteurl'),
52
+		'geodir_plugin_url' => geodir_plugin_url(),
53
+		'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
+		'geodir_ajax_url' => geodir_get_ajax_url(),
55
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
+	);
58
+
59
+	/**
60
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
+	 *
62
+	 * This is used by addons to add JS translatable variables.
63
+	 *
64
+	 * @since 1.4.4
65
+	 * @param array $geodir_vars_data {
66
+	 *    geodir var data used by addons to add JS translatable variables.
67
+	 *
68
+	 *    @type string $siteurl Site url.
69
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
+	 *    @type int $is_rtl Checks if current locale is RTL.
73
+	 *
74
+	 * }
75
+	 */
76
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
+
78
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
+
80
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
+
83
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
+	wp_enqueue_script('geodirectory-lightbox-jquery');
85
+
86
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
+	if ($is_detail_page) {
88
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
89
+	}
90
+
91
+	if (in_array($geodir_map_name, array('auto', 'google'))) {
92
+		$map_lang = "&language=" . geodir_get_map_default_language();
93
+		/**
94
+		 * Filter the variables that are added to the end of the google maps script call.
95
+		 *
96
+		 * This i used to change things like google maps language etc.
97
+		 *
98
+		 * @since 1.0.0
99
+		 * @param string $var The string to filter, default is empty string.
100
+		 */
101
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
102
+		wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
103
+	}
104 104
     
105
-    if ($geodir_map_name == 'osm') {
106
-        // Leaflet OpenStreetMap
107
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
108
-        wp_enqueue_style('geodirectory-leaflet-style');
105
+	if ($geodir_map_name == 'osm') {
106
+		// Leaflet OpenStreetMap
107
+		wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
108
+		wp_enqueue_style('geodirectory-leaflet-style');
109 109
             
110
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
111
-        wp_enqueue_script('geodirectory-leaflet-script');
110
+		wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
111
+		wp_enqueue_script('geodirectory-leaflet-script');
112 112
         
113
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
114
-        wp_enqueue_script('geodirectory-leaflet-geo-script');
115
-    }
116
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
113
+		wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION);
114
+		wp_enqueue_script('geodirectory-leaflet-geo-script');
115
+	}
116
+	wp_enqueue_script( 'jquery-ui-autocomplete' );
117 117
     
118
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
119
-    wp_enqueue_script('geodirectory-goMap-script');
120
-
121
-
122
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
123
-    wp_enqueue_script('chosen');
124
-
125
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
126
-    wp_enqueue_script('geodirectory-choose-ajax');
127
-
128
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
129
-
130
-    if (is_page() && geodir_is_page('add-listing')) {
131
-        // SCRIPT FOR UPLOAD
132
-        wp_enqueue_script('plupload-all');
133
-        wp_enqueue_script('jquery-ui-sortable');
134
-
135
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
136
-        wp_enqueue_script('geodirectory-plupload-script');
137
-        // SCRIPT FOR UPLOAD END
138
-
139
-        // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
140
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
141
-            $ajax_url = admin_url('admin-ajax.php');
142
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
143
-            $ajax_url = admin_url('admin-ajax.php');
144
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
145
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
146
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
147
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
148
-        } else {
149
-            $ajax_url = admin_url('admin-ajax.php');
150
-        }
118
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
119
+	wp_enqueue_script('geodirectory-goMap-script');
120
+
121
+
122
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
123
+	wp_enqueue_script('chosen');
124
+
125
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
126
+	wp_enqueue_script('geodirectory-choose-ajax');
127
+
128
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
129
+
130
+	if (is_page() && geodir_is_page('add-listing')) {
131
+		// SCRIPT FOR UPLOAD
132
+		wp_enqueue_script('plupload-all');
133
+		wp_enqueue_script('jquery-ui-sortable');
134
+
135
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
136
+		wp_enqueue_script('geodirectory-plupload-script');
137
+		// SCRIPT FOR UPLOAD END
138
+
139
+		// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
140
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
141
+			$ajax_url = admin_url('admin-ajax.php');
142
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
143
+			$ajax_url = admin_url('admin-ajax.php');
144
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
145
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
146
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
147
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
148
+		} else {
149
+			$ajax_url = admin_url('admin-ajax.php');
150
+		}
151 151
 
152
-        // place js config array for plupload
153
-        $plupload_init = array(
154
-            'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
155
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
156
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
157
-            'drop_element' => 'dropbox', // will be adjusted per uploader
158
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
159
-            'multiple_queues' => true,
160
-            'max_file_size' => geodir_max_upload_size(),
161
-            'url' => $ajax_url,
162
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
163
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
164
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
165
-            'multipart' => true,
166
-            'urlstream_upload' => true,
167
-            'multi_selection' => false, // will be added per uploader
168
-            // additional post data to send to our ajax hook
169
-            'multipart_params' => array(
170
-                '_ajax_nonce' => "", // will be added per uploader
171
-                'action' => 'plupload_action', // the ajax action name
172
-                'imgid' => 0 // will be added per uploader
173
-            )
174
-        );
175
-        $base_plupload_config = json_encode($plupload_init);
176
-
177
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
178
-            'upload_img_size' => geodir_max_upload_size());
179
-
180
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
181
-
182
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
183
-    } // End if for add place page
184
-
185
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
186
-    if ($is_detail_page) {
152
+		// place js config array for plupload
153
+		$plupload_init = array(
154
+			'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
155
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
156
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
157
+			'drop_element' => 'dropbox', // will be adjusted per uploader
158
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
159
+			'multiple_queues' => true,
160
+			'max_file_size' => geodir_max_upload_size(),
161
+			'url' => $ajax_url,
162
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
163
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
164
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
165
+			'multipart' => true,
166
+			'urlstream_upload' => true,
167
+			'multi_selection' => false, // will be added per uploader
168
+			// additional post data to send to our ajax hook
169
+			'multipart_params' => array(
170
+				'_ajax_nonce' => "", // will be added per uploader
171
+				'action' => 'plupload_action', // the ajax action name
172
+				'imgid' => 0 // will be added per uploader
173
+			)
174
+		);
175
+		$base_plupload_config = json_encode($plupload_init);
176
+
177
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
178
+			'upload_img_size' => geodir_max_upload_size());
179
+
180
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
181
+
182
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
183
+	} // End if for add place page
184
+
185
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
186
+	if ($is_detail_page) {
187 187
 		wp_enqueue_script('geodirectory-post-custom-js');
188 188
 	}
189 189
 
190
-    // font awesome rating script
190
+	// font awesome rating script
191 191
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
192 192
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
193 193
 		wp_enqueue_script('geodir-barrating-js');
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 		wp_enqueue_script('geodir-jRating-js');
197 197
 	}
198 198
 
199
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
200
-    wp_enqueue_script('geodir-on-document-load');
199
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
200
+	wp_enqueue_script('geodir-on-document-load');
201 201
 
202
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
-    wp_enqueue_script('google-geometa');
202
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
+	wp_enqueue_script('google-geometa');
204 204
 }
205 205
 
206 206
 /**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
  */
215 215
 function geodir_header_scripts()
216 216
 {
217
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
218
-    echo stripslashes(get_option('geodir_header_scripts'));
217
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
218
+	echo stripslashes(get_option('geodir_header_scripts'));
219 219
 }
220 220
 
221 221
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 function geodir_footer_scripts()
232 232
 {	
233 233
 	echo stripslashes(get_option('geodir_ga_tracking_code'));
234
-    echo stripslashes(get_option('geodir_footer_scripts'));
234
+	echo stripslashes(get_option('geodir_footer_scripts'));
235 235
 }
236 236
 
237 237
 
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_add_async_forscript($url)
247 247
 {
248
-    if (strpos($url, '#asyncload')===false)
249
-        return $url;
250
-    else if (is_admin())
251
-        return str_replace('#asyncload', '', $url);
252
-    else
253
-        return str_replace('#asyncload', '', $url)."' async='async";
248
+	if (strpos($url, '#asyncload')===false)
249
+		return $url;
250
+	else if (is_admin())
251
+		return str_replace('#asyncload', '', $url);
252
+	else
253
+		return str_replace('#asyncload', '', $url)."' async='async";
254 254
 }
255 255
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
256 256
 
@@ -263,17 +263,17 @@  discard block
 block discarded – undo
263 263
 function geodir_templates_styles()
264 264
 {
265 265
 
266
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
267
-    wp_enqueue_style('geodir-core-scss');
268
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
266
+	wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
267
+	wp_enqueue_style('geodir-core-scss');
268
+	wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
269 269
 
270
-    if(is_rtl()){
271
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
272
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
273
-    }
270
+	if(is_rtl()){
271
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
272
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
273
+	}
274 274
 
275
-    wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
276
-    wp_enqueue_style('font-awesome');
275
+	wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
276
+	wp_enqueue_style('font-awesome');
277 277
 
278 278
 
279 279
 }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
  */
288 288
 function geodir_get_sidebar()
289 289
 {
290
-    get_sidebar('geodirectory');
290
+	get_sidebar('geodirectory');
291 291
 }
292 292
 
293 293
 /**
@@ -306,122 +306,122 @@  discard block
 block discarded – undo
306 306
  * @param bool $always_show Do you want to show the pagination always? Default: false.
307 307
  */
308 308
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
309
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
309
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
310 310
 
311
-    if (empty($prelabel)) {
312
-        $prelabel = '<strong>&laquo;</strong>';
313
-    }
311
+	if (empty($prelabel)) {
312
+		$prelabel = '<strong>&laquo;</strong>';
313
+	}
314 314
 
315
-    if (empty($nxtlabel)) {
316
-        $nxtlabel = '<strong>&raquo;</strong>';
317
-    }
315
+	if (empty($nxtlabel)) {
316
+		$nxtlabel = '<strong>&raquo;</strong>';
317
+	}
318 318
 
319
-    $half_pages_to_show = round($pages_to_show / 2);
319
+	$half_pages_to_show = round($pages_to_show / 2);
320 320
 
321
-    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
322
-        return;
321
+	if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
322
+		return;
323 323
 
324
-    if (!is_single()) {
325
-        if (function_exists('geodir_location_geo_home_link')) {
326
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
327
-        }
328
-        $numposts = $wp_query->found_posts;
324
+	if (!is_single()) {
325
+		if (function_exists('geodir_location_geo_home_link')) {
326
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
327
+		}
328
+		$numposts = $wp_query->found_posts;
329 329
 
330
-        $max_page = ceil($numposts / $posts_per_page);
330
+		$max_page = ceil($numposts / $posts_per_page);
331 331
 
332
-        if (empty($paged)) {
333
-            $paged = 1;
334
-        }
332
+		if (empty($paged)) {
333
+			$paged = 1;
334
+		}
335 335
         
336
-        $post_type = geodir_get_current_posttype();
337
-        $listing_type_name = get_post_type_plural_label($post_type);
338
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
339
-            $term = array();
336
+		$post_type = geodir_get_current_posttype();
337
+		$listing_type_name = get_post_type_plural_label($post_type);
338
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
339
+			$term = array();
340 340
             
341
-            if (is_tax()) {
342
-                $term_id = get_queried_object_id();
343
-                $taxonomy = get_query_var('taxonomy');
341
+			if (is_tax()) {
342
+				$term_id = get_queried_object_id();
343
+				$taxonomy = get_query_var('taxonomy');
344 344
 
345
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
346
-                    $term = get_term($term_id, $post_type . 'category');
347
-                }
348
-            }
345
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
346
+					$term = get_term($term_id, $post_type . 'category');
347
+				}
348
+			}
349 349
             
350
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
351
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
350
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
351
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
352 352
                 
353
-                if (!is_array($taxonomy_search)) {
354
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
355
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
356
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
357
-                }
358
-            }
353
+				if (!is_array($taxonomy_search)) {
354
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
355
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
356
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
357
+				}
358
+			}
359 359
             
360
-            if (!empty($term) && !is_wp_error($term)) {
361
-                $listing_type_name = $term->name;
362
-            }
363
-        }
360
+			if (!empty($term) && !is_wp_error($term)) {
361
+				$listing_type_name = $term->name;
362
+			}
363
+		}
364 364
 
365
-        if ($max_page > 1 || $always_show) {            
366
-            // Extra pagination info
367
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
368
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
369
-            $end_no = min($paged * $posts_per_page, $numposts);
365
+		if ($max_page > 1 || $always_show) {            
366
+			// Extra pagination info
367
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
368
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
369
+			$end_no = min($paged * $posts_per_page, $numposts);
370 370
 
371
-            if ($geodir_pagination_more_info != '') {
372
-                if ($listing_type_name) {
373
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
374
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
375
-                } else {
376
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
377
-                }
378
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
379
-                /**
380
-                 * Adds an extra pagination info above/under pagination.
381
-                 *
382
-                 * @since 1.5.9
383
-                 *
384
-                 * @param string $pagination_info Extra pagination info content.
385
-                 * @param string $listing_type_name Listing results type.
386
-                 * @param string $start_no First result number.
387
-                 * @param string $end_no Last result number.
388
-                 * @param string $numposts Total number of listings.
389
-                 * @param string $post_type The post type.
390
-                 */
391
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
371
+			if ($geodir_pagination_more_info != '') {
372
+				if ($listing_type_name) {
373
+					$listing_type_name = __($listing_type_name, 'geodirectory');
374
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
375
+				} else {
376
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
377
+				}
378
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
379
+				/**
380
+				 * Adds an extra pagination info above/under pagination.
381
+				 *
382
+				 * @since 1.5.9
383
+				 *
384
+				 * @param string $pagination_info Extra pagination info content.
385
+				 * @param string $listing_type_name Listing results type.
386
+				 * @param string $start_no First result number.
387
+				 * @param string $end_no Last result number.
388
+				 * @param string $numposts Total number of listings.
389
+				 * @param string $post_type The post type.
390
+				 */
391
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
392 392
                 
393
-                if ($geodir_pagination_more_info == 'before') {
394
-                    $before = $before . $pagination_info;
395
-                } else if ($geodir_pagination_more_info == 'after') {
396
-                    $after = $pagination_info . $after;
397
-                }
398
-            }
393
+				if ($geodir_pagination_more_info == 'before') {
394
+					$before = $before . $pagination_info;
395
+				} else if ($geodir_pagination_more_info == 'after') {
396
+					$after = $pagination_info . $after;
397
+				}
398
+			}
399 399
             
400
-            echo "$before <div class='Navi gd-navi'>";
401
-            if ($paged >= ($pages_to_show - 1)) {
402
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
403
-            }
404
-            previous_posts_link($prelabel);
405
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
406
-                if ($i >= 1 && $i <= $max_page) {
407
-                    if ($i == $paged) {
408
-                        echo "<strong class='on'>$i</strong>";
409
-                    } else {
410
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
411
-                    }
412
-                }
413
-            }
414
-            next_posts_link($nxtlabel, $max_page);
415
-            if (($paged + $half_pages_to_show) < ($max_page)) {
416
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
417
-            }
418
-            echo "</div> $after";
419
-        }
400
+			echo "$before <div class='Navi gd-navi'>";
401
+			if ($paged >= ($pages_to_show - 1)) {
402
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
403
+			}
404
+			previous_posts_link($prelabel);
405
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
406
+				if ($i >= 1 && $i <= $max_page) {
407
+					if ($i == $paged) {
408
+						echo "<strong class='on'>$i</strong>";
409
+					} else {
410
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
411
+					}
412
+				}
413
+			}
414
+			next_posts_link($nxtlabel, $max_page);
415
+			if (($paged + $half_pages_to_show) < ($max_page)) {
416
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
417
+			}
418
+			echo "</div> $after";
419
+		}
420 420
         
421
-        if (function_exists('geodir_location_geo_home_link')) {
422
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
423
-        }
424
-    }
421
+		if (function_exists('geodir_location_geo_home_link')) {
422
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
423
+		}
424
+	}
425 425
 }
426 426
 
427 427
 /**
@@ -432,20 +432,20 @@  discard block
 block discarded – undo
432 432
  */
433 433
 function geodir_listingsearch_scripts()
434 434
 {
435
-    if (get_option('gd_search_dist') != '') {
436
-        $dist = get_option('gd_search_dist');
437
-    } else {
438
-        $dist = 500;
439
-    }
440
-    $dist_dif = 1000;
441
-
442
-    if ($dist <= 5000) $dist_dif = 500;
443
-    if ($dist <= 1000) $dist_dif = 100;
444
-    if ($dist <= 500) $dist_dif = 50;
445
-    if ($dist <= 100) $dist_dif = 10;
446
-    if ($dist <= 50) $dist_dif = 5;
447
-
448
-    ?>
435
+	if (get_option('gd_search_dist') != '') {
436
+		$dist = get_option('gd_search_dist');
437
+	} else {
438
+		$dist = 500;
439
+	}
440
+	$dist_dif = 1000;
441
+
442
+	if ($dist <= 5000) $dist_dif = 500;
443
+	if ($dist <= 1000) $dist_dif = 100;
444
+	if ($dist <= 500) $dist_dif = 50;
445
+	if ($dist <= 100) $dist_dif = 10;
446
+	if ($dist <= 50) $dist_dif = 5;
447
+
448
+	?>
449 449
     <script type="text/javascript">
450 450
 
451 451
         jQuery(function ($) {
@@ -504,15 +504,15 @@  discard block
 block discarded – undo
504 504
 function geodir_add_sharelocation_scripts()
505 505
 {
506 506
 
507
-    $default_search_for_text = SEARCH_FOR_TEXT;
508
-    if (get_option('geodir_search_field_default_text'))
509
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
507
+	$default_search_for_text = SEARCH_FOR_TEXT;
508
+	if (get_option('geodir_search_field_default_text'))
509
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
510 510
 
511
-    $default_near_text = NEAR_TEXT;
512
-    if (get_option('geodir_near_field_default_text'))
513
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
511
+	$default_near_text = NEAR_TEXT;
512
+	if (get_option('geodir_near_field_default_text'))
513
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
514 514
 
515
-    ?>
515
+	?>
516 516
 
517 517
 
518 518
     <script type="text/javascript">
@@ -593,14 +593,14 @@  discard block
 block discarded – undo
593 593
                     initialise2();
594 594
                 } else {
595 595
                     <?php
596
-                    $near_add = get_option('geodir_search_near_addition');
597
-                    /**
598
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
599
-                     *
600
-                     * @since 1.0.0
601
-                     */
602
-                    $near_add2 = apply_filters('geodir_search_near_addition', '');
603
-                    ?>
596
+					$near_add = get_option('geodir_search_near_addition');
597
+					/**
598
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
599
+					 *
600
+					 * @since 1.0.0
601
+					 */
602
+					$near_add2 = apply_filters('geodir_search_near_addition', '');
603
+					?>
604 604
                     if (window.gdMaps === 'google') {
605 605
                         Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
606 606
                             function (results, status) {
@@ -703,30 +703,30 @@  discard block
 block discarded – undo
703 703
  */
704 704
 function geodir_show_badges_on_image($which, $post, $link)
705 705
 {
706
-    $return = '';
707
-    switch ($which) {
708
-        case 'featured':
709
-            /**
710
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
711
-             *
712
-             * @since 1.0.0
713
-             * @param object $post The post object.
714
-             * @param string $link The link to the post.
715
-             */
716
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
717
-            break;
718
-        case 'new' :
719
-            /**
720
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
721
-             *
722
-             * @since 1.0.0
723
-             * @param object $post The post object.
724
-             * @param string $link The link to the post.
725
-             */
726
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
727
-            break;
728
-
729
-    }
706
+	$return = '';
707
+	switch ($which) {
708
+		case 'featured':
709
+			/**
710
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
711
+			 *
712
+			 * @since 1.0.0
713
+			 * @param object $post The post object.
714
+			 * @param string $link The link to the post.
715
+			 */
716
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
717
+			break;
718
+		case 'new' :
719
+			/**
720
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
721
+			 *
722
+			 * @since 1.0.0
723
+			 * @param object $post The post object.
724
+			 * @param string $link The link to the post.
725
+			 */
726
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
727
+			break;
728
+
729
+	}
730 730
     
731
-    return $return;
731
+	return $return;
732 732
 }
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 2 patches
Indentation   +1488 added lines, -1488 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
-    if ($geodir_theme_location) {
227
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
228
-    } else {
229
-        update_option('geodir_theme_location_nav', '');
230
-    }
225
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+	if ($geodir_theme_location) {
227
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
228
+	} else {
229
+		update_option('geodir_theme_location_nav', '');
230
+	}
231 231
 }
232 232
 
233 233
 /// add action for theme switch to blank previous theme navigation location setting
@@ -248,32 +248,32 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function geodir_add_post_filters()
250 250
 {
251
-    /**
252
-     * Contains all function for filtering listing.
253
-     *
254
-     * @since 1.0.0
255
-     * @package GeoDirectory
256
-     */
257
-    include_once('geodirectory-functions/listing_filters.php');
251
+	/**
252
+	 * Contains all function for filtering listing.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @package GeoDirectory
256
+	 */
257
+	include_once('geodirectory-functions/listing_filters.php');
258 258
 }
259 259
 
260 260
 
261 261
 if (!function_exists('geodir_init_defaults')) {
262
-    /**
263
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
-     *
265
-     * @since 1.0.0
266
-     * @package GeoDirectory
267
-     */
268
-    function geodir_init_defaults()
269
-    {
270
-        if (function_exists('geodir_register_defaults')) {
262
+	/**
263
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
+	 *
265
+	 * @since 1.0.0
266
+	 * @package GeoDirectory
267
+	 */
268
+	function geodir_init_defaults()
269
+	{
270
+		if (function_exists('geodir_register_defaults')) {
271 271
 
272
-            geodir_register_defaults();
272
+			geodir_register_defaults();
273 273
 
274
-        }
274
+		}
275 275
 
276
-    }
276
+	}
277 277
 }
278 278
 
279 279
 
@@ -295,26 +295,26 @@  discard block
 block discarded – undo
295 295
 // CALLED ON 'sidebars_widgets' FILTER
296 296
 
297 297
 if (!function_exists('geodir_restrict_widget')) {
298
-    /**
299
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
-     *
301
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function geodir_restrict_widget()
307
-    {
308
-        global $is_listing, $is_single_place;
298
+	/**
299
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
+	 *
301
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function geodir_restrict_widget()
307
+	{
308
+		global $is_listing, $is_single_place;
309 309
 
310
-        // set is listing	
311
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
310
+		// set is listing	
311
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
312 312
 
313
-        // set is single place
314
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
313
+		// set is single place
314
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
315 315
 
316 316
 
317
-    }
317
+	}
318 318
 }
319 319
 
320 320
 
@@ -335,32 +335,32 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function geodir_detail_page_sidebar_content_sorting()
337 337
 {
338
-    $arr_detail_page_sidebar_content =
339
-        /**
340
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
341
-         *
342
-         * This filter can be used to remove sections of the details page sidebar,
343
-         * add new sections or rearrange the order of the sections.
344
-         *
345
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
-         * @since 1.0.0
347
-         */
348
-        apply_filters('geodir_detail_page_sidebar_content',
349
-            array('geodir_social_sharing_buttons',
350
-                'geodir_share_this_button',
351
-                'geodir_detail_page_google_analytics',
352
-                'geodir_edit_post_link',
353
-                //'geodir_detail_page_review_rating',
354
-                'geodir_detail_page_more_info'
355
-            ) // end of array 
356
-        ); // end of apply filter
357
-    if (!empty($arr_detail_page_sidebar_content)) {
358
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
359
-            if (function_exists($content_function)) {
360
-                add_action('geodir_detail_page_sidebar', $content_function);
361
-            }
362
-        }
363
-    }
338
+	$arr_detail_page_sidebar_content =
339
+		/**
340
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
341
+		 *
342
+		 * This filter can be used to remove sections of the details page sidebar,
343
+		 * add new sections or rearrange the order of the sections.
344
+		 *
345
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
+		 * @since 1.0.0
347
+		 */
348
+		apply_filters('geodir_detail_page_sidebar_content',
349
+			array('geodir_social_sharing_buttons',
350
+				'geodir_share_this_button',
351
+				'geodir_detail_page_google_analytics',
352
+				'geodir_edit_post_link',
353
+				//'geodir_detail_page_review_rating',
354
+				'geodir_detail_page_more_info'
355
+			) // end of array 
356
+		); // end of apply filter
357
+	if (!empty($arr_detail_page_sidebar_content)) {
358
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
359
+			if (function_exists($content_function)) {
360
+				add_action('geodir_detail_page_sidebar', $content_function);
361
+			}
362
+		}
363
+	}
364 364
 }
365 365
 
366 366
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function geodir_add_to_favourite_link()
377 377
 {
378
-    global $post, $preview;
379
-    if (!$preview && geodir_is_page('detail')) {
380
-        ?>
378
+	global $post, $preview;
379
+	if (!$preview && geodir_is_page('detail')) {
380
+		?>
381 381
         <p class="edit_link">
382 382
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
383 383
         </p>
384 384
     <?php
385
-    }
385
+	}
386 386
 }
387 387
 
388 388
 /**
@@ -396,41 +396,41 @@  discard block
 block discarded – undo
396 396
  */
397 397
 function geodir_social_sharing_buttons()
398 398
 {
399
-    global $preview;
400
-    ob_start(); // Start  buffering;
401
-    /**
402
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
-     *
404
-     * @since 1.0.0
405
-     */
406
-    do_action('geodir_before_social_sharing_buttons');
407
-    if (!$preview) {
408
-        ?>
399
+	global $preview;
400
+	ob_start(); // Start  buffering;
401
+	/**
402
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
+	 *
404
+	 * @since 1.0.0
405
+	 */
406
+	do_action('geodir_before_social_sharing_buttons');
407
+	if (!$preview) {
408
+		?>
409 409
         <div class="likethis">
410 410
             <?php geodir_twitter_tweet_button(); ?>
411 411
             <?php geodir_fb_like_button(); ?>
412 412
             <?php geodir_google_plus_button(); ?>
413 413
         </div>
414 414
     <?php
415
-    }// end of if, if its a preview or not
416
-
417
-    /**
418
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
-     *
420
-     * @since 1.0.0
421
-     */
422
-    do_action('geodir_after_social_sharing_buttons');
423
-    $content_html = ob_get_clean();
424
-    if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
-        /**
428
-         * Filter the geodir_social_sharing_buttons() function content.
429
-         *
430
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
-         */
432
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
-    }
415
+	}// end of if, if its a preview or not
416
+
417
+	/**
418
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
+	 *
420
+	 * @since 1.0.0
421
+	 */
422
+	do_action('geodir_after_social_sharing_buttons');
423
+	$content_html = ob_get_clean();
424
+	if (trim($content_html) != '')
425
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
+		/**
428
+		 * Filter the geodir_social_sharing_buttons() function content.
429
+		 *
430
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
+		 */
432
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
+	}
434 434
 
435 435
 
436 436
 }
@@ -446,39 +446,39 @@  discard block
 block discarded – undo
446 446
  */
447 447
 function geodir_share_this_button()
448 448
 {
449
-    global $preview;
450
-    ob_start(); // Start buffering;
451
-    /**
452
-     * This is called before the share this html in the function geodir_share_this_button()
453
-     *
454
-     * @since 1.0.0
455
-     */
456
-    do_action('geodir_before_share_this_button');
457
-    if (!$preview) {
458
-        ?>
449
+	global $preview;
450
+	ob_start(); // Start buffering;
451
+	/**
452
+	 * This is called before the share this html in the function geodir_share_this_button()
453
+	 *
454
+	 * @since 1.0.0
455
+	 */
456
+	do_action('geodir_before_share_this_button');
457
+	if (!$preview) {
458
+		?>
459 459
         <div class="share clearfix">
460 460
             <?php geodir_share_this_button_code(); ?>
461 461
         </div>
462 462
     <?php
463
-    }// end of if, if its a preview or not
464
-    /**
465
-     * This is called after the share this html in the function geodir_share_this_button()
466
-     *
467
-     * @since 1.0.0
468
-     */
469
-    do_action('geodir_after_share_this_button');
470
-    $content_html = ob_get_clean();
471
-    if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
-        /**
475
-         * Filter the geodir_share_this_button() function content.
476
-         *
477
-         * @param string $content_html The output html of the geodir_share_this_button() function.
478
-         * @since 1.0.0
479
-         */
480
-        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
-    }
463
+	}// end of if, if its a preview or not
464
+	/**
465
+	 * This is called after the share this html in the function geodir_share_this_button()
466
+	 *
467
+	 * @since 1.0.0
468
+	 */
469
+	do_action('geodir_after_share_this_button');
470
+	$content_html = ob_get_clean();
471
+	if (trim($content_html) != '')
472
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
+	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
+		/**
475
+		 * Filter the geodir_share_this_button() function content.
476
+		 *
477
+		 * @param string $content_html The output html of the geodir_share_this_button() function.
478
+		 * @since 1.0.0
479
+		 */
480
+		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
+	}
482 482
 
483 483
 }
484 484
 
@@ -494,46 +494,46 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_edit_post_link()
496 496
 {
497
-    global $post, $preview;
498
-    ob_start(); // Start buffering;
499
-    /**
500
-     * This is called before the edit post link html in the function geodir_edit_post_link()
501
-     *
502
-     * @since 1.0.0
503
-     */
504
-    do_action('geodir_before_edit_post_link');
505
-    if (!$preview) {
506
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
497
+	global $post, $preview;
498
+	ob_start(); // Start buffering;
499
+	/**
500
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
501
+	 *
502
+	 * @since 1.0.0
503
+	 */
504
+	do_action('geodir_before_edit_post_link');
505
+	if (!$preview) {
506
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
507 507
         
508
-        if ($is_current_user_owner) {
509
-            $post_id = $post->ID;
508
+		if ($is_current_user_owner) {
509
+			$post_id = $post->ID;
510 510
             
511
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
-                $post_id = (int)$_REQUEST['pid'];
513
-            }
511
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
+				$post_id = (int)$_REQUEST['pid'];
513
+			}
514 514
 
515
-            $postlink = get_permalink(geodir_add_listing_page_id());
516
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
-        }
519
-    }// end of if, if its a preview or not
520
-    /**
521
-     * This is called after the edit post link html in the function geodir_edit_post_link()
522
-     *
523
-     * @since 1.0.0
524
-     */
525
-    do_action('geodir_after_edit_post_link');
526
-    $content_html = ob_get_clean();
527
-    if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
-        /**
531
-         * Filter the geodir_edit_post_link() function content.
532
-         *
533
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
534
-         */
535
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
-    }
515
+			$postlink = get_permalink(geodir_add_listing_page_id());
516
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
+		}
519
+	}// end of if, if its a preview or not
520
+	/**
521
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
522
+	 *
523
+	 * @since 1.0.0
524
+	 */
525
+	do_action('geodir_after_edit_post_link');
526
+	$content_html = ob_get_clean();
527
+	if (trim($content_html) != '')
528
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
+		/**
531
+		 * Filter the geodir_edit_post_link() function content.
532
+		 *
533
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
534
+		 */
535
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
+	}
537 537
 }
538 538
 
539 539
 /**
@@ -547,41 +547,41 @@  discard block
 block discarded – undo
547 547
  */
548 548
 function geodir_detail_page_google_analytics()
549 549
 {
550
-    global $post;
551
-    $package_info = array();
552
-    $package_info = geodir_post_package_info($package_info, $post);
550
+	global $post;
551
+	$package_info = array();
552
+	$package_info = geodir_post_package_info($package_info, $post);
553 553
 
554
-    $id = trim(get_option('geodir_ga_id'));
554
+	$id = trim(get_option('geodir_ga_id'));
555 555
 
556
-    if (!$id) {
557
-        return; //if no Google Analytics ID then bail.
558
-    }
556
+	if (!$id) {
557
+		return; //if no Google Analytics ID then bail.
558
+	}
559 559
 
560
-    ob_start(); // Start buffering;
561
-    /**
562
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
-     *
564
-     * @since 1.0.0
565
-     */
566
-    do_action('geodir_before_google_analytics');
560
+	ob_start(); // Start buffering;
561
+	/**
562
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
+	 *
564
+	 * @since 1.0.0
565
+	 */
566
+	do_action('geodir_before_google_analytics');
567 567
     
568
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
569
-    /**
570
-     * Filter the time interval to check & refresh new users results.
571
-     *
572
-     * @since 1.5.9
573
-     *
574
-     * @param int $refresh_time Time interval to check & refresh new users results.
575
-     */
576
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
-    $refresh_time = absint($refresh_time * 1000);
568
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
569
+	/**
570
+	 * Filter the time interval to check & refresh new users results.
571
+	 *
572
+	 * @since 1.5.9
573
+	 *
574
+	 * @param int $refresh_time Time interval to check & refresh new users results.
575
+	 */
576
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
+	$refresh_time = absint($refresh_time * 1000);
578 578
     
579
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
579
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
580 580
     
581
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
584
-        ?>
581
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
584
+		?>
585 585
         <script type="text/javascript">
586 586
             var gd_gaTimeOut;
587 587
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -833,15 +833,15 @@  discard block
 block discarded – undo
833 833
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
834 834
 
835 835
                     <?php
836
-                    // Here we list the shorthand days of the week so it can be used in translation.
837
-                    __("Mon",'geodirectory');
838
-                    __("Tue",'geodirectory');
839
-                    __("Wed",'geodirectory');
840
-                    __("Thu",'geodirectory');
841
-                    __("Fri",'geodirectory');
842
-                    __("Sat",'geodirectory');
843
-                    __("Sun",'geodirectory');
844
-                    ?>
836
+					// Here we list the shorthand days of the week so it can be used in translation.
837
+					__("Mon",'geodirectory');
838
+					__("Tue",'geodirectory');
839
+					__("Wed",'geodirectory');
840
+					__("Thu",'geodirectory');
841
+					__("Fri",'geodirectory');
842
+					__("Sat",'geodirectory');
843
+					__("Sun",'geodirectory');
844
+					?>
845 845
 
846 846
                     labels = [
847 847
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1090,24 +1090,24 @@  discard block
 block discarded – undo
1090 1090
         </span>
1091 1091
 
1092 1092
     <?php
1093
-    }
1094
-    /**
1095
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
-     *
1097
-     * @since 1.0.0
1098
-     */
1099
-    do_action('geodir_after_google_analytics');
1100
-    $content_html = ob_get_clean();
1101
-    if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
-        /**
1105
-         * Filter the geodir_edit_post_link() function content.
1106
-         *
1107
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
-         */
1109
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
-    }
1093
+	}
1094
+	/**
1095
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
+	 *
1097
+	 * @since 1.0.0
1098
+	 */
1099
+	do_action('geodir_after_google_analytics');
1100
+	$content_html = ob_get_clean();
1101
+	if (trim($content_html) != '')
1102
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
+		/**
1105
+		 * Filter the geodir_edit_post_link() function content.
1106
+		 *
1107
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
+		 */
1109
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
+	}
1111 1111
 }
1112 1112
 
1113 1113
 /**
@@ -1123,90 +1123,90 @@  discard block
 block discarded – undo
1123 1123
  */
1124 1124
 function geodir_detail_page_review_rating()
1125 1125
 {
1126
-    global $post, $preview, $post_images;
1127
-    ob_start(); // Start  buffering;
1128
-    /**
1129
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
-     *
1131
-     * This is called outside the check for an actual rating and the check for preview page.
1132
-     *
1133
-     * @since 1.0.0
1134
-     */
1135
-    do_action('geodir_before_detail_page_review_rating');
1136
-
1137
-    $comment_count = geodir_get_review_count_total($post->ID);
1138
-    $post_avgratings = geodir_get_post_rating($post->ID);
1139
-
1140
-    if ($post_avgratings != 0 && !$preview) {
1141
-        /**
1142
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
-         *
1144
-         * This is called inside the check for an actual rating and the check for preview page.
1145
-         *
1146
-         * @since 1.0.0
1147
-         * @param float $post_avgratings Average rating for the surrent post.
1148
-         * @param int $post->ID Current post ID.
1149
-         */
1150
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
-
1152
-        $html = '<p style=" float:left;">';
1153
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1126
+	global $post, $preview, $post_images;
1127
+	ob_start(); // Start  buffering;
1128
+	/**
1129
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
+	 *
1131
+	 * This is called outside the check for an actual rating and the check for preview page.
1132
+	 *
1133
+	 * @since 1.0.0
1134
+	 */
1135
+	do_action('geodir_before_detail_page_review_rating');
1136
+
1137
+	$comment_count = geodir_get_review_count_total($post->ID);
1138
+	$post_avgratings = geodir_get_post_rating($post->ID);
1139
+
1140
+	if ($post_avgratings != 0 && !$preview) {
1141
+		/**
1142
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
+		 *
1144
+		 * This is called inside the check for an actual rating and the check for preview page.
1145
+		 *
1146
+		 * @since 1.0.0
1147
+		 * @param float $post_avgratings Average rating for the surrent post.
1148
+		 * @param int $post->ID Current post ID.
1149
+		 */
1150
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
+
1152
+		$html = '<p style=" float:left;">';
1153
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1156 1156
        
1157 1157
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1158 1158
 	   
1159 1159
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1160 1160
 
1161
-        $html .= '<span class="item">';
1162
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1161
+		$html .= '<span class="item">';
1162
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1163 1163
 
1164
-        if ($post_images) {
1165
-            foreach ($post_images as $img) {
1166
-                $post_img = $img->src;
1167
-                break;
1168
-            }
1169
-        }
1170
-
1171
-        if (isset($post_img) && $post_img) {
1172
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
-        }
1174
-
1175
-        $html .= '</span>';
1176
-
1177
-        echo $html .= '</div>';
1178
-        /**
1179
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
-         *
1181
-         * This is called inside the check for an actual rating and the check for preview page.
1182
-         *
1183
-         * @since 1.0.0
1184
-         * @param float $post_avgratings Average rating for the surrent post.
1185
-         * @param int $post->ID Current post ID.
1186
-         */
1187
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
-    }
1189
-    /**
1190
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
-     *
1192
-     * This is called outside the check for an actual rating and the check for preview page.
1193
-     *
1194
-     * @since 1.0.0
1195
-     */
1196
-    do_action('geodir_after_detail_page_review_rating');
1197
-    $content_html = ob_get_clean();
1198
-    if (trim($content_html) != '') {
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
-    }
1201
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
-        /**
1203
-         * Filter the geodir_detail_page_review_rating() function content.
1204
-         *
1205
-         * @since 1.0.0
1206
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
-         */
1208
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
-    }
1164
+		if ($post_images) {
1165
+			foreach ($post_images as $img) {
1166
+				$post_img = $img->src;
1167
+				break;
1168
+			}
1169
+		}
1170
+
1171
+		if (isset($post_img) && $post_img) {
1172
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
+		}
1174
+
1175
+		$html .= '</span>';
1176
+
1177
+		echo $html .= '</div>';
1178
+		/**
1179
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
+		 *
1181
+		 * This is called inside the check for an actual rating and the check for preview page.
1182
+		 *
1183
+		 * @since 1.0.0
1184
+		 * @param float $post_avgratings Average rating for the surrent post.
1185
+		 * @param int $post->ID Current post ID.
1186
+		 */
1187
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
+	}
1189
+	/**
1190
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
+	 *
1192
+	 * This is called outside the check for an actual rating and the check for preview page.
1193
+	 *
1194
+	 * @since 1.0.0
1195
+	 */
1196
+	do_action('geodir_after_detail_page_review_rating');
1197
+	$content_html = ob_get_clean();
1198
+	if (trim($content_html) != '') {
1199
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
+	}
1201
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
+		/**
1203
+		 * Filter the geodir_detail_page_review_rating() function content.
1204
+		 *
1205
+		 * @since 1.0.0
1206
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
+		 */
1208
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
+	}
1210 1210
 }
1211 1211
 
1212 1212
 /**
@@ -1218,35 +1218,35 @@  discard block
 block discarded – undo
1218 1218
  */
1219 1219
 function geodir_detail_page_more_info()
1220 1220
 {
1221
-    ob_start(); // Start  buffering;
1222
-    /**
1223
-     * This is called before the info section html.
1224
-     *
1225
-     * @since 1.0.0
1226
-     */
1227
-    do_action('geodir_before_detail_page_more_info');
1228
-    if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1229
-        echo $geodir_post_detail_fields;
1230
-    }
1231
-    /**
1232
-     * This is called after the info section html.
1233
-     *
1234
-     * @since 1.0.0
1235
-     */
1236
-    do_action('geodir_after_detail_page_more_info');
1237
-
1238
-    $content_html = ob_get_clean();
1239
-    if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
-        /**
1243
-         * Filter the output html for function geodir_detail_page_more_info().
1244
-         *
1245
-         * @since 1.0.0
1246
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
-         */
1248
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
-    }
1221
+	ob_start(); // Start  buffering;
1222
+	/**
1223
+	 * This is called before the info section html.
1224
+	 *
1225
+	 * @since 1.0.0
1226
+	 */
1227
+	do_action('geodir_before_detail_page_more_info');
1228
+	if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1229
+		echo $geodir_post_detail_fields;
1230
+	}
1231
+	/**
1232
+	 * This is called after the info section html.
1233
+	 *
1234
+	 * @since 1.0.0
1235
+	 */
1236
+	do_action('geodir_after_detail_page_more_info');
1237
+
1238
+	$content_html = ob_get_clean();
1239
+	if (trim($content_html) != '')
1240
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
+		/**
1243
+		 * Filter the output html for function geodir_detail_page_more_info().
1244
+		 *
1245
+		 * @since 1.0.0
1246
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
+		 */
1248
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
+	}
1250 1250
 }
1251 1251
 
1252 1252
 
@@ -1260,15 +1260,15 @@  discard block
 block discarded – undo
1260 1260
  */
1261 1261
 function geodir_localize_all_js_msg()
1262 1262
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1263
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
-        $ajax_url = admin_url('admin-ajax.php');
1265
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
-        $ajax_url = admin_url('admin-ajax.php');
1267
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
-    }
1263
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
+		$ajax_url = admin_url('admin-ajax.php');
1265
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
+		$ajax_url = admin_url('admin-ajax.php');
1267
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
+	}
1272 1272
 	
1273 1273
 	/**
1274 1274
 	 * Filter the allowed image type extensions for post images.
@@ -1278,59 +1278,59 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1280 1280
 	
1281
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1282
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
-    $default_marker_width = $default_marker_size['w'];
1284
-    $default_marker_height = $default_marker_size['h'];
1281
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1282
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
+	$default_marker_width = $default_marker_size['w'];
1284
+	$default_marker_height = $default_marker_size['h'];
1285 1285
     
1286
-    $arr_alert_msg = array(
1287
-        'geodir_plugin_url' => geodir_plugin_url(),
1288
-        'geodir_admin_ajax_url' => $ajax_url,
1289
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
-        //start not show alert msg
1294
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
-        // end not show alert msg
1300
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
-        //start not show alert msg
1302
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1303
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1304
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1305
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1306
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1307
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1308
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1309
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1310
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1311
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1312
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1313
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1314
-        'geodir_default_marker_icon' => $default_marker_icon,
1315
-        'geodir_default_marker_w' => $default_marker_width,
1316
-        'geodir_default_marker_h' => $default_marker_height,
1317
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1318
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1319
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1320
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1321
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1322
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1323
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1324
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1325
-        /* on/off dragging for phone devices */
1326
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1327
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1328
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1329
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1330
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1331
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1332
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1333
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1286
+	$arr_alert_msg = array(
1287
+		'geodir_plugin_url' => geodir_plugin_url(),
1288
+		'geodir_admin_ajax_url' => $ajax_url,
1289
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
+		//start not show alert msg
1294
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
+		// end not show alert msg
1300
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
+		//start not show alert msg
1302
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1303
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1304
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1305
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1306
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1307
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1308
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1309
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1310
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1311
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1312
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1313
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1314
+		'geodir_default_marker_icon' => $default_marker_icon,
1315
+		'geodir_default_marker_w' => $default_marker_width,
1316
+		'geodir_default_marker_h' => $default_marker_height,
1317
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1318
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1319
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1320
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1321
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1322
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1323
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1324
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1325
+		/* on/off dragging for phone devices */
1326
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1327
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1328
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1329
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1330
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1331
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1332
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1333
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1334 1334
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1335 1335
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1336 1336
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1338,29 +1338,29 @@  discard block
 block discarded – undo
1338 1338
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1339 1339
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1340 1340
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1341
-        'geodir_map_name' => geodir_map_name(),
1342
-    );
1343
-
1344
-    /**
1345
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1346
-     *
1347
-     * With this filter you can add, remove or change translated JS strings.
1348
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1349
-     *
1350
-     * @since 1.0.0
1351
-     */
1352
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1353
-
1354
-    foreach ($arr_alert_msg as $key => $value) {
1355
-        if (!is_scalar($value))
1356
-            continue;
1357
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1358
-    }
1341
+		'geodir_map_name' => geodir_map_name(),
1342
+	);
1343
+
1344
+	/**
1345
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1346
+	 *
1347
+	 * With this filter you can add, remove or change translated JS strings.
1348
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1349
+	 *
1350
+	 * @since 1.0.0
1351
+	 */
1352
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1359 1353
 
1360
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1361
-    echo '<script>';
1362
-    echo $script;
1363
-    echo '</script>';
1354
+	foreach ($arr_alert_msg as $key => $value) {
1355
+		if (!is_scalar($value))
1356
+			continue;
1357
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1358
+	}
1359
+
1360
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1361
+	echo '<script>';
1362
+	echo $script;
1363
+	echo '</script>';
1364 1364
 }
1365 1365
 
1366 1366
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1376,9 +1376,9 @@  discard block
 block discarded – undo
1376 1376
  */
1377 1377
 function geodir_admin_bar_site_menu($wp_admin_bar)
1378 1378
 {
1379
-    if (get_option("geodir_installed")) {
1380
-        $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1381
-    }
1379
+	if (get_option("geodir_installed")) {
1380
+		$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1381
+	}
1382 1382
 }
1383 1383
 
1384 1384
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1404,25 +1404,25 @@  discard block
 block discarded – undo
1404 1404
  */
1405 1405
 function geodir_store_sidebars()
1406 1406
 {
1407
-    global $geodir_sidebars;
1408
-    global $sidebars_widgets;
1409
-
1410
-    if (!is_array($sidebars_widgets))
1411
-        $sidebars_widgets = wp_get_sidebars_widgets();
1412
-    $geodir_old_sidebars = array();
1413
-
1414
-    if (is_array($geodir_sidebars)) {
1415
-        foreach ($geodir_sidebars as $val) {
1416
-            if (is_array($sidebars_widgets)) {
1417
-                if (array_key_exists($val, $sidebars_widgets))
1418
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1419
-                else
1420
-                    $geodir_old_sidebars[$val] = array();
1421
-            }
1422
-        }
1423
-    }
1424
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1425
-    geodir_option_version_backup('geodir_sidebars');
1407
+	global $geodir_sidebars;
1408
+	global $sidebars_widgets;
1409
+
1410
+	if (!is_array($sidebars_widgets))
1411
+		$sidebars_widgets = wp_get_sidebars_widgets();
1412
+	$geodir_old_sidebars = array();
1413
+
1414
+	if (is_array($geodir_sidebars)) {
1415
+		foreach ($geodir_sidebars as $val) {
1416
+			if (is_array($sidebars_widgets)) {
1417
+				if (array_key_exists($val, $sidebars_widgets))
1418
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1419
+				else
1420
+					$geodir_old_sidebars[$val] = array();
1421
+			}
1422
+		}
1423
+	}
1424
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1425
+	geodir_option_version_backup('geodir_sidebars');
1426 1426
 
1427 1427
 }
1428 1428
 
@@ -1436,28 +1436,28 @@  discard block
 block discarded – undo
1436 1436
  */
1437 1437
 function geodir_restore_sidebars()
1438 1438
 {
1439
-    global $sidebars_widgets;
1440
-
1441
-    if (!is_array($sidebars_widgets))
1442
-        $sidebars_widgets = wp_get_sidebars_widgets();
1443
-
1444
-    if (is_array($sidebars_widgets)) {
1445
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1446
-        if (is_array($geodir_old_sidebars)) {
1447
-            foreach ($geodir_old_sidebars as $key => $val) {
1448
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1449
-                {
1450
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1451
-                }
1439
+	global $sidebars_widgets;
1452 1440
 
1441
+	if (!is_array($sidebars_widgets))
1442
+		$sidebars_widgets = wp_get_sidebars_widgets();
1453 1443
 
1454
-            }
1455
-        }
1444
+	if (is_array($sidebars_widgets)) {
1445
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1446
+		if (is_array($geodir_old_sidebars)) {
1447
+			foreach ($geodir_old_sidebars as $key => $val) {
1448
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1449
+				{
1450
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1451
+				}
1456 1452
 
1457
-    }
1458 1453
 
1459
-    update_option('sidebars_widgets', $sidebars_widgets);
1460
-    update_option('geodir_sidebars', '');
1454
+			}
1455
+		}
1456
+
1457
+	}
1458
+
1459
+	update_option('sidebars_widgets', $sidebars_widgets);
1460
+	update_option('geodir_sidebars', '');
1461 1461
 }
1462 1462
 
1463 1463
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1470,9 +1470,9 @@  discard block
 block discarded – undo
1470 1470
  */
1471 1471
 function geodir_after_listing_post_gridview()
1472 1472
 {
1473
-    global $gridview_columns;
1473
+	global $gridview_columns;
1474 1474
 
1475
-    $gridview_columns = '';
1475
+	$gridview_columns = '';
1476 1476
 
1477 1477
 }
1478 1478
 
@@ -1500,11 +1500,11 @@  discard block
 block discarded – undo
1500 1500
  */
1501 1501
 function so_handle_038($url, $original_url, $_context)
1502 1502
 {
1503
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1504
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1505
-    }
1503
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1504
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1505
+	}
1506 1506
 
1507
-    return $url;
1507
+	return $url;
1508 1508
 }
1509 1509
 
1510 1510
 
@@ -1520,34 +1520,34 @@  discard block
 block discarded – undo
1520 1520
 function geodir_after_main_form_fields() {
1521 1521
 	global $gd_session;
1522 1522
 	
1523
-    if (get_option('geodir_accept_term_condition')) {
1524
-        global $post;
1525
-        $term_condition = '';
1526
-        if (isset($_REQUEST['backandedit'])) {
1527
-            $post = (object)$gd_session->get('listing');
1528
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1529
-        }
1530
-
1531
-        ?>
1523
+	if (get_option('geodir_accept_term_condition')) {
1524
+		global $post;
1525
+		$term_condition = '';
1526
+		if (isset($_REQUEST['backandedit'])) {
1527
+			$post = (object)$gd_session->get('listing');
1528
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1529
+		}
1530
+
1531
+		?>
1532 1532
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1533 1533
             <label>&nbsp;</label>
1534 1534
 
1535 1535
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1536 1536
 				<span style="display:block"> 
1537 1537
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1538
-                    echo 'checked="checked"';
1539
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1538
+					echo 'checked="checked"';
1539
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1540 1540
                        class="geodir_textfield" value="1"
1541 1541
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1542 1542
 				</span>
1543 1543
             </div>
1544 1544
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1545
-                    _e($required_msg, 'geodirectory');
1546
-                } ?></span>
1545
+					_e($required_msg, 'geodirectory');
1546
+				} ?></span>
1547 1547
         </div>
1548 1548
     <?php
1549 1549
 
1550
-    }
1550
+	}
1551 1551
 }
1552 1552
 
1553 1553
 
@@ -1572,42 +1572,42 @@  discard block
 block discarded – undo
1572 1572
  */
1573 1573
 function geodir_detail_page_tab_is_display($is_display, $tab)
1574 1574
 {
1575
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1575
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1576 1576
 
1577
-    if ($tab == 'post_profile') {
1578
-        /** This action is documented in geodirectory_template_actions.php */
1579
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1577
+	if ($tab == 'post_profile') {
1578
+		/** This action is documented in geodirectory_template_actions.php */
1579
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1580 1580
         
1581
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1582
-            $is_display = false;
1583
-        }
1584
-    }
1581
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1582
+			$is_display = false;
1583
+		}
1584
+	}
1585 1585
     
1586
-    if ($tab == 'post_info')
1587
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1586
+	if ($tab == 'post_info')
1587
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1588 1588
 
1589
-    if ($tab == 'post_images')
1590
-        $is_display = (!empty($post_images)) ? true : false;
1589
+	if ($tab == 'post_images')
1590
+		$is_display = (!empty($post_images)) ? true : false;
1591 1591
 
1592
-    if ($tab == 'post_video')
1593
-        $is_display = (!empty($video)) ? true : false;
1592
+	if ($tab == 'post_video')
1593
+		$is_display = (!empty($video)) ? true : false;
1594 1594
 
1595
-    if ($tab == 'special_offers')
1596
-        $is_display = (!empty($special_offers)) ? true : false;
1595
+	if ($tab == 'special_offers')
1596
+		$is_display = (!empty($special_offers)) ? true : false;
1597 1597
 
1598
-    if ($tab == 'reviews')
1599
-        $is_display = (geodir_is_page('detail')) ? true : false;
1598
+	if ($tab == 'reviews')
1599
+		$is_display = (geodir_is_page('detail')) ? true : false;
1600 1600
 
1601
-    if ($tab == 'related_listing') {
1602
-       $message = __('No listings found which match your selection.', 'geodirectory');
1601
+	if ($tab == 'related_listing') {
1602
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1603 1603
        
1604
-       /** This action is documented in geodirectory-functions/template_functions.php */
1605
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1604
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1605
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1606 1606
        
1607
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1608
-    }
1607
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1608
+	}
1609 1609
 
1610
-    return $is_display;
1610
+	return $is_display;
1611 1611
 }
1612 1612
 
1613 1613
 
@@ -1623,69 +1623,69 @@  discard block
 block discarded – undo
1623 1623
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1624 1624
  */
1625 1625
 function geodir_changes_in_custom_fields_table() {
1626
-    global $wpdb, $plugin_prefix;
1626
+	global $wpdb, $plugin_prefix;
1627 1627
 	
1628 1628
 	// Remove unused virtual page
1629 1629
 	$listings_page_id = (int)get_option('geodir_listing_page');
1630 1630
 	if ($listings_page_id) {
1631 1631
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1632
-        delete_option('geodir_listing_page');
1632
+		delete_option('geodir_listing_page');
1633 1633
 	}
1634 1634
 
1635
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1636
-        $wpdb->query(
1637
-            $wpdb->prepare(
1638
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1639
-                array('1', '1', 'admin')
1640
-            )
1641
-        );
1635
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1636
+		$wpdb->query(
1637
+			$wpdb->prepare(
1638
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1639
+				array('1', '1', 'admin')
1640
+			)
1641
+		);
1642 1642
 
1643 1643
 
1644
-        /* --- terms meta value set --- */
1644
+		/* --- terms meta value set --- */
1645 1645
 
1646
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1646
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1647 1647
 
1648
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1648
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1649 1649
 
1650
-        if (!empty($options_data)) {
1650
+		if (!empty($options_data)) {
1651 1651
 
1652
-            foreach ($options_data as $optobj) {
1652
+			foreach ($options_data as $optobj) {
1653 1653
 
1654
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1654
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1655 1655
 
1656
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1656
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1657 1657
 
1658
-                if (!empty($taxonomies_data)) {
1658
+				if (!empty($taxonomies_data)) {
1659 1659
 
1660
-                    foreach ($taxonomies_data as $taxobj) {
1660
+					foreach ($taxonomies_data as $taxobj) {
1661 1661
 
1662
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1663
-                        $post_type = $taxObject->object_type[0];
1662
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1663
+						$post_type = $taxObject->object_type[0];
1664 1664
 
1665
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1665
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1666 1666
 
1667
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1667
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1668 1668
 
1669
-                        if ($duplicate_data) {
1669
+						if ($duplicate_data) {
1670 1670
 
1671
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1671
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1672 1672
 
1673
-                        } else {
1673
+						} else {
1674 1674
 
1675
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1675
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1676 1676
 
1677
-                        }
1677
+						}
1678 1678
 
1679
-                    }
1679
+					}
1680 1680
 
1681
-                }
1681
+				}
1682 1682
 
1683
-            }
1684
-        }
1683
+			}
1684
+		}
1685 1685
 
1686
-        update_option('geodir_changes_in_custom_fields_table', '1');
1686
+		update_option('geodir_changes_in_custom_fields_table', '1');
1687 1687
 
1688
-    }
1688
+	}
1689 1689
 
1690 1690
 }
1691 1691
 
@@ -1704,24 +1704,24 @@  discard block
 block discarded – undo
1704 1704
 function geodir_location_slug_check($slug)
1705 1705
 {
1706 1706
 
1707
-    global $wpdb, $table_prefix;
1707
+	global $wpdb, $table_prefix;
1708 1708
 
1709
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1709
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1710 1710
 
1711
-    if ($slug_exists) {
1711
+	if ($slug_exists) {
1712 1712
 
1713
-        $suffix = 1;
1714
-        do {
1715
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1716
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1717
-            $suffix++;
1718
-        } while ($location_slug_check && $suffix < 100);
1713
+		$suffix = 1;
1714
+		do {
1715
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1716
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1717
+			$suffix++;
1718
+		} while ($location_slug_check && $suffix < 100);
1719 1719
 
1720
-        $slug = $alt_location_name;
1720
+		$slug = $alt_location_name;
1721 1721
 
1722
-    }
1722
+	}
1723 1723
 
1724
-    return $slug;
1724
+	return $slug;
1725 1725
 
1726 1726
 }
1727 1727
 
@@ -1746,42 +1746,42 @@  discard block
 block discarded – undo
1746 1746
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1747 1747
 {
1748 1748
 
1749
-    global $wpdb, $plugin_prefix, $table_prefix;
1749
+	global $wpdb, $plugin_prefix, $table_prefix;
1750 1750
 
1751
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1751
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1752 1752
 
1753
-    $slug = $tern_data->slug;
1753
+	$slug = $tern_data->slug;
1754 1754
 
1755
-    /**
1756
-     * Filter if a term slug exists.
1757
-     *
1758
-     * @since 1.0.0
1759
-     * @package GeoDirectory
1760
-     * @param bool $bool Default: false.
1761
-     * @param string $slug The term slug.
1762
-     * @param int $term_id The term ID.
1763
-     */
1764
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1755
+	/**
1756
+	 * Filter if a term slug exists.
1757
+	 *
1758
+	 * @since 1.0.0
1759
+	 * @package GeoDirectory
1760
+	 * @param bool $bool Default: false.
1761
+	 * @param string $slug The term slug.
1762
+	 * @param int $term_id The term ID.
1763
+	 */
1764
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1765 1765
 
1766
-    if ($slug_exists) {
1766
+	if ($slug_exists) {
1767 1767
 
1768
-        $suffix = 1;
1769
-        do {
1770
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1768
+		$suffix = 1;
1769
+		do {
1770
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1771 1771
 
1772
-            /** This action is documented in geodirectory_hooks_actions.php */
1773
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1772
+			/** This action is documented in geodirectory_hooks_actions.php */
1773
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1774 1774
 
1775
-            $suffix++;
1776
-        } while ($term_slug_check && $suffix < 100);
1775
+			$suffix++;
1776
+		} while ($term_slug_check && $suffix < 100);
1777 1777
 
1778
-        $slug = $new_slug;
1778
+		$slug = $new_slug;
1779 1779
 
1780
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1780
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1781 1781
 
1782
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1782
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1783 1783
 
1784
-    }
1784
+	}
1785 1785
 	
1786 1786
 	// Update tag in detail table.
1787 1787
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1822,21 +1822,21 @@  discard block
 block discarded – undo
1822 1822
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1823 1823
 {
1824 1824
 
1825
-    global $wpdb, $table_prefix;
1825
+	global $wpdb, $table_prefix;
1826 1826
 
1827
-    $default_location = geodir_get_default_location();
1827
+	$default_location = geodir_get_default_location();
1828 1828
 
1829
-    $country_slug = $default_location->country_slug;
1830
-    $region_slug = $default_location->region_slug;
1831
-    $city_slug = $default_location->city_slug;
1829
+	$country_slug = $default_location->country_slug;
1830
+	$region_slug = $default_location->region_slug;
1831
+	$city_slug = $default_location->city_slug;
1832 1832
 
1833
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1834
-        return $slug_exists = true;
1833
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1834
+		return $slug_exists = true;
1835 1835
 
1836
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1837
-        return $slug_exists = true;
1836
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1837
+		return $slug_exists = true;
1838 1838
 
1839
-    return $slug_exists;
1839
+	return $slug_exists;
1840 1840
 }
1841 1841
 
1842 1842
 
@@ -1855,75 +1855,75 @@  discard block
 block discarded – undo
1855 1855
  */
1856 1856
 function geodir_custom_page_title($title = '', $sep = '')
1857 1857
 {
1858
-    global $wp;
1859
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1860
-        return $title;
1861
-    }
1858
+	global $wp;
1859
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1860
+		return $title;
1861
+	}
1862 1862
 
1863
-    if ($sep == '') {
1864
-        /**
1865
-         * Filter the page title separator.
1866
-         *
1867
-         * @since 1.0.0
1868
-         * @package GeoDirectory
1869
-         * @param string $sep The separator, default: `|`.
1870
-         */
1871
-        $sep = apply_filters('geodir_page_title_separator', '|');
1872
-    }
1863
+	if ($sep == '') {
1864
+		/**
1865
+		 * Filter the page title separator.
1866
+		 *
1867
+		 * @since 1.0.0
1868
+		 * @package GeoDirectory
1869
+		 * @param string $sep The separator, default: `|`.
1870
+		 */
1871
+		$sep = apply_filters('geodir_page_title_separator', '|');
1872
+	}
1873 1873
 
1874 1874
 
1875
-    $gd_page = '';
1876
-    if(geodir_is_page('home')){
1877
-        $gd_page = 'home';
1878
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('detail')){
1881
-        $gd_page = 'detail';
1882
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1883
-    }
1884
-    elseif(geodir_is_page('pt')){
1885
-        $gd_page = 'pt';
1886
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1887
-    }
1888
-    elseif(geodir_is_page('listing')){
1889
-        $gd_page = 'listing';
1890
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1891
-    }
1892
-    elseif(geodir_is_page('location')){
1893
-        $gd_page = 'location';
1894
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1895
-    }
1896
-    elseif(geodir_is_page('search')){
1897
-        $gd_page = 'search';
1898
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1899
-    }
1900
-    elseif(geodir_is_page('add-listing')){
1901
-        $gd_page = 'add-listing';
1902
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1903
-    }
1904
-    elseif(geodir_is_page('author')){
1905
-        $gd_page = 'author';
1906
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1907
-    }
1908
-    elseif(geodir_is_page('login')){
1909
-        $gd_page = 'login';
1910
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1911
-    }
1912
-    elseif(geodir_is_page('listing-success')){
1913
-        $gd_page = 'listing-success';
1914
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1915
-    }
1875
+	$gd_page = '';
1876
+	if(geodir_is_page('home')){
1877
+		$gd_page = 'home';
1878
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1879
+	}
1880
+	elseif(geodir_is_page('detail')){
1881
+		$gd_page = 'detail';
1882
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1883
+	}
1884
+	elseif(geodir_is_page('pt')){
1885
+		$gd_page = 'pt';
1886
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1887
+	}
1888
+	elseif(geodir_is_page('listing')){
1889
+		$gd_page = 'listing';
1890
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1891
+	}
1892
+	elseif(geodir_is_page('location')){
1893
+		$gd_page = 'location';
1894
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1895
+	}
1896
+	elseif(geodir_is_page('search')){
1897
+		$gd_page = 'search';
1898
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1899
+	}
1900
+	elseif(geodir_is_page('add-listing')){
1901
+		$gd_page = 'add-listing';
1902
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1903
+	}
1904
+	elseif(geodir_is_page('author')){
1905
+		$gd_page = 'author';
1906
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1907
+	}
1908
+	elseif(geodir_is_page('login')){
1909
+		$gd_page = 'login';
1910
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1911
+	}
1912
+	elseif(geodir_is_page('listing-success')){
1913
+		$gd_page = 'listing-success';
1914
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1915
+	}
1916 1916
 
1917 1917
 
1918
-    /**
1919
-     * Filter page meta title to replace variables.
1920
-     *
1921
-     * @since 1.5.4
1922
-     * @param string $title The page title including variables.
1923
-     * @param string $gd_page The GeoDirectory page type if any.
1924
-     * @param string $sep The title separator symbol.
1925
-     */
1926
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1918
+	/**
1919
+	 * Filter page meta title to replace variables.
1920
+	 *
1921
+	 * @since 1.5.4
1922
+	 * @param string $title The page title including variables.
1923
+	 * @param string $gd_page The GeoDirectory page type if any.
1924
+	 * @param string $sep The title separator symbol.
1925
+	 */
1926
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1927 1927
 
1928 1928
 }
1929 1929
 
@@ -1939,36 +1939,36 @@  discard block
 block discarded – undo
1939 1939
 function geodir_set_post_attachment()
1940 1940
 {
1941 1941
 
1942
-    if (!get_option('geodir_set_post_attachments')) {
1942
+	if (!get_option('geodir_set_post_attachments')) {
1943 1943
 
1944
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1945
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1944
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1945
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1946 1946
 
1947
-        $all_postypes = geodir_get_posttypes();
1947
+		$all_postypes = geodir_get_posttypes();
1948 1948
 
1949
-        foreach($all_postypes as $post_type){
1950
-            $args = array(
1951
-                'posts_per_page' => -1,
1952
-                'post_type' => $post_type,
1953
-                'post_status' => 'publish');
1949
+		foreach($all_postypes as $post_type){
1950
+			$args = array(
1951
+				'posts_per_page' => -1,
1952
+				'post_type' => $post_type,
1953
+				'post_status' => 'publish');
1954 1954
 
1955
-            $posts_array = get_posts($args);
1955
+			$posts_array = get_posts($args);
1956 1956
 
1957
-            if (!empty($posts_array)) {
1957
+			if (!empty($posts_array)) {
1958 1958
 
1959
-                foreach ($posts_array as $post) {
1959
+				foreach ($posts_array as $post) {
1960 1960
 
1961
-                    geodir_set_wp_featured_image($post->ID);
1961
+					geodir_set_wp_featured_image($post->ID);
1962 1962
 
1963
-                }
1963
+				}
1964 1964
 
1965
-            }
1966
-        }
1965
+			}
1966
+		}
1967 1967
 
1968 1968
 
1969
-        update_option('geodir_set_post_attachments', '1');
1969
+		update_option('geodir_set_post_attachments', '1');
1970 1970
 
1971
-    }
1971
+	}
1972 1972
 
1973 1973
 }
1974 1974
 
@@ -1985,19 +1985,19 @@  discard block
 block discarded – undo
1985 1985
 function geodir_remove_url_seperator()
1986 1986
 {
1987 1987
 
1988
-    if (!get_option('geodir_remove_url_seperator')) {
1988
+	if (!get_option('geodir_remove_url_seperator')) {
1989 1989
 
1990
-        if (get_option('geodir_listingurl_separator'))
1991
-            delete_option('geodir_listingurl_separator');
1990
+		if (get_option('geodir_listingurl_separator'))
1991
+			delete_option('geodir_listingurl_separator');
1992 1992
 
1993
-        if (get_option('geodir_detailurl_separator'))
1994
-            delete_option('geodir_detailurl_separator');
1993
+		if (get_option('geodir_detailurl_separator'))
1994
+			delete_option('geodir_detailurl_separator');
1995 1995
 
1996
-        flush_rewrite_rules(false);
1996
+		flush_rewrite_rules(false);
1997 1997
 
1998
-        update_option('geodir_remove_url_seperator', '1');
1998
+		update_option('geodir_remove_url_seperator', '1');
1999 1999
 
2000
-    }
2000
+	}
2001 2001
 
2002 2002
 }
2003 2003
 
@@ -2013,19 +2013,19 @@  discard block
 block discarded – undo
2013 2013
  */
2014 2014
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2015 2015
 {
2016
-    foreach ($permalink_arr as $key => $value) {
2016
+	foreach ($permalink_arr as $key => $value) {
2017 2017
 
2018
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2019
-            unset($permalink_arr[$key]);
2018
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2019
+			unset($permalink_arr[$key]);
2020 2020
 
2021
-    }
2021
+	}
2022 2022
 
2023
-    return $permalink_arr;
2023
+	return $permalink_arr;
2024 2024
 
2025 2025
 }
2026 2026
 
2027 2027
 if (!is_admin()) {
2028
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2028
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2029 2029
 }
2030 2030
 /**
2031 2031
  * Set status from draft to publish.
@@ -2038,16 +2038,16 @@  discard block
 block discarded – undo
2038 2038
  */
2039 2039
 function geodir_set_status_draft_to_publish_for_own_post($post)
2040 2040
 {
2041
-    $user_id = get_current_user_id();
2041
+	$user_id = get_current_user_id();
2042 2042
 
2043
-    if(!$user_id){return $post;}
2043
+	if(!$user_id){return $post;}
2044 2044
 
2045
-    $gd_post_types = geodir_get_posttypes();
2045
+	$gd_post_types = geodir_get_posttypes();
2046 2046
 
2047
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2048
-        $post[0]->post_status = 'publish';
2049
-    }
2050
-    return $post;
2047
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2048
+		$post[0]->post_status = 'publish';
2049
+	}
2050
+	return $post;
2051 2051
 }
2052 2052
 
2053 2053
 
@@ -2139,33 +2139,33 @@  discard block
 block discarded – undo
2139 2139
  */
2140 2140
 function geodir_detail_page_tab_headings_change($tabs_arr)
2141 2141
 {
2142
-    global $wpdb;
2142
+	global $wpdb;
2143 2143
 
2144
-    $post_type = geodir_get_current_posttype();
2144
+	$post_type = geodir_get_current_posttype();
2145 2145
 
2146
-    $all_postypes = geodir_get_posttypes();
2146
+	$all_postypes = geodir_get_posttypes();
2147 2147
 
2148
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2148
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2149 2149
 
2150
-        if (array_key_exists('post_video', $tabs_arr)) {
2150
+		if (array_key_exists('post_video', $tabs_arr)) {
2151 2151
 
2152
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2152
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2153 2153
 
2154
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2155
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2156
-        }
2154
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2155
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2156
+		}
2157 2157
 
2158
-        if (array_key_exists('special_offers', $tabs_arr)) {
2158
+		if (array_key_exists('special_offers', $tabs_arr)) {
2159 2159
 
2160
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2160
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2161 2161
 
2162
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2163
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2164
-        }
2162
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2163
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2164
+		}
2165 2165
 
2166
-    }
2166
+	}
2167 2167
 
2168
-    return $tabs_arr;
2168
+	return $tabs_arr;
2169 2169
 
2170 2170
 }
2171 2171
 
@@ -2178,10 +2178,10 @@  discard block
 block discarded – undo
2178 2178
  */
2179 2179
 function geodir_remove_template_redirect_actions()
2180 2180
 {
2181
-    if (geodir_is_page('login')){
2182
-        remove_all_actions('template_redirect');
2183
-        remove_action('init', 'avia_modify_front', 10);
2184
-    }
2181
+	if (geodir_is_page('login')){
2182
+		remove_all_actions('template_redirect');
2183
+		remove_action('init', 'avia_modify_front', 10);
2184
+	}
2185 2185
 }
2186 2186
 
2187 2187
 
@@ -2203,51 +2203,51 @@  discard block
 block discarded – undo
2203 2203
 function geodirectory_before_featured_image_delete($attachment_id)
2204 2204
 {
2205 2205
 
2206
-    global $wpdb, $plugin_prefix;
2206
+	global $wpdb, $plugin_prefix;
2207 2207
 
2208
-    $post_id = get_post_field('post_parent', $attachment_id);
2208
+	$post_id = get_post_field('post_parent', $attachment_id);
2209 2209
 
2210
-    $attachment_url = wp_get_attachment_url($attachment_id);
2210
+	$attachment_url = wp_get_attachment_url($attachment_id);
2211 2211
 
2212
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2212
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2213 2213
 
2214
-        $post_type = get_post_type($post_id);
2214
+		$post_type = get_post_type($post_id);
2215 2215
 
2216
-        $all_postypes = geodir_get_posttypes();
2216
+		$all_postypes = geodir_get_posttypes();
2217 2217
 
2218
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2219
-            return false;
2218
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2219
+			return false;
2220 2220
 
2221
-        $uploads = wp_upload_dir();
2221
+		$uploads = wp_upload_dir();
2222 2222
 
2223
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2223
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2224 2224
 
2225
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2225
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2226 2226
 
2227
-        $wpdb->query(
2228
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2229
-                array($post_id, $split_img_file_path)
2230
-            )
2231
-        );
2227
+		$wpdb->query(
2228
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2229
+				array($post_id, $split_img_file_path)
2230
+			)
2231
+		);
2232 2232
 
2233
-        $attachment_data = $wpdb->get_row(
2234
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2235
-                array($post_id)
2236
-            )
2237
-        );
2233
+		$attachment_data = $wpdb->get_row(
2234
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2235
+				array($post_id)
2236
+			)
2237
+		);
2238 2238
 
2239
-        if (!empty($attachment_data)) {
2240
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2241
-        }
2239
+		if (!empty($attachment_data)) {
2240
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2241
+		}
2242 2242
 
2243 2243
 
2244
-        $table_name = $plugin_prefix . $post_type . '_detail';
2244
+		$table_name = $plugin_prefix . $post_type . '_detail';
2245 2245
 
2246
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2246
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2247 2247
 
2248
-        geodir_set_wp_featured_image($post_id);
2248
+		geodir_set_wp_featured_image($post_id);
2249 2249
 
2250
-    }
2250
+	}
2251 2251
 
2252 2252
 }
2253 2253
 
@@ -2265,79 +2265,79 @@  discard block
 block discarded – undo
2265 2265
 function geodir_temp_set_post_attachment()
2266 2266
 {
2267 2267
 
2268
-    global $wpdb, $plugin_prefix;
2268
+	global $wpdb, $plugin_prefix;
2269 2269
 
2270
-    $all_postypes = geodir_get_posttypes();
2270
+	$all_postypes = geodir_get_posttypes();
2271 2271
 
2272
-    foreach ($all_postypes as $posttype) {
2272
+	foreach ($all_postypes as $posttype) {
2273 2273
 
2274
-        $tablename = $plugin_prefix . $posttype . '_detail';
2274
+		$tablename = $plugin_prefix . $posttype . '_detail';
2275 2275
 
2276
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2276
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2277 2277
 
2278
-        if (!empty($get_post_data)) {
2278
+		if (!empty($get_post_data)) {
2279 2279
 
2280
-            foreach ($get_post_data as $data) {
2280
+			foreach ($get_post_data as $data) {
2281 2281
 
2282
-                $post_id = $data->post_id;
2282
+				$post_id = $data->post_id;
2283 2283
 
2284
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2284
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2285 2285
 
2286
-                if (!empty($attachment_data)) {
2286
+				if (!empty($attachment_data)) {
2287 2287
 
2288
-                    foreach ($attachment_data as $attach) {
2288
+					foreach ($attachment_data as $attach) {
2289 2289
 
2290
-                        $file_info = pathinfo($attach->file);
2290
+						$file_info = pathinfo($attach->file);
2291 2291
 
2292
-                        $sub_dir = '';
2293
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2294
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2292
+						$sub_dir = '';
2293
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2294
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2295 2295
 
2296
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2297
-                        $uploads_path = $uploads['basedir'];
2296
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2297
+						$uploads_path = $uploads['basedir'];
2298 2298
 
2299
-                        $file_name = $file_info['basename'];
2299
+						$file_name = $file_info['basename'];
2300 2300
 
2301
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2301
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2302 2302
 
2303
-                        if (!file_exists($img_arr['path'])) {
2303
+						if (!file_exists($img_arr['path'])) {
2304 2304
 
2305
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2305
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2306 2306
 
2307
-                        }
2307
+						}
2308 2308
 
2309
-                    }
2309
+					}
2310 2310
 
2311
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2311
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2312 2312
 
2313
-                    if (!empty($attachment_data)) {
2313
+					if (!empty($attachment_data)) {
2314 2314
 
2315
-                        if ($attachment_data->ID)
2316
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2315
+						if ($attachment_data->ID)
2316
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2317 2317
 
2318
-                    } else {
2318
+					} else {
2319 2319
 
2320
-                        if (has_post_thumbnail($post_id)) {
2320
+						if (has_post_thumbnail($post_id)) {
2321 2321
 
2322
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2322
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2323 2323
 
2324
-                            wp_delete_attachment($post_thumbnail_id);
2324
+							wp_delete_attachment($post_thumbnail_id);
2325 2325
 
2326
-                        }
2326
+						}
2327 2327
 
2328
-                    }
2328
+					}
2329 2329
 
2330
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2330
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2331 2331
 
2332
-                    geodir_set_wp_featured_image($post_id);
2332
+					geodir_set_wp_featured_image($post_id);
2333 2333
 
2334
-                }
2334
+				}
2335 2335
 
2336
-            }
2336
+			}
2337 2337
 
2338
-        }
2338
+		}
2339 2339
 
2340
-    }
2340
+	}
2341 2341
 
2342 2342
 }
2343 2343
 
@@ -2355,9 +2355,9 @@  discard block
 block discarded – undo
2355 2355
 function geodir_default_rating_star_icon()
2356 2356
 {
2357 2357
 
2358
-    if (!get_option('geodir_default_rating_star_icon')) {
2359
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2360
-    }
2358
+	if (!get_option('geodir_default_rating_star_icon')) {
2359
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2360
+	}
2361 2361
 
2362 2362
 }
2363 2363
 
@@ -2375,27 +2375,27 @@  discard block
 block discarded – undo
2375 2375
  */
2376 2376
 function geodir_user_post_listing_count($user_id=null)
2377 2377
 {
2378
-    global $wpdb, $plugin_prefix, $current_user;
2379
-    if(!$user_id){
2380
-        $user_id = $current_user->ID;
2381
-    }
2378
+	global $wpdb, $plugin_prefix, $current_user;
2379
+	if(!$user_id){
2380
+		$user_id = $current_user->ID;
2381
+	}
2382 2382
 
2383
-    $user_id = $current_user->ID;
2384
-    $all_postypes = geodir_get_posttypes();
2385
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2383
+	$user_id = $current_user->ID;
2384
+	$all_postypes = geodir_get_posttypes();
2385
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2386 2386
 
2387
-    $user_listing = array();
2388
-    if (is_array($all_posts) && !empty($all_posts)) {
2389
-        foreach ($all_posts as $ptype) {
2390
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2387
+	$user_listing = array();
2388
+	if (is_array($all_posts) && !empty($all_posts)) {
2389
+		foreach ($all_posts as $ptype) {
2390
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2391 2391
 
2392
-            if ($total_posts > 0) {
2393
-                $user_listing[$ptype] = $total_posts;
2394
-            }
2395
-        }
2396
-    }
2392
+			if ($total_posts > 0) {
2393
+				$user_listing[$ptype] = $total_posts;
2394
+			}
2395
+		}
2396
+	}
2397 2397
 
2398
-    return $user_listing;
2398
+	return $user_listing;
2399 2399
 }
2400 2400
 
2401 2401
 
@@ -2415,579 +2415,579 @@  discard block
 block discarded – undo
2415 2415
  */
2416 2416
 function geodir_detail_page_custom_field_tab($tabs_arr)
2417 2417
 {
2418
-    global $post;
2419
-
2420
-    $post_type = geodir_get_current_posttype();
2421
-    $all_postypes = geodir_get_posttypes();
2422
-
2423
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2424
-        $package_info = array();
2425
-        $package_info = geodir_post_package_info($package_info, $post);
2426
-        $post_package_id = $package_info->pid;
2427
-        $fields_location = 'detail';
2428
-
2429
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2430
-        if (!empty($custom_fields)) {
2431
-            $parse_custom_fields = array();
2432
-            foreach ($custom_fields as $field) {
2433
-                $field = stripslashes_deep($field); // strip slashes
2418
+	global $post;
2419
+
2420
+	$post_type = geodir_get_current_posttype();
2421
+	$all_postypes = geodir_get_posttypes();
2422
+
2423
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2424
+		$package_info = array();
2425
+		$package_info = geodir_post_package_info($package_info, $post);
2426
+		$post_package_id = $package_info->pid;
2427
+		$fields_location = 'detail';
2428
+
2429
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2430
+		if (!empty($custom_fields)) {
2431
+			$parse_custom_fields = array();
2432
+			foreach ($custom_fields as $field) {
2433
+				$field = stripslashes_deep($field); // strip slashes
2434 2434
                 
2435
-                $type = $field;
2436
-                $field_name = $field['htmlvar_name'];
2437
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2438
-                    $post->{$field_name} = $_REQUEST[$field_name];
2439
-                }
2440
-
2441
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2442
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2443
-                        continue;
2444
-                    }
2445
-
2446
-                    $parse_custom_fields[] = $field;
2447
-                }
2448
-            }
2449
-            $custom_fields = $parse_custom_fields;
2450
-        }
2451
-
2452
-        if (!empty($custom_fields)) {
2453
-            $field_set_start = 0;
2454
-            $fieldset_count = 0;
2455
-            $fieldset = '';
2456
-            $total_fields = count($custom_fields);
2457
-            $count_field = 0;
2458
-            $fieldset_arr = array();
2459
-            $i = 0;
2460
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2461
-
2462
-            foreach ($custom_fields as $field) {
2463
-                $count_field++;
2464
-                $field_name = $field['htmlvar_name'];
2465
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2466
-                    $post->{$field_name} = $_REQUEST[$field_name];
2467
-                }
2468
-
2469
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2470
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2471
-                    $site_title = trim($field['site_title']);
2472
-                    $type = $field;
2473
-                    $html = '';
2474
-                    $html_var = $field_name;
2475
-                    $field_icon = '';
2476
-                    $variables_array = array();
2477
-
2478
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2479
-                        continue;
2480
-                    }
2481
-
2482
-                    if ($type['type'] != 'fieldset') {
2483
-                        $i++;
2484
-                        $variables_array['post_id'] = $post->ID;
2485
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2486
-                        $variables_array['value'] = '';
2487
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2488
-                    }
2489
-
2490
-                    if (strpos($type['field_icon'], 'http') !== false) {
2491
-                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2492
-                    } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2493
-                        $field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2494
-                    }
2435
+				$type = $field;
2436
+				$field_name = $field['htmlvar_name'];
2437
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2438
+					$post->{$field_name} = $_REQUEST[$field_name];
2439
+				}
2440
+
2441
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2442
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2443
+						continue;
2444
+					}
2445
+
2446
+					$parse_custom_fields[] = $field;
2447
+				}
2448
+			}
2449
+			$custom_fields = $parse_custom_fields;
2450
+		}
2495 2451
 
2496
-                    switch ($type['type']) {
2497
-                        case 'fieldset': {
2498
-                            $i = 0;
2499
-                            $fieldset_count++;
2500
-                            $field_set_start = 1;
2501
-                            $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2502
-                            $fieldset_arr[$fieldset_count]['label'] = $label;
2503
-                        }
2504
-                            break;
2505
-                        case 'url': {
2506
-                            if (strpos($field_icon, 'http') !== false) {
2507
-                                $field_icon_af = '';
2508
-                            } elseif ($field_icon == '') {
2509
-
2510
-                                if ($type['name'] == 'geodir_facebook') {
2511
-                                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
2512
-                                } elseif ($type['name'] == 'geodir_twitter') {
2513
-                                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
2514
-                                } else {
2515
-                                    $field_icon_af = '<i class="fa fa-link"></i>';
2516
-                                }
2517
-
2518
-                            } else {
2519
-                                $field_icon_af = $field_icon;
2520
-                                $field_icon = '';
2521
-                            }
2452
+		if (!empty($custom_fields)) {
2453
+			$field_set_start = 0;
2454
+			$fieldset_count = 0;
2455
+			$fieldset = '';
2456
+			$total_fields = count($custom_fields);
2457
+			$count_field = 0;
2458
+			$fieldset_arr = array();
2459
+			$i = 0;
2460
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2461
+
2462
+			foreach ($custom_fields as $field) {
2463
+				$count_field++;
2464
+				$field_name = $field['htmlvar_name'];
2465
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2466
+					$post->{$field_name} = $_REQUEST[$field_name];
2467
+				}
2468
+
2469
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2470
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2471
+					$site_title = trim($field['site_title']);
2472
+					$type = $field;
2473
+					$html = '';
2474
+					$html_var = $field_name;
2475
+					$field_icon = '';
2476
+					$variables_array = array();
2477
+
2478
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2479
+						continue;
2480
+					}
2481
+
2482
+					if ($type['type'] != 'fieldset') {
2483
+						$i++;
2484
+						$variables_array['post_id'] = $post->ID;
2485
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2486
+						$variables_array['value'] = '';
2487
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2488
+					}
2489
+
2490
+					if (strpos($type['field_icon'], 'http') !== false) {
2491
+						$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2492
+					} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2493
+						$field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2494
+					}
2495
+
2496
+					switch ($type['type']) {
2497
+						case 'fieldset': {
2498
+							$i = 0;
2499
+							$fieldset_count++;
2500
+							$field_set_start = 1;
2501
+							$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2502
+							$fieldset_arr[$fieldset_count]['label'] = $label;
2503
+						}
2504
+							break;
2505
+						case 'url': {
2506
+							if (strpos($field_icon, 'http') !== false) {
2507
+								$field_icon_af = '';
2508
+							} elseif ($field_icon == '') {
2509
+
2510
+								if ($type['name'] == 'geodir_facebook') {
2511
+									$field_icon_af = '<i class="fa fa-facebook-square"></i>';
2512
+								} elseif ($type['name'] == 'geodir_twitter') {
2513
+									$field_icon_af = '<i class="fa fa-twitter-square"></i>';
2514
+								} else {
2515
+									$field_icon_af = '<i class="fa fa-link"></i>';
2516
+								}
2517
+
2518
+							} else {
2519
+								$field_icon_af = $field_icon;
2520
+								$field_icon = '';
2521
+							}
2522 2522
                             
2523
-                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2524
-
2525
-                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2526
-                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2527
-                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2528
-
2529
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2530
-
2531
-                            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
2532
-                            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2533
-
2534
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2535
-                                /**
2536
-                                 * Filer the custom field website name.
2537
-                                 *
2538
-                                 * @since 1.0.0
2539
-                                 * @param string $title The field name default: "Website".
2540
-                                 * @param string $website The website address.
2541
-                                 * @param int $post->ID The post ID.
2542
-                                 */
2543
-                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2544
-                        }
2545
-                            break;
2546
-                        case 'phone': {
2547
-                            if (strpos($field_icon, 'http') !== false) {
2548
-                                $field_icon_af = '';
2549
-                            } elseif ($field_icon == '') {
2550
-                                $field_icon_af = '<i class="fa fa-phone"></i>';
2551
-                            } else {
2552
-                                $field_icon_af = $field_icon;
2553
-                                $field_icon = '';
2554
-                            }
2555
-
2556
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2557
-
2558
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2559
-                            if ($field_set_start == 1 && $site_title != '') {
2560
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2561
-                            }
2562
-                            $html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2563
-                        }
2564
-                            break;
2565
-                        case 'time': {
2566
-                            $value = '';
2567
-                            if ($post->{$type['htmlvar_name']} != '')
2568
-                                $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2569
-
2570
-                            if (strpos($field_icon, 'http') !== false) {
2571
-                                $field_icon_af = '';
2572
-                            } elseif ($field_icon == '') {
2573
-                                $field_icon_af = '<i class="fa fa-clock-o"></i>';
2574
-                            } else {
2575
-                                $field_icon_af = $field_icon;
2576
-                                $field_icon = '';
2577
-                            }
2578
-
2579
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2580
-
2581
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2582
-                            if ($field_set_start == 1 && $site_title != '') {
2583
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2584
-                            }
2585
-                            $html .= ' </span>' . stripslashes($value) . '</div>';
2586
-                        }
2587
-                            break;
2588
-                        case 'datepicker': {
2589
-                            $date_format = geodir_default_date_format();
2590
-                            if ($type['extra_fields'] != '') {
2591
-                                $date_format = unserialize($type['extra_fields']);
2592
-                                $date_format = $date_format['date_format'];
2593
-                            }
2594
-
2595
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2596
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2597
-
2598
-                            $date_format = str_replace($search, $replace, $date_format);
2599
-
2600
-                            $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2601
-
2602
-                            $value = '';
2603
-                            if ($post->{$type['htmlvar_name']} != '')
2604
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2605
-
2606
-                            if (strpos($field_icon, 'http') !== false) {
2607
-                                $field_icon_af = '';
2608
-                            } elseif ($field_icon == '') {
2609
-                                $field_icon_af = '<i class="fa fa-calendar"></i>';
2610
-                            } else {
2611
-                                $field_icon_af = $field_icon;
2612
-                                $field_icon = '';
2613
-                            }
2614
-
2615
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2616
-
2617
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2618
-                            if ($field_set_start == 1 && $site_title != '') {
2619
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2620
-                            }
2621
-                            $html .= ' </span>' . $value . '</div>';
2622
-                        }
2623
-                            break;
2624
-                        case 'text': {
2625
-                            if (strpos($field_icon, 'http') !== false) {
2626
-                                $field_icon_af = '';
2627
-                            } elseif ($field_icon == '') {
2628
-                                $field_icon_af = '';
2629
-                            } else {
2630
-                                $field_icon_af = $field_icon;
2631
-                                $field_icon = '';
2632
-                            }
2633
-
2634
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2635
-
2636
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2637
-                            if ($field_set_start == 1 && $site_title != '') {
2638
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2639
-                            }
2640
-                            $html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2641
-                        }
2642
-                            break;
2643
-                        case 'radio': {
2644
-
2645
-                            if ($post->{$type['htmlvar_name']} != '') {
2646
-                                if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2647
-                                    $html_val = __('No', 'geodirectory');
2648
-                                } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2649
-                                    $html_val = __('Yes', 'geodirectory');
2650
-                                } else {
2651
-                                    $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2523
+							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2524
+
2525
+							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2526
+							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2527
+							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2528
+
2529
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2530
+
2531
+							// all search engines that use the nofollow value exclude links that use it from their ranking calculation
2532
+							$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2533
+
2534
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2535
+								/**
2536
+								 * Filer the custom field website name.
2537
+								 *
2538
+								 * @since 1.0.0
2539
+								 * @param string $title The field name default: "Website".
2540
+								 * @param string $website The website address.
2541
+								 * @param int $post->ID The post ID.
2542
+								 */
2543
+								apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2544
+						}
2545
+							break;
2546
+						case 'phone': {
2547
+							if (strpos($field_icon, 'http') !== false) {
2548
+								$field_icon_af = '';
2549
+							} elseif ($field_icon == '') {
2550
+								$field_icon_af = '<i class="fa fa-phone"></i>';
2551
+							} else {
2552
+								$field_icon_af = $field_icon;
2553
+								$field_icon = '';
2554
+							}
2555
+
2556
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2557
+
2558
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2559
+							if ($field_set_start == 1 && $site_title != '') {
2560
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2561
+							}
2562
+							$html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2563
+						}
2564
+							break;
2565
+						case 'time': {
2566
+							$value = '';
2567
+							if ($post->{$type['htmlvar_name']} != '')
2568
+								$value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2569
+
2570
+							if (strpos($field_icon, 'http') !== false) {
2571
+								$field_icon_af = '';
2572
+							} elseif ($field_icon == '') {
2573
+								$field_icon_af = '<i class="fa fa-clock-o"></i>';
2574
+							} else {
2575
+								$field_icon_af = $field_icon;
2576
+								$field_icon = '';
2577
+							}
2578
+
2579
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2580
+
2581
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2582
+							if ($field_set_start == 1 && $site_title != '') {
2583
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2584
+							}
2585
+							$html .= ' </span>' . stripslashes($value) . '</div>';
2586
+						}
2587
+							break;
2588
+						case 'datepicker': {
2589
+							$date_format = geodir_default_date_format();
2590
+							if ($type['extra_fields'] != '') {
2591
+								$date_format = unserialize($type['extra_fields']);
2592
+								$date_format = $date_format['date_format'];
2593
+							}
2594
+
2595
+							$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2596
+							$replace = array('d','j','l','m','n','F','Y');//PHP date format
2597
+
2598
+							$date_format = str_replace($search, $replace, $date_format);
2599
+
2600
+							$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2601
+
2602
+							$value = '';
2603
+							if ($post->{$type['htmlvar_name']} != '')
2604
+								$value = date($date_format, strtotime($post_htmlvar_value));
2605
+
2606
+							if (strpos($field_icon, 'http') !== false) {
2607
+								$field_icon_af = '';
2608
+							} elseif ($field_icon == '') {
2609
+								$field_icon_af = '<i class="fa fa-calendar"></i>';
2610
+							} else {
2611
+								$field_icon_af = $field_icon;
2612
+								$field_icon = '';
2613
+							}
2614
+
2615
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2616
+
2617
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2618
+							if ($field_set_start == 1 && $site_title != '') {
2619
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2620
+							}
2621
+							$html .= ' </span>' . $value . '</div>';
2622
+						}
2623
+							break;
2624
+						case 'text': {
2625
+							if (strpos($field_icon, 'http') !== false) {
2626
+								$field_icon_af = '';
2627
+							} elseif ($field_icon == '') {
2628
+								$field_icon_af = '';
2629
+							} else {
2630
+								$field_icon_af = $field_icon;
2631
+								$field_icon = '';
2632
+							}
2633
+
2634
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2635
+
2636
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2637
+							if ($field_set_start == 1 && $site_title != '') {
2638
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2639
+							}
2640
+							$html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2641
+						}
2642
+							break;
2643
+						case 'radio': {
2644
+
2645
+							if ($post->{$type['htmlvar_name']} != '') {
2646
+								if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2647
+									$html_val = __('No', 'geodirectory');
2648
+								} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2649
+									$html_val = __('Yes', 'geodirectory');
2650
+								} else {
2651
+									$html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2652 2652
                                     
2653
-                                    if (!empty($type['option_values'])) {
2654
-                                        $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2653
+									if (!empty($type['option_values'])) {
2654
+										$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2655 2655
                                         
2656
-                                        if (!empty($cf_option_values)) {
2657
-                                            foreach ($cf_option_values as $cf_option_value) {
2658
-                                                if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2659
-                                                    $html_val = $cf_option_value['label'];
2660
-                                                }
2661
-                                            }
2662
-                                        }
2663
-                                    }
2664
-                                }
2665
-
2666
-                                if (strpos($field_icon, 'http') !== false) {
2667
-                                    $field_icon_af = '';
2668
-                                } else if ($field_icon == '') {
2669
-                                    $field_icon_af = '';
2670
-                                } else {
2671
-                                    $field_icon_af = $field_icon;
2672
-                                    $field_icon = '';
2673
-                                }
2674
-
2675
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2676
-
2677
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2678
-
2679
-                                if ($field_set_start == 1 && $site_title != '') {
2680
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2681
-                                }
2682
-
2683
-                                $html .= ' </span>' . $html_val . '</div>';
2684
-                            }
2685
-                        }
2686
-                            break;
2687
-                        case 'checkbox': {
2688
-                            $html_var = $type['htmlvar_name'];
2689
-                            $html_val = $type['htmlvar_name'];
2690
-
2691
-                            if ((int)$post->{$html_var} == 1) {
2692
-
2693
-                                if ($post->{$type['htmlvar_name']} == '1') {
2694
-                                    $html_val = __('Yes', 'geodirectory');
2695
-                                } else {
2696
-                                    $html_val = __('No', 'geodirectory');
2697
-                                }
2698
-
2699
-                                if (strpos($field_icon, 'http') !== false) {
2700
-                                    $field_icon_af = '';
2701
-                                } else if ($field_icon == '') {
2702
-                                    $field_icon_af = '';
2703
-                                } else {
2704
-                                    $field_icon_af = $field_icon;
2705
-                                    $field_icon = '';
2706
-                                }
2707
-
2708
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2709
-
2710
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2711
-
2712
-                                if ($field_set_start == 1 && $site_title != '') {
2713
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2714
-                                }
2715
-
2716
-                                $html .= ' </span>' . $html_val . '</div>';
2717
-                            }
2718
-                        }
2719
-                            break;
2720
-                        case 'select': {
2721
-                            if (strpos($field_icon, 'http') !== false) {
2722
-                                $field_icon_af = '';
2723
-                            } elseif ($field_icon == '') {
2724
-                                $field_icon_af = '';
2725
-                            } else {
2726
-                                $field_icon_af = $field_icon;
2727
-                                $field_icon = '';
2728
-                            }
2656
+										if (!empty($cf_option_values)) {
2657
+											foreach ($cf_option_values as $cf_option_value) {
2658
+												if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2659
+													$html_val = $cf_option_value['label'];
2660
+												}
2661
+											}
2662
+										}
2663
+									}
2664
+								}
2665
+
2666
+								if (strpos($field_icon, 'http') !== false) {
2667
+									$field_icon_af = '';
2668
+								} else if ($field_icon == '') {
2669
+									$field_icon_af = '';
2670
+								} else {
2671
+									$field_icon_af = $field_icon;
2672
+									$field_icon = '';
2673
+								}
2674
+
2675
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2676
+
2677
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2678
+
2679
+								if ($field_set_start == 1 && $site_title != '') {
2680
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2681
+								}
2682
+
2683
+								$html .= ' </span>' . $html_val . '</div>';
2684
+							}
2685
+						}
2686
+							break;
2687
+						case 'checkbox': {
2688
+							$html_var = $type['htmlvar_name'];
2689
+							$html_val = $type['htmlvar_name'];
2690
+
2691
+							if ((int)$post->{$html_var} == 1) {
2692
+
2693
+								if ($post->{$type['htmlvar_name']} == '1') {
2694
+									$html_val = __('Yes', 'geodirectory');
2695
+								} else {
2696
+									$html_val = __('No', 'geodirectory');
2697
+								}
2698
+
2699
+								if (strpos($field_icon, 'http') !== false) {
2700
+									$field_icon_af = '';
2701
+								} else if ($field_icon == '') {
2702
+									$field_icon_af = '';
2703
+								} else {
2704
+									$field_icon_af = $field_icon;
2705
+									$field_icon = '';
2706
+								}
2707
+
2708
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2709
+
2710
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2711
+
2712
+								if ($field_set_start == 1 && $site_title != '') {
2713
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2714
+								}
2715
+
2716
+								$html .= ' </span>' . $html_val . '</div>';
2717
+							}
2718
+						}
2719
+							break;
2720
+						case 'select': {
2721
+							if (strpos($field_icon, 'http') !== false) {
2722
+								$field_icon_af = '';
2723
+							} elseif ($field_icon == '') {
2724
+								$field_icon_af = '';
2725
+							} else {
2726
+								$field_icon_af = $field_icon;
2727
+								$field_icon = '';
2728
+							}
2729 2729
                             
2730
-                            $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2730
+							$field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2731 2731
                             
2732
-                            if (!empty($type['option_values'])) {
2733
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2732
+							if (!empty($type['option_values'])) {
2733
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2734 2734
                                 
2735
-                                if (!empty($cf_option_values)) {
2736
-                                    foreach ($cf_option_values as $cf_option_value) {
2737
-                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2738
-                                            $field_value = $cf_option_value['label'];
2739
-                                        }
2740
-                                    }
2741
-                                }
2742
-                            }
2743
-
2744
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2745
-
2746
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2747
-                            if ($field_set_start == 1 && $site_title != '') {
2748
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2749
-                            }
2750
-                            $html .= ' </span>' . $field_value . '</div>';
2751
-                        }
2752
-                            break;
2753
-                        case 'multiselect': {
2754
-                            if (is_array($post->{$type['htmlvar_name']})) {
2755
-                                $post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2756
-                            }
2757
-
2758
-                            if (strpos($field_icon, 'http') !== false) {
2759
-                                $field_icon_af = '';
2760
-                            } elseif ($field_icon == '') {
2761
-                                $field_icon_af = '';
2762
-                            } else {
2763
-                                $field_icon_af = $field_icon;
2764
-                                $field_icon = '';
2765
-                            }
2766
-
2767
-                            $field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2768
-
2769
-                            $option_values = array();
2770
-                            if (!empty($type['option_values'])) {
2771
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2735
+								if (!empty($cf_option_values)) {
2736
+									foreach ($cf_option_values as $cf_option_value) {
2737
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2738
+											$field_value = $cf_option_value['label'];
2739
+										}
2740
+									}
2741
+								}
2742
+							}
2743
+
2744
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2745
+
2746
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2747
+							if ($field_set_start == 1 && $site_title != '') {
2748
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2749
+							}
2750
+							$html .= ' </span>' . $field_value . '</div>';
2751
+						}
2752
+							break;
2753
+						case 'multiselect': {
2754
+							if (is_array($post->{$type['htmlvar_name']})) {
2755
+								$post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2756
+							}
2757
+
2758
+							if (strpos($field_icon, 'http') !== false) {
2759
+								$field_icon_af = '';
2760
+							} elseif ($field_icon == '') {
2761
+								$field_icon_af = '';
2762
+							} else {
2763
+								$field_icon_af = $field_icon;
2764
+								$field_icon = '';
2765
+							}
2766
+
2767
+							$field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2768
+
2769
+							$option_values = array();
2770
+							if (!empty($type['option_values'])) {
2771
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2772 2772
                                 
2773
-                                if (!empty($cf_option_values)) {
2774
-                                    foreach ($cf_option_values as $cf_option_value) {
2775
-                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2776
-                                            $option_values[] = $cf_option_value['label'];
2777
-                                        }
2778
-                                    }
2779
-                                }
2780
-                            }
2781
-
2782
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2783
-
2784
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2785
-                            if ($field_set_start == 1 && $site_title != '') {
2786
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2787
-                            }
2788
-                            $html .= ' </span>';
2789
-
2790
-                            if (count($option_values) > 1) {
2791
-                                $html .= '<ul>';
2792
-                                foreach ($option_values as $val) {
2793
-                                    $html .= '<li>' . $val . '</li>';
2794
-                                }
2795
-                                $html .= '</ul>';
2796
-                            } else {
2797
-                                $html .= $post->{$type['htmlvar_name']};
2798
-                            }
2799
-                            $html .= '</div>';
2800
-                        }
2801
-                            break;
2802
-                        case 'email': {
2803
-                            if (strpos($field_icon, 'http') !== false) {
2804
-                                $field_icon_af = '';
2805
-                            } elseif ($field_icon == '') {
2806
-                                $field_icon_af = '<i class="fa fa-envelope"></i>';
2807
-                            } else {
2808
-                                $field_icon_af = $field_icon;
2809
-                                $field_icon = '';
2810
-                            }
2811
-
2812
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2813
-
2814
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2815
-                            if ($field_set_start == 1 && $site_title != '') {
2816
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2817
-                            }
2818
-                            $html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2819
-                        }
2820
-                            break;
2821
-                        case 'textarea': {
2822
-                            if (strpos($field_icon, 'http') !== false) {
2823
-                                $field_icon_af = '';
2824
-                            } elseif ($field_icon == '') {
2825
-                                $field_icon_af = '';
2826
-                            } else {
2827
-                                $field_icon_af = $field_icon;
2828
-                                $field_icon = '';
2829
-                            }
2830
-
2831
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2832
-
2833
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2834
-                            if ($field_set_start == 1 && $site_title != '') {
2835
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2836
-                            }
2837
-                            $html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2838
-                        }
2839
-                            break;
2840
-                        case 'html': {
2841
-                            if (strpos($field_icon, 'http') !== false) {
2842
-                                $field_icon_af = '';
2843
-                            } elseif ($field_icon == '') {
2844
-                                $field_icon_af = '';
2845
-                            } else {
2846
-                                $field_icon_af = $field_icon;
2847
-                                $field_icon = '';
2848
-                            }
2849
-
2850
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2851
-
2852
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2853
-                            if ($field_set_start == 1 && $site_title != '') {
2854
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2855
-                            }
2856
-                            $html .= ' </span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2857
-                        }
2858
-                        break;
2859
-                        case 'file': {
2860
-                            $html_var = $type['htmlvar_name'];
2861
-
2862
-                            if (!empty($post->{$type['htmlvar_name']})) {
2863
-                                $files = explode(",", $post->{$type['htmlvar_name']});
2864
-
2865
-                                if (!empty($files)) {
2866
-                                    $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2867
-                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2773
+								if (!empty($cf_option_values)) {
2774
+									foreach ($cf_option_values as $cf_option_value) {
2775
+										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2776
+											$option_values[] = $cf_option_value['label'];
2777
+										}
2778
+									}
2779
+								}
2780
+							}
2781
+
2782
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2783
+
2784
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2785
+							if ($field_set_start == 1 && $site_title != '') {
2786
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2787
+							}
2788
+							$html .= ' </span>';
2789
+
2790
+							if (count($option_values) > 1) {
2791
+								$html .= '<ul>';
2792
+								foreach ($option_values as $val) {
2793
+									$html .= '<li>' . $val . '</li>';
2794
+								}
2795
+								$html .= '</ul>';
2796
+							} else {
2797
+								$html .= $post->{$type['htmlvar_name']};
2798
+							}
2799
+							$html .= '</div>';
2800
+						}
2801
+							break;
2802
+						case 'email': {
2803
+							if (strpos($field_icon, 'http') !== false) {
2804
+								$field_icon_af = '';
2805
+							} elseif ($field_icon == '') {
2806
+								$field_icon_af = '<i class="fa fa-envelope"></i>';
2807
+							} else {
2808
+								$field_icon_af = $field_icon;
2809
+								$field_icon = '';
2810
+							}
2811
+
2812
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2813
+
2814
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2815
+							if ($field_set_start == 1 && $site_title != '') {
2816
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2817
+							}
2818
+							$html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2819
+						}
2820
+							break;
2821
+						case 'textarea': {
2822
+							if (strpos($field_icon, 'http') !== false) {
2823
+								$field_icon_af = '';
2824
+							} elseif ($field_icon == '') {
2825
+								$field_icon_af = '';
2826
+							} else {
2827
+								$field_icon_af = $field_icon;
2828
+								$field_icon = '';
2829
+							}
2830
+
2831
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2832
+
2833
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2834
+							if ($field_set_start == 1 && $site_title != '') {
2835
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2836
+							}
2837
+							$html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2838
+						}
2839
+							break;
2840
+						case 'html': {
2841
+							if (strpos($field_icon, 'http') !== false) {
2842
+								$field_icon_af = '';
2843
+							} elseif ($field_icon == '') {
2844
+								$field_icon_af = '';
2845
+							} else {
2846
+								$field_icon_af = $field_icon;
2847
+								$field_icon = '';
2848
+							}
2849
+
2850
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2851
+
2852
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2853
+							if ($field_set_start == 1 && $site_title != '') {
2854
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2855
+							}
2856
+							$html .= ' </span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2857
+						}
2858
+						break;
2859
+						case 'file': {
2860
+							$html_var = $type['htmlvar_name'];
2861
+
2862
+							if (!empty($post->{$type['htmlvar_name']})) {
2863
+								$files = explode(",", $post->{$type['htmlvar_name']});
2864
+
2865
+								if (!empty($files)) {
2866
+									$extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2867
+									$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2868 2868
                                
2869
-                                    $file_paths = '';
2870
-                                    foreach ($files as $file) {
2871
-                                        if (!empty($file)) {
2872
-                                            $image_name_arr = explode('/', $file);
2873
-                                            $filename = end($image_name_arr);
2874
-
2875
-                                            $arr_file_type = wp_check_filetype($filename);
2876
-                                            if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2877
-                                                continue;
2878
-                                            }
2879
-                                            $uploaded_file_type = $arr_file_type['type'];
2880
-                                            $uploaded_file_ext = $arr_file_type['ext'];
2869
+									$file_paths = '';
2870
+									foreach ($files as $file) {
2871
+										if (!empty($file)) {
2872
+											$image_name_arr = explode('/', $file);
2873
+											$filename = end($image_name_arr);
2874
+
2875
+											$arr_file_type = wp_check_filetype($filename);
2876
+											if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2877
+												continue;
2878
+											}
2879
+											$uploaded_file_type = $arr_file_type['type'];
2880
+											$uploaded_file_ext = $arr_file_type['ext'];
2881 2881
                                             
2882
-                                            if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2883
-                                                continue; // Invalid file type.
2884
-                                            }
2885
-
2886
-                                            $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2887
-
2888
-                                            // If the uploaded file is image
2889
-                                            if (in_array($uploaded_file_type, $image_file_types)) {
2890
-                                                $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2891
-                                                $file_paths .= '<a href="'.$file.'">';
2892
-                                                $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2893
-                                                $file_paths .= '</a>';
2894
-                                                $file_paths .= '</div>';
2895
-                                            } else {
2896
-                                                $ext_path = '_' . $html_var . '_';
2897
-                                                $filename = explode($ext_path, $filename);
2898
-                                                $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2899
-                                            }
2900
-                                        }
2901
-                                    }
2902
-
2903
-                                    if (strpos($field_icon, 'http') !== false) {
2904
-                                        $field_icon_af = '';
2905
-                                    } else if ($field_icon == '') {
2906
-                                        $field_icon_af = '';
2907
-                                    } else {
2908
-                                        $field_icon_af = $field_icon;
2909
-                                        $field_icon = '';
2910
-                                    }
2911
-
2912
-                                    $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2913
-
2914
-
2915
-                                    $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2916
-
2917
-                                    if ($field_set_start == 1 && $site_title != '') {
2918
-                                        $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2919
-                                    }
2920
-
2921
-                                    $html .= ' </span>' . $file_paths . '</div>';
2922
-                                }
2923
-                            }
2924
-                        }
2925
-                            break;
2926
-                    }
2927
-
2928
-
2929
-                    /**
2930
-                     * Filter custom field output in tab.
2931
-                     *
2932
-                     * @since 1.5.6
2933
-                     *
2934
-                     * @param string $html_var The HTML variable name for the field.
2935
-                     * @param string $html Custom field unfiltered HTML.
2936
-                     * @param array $variables_array Custom field variables array.
2937
-                     */
2938
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2939
-
2940
-                    $fieldset_html = '';
2941
-                    if ($field_set_start == 1) {
2942
-                        $add_html = false;
2943
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2944
-                            if ($fieldset != '') {
2945
-                                $add_html = true;
2946
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2947
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2948
-                            }
2949
-                            $fieldset_html = $fieldset;
2950
-                            $fieldset = '';
2951
-                        } else {
2952
-                            $fieldset .= $html;
2953
-                            if ($total_fields == $count_field && $fieldset != '') {
2954
-                                $add_html = true;
2955
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2956
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2957
-                                $fieldset_html = $fieldset;
2958
-                            }
2959
-                        }
2960
-
2961
-                        if ($add_html) {
2962
-                            $tabs_arr[$htmlvar_name] = array(
2963
-                                'heading_text' => __($label, 'geodirectory'),
2964
-                                'is_active_tab' => false,
2965
-                                /**
2966
-                                 * Filter if a custom field should be displayed on the details page tab.
2967
-                                 *
2968
-                                 * @since 1.0.0
2969
-                                 * @param string $htmlvar_name The field HTML var name.
2970
-                                 */
2971
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2972
-                                'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2973
-                            );
2974
-                        }
2975
-                    } else {
2976
-                        if ($html != '') {
2977
-                            $tabs_arr[$field['htmlvar_name']] = array(
2978
-                                'heading_text' => __($label, 'geodirectory'),
2979
-                                'is_active_tab' => false,
2980
-                                /** This action is documented in geodirectory_hooks_actions.php */
2981
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2982
-                                'tab_content' => $html
2983
-                            );
2984
-                        }
2985
-                    }
2986
-                }
2987
-            }
2988
-        }
2989
-    }
2990
-    return $tabs_arr;
2882
+											if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2883
+												continue; // Invalid file type.
2884
+											}
2885
+
2886
+											$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2887
+
2888
+											// If the uploaded file is image
2889
+											if (in_array($uploaded_file_type, $image_file_types)) {
2890
+												$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2891
+												$file_paths .= '<a href="'.$file.'">';
2892
+												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2893
+												$file_paths .= '</a>';
2894
+												$file_paths .= '</div>';
2895
+											} else {
2896
+												$ext_path = '_' . $html_var . '_';
2897
+												$filename = explode($ext_path, $filename);
2898
+												$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2899
+											}
2900
+										}
2901
+									}
2902
+
2903
+									if (strpos($field_icon, 'http') !== false) {
2904
+										$field_icon_af = '';
2905
+									} else if ($field_icon == '') {
2906
+										$field_icon_af = '';
2907
+									} else {
2908
+										$field_icon_af = $field_icon;
2909
+										$field_icon = '';
2910
+									}
2911
+
2912
+									$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2913
+
2914
+
2915
+									$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2916
+
2917
+									if ($field_set_start == 1 && $site_title != '') {
2918
+										$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2919
+									}
2920
+
2921
+									$html .= ' </span>' . $file_paths . '</div>';
2922
+								}
2923
+							}
2924
+						}
2925
+							break;
2926
+					}
2927
+
2928
+
2929
+					/**
2930
+					 * Filter custom field output in tab.
2931
+					 *
2932
+					 * @since 1.5.6
2933
+					 *
2934
+					 * @param string $html_var The HTML variable name for the field.
2935
+					 * @param string $html Custom field unfiltered HTML.
2936
+					 * @param array $variables_array Custom field variables array.
2937
+					 */
2938
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2939
+
2940
+					$fieldset_html = '';
2941
+					if ($field_set_start == 1) {
2942
+						$add_html = false;
2943
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2944
+							if ($fieldset != '') {
2945
+								$add_html = true;
2946
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2947
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2948
+							}
2949
+							$fieldset_html = $fieldset;
2950
+							$fieldset = '';
2951
+						} else {
2952
+							$fieldset .= $html;
2953
+							if ($total_fields == $count_field && $fieldset != '') {
2954
+								$add_html = true;
2955
+								$label = $fieldset_arr[$fieldset_count]['label'];
2956
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2957
+								$fieldset_html = $fieldset;
2958
+							}
2959
+						}
2960
+
2961
+						if ($add_html) {
2962
+							$tabs_arr[$htmlvar_name] = array(
2963
+								'heading_text' => __($label, 'geodirectory'),
2964
+								'is_active_tab' => false,
2965
+								/**
2966
+								 * Filter if a custom field should be displayed on the details page tab.
2967
+								 *
2968
+								 * @since 1.0.0
2969
+								 * @param string $htmlvar_name The field HTML var name.
2970
+								 */
2971
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2972
+								'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2973
+							);
2974
+						}
2975
+					} else {
2976
+						if ($html != '') {
2977
+							$tabs_arr[$field['htmlvar_name']] = array(
2978
+								'heading_text' => __($label, 'geodirectory'),
2979
+								'is_active_tab' => false,
2980
+								/** This action is documented in geodirectory_hooks_actions.php */
2981
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2982
+								'tab_content' => $html
2983
+							);
2984
+						}
2985
+					}
2986
+				}
2987
+			}
2988
+		}
2989
+	}
2990
+	return $tabs_arr;
2991 2991
 }
2992 2992
 
2993 2993
 /* display add listing page for wpml */
@@ -3011,37 +3011,37 @@  discard block
 block discarded – undo
3011 3011
  */
3012 3012
 function geodir_add_post_status_author_page()
3013 3013
 {
3014
-    global $wpdb, $post;
3015
-
3016
-    $html = '';
3017
-    if (get_current_user_id()) {
3018
-        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3019
-
3020
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3021
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3022
-            $status = "<strong>(";
3023
-            $status_icon = '<i class="fa fa-play"></i>';
3024
-            if ($real_status == 'publish') {
3025
-                $status .= __('Published', 'geodirectory');
3026
-            } else {
3027
-                $status .= __('Not published', 'geodirectory');
3028
-                $status_icon = '<i class="fa fa-pause"></i>';
3029
-            }
3030
-            $status .= ")</strong>";
3014
+	global $wpdb, $post;
3015
+
3016
+	$html = '';
3017
+	if (get_current_user_id()) {
3018
+		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3019
+
3020
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3021
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3022
+			$status = "<strong>(";
3023
+			$status_icon = '<i class="fa fa-play"></i>';
3024
+			if ($real_status == 'publish') {
3025
+				$status .= __('Published', 'geodirectory');
3026
+			} else {
3027
+				$status .= __('Not published', 'geodirectory');
3028
+				$status_icon = '<i class="fa fa-pause"></i>';
3029
+			}
3030
+			$status .= ")</strong>";
3031 3031
 
3032
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3033
-        }
3034
-    }
3032
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3033
+		}
3034
+	}
3035 3035
 
3036
-    if ($html != '') {
3037
-        /**
3038
-         * Filter the post status text on the author page.
3039
-         *
3040
-         * @since 1.0.0
3041
-         * @param string $html The HTML of the status.
3042
-         */
3043
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3044
-    }
3036
+	if ($html != '') {
3037
+		/**
3038
+		 * Filter the post status text on the author page.
3039
+		 *
3040
+		 * @since 1.0.0
3041
+		 * @param string $html The HTML of the status.
3042
+		 */
3043
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3044
+	}
3045 3045
 
3046 3046
 
3047 3047
 }
@@ -3055,21 +3055,21 @@  discard block
 block discarded – undo
3055 3055
  */
3056 3056
 function geodir_init_no_rating()
3057 3057
 {
3058
-    if (get_option('geodir_disable_rating')) {
3059
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3060
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3061
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3062
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3063
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3064
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3065
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3066
-
3067
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3068
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3069
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3070
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3071
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3072
-    }
3058
+	if (get_option('geodir_disable_rating')) {
3059
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3060
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3061
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3062
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3063
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3064
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3065
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3066
+
3067
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3068
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3069
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3070
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3071
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3072
+	}
3073 3073
 }
3074 3074
 
3075 3075
 /**
@@ -3081,20 +3081,20 @@  discard block
 block discarded – undo
3081 3081
  */
3082 3082
 function geodir_no_rating_rating_fields()
3083 3083
 {
3084
-    global $post;
3084
+	global $post;
3085 3085
 
3086
-    $post_types = geodir_get_posttypes();
3086
+	$post_types = geodir_get_posttypes();
3087 3087
 
3088
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3089
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3090
-            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3091
-            if (get_option('geodir_reviewrating_enable_images')) {
3092
-                geodir_reviewrating_rating_img_html();
3093
-            }
3094
-        } else {
3095
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3096
-        }
3097
-    }
3088
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3089
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3090
+			echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3091
+			if (get_option('geodir_reviewrating_enable_images')) {
3092
+				geodir_reviewrating_rating_img_html();
3093
+			}
3094
+		} else {
3095
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3096
+		}
3097
+	}
3098 3098
 }
3099 3099
 
3100 3100
 /**
@@ -3108,11 +3108,11 @@  discard block
 block discarded – undo
3108 3108
  */
3109 3109
 function geodir_no_rating_comment_text($content, $comment = '')
3110 3110
 {
3111
-    if (!is_admin()) {
3112
-        return '<div class="description">' . $content . '</div>';
3113
-    } else {
3114
-        return $content;
3115
-    }
3111
+	if (!is_admin()) {
3112
+		return '<div class="description">' . $content . '</div>';
3113
+	} else {
3114
+		return $content;
3115
+	}
3116 3116
 }
3117 3117
 
3118 3118
 /**
@@ -3125,7 +3125,7 @@  discard block
 block discarded – undo
3125 3125
  */
3126 3126
 function geodir_no_rating_review_rating_html($content = '')
3127 3127
 {
3128
-    return NULL;
3128
+	return NULL;
3129 3129
 }
3130 3130
 
3131 3131
 /**
@@ -3139,19 +3139,19 @@  discard block
 block discarded – undo
3139 3139
  */
3140 3140
 function geodir_no_rating_get_sort_options($options, $post_type = '')
3141 3141
 {
3142
-    $new_options = array();
3143
-    if (!empty($options)) {
3144
-        foreach ($options as $option) {
3145
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3146
-                continue;
3147
-            }
3148
-            $new_options[] = $option;
3149
-        }
3142
+	$new_options = array();
3143
+	if (!empty($options)) {
3144
+		foreach ($options as $option) {
3145
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3146
+				continue;
3147
+			}
3148
+			$new_options[] = $option;
3149
+		}
3150 3150
 
3151
-        $options = $new_options;
3152
-    }
3151
+		$options = $new_options;
3152
+	}
3153 3153
 
3154
-    return $options;
3154
+	return $options;
3155 3155
 }
3156 3156
 
3157 3157
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -3165,11 +3165,11 @@  discard block
 block discarded – undo
3165 3165
  */
3166 3166
 function geodir_all_js_msg_no_rating($msg = array())
3167 3167
 {
3168
-    if (get_option('geodir_disable_rating')) {
3169
-        $msg['gd_cmt_no_rating'] = true;
3170
-    }
3168
+	if (get_option('geodir_disable_rating')) {
3169
+		$msg['gd_cmt_no_rating'] = true;
3170
+	}
3171 3171
 
3172
-    return $msg;
3172
+	return $msg;
3173 3173
 }
3174 3174
 
3175 3175
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -3183,13 +3183,13 @@  discard block
 block discarded – undo
3183 3183
  */
3184 3184
 function geodir_body_class_no_rating($classes = array())
3185 3185
 {
3186
-    if (get_option('geodir_disable_rating')) {
3187
-        $classes[] = 'gd-no-rating';
3188
-    }
3186
+	if (get_option('geodir_disable_rating')) {
3187
+		$classes[] = 'gd-no-rating';
3188
+	}
3189 3189
     
3190
-    $classes[] = 'gd-map-' . geodir_map_name();
3190
+	$classes[] = 'gd-map-' . geodir_map_name();
3191 3191
 
3192
-    return $classes;
3192
+	return $classes;
3193 3193
 }
3194 3194
 
3195 3195
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -3203,13 +3203,13 @@  discard block
 block discarded – undo
3203 3203
  */
3204 3204
 function geodir_admin_body_class_no_rating($class = '')
3205 3205
 {
3206
-    if (get_option('geodir_disable_rating')) {
3207
-        $class .= ' gd-no-rating';
3208
-    }
3206
+	if (get_option('geodir_disable_rating')) {
3207
+		$class .= ' gd-no-rating';
3208
+	}
3209 3209
     
3210
-    $class .= ' gd-map-' . geodir_map_name();
3210
+	$class .= ' gd-map-' . geodir_map_name();
3211 3211
 
3212
-    return $class;
3212
+	return $class;
3213 3213
 }
3214 3214
 
3215 3215
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -3222,10 +3222,10 @@  discard block
 block discarded – undo
3222 3222
  */
3223 3223
 function geodir_wp_head_no_rating()
3224 3224
 {
3225
-    if (get_option('geodir_disable_rating')) {
3226
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3227
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3228
-    }
3225
+	if (get_option('geodir_disable_rating')) {
3226
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3227
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3228
+	}
3229 3229
 }
3230 3230
 
3231 3231
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -3242,36 +3242,36 @@  discard block
 block discarded – undo
3242 3242
  * @return array Translation texts.
3243 3243
  */
3244 3244
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3245
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3246
-
3247
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3248
-
3249
-    /**
3250
-     * Filters the geodirectory option names that requires to add for translation.
3251
-     *
3252
-     * @since 1.5.7
3253
-     * @package GeoDirectory
3254
-     *
3255
-     * @param  array $gd_options Array of option names.
3256
-     */
3257
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3258
-    $gd_options = array_unique($gd_options);
3259
-
3260
-    if (!empty($gd_options)) {
3261
-        foreach ($gd_options as $gd_option) {
3262
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
3263
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3245
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3246
+
3247
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3248
+
3249
+	/**
3250
+	 * Filters the geodirectory option names that requires to add for translation.
3251
+	 *
3252
+	 * @since 1.5.7
3253
+	 * @package GeoDirectory
3254
+	 *
3255
+	 * @param  array $gd_options Array of option names.
3256
+	 */
3257
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3258
+	$gd_options = array_unique($gd_options);
3259
+
3260
+	if (!empty($gd_options)) {
3261
+		foreach ($gd_options as $gd_option) {
3262
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
3263
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3264 3264
                 
3265
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3266
-                    $translation_texts[] = stripslashes_deep($option_value);
3267
-                }
3268
-            }
3269
-        }
3270
-    }
3265
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3266
+					$translation_texts[] = stripslashes_deep($option_value);
3267
+				}
3268
+			}
3269
+		}
3270
+	}
3271 3271
 
3272
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3272
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3273 3273
 
3274
-    return $translation_texts;
3274
+	return $translation_texts;
3275 3275
 }
3276 3276
 
3277 3277
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -3285,15 +3285,15 @@  discard block
 block discarded – undo
3285 3285
 
3286 3286
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
3287 3287
 function gd_get_comments_link($comments_link, $post_id) {
3288
-    $post_type = get_post_type($post_id);
3288
+	$post_type = get_post_type($post_id);
3289 3289
 
3290
-    $all_postypes = geodir_get_posttypes();
3291
-    if (in_array($post_type, $all_postypes)) {
3292
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
3293
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
3294
-    }
3290
+	$all_postypes = geodir_get_posttypes();
3291
+	if (in_array($post_type, $all_postypes)) {
3292
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
3293
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
3294
+	}
3295 3295
 
3296
-    return $comments_link;
3296
+	return $comments_link;
3297 3297
 }
3298 3298
 
3299 3299
 
@@ -3311,11 +3311,11 @@  discard block
 block discarded – undo
3311 3311
 function geodir_add_nav_menu_class( $args )
3312 3312
 {
3313 3313
 
3314
-        if(isset($args['menu_class'])){
3315
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
3316
-        }
3314
+		if(isset($args['menu_class'])){
3315
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
3316
+		}
3317 3317
     
3318
-    return $args;
3318
+	return $args;
3319 3319
 }
3320 3320
 
3321 3321
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
3322 3322
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 /* WP REVIEW COUNT ACTIONS */
177 177
 ////////////////////////
178 178
 
179
-add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
179
+add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
180 180
 //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
181
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
181
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
182 182
 //add_action('created_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
184 184
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
226 226
     if ($geodir_theme_location) {
227 227
         update_option('geodir_theme_location_nav', $geodir_theme_location);
228 228
     } else {
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 
321 321
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
322 322
 
323
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
324
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
323
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
324
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
325 325
 
326 326
 // Detail page sidebar content 
327 327
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
     do_action('geodir_after_social_sharing_buttons');
423 423
     $content_html = ob_get_clean();
424 424
     if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
425
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
426
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
427 427
         /**
428 428
          * Filter the geodir_social_sharing_buttons() function content.
429 429
          *
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
     do_action('geodir_after_share_this_button');
470 470
     $content_html = ob_get_clean();
471 471
     if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
472
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">'.$content_html.'</div>';
473
+    if ((int) get_option('geodir_disable_sharethis_button_section') != 1) {
474 474
         /**
475 475
          * Filter the geodir_share_this_button() function content.
476 476
          *
@@ -509,12 +509,12 @@  discard block
 block discarded – undo
509 509
             $post_id = $post->ID;
510 510
             
511 511
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
-                $post_id = (int)$_REQUEST['pid'];
512
+                $post_id = (int) $_REQUEST['pid'];
513 513
             }
514 514
 
515 515
             $postlink = get_permalink(geodir_add_listing_page_id());
516 516
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
517
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
518 518
         }
519 519
     }// end of if, if its a preview or not
520 520
     /**
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
     do_action('geodir_after_edit_post_link');
526 526
     $content_html = ob_get_clean();
527 527
     if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
528
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
529
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
530 530
         /**
531 531
          * Filter the geodir_edit_post_link() function content.
532 532
          *
@@ -579,14 +579,14 @@  discard block
 block discarded – undo
579 579
     $hide_refresh = get_option('geodir_ga_auto_refresh');
580 580
     
581 581
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
582
+    if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
583 583
         $page_url = urlencode($_SERVER['REQUEST_URI']);
584 584
         ?>
585 585
         <script type="text/javascript">
586 586
             var gd_gaTimeOut;
587
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
588
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
589
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
587
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
588
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
589
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
590 590
             ga_data1 = false;
591 591
             ga_data2 = false;
592 592
             ga_data3 = false;
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
             }
728 728
 
729 729
             function gdga_noResults() {
730
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
730
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
731 731
                 jQuery('#gdga-legend-container').html('');
732 732
             }
733 733
 
@@ -759,18 +759,18 @@  discard block
 block discarded – undo
759 759
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
760 760
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
761 761
 
762
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
763
-                        '<?php _e('Feb', 'geodirectory');?>',
764
-                        '<?php _e('Mar', 'geodirectory');?>',
765
-                        '<?php _e('Apr', 'geodirectory');?>',
766
-                        '<?php _e('May', 'geodirectory');?>',
767
-                        '<?php _e('Jun', 'geodirectory');?>',
768
-                        '<?php _e('Jul', 'geodirectory');?>',
769
-                        '<?php _e('Aug', 'geodirectory');?>',
770
-                        '<?php _e('Sep', 'geodirectory');?>',
771
-                        '<?php _e('Oct', 'geodirectory');?>',
772
-                        '<?php _e('Nov', 'geodirectory');?>',
773
-                        '<?php _e('Dec', 'geodirectory');?>'];
762
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
763
+                        '<?php _e('Feb', 'geodirectory'); ?>',
764
+                        '<?php _e('Mar', 'geodirectory'); ?>',
765
+                        '<?php _e('Apr', 'geodirectory'); ?>',
766
+                        '<?php _e('May', 'geodirectory'); ?>',
767
+                        '<?php _e('Jun', 'geodirectory'); ?>',
768
+                        '<?php _e('Jul', 'geodirectory'); ?>',
769
+                        '<?php _e('Aug', 'geodirectory'); ?>',
770
+                        '<?php _e('Sep', 'geodirectory'); ?>',
771
+                        '<?php _e('Oct', 'geodirectory'); ?>',
772
+                        '<?php _e('Nov', 'geodirectory'); ?>',
773
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
774 774
 
775 775
                     // Ensure the data arrays are at least as long as the labels array.
776 776
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -783,13 +783,13 @@  discard block
 block discarded – undo
783 783
                         labels : labels,
784 784
                         datasets : [
785 785
                             {
786
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
786
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
787 787
                                 fillColor : "rgba(220,220,220,0.5)",
788 788
                                 strokeColor : "rgba(220,220,220,1)",
789 789
                                 data : data2
790 790
                             },
791 791
                             {
792
-                                label: '<?php _e('This Year', 'geodirectory');?>',
792
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
793 793
                                 fillColor : "rgba(151,187,205,0.5)",
794 794
                                 strokeColor : "rgba(151,187,205,1)",
795 795
                                 data : data1
@@ -834,30 +834,30 @@  discard block
 block discarded – undo
834 834
 
835 835
                     <?php
836 836
                     // Here we list the shorthand days of the week so it can be used in translation.
837
-                    __("Mon",'geodirectory');
838
-                    __("Tue",'geodirectory');
839
-                    __("Wed",'geodirectory');
840
-                    __("Thu",'geodirectory');
841
-                    __("Fri",'geodirectory');
842
-                    __("Sat",'geodirectory');
843
-                    __("Sun",'geodirectory');
837
+                    __("Mon", 'geodirectory');
838
+                    __("Tue", 'geodirectory');
839
+                    __("Wed", 'geodirectory');
840
+                    __("Thu", 'geodirectory');
841
+                    __("Fri", 'geodirectory');
842
+                    __("Sat", 'geodirectory');
843
+                    __("Sun", 'geodirectory');
844 844
                     ?>
845 845
 
846 846
                     labels = [
847
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
848
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
849
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
850
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
851
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
852
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
853
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
847
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
848
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
849
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
850
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
851
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
852
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
853
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
854 854
                     ];
855 855
 
856 856
                     var data = {
857 857
                         labels : labels,
858 858
                         datasets : [
859 859
                             {
860
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
860
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
861 861
                                 fillColor : "rgba(220,220,220,0.5)",
862 862
                                 strokeColor : "rgba(220,220,220,1)",
863 863
                                 pointColor : "rgba(220,220,220,1)",
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
                                 data : data2
866 866
                             },
867 867
                             {
868
-                                label: '<?php _e('This Week', 'geodirectory');?>',
868
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
869 869
                                 fillColor : "rgba(151,187,205,0.5)",
870 870
                                 strokeColor : "rgba(151,187,205,1)",
871 871
                                 pointColor : "rgba(151,187,205,1)",
@@ -1072,18 +1072,18 @@  discard block
 block discarded – undo
1072 1072
         </style>
1073 1073
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1074 1074
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1075
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1075
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1076 1076
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1077
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1077
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1078 1078
             <div id="gd-active-users-container">
1079
-                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
1079
+                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
1080 1080
                     <b class="gd-ActiveUsers-value">0</b>
1081 1081
                 </div>
1082 1082
             </div>
1083 1083
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1084
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1085
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1086
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1084
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1085
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1086
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1087 1087
             </select>
1088 1088
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1089 1089
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
     do_action('geodir_after_google_analytics');
1100 1100
     $content_html = ob_get_clean();
1101 1101
     if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1102
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1103
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1104 1104
         /**
1105 1105
          * Filter the geodir_edit_post_link() function content.
1106 1106
          *
@@ -1156,10 +1156,10 @@  discard block
 block discarded – undo
1156 1156
        
1157 1157
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1158 1158
 	   
1159
-	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1159
+	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />';
1160 1160
 
1161 1161
         $html .= '<span class="item">';
1162
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1162
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1163 1163
 
1164 1164
         if ($post_images) {
1165 1165
             foreach ($post_images as $img) {
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
         }
1170 1170
 
1171 1171
         if (isset($post_img) && $post_img) {
1172
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1172
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1173 1173
         }
1174 1174
 
1175 1175
         $html .= '</span>';
@@ -1196,9 +1196,9 @@  discard block
 block discarded – undo
1196 1196
     do_action('geodir_after_detail_page_review_rating');
1197 1197
     $content_html = ob_get_clean();
1198 1198
     if (trim($content_html) != '') {
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1199
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1200 1200
     }
1201
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1201
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1202 1202
         /**
1203 1203
          * Filter the geodir_detail_page_review_rating() function content.
1204 1204
          *
@@ -1237,8 +1237,8 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
     $content_html = ob_get_clean();
1239 1239
     if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1240
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1241
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1242 1242
         /**
1243 1243
          * Filter the output html for function geodir_detail_page_more_info().
1244 1244
          *
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1337 1337
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1338 1338
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1339
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1339
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1340 1340
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1341 1341
         'geodir_map_name' => geodir_map_name(),
1342 1342
     );
@@ -1354,10 +1354,10 @@  discard block
 block discarded – undo
1354 1354
     foreach ($arr_alert_msg as $key => $value) {
1355 1355
         if (!is_scalar($value))
1356 1356
             continue;
1357
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1357
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1358 1358
     }
1359 1359
 
1360
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1360
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1361 1361
     echo '<script>';
1362 1362
     echo $script;
1363 1363
     echo '</script>';
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
         $geodir_old_sidebars = get_option('geodir_sidebars');
1446 1446
         if (is_array($geodir_old_sidebars)) {
1447 1447
             foreach ($geodir_old_sidebars as $key => $val) {
1448
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1448
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1449 1449
                 {
1450 1450
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1451 1451
                 }
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
         global $post;
1525 1525
         $term_condition = '';
1526 1526
         if (isset($_REQUEST['backandedit'])) {
1527
-            $post = (object)$gd_session->get('listing');
1527
+            $post = (object) $gd_session->get('listing');
1528 1528
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1529 1529
         }
1530 1530
 
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
                     echo 'checked="checked"';
1539 1539
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1540 1540
                        class="geodir_textfield" value="1"
1541
-                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1541
+                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1542 1542
 				</span>
1543 1543
             </div>
1544 1544
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
         /** This action is documented in geodirectory_template_actions.php */
1579 1579
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1580 1580
         
1581
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1581
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1582 1582
             $is_display = false;
1583 1583
         }
1584 1584
     }
@@ -1626,16 +1626,16 @@  discard block
 block discarded – undo
1626 1626
     global $wpdb, $plugin_prefix;
1627 1627
 	
1628 1628
 	// Remove unused virtual page
1629
-	$listings_page_id = (int)get_option('geodir_listing_page');
1629
+	$listings_page_id = (int) get_option('geodir_listing_page');
1630 1630
 	if ($listings_page_id) {
1631
-		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1631
+		$wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->posts." WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1632 1632
         delete_option('geodir_listing_page');
1633 1633
 	}
1634 1634
 
1635 1635
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1636 1636
         $wpdb->query(
1637 1637
             $wpdb->prepare(
1638
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1638
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1639 1639
                 array('1', '1', 'admin')
1640 1640
             )
1641 1641
         );
@@ -1643,9 +1643,9 @@  discard block
 block discarded – undo
1643 1643
 
1644 1644
         /* --- terms meta value set --- */
1645 1645
 
1646
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1646
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1647 1647
 
1648
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1648
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1649 1649
 
1650 1650
         if (!empty($options_data)) {
1651 1651
 
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 
1654 1654
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1655 1655
 
1656
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1656
+                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM ".$wpdb->prefix."term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1657 1657
 
1658 1658
                 if (!empty($taxonomies_data)) {
1659 1659
 
@@ -1662,17 +1662,17 @@  discard block
 block discarded – undo
1662 1662
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1663 1663
                         $post_type = $taxObject->object_type[0];
1664 1664
 
1665
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1665
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1666 1666
 
1667
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1667
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1668 1668
 
1669 1669
                         if ($duplicate_data) {
1670 1670
 
1671
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1671
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1672 1672
 
1673 1673
                         } else {
1674 1674
 
1675
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1675
+                            $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1676 1676
 
1677 1677
                         }
1678 1678
 
@@ -1706,14 +1706,14 @@  discard block
 block discarded – undo
1706 1706
 
1707 1707
     global $wpdb, $table_prefix;
1708 1708
 
1709
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1709
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1710 1710
 
1711 1711
     if ($slug_exists) {
1712 1712
 
1713 1713
         $suffix = 1;
1714 1714
         do {
1715
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1716
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1715
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1716
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1717 1717
             $suffix++;
1718 1718
         } while ($location_slug_check && $suffix < 100);
1719 1719
 
@@ -1767,7 +1767,7 @@  discard block
 block discarded – undo
1767 1767
 
1768 1768
         $suffix = 1;
1769 1769
         do {
1770
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1770
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1771 1771
 
1772 1772
             /** This action is documented in geodirectory_hooks_actions.php */
1773 1773
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
 
1780 1780
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1781 1781
 
1782
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1782
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1783 1783
 
1784 1784
     }
1785 1785
 	
@@ -1788,18 +1788,18 @@  discard block
 block discarded – undo
1788 1788
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1789 1789
 	
1790 1790
 	$post_types = geodir_get_posttypes();
1791
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1792
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1791
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1792
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1793 1793
 		
1794 1794
 		if (!empty($posts_obj)) {
1795 1795
 			foreach ($posts_obj as $post_obj) {
1796 1796
 				$post_id = $post_obj->object_id;
1797 1797
 				
1798
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1798
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1799 1799
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1800 1800
 				
1801
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1802
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1801
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1802
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1803 1803
 			}
1804 1804
 		}
1805 1805
 	}
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1834 1834
         return $slug_exists = true;
1835 1835
 
1836
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1836
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1837 1837
         return $slug_exists = true;
1838 1838
 
1839 1839
     return $slug_exists;
@@ -1873,43 +1873,43 @@  discard block
 block discarded – undo
1873 1873
 
1874 1874
 
1875 1875
     $gd_page = '';
1876
-    if(geodir_is_page('home')){
1876
+    if (geodir_is_page('home')) {
1877 1877
         $gd_page = 'home';
1878 1878
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1879 1879
     }
1880
-    elseif(geodir_is_page('detail')){
1880
+    elseif (geodir_is_page('detail')) {
1881 1881
         $gd_page = 'detail';
1882 1882
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1883 1883
     }
1884
-    elseif(geodir_is_page('pt')){
1884
+    elseif (geodir_is_page('pt')) {
1885 1885
         $gd_page = 'pt';
1886 1886
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1887 1887
     }
1888
-    elseif(geodir_is_page('listing')){
1888
+    elseif (geodir_is_page('listing')) {
1889 1889
         $gd_page = 'listing';
1890 1890
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1891 1891
     }
1892
-    elseif(geodir_is_page('location')){
1892
+    elseif (geodir_is_page('location')) {
1893 1893
         $gd_page = 'location';
1894 1894
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1895 1895
     }
1896
-    elseif(geodir_is_page('search')){
1896
+    elseif (geodir_is_page('search')) {
1897 1897
         $gd_page = 'search';
1898 1898
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1899 1899
     }
1900
-    elseif(geodir_is_page('add-listing')){
1900
+    elseif (geodir_is_page('add-listing')) {
1901 1901
         $gd_page = 'add-listing';
1902 1902
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1903 1903
     }
1904
-    elseif(geodir_is_page('author')){
1904
+    elseif (geodir_is_page('author')) {
1905 1905
         $gd_page = 'author';
1906 1906
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1907 1907
     }
1908
-    elseif(geodir_is_page('login')){
1908
+    elseif (geodir_is_page('login')) {
1909 1909
         $gd_page = 'login';
1910 1910
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1911 1911
     }
1912
-    elseif(geodir_is_page('listing-success')){
1912
+    elseif (geodir_is_page('listing-success')) {
1913 1913
         $gd_page = 'listing-success';
1914 1914
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1915 1915
     }
@@ -1941,12 +1941,12 @@  discard block
 block discarded – undo
1941 1941
 
1942 1942
     if (!get_option('geodir_set_post_attachments')) {
1943 1943
 
1944
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1945
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1944
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1945
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1946 1946
 
1947 1947
         $all_postypes = geodir_get_posttypes();
1948 1948
 
1949
-        foreach($all_postypes as $post_type){
1949
+        foreach ($all_postypes as $post_type) {
1950 1950
             $args = array(
1951 1951
                 'posts_per_page' => -1,
1952 1952
                 'post_type' => $post_type,
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 {
2041 2041
     $user_id = get_current_user_id();
2042 2042
 
2043
-    if(!$user_id){return $post;}
2043
+    if (!$user_id) {return $post; }
2044 2044
 
2045 2045
     $gd_post_types = geodir_get_posttypes();
2046 2046
 
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
 
2150 2150
         if (array_key_exists('post_video', $tabs_arr)) {
2151 2151
 
2152
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2152
+            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2153 2153
 
2154 2154
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2155 2155
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
 
2158 2158
         if (array_key_exists('special_offers', $tabs_arr)) {
2159 2159
 
2160
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2160
+            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2161 2161
 
2162 2162
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2163 2163
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
  */
2179 2179
 function geodir_remove_template_redirect_actions()
2180 2180
 {
2181
-    if (geodir_is_page('login')){
2181
+    if (geodir_is_page('login')) {
2182 2182
         remove_all_actions('template_redirect');
2183 2183
         remove_action('init', 'avia_modify_front', 10);
2184 2184
     }
@@ -2225,25 +2225,25 @@  discard block
 block discarded – undo
2225 2225
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2226 2226
 
2227 2227
         $wpdb->query(
2228
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2228
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2229 2229
                 array($post_id, $split_img_file_path)
2230 2230
             )
2231 2231
         );
2232 2232
 
2233 2233
         $attachment_data = $wpdb->get_row(
2234
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2234
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2235 2235
                 array($post_id)
2236 2236
             )
2237 2237
         );
2238 2238
 
2239 2239
         if (!empty($attachment_data)) {
2240
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2240
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2241 2241
         }
2242 2242
 
2243 2243
 
2244
-        $table_name = $plugin_prefix . $post_type . '_detail';
2244
+        $table_name = $plugin_prefix.$post_type.'_detail';
2245 2245
 
2246
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2246
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2247 2247
 
2248 2248
         geodir_set_wp_featured_image($post_id);
2249 2249
 
@@ -2271,9 +2271,9 @@  discard block
 block discarded – undo
2271 2271
 
2272 2272
     foreach ($all_postypes as $posttype) {
2273 2273
 
2274
-        $tablename = $plugin_prefix . $posttype . '_detail';
2274
+        $tablename = $plugin_prefix.$posttype.'_detail';
2275 2275
 
2276
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2276
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2277 2277
 
2278 2278
         if (!empty($get_post_data)) {
2279 2279
 
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
 
2282 2282
                 $post_id = $data->post_id;
2283 2283
 
2284
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2284
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2285 2285
 
2286 2286
                 if (!empty($attachment_data)) {
2287 2287
 
@@ -2298,22 +2298,22 @@  discard block
 block discarded – undo
2298 2298
 
2299 2299
                         $file_name = $file_info['basename'];
2300 2300
 
2301
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2301
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2302 2302
 
2303 2303
                         if (!file_exists($img_arr['path'])) {
2304 2304
 
2305
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2305
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2306 2306
 
2307 2307
                         }
2308 2308
 
2309 2309
                     }
2310 2310
 
2311
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2311
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2312 2312
 
2313 2313
                     if (!empty($attachment_data)) {
2314 2314
 
2315 2315
                         if ($attachment_data->ID)
2316
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2316
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2317 2317
 
2318 2318
                     } else {
2319 2319
 
@@ -2327,7 +2327,7 @@  discard block
 block discarded – undo
2327 2327
 
2328 2328
                     }
2329 2329
 
2330
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2330
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2331 2331
 
2332 2332
                     geodir_set_wp_featured_image($post_id);
2333 2333
 
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 {
2357 2357
 
2358 2358
     if (!get_option('geodir_default_rating_star_icon')) {
2359
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2359
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2360 2360
     }
2361 2361
 
2362 2362
 }
@@ -2373,10 +2373,10 @@  discard block
 block discarded – undo
2373 2373
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2374 2374
  * @return array User listing count for each post type.
2375 2375
  */
2376
-function geodir_user_post_listing_count($user_id=null)
2376
+function geodir_user_post_listing_count($user_id = null)
2377 2377
 {
2378 2378
     global $wpdb, $plugin_prefix, $current_user;
2379
-    if(!$user_id){
2379
+    if (!$user_id) {
2380 2380
         $user_id = $current_user->ID;
2381 2381
     }
2382 2382
 
@@ -2387,7 +2387,7 @@  discard block
 block discarded – undo
2387 2387
     $user_listing = array();
2388 2388
     if (is_array($all_posts) && !empty($all_posts)) {
2389 2389
         foreach ($all_posts as $ptype) {
2390
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2390
+            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_author=".$user_id." AND post_type='".$ptype."' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2391 2391
 
2392 2392
             if ($total_posts > 0) {
2393 2393
                 $user_listing[$ptype] = $total_posts;
@@ -2488,9 +2488,9 @@  discard block
 block discarded – undo
2488 2488
                     }
2489 2489
 
2490 2490
                     if (strpos($type['field_icon'], 'http') !== false) {
2491
-                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2491
+                        $field_icon = ' background: url('.$type['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2492 2492
                     } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2493
-                        $field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2493
+                        $field_icon = '<i class="'.$type['field_icon'].'"></i>';
2494 2494
                     }
2495 2495
 
2496 2496
                     switch ($type['type']) {
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
                             $i = 0;
2499 2499
                             $fieldset_count++;
2500 2500
                             $field_set_start = 1;
2501
-                            $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2501
+                            $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2502 2502
                             $fieldset_arr[$fieldset_count]['label'] = $label;
2503 2503
                         }
2504 2504
                             break;
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
                             // all search engines that use the nofollow value exclude links that use it from their ranking calculation
2532 2532
                             $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2533 2533
 
2534
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2534
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.' <a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.
2535 2535
                                 /**
2536 2536
                                  * Filer the custom field website name.
2537 2537
                                  *
@@ -2540,7 +2540,7 @@  discard block
 block discarded – undo
2540 2540
                                  * @param string $website The website address.
2541 2541
                                  * @param int $post->ID The post ID.
2542 2542
                                  */
2543
-                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2543
+                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
2544 2544
                         }
2545 2545
                             break;
2546 2546
                         case 'phone': {
@@ -2555,11 +2555,11 @@  discard block
 block discarded – undo
2555 2555
 
2556 2556
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2557 2557
 
2558
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2558
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af;
2559 2559
                             if ($field_set_start == 1 && $site_title != '') {
2560
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2560
+                                $html .= ' '.__($site_title, 'geodirectory').': ';
2561 2561
                             }
2562
-                            $html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2562
+                            $html .= ' </span>'.stripslashes($post->{$type['htmlvar_name']}).'</div>';
2563 2563
                         }
2564 2564
                             break;
2565 2565
                         case 'time': {
@@ -2578,11 +2578,11 @@  discard block
 block discarded – undo
2578 2578
 
2579 2579
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2580 2580
 
2581
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2581
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;
2582 2582
                             if ($field_set_start == 1 && $site_title != '') {
2583
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2583
+                                $html .= ' '.__($site_title, 'geodirectory').': ';
2584 2584
                             }
2585
-                            $html .= ' </span>' . stripslashes($value) . '</div>';
2585
+                            $html .= ' </span>'.stripslashes($value).'</div>';
2586 2586
                         }
2587 2587
                             break;
2588 2588
                         case 'datepicker': {
@@ -2592,8 +2592,8 @@  discard block
 block discarded – undo
2592 2592
                                 $date_format = $date_format['date_format'];
2593 2593
                             }
2594 2594
 
2595
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2596
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2595
+                            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
2596
+                            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
2597 2597
 
2598 2598
                             $date_format = str_replace($search, $replace, $date_format);
2599 2599
 
@@ -2614,11 +2614,11 @@  discard block
 block discarded – undo
2614 2614
 
2615 2615
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2616 2616
 
2617
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2617
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;
2618 2618
                             if ($field_set_start == 1 && $site_title != '') {
2619
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2619
+                                $html .= ' '.__($site_title, 'geodirectory').': ';
2620 2620
                             }
2621
-                            $html .= ' </span>' . $value . '</div>';
2621
+                            $html .= ' </span>'.$value.'</div>';
2622 2622
                         }
2623 2623
                             break;
2624 2624
                         case 'text': {
@@ -2633,11 +2633,11 @@  discard block
 block discarded – undo
2633 2633
 
2634 2634
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2635 2635
 
2636
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2636
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
2637 2637
                             if ($field_set_start == 1 && $site_title != '') {
2638
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2638
+                                $html .= ' '.__($site_title, 'geodirectory').': ';
2639 2639
                             }
2640
-                            $html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2640
+                            $html .= ' </span>'.stripslashes($post->{$type['htmlvar_name']}).'</div>';
2641 2641
                         }
2642 2642
                             break;
2643 2643
                         case 'radio': {
@@ -2674,13 +2674,13 @@  discard block
 block discarded – undo
2674 2674
 
2675 2675
                                 $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2676 2676
 
2677
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2677
+                                $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;
2678 2678
 
2679 2679
                                 if ($field_set_start == 1 && $site_title != '') {
2680
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2680
+                                    $html .= ' '.__($site_title, 'geodirectory').': ';
2681 2681
                                 }
2682 2682
 
2683
-                                $html .= ' </span>' . $html_val . '</div>';
2683
+                                $html .= ' </span>'.$html_val.'</div>';
2684 2684
                             }
2685 2685
                         }
2686 2686
                             break;
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
                             $html_var = $type['htmlvar_name'];
2689 2689
                             $html_val = $type['htmlvar_name'];
2690 2690
 
2691
-                            if ((int)$post->{$html_var} == 1) {
2691
+                            if ((int) $post->{$html_var} == 1) {
2692 2692
 
2693 2693
                                 if ($post->{$type['htmlvar_name']} == '1') {
2694 2694
                                     $html_val = __('Yes', 'geodirectory');
@@ -2707,13 +2707,13 @@  discard block
 block discarded – undo
2707 2707
 
2708 2708
                                 $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2709 2709
 
2710
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2710
+                                $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;
2711 2711
 
2712 2712
                                 if ($field_set_start == 1 && $site_title != '') {
2713
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2713
+                                    $html .= ' '.__($site_title, 'geodirectory').': ';
2714 2714
                                 }
2715 2715
 
2716
-                                $html .= ' </span>' . $html_val . '</div>';
2716
+                                $html .= ' </span>'.$html_val.'</div>';
2717 2717
                             }
2718 2718
                         }
2719 2719
                             break;
@@ -2743,11 +2743,11 @@  discard block
 block discarded – undo
2743 2743
 
2744 2744
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2745 2745
 
2746
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2746
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
2747 2747
                             if ($field_set_start == 1 && $site_title != '') {
2748
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2748
+                                $html .= ' '.__($site_title, 'geodirectory').': ';
2749 2749
                             }
2750
-                            $html .= ' </span>' . $field_value . '</div>';
2750
+                            $html .= ' </span>'.$field_value.'</div>';
2751 2751
                         }
2752 2752
                             break;
2753 2753
                         case 'multiselect': {
@@ -2781,16 +2781,16 @@  discard block
 block discarded – undo
2781 2781
 
2782 2782
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2783 2783
 
2784
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2784
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
2785 2785
                             if ($field_set_start == 1 && $site_title != '') {
2786
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2786
+                                $html .= ' '.__($site_title, 'geodirectory').': ';
2787 2787
                             }
2788 2788
                             $html .= ' </span>';
2789 2789
 
2790 2790
                             if (count($option_values) > 1) {
2791 2791
                                 $html .= '<ul>';
2792 2792
                                 foreach ($option_values as $val) {
2793
-                                    $html .= '<li>' . $val . '</li>';
2793
+                                    $html .= '<li>'.$val.'</li>';
2794 2794
                                 }
2795 2795
                                 $html .= '</ul>';
2796 2796
                             } else {
@@ -2811,11 +2811,11 @@  discard block
 block discarded – undo
2811 2811
 
2812 2812
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2813 2813
 
2814
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2814
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
2815 2815
                             if ($field_set_start == 1 && $site_title != '') {
2816
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2816
+                                $html .= ' '.__($site_title, 'geodirectory').': ';
2817 2817
                             }
2818
-                            $html .= ' </span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
2818
+                            $html .= ' </span>'.stripslashes($post->{$type['htmlvar_name']}).'</div>';
2819 2819
                         }
2820 2820
                             break;
2821 2821
                         case 'textarea': {
@@ -2830,11 +2830,11 @@  discard block
 block discarded – undo
2830 2830
 
2831 2831
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2832 2832
 
2833
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2833
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
2834 2834
                             if ($field_set_start == 1 && $site_title != '') {
2835
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2835
+                                $html .= ' '.__($site_title, 'geodirectory').': ';
2836 2836
                             }
2837
-                            $html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2837
+                            $html .= '</span>'.wpautop(stripslashes($post->{$type['htmlvar_name']})).'</div>';
2838 2838
                         }
2839 2839
                             break;
2840 2840
                         case 'html': {
@@ -2849,11 +2849,11 @@  discard block
 block discarded – undo
2849 2849
 
2850 2850
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2851 2851
 
2852
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2852
+                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
2853 2853
                             if ($field_set_start == 1 && $site_title != '') {
2854
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2854
+                                $html .= ' '.__($site_title, 'geodirectory').': ';
2855 2855
                             }
2856
-                            $html .= ' </span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
2856
+                            $html .= ' </span>'.wpautop(stripslashes($post->{$type['htmlvar_name']})).'</div>';
2857 2857
                         }
2858 2858
                         break;
2859 2859
                         case 'file': {
@@ -2864,7 +2864,7 @@  discard block
 block discarded – undo
2864 2864
 
2865 2865
                                 if (!empty($files)) {
2866 2866
                                     $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2867
-                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2867
+                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
2868 2868
                                
2869 2869
                                     $file_paths = '';
2870 2870
                                     foreach ($files as $file) {
@@ -2893,9 +2893,9 @@  discard block
 block discarded – undo
2893 2893
                                                 $file_paths .= '</a>';
2894 2894
                                                 $file_paths .= '</div>';
2895 2895
                                             } else {
2896
-                                                $ext_path = '_' . $html_var . '_';
2896
+                                                $ext_path = '_'.$html_var.'_';
2897 2897
                                                 $filename = explode($ext_path, $filename);
2898
-                                                $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2898
+                                                $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
2899 2899
                                             }
2900 2900
                                         }
2901 2901
                                     }
@@ -2912,13 +2912,13 @@  discard block
 block discarded – undo
2912 2912
                                     $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2913 2913
 
2914 2914
 
2915
-                                    $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2915
+                                    $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;'.$field_icon.'">'.$field_icon_af;
2916 2916
 
2917 2917
                                     if ($field_set_start == 1 && $site_title != '') {
2918
-                                        $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2918
+                                        $html .= ' '.__($site_title, 'geodirectory').': ';
2919 2919
                                     }
2920 2920
 
2921
-                                    $html .= ' </span>' . $file_paths . '</div>';
2921
+                                    $html .= ' </span>'.$file_paths.'</div>';
2922 2922
                                 }
2923 2923
                             }
2924 2924
                         }
@@ -2969,7 +2969,7 @@  discard block
 block discarded – undo
2969 2969
                                  * @param string $htmlvar_name The field HTML var name.
2970 2970
                                  */
2971 2971
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2972
-                                'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2972
+                                'tab_content' => '<div class="geodir-company_info field-group">'.$fieldset_html.'</html>'
2973 2973
                             );
2974 2974
                         }
2975 2975
                     } else {
@@ -3029,7 +3029,7 @@  discard block
 block discarded – undo
3029 3029
             }
3030 3030
             $status .= ")</strong>";
3031 3031
 
3032
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3032
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
3033 3033
         }
3034 3034
     }
3035 3035
 
@@ -3109,7 +3109,7 @@  discard block
 block discarded – undo
3109 3109
 function geodir_no_rating_comment_text($content, $comment = '')
3110 3110
 {
3111 3111
     if (!is_admin()) {
3112
-        return '<div class="description">' . $content . '</div>';
3112
+        return '<div class="description">'.$content.'</div>';
3113 3113
     } else {
3114 3114
         return $content;
3115 3115
     }
@@ -3187,7 +3187,7 @@  discard block
 block discarded – undo
3187 3187
         $classes[] = 'gd-no-rating';
3188 3188
     }
3189 3189
     
3190
-    $classes[] = 'gd-map-' . geodir_map_name();
3190
+    $classes[] = 'gd-map-'.geodir_map_name();
3191 3191
 
3192 3192
     return $classes;
3193 3193
 }
@@ -3207,7 +3207,7 @@  discard block
 block discarded – undo
3207 3207
         $class .= ' gd-no-rating';
3208 3208
     }
3209 3209
     
3210
-    $class .= ' gd-map-' . geodir_map_name();
3210
+    $class .= ' gd-map-'.geodir_map_name();
3211 3211
 
3212 3212
     return $class;
3213 3213
 }
@@ -3242,7 +3242,7 @@  discard block
 block discarded – undo
3242 3242
  * @return array Translation texts.
3243 3243
  */
3244 3244
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3245
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3245
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
3246 3246
 
3247 3247
     $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3248 3248
 
@@ -3308,14 +3308,14 @@  discard block
 block discarded – undo
3308 3308
  * @param array $args The array of menu arguments.
3309 3309
  * @return array The modified arguments.
3310 3310
  */
3311
-function geodir_add_nav_menu_class( $args )
3311
+function geodir_add_nav_menu_class($args)
3312 3312
 {
3313 3313
 
3314
-        if(isset($args['menu_class'])){
3314
+        if (isset($args['menu_class'])) {
3315 3315
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
3316 3316
         }
3317 3317
     
3318 3318
     return $args;
3319 3319
 }
3320 3320
 
3321
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
3322 3321
\ No newline at end of file
3322
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
3323 3323
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 1 patch
Indentation   +2817 added lines, -2817 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
+	{
1062 1053
 
1063
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1054
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1055
+			'categorys' => __('Categories', 'geodirectory'));
1064 1056
 
1065
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
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
+		}
1066 1062
 
1067
-        return $columns;
1068
-    }
1063
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1064
+
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">
@@ -2774,7 +2774,7 @@  discard block
 block discarded – undo
2774 2774
 						 * Called just after the sample CSV download link.
2775 2775
 						 *
2776 2776
 						 * @since 1.0.0
2777
-                         * @package GeoDirectory
2777
+						 * @package GeoDirectory
2778 2778
 						 */
2779 2779
 						do_action('geodir_sample_cats_csv_download_link');
2780 2780
 						?>
@@ -2859,11 +2859,11 @@  discard block
 block discarded – undo
2859 2859
 	 *
2860 2860
 	 * Called after the last setting on the GD > Import & Export page.
2861 2861
 	 * @since 1.4.6
2862
-     * @package GeoDirectory
2862
+	 * @package GeoDirectory
2863 2863
 	 *
2864 2864
 	 * @param array $gd_posttypes GD post types.
2865
-     * @param array $gd_chunksize_options File chunk size options.
2866
-     * @param string $nonce Wordpress security token for GD import & export.
2865
+	 * @param array $gd_chunksize_options File chunk size options.
2866
+	 * @param string $nonce Wordpress security token for GD import & export.
2867 2867
 	 */
2868 2868
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2869 2869
 	?>
@@ -3520,44 +3520,44 @@  discard block
 block discarded – undo
3520 3520
 function geodir_init_filesystem()
3521 3521
 {
3522 3522
 
3523
-    if(!function_exists('get_filesystem_method')){
3524
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3525
-    }
3526
-    $access_type = get_filesystem_method();
3527
-    if ($access_type === 'direct') {
3528
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3529
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3530
-
3531
-        /* initialize the API */
3532
-        if (!WP_Filesystem($creds)) {
3533
-            /* any problems and we exit */
3534
-            //return '@@@3';
3535
-            return false;
3536
-        }
3537
-
3538
-        global $wp_filesystem;
3539
-        return $wp_filesystem;
3540
-        /* do our file manipulations below */
3541
-    } elseif (defined('FTP_USER')) {
3542
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3523
+	if(!function_exists('get_filesystem_method')){
3524
+		require_once(ABSPATH."/wp-admin/includes/file.php");
3525
+	}
3526
+	$access_type = get_filesystem_method();
3527
+	if ($access_type === 'direct') {
3528
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3529
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3530
+
3531
+		/* initialize the API */
3532
+		if (!WP_Filesystem($creds)) {
3533
+			/* any problems and we exit */
3534
+			//return '@@@3';
3535
+			return false;
3536
+		}
3543 3537
 
3544
-        /* initialize the API */
3545
-        if (!WP_Filesystem($creds)) {
3546
-            /* any problems and we exit */
3547
-            //return '@@@33';
3548
-            return false;
3549
-        }
3538
+		global $wp_filesystem;
3539
+		return $wp_filesystem;
3540
+		/* do our file manipulations below */
3541
+	} elseif (defined('FTP_USER')) {
3542
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3543
+
3544
+		/* initialize the API */
3545
+		if (!WP_Filesystem($creds)) {
3546
+			/* any problems and we exit */
3547
+			//return '@@@33';
3548
+			return false;
3549
+		}
3550 3550
 
3551
-        global $wp_filesystem;
3552
-        //return '@@@1';
3553
-        return $wp_filesystem;
3551
+		global $wp_filesystem;
3552
+		//return '@@@1';
3553
+		return $wp_filesystem;
3554 3554
 
3555
-    } else {
3556
-        //return '@@@2';
3557
-        /* don't have direct write access. Prompt user with our notice */
3558
-        add_action('admin_notice', 'geodir_filesystem_notice');
3559
-        return false;
3560
-    }
3555
+	} else {
3556
+		//return '@@@2';
3557
+		/* don't have direct write access. Prompt user with our notice */
3558
+		add_action('admin_notice', 'geodir_filesystem_notice');
3559
+		return false;
3560
+	}
3561 3561
 
3562 3562
 }
3563 3563
 
@@ -3575,10 +3575,10 @@  discard block
 block discarded – undo
3575 3575
  */
3576 3576
 function geodir_filesystem_notice()
3577 3577
 {   if ( defined( 'DOING_AJAX' ) ){return;}
3578
-    $access_type = get_filesystem_method();
3579
-    if ($access_type === 'direct') {
3580
-    } elseif (!defined('FTP_USER')) {
3581
-        ?>
3578
+	$access_type = get_filesystem_method();
3579
+	if ($access_type === 'direct') {
3580
+	} elseif (!defined('FTP_USER')) {
3581
+		?>
3582 3582
         <div class="error">
3583 3583
             <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'); ?>
3584 3584
                 <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>
@@ -3604,1229 +3604,1229 @@  discard block
 block discarded – undo
3604 3604
  * @return string Json data.
3605 3605
  */
3606 3606
 function geodir_ajax_import_export() {
3607
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3607
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3608 3608
     
3609
-    error_reporting(0);
3609
+	error_reporting(0);
3610 3610
 
3611
-    // try to set higher limits for import
3612
-    $max_input_time = ini_get('max_input_time');
3613
-    $max_execution_time = ini_get('max_execution_time');
3614
-    $memory_limit= ini_get('memory_limit');
3611
+	// try to set higher limits for import
3612
+	$max_input_time = ini_get('max_input_time');
3613
+	$max_execution_time = ini_get('max_execution_time');
3614
+	$memory_limit= ini_get('memory_limit');
3615 3615
 
3616
-    if(!$max_input_time || $max_input_time<3000){
3617
-        ini_set('max_input_time', 3000);
3618
-    }
3616
+	if(!$max_input_time || $max_input_time<3000){
3617
+		ini_set('max_input_time', 3000);
3618
+	}
3619 3619
 
3620
-    if(!$max_execution_time || $max_execution_time<3000){
3621
-        ini_set('max_execution_time', 3000);
3622
-    }
3620
+	if(!$max_execution_time || $max_execution_time<3000){
3621
+		ini_set('max_execution_time', 3000);
3622
+	}
3623 3623
 
3624
-    if($memory_limit && str_replace('M','',$memory_limit)){
3625
-        if(str_replace('M','',$memory_limit)<256){
3626
-            ini_set('memory_limit', '256M');
3627
-        }
3628
-    }
3624
+	if($memory_limit && str_replace('M','',$memory_limit)){
3625
+		if(str_replace('M','',$memory_limit)<256){
3626
+			ini_set('memory_limit', '256M');
3627
+		}
3628
+	}
3629 3629
 
3630
-    $json = array();
3630
+	$json = array();
3631 3631
 
3632
-    if ( !current_user_can( 'manage_options' ) ) {
3633
-        wp_send_json( $json );
3634
-    }
3632
+	if ( !current_user_can( 'manage_options' ) ) {
3633
+		wp_send_json( $json );
3634
+	}
3635 3635
 
3636
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3637
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3638
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3636
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3637
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3638
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3639 3639
 
3640
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3641
-        wp_send_json( $json );
3642
-    }
3640
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3641
+		wp_send_json( $json );
3642
+	}
3643 3643
 
3644
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3645
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3646
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3647
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3644
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3645
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3646
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3647
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3648 3648
 
3649
-    $wp_filesystem = geodir_init_filesystem();
3650
-    if (!$wp_filesystem) {
3651
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3652
-        wp_send_json( $json );
3653
-    }
3649
+	$wp_filesystem = geodir_init_filesystem();
3650
+	if (!$wp_filesystem) {
3651
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3652
+		wp_send_json( $json );
3653
+	}
3654 3654
 
3655
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3656
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3657
-        wp_send_json( $json );
3658
-    }
3655
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3656
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3657
+		wp_send_json( $json );
3658
+	}
3659 3659
 
3660
-    $csv_file_dir = geodir_path_import_export( false );
3661
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3662
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3663
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3664
-            wp_send_json( $json );
3665
-        }
3666
-    }
3660
+	$csv_file_dir = geodir_path_import_export( false );
3661
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3662
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3663
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3664
+			wp_send_json( $json );
3665
+		}
3666
+	}
3667 3667
     
3668
-    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3669
-    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3670
-
3671
-    switch ( $task ) {
3672
-        case 'export_posts': {
3673
-            // WPML
3674
-            $is_wpml = geodir_is_wpml();
3675
-            if ($is_wpml) {
3676
-                global $sitepress;
3677
-                $active_lang = ICL_LANGUAGE_CODE;
3668
+	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3669
+	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3670
+
3671
+	switch ( $task ) {
3672
+		case 'export_posts': {
3673
+			// WPML
3674
+			$is_wpml = geodir_is_wpml();
3675
+			if ($is_wpml) {
3676
+				global $sitepress;
3677
+				$active_lang = ICL_LANGUAGE_CODE;
3678 3678
                 
3679
-                $sitepress->switch_lang('all', true);
3680
-            }
3681
-            // WPML
3682
-            if ( $post_type == 'gd_event' ) {
3683
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3684
-            }
3685
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3686
-            $posts_count = geodir_get_posts_count( $post_type );
3687
-            $file_url_base = geodir_path_import_export() . '/';
3688
-            $file_url = $file_url_base . $file_name . '.csv';
3689
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3690
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3679
+				$sitepress->switch_lang('all', true);
3680
+			}
3681
+			// WPML
3682
+			if ( $post_type == 'gd_event' ) {
3683
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3684
+			}
3685
+			$file_name = $post_type . '_' . date( 'dmyHi' );
3686
+			$posts_count = geodir_get_posts_count( $post_type );
3687
+			$file_url_base = geodir_path_import_export() . '/';
3688
+			$file_url = $file_url_base . $file_name . '.csv';
3689
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3690
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3691 3691
             
3692
-            $chunk_file_paths = array();
3692
+			$chunk_file_paths = array();
3693 3693
 
3694
-            if ( isset( $_REQUEST['_st'] ) ) {
3695
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3696
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3697
-                $percentage = min( $percentage, 100 );
3694
+			if ( isset( $_REQUEST['_st'] ) ) {
3695
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3696
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3697
+				$percentage = min( $percentage, 100 );
3698 3698
                 
3699
-                $json['percentage'] = $percentage;
3700
-                // WPML
3701
-                if ($is_wpml) {
3702
-                    $sitepress->switch_lang($active_lang, true);
3703
-                }
3704
-                // WPML
3705
-                wp_send_json( $json );
3706
-                gd_die();
3707
-            } else {
3708
-                if ( !$posts_count > 0 ) {
3709
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3710
-                } else {
3711
-                    $total_posts = $posts_count;
3712
-                    if ($chunk_per_page > $total_posts) {
3713
-                        $chunk_per_page = $total_posts;
3714
-                    }
3715
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3699
+				$json['percentage'] = $percentage;
3700
+				// WPML
3701
+				if ($is_wpml) {
3702
+					$sitepress->switch_lang($active_lang, true);
3703
+				}
3704
+				// WPML
3705
+				wp_send_json( $json );
3706
+				gd_die();
3707
+			} else {
3708
+				if ( !$posts_count > 0 ) {
3709
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3710
+				} else {
3711
+					$total_posts = $posts_count;
3712
+					if ($chunk_per_page > $total_posts) {
3713
+						$chunk_per_page = $total_posts;
3714
+					}
3715
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3716 3716
                     
3717
-                    $j = $chunk_page_no;
3718
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3717
+					$j = $chunk_page_no;
3718
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3719 3719
                     
3720
-                    $per_page = 500;
3721
-                    if ($per_page > $chunk_per_page) {
3722
-                        $per_page = $chunk_per_page;
3723
-                    }
3724
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3720
+					$per_page = 500;
3721
+					if ($per_page > $chunk_per_page) {
3722
+						$per_page = $chunk_per_page;
3723
+					}
3724
+					$total_pages = ceil( $chunk_per_page / $per_page );
3725 3725
                     
3726
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3727
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3726
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3727
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3728 3728
                         
3729
-                        $clear = $i == 0 ? true : false;
3730
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3731
-                    }
3729
+						$clear = $i == 0 ? true : false;
3730
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3731
+					}
3732 3732
                         
3733
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3734
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3735
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3736
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3737
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3733
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3734
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3735
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3736
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3737
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3738 3738
                         
3739
-                        $file_url = $file_url_base . $chunk_file_name;
3740
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3741
-                    }
3739
+						$file_url = $file_url_base . $chunk_file_name;
3740
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3741
+					}
3742 3742
                     
3743
-                    if ( !empty($chunk_file_paths) ) {
3744
-                        $json['total'] = $posts_count;
3745
-                        $json['files'] = $chunk_file_paths;
3746
-                    } else {
3747
-                        if ($j > 1) {
3748
-                            $json['total'] = $posts_count;
3749
-                            $json['files'] = array();
3750
-                        } else {
3751
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3752
-                        }
3753
-                    }
3754
-                }
3755
-                // WPML
3756
-                if ($is_wpml) {
3757
-                    $sitepress->switch_lang($active_lang, true);
3758
-                }
3759
-                // WPML
3760
-                wp_send_json( $json );
3761
-            }
3762
-        }
3763
-        break;
3764
-        case 'export_cats': {
3765
-            // WPML
3766
-            $is_wpml = geodir_is_wpml();
3767
-            if ($is_wpml) {
3768
-                global $sitepress;
3769
-                $active_lang = ICL_LANGUAGE_CODE;
3743
+					if ( !empty($chunk_file_paths) ) {
3744
+						$json['total'] = $posts_count;
3745
+						$json['files'] = $chunk_file_paths;
3746
+					} else {
3747
+						if ($j > 1) {
3748
+							$json['total'] = $posts_count;
3749
+							$json['files'] = array();
3750
+						} else {
3751
+							$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3752
+						}
3753
+					}
3754
+				}
3755
+				// WPML
3756
+				if ($is_wpml) {
3757
+					$sitepress->switch_lang($active_lang, true);
3758
+				}
3759
+				// WPML
3760
+				wp_send_json( $json );
3761
+			}
3762
+		}
3763
+		break;
3764
+		case 'export_cats': {
3765
+			// WPML
3766
+			$is_wpml = geodir_is_wpml();
3767
+			if ($is_wpml) {
3768
+				global $sitepress;
3769
+				$active_lang = ICL_LANGUAGE_CODE;
3770 3770
                 
3771
-                $sitepress->switch_lang('all', true);
3772
-            }
3773
-            // WPML
3774
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3771
+				$sitepress->switch_lang('all', true);
3772
+			}
3773
+			// WPML
3774
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
3775 3775
             
3776
-            $terms_count = geodir_get_terms_count( $post_type );
3777
-            $file_url_base = geodir_path_import_export() . '/';
3778
-            $file_url = $file_url_base . $file_name . '.csv';
3779
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3780
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3776
+			$terms_count = geodir_get_terms_count( $post_type );
3777
+			$file_url_base = geodir_path_import_export() . '/';
3778
+			$file_url = $file_url_base . $file_name . '.csv';
3779
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3780
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3781 3781
             
3782
-            $chunk_file_paths = array();
3782
+			$chunk_file_paths = array();
3783 3783
             
3784
-            if ( isset( $_REQUEST['_st'] ) ) {
3785
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3786
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3787
-                $percentage = min( $percentage, 100 );
3784
+			if ( isset( $_REQUEST['_st'] ) ) {
3785
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3786
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3787
+				$percentage = min( $percentage, 100 );
3788 3788
                 
3789
-                $json['percentage'] = $percentage;
3790
-                // WPML
3791
-                if ($is_wpml) {
3792
-                    $sitepress->switch_lang($active_lang, true);
3793
-                }
3794
-                // WPML
3795
-                wp_send_json( $json );
3796
-            } else {
3797
-                if ( !$terms_count > 0 ) {
3798
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3799
-                } else {
3800
-                    $total_terms = $terms_count;
3801
-                    if ($chunk_per_page > $terms_count) {
3802
-                        $chunk_per_page = $terms_count;
3803
-                    }
3804
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3789
+				$json['percentage'] = $percentage;
3790
+				// WPML
3791
+				if ($is_wpml) {
3792
+					$sitepress->switch_lang($active_lang, true);
3793
+				}
3794
+				// WPML
3795
+				wp_send_json( $json );
3796
+			} else {
3797
+				if ( !$terms_count > 0 ) {
3798
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3799
+				} else {
3800
+					$total_terms = $terms_count;
3801
+					if ($chunk_per_page > $terms_count) {
3802
+						$chunk_per_page = $terms_count;
3803
+					}
3804
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3805 3805
                     
3806
-                    $j = $chunk_page_no;
3807
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3806
+					$j = $chunk_page_no;
3807
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3808 3808
                     
3809
-                    $per_page = 500;
3810
-                    if ($per_page > $chunk_per_page) {
3811
-                        $per_page = $chunk_per_page;
3812
-                    }
3813
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3809
+					$per_page = 500;
3810
+					if ($per_page > $chunk_per_page) {
3811
+						$per_page = $chunk_per_page;
3812
+					}
3813
+					$total_pages = ceil( $chunk_per_page / $per_page );
3814 3814
                     
3815
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3816
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3815
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3816
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3817 3817
                         
3818
-                        $clear = $i == 0 ? true : false;
3819
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3820
-                    }
3818
+						$clear = $i == 0 ? true : false;
3819
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3820
+					}
3821 3821
                     
3822
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3823
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3824
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3825
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3826
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3822
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3823
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3824
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3825
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3826
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3827 3827
                         
3828
-                        $file_url = $file_url_base . $chunk_file_name;
3829
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3830
-                    }
3828
+						$file_url = $file_url_base . $chunk_file_name;
3829
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3830
+					}
3831 3831
                     
3832
-                    if ( !empty($chunk_file_paths) ) {
3833
-                        $json['total'] = $terms_count;
3834
-                        $json['files'] = $chunk_file_paths;
3835
-                    } else {
3836
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3837
-                    }
3838
-                }
3839
-                // WPML
3840
-                if ($is_wpml) {
3841
-                    $sitepress->switch_lang($active_lang, true);
3842
-                }
3843
-                // WPML
3844
-                wp_send_json( $json );
3845
-            }
3846
-        }
3847
-        break;
3848
-        case 'export_locations': {
3849
-            $file_url_base = geodir_path_import_export() . '/';
3850
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3851
-            $file_url = $file_url_base . $file_name . '.csv';
3852
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3853
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3832
+					if ( !empty($chunk_file_paths) ) {
3833
+						$json['total'] = $terms_count;
3834
+						$json['files'] = $chunk_file_paths;
3835
+					} else {
3836
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3837
+					}
3838
+				}
3839
+				// WPML
3840
+				if ($is_wpml) {
3841
+					$sitepress->switch_lang($active_lang, true);
3842
+				}
3843
+				// WPML
3844
+				wp_send_json( $json );
3845
+			}
3846
+		}
3847
+		break;
3848
+		case 'export_locations': {
3849
+			$file_url_base = geodir_path_import_export() . '/';
3850
+			$file_name = 'gd_locations_' . date( 'dmyHi' );
3851
+			$file_url = $file_url_base . $file_name . '.csv';
3852
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3853
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3854 3854
             
3855
-            $items_count = (int)geodir_location_imex_count_locations();
3855
+			$items_count = (int)geodir_location_imex_count_locations();
3856 3856
             
3857
-            if ( isset( $_REQUEST['_st'] ) ) {
3858
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3859
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3860
-                $percentage = min( $percentage, 100 );
3857
+			if ( isset( $_REQUEST['_st'] ) ) {
3858
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3859
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3860
+				$percentage = min( $percentage, 100 );
3861 3861
                 
3862
-                $json['percentage'] = $percentage;
3863
-                wp_send_json( $json );
3864
-            } else {
3865
-                $chunk_file_paths = array();
3862
+				$json['percentage'] = $percentage;
3863
+				wp_send_json( $json );
3864
+			} else {
3865
+				$chunk_file_paths = array();
3866 3866
                 
3867
-                if ( !$items_count > 0 ) {
3868
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3869
-                } else {
3870
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3871
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3867
+				if ( !$items_count > 0 ) {
3868
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3869
+				} else {
3870
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3871
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3872 3872
                     
3873
-                    $j = $chunk_page_no;
3874
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3873
+					$j = $chunk_page_no;
3874
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3875 3875
                     
3876
-                    $per_page = 500;
3877
-                    $per_page = min( $per_page, $chunk_per_page );
3878
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3876
+					$per_page = 500;
3877
+					$per_page = min( $per_page, $chunk_per_page );
3878
+					$total_pages = ceil( $chunk_per_page / $per_page );
3879 3879
                     
3880
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3881
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3880
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3881
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3882 3882
                         
3883
-                        $clear = $i == 0 ? true : false;
3884
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3885
-                    }
3883
+						$clear = $i == 0 ? true : false;
3884
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3885
+					}
3886 3886
                     
3887
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3888
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3889
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3890
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3891
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3887
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3888
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3889
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3890
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3891
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3892 3892
                         
3893
-                        $file_url = $file_url_base . $chunk_file_name;
3894
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3895
-                    }
3893
+						$file_url = $file_url_base . $chunk_file_name;
3894
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3895
+					}
3896 3896
                     
3897
-                    if ( !empty($chunk_file_paths) ) {
3898
-                        $json['total'] = $items_count;
3899
-                        $json['files'] = $chunk_file_paths;
3900
-                    } else {
3901
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3902
-                    }
3903
-                }
3904
-                wp_send_json( $json );
3905
-            }
3906
-        }
3907
-        break;
3908
-        case 'export_hoods': {
3909
-            $file_url_base = geodir_path_import_export() . '/';
3910
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3911
-            $file_url = $file_url_base . $file_name . '.csv';
3912
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3913
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3897
+					if ( !empty($chunk_file_paths) ) {
3898
+						$json['total'] = $items_count;
3899
+						$json['files'] = $chunk_file_paths;
3900
+					} else {
3901
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3902
+					}
3903
+				}
3904
+				wp_send_json( $json );
3905
+			}
3906
+		}
3907
+		break;
3908
+		case 'export_hoods': {
3909
+			$file_url_base = geodir_path_import_export() . '/';
3910
+			$file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3911
+			$file_url = $file_url_base . $file_name . '.csv';
3912
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3913
+			$file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3914 3914
             
3915
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3915
+			$items_count = (int)geodir_location_imex_count_neighbourhoods();
3916 3916
             
3917
-            if ( isset( $_REQUEST['_st'] ) ) {
3918
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3919
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3920
-                $percentage = min( $percentage, 100 );
3917
+			if ( isset( $_REQUEST['_st'] ) ) {
3918
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3919
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3920
+				$percentage = min( $percentage, 100 );
3921 3921
                 
3922
-                $json['percentage'] = $percentage;
3923
-                wp_send_json( $json );
3924
-            } else {
3925
-                $chunk_file_paths = array();
3922
+				$json['percentage'] = $percentage;
3923
+				wp_send_json( $json );
3924
+			} else {
3925
+				$chunk_file_paths = array();
3926 3926
                 
3927
-                if ( !$items_count > 0 ) {
3928
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3929
-                } else {
3930
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3931
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3927
+				if ( !$items_count > 0 ) {
3928
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3929
+				} else {
3930
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3931
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3932 3932
                     
3933
-                    $j = $chunk_page_no;
3934
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3933
+					$j = $chunk_page_no;
3934
+					$chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3935 3935
                     
3936
-                    $per_page = 500;
3937
-                    $per_page = min( $per_page, $chunk_per_page );
3938
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3936
+					$per_page = 500;
3937
+					$per_page = min( $per_page, $chunk_per_page );
3938
+					$total_pages = ceil( $chunk_per_page / $per_page );
3939 3939
                     
3940
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3941
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3940
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3941
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3942 3942
                         
3943
-                        $clear = $i == 0 ? true : false;
3944
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3945
-                    }
3943
+						$clear = $i == 0 ? true : false;
3944
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3945
+					}
3946 3946
                     
3947
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3948
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3949
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3950
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3951
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3947
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3948
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3949
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3950
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3951
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3952 3952
                         
3953
-                        $file_url = $file_url_base . $chunk_file_name;
3954
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3955
-                    }
3953
+						$file_url = $file_url_base . $chunk_file_name;
3954
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3955
+					}
3956 3956
                     
3957
-                    if ( !empty($chunk_file_paths) ) {
3958
-                        $json['total'] = $items_count;
3959
-                        $json['files'] = $chunk_file_paths;
3960
-                    } else {
3961
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3962
-                    }
3963
-                }
3964
-                wp_send_json( $json );
3965
-            }
3966
-        }
3967
-        break;
3968
-        case 'prepare_import':
3969
-        case 'import_cat':
3970
-        case 'import_post':
3971
-        case 'import_loc':
3972
-        case 'import_hood': {
3973
-            // WPML
3974
-            $is_wpml = geodir_is_wpml();
3975
-            if ($is_wpml) {
3976
-                global $sitepress;
3977
-                $active_lang = ICL_LANGUAGE_CODE;
3978
-            }
3979
-            // WPML
3957
+					if ( !empty($chunk_file_paths) ) {
3958
+						$json['total'] = $items_count;
3959
+						$json['files'] = $chunk_file_paths;
3960
+					} else {
3961
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3962
+					}
3963
+				}
3964
+				wp_send_json( $json );
3965
+			}
3966
+		}
3967
+		break;
3968
+		case 'prepare_import':
3969
+		case 'import_cat':
3970
+		case 'import_post':
3971
+		case 'import_loc':
3972
+		case 'import_hood': {
3973
+			// WPML
3974
+			$is_wpml = geodir_is_wpml();
3975
+			if ($is_wpml) {
3976
+				global $sitepress;
3977
+				$active_lang = ICL_LANGUAGE_CODE;
3978
+			}
3979
+			// WPML
3980 3980
             
3981
-            ini_set( 'auto_detect_line_endings', true );
3981
+			ini_set( 'auto_detect_line_endings', true );
3982 3982
             
3983
-            $uploads = wp_upload_dir();
3984
-            $uploads_dir = $uploads['path'];
3985
-            $uploads_subdir = $uploads['subdir'];
3983
+			$uploads = wp_upload_dir();
3984
+			$uploads_dir = $uploads['path'];
3985
+			$uploads_subdir = $uploads['subdir'];
3986 3986
             
3987
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3988
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3987
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3988
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3989 3989
             
3990
-            $csv_file_arr = explode( '/', $csv_file );
3991
-            $csv_filename = end( $csv_file_arr );
3992
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3990
+			$csv_file_arr = explode( '/', $csv_file );
3991
+			$csv_filename = end( $csv_file_arr );
3992
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3993 3993
             
3994
-            $json['file'] = $csv_file;
3995
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3996
-            $file = array();
3994
+			$json['file'] = $csv_file;
3995
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3996
+			$file = array();
3997 3997
 
3998
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3999
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3998
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3999
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
4000 4000
                 
4001
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4002
-                    $json['error'] = NULL;
4003
-                    $json['rows'] = 0;
4001
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4002
+					$json['error'] = NULL;
4003
+					$json['rows'] = 0;
4004 4004
                     
4005
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4006
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4007
-                            if ( !empty( $data ) ) {
4008
-                                $file[] = $data;
4009
-                            }
4010
-                        }
4011
-                        fclose($handle);
4012
-                    }
4005
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4006
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4007
+							if ( !empty( $data ) ) {
4008
+								$file[] = $data;
4009
+							}
4010
+						}
4011
+						fclose($handle);
4012
+					}
4013 4013
 
4014
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4014
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4015 4015
                     
4016
-                    if (!$json['rows'] > 0) {
4017
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
4018
-                    }
4019
-                } else {
4020
-                    wp_send_json( $json );
4021
-                }
4022
-            } else {
4023
-                wp_send_json( $json );
4024
-            }
4016
+					if (!$json['rows'] > 0) {
4017
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
4018
+					}
4019
+				} else {
4020
+					wp_send_json( $json );
4021
+				}
4022
+			} else {
4023
+				wp_send_json( $json );
4024
+			}
4025 4025
             
4026
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4027
-                wp_send_json( $json );
4028
-            }
4026
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4027
+				wp_send_json( $json );
4028
+			}
4029 4029
             
4030
-            $total = $json['rows'];
4031
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4032
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4030
+			$total = $json['rows'];
4031
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4032
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4033 4033
             
4034
-            $count = $limit;
4034
+			$count = $limit;
4035 4035
             
4036
-            if ($count < $total) {
4037
-                $count = $processed + $count;
4038
-                if ($count > $total) {
4039
-                    $count = $total;
4040
-                }
4041
-            } else {
4042
-                $count = $total;
4043
-            }
4036
+			if ($count < $total) {
4037
+				$count = $processed + $count;
4038
+				if ($count > $total) {
4039
+					$count = $total;
4040
+				}
4041
+			} else {
4042
+				$count = $total;
4043
+			}
4044 4044
             
4045
-            $created = 0;
4046
-            $updated = 0;
4047
-            $skipped = 0;
4048
-            $invalid = 0;
4049
-            $invalid_addr = 0;
4050
-            $images = 0;
4045
+			$created = 0;
4046
+			$updated = 0;
4047
+			$skipped = 0;
4048
+			$invalid = 0;
4049
+			$invalid_addr = 0;
4050
+			$images = 0;
4051 4051
             
4052
-            $gd_post_info = array();
4053
-            $countpost = 0;
4052
+			$gd_post_info = array();
4053
+			$countpost = 0;
4054 4054
             
4055
-            $post_types = geodir_get_posttypes();
4055
+			$post_types = geodir_get_posttypes();
4056 4056
 
4057
-            if ( $task == 'import_cat' ) {
4058
-                if (!empty($file)) {
4059
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4057
+			if ( $task == 'import_cat' ) {
4058
+				if (!empty($file)) {
4059
+					$columns = isset($file[0]) ? $file[0] : NULL;
4060 4060
                     
4061
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4062
-                        $json['error'] = CSV_INVAILD_FILE;
4063
-                        wp_send_json( $json );
4064
-                        exit;
4065
-                    }
4061
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4062
+						$json['error'] = CSV_INVAILD_FILE;
4063
+						wp_send_json( $json );
4064
+						exit;
4065
+					}
4066 4066
                     
4067
-                    $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
4067
+					$gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
4068 4068
                     
4069
-                    for ($i = 1; $i <= $limit; $i++) {
4070
-                        $index = $processed + $i;
4069
+					for ($i = 1; $i <= $limit; $i++) {
4070
+						$index = $processed + $i;
4071 4071
                         
4072
-                        if (isset($file[$index])) {
4073
-                            $row = $file[$index];
4074
-                            $row = array_map( 'trim', $row );
4075
-                            //$row = array_map( 'utf8_encode', $row );
4072
+						if (isset($file[$index])) {
4073
+							$row = $file[$index];
4074
+							$row = array_map( 'trim', $row );
4075
+							//$row = array_map( 'utf8_encode', $row );
4076 4076
                             
4077
-                            $cat_id = '';
4078
-                            $cat_name = '';
4079
-                            $cat_slug = '';
4080
-                            $cat_posttype = '';
4081
-                            $cat_parent = '';
4082
-                            $cat_description = '';
4083
-                            $cat_schema = '';
4084
-                            $cat_top_description = '';
4085
-                            $cat_image = '';
4086
-                            $cat_icon = '';
4087
-                            $cat_language = '';
4088
-                            $cat_id_original = '';
4077
+							$cat_id = '';
4078
+							$cat_name = '';
4079
+							$cat_slug = '';
4080
+							$cat_posttype = '';
4081
+							$cat_parent = '';
4082
+							$cat_description = '';
4083
+							$cat_schema = '';
4084
+							$cat_top_description = '';
4085
+							$cat_image = '';
4086
+							$cat_icon = '';
4087
+							$cat_language = '';
4088
+							$cat_id_original = '';
4089 4089
                             
4090
-                            $c = 0;
4091
-                            foreach ($columns as $column ) {
4092
-                                if ( $column == 'cat_id' ) {
4093
-                                    $cat_id = (int)$row[$c];
4094
-                                } else if ( $column == 'cat_name' ) {
4095
-                                    $cat_name = $row[$c];
4096
-                                } else if ( $column == 'cat_slug' ) {
4097
-                                    $cat_slug = $row[$c];
4098
-                                } else if ( $column == 'cat_posttype' ) {
4099
-                                    $cat_posttype = $row[$c];
4100
-                                } else if ( $column == 'cat_parent' ) {
4101
-                                    $cat_parent = trim($row[$c]);
4102
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4103
-                                    $cat_schema = $row[$c];
4104
-                                } else if ( $column == 'cat_description' ) {
4105
-                                    $cat_description = $row[$c];
4106
-                                } else if ( $column == 'cat_top_description' ) {
4107
-                                    $cat_top_description = $row[$c];
4108
-                                } else if ( $column == 'cat_image' ) {
4109
-                                    $cat_image = $row[$c];
4110
-                                } else if ( $column == 'cat_icon' ) {
4111
-                                    $cat_icon = $row[$c];
4112
-                                }
4113
-                                // WPML
4114
-                                if ( $is_wpml ) {
4115
-                                    if ( $column == 'cat_language' ) {
4116
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
4117
-                                    } else if ( $column == 'cat_id_original' ) {
4118
-                                        $cat_id_original = (int)$row[$c];
4119
-                                    }
4120
-                                }
4121
-                                // WPML
4122
-                                $c++;
4123
-                            }
4090
+							$c = 0;
4091
+							foreach ($columns as $column ) {
4092
+								if ( $column == 'cat_id' ) {
4093
+									$cat_id = (int)$row[$c];
4094
+								} else if ( $column == 'cat_name' ) {
4095
+									$cat_name = $row[$c];
4096
+								} else if ( $column == 'cat_slug' ) {
4097
+									$cat_slug = $row[$c];
4098
+								} else if ( $column == 'cat_posttype' ) {
4099
+									$cat_posttype = $row[$c];
4100
+								} else if ( $column == 'cat_parent' ) {
4101
+									$cat_parent = trim($row[$c]);
4102
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4103
+									$cat_schema = $row[$c];
4104
+								} else if ( $column == 'cat_description' ) {
4105
+									$cat_description = $row[$c];
4106
+								} else if ( $column == 'cat_top_description' ) {
4107
+									$cat_top_description = $row[$c];
4108
+								} else if ( $column == 'cat_image' ) {
4109
+									$cat_image = $row[$c];
4110
+								} else if ( $column == 'cat_icon' ) {
4111
+									$cat_icon = $row[$c];
4112
+								}
4113
+								// WPML
4114
+								if ( $is_wpml ) {
4115
+									if ( $column == 'cat_language' ) {
4116
+										$cat_language = geodir_strtolower( trim( $row[$c] ) );
4117
+									} else if ( $column == 'cat_id_original' ) {
4118
+										$cat_id_original = (int)$row[$c];
4119
+									}
4120
+								}
4121
+								// WPML
4122
+								$c++;
4123
+							}
4124 4124
                             
4125
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4126
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4125
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4126
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4127 4127
                                 
4128
-                                $invalid++;
4129
-                                continue;
4130
-                            }
4128
+								$invalid++;
4129
+								continue;
4130
+							}
4131 4131
                             
4132
-                            // WPML
4133
-                            if ($is_wpml && $cat_language != '') {
4134
-                                $sitepress->switch_lang($cat_language, true);
4135
-                            }
4136
-                            // WPML
4132
+							// WPML
4133
+							if ($is_wpml && $cat_language != '') {
4134
+								$sitepress->switch_lang($cat_language, true);
4135
+							}
4136
+							// WPML
4137 4137
                                                         
4138
-                            $term_data = array();
4139
-                            $term_data['name'] = $cat_name;
4140
-                            $term_data['slug'] = $cat_slug;
4141
-                            $term_data['description'] = $cat_description;
4142
-                            $term_data['cat_schema'] = $cat_schema;
4143
-                            $term_data['top_description'] = $cat_top_description;
4144
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4145
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4138
+							$term_data = array();
4139
+							$term_data['name'] = $cat_name;
4140
+							$term_data['slug'] = $cat_slug;
4141
+							$term_data['description'] = $cat_description;
4142
+							$term_data['cat_schema'] = $cat_schema;
4143
+							$term_data['top_description'] = $cat_top_description;
4144
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4145
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4146 4146
                             
4147
-                            //$term_data = array_map( 'utf8_encode', $term_data );
4147
+							//$term_data = array_map( 'utf8_encode', $term_data );
4148 4148
                             
4149
-                            $taxonomy = $cat_posttype . 'category';
4149
+							$taxonomy = $cat_posttype . 'category';
4150 4150
                             
4151
-                            $term_data['taxonomy'] = $taxonomy;
4151
+							$term_data['taxonomy'] = $taxonomy;
4152 4152
 
4153
-                            $term_parent_id = 0;
4154
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4155
-                                $term_parent = '';
4153
+							$term_parent_id = 0;
4154
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
4155
+								$term_parent = '';
4156 4156
                                 
4157
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4158
-                                    //
4159
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4160
-                                    //
4161
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4162
-                                    //
4163
-                                } else {
4164
-                                    $term_parent_data = array();
4165
-                                    $term_parent_data['name'] = $cat_parent;
4166
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4167
-                                    $term_parent_data['taxonomy'] = $taxonomy;
4157
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4158
+									//
4159
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4160
+									//
4161
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4162
+									//
4163
+								} else {
4164
+									$term_parent_data = array();
4165
+									$term_parent_data['name'] = $cat_parent;
4166
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4167
+									$term_parent_data['taxonomy'] = $taxonomy;
4168 4168
                                     
4169
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4170
-                                }
4169
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4170
+								}
4171 4171
                                 
4172
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4173
-                                    $term_parent_id = (int)$term_parent->term_id;
4174
-                                }
4175
-                            }
4176
-                            $term_data['parent'] = (int)$term_parent_id;
4172
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4173
+									$term_parent_id = (int)$term_parent->term_id;
4174
+								}
4175
+							}
4176
+							$term_data['parent'] = (int)$term_parent_id;
4177 4177
 
4178
-                            $term_id = NULL;
4179
-                            if ( $import_choice == 'update' ) {
4180
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4181
-                                    $term_data['term_id'] = $term['term_id'];
4178
+							$term_id = NULL;
4179
+							if ( $import_choice == 'update' ) {
4180
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4181
+									$term_data['term_id'] = $term['term_id'];
4182 4182
                                     
4183
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4184
-                                        $updated++;
4185
-                                    } else {
4186
-                                        $invalid++;
4187
-                                        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' ) );
4188
-                                    }
4189
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4190
-                                    $term_data['term_id'] = $term['term_id'];
4183
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4184
+										$updated++;
4185
+									} else {
4186
+										$invalid++;
4187
+										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' ) );
4188
+									}
4189
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4190
+									$term_data['term_id'] = $term['term_id'];
4191 4191
                                     
4192
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4193
-                                        $updated++;
4194
-                                    } else {
4195
-                                        $invalid++;
4196
-                                        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' ) );
4197
-                                    }
4198
-                                } else {
4199
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4200
-                                        $created++;
4201
-                                    } else {
4202
-                                        $invalid++;
4203
-                                        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' ) );
4204
-                                    }
4205
-                                }
4206
-                            } else if ( $import_choice == 'skip' ) {
4207
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4208
-                                    $skipped++;
4209
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4210
-                                    $skipped++;
4211
-                                } else {
4212
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4213
-                                        $created++;
4214
-                                    } else {
4215
-                                        $invalid++;
4216
-                                        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' ) );
4217
-                                    }
4218
-                                }
4219
-                            } else {
4220
-                                $invalid++;
4221
-                                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' ) );
4222
-                            }
4192
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4193
+										$updated++;
4194
+									} else {
4195
+										$invalid++;
4196
+										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' ) );
4197
+									}
4198
+								} else {
4199
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4200
+										$created++;
4201
+									} else {
4202
+										$invalid++;
4203
+										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' ) );
4204
+									}
4205
+								}
4206
+							} else if ( $import_choice == 'skip' ) {
4207
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4208
+									$skipped++;
4209
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4210
+									$skipped++;
4211
+								} else {
4212
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4213
+										$created++;
4214
+									} else {
4215
+										$invalid++;
4216
+										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' ) );
4217
+									}
4218
+								}
4219
+							} else {
4220
+								$invalid++;
4221
+								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' ) );
4222
+							}
4223 4223
                             
4224
-                            if ( $term_id ) {
4225
-                                // WPML
4226
-                                if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
4227
-                                    $wpml_element_type = 'tax_' . $taxonomy;
4228
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
4229
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4230
-
4231
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
4224
+							if ( $term_id ) {
4225
+								// WPML
4226
+								if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
4227
+									$wpml_element_type = 'tax_' . $taxonomy;
4228
+									$source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
4229
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4230
+
4231
+									$trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
4232 4232
                                     
4233
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
4234
-                                }
4235
-                                // WPML
4233
+									$sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
4234
+								}
4235
+								// WPML
4236 4236
                                 
4237
-                                if ( isset( $term_data['top_description'] ) ) {
4238
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4239
-                                }
4237
+								if ( isset( $term_data['top_description'] ) ) {
4238
+									update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4239
+								}
4240 4240
                                 
4241
-                                if ( isset( $term_data['cat_schema'] ) ) {
4242
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4243
-                                }
4241
+								if ( isset( $term_data['cat_schema'] ) ) {
4242
+									update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4243
+								}
4244 4244
             
4245
-                                $attachment = false;
4246
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4247
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4248
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4245
+								$attachment = false;
4246
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4247
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4248
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4249 4249
                                     
4250
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4251
-                                        $attachment = true;
4252
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4253
-                                    }
4254
-                                }
4250
+									if ( basename($cat_image) != $term_data['image'] ) {
4251
+										$attachment = true;
4252
+										update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4253
+									}
4254
+								}
4255 4255
                                 
4256
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4257
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4258
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4256
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4257
+									$cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4258
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4259 4259
                                         
4260
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4261
-                                        $attachment = true;
4262
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4263
-                                    }
4264
-                                }
4260
+									if ( basename($cat_icon) != $term_data['icon'] ) {
4261
+										$attachment = true;
4262
+										update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4263
+									}
4264
+								}
4265 4265
                                 
4266
-                                if ( $attachment ) {
4267
-                                    $images++;
4268
-                                }
4269
-                            }
4266
+								if ( $attachment ) {
4267
+									$images++;
4268
+								}
4269
+							}
4270 4270
                             
4271
-                            // WPML
4272
-                            if ($is_wpml && $cat_language != '') {
4273
-                                $sitepress->switch_lang($active_lang, true);
4274
-                            }
4275
-                            // WPML
4276
-                        }
4277
-                    }
4278
-                }
4271
+							// WPML
4272
+							if ($is_wpml && $cat_language != '') {
4273
+								$sitepress->switch_lang($active_lang, true);
4274
+							}
4275
+							// WPML
4276
+						}
4277
+					}
4278
+				}
4279 4279
                 
4280
-                $json = array();
4281
-                $json['processed'] = $limit;
4282
-                $json['created'] = $created;
4283
-                $json['updated'] = $updated;
4284
-                $json['skipped'] = $skipped;
4285
-                $json['invalid'] = $invalid;
4286
-                $json['images'] = $images;
4280
+				$json = array();
4281
+				$json['processed'] = $limit;
4282
+				$json['created'] = $created;
4283
+				$json['updated'] = $updated;
4284
+				$json['skipped'] = $skipped;
4285
+				$json['invalid'] = $invalid;
4286
+				$json['images'] = $images;
4287 4287
                 
4288
-                wp_send_json( $json );
4289
-                exit;
4290
-            } else if ( $task == 'import_post' ) {
4291
-                //run some stuff to make the import quicker
4292
-                wp_defer_term_counting( true );
4293
-                wp_defer_comment_counting( true );
4294
-                $wpdb->query( 'SET autocommit = 0;' );
4295
-
4296
-                //remove_all_actions('publish_post');
4297
-                //remove_all_actions('transition_post_status');
4298
-                //remove_all_actions('publish_future_post');
4299
-
4300
-                if (!empty($file)) {
4301
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4302
-                    $default_status = 'publish';
4303
-                    $current_date = date_i18n( 'Y-m-d', time() );
4288
+				wp_send_json( $json );
4289
+				exit;
4290
+			} else if ( $task == 'import_post' ) {
4291
+				//run some stuff to make the import quicker
4292
+				wp_defer_term_counting( true );
4293
+				wp_defer_comment_counting( true );
4294
+				$wpdb->query( 'SET autocommit = 0;' );
4295
+
4296
+				//remove_all_actions('publish_post');
4297
+				//remove_all_actions('transition_post_status');
4298
+				//remove_all_actions('publish_future_post');
4299
+
4300
+				if (!empty($file)) {
4301
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4302
+					$default_status = 'publish';
4303
+					$current_date = date_i18n( 'Y-m-d', time() );
4304 4304
                     
4305
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4305
+					$columns = isset($file[0]) ? $file[0] : NULL;
4306 4306
                     
4307
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4308
-                        $json['error'] = CSV_INVAILD_FILE;
4309
-                        wp_send_json( $json );
4310
-                        exit;
4311
-                    }
4307
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4308
+						$json['error'] = CSV_INVAILD_FILE;
4309
+						wp_send_json( $json );
4310
+						exit;
4311
+					}
4312 4312
 
4313
-                    $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4314
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4315
-                    $processed_actual = 0;
4316
-                    for ($i = 1; $i <= $limit; $i++) {
4317
-                        $index = $processed + $i;
4318
-                        $gd_post = array();
4313
+					$gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4314
+					$wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4315
+					$processed_actual = 0;
4316
+					for ($i = 1; $i <= $limit; $i++) {
4317
+						$index = $processed + $i;
4318
+						$gd_post = array();
4319 4319
                         
4320
-                        if (isset($file[$index])) {
4321
-                            $processed_actual++;
4322
-                            $row = $file[$index];
4323
-                            $row = array_map( 'trim', $row );
4324
-                            //$row = array_map( 'utf8_encode', $row );
4325
-                            $row = array_map( 'addslashes_gpc', $row );
4320
+						if (isset($file[$index])) {
4321
+							$processed_actual++;
4322
+							$row = $file[$index];
4323
+							$row = array_map( 'trim', $row );
4324
+							//$row = array_map( 'utf8_encode', $row );
4325
+							$row = array_map( 'addslashes_gpc', $row );
4326 4326
                             
4327
-                            $post_id = '';
4328
-                            $post_title = '';
4329
-                            $post_author = '';
4330
-                            $post_content = '';
4331
-                            $post_category_arr = array();
4332
-                            $default_category = '';
4333
-                            $post_tags = array();
4334
-                            $post_type = '';
4335
-                            $post_status = '';
4336
-                            $geodir_video = '';
4337
-                            $post_address = '';
4338
-                            $post_city = '';
4339
-                            $post_region = '';
4340
-                            $post_country = '';
4341
-                            $post_zip = '';
4342
-                            $post_latitude = '';
4343
-                            $post_longitude = '';
4344
-                            $post_neighbourhood = '';
4345
-                            $neighbourhood_latitude = '';
4346
-                            $neighbourhood_longitude = '';
4347
-                            $geodir_timing = '';
4348
-                            $geodir_contact = '';
4349
-                            $geodir_email = '';
4350
-                            $geodir_website = '';
4351
-                            $geodir_twitter = '';
4352
-                            $geodir_facebook = '';
4353
-                            $geodir_twitter = '';
4354
-                            $post_images = array();
4327
+							$post_id = '';
4328
+							$post_title = '';
4329
+							$post_author = '';
4330
+							$post_content = '';
4331
+							$post_category_arr = array();
4332
+							$default_category = '';
4333
+							$post_tags = array();
4334
+							$post_type = '';
4335
+							$post_status = '';
4336
+							$geodir_video = '';
4337
+							$post_address = '';
4338
+							$post_city = '';
4339
+							$post_region = '';
4340
+							$post_country = '';
4341
+							$post_zip = '';
4342
+							$post_latitude = '';
4343
+							$post_longitude = '';
4344
+							$post_neighbourhood = '';
4345
+							$neighbourhood_latitude = '';
4346
+							$neighbourhood_longitude = '';
4347
+							$geodir_timing = '';
4348
+							$geodir_contact = '';
4349
+							$geodir_email = '';
4350
+							$geodir_website = '';
4351
+							$geodir_twitter = '';
4352
+							$geodir_facebook = '';
4353
+							$geodir_twitter = '';
4354
+							$post_images = array();
4355 4355
                             
4356
-                            $expire_date = 'Never';
4356
+							$expire_date = 'Never';
4357 4357
                             
4358
-                            $language = '';
4359
-                            $original_post_id = '';
4358
+							$language = '';
4359
+							$original_post_id = '';
4360 4360
                                                         
4361
-                            $c = 0;
4362
-                            foreach ($columns as $column ) {
4363
-                                $gd_post[$column] = $row[$c];
4361
+							$c = 0;
4362
+							foreach ($columns as $column ) {
4363
+								$gd_post[$column] = $row[$c];
4364 4364
                                 
4365
-                                if ( $column == 'post_id' ) {
4366
-                                    $post_id = $row[$c];
4367
-                                } else if ( $column == 'post_title' ) {
4368
-                                    $post_title = sanitize_text_field($row[$c]);
4369
-                                } else if ( $column == 'post_author' ) {
4370
-                                    $post_author = $row[$c];
4371
-                                } else if ( $column == 'post_content' ) {
4372
-                                    $post_content = $row[$c];
4373
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4374
-                                    $post_category_arr = explode( ',', $row[$c] );
4375
-                                } else if ( $column == 'default_category' ) {
4376
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
4377
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4378
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4379
-                                } else if ( $column == 'post_type' ) {
4380
-                                    $post_type = $row[$c];
4381
-                                } else if ( $column == 'post_status' ) {
4382
-                                    $post_status = sanitize_key( $row[$c] );
4383
-                                } else if ( $column == 'is_featured' ) {
4384
-                                    $is_featured = (int)$row[$c];
4385
-                                } else if ( $column == 'geodir_video' ) {
4386
-                                    $geodir_video = $row[$c];
4387
-                                } else if ( $column == 'post_address' ) {
4388
-                                    $post_address = sanitize_text_field($row[$c]);
4389
-                                } else if ( $column == 'post_city' ) {
4390
-                                    $post_city = sanitize_text_field($row[$c]);
4391
-                                } else if ( $column == 'post_region' ) {
4392
-                                    $post_region = sanitize_text_field($row[$c]);
4393
-                                } else if ( $column == 'post_country' ) {
4394
-                                    $post_country = sanitize_text_field($row[$c]);
4395
-                                } else if ( $column == 'post_zip' ) {
4396
-                                    $post_zip = sanitize_text_field($row[$c]);
4397
-                                } else if ( $column == 'post_latitude' ) {
4398
-                                    $post_latitude = sanitize_text_field($row[$c]);
4399
-                                } else if ( $column == 'post_longitude' ) {
4400
-                                    $post_longitude = sanitize_text_field($row[$c]);
4401
-                                } else if ( $column == 'post_neighbourhood' ) {
4402
-                                    $post_neighbourhood = sanitize_text_field($row[$c]);
4403
-                                    unset($gd_post[$column]);
4404
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4405
-                                    $neighbourhood_latitude = sanitize_text_field($row[$c]);
4406
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4407
-                                    $neighbourhood_longitude = sanitize_text_field($row[$c]);
4408
-                                } else if ( $column == 'geodir_timing' ) {
4409
-                                    $geodir_timing = sanitize_text_field($row[$c]);
4410
-                                } else if ( $column == 'geodir_contact' ) {
4411
-                                    $geodir_contact = sanitize_text_field($row[$c]);
4412
-                                } else if ( $column == 'geodir_email' ) {
4413
-                                    $geodir_email = sanitize_email($row[$c]);
4414
-                                } else if ( $column == 'geodir_website' ) {
4415
-                                    $geodir_website = sanitize_text_field($row[$c]);
4416
-                                } else if ( $column == 'geodir_twitter' ) {
4417
-                                    $geodir_twitter = sanitize_text_field($row[$c]);
4418
-                                } else if ( $column == 'geodir_facebook' ) {
4419
-                                    $geodir_facebook = sanitize_text_field($row[$c]);
4420
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4421
-                                    $post_images[] = $row[$c];
4422
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4423
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4424
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4425
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
4426
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4427
-                                }
4428
-                                // WPML
4429
-                                if ($is_wpml) {
4430
-                                    if ($column == 'language') {
4431
-                                        $language = geodir_strtolower(trim($row[$c]));
4432
-                                    } else if ($column == 'original_post_id') {
4433
-                                        $original_post_id = (int)$row[$c];
4434
-                                    }
4435
-                                }
4436
-                                // WPML
4437
-                                $c++;
4438
-                            }
4365
+								if ( $column == 'post_id' ) {
4366
+									$post_id = $row[$c];
4367
+								} else if ( $column == 'post_title' ) {
4368
+									$post_title = sanitize_text_field($row[$c]);
4369
+								} else if ( $column == 'post_author' ) {
4370
+									$post_author = $row[$c];
4371
+								} else if ( $column == 'post_content' ) {
4372
+									$post_content = $row[$c];
4373
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
4374
+									$post_category_arr = explode( ',', $row[$c] );
4375
+								} else if ( $column == 'default_category' ) {
4376
+									$default_category = wp_kses_normalize_entities($row[$c]);
4377
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
4378
+									$post_tags = explode( ',', sanitize_text_field($row[$c]) );
4379
+								} else if ( $column == 'post_type' ) {
4380
+									$post_type = $row[$c];
4381
+								} else if ( $column == 'post_status' ) {
4382
+									$post_status = sanitize_key( $row[$c] );
4383
+								} else if ( $column == 'is_featured' ) {
4384
+									$is_featured = (int)$row[$c];
4385
+								} else if ( $column == 'geodir_video' ) {
4386
+									$geodir_video = $row[$c];
4387
+								} else if ( $column == 'post_address' ) {
4388
+									$post_address = sanitize_text_field($row[$c]);
4389
+								} else if ( $column == 'post_city' ) {
4390
+									$post_city = sanitize_text_field($row[$c]);
4391
+								} else if ( $column == 'post_region' ) {
4392
+									$post_region = sanitize_text_field($row[$c]);
4393
+								} else if ( $column == 'post_country' ) {
4394
+									$post_country = sanitize_text_field($row[$c]);
4395
+								} else if ( $column == 'post_zip' ) {
4396
+									$post_zip = sanitize_text_field($row[$c]);
4397
+								} else if ( $column == 'post_latitude' ) {
4398
+									$post_latitude = sanitize_text_field($row[$c]);
4399
+								} else if ( $column == 'post_longitude' ) {
4400
+									$post_longitude = sanitize_text_field($row[$c]);
4401
+								} else if ( $column == 'post_neighbourhood' ) {
4402
+									$post_neighbourhood = sanitize_text_field($row[$c]);
4403
+									unset($gd_post[$column]);
4404
+								} else if ( $column == 'neighbourhood_latitude' ) {
4405
+									$neighbourhood_latitude = sanitize_text_field($row[$c]);
4406
+								} else if ( $column == 'neighbourhood_longitude' ) {
4407
+									$neighbourhood_longitude = sanitize_text_field($row[$c]);
4408
+								} else if ( $column == 'geodir_timing' ) {
4409
+									$geodir_timing = sanitize_text_field($row[$c]);
4410
+								} else if ( $column == 'geodir_contact' ) {
4411
+									$geodir_contact = sanitize_text_field($row[$c]);
4412
+								} else if ( $column == 'geodir_email' ) {
4413
+									$geodir_email = sanitize_email($row[$c]);
4414
+								} else if ( $column == 'geodir_website' ) {
4415
+									$geodir_website = sanitize_text_field($row[$c]);
4416
+								} else if ( $column == 'geodir_twitter' ) {
4417
+									$geodir_twitter = sanitize_text_field($row[$c]);
4418
+								} else if ( $column == 'geodir_facebook' ) {
4419
+									$geodir_facebook = sanitize_text_field($row[$c]);
4420
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4421
+									$post_images[] = $row[$c];
4422
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4423
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4424
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4425
+									$row[$c] = str_replace('/', '-', $row[$c]);
4426
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4427
+								}
4428
+								// WPML
4429
+								if ($is_wpml) {
4430
+									if ($column == 'language') {
4431
+										$language = geodir_strtolower(trim($row[$c]));
4432
+									} else if ($column == 'original_post_id') {
4433
+										$original_post_id = (int)$row[$c];
4434
+									}
4435
+								}
4436
+								// WPML
4437
+								$c++;
4438
+							}
4439 4439
                             
4440
-                            // WPML
4441
-                            if ($is_wpml && $language != '') {
4442
-                                $sitepress->switch_lang($language, true);
4443
-                            }
4444
-                            // WPML
4440
+							// WPML
4441
+							if ($is_wpml && $language != '') {
4442
+								$sitepress->switch_lang($language, true);
4443
+							}
4444
+							// WPML
4445 4445
 
4446
-                            $gd_post['IMAGE'] = $post_images;
4446
+							$gd_post['IMAGE'] = $post_images;
4447 4447
                             
4448
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4449
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4448
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4449
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4450 4450
                                                                                                                 
4451
-                            $valid = true;
4451
+							$valid = true;
4452 4452
                             
4453
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4454
-                                $invalid++;
4455
-                                $valid = false;
4456
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4457
-                            }
4453
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4454
+								$invalid++;
4455
+								$valid = false;
4456
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4457
+							}
4458 4458
                             
4459
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4460
-                            if ( $location_allowed ) {
4461
-                                $location_result = geodir_get_default_location();
4462
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4463
-                                    $invalid_addr++;
4464
-                                    $valid = false;
4465
-                                    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' ) );
4466
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4467
-                                    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 ) ) ) {
4468
-                                        $invalid_addr++;
4469
-                                        $valid = false;
4470
-                                        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' ) );
4471
-                                    } else {
4472
-                                        if (!$location_manager) {
4473
-                                            $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.
4474
-                                        }
4475
-                                    }
4476
-                                }
4477
-                            }
4459
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4460
+							if ( $location_allowed ) {
4461
+								$location_result = geodir_get_default_location();
4462
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4463
+									$invalid_addr++;
4464
+									$valid = false;
4465
+									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' ) );
4466
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4467
+									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 ) ) ) {
4468
+										$invalid_addr++;
4469
+										$valid = false;
4470
+										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' ) );
4471
+									} else {
4472
+										if (!$location_manager) {
4473
+											$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.
4474
+										}
4475
+									}
4476
+								}
4477
+							}
4478 4478
                             
4479
-                            if ( !$valid ) {
4480
-                                continue;
4481
-                            }
4479
+							if ( !$valid ) {
4480
+								continue;
4481
+							}
4482 4482
 
4483
-                            $cat_taxonomy = $post_type . 'category';
4484
-                            $tags_taxonomy = $post_type . '_tags';
4483
+							$cat_taxonomy = $post_type . 'category';
4484
+							$tags_taxonomy = $post_type . '_tags';
4485 4485
                             
4486
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4487
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
4488
-                            }
4486
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4487
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
4488
+							}
4489 4489
 
4490
-                            $post_category = array();
4491
-                            $default_category_id = NULL;
4492
-                            if ( !empty( $post_category_arr ) ) {
4493
-                                foreach ( $post_category_arr as $value ) {
4494
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4490
+							$post_category = array();
4491
+							$default_category_id = NULL;
4492
+							if ( !empty( $post_category_arr ) ) {
4493
+								foreach ( $post_category_arr as $value ) {
4494
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
4495 4495
                                     
4496
-                                    if ( $category_name != '' ) {
4497
-                                        $term_category = array();
4496
+									if ( $category_name != '' ) {
4497
+										$term_category = array();
4498 4498
                                         
4499
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4500
-                                            $term_category = $term;
4501
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4502
-                                            $term_category = $term;
4503
-                                        } else {
4504
-                                            $term_data = array();
4505
-                                            $term_data['name'] = $category_name;
4506
-                                            $term_data['taxonomy'] = $cat_taxonomy;
4499
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4500
+											$term_category = $term;
4501
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4502
+											$term_category = $term;
4503
+										} else {
4504
+											$term_data = array();
4505
+											$term_data['name'] = $category_name;
4506
+											$term_data['taxonomy'] = $cat_taxonomy;
4507 4507
                                             
4508
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4509
-                                            if ( $term_id ) {
4510
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4511
-                                            }
4512
-                                        }
4508
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4509
+											if ( $term_id ) {
4510
+												$term_category = get_term( $term_id, $cat_taxonomy );
4511
+											}
4512
+										}
4513 4513
                                         
4514
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4515
-                                            $post_category[] = intval($term_category->term_id);
4514
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4515
+											$post_category[] = intval($term_category->term_id);
4516 4516
                                             
4517
-                                            if ($category_name == $default_category) {
4518
-                                                $default_category_id = intval($term_category->term_id);
4519
-                                            }
4520
-                                        }
4521
-                                    }
4522
-                                }
4523
-                            }
4517
+											if ($category_name == $default_category) {
4518
+												$default_category_id = intval($term_category->term_id);
4519
+											}
4520
+										}
4521
+									}
4522
+								}
4523
+							}
4524 4524
 
4525
-                            $save_post = array();
4526
-                            $save_post['post_title'] = $post_title;
4527
-                            $save_post['post_content'] = $post_content;
4528
-                            $save_post['post_type'] = $post_type;
4529
-                            $save_post['post_author'] = $post_author;
4530
-                            $save_post['post_status'] = $post_status;
4531
-                            $save_post['post_category'] = $post_category;
4532
-                            $save_post['post_tags'] = $post_tags;
4533
-
4534
-                            $saved_post_id = NULL;
4535
-                            if ( $import_choice == 'update' ) {
4536
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4525
+							$save_post = array();
4526
+							$save_post['post_title'] = $post_title;
4527
+							$save_post['post_content'] = $post_content;
4528
+							$save_post['post_type'] = $post_type;
4529
+							$save_post['post_author'] = $post_author;
4530
+							$save_post['post_status'] = $post_status;
4531
+							$save_post['post_category'] = $post_category;
4532
+							$save_post['post_tags'] = $post_tags;
4533
+
4534
+							$saved_post_id = NULL;
4535
+							if ( $import_choice == 'update' ) {
4536
+								$gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4537 4537
                                 
4538
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4539
-                                    $save_post['ID'] = $post_id;
4538
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4539
+									$save_post['ID'] = $post_id;
4540 4540
                                     
4541
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4542
-                                        if ( is_wp_error( $saved_post_id ) ) {
4543
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4544
-                                            $saved_post_id = 0;
4545
-                                        } else {
4546
-                                            $saved_post_id = $post_id;
4547
-                                            $updated++;
4548
-                                        }
4549
-                                    }
4550
-                                } else {
4551
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4552
-                                        if ( is_wp_error( $saved_post_id ) ) {
4553
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4554
-                                            $saved_post_id = 0;
4555
-                                        } else {
4556
-                                            $created++;
4557
-                                        }
4558
-                                    }
4559
-                                }
4541
+									if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4542
+										if ( is_wp_error( $saved_post_id ) ) {
4543
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4544
+											$saved_post_id = 0;
4545
+										} else {
4546
+											$saved_post_id = $post_id;
4547
+											$updated++;
4548
+										}
4549
+									}
4550
+								} else {
4551
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4552
+										if ( is_wp_error( $saved_post_id ) ) {
4553
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4554
+											$saved_post_id = 0;
4555
+										} else {
4556
+											$created++;
4557
+										}
4558
+									}
4559
+								}
4560 4560
                                 
4561
-                                if ( !$saved_post_id > 0 ) {
4562
-                                    $invalid++;
4563
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4564
-                                }
4565
-                            } else if ( $import_choice == 'skip' ) {
4566
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4567
-                                    $skipped++;	
4568
-                                } else {
4569
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4570
-                                        if ( is_wp_error( $saved_post_id ) ) {
4571
-                                            $invalid++;
4561
+								if ( !$saved_post_id > 0 ) {
4562
+									$invalid++;
4563
+									geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4564
+								}
4565
+							} else if ( $import_choice == 'skip' ) {
4566
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4567
+									$skipped++;	
4568
+								} else {
4569
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4570
+										if ( is_wp_error( $saved_post_id ) ) {
4571
+											$invalid++;
4572 4572
                                             
4573
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4574
-                                            $saved_post_id = 0;
4575
-                                        } else {
4576
-                                            $created++;
4577
-                                        }
4578
-                                    } else {
4579
-                                        $invalid++;
4573
+											geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4574
+											$saved_post_id = 0;
4575
+										} else {
4576
+											$created++;
4577
+										}
4578
+									} else {
4579
+										$invalid++;
4580 4580
                                         
4581
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4582
-                                    }
4583
-                                }
4584
-                            } else {
4585
-                                $invalid++;
4581
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4582
+									}
4583
+								}
4584
+							} else {
4585
+								$invalid++;
4586 4586
                                 
4587
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4588
-                            }
4587
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4588
+							}
4589 4589
 
4590
-                            if ( (int)$saved_post_id > 0 ) {
4591
-                                // WPML
4592
-                                if ($is_wpml && $original_post_id > 0 && $language != '') {
4593
-                                    $wpml_post_type = 'post_' . $post_type;
4594
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4595
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4590
+							if ( (int)$saved_post_id > 0 ) {
4591
+								// WPML
4592
+								if ($is_wpml && $original_post_id > 0 && $language != '') {
4593
+									$wpml_post_type = 'post_' . $post_type;
4594
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4595
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4596 4596
 
4597
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4597
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4598 4598
                                     
4599
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4600
-                                }
4601
-                                // WPML
4602
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4599
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4600
+								}
4601
+								// WPML
4602
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
4603 4603
                                 
4604
-                                $gd_post['post_id'] = $saved_post_id;
4605
-                                $gd_post['ID'] = $saved_post_id;
4606
-                                $gd_post['post_tags'] = $post_tags;
4607
-                                $gd_post['post_title'] = $post_title;
4608
-                                $gd_post['post_status'] = $post_status;
4609
-                                $gd_post['submit_time'] = time();
4610
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4604
+								$gd_post['post_id'] = $saved_post_id;
4605
+								$gd_post['ID'] = $saved_post_id;
4606
+								$gd_post['post_tags'] = $post_tags;
4607
+								$gd_post['post_title'] = $post_title;
4608
+								$gd_post['post_status'] = $post_status;
4609
+								$gd_post['submit_time'] = time();
4610
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4611 4611
                                                     
4612
-                                // post location
4613
-                                $post_location_id = 0;
4614
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4615
-                                    $gd_post['post_neighbourhood'] = '';
4612
+								// post location
4613
+								$post_location_id = 0;
4614
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4615
+									$gd_post['post_neighbourhood'] = '';
4616 4616
                                     
4617
-                                    $post_location_info = array(
4618
-                                                                'city' => $post_city,
4619
-                                                                'region' => $post_region,
4620
-                                                                'country' => $post_country,
4621
-                                                                'geo_lat' => $post_latitude,
4622
-                                                                'geo_lng' => $post_longitude
4623
-                                                            );
4624
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4625
-                                        $post_location_id = $location_id;
4626
-                                    }
4617
+									$post_location_info = array(
4618
+																'city' => $post_city,
4619
+																'region' => $post_region,
4620
+																'country' => $post_country,
4621
+																'geo_lat' => $post_latitude,
4622
+																'geo_lng' => $post_longitude
4623
+															);
4624
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4625
+										$post_location_id = $location_id;
4626
+									}
4627 4627
                                     
4628
-                                    if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4629
-                                        $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4628
+									if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4629
+										$neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4630 4630
 
4631
-                                        $hood_data = array();
4632
-                                        $hood_data['hood_location_id'] = $post_location_id;
4633
-                                        $hood_data['hood_name'] = $post_neighbourhood;
4631
+										$hood_data = array();
4632
+										$hood_data['hood_location_id'] = $post_location_id;
4633
+										$hood_data['hood_name'] = $post_neighbourhood;
4634 4634
                                         
4635
-                                        if (!empty($neighbourhood_info)) {
4636
-                                            $hood_data['hood_id'] = $neighbourhood_info->hood_id;
4637
-                                            $hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4635
+										if (!empty($neighbourhood_info)) {
4636
+											$hood_data['hood_id'] = $neighbourhood_info->hood_id;
4637
+											$hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4638 4638
                                             
4639
-                                            if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4640
-                                                $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4641
-                                                $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4642
-                                            }
4643
-                                        }
4639
+											if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4640
+												$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4641
+												$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4642
+											}
4643
+										}
4644 4644
                                         
4645
-                                        if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4646
-                                            $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4647
-                                            $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4648
-                                        }
4645
+										if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4646
+											$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4647
+											$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4648
+										}
4649 4649
                                         
4650
-                                        $hood_data['hood_latitude'] = $post_latitude;
4651
-                                        $hood_data['hood_longitude'] = $post_longitude;
4650
+										$hood_data['hood_latitude'] = $post_latitude;
4651
+										$hood_data['hood_longitude'] = $post_longitude;
4652 4652
 
4653
-                                        $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4654
-                                        if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4655
-                                            $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4656
-                                        }
4657
-                                    }
4658
-                                }
4659
-                                $gd_post['post_location_id'] = $post_location_id;
4653
+										$neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4654
+										if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4655
+											$gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4656
+										}
4657
+									}
4658
+								}
4659
+								$gd_post['post_location_id'] = $post_location_id;
4660 4660
                                 
4661
-                                // post package info
4662
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4663
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4664
-                                    $package_id = $gd_post_info->package_id;
4665
-                                }
4661
+								// post package info
4662
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4663
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4664
+									$package_id = $gd_post_info->package_id;
4665
+								}
4666 4666
                                 
4667
-                                $package_info = array();
4668
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4669
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4667
+								$package_info = array();
4668
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4669
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
4670 4670
                                     
4671
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4672
-                                        $package_info = array();
4673
-                                    }
4674
-                                }
4671
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4672
+										$package_info = array();
4673
+									}
4674
+								}
4675 4675
                                 
4676
-                                if (empty($package_info)) {
4677
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4678
-                                }
4676
+								if (empty($package_info)) {
4677
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
4678
+								}
4679 4679
                                  
4680
-                                if (!empty($package_info))	 {
4681
-                                    $package_id = $package_info['pid'];
4680
+								if (!empty($package_info))	 {
4681
+									$package_id = $package_info['pid'];
4682 4682
                                     
4683
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4684
-                                        $gd_post['expire_date'] = $expire_date;
4685
-                                    } else {
4686
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4687
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4688
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4689
-                                        } else {
4690
-                                            $gd_post['expire_date'] = 'Never';
4691
-                                        }
4692
-                                    }
4683
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4684
+										$gd_post['expire_date'] = $expire_date;
4685
+									} else {
4686
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4687
+											$gd_post['alive_days'] = (int)$package_info['days'];
4688
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4689
+										} else {
4690
+											$gd_post['expire_date'] = 'Never';
4691
+										}
4692
+									}
4693 4693
                                     
4694
-                                    $gd_post['package_id'] = $package_id;
4695
-                                }
4694
+									$gd_post['package_id'] = $package_id;
4695
+								}
4696 4696
 
4697
-                                $table = $plugin_prefix . $post_type . '_detail';
4697
+								$table = $plugin_prefix . $post_type . '_detail';
4698 4698
                                 
4699
-                                if ($post_type == 'gd_event') {
4700
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
4701
-                                }
4699
+								if ($post_type == 'gd_event') {
4700
+									$gd_post = geodir_imex_process_event_data($gd_post);
4701
+								}
4702 4702
                                 
4703
-                                if (isset($gd_post['post_id'])) {
4704
-                                    unset($gd_post['post_id']);
4705
-                                }
4703
+								if (isset($gd_post['post_id'])) {
4704
+									unset($gd_post['post_id']);
4705
+								}
4706 4706
 
4707
-                                // Export franchise fields
4708
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4709
-                                if ($is_franchise_active) {
4710
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4711
-                                        $gd_franchise_lock = array();
4707
+								// Export franchise fields
4708
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4709
+								if ($is_franchise_active) {
4710
+									if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4711
+										$gd_franchise_lock = array();
4712 4712
                                         
4713
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4714
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4715
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4716
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4717
-                                        }
4713
+										if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4714
+											$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4715
+											$gd_franchise_lock = trim( $gd_franchise_lock );
4716
+											$gd_franchise_lock = explode( ",", $gd_franchise_lock );
4717
+										}
4718 4718
                                         
4719
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4720
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4721
-                                    } else {
4722
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4723
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4724
-                                        }
4725
-                                    }
4726
-                                }
4719
+										update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4720
+										update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4721
+									} else {
4722
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4723
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4724
+										}
4725
+									}
4726
+								}
4727 4727
                                 
4728
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4729
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4730
-                                    if ($default_category_id) {
4731
-                                        $save_post['post_default_category'] = $default_category_id;
4732
-                                        $gd_post['default_category'] = $default_category_id;
4733
-                                    }
4734
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
4735
-                                }
4728
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4729
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4730
+									if ($default_category_id) {
4731
+										$save_post['post_default_category'] = $default_category_id;
4732
+										$gd_post['default_category'] = $default_category_id;
4733
+									}
4734
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
4735
+								}
4736 4736
                                 
4737
-                                // Save post info
4738
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4739
-                                // post taxonomies
4740
-                                if ( !empty( $save_post['post_category'] ) ) {
4741
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4737
+								// Save post info
4738
+								geodir_save_post_info( $saved_post_id, $gd_post );
4739
+								// post taxonomies
4740
+								if ( !empty( $save_post['post_category'] ) ) {
4741
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4742 4742
                                     
4743
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4744
-                                    if ($default_category_id) {
4745
-                                        $post_default_category = $default_category_id;
4746
-                                    }
4747
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4748
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4749
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4743
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4744
+									if ($default_category_id) {
4745
+										$post_default_category = $default_category_id;
4746
+									}
4747
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4748
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4749
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4750 4750
                                     
4751
-                                    if ($post_category_str != '' && $post_default_category) {
4752
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4753
-                                    }
4751
+									if ($post_category_str != '' && $post_default_category) {
4752
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4753
+									}
4754 4754
                                     
4755
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4755
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4756 4756
                                     
4757
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4758
-                                }
4757
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4758
+								}
4759 4759
 
4760
-                                if ( !empty( $save_post['post_tags'] ) ) {
4761
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4762
-                                }
4760
+								if ( !empty( $save_post['post_tags'] ) ) {
4761
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4762
+								}
4763 4763
 
4764
-                                // Post images
4765
-                                if ( !empty( $post_images ) ) {
4766
-                                    $post_images = array_unique($post_images);
4764
+								// Post images
4765
+								if ( !empty( $post_images ) ) {
4766
+									$post_images = array_unique($post_images);
4767 4767
                                     
4768
-                                    $old_post_images_arr = array();
4769
-                                    $saved_post_images_arr = array();
4768
+									$old_post_images_arr = array();
4769
+									$saved_post_images_arr = array();
4770 4770
                                     
4771
-                                    $order = 1;
4771
+									$order = 1;
4772 4772
                                     
4773
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4774
-                                    if (!empty($old_post_images)) {
4775
-                                        foreach( $old_post_images as $old_post_image ) {
4776
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4777
-                                                $old_post_images_arr[] = $old_post_image->file;
4778
-                                            }
4779
-                                        }
4780
-                                    }
4773
+									$old_post_images = geodir_get_images( $saved_post_id );
4774
+									if (!empty($old_post_images)) {
4775
+										foreach( $old_post_images as $old_post_image ) {
4776
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4777
+												$old_post_images_arr[] = $old_post_image->file;
4778
+											}
4779
+										}
4780
+									}
4781 4781
 
4782
-                                    foreach ( $post_images as $post_image ) {
4783
-                                        $image_name = basename( $post_image );
4784
-                                        $saved_post_images_arr[] = $image_name;
4782
+									foreach ( $post_images as $post_image ) {
4783
+										$image_name = basename( $post_image );
4784
+										$saved_post_images_arr[] = $image_name;
4785 4785
                                         
4786
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4787
-                                            continue; // Skip if image already exists.
4788
-                                        }
4786
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4787
+											continue; // Skip if image already exists.
4788
+										}
4789 4789
                                         
4790
-                                        $image_name_parts = explode( '.', $image_name );
4791
-                                        array_pop( $image_name_parts );
4792
-                                        $proper_image_name = implode( '.', $image_name_parts );
4790
+										$image_name_parts = explode( '.', $image_name );
4791
+										array_pop( $image_name_parts );
4792
+										$proper_image_name = implode( '.', $image_name_parts );
4793 4793
                                         
4794
-                                        $arr_file_type = wp_check_filetype( $image_name );
4794
+										$arr_file_type = wp_check_filetype( $image_name );
4795 4795
                                         
4796
-                                        if ( !empty( $arr_file_type ) ) {
4797
-                                            $uploaded_file_type = $arr_file_type['type'];
4796
+										if ( !empty( $arr_file_type ) ) {
4797
+											$uploaded_file_type = $arr_file_type['type'];
4798 4798
                                             
4799
-                                            $attachment = array();
4800
-                                            $attachment['post_id'] = $saved_post_id;
4801
-                                            $attachment['title'] = $proper_image_name;
4802
-                                            $attachment['content'] = '';
4803
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4804
-                                            $attachment['mime_type'] = $uploaded_file_type;
4805
-                                            $attachment['menu_order'] = $order;
4806
-                                            $attachment['is_featured'] = 0;
4807
-
4808
-                                            $attachment_set = '';
4809
-                                            foreach ( $attachment as $key => $val ) {
4810
-                                                if ( $val != '' ) {
4811
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4812
-                                                }
4813
-                                            }
4814
-                                            $attachment_set = trim( $attachment_set, ", " );
4799
+											$attachment = array();
4800
+											$attachment['post_id'] = $saved_post_id;
4801
+											$attachment['title'] = $proper_image_name;
4802
+											$attachment['content'] = '';
4803
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
4804
+											$attachment['mime_type'] = $uploaded_file_type;
4805
+											$attachment['menu_order'] = $order;
4806
+											$attachment['is_featured'] = 0;
4807
+
4808
+											$attachment_set = '';
4809
+											foreach ( $attachment as $key => $val ) {
4810
+												if ( $val != '' ) {
4811
+													$attachment_set .= $key . " = '" . $val . "', ";
4812
+												}
4813
+											}
4814
+											$attachment_set = trim( $attachment_set, ", " );
4815 4815
                                                                                         
4816
-                                            // Add new attachment
4817
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4816
+											// Add new attachment
4817
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4818 4818
                                                                                         
4819
-                                            $order++;
4820
-                                        }
4821
-                                    }
4819
+											$order++;
4820
+										}
4821
+									}
4822 4822
 
4823
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4824
-                                    // Remove previous attachment
4825
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4823
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4824
+									// Remove previous attachment
4825
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4826 4826
                                     
4827
-                                    if ( !empty( $saved_post_images_arr ) ) {
4828
-                                        geodir_set_wp_featured_image($saved_post_id);
4829
-                                        /*
4827
+									if ( !empty( $saved_post_images_arr ) ) {
4828
+										geodir_set_wp_featured_image($saved_post_id);
4829
+										/*
4830 4830
                                         $menu_order = 1;
4831 4831
                                         
4832 4832
                                         foreach ( $saved_post_images_arr as $img_name ) {
@@ -4839,281 +4839,281 @@  discard block
 block discarded – undo
4839 4839
                                             }
4840 4840
                                             $menu_order++;
4841 4841
                                         }*/
4842
-                                    }
4842
+									}
4843 4843
                                     
4844
-                                    if ( $order > 1 ) {
4845
-                                        $images++;
4846
-                                    }
4847
-                                }
4844
+									if ( $order > 1 ) {
4845
+										$images++;
4846
+									}
4847
+								}
4848 4848
 
4849
-                                /** This action is documented in geodirectory-functions/post-functions.php */
4850
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4849
+								/** This action is documented in geodirectory-functions/post-functions.php */
4850
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4851 4851
                                 
4852
-                                if (isset($is_featured)) {
4853
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4854
-                                }
4855
-                                if (isset($gd_post['expire_date'])) {
4856
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4857
-                                }
4858
-                            }
4852
+								if (isset($is_featured)) {
4853
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4854
+								}
4855
+								if (isset($gd_post['expire_date'])) {
4856
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4857
+								}
4858
+							}
4859 4859
                             
4860
-                            // WPML
4861
-                            if ($is_wpml && $language != '') {
4862
-                                $sitepress->switch_lang($active_lang, true);
4863
-                            }
4864
-                            // WPML
4865
-                        }
4866
-                    }
4867
-                }
4860
+							// WPML
4861
+							if ($is_wpml && $language != '') {
4862
+								$sitepress->switch_lang($active_lang, true);
4863
+							}
4864
+							// WPML
4865
+						}
4866
+					}
4867
+				}
4868 4868
 
4869
-                //undo some stuff to make the import quicker
4870
-                wp_defer_term_counting( false );
4871
-                wp_defer_comment_counting( false );
4872
-                $wpdb->query( 'COMMIT;' );
4873
-                $wpdb->query( 'SET autocommit = 1;' );
4874
-
4875
-                $json = array();
4876
-                $json['processed'] = $processed_actual;
4877
-                $json['created'] = $created;
4878
-                $json['updated'] = $updated;
4879
-                $json['skipped'] = $skipped;
4880
-                $json['invalid'] = $invalid;
4881
-                $json['invalid_addr'] = $invalid_addr;
4882
-                $json['images'] = $images;
4869
+				//undo some stuff to make the import quicker
4870
+				wp_defer_term_counting( false );
4871
+				wp_defer_comment_counting( false );
4872
+				$wpdb->query( 'COMMIT;' );
4873
+				$wpdb->query( 'SET autocommit = 1;' );
4874
+
4875
+				$json = array();
4876
+				$json['processed'] = $processed_actual;
4877
+				$json['created'] = $created;
4878
+				$json['updated'] = $updated;
4879
+				$json['skipped'] = $skipped;
4880
+				$json['invalid'] = $invalid;
4881
+				$json['invalid_addr'] = $invalid_addr;
4882
+				$json['images'] = $images;
4883 4883
                 
4884
-                wp_send_json( $json );
4885
-                exit;
4886
-            } else if ( $task == 'import_loc' ) {
4887
-                global $gd_post_types;
4888
-                $gd_post_types = $post_types;
4884
+				wp_send_json( $json );
4885
+				exit;
4886
+			} else if ( $task == 'import_loc' ) {
4887
+				global $gd_post_types;
4888
+				$gd_post_types = $post_types;
4889 4889
                 
4890
-                if (!empty($file)) {
4891
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4890
+				if (!empty($file)) {
4891
+					$columns = isset($file[0]) ? $file[0] : NULL;
4892 4892
                     
4893
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4894
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4895
-                        wp_send_json( $json );
4896
-                    }
4893
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4894
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4895
+						wp_send_json( $json );
4896
+					}
4897 4897
                     
4898
-                    $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4899
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4900
-                    for ($i = 1; $i <= $limit; $i++) {
4901
-                        $index = $processed + $i;
4898
+					$gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4899
+					$gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4900
+					for ($i = 1; $i <= $limit; $i++) {
4901
+						$index = $processed + $i;
4902 4902
                         
4903
-                        if (isset($file[$index])) {
4904
-                            $row = $file[$index];
4905
-                            $row = array_map( 'trim', $row );
4906
-                            $data = array();
4903
+						if (isset($file[$index])) {
4904
+							$row = $file[$index];
4905
+							$row = array_map( 'trim', $row );
4906
+							$data = array();
4907 4907
                             
4908
-                            foreach ($columns as $c => $column ) {
4909
-                                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'))) {
4910
-                                    $data[$column] = $row[$c];
4911
-                                }
4912
-                            }
4908
+							foreach ($columns as $c => $column ) {
4909
+								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'))) {
4910
+									$data[$column] = $row[$c];
4911
+								}
4912
+							}
4913 4913
 
4914
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4915
-                                $invalid++;
4916
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4917
-                                continue;
4918
-                            }
4914
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4915
+								$invalid++;
4916
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4917
+								continue;
4918
+							}
4919 4919
                             
4920
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4920
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4921 4921
                             
4922
-                            if ( $import_choice == 'update' ) {
4923
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4924
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4925
-                                        $updated++;
4926
-                                    } else {
4927
-                                        $invalid++;
4928
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4929
-                                    }
4930
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4931
-                                    $data['location_id'] = (int)$location->location_id;
4922
+							if ( $import_choice == 'update' ) {
4923
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4924
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4925
+										$updated++;
4926
+									} else {
4927
+										$invalid++;
4928
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4929
+									}
4930
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4931
+									$data['location_id'] = (int)$location->location_id;
4932 4932
                                     
4933
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4934
-                                        $data['location_id'] = (int)$location->location_id;
4935
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4936
-                                        $data['location_id'] = (int)$location->location_id;
4937
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4938
-                                        $data['location_id'] = (int)$location->location_id;
4939
-                                    }
4933
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4934
+										$data['location_id'] = (int)$location->location_id;
4935
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4936
+										$data['location_id'] = (int)$location->location_id;
4937
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4938
+										$data['location_id'] = (int)$location->location_id;
4939
+									}
4940 4940
                                     
4941
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4942
-                                        $updated++;
4943
-                                    } else {
4944
-                                        $invalid++;
4945
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4946
-                                    }
4947
-                                } else {
4948
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4949
-                                        $created++;
4950
-                                    } else {
4951
-                                        $invalid++;
4952
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4953
-                                    }
4954
-                                }
4955
-                            } elseif ( $import_choice == 'skip' ) {
4956
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4957
-                                    $skipped++;
4958
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4959
-                                    $skipped++;
4960
-                                } else {
4961
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4962
-                                        $created++;
4963
-                                    } else {
4964
-                                        $invalid++;
4965
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4966
-                                    }
4967
-                                }
4968
-                            } else {
4969
-                                $invalid++;
4970
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4971
-                            }
4972
-                        }
4973
-                    }
4974
-                }
4941
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4942
+										$updated++;
4943
+									} else {
4944
+										$invalid++;
4945
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4946
+									}
4947
+								} else {
4948
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4949
+										$created++;
4950
+									} else {
4951
+										$invalid++;
4952
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4953
+									}
4954
+								}
4955
+							} elseif ( $import_choice == 'skip' ) {
4956
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4957
+									$skipped++;
4958
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4959
+									$skipped++;
4960
+								} else {
4961
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4962
+										$created++;
4963
+									} else {
4964
+										$invalid++;
4965
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4966
+									}
4967
+								}
4968
+							} else {
4969
+								$invalid++;
4970
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4971
+							}
4972
+						}
4973
+					}
4974
+				}
4975 4975
                 
4976
-                $json = array();
4977
-                $json['processed'] = $limit;
4978
-                $json['created'] = $created;
4979
-                $json['updated'] = $updated;
4980
-                $json['skipped'] = $skipped;
4981
-                $json['invalid'] = $invalid;
4982
-                $json['images'] = $images;
4976
+				$json = array();
4977
+				$json['processed'] = $limit;
4978
+				$json['created'] = $created;
4979
+				$json['updated'] = $updated;
4980
+				$json['skipped'] = $skipped;
4981
+				$json['invalid'] = $invalid;
4982
+				$json['images'] = $images;
4983 4983
                 
4984
-                wp_send_json( $json );
4985
-            } else if ( $task == 'import_hood' ) {               
4986
-                if (!empty($file)) {
4987
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4984
+				wp_send_json( $json );
4985
+			} else if ( $task == 'import_hood' ) {               
4986
+				if (!empty($file)) {
4987
+					$columns = isset($file[0]) ? $file[0] : NULL;
4988 4988
                     
4989
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4990
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4991
-                        wp_send_json( $json );
4992
-                    }
4989
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4990
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4991
+						wp_send_json( $json );
4992
+					}
4993 4993
                     
4994
-                    $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4995
-                    $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' );
4996
-                    for ($i = 1; $i <= $limit; $i++) {
4997
-                        $index = $processed + $i;
4994
+					$gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4995
+					$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' );
4996
+					for ($i = 1; $i <= $limit; $i++) {
4997
+						$index = $processed + $i;
4998 4998
                         
4999
-                        if (isset($file[$index])) {
5000
-                            $row = $file[$index];
5001
-                            $row = array_map( 'trim', $row );
5002
-                            $data = array();
4999
+						if (isset($file[$index])) {
5000
+							$row = $file[$index];
5001
+							$row = array_map( 'trim', $row );
5002
+							$data = array();
5003 5003
                             
5004
-                            foreach ($columns as $c => $column) {
5005
-                                if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
5006
-                                    $data[$column] = sanitize_text_field($row[$c]);
5007
-                                }
5008
-                            }
5004
+							foreach ($columns as $c => $column) {
5005
+								if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
5006
+									$data[$column] = sanitize_text_field($row[$c]);
5007
+								}
5008
+							}
5009 5009
 
5010
-                            if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
5011
-                                $invalid++;
5012
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5013
-                                continue;
5014
-                            }
5010
+							if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
5011
+								$invalid++;
5012
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5013
+								continue;
5014
+							}
5015 5015
                             
5016
-                            $location_info = array();
5017
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
5018
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
5019
-                            } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
5020
-                                $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
5021
-                            }
5016
+							$location_info = array();
5017
+							if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
5018
+								$location_info = geodir_get_location_by_id('', (int)$data['location_id']);
5019
+							} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
5020
+								$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
5021
+							}
5022 5022
 
5023
-                            if (empty($location_info)) {
5024
-                                $invalid++;
5025
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5026
-                                continue;
5027
-                            }
5023
+							if (empty($location_info)) {
5024
+								$invalid++;
5025
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5026
+								continue;
5027
+							}
5028 5028
                             
5029
-                            $location_id = $location_info->location_id;
5029
+							$location_id = $location_info->location_id;
5030 5030
 
5031
-                            $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
5031
+							$data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
5032 5032
                             
5033
-                            $hood_data = array();
5034
-                            $hood_data['hood_name'] = $data['neighbourhood_name'];
5035
-                            $hood_data['hood_slug'] = $data['neighbourhood_slug'];
5036
-                            $hood_data['hood_latitude'] = $data['latitude'];
5037
-                            $hood_data['hood_longitude'] = $data['longitude'];
5038
-                            $hood_data['hood_location_id'] = $location_id;
5033
+							$hood_data = array();
5034
+							$hood_data['hood_name'] = $data['neighbourhood_name'];
5035
+							$hood_data['hood_slug'] = $data['neighbourhood_slug'];
5036
+							$hood_data['hood_latitude'] = $data['latitude'];
5037
+							$hood_data['hood_longitude'] = $data['longitude'];
5038
+							$hood_data['hood_location_id'] = $location_id;
5039 5039
                                     
5040
-                            if ( $import_choice == 'update' ) {
5041
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5042
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
5040
+							if ( $import_choice == 'update' ) {
5041
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5042
+									$hood_data['hood_id'] = (int)$data['neighbourhood_id'];
5043 5043
                                     
5044
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5045
-                                        $updated++;
5046
-                                    } else {
5047
-                                        $invalid++;
5048
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5049
-                                    }
5050
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5051
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
5044
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5045
+										$updated++;
5046
+									} else {
5047
+										$invalid++;
5048
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5049
+									}
5050
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5051
+									$hood_data['hood_id'] = (int)$neighbourhood->hood_id;
5052 5052
                                     
5053
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5054
-                                        $updated++;
5055
-                                    } else {
5056
-                                        $invalid++;
5057
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5058
-                                    }
5059
-                                } else {
5060
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5061
-                                        $created++;
5062
-                                    } else {
5063
-                                        $invalid++;
5064
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5065
-                                    }
5066
-                                }
5067
-                            } elseif ( $import_choice == 'skip' ) {
5068
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5069
-                                    $skipped++;
5070
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5071
-                                    $skipped++;
5072
-                                } else {
5053
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5054
+										$updated++;
5055
+									} else {
5056
+										$invalid++;
5057
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5058
+									}
5059
+								} else {
5060
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5061
+										$created++;
5062
+									} else {
5063
+										$invalid++;
5064
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5065
+									}
5066
+								}
5067
+							} elseif ( $import_choice == 'skip' ) {
5068
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5069
+									$skipped++;
5070
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5071
+									$skipped++;
5072
+								} else {
5073 5073
                                     
5074
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5075
-                                        $created++;
5076
-                                    } else {
5077
-                                        $invalid++;
5078
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5079
-                                    }
5080
-                                }
5081
-                            } else {
5082
-                                $invalid++;
5083
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5084
-                            }
5085
-                        }
5086
-                    }
5087
-                }
5074
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5075
+										$created++;
5076
+									} else {
5077
+										$invalid++;
5078
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5079
+									}
5080
+								}
5081
+							} else {
5082
+								$invalid++;
5083
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5084
+							}
5085
+						}
5086
+					}
5087
+				}
5088 5088
                 
5089
-                $json = array();
5090
-                $json['processed'] = $limit;
5091
-                $json['created'] = $created;
5092
-                $json['updated'] = $updated;
5093
-                $json['skipped'] = $skipped;
5094
-                $json['invalid'] = $invalid;
5095
-                $json['images'] = $images;
5089
+				$json = array();
5090
+				$json['processed'] = $limit;
5091
+				$json['created'] = $created;
5092
+				$json['updated'] = $updated;
5093
+				$json['skipped'] = $skipped;
5094
+				$json['invalid'] = $invalid;
5095
+				$json['images'] = $images;
5096 5096
                 
5097
-                wp_send_json( $json );
5098
-            }
5099
-        }
5100
-        break;
5101
-        case 'import_finish':{
5102
-            /**
5103
-             * Run an action when an import finishes.
5104
-             *
5105
-             * This action can be used to fire functions after an import ends.
5106
-             *
5107
-             * @since 1.5.3
5108
-             * @package GeoDirectory
5109
-             */
5110
-            do_action('geodir_import_finished');
5111
-        }
5112
-        break;
5097
+				wp_send_json( $json );
5098
+			}
5099
+		}
5100
+		break;
5101
+		case 'import_finish':{
5102
+			/**
5103
+			 * Run an action when an import finishes.
5104
+			 *
5105
+			 * This action can be used to fire functions after an import ends.
5106
+			 *
5107
+			 * @since 1.5.3
5108
+			 * @package GeoDirectory
5109
+			 */
5110
+			do_action('geodir_import_finished');
5111
+		}
5112
+		break;
5113 5113
 
5114
-    }
5115
-    echo '0';
5116
-    gd_die();
5114
+	}
5115
+	echo '0';
5116
+	gd_die();
5117 5117
 }
5118 5118
 
5119 5119
 /**
@@ -5157,12 +5157,12 @@  discard block
 block discarded – undo
5157 5157
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5158 5158
 	}
5159 5159
 	
5160
-    if( !empty( $term ) ) {
5160
+	if( !empty( $term ) ) {
5161 5161
 		$result = wp_insert_term( $term, $taxonomy, $args );
5162
-        if( !is_wp_error( $result ) ) {
5163
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5164
-        }
5165
-    }
5162
+		if( !is_wp_error( $result ) ) {
5163
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5164
+		}
5165
+	}
5166 5166
 	
5167 5167
 	return false;
5168 5168
 }
@@ -5208,16 +5208,16 @@  discard block
 block discarded – undo
5208 5208
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5209 5209
 		
5210 5210
 		if( !is_wp_error( $result ) ) {
5211
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5212
-        }
5211
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5212
+		}
5213 5213
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5214 5214
 		$term_data['term_id'] = $term_info['term_id'];
5215 5215
 		
5216 5216
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5217 5217
 		
5218 5218
 		if( !is_wp_error( $result ) ) {
5219
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5220
-        }
5219
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5220
+		}
5221 5221
 	} else {
5222 5222
 		return geodir_imex_insert_term( $taxonomy, $term_data );
5223 5223
 	}
@@ -5238,37 +5238,37 @@  discard block
 block discarded – undo
5238 5238
  * @return int Posts count.
5239 5239
  */
5240 5240
 function geodir_get_posts_count( $post_type ) {
5241
-    global $wpdb, $plugin_prefix;
5241
+	global $wpdb, $plugin_prefix;
5242 5242
 
5243
-    if ( !post_type_exists( $post_type ) ) {
5244
-        return 0;
5245
-    }
5243
+	if ( !post_type_exists( $post_type ) ) {
5244
+		return 0;
5245
+	}
5246 5246
         
5247
-    $table = $plugin_prefix . $post_type . '_detail';
5247
+	$table = $plugin_prefix . $post_type . '_detail';
5248 5248
 
5249
-    // Skip listing with statuses trash, auto-draft etc...
5250
-    $skip_statuses = geodir_imex_export_skip_statuses();
5251
-    $where_statuses = '';
5252
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5253
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5254
-    }
5249
+	// Skip listing with statuses trash, auto-draft etc...
5250
+	$skip_statuses = geodir_imex_export_skip_statuses();
5251
+	$where_statuses = '';
5252
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5253
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5254
+	}
5255 5255
 
5256
-    $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 );
5256
+	$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 );
5257 5257
 
5258
-    $posts_count = (int)$wpdb->get_var( $query );
5258
+	$posts_count = (int)$wpdb->get_var( $query );
5259 5259
     
5260
-    /**
5261
-     * Modify returned post counts for the current post type.
5262
-     *
5263
-     * @since 1.4.6
5264
-     * @package GeoDirectory
5265
-     *
5266
-     * @param int $posts_count Post counts.
5267
-     * @param string $post_type Post type.
5268
-     */
5269
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5270
-
5271
-    return $posts_count;
5260
+	/**
5261
+	 * Modify returned post counts for the current post type.
5262
+	 *
5263
+	 * @since 1.4.6
5264
+	 * @package GeoDirectory
5265
+	 *
5266
+	 * @param int $posts_count Post counts.
5267
+	 * @param string $post_type Post type.
5268
+	 */
5269
+	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5270
+
5271
+	return $posts_count;
5272 5272
 }
5273 5273
 
5274 5274
 /**
@@ -5296,9 +5296,9 @@  discard block
 block discarded – undo
5296 5296
 	
5297 5297
 	if ( !empty( $posts ) ) {
5298 5298
 		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5299
-        $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5300
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5301
-        $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5299
+		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5300
+		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5301
+		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5302 5302
 		
5303 5303
 		$csv_row = array();
5304 5304
 		$csv_row[] = 'post_id';
@@ -5342,11 +5342,11 @@  discard block
 block discarded – undo
5342 5342
 		$csv_row[] = 'post_zip';
5343 5343
 		$csv_row[] = 'post_latitude';
5344 5344
 		$csv_row[] = 'post_longitude';
5345
-        if ($neighbourhood_active) {
5346
-            $csv_row[] = 'post_neighbourhood';
5347
-            $csv_row[] = 'neighbourhood_latitude';
5348
-            $csv_row[] = 'neighbourhood_longitude';
5349
-        }
5345
+		if ($neighbourhood_active) {
5346
+			$csv_row[] = 'post_neighbourhood';
5347
+			$csv_row[] = 'neighbourhood_latitude';
5348
+			$csv_row[] = 'neighbourhood_longitude';
5349
+		}
5350 5350
 		$csv_row[] = 'geodir_timing';
5351 5351
 		$csv_row[] = 'geodir_contact';
5352 5352
 		$csv_row[] = 'geodir_email';
@@ -5381,7 +5381,7 @@  discard block
 block discarded – undo
5381 5381
 		$csv_rows[] = $csv_row;
5382 5382
 
5383 5383
 		$images_count = 5;
5384
-        $xx=0;
5384
+		$xx=0;
5385 5385
 		foreach ( $posts as $post ) {$xx++;
5386 5386
 			$post_id = $post['ID'];
5387 5387
 			
@@ -5524,21 +5524,21 @@  discard block
 block discarded – undo
5524 5524
 			$csv_row[] = $post_info['post_zip']; // post_zip
5525 5525
 			$csv_row[] = $post_info['post_latitude']; // post_latitude
5526 5526
 			$csv_row[] = $post_info['post_longitude']; // post_longitude
5527
-            if ($neighbourhood_active) {
5528
-                $post_neighbourhood = '';
5529
-                $neighbourhood_latitude = '';
5530
-                $neighbourhood_longitude = '';
5531
-                if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5532
-                    if (!empty($hood_info)) {
5533
-                        $post_neighbourhood = $hood_info->hood_name;
5534
-                        $neighbourhood_latitude = $hood_info->hood_latitude;
5535
-                        $neighbourhood_longitude = $hood_info->hood_longitude;
5536
-                    }
5537
-                }
5538
-                $csv_row[] = $post_neighbourhood; // post_neighbourhood
5539
-                $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5540
-                $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5541
-            }
5527
+			if ($neighbourhood_active) {
5528
+				$post_neighbourhood = '';
5529
+				$neighbourhood_latitude = '';
5530
+				$neighbourhood_longitude = '';
5531
+				if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5532
+					if (!empty($hood_info)) {
5533
+						$post_neighbourhood = $hood_info->hood_name;
5534
+						$neighbourhood_latitude = $hood_info->hood_latitude;
5535
+						$neighbourhood_longitude = $hood_info->hood_longitude;
5536
+					}
5537
+				}
5538
+				$csv_row[] = $post_neighbourhood; // post_neighbourhood
5539
+				$csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5540
+				$csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5541
+			}
5542 5542
 			$csv_row[] = $post_info['geodir_timing']; // geodir_timing
5543 5543
 			$csv_row[] = $post_info['geodir_contact']; // geodir_contact
5544 5544
 			$csv_row[] = $post_info['geodir_email']; // geodir_email
@@ -5609,55 +5609,55 @@  discard block
 block discarded – undo
5609 5609
  * @return array Array of posts data.
5610 5610
  */
5611 5611
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5612
-    global $wpdb, $plugin_prefix;
5612
+	global $wpdb, $plugin_prefix;
5613 5613
 
5614
-    if ( ! post_type_exists( $post_type ) )
5615
-        return new stdClass;
5614
+	if ( ! post_type_exists( $post_type ) )
5615
+		return new stdClass;
5616 5616
         
5617
-    $table = $plugin_prefix . $post_type . '_detail';
5617
+	$table = $plugin_prefix . $post_type . '_detail';
5618 5618
 
5619
-    $limit = '';
5620
-    if ( $per_page > 0 && $page_no > 0 ) {
5621
-        $offset = ( $page_no - 1 ) * $per_page;
5619
+	$limit = '';
5620
+	if ( $per_page > 0 && $page_no > 0 ) {
5621
+		$offset = ( $page_no - 1 ) * $per_page;
5622 5622
         
5623
-        if ( $offset > 0 ) {
5624
-            $limit = " LIMIT " . $offset . "," . $per_page;
5625
-        } else {
5626
-            $limit = " LIMIT " . $per_page;
5627
-        }
5628
-    }
5623
+		if ( $offset > 0 ) {
5624
+			$limit = " LIMIT " . $offset . "," . $per_page;
5625
+		} else {
5626
+			$limit = " LIMIT " . $per_page;
5627
+		}
5628
+	}
5629 5629
 
5630
-    // Skip listing with statuses trash, auto-draft etc...
5631
-    $skip_statuses = geodir_imex_export_skip_statuses();
5632
-    $where_statuses = '';
5633
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5634
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5635
-    }
5630
+	// Skip listing with statuses trash, auto-draft etc...
5631
+	$skip_statuses = geodir_imex_export_skip_statuses();
5632
+	$where_statuses = '';
5633
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5634
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5635
+	}
5636
+
5637
+	$query = "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;
5638
+	/**
5639
+	 * Modify returned posts SQL query for the current post type.
5640
+	 *
5641
+	 * @since 1.4.6
5642
+	 * @package GeoDirectory
5643
+	 *
5644
+	 * @param int $query The SQL query.
5645
+	 * @param string $post_type Post type.
5646
+	 */
5647
+	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5648
+
5649
+	$results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5636 5650
 
5637
-    $query = "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;
5638
-    /**
5639
-     * Modify returned posts SQL query for the current post type.
5640
-     *
5641
-     * @since 1.4.6
5642
-     * @package GeoDirectory
5643
-     *
5644
-     * @param int $query The SQL query.
5645
-     * @param string $post_type Post type.
5646
-     */
5647
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5648
-
5649
-    $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5650
-
5651
-    /**
5652
-     * Modify returned post results for the current post type.
5653
-     *
5654
-     * @since 1.4.6
5655
-     * @package GeoDirectory
5656
-     *
5657
-     * @param object $results An object containing all post ids.
5658
-     * @param string $post_type Post type.
5659
-     */
5660
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5651
+	/**
5652
+	 * Modify returned post results for the current post type.
5653
+	 *
5654
+	 * @since 1.4.6
5655
+	 * @package GeoDirectory
5656
+	 *
5657
+	 * @param object $results An object containing all post ids.
5658
+	 * @param string $post_type Post type.
5659
+	 */
5660
+	return apply_filters( 'geodir_export_posts', $results, $post_type );
5661 5661
 }
5662 5662
 
5663 5663
 /**
@@ -5675,23 +5675,23 @@  discard block
 block discarded – undo
5675 5675
  * @return string The SQL query.
5676 5676
  */
5677 5677
 function geodir_imex_get_events_query( $query, $post_type ) {
5678
-    if ( $post_type == 'gd_event' ) {
5679
-        global $wpdb, $plugin_prefix;
5678
+	if ( $post_type == 'gd_event' ) {
5679
+		global $wpdb, $plugin_prefix;
5680 5680
         
5681
-        $table = $plugin_prefix . $post_type . '_detail';
5682
-        $schedule_table = EVENT_SCHEDULE;
5681
+		$table = $plugin_prefix . $post_type . '_detail';
5682
+		$schedule_table = EVENT_SCHEDULE;
5683 5683
         
5684
-        // Skip listing with statuses trash, auto-draft etc...
5685
-        $skip_statuses = geodir_imex_export_skip_statuses();
5686
-        $where_statuses = '';
5687
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5688
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5689
-        }
5684
+		// Skip listing with statuses trash, auto-draft etc...
5685
+		$skip_statuses = geodir_imex_export_skip_statuses();
5686
+		$where_statuses = '';
5687
+		if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5688
+			$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5689
+		}
5690 5690
 
5691
-        $query = "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";
5692
-    }
5691
+		$query = "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";
5692
+	}
5693 5693
 
5694
-    return $query;
5694
+	return $query;
5695 5695
 }
5696 5696
 
5697 5697
 /**
@@ -5713,36 +5713,36 @@  discard block
 block discarded – undo
5713 5713
  * @return int Total terms count.
5714 5714
  */
5715 5715
 function geodir_get_terms_count( $post_type ) {
5716
-    $args = array( 'hide_empty' => 0 );
5716
+	$args = array( 'hide_empty' => 0 );
5717 5717
 
5718
-    remove_all_filters( 'get_terms' );
5718
+	remove_all_filters( 'get_terms' );
5719 5719
 
5720
-    $taxonomy = $post_type . 'category';
5720
+	$taxonomy = $post_type . 'category';
5721 5721
 
5722
-    // WPML
5723
-    $is_wpml = geodir_is_wpml();
5724
-    $active_lang = 'all';
5725
-    if ( $is_wpml ) {
5726
-        global $sitepress;
5727
-        $active_lang = $sitepress->get_current_language();
5722
+	// WPML
5723
+	$is_wpml = geodir_is_wpml();
5724
+	$active_lang = 'all';
5725
+	if ( $is_wpml ) {
5726
+		global $sitepress;
5727
+		$active_lang = $sitepress->get_current_language();
5728 5728
         
5729
-        if ( $active_lang != 'all' ) {
5730
-            $sitepress->switch_lang( 'all', true );
5731
-        }
5732
-    }
5733
-    // WPML
5729
+		if ( $active_lang != 'all' ) {
5730
+			$sitepress->switch_lang( 'all', true );
5731
+		}
5732
+	}
5733
+	// WPML
5734 5734
             
5735
-    $count_terms = wp_count_terms( $taxonomy, $args );
5735
+	$count_terms = wp_count_terms( $taxonomy, $args );
5736 5736
 
5737
-    // WPML
5738
-    if ( $is_wpml && $active_lang !== 'all' ) {
5739
-        global $sitepress;
5740
-        $sitepress->switch_lang( $active_lang, true );
5741
-    }
5742
-    // WPML
5743
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5737
+	// WPML
5738
+	if ( $is_wpml && $active_lang !== 'all' ) {
5739
+		global $sitepress;
5740
+		$sitepress->switch_lang( $active_lang, true );
5741
+	}
5742
+	// WPML
5743
+	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5744 5744
      
5745
-    return $count_terms;
5745
+	return $count_terms;
5746 5746
 }
5747 5747
 
5748 5748
 /**
@@ -5781,11 +5781,11 @@  discard block
 block discarded – undo
5781 5781
 		$csv_row[] = 'cat_posttype';
5782 5782
 		$csv_row[] = 'cat_parent';
5783 5783
 		$csv_row[] = 'cat_schema';
5784
-        // WPML
5784
+		// WPML
5785 5785
 		$is_wpml = geodir_is_wpml();
5786 5786
 		if ($is_wpml) {
5787 5787
 			$csv_row[] = 'cat_language';
5788
-            $csv_row[] = 'cat_id_original';
5788
+			$csv_row[] = 'cat_id_original';
5789 5789
 		}
5790 5790
 		// WPML
5791 5791
 		$csv_row[] = 'cat_description';
@@ -5815,10 +5815,10 @@  discard block
 block discarded – undo
5815 5815
 			$csv_row[] = $post_type;
5816 5816
 			$csv_row[] = $cat_parent;
5817 5817
 			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5818
-            // WPML
5818
+			// WPML
5819 5819
 			if ($is_wpml) {
5820 5820
 				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5821
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5821
+				$csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5822 5822
 			}
5823 5823
 			// WPML
5824 5824
 			$csv_row[] = $term->description;
@@ -6414,43 +6414,43 @@  discard block
 block discarded – undo
6414 6414
  * @param string $status Post status.
6415 6415
  */
6416 6416
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
6417
-    global $wpdb, $current_user;
6418
-
6419
-    $option_value = get_option($option);
6420
-
6421
-    if ($option_value > 0) :
6422
-        if (get_post($option_value)) :
6423
-            // Page exists
6424
-            return;
6425
-        endif;
6426
-    endif;
6427
-
6428
-    $page_found = $wpdb->get_var(
6429
-        $wpdb->prepare(
6430
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6431
-            array($slug)
6432
-        )
6433
-    );
6434
-
6435
-    if ($page_found) :
6436
-        // Page exists
6437
-        if (!$option_value) update_option($option, $page_found);
6438
-        return;
6439
-    endif;
6440
-
6441
-    $page_data = array(
6442
-        'post_status' => $status,
6443
-        'post_type' => 'page',
6444
-        'post_author' => $current_user->ID,
6445
-        'post_name' => $slug,
6446
-        'post_title' => $page_title,
6447
-        'post_content' => $page_content,
6448
-        'post_parent' => $post_parent,
6449
-        'comment_status' => 'closed'
6450
-    );
6451
-    $page_id = wp_insert_post($page_data);
6452
-
6453
-    add_option($option, $page_id);
6417
+	global $wpdb, $current_user;
6418
+
6419
+	$option_value = get_option($option);
6420
+
6421
+	if ($option_value > 0) :
6422
+		if (get_post($option_value)) :
6423
+			// Page exists
6424
+			return;
6425
+		endif;
6426
+	endif;
6427
+
6428
+	$page_found = $wpdb->get_var(
6429
+		$wpdb->prepare(
6430
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6431
+			array($slug)
6432
+		)
6433
+	);
6434
+
6435
+	if ($page_found) :
6436
+		// Page exists
6437
+		if (!$option_value) update_option($option, $page_found);
6438
+		return;
6439
+	endif;
6440
+
6441
+	$page_data = array(
6442
+		'post_status' => $status,
6443
+		'post_type' => 'page',
6444
+		'post_author' => $current_user->ID,
6445
+		'post_name' => $slug,
6446
+		'post_title' => $page_title,
6447
+		'post_content' => $page_content,
6448
+		'post_parent' => $post_parent,
6449
+		'comment_status' => 'closed'
6450
+	);
6451
+	$page_id = wp_insert_post($page_data);
6452
+
6453
+	add_option($option, $page_id);
6454 6454
 
6455 6455
 }
6456 6456
 
@@ -6481,9 +6481,9 @@  discard block
 block discarded – undo
6481 6481
  * @package GeoDirectory
6482 6482
  */
6483 6483
 function geodir_admin_upgrade_notice() {
6484
-    $class = "error";
6485
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6486
-    echo"<div class=\"$class\"> <p>$message</p></div>";
6484
+	$class = "error";
6485
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6486
+	echo"<div class=\"$class\"> <p>$message</p></div>";
6487 6487
 }
6488 6488
 
6489 6489
 /**
@@ -6496,18 +6496,18 @@  discard block
 block discarded – undo
6496 6496
  */
6497 6497
 function geodire_admin_upgrade_notice( $plugin_data, $r )
6498 6498
 {
6499
-    // readme contents
6500
-    $args = array(
6501
-        'timeout'     => 15,
6502
-        'redirection' => 5
6503
-    );
6504
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6505
-    $data       = wp_remote_get( $url, $args );
6499
+	// readme contents
6500
+	$args = array(
6501
+		'timeout'     => 15,
6502
+		'redirection' => 5
6503
+	);
6504
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6505
+	$data       = wp_remote_get( $url, $args );
6506 6506
 
6507
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
6507
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
6508 6508
 
6509
-        geodir_in_plugin_update_message($data['body']);
6510
-    }
6509
+		geodir_in_plugin_update_message($data['body']);
6510
+	}
6511 6511
 }
6512 6512
 
6513 6513
 
@@ -6515,28 +6515,28 @@  discard block
 block discarded – undo
6515 6515
 * @param string $content http response body
6516 6516
 */
6517 6517
 function geodir_in_plugin_update_message($content) {
6518
-    // Output Upgrade Notice
6519
-    $matches        = null;
6520
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6521
-    $upgrade_notice = '';
6522
-    if ( preg_match( $regexp, $content, $matches ) ) {
6523
-        if(empty($matches)){return;}
6524
-
6525
-        $version = trim( $matches[1] );
6526
-        if($version && $version>GEODIRECTORY_VERSION){
6527
-
6528
-
6529
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6530
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6531
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6532
-            foreach ( $notices as $index => $line ) {
6533
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6534
-            }
6535
-            $upgrade_notice .= '</div> ';
6536
-        }
6537
-        }
6538
-    }
6539
-    echo $upgrade_notice;
6518
+	// Output Upgrade Notice
6519
+	$matches        = null;
6520
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6521
+	$upgrade_notice = '';
6522
+	if ( preg_match( $regexp, $content, $matches ) ) {
6523
+		if(empty($matches)){return;}
6524
+
6525
+		$version = trim( $matches[1] );
6526
+		if($version && $version>GEODIRECTORY_VERSION){
6527
+
6528
+
6529
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6530
+		if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6531
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6532
+			foreach ( $notices as $index => $line ) {
6533
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6534
+			}
6535
+			$upgrade_notice .= '</div> ';
6536
+		}
6537
+		}
6538
+	}
6539
+	echo $upgrade_notice;
6540 6540
 }
6541 6541
 
6542 6542
 /**
@@ -6569,19 +6569,19 @@  discard block
 block discarded – undo
6569 6569
  * @param array Listing statuses to be skipped.
6570 6570
  */
6571 6571
 function geodir_imex_export_skip_statuses() {
6572
-    $statuses = array( 'trash', 'auto-draft' );
6572
+	$statuses = array( 'trash', 'auto-draft' );
6573 6573
     
6574
-    /**
6575
-     * Filter the statuses to skip during GD export listings.
6576
-     *
6577
-     * @since 1.6.0
6578
-     * @package GeoDirectory
6579
-     *
6580
-     * @param array $statuses Listing statuses to be skipped.
6581
-     */
6582
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6574
+	/**
6575
+	 * Filter the statuses to skip during GD export listings.
6576
+	 *
6577
+	 * @since 1.6.0
6578
+	 * @package GeoDirectory
6579
+	 *
6580
+	 * @param array $statuses Listing statuses to be skipped.
6581
+	 */
6582
+	$statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6583 6583
      
6584
-    return $statuses;
6584
+	return $statuses;
6585 6585
 }
6586 6586
 
6587 6587
 /**
@@ -6593,15 +6593,15 @@  discard block
 block discarded – undo
6593 6593
  * @since 1.6.3
6594 6594
  */
6595 6595
 function geodir_admin_dequeue_scripts() {
6596
-    // EDD
6597
-    if (wp_script_is('jquery-chosen', 'enqueued')) {
6598
-        wp_dequeue_script('jquery-chosen');
6599
-    }
6596
+	// EDD
6597
+	if (wp_script_is('jquery-chosen', 'enqueued')) {
6598
+		wp_dequeue_script('jquery-chosen');
6599
+	}
6600 6600
     
6601
-    // Ultimate Addons for Visual Composer
6602
-    if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6603
-        wp_dequeue_script('ultimate-vc-backend-script');
6604
-    }
6601
+	// Ultimate Addons for Visual Composer
6602
+	if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6603
+		wp_dequeue_script('ultimate-vc-backend-script');
6604
+	}
6605 6605
 }
6606 6606
 
6607 6607
 /*
Please login to merge, or discard this patch.