Test Failed
Push — master ( 8c5d76...a58216 )
by Stiofan
26:48 queued 14s
created
geodirectory-admin/admin_functions.php 2 patches
Indentation   +2951 added lines, -2951 removed lines patch added patch discarded remove patch
@@ -13,134 +13,134 @@  discard block
 block discarded – undo
13 13
  * @package GeoDirectory
14 14
  */
15 15
 function geodir_deactivation() {
16
-    // Update installed variable
17
-    update_option("geodir_installed", 0);
16
+	// Update installed variable
17
+	update_option("geodir_installed", 0);
18 18
 
19
-    // Remove rewrite rules and then recreate rewrite rules.
20
-    flush_rewrite_rules();
19
+	// Remove rewrite rules and then recreate rewrite rules.
20
+	flush_rewrite_rules();
21 21
 }
22 22
 
23 23
 if (!function_exists('geodir_admin_styles')) {
24
-    /**
25
-     * Enqueue Admin Styles.
26
-     *
27
-     * @since 1.0.0
28
-     * @package GeoDirectory
29
-     */
30
-    function geodir_admin_styles() {
31
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32
-        wp_enqueue_style('geodirectory-admin-css');
24
+	/**
25
+	 * Enqueue Admin Styles.
26
+	 *
27
+	 * @since 1.0.0
28
+	 * @package GeoDirectory
29
+	 */
30
+	function geodir_admin_styles() {
31
+		wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32
+		wp_enqueue_style('geodirectory-admin-css');
33 33
 
34
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35
-        wp_enqueue_style('geodirectory-frontend-style');
34
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35
+		wp_enqueue_style('geodirectory-frontend-style');
36 36
 
37
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38
-        wp_enqueue_style('geodir-chosen-style');
37
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38
+		wp_enqueue_style('geodir-chosen-style');
39 39
 
40
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
40
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
42 42
 
43
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44
-        wp_enqueue_style('geodirectory-jquery-ui-css');
43
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44
+		wp_enqueue_style('geodirectory-jquery-ui-css');
45 45
 
46
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47
-        wp_enqueue_style('geodirectory-custom-fields-css');
46
+		wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47
+		wp_enqueue_style('geodirectory-custom-fields-css');
48 48
 
49
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50
-        wp_enqueue_style('geodirectory-pluplodar-css');
49
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50
+		wp_enqueue_style('geodirectory-pluplodar-css');
51 51
 
52
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53
-        wp_enqueue_style('geodir-rating-style');
52
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53
+		wp_enqueue_style('geodir-rating-style');
54 54
 
55
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56
-        wp_enqueue_style('geodir-rtl-style');
57
-    }
55
+		wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56
+		wp_enqueue_style('geodir-rtl-style');
57
+	}
58 58
 }
59 59
 
60 60
 if (!function_exists('geodir_admin_styles_req')) {
61
-    /**
62
-     * Loads stylesheets from CDN.
63
-     *
64
-     * @since 1.0.0
65
-     * @package GeoDirectory
66
-     */
67
-    function geodir_admin_styles_req()
68
-    {
69
-
70
-        wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION);
71
-        wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
72
-        wp_enqueue_script( 'font-awesome' );
73
-
74
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
75
-        wp_enqueue_script('geodirectory-admin');
61
+	/**
62
+	 * Loads stylesheets from CDN.
63
+	 *
64
+	 * @since 1.0.0
65
+	 * @package GeoDirectory
66
+	 */
67
+	function geodir_admin_styles_req()
68
+	{
76 69
 
77
-    }
70
+		wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION);
71
+		wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
72
+		wp_enqueue_script( 'font-awesome' );
73
+
74
+		wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
75
+		wp_enqueue_script('geodirectory-admin');
76
+
77
+	}
78 78
 }
79 79
 
80 80
 if (!function_exists('geodir_admin_scripts')) {
81
-    /**
82
-     * Enqueue Admin Scripts.
83
-     *
84
-     * @since 1.0.0
85
-     * @package GeoDirectory
86
-     */
87
-    function geodir_admin_scripts()
88
-    {
89
-        $geodir_map_name = geodir_map_name();
81
+	/**
82
+	 * Enqueue Admin Scripts.
83
+	 *
84
+	 * @since 1.0.0
85
+	 * @package GeoDirectory
86
+	 */
87
+	function geodir_admin_scripts()
88
+	{
89
+		$geodir_map_name = geodir_map_name();
90 90
         
91
-        wp_enqueue_script('jquery');
91
+		wp_enqueue_script('jquery');
92 92
 
93
-        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);
93
+		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);
94 94
 
95
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
96
-        wp_enqueue_script('chosen');
95
+		wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
96
+		wp_enqueue_script('chosen');
97 97
 
98
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
99
-        wp_enqueue_script('geodirectory-choose-ajax');
98
+		wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
99
+		wp_enqueue_script('geodirectory-choose-ajax');
100 100
 
101
-        if (isset($_REQUEST['listing_type'])) {
102
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
103
-        }
101
+		if (isset($_REQUEST['listing_type'])) {
102
+			wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
103
+		}
104 104
 
105
-        wp_enqueue_script('geodirectory-custom-fields-script');
106
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
105
+		wp_enqueue_script('geodirectory-custom-fields-script');
106
+		$plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
107 107
 
108
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
108
+		wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
109 109
 
110
-        if (in_array($geodir_map_name, array('auto', 'google'))) {
111
-            $map_lang = "&language=" . geodir_get_map_default_language();
112
-            $map_key = "&key=" . geodir_get_map_api_key();
113
-            /** This filter is documented in geodirectory_template_tags.php */
114
-            $map_extra = apply_filters('geodir_googlemap_script_extra', '');
115
-            wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
110
+		if (in_array($geodir_map_name, array('auto', 'google'))) {
111
+			$map_lang = "&language=" . geodir_get_map_default_language();
112
+			$map_key = "&key=" . geodir_get_map_api_key();
113
+			/** This filter is documented in geodirectory_template_tags.php */
114
+			$map_extra = apply_filters('geodir_googlemap_script_extra', '');
115
+			wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
116 116
             
117
-            // Overlapping Marker Spiderfier
118
-            wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
119
-            wp_enqueue_script('geodirectory-g-overlappingmarker-script');
120
-        }
117
+			// Overlapping Marker Spiderfier
118
+			wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
119
+			wp_enqueue_script('geodirectory-g-overlappingmarker-script');
120
+		}
121 121
         
122
-        if ($geodir_map_name == 'osm') {
123
-            // Leaflet OpenStreetMap
124
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
125
-            wp_enqueue_style('geodirectory-leaflet-style');
122
+		if ($geodir_map_name == 'osm') {
123
+			// Leaflet OpenStreetMap
124
+			wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
125
+			wp_enqueue_style('geodirectory-leaflet-style');
126 126
                 
127
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
128
-            wp_enqueue_script('geodirectory-leaflet-script');
127
+			wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
128
+			wp_enqueue_script('geodirectory-leaflet-script');
129 129
             
130
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
131
-            wp_enqueue_script('geodirectory-leaflet-geo-script');
130
+			wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
131
+			wp_enqueue_script('geodirectory-leaflet-geo-script');
132 132
             
133
-            // Overlapping Marker Spiderfier Leaflet
134
-            wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
135
-            wp_enqueue_script('geodirectory-o-overlappingmarker-script');
136
-        }
137
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
133
+			// Overlapping Marker Spiderfier Leaflet
134
+			wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
135
+			wp_enqueue_script('geodirectory-o-overlappingmarker-script');
136
+		}
137
+		wp_enqueue_script( 'jquery-ui-autocomplete' );
138 138
         
139
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
140
-        wp_enqueue_script('geodirectory-goMap-script');
139
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
140
+		wp_enqueue_script('geodirectory-goMap-script');
141 141
 
142
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
143
-        wp_enqueue_script('geodirectory-goMap-script');
142
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
143
+		wp_enqueue_script('geodirectory-goMap-script');
144 144
 
145 145
 		// font awesome rating script
146 146
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
@@ -151,167 +151,167 @@  discard block
 block discarded – undo
151 151
 			wp_enqueue_script('geodir-jRating-js');
152 152
 		}
153 153
 
154
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
155
-        wp_enqueue_script('geodir-on-document-load');
156
-
157
-
158
-        // SCRIPT FOR UPLOAD
159
-        wp_enqueue_script('plupload-all');
160
-        wp_enqueue_script('jquery-ui-sortable');
161
-
162
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
163
-        wp_enqueue_script('geodirectory-plupload-script');
164
-
165
-        // SCRIPT FOR UPLOAD END
166
-
167
-
168
-        // place js config array for plupload
169
-        $plupload_init = array(
170
-            'runtimes' => 'html5,silverlight,html4',
171
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
172
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
173
-            'drop_element' => 'dropbox', // will be adjusted per uploader
174
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
175
-            'multiple_queues' => true,
176
-            'max_file_size' => geodir_max_upload_size(),
177
-            'url' => admin_url('admin-ajax.php'),
178
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
179
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
180
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
181
-            'multipart' => true,
182
-            'urlstream_upload' => true,
183
-            'multi_selection' => false, // will be added per uploader
184
-            // additional post data to send to our ajax hook
185
-            'multipart_params' => array(
186
-                '_ajax_nonce' => "", // will be added per uploader
187
-                'action' => 'plupload_action', // the ajax action name
188
-                'imgid' => 0 // will be added per uploader
189
-            )
190
-        );
191
-        $base_plupload_config = json_encode($plupload_init);
192
-
193
-
194
-        $thumb_img_arr = array();
195
-
196
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
197
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
198
-
199
-        $totImg = '';
200
-        $image_limit = '';
201
-        if (!empty($thumb_img_arr)) {
202
-            $totImg = count($thumb_img_arr);
203
-        }
154
+		wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
155
+		wp_enqueue_script('geodir-on-document-load');
156
+
157
+
158
+		// SCRIPT FOR UPLOAD
159
+		wp_enqueue_script('plupload-all');
160
+		wp_enqueue_script('jquery-ui-sortable');
161
+
162
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
163
+		wp_enqueue_script('geodirectory-plupload-script');
164
+
165
+		// SCRIPT FOR UPLOAD END
166
+
167
+
168
+		// place js config array for plupload
169
+		$plupload_init = array(
170
+			'runtimes' => 'html5,silverlight,html4',
171
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
172
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
173
+			'drop_element' => 'dropbox', // will be adjusted per uploader
174
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
175
+			'multiple_queues' => true,
176
+			'max_file_size' => geodir_max_upload_size(),
177
+			'url' => admin_url('admin-ajax.php'),
178
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
179
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
180
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
181
+			'multipart' => true,
182
+			'urlstream_upload' => true,
183
+			'multi_selection' => false, // will be added per uploader
184
+			// additional post data to send to our ajax hook
185
+			'multipart_params' => array(
186
+				'_ajax_nonce' => "", // will be added per uploader
187
+				'action' => 'plupload_action', // the ajax action name
188
+				'imgid' => 0 // will be added per uploader
189
+			)
190
+		);
191
+		$base_plupload_config = json_encode($plupload_init);
192
+
193
+
194
+		$thumb_img_arr = array();
195
+
196
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
197
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
198
+
199
+		$totImg = '';
200
+		$image_limit = '';
201
+		if (!empty($thumb_img_arr)) {
202
+			$totImg = count($thumb_img_arr);
203
+		}
204 204
 
205
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
206
-            'totalImg' => $totImg,
207
-            'image_limit' => $image_limit,
208
-            'upload_img_size' => geodir_max_upload_size());
205
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
206
+			'totalImg' => $totImg,
207
+			'image_limit' => $image_limit,
208
+			'upload_img_size' => geodir_max_upload_size());
209 209
 
210
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
210
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
211 211
 
212
-        $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
213
-        wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
212
+		$ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
213
+		wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
214 214
 
215 215
 
216
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
217
-        wp_enqueue_script('geodirectory-admin-script');
216
+		wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
217
+		wp_enqueue_script('geodirectory-admin-script');
218 218
 
219
-        wp_enqueue_style('farbtastic');
220
-        wp_enqueue_script('farbtastic');
219
+		wp_enqueue_style('farbtastic');
220
+		wp_enqueue_script('farbtastic');
221 221
 
222
-        $screen = get_current_screen();
223
-        if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
224
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
225
-        }
222
+		$screen = get_current_screen();
223
+		if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
224
+			wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
225
+		}
226 226
 
227
-        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
228
-        wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
227
+		$ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
228
+		wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
229 229
 
230
-    }
230
+	}
231 231
 }
232 232
 
233 233
 if (!function_exists('geodir_admin_menu')) {
234
-    /**
235
-     * Admin Menus
236
-     *
237
-     * Sets up the admin menus in wordpress.
238
-     *
239
-     * @since 1.0.0
240
-     * @package GeoDirectory
241
-     * @global array $menu Menu array.
242
-     * @global object $geodirectory GeoDirectory plugin object.
243
-     */
244
-    function geodir_admin_menu()
245
-    {
246
-        global $menu, $geodirectory;
234
+	/**
235
+	 * Admin Menus
236
+	 *
237
+	 * Sets up the admin menus in wordpress.
238
+	 *
239
+	 * @since 1.0.0
240
+	 * @package GeoDirectory
241
+	 * @global array $menu Menu array.
242
+	 * @global object $geodirectory GeoDirectory plugin object.
243
+	 */
244
+	function geodir_admin_menu()
245
+	{
246
+		global $menu, $geodirectory;
247 247
 
248
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
248
+		if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
249 249
 
250
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
250
+		add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
251 251
 
252 252
 
253
-    }
253
+	}
254 254
 }
255 255
 
256 256
 if (!function_exists('geodir_admin_menu_order')) {
257
-    /**
258
-     * Order admin menus.
259
-     *
260
-     * @since 1.0.0
261
-     * @package GeoDirectory
262
-     * @param array $menu_order Menu order array.
263
-     * @return array Modified menu order array.
264
-     */
265
-    function geodir_admin_menu_order($menu_order)
266
-    {
267
-
268
-        // Initialize our custom order array
269
-        $geodir_menu_order = array();
270
-
271
-        // Get the index of our custom separator
272
-        $geodir_separator = array_search('separator-geodirectory', $menu_order);
273
-
274
-        // Get index of posttype menu
275
-        $post_types = geodir_get_posttypes();
276
-
277
-        // Loop through menu order and do some rearranging
278
-        foreach ($menu_order as $index => $item) :
279
-
280
-            if ((('geodirectory') == $item)) :
281
-                $geodir_menu_order[] = 'separator-geodirectory';
282
-                if (!empty($post_types)) {
283
-                    foreach ($post_types as $post_type) {
284
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
285
-                    }
286
-                }
287
-                $geodir_menu_order[] = $item;
257
+	/**
258
+	 * Order admin menus.
259
+	 *
260
+	 * @since 1.0.0
261
+	 * @package GeoDirectory
262
+	 * @param array $menu_order Menu order array.
263
+	 * @return array Modified menu order array.
264
+	 */
265
+	function geodir_admin_menu_order($menu_order)
266
+	{
288 267
 
289
-                unset($menu_order[$geodir_separator]);
290
-            //unset( $menu_order[$geodir_places] );
291
-            elseif (!in_array($item, array('separator-geodirectory'))) :
292
-                $geodir_menu_order[] = $item;
293
-            endif;
268
+		// Initialize our custom order array
269
+		$geodir_menu_order = array();
294 270
 
295
-        endforeach;
271
+		// Get the index of our custom separator
272
+		$geodir_separator = array_search('separator-geodirectory', $menu_order);
296 273
 
297
-        // Return order
298
-        return $geodir_menu_order;
299
-    }
274
+		// Get index of posttype menu
275
+		$post_types = geodir_get_posttypes();
276
+
277
+		// Loop through menu order and do some rearranging
278
+		foreach ($menu_order as $index => $item) :
279
+
280
+			if ((('geodirectory') == $item)) :
281
+				$geodir_menu_order[] = 'separator-geodirectory';
282
+				if (!empty($post_types)) {
283
+					foreach ($post_types as $post_type) {
284
+						$geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
285
+					}
286
+				}
287
+				$geodir_menu_order[] = $item;
288
+
289
+				unset($menu_order[$geodir_separator]);
290
+			//unset( $menu_order[$geodir_places] );
291
+			elseif (!in_array($item, array('separator-geodirectory'))) :
292
+				$geodir_menu_order[] = $item;
293
+			endif;
294
+
295
+		endforeach;
296
+
297
+		// Return order
298
+		return $geodir_menu_order;
299
+	}
300 300
 }
301 301
 
302 302
 if (!function_exists('geodir_admin_custom_menu_order')) {
303
-    /**
304
-     * Enables custom menu order.
305
-     *
306
-     * @since 1.0.0
307
-     * @package GeoDirectory
308
-     * @return bool
309
-     */
310
-    function geodir_admin_custom_menu_order()
311
-    {
312
-        if (!current_user_can('manage_options')) return false;
313
-        return true;
314
-    }
303
+	/**
304
+	 * Enables custom menu order.
305
+	 *
306
+	 * @since 1.0.0
307
+	 * @package GeoDirectory
308
+	 * @return bool
309
+	 */
310
+	function geodir_admin_custom_menu_order()
311
+	{
312
+		if (!current_user_can('manage_options')) return false;
313
+		return true;
314
+	}
315 315
 }
316 316
 
317 317
 /**
@@ -322,51 +322,51 @@  discard block
 block discarded – undo
322 322
  */
323 323
 function geodir_before_admin_panel()
324 324
 {
325
-    if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326
-        echo '<div id="message" class="updated fade">
325
+	if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326
+		echo '<div id="message" class="updated fade">
327 327
                         <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
328 328
                         <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
329 329
                 </div>';
330 330
 
331
-    }
331
+	}
332 332
 
333
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334
-        switch ($_REQUEST['msg']) {
335
-            case 'success':
336
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
337
-                flush_rewrite_rules(false);
333
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334
+		switch ($_REQUEST['msg']) {
335
+			case 'success':
336
+				echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
337
+				flush_rewrite_rules(false);
338 338
 
339
-                break;
339
+				break;
340 340
 			case 'fail':
341 341
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
342 342
 				
343 343
 				if ($gderr == 21)
344
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
344
+					echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
345 345
 				else
346 346
 					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
347
-                break;
348
-        }
349
-    }
347
+				break;
348
+		}
349
+	}
350 350
 
351
-    $geodir_load_map = get_option('geodir_load_map');
352
-    $need_map_key = false;
353
-    if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
354
-        $need_map_key = true;
355
-    }
351
+	$geodir_load_map = get_option('geodir_load_map');
352
+	$need_map_key = false;
353
+	if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
354
+		$need_map_key = true;
355
+	}
356 356
 
357
-    if (!geodir_get_map_api_key() && $need_map_key) {
358
-        echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
359
-    }
357
+	if (!geodir_get_map_api_key() && $need_map_key) {
358
+		echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
359
+	}
360 360
 
361
-    if (!geodir_is_default_location_set()) {
362
-        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>';
361
+	if (!geodir_is_default_location_set()) {
362
+		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>';
363 363
 
364
-    }
364
+	}
365 365
 
366
-    if (!function_exists('curl_init')) {
367
-        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>';
366
+	if (!function_exists('curl_init')) {
367
+		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>';
368 368
 
369
-    }
369
+	}
370 370
 
371 371
 
372 372
 
@@ -383,19 +383,19 @@  discard block
 block discarded – undo
383 383
  */
384 384
 function geodir_handle_option_form_submit($current_tab)
385 385
 {
386
-    global $geodir_settings;
387
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
388
-        /**
389
-         * Contains settings array for current tab.
390
-         *
391
-         * @since 1.0.0
392
-         * @package GeoDirectory
393
-         */
394
-        include_once('option-pages/' . $current_tab . '_array.php');
395
-    }
396
-    if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
397
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
398
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
386
+	global $geodir_settings;
387
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
388
+		/**
389
+		 * Contains settings array for current tab.
390
+		 *
391
+		 * @since 1.0.0
392
+		 * @package GeoDirectory
393
+		 */
394
+		include_once('option-pages/' . $current_tab . '_array.php');
395
+	}
396
+	if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
397
+		if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
398
+		if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
399 399
 		
400 400
 		/**
401 401
 		 * Fires before updating geodirectory admin settings.
@@ -407,38 +407,38 @@  discard block
 block discarded – undo
407 407
 		 */
408 408
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
409 409
 		
410
-        if (!empty($geodir_settings[$current_tab]))
411
-            geodir_update_options($geodir_settings[$current_tab]);
410
+		if (!empty($geodir_settings[$current_tab]))
411
+			geodir_update_options($geodir_settings[$current_tab]);
412 412
 
413
-        /**
414
-         * Called after GeoDirectory options settings are updated.
415
-         *
416
-         * @since 1.0.0
417
-         * @param array $geodir_settings The array of GeoDirectory settings.
418
-         * @see 'geodir_before_update_options'
419
-         */
420
-        do_action('geodir_update_options', $geodir_settings);
413
+		/**
414
+		 * Called after GeoDirectory options settings are updated.
415
+		 *
416
+		 * @since 1.0.0
417
+		 * @param array $geodir_settings The array of GeoDirectory settings.
418
+		 * @see 'geodir_before_update_options'
419
+		 */
420
+		do_action('geodir_update_options', $geodir_settings);
421 421
 
422
-        /**
423
-         * Called after GeoDirectory options settings are updated.
424
-         *
425
-         * Provides tab specific settings.
426
-         *
427
-         * @since 1.0.0
428
-         * @param string $current_tab The current settings tab name.
429
-         * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
430
-         */
431
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
422
+		/**
423
+		 * Called after GeoDirectory options settings are updated.
424
+		 *
425
+		 * Provides tab specific settings.
426
+		 *
427
+		 * @since 1.0.0
428
+		 * @param string $current_tab The current settings tab name.
429
+		 * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
430
+		 */
431
+		do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
432 432
 
433
-        flush_rewrite_rules(false);
433
+		flush_rewrite_rules(false);
434 434
 
435
-        $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
435
+		$current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
436 436
 
437
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
437
+		$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
438 438
 
439
-        wp_redirect($redirect_url);
440
-        exit();
441
-    endif;
439
+		wp_redirect($redirect_url);
440
+		exit();
441
+	endif;
442 442
 
443 443
 
444 444
 }
@@ -456,144 +456,144 @@  discard block
 block discarded – undo
456 456
  * @return bool Returns true if saved.
457 457
  */
458 458
 function geodir_update_options($options, $dummy = false) {
459
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
459
+	if ((!isset($_POST) || !$_POST) && !$dummy) return false;
460 460
 
461
-    foreach ($options as $value) {
462
-        if ($dummy && isset($value['std']))
463
-            $_POST[$value['id']] = $value['std'];
461
+	foreach ($options as $value) {
462
+		if ($dummy && isset($value['std']))
463
+			$_POST[$value['id']] = $value['std'];
464 464
 
465 465
 
466
-        if (isset($value['type']) && $value['type'] == 'checkbox') :
466
+		if (isset($value['type']) && $value['type'] == 'checkbox') :
467 467
 
468
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
469
-                update_option($value['id'], $_POST[$value['id']]);
470
-            } else {
471
-                update_option($value['id'], 0);
472
-            }
468
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
469
+				update_option($value['id'], $_POST[$value['id']]);
470
+			} else {
471
+				update_option($value['id'], 0);
472
+			}
473 473
 
474
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
474
+		elseif (isset($value['type']) && $value['type'] == 'image_width') :
475 475
 
476
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
477
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
478
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
479
-                if (isset($_POST[$value['id'] . '_crop'])) :
480
-                    update_option($value['id'] . '_crop', 1);
481
-                else :
482
-                    update_option($value['id'] . '_crop', 0);
483
-                endif;
484
-            } else {
485
-                update_option($value['id'] . '_width', $value['std']);
486
-                update_option($value['id'] . '_height', $value['std']);
487
-                update_option($value['id'] . '_crop', 1);
488
-            }
476
+			if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
477
+				update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
478
+				update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
479
+				if (isset($_POST[$value['id'] . '_crop'])) :
480
+					update_option($value['id'] . '_crop', 1);
481
+				else :
482
+					update_option($value['id'] . '_crop', 0);
483
+				endif;
484
+			} else {
485
+				update_option($value['id'] . '_width', $value['std']);
486
+				update_option($value['id'] . '_height', $value['std']);
487
+				update_option($value['id'] . '_crop', 1);
488
+			}
489 489
 
490
-        elseif (isset($value['type']) && $value['type'] == 'map') :
491
-            $post_types = array();
492
-            $categories = array();
490
+		elseif (isset($value['type']) && $value['type'] == 'map') :
491
+			$post_types = array();
492
+			$categories = array();
493 493
 
494
-            if (!empty($_POST['home_map_post_types'])) :
495
-                foreach ($_POST['home_map_post_types'] as $post_type) :
496
-                    $post_types[] = $post_type;
497
-                endforeach;
498
-            endif;
494
+			if (!empty($_POST['home_map_post_types'])) :
495
+				foreach ($_POST['home_map_post_types'] as $post_type) :
496
+					$post_types[] = $post_type;
497
+				endforeach;
498
+			endif;
499 499
 
500
-            update_option('geodir_exclude_post_type_on_map', $post_types);
500
+			update_option('geodir_exclude_post_type_on_map', $post_types);
501 501
 
502
-            if (!empty($_POST['post_category'])) :
503
-                foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
504
-                    $categories[$texonomy] = array();
505
-                    foreach ($cat_arr as $category) :
506
-                        $categories[$texonomy][] = $category;
507
-                    endforeach;
508
-                    $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
509
-                endforeach;
510
-            endif;
511
-            update_option('geodir_exclude_cat_on_map', $categories);
512
-            update_option('geodir_exclude_cat_on_map_upgrade', 1);
513
-        elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
502
+			if (!empty($_POST['post_category'])) :
503
+				foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
504
+					$categories[$texonomy] = array();
505
+					foreach ($cat_arr as $category) :
506
+						$categories[$texonomy][] = $category;
507
+					endforeach;
508
+					$categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
509
+				endforeach;
510
+			endif;
511
+			update_option('geodir_exclude_cat_on_map', $categories);
512
+			update_option('geodir_exclude_cat_on_map_upgrade', 1);
513
+		elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
514 514
 
515 515
 
516
-            if (!empty($_POST['geodir_default_map_language'])):
517
-                update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
518
-            endif;
516
+			if (!empty($_POST['geodir_default_map_language'])):
517
+				update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
518
+			endif;
519 519
 
520 520
 
521
-            if (!empty($_POST['geodir_default_map_search_pt'])):
522
-                update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
523
-            endif;
521
+			if (!empty($_POST['geodir_default_map_search_pt'])):
522
+				update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
523
+			endif;
524 524
 
525 525
 
526
-        elseif (isset($value['type']) && $value['type'] == 'file') :
526
+		elseif (isset($value['type']) && $value['type'] == 'file') :
527 527
 
528 528
 
529
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
529
+			if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
530 530
 
531
-                if (get_option($value['id'])) {
532
-                    $image_name_arr = explode('/', get_option($value['id']));
533
-                    $noimg_name = end($image_name_arr);
534
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
535
-                    if (file_exists($img_path))
536
-                        unlink($img_path);
537
-                }
531
+				if (get_option($value['id'])) {
532
+					$image_name_arr = explode('/', get_option($value['id']));
533
+					$noimg_name = end($image_name_arr);
534
+					$img_path = $uploads['path'] . '/' . $noimg_name;
535
+					if (file_exists($img_path))
536
+						unlink($img_path);
537
+				}
538 538
 
539
-                update_option($value['id'], '');
540
-            }
539
+				update_option($value['id'], '');
540
+			}
541 541
 
542
-            $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
543
-            $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
544
-
545
-            if (!empty($filename)):
546
-                $ext = pathinfo($filename, PATHINFO_EXTENSION);
547
-                $uplaods = array();
548
-
549
-                foreach ($uploadedfile as $key => $uplaod):
550
-                    if ($key == 'name'):
551
-                        $uplaods[$key] = $filename;
552
-                    else :
553
-                        $uplaods[$key] = $uplaod;
554
-                    endif;
555
-                endforeach;
556
-
557
-                $uploads = wp_upload_dir();
558
-
559
-                if (get_option($value['id'])) {
560
-                    $image_name_arr = explode('/', get_option($value['id']));
561
-                    $noimg_name = end($image_name_arr);
562
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
563
-                    if (file_exists($img_path))
564
-                        unlink($img_path);
565
-                }
542
+			$uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
543
+			$filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
544
+
545
+			if (!empty($filename)):
546
+				$ext = pathinfo($filename, PATHINFO_EXTENSION);
547
+				$uplaods = array();
548
+
549
+				foreach ($uploadedfile as $key => $uplaod):
550
+					if ($key == 'name'):
551
+						$uplaods[$key] = $filename;
552
+					else :
553
+						$uplaods[$key] = $uplaod;
554
+					endif;
555
+				endforeach;
556
+
557
+				$uploads = wp_upload_dir();
558
+
559
+				if (get_option($value['id'])) {
560
+					$image_name_arr = explode('/', get_option($value['id']));
561
+					$noimg_name = end($image_name_arr);
562
+					$img_path = $uploads['path'] . '/' . $noimg_name;
563
+					if (file_exists($img_path))
564
+						unlink($img_path);
565
+				}
566 566
 
567
-                $upload_overrides = array('test_form' => false);
568
-                $movefile = wp_handle_upload($uplaods, $upload_overrides);
567
+				$upload_overrides = array('test_form' => false);
568
+				$movefile = wp_handle_upload($uplaods, $upload_overrides);
569 569
 
570
-                update_option($value['id'], $movefile['url']);
570
+				update_option($value['id'], $movefile['url']);
571 571
 
572
-            endif;
572
+			endif;
573 573
 
574
-            if (!get_option($value['id']) && isset($value['value'])):
575
-                update_option($value['id'], $value['value']);
576
-            endif;
574
+			if (!get_option($value['id']) && isset($value['value'])):
575
+				update_option($value['id'], $value['value']);
576
+			endif;
577 577
 
578 578
 
579
-        else :
580
-            // same menu setting per theme.
581
-            if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
582
-                $theme = wp_get_theme();
583
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
584
-            }
579
+		else :
580
+			// same menu setting per theme.
581
+			if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
582
+				$theme = wp_get_theme();
583
+				update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
584
+			}
585 585
 
586
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
587
-                update_option($value['id'], $_POST[$value['id']]);
588
-            } else {
589
-                delete_option($value['id']);
590
-            }
586
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
587
+				update_option($value['id'], $_POST[$value['id']]);
588
+			} else {
589
+				delete_option($value['id']);
590
+			}
591 591
 
592
-        endif;
593
-    }
594
-    if ($dummy)
595
-        $_POST = array();
596
-    return true;
592
+		endif;
593
+	}
594
+	if ($dummy)
595
+		$_POST = array();
596
+	return true;
597 597
 
598 598
 }
599 599
 
@@ -642,33 +642,33 @@  discard block
 block discarded – undo
642 642
 function places_custom_fields_tab($tabs)
643 643
 {
644 644
 
645
-    $geodir_post_types = get_option('geodir_post_types');
645
+	$geodir_post_types = get_option('geodir_post_types');
646 646
 
647
-    if (!empty($geodir_post_types)) {
647
+	if (!empty($geodir_post_types)) {
648 648
 
649
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
649
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
650 650
 
651
-            $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
651
+			$listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
652 652
 
653
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
654
-                'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
655
-                'subtabs' => array(
656
-                    array('subtab' => 'custom_fields',
657
-                        'label' => __('Custom Fields', 'geodirectory'),
658
-                        'request' => array('listing_type' => $geodir_post_type)),
659
-                    array('subtab' => 'sorting_options',
660
-                        'label' => __('Sorting Options', 'geodirectory'),
661
-                        'request' => array('listing_type' => $geodir_post_type)),
662
-                ),
663
-                'tab_index' => 9,
664
-                'request' => array('listing_type' => $geodir_post_type)
665
-            );
653
+			$tabs[$geodir_post_type . '_fields_settings'] = array(
654
+				'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
655
+				'subtabs' => array(
656
+					array('subtab' => 'custom_fields',
657
+						'label' => __('Custom Fields', 'geodirectory'),
658
+						'request' => array('listing_type' => $geodir_post_type)),
659
+					array('subtab' => 'sorting_options',
660
+						'label' => __('Sorting Options', 'geodirectory'),
661
+						'request' => array('listing_type' => $geodir_post_type)),
662
+				),
663
+				'tab_index' => 9,
664
+				'request' => array('listing_type' => $geodir_post_type)
665
+			);
666 666
 
667
-        endforeach;
667
+		endforeach;
668 668
 
669
-    }
669
+	}
670 670
 
671
-    return $tabs;
671
+	return $tabs;
672 672
 }
673 673
 
674 674
 
@@ -684,9 +684,9 @@  discard block
 block discarded – undo
684 684
  */
685 685
 function geodir_tools_setting_tab($tabs)
686 686
 {
687
-    wp_enqueue_script( 'jquery-ui-progressbar' );
688
-    $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
689
-    return $tabs;
687
+	wp_enqueue_script( 'jquery-ui-progressbar' );
688
+	$tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
689
+	return $tabs;
690 690
 }
691 691
 
692 692
 /**
@@ -701,8 +701,8 @@  discard block
 block discarded – undo
701 701
  */
702 702
 function geodir_compatibility_setting_tab($tabs)
703 703
 {
704
-    $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
705
-    return $tabs;
704
+	$tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
705
+	return $tabs;
706 706
 }
707 707
 
708 708
 
@@ -718,144 +718,144 @@  discard block
 block discarded – undo
718 718
  */
719 719
 function geodir_extend_geodirectory_setting_tab($tabs)
720 720
 {
721
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
722
-    return $tabs;
721
+	$tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
722
+	return $tabs;
723 723
 }
724 724
 
725 725
 
726 726
 if (!function_exists('geodir_edit_post_columns')) {
727
-    /**
728
-     * Modify admin post listing page columns.
729
-     *
730
-     * @since 1.0.0
731
-     * @package GeoDirectory
732
-     * @param array $columns The column array.
733
-     * @return array Altered column array.
734
-     */
735
-    function geodir_edit_post_columns($columns)
736
-    {
737
-
738
-        $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
739
-            'categorys' => __('Categories', 'geodirectory'));
740
-
741
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
742
-        {
743
-            $offset = 0; // should we prepend $array with $data?
744
-            $offset = count($columns); // or should we append $array with $data? lets pick this one...
745
-        }
727
+	/**
728
+	 * Modify admin post listing page columns.
729
+	 *
730
+	 * @since 1.0.0
731
+	 * @package GeoDirectory
732
+	 * @param array $columns The column array.
733
+	 * @return array Altered column array.
734
+	 */
735
+	function geodir_edit_post_columns($columns)
736
+	{
746 737
 
747
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
738
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
739
+			'categorys' => __('Categories', 'geodirectory'));
748 740
 
749
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
741
+		if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
742
+		{
743
+			$offset = 0; // should we prepend $array with $data?
744
+			$offset = count($columns); // or should we append $array with $data? lets pick this one...
745
+		}
750 746
 
751
-        return $columns;
752
-    }
747
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
748
+
749
+		$columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
750
+
751
+		return $columns;
752
+	}
753 753
 }
754 754
 
755 755
 
756 756
 if (!function_exists('geodir_manage_post_columns')) {
757
-    /**
758
-     * Adds content to our custom post listing page columns.
759
-     *
760
-     * @since 1.0.0
761
-     * @package GeoDirectory
762
-     * @global object $wpdb WordPress Database object.
763
-     * @global object $post WordPress Post object.
764
-     * @param string $column The column name.
765
-     * @param int $post_id The post ID.
766
-     */
767
-    function geodir_manage_post_columns($column, $post_id)
768
-    {
769
-        global $post, $wpdb;
770
-
771
-        switch ($column):
772
-            /* If displaying the 'city' column. */
773
-            case 'location' :
774
-                $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
775
-                $location = geodir_get_location($location_id);
776
-                /* If no city is found, output a default message. */
777
-                if (empty($location)) {
778
-                    _e('Unknown', 'geodirectory');
779
-                } else {
780
-                    /* If there is a city id, append 'city name' to the text string. */
781
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
782
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
783
-                }
784
-                break;
785
-
786
-            /* If displaying the 'expire' column. */
787
-            case 'expire' :
788
-                $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
789
-                $d1 = $expire_date; // get expire_date
790
-                $d2 = date('Y-m-d'); // get current date
791
-                $state = __('days left', 'geodirectory');
792
-                $date_diff_text = '';
793
-                $expire_class = 'expire_left';
794
-                if ($expire_date != 'Never') {
795
-                    if (strtotime($d1) < strtotime($d2)) {
796
-                        $state = __('days overdue', 'geodirectory');
797
-                        $expire_class = 'expire_over';
798
-                    }
799
-                    $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
800
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
801
-                }
802
-                /* If no expire_date is found, output a default message. */
803
-                if (empty($expire_date))
804
-                    echo __('Unknown', 'geodirectory');
805
-                /* If there is a expire_date, append 'days left' to the text string. */
806
-                else
807
-                    echo $expire_date . $date_diff_text;
808
-                break;
809
-
810
-            /* If displaying the 'categorys' column. */
811
-            case 'categorys' :
812
-
813
-                /* Get the categorys for the post. */
814
-
815
-
816
-                $terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
817
-
818
-                /* If terms were found. */
819
-                if (!empty($terms)) {
820
-                    $out = array();
821
-                    /* Loop through each term, linking to the 'edit posts' page for the specific term. */
822
-                    foreach ($terms as $term) {
823
-                        if (!strstr($term->taxonomy, 'tag')) {
824
-                            $out[] = sprintf('<a href="%s">%s</a>',
825
-                                esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
826
-                                esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
827
-                            );
828
-                        }
829
-                    }
830
-                    /* Join the terms, separating them with a comma. */
831
-                    echo(join(', ', $out));
832
-                } /* If no terms were found, output a default message. */
833
-                else {
834
-                    _e('No Categories', 'geodirectory');
835
-                }
836
-                break;
757
+	/**
758
+	 * Adds content to our custom post listing page columns.
759
+	 *
760
+	 * @since 1.0.0
761
+	 * @package GeoDirectory
762
+	 * @global object $wpdb WordPress Database object.
763
+	 * @global object $post WordPress Post object.
764
+	 * @param string $column The column name.
765
+	 * @param int $post_id The post ID.
766
+	 */
767
+	function geodir_manage_post_columns($column, $post_id)
768
+	{
769
+		global $post, $wpdb;
770
+
771
+		switch ($column):
772
+			/* If displaying the 'city' column. */
773
+			case 'location' :
774
+				$location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
775
+				$location = geodir_get_location($location_id);
776
+				/* If no city is found, output a default message. */
777
+				if (empty($location)) {
778
+					_e('Unknown', 'geodirectory');
779
+				} else {
780
+					/* If there is a city id, append 'city name' to the text string. */
781
+					$add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
782
+					echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
783
+				}
784
+				break;
785
+
786
+			/* If displaying the 'expire' column. */
787
+			case 'expire' :
788
+				$expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
789
+				$d1 = $expire_date; // get expire_date
790
+				$d2 = date('Y-m-d'); // get current date
791
+				$state = __('days left', 'geodirectory');
792
+				$date_diff_text = '';
793
+				$expire_class = 'expire_left';
794
+				if ($expire_date != 'Never') {
795
+					if (strtotime($d1) < strtotime($d2)) {
796
+						$state = __('days overdue', 'geodirectory');
797
+						$expire_class = 'expire_over';
798
+					}
799
+					$date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
800
+					$date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
801
+				}
802
+				/* If no expire_date is found, output a default message. */
803
+				if (empty($expire_date))
804
+					echo __('Unknown', 'geodirectory');
805
+				/* If there is a expire_date, append 'days left' to the text string. */
806
+				else
807
+					echo $expire_date . $date_diff_text;
808
+				break;
837 809
 
838
-        endswitch;
839
-    }
810
+			/* If displaying the 'categorys' column. */
811
+			case 'categorys' :
812
+
813
+				/* Get the categorys for the post. */
814
+
815
+
816
+				$terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
817
+
818
+				/* If terms were found. */
819
+				if (!empty($terms)) {
820
+					$out = array();
821
+					/* Loop through each term, linking to the 'edit posts' page for the specific term. */
822
+					foreach ($terms as $term) {
823
+						if (!strstr($term->taxonomy, 'tag')) {
824
+							$out[] = sprintf('<a href="%s">%s</a>',
825
+								esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
826
+								esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
827
+							);
828
+						}
829
+					}
830
+					/* Join the terms, separating them with a comma. */
831
+					echo(join(', ', $out));
832
+				} /* If no terms were found, output a default message. */
833
+				else {
834
+					_e('No Categories', 'geodirectory');
835
+				}
836
+				break;
837
+
838
+		endswitch;
839
+	}
840 840
 }
841 841
 
842 842
 
843 843
 if (!function_exists('geodir_post_sortable_columns')) {
844
-    /**
845
-     * Makes admin post listing page columns sortable.
846
-     *
847
-     * @since 1.0.0
848
-     * @package GeoDirectory
849
-     * @param array $columns The column array.
850
-     * @return array Altered column array.
851
-     */
852
-    function geodir_post_sortable_columns($columns)
853
-    {
854
-
855
-        $columns['expire'] = 'expire';
856
-
857
-        return $columns;
858
-    }
844
+	/**
845
+	 * Makes admin post listing page columns sortable.
846
+	 *
847
+	 * @since 1.0.0
848
+	 * @package GeoDirectory
849
+	 * @param array $columns The column array.
850
+	 * @return array Altered column array.
851
+	 */
852
+	function geodir_post_sortable_columns($columns)
853
+	{
854
+
855
+		$columns['expire'] = 'expire';
856
+
857
+		return $columns;
858
+	}
859 859
 }
860 860
 
861 861
 /**
@@ -869,32 +869,32 @@  discard block
 block discarded – undo
869 869
  * @param int $post_id The post ID.
870 870
  */
871 871
 function geodir_post_information_save($post_id, $post) {
872
-    global $wpdb, $current_user;
872
+	global $wpdb, $current_user;
873 873
 
874
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
875
-        return;
876
-    }
874
+	if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
875
+		return;
876
+	}
877 877
 
878
-    $geodir_posttypes = geodir_get_posttypes();
878
+	$geodir_posttypes = geodir_get_posttypes();
879 879
 
880
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
881
-        return;
880
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
881
+		return;
882 882
 
883
-    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
884
-        if (isset($_REQUEST['_status']))
885
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
883
+	if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
884
+		if (isset($_REQUEST['_status']))
885
+			geodir_change_post_status($post_id, $_REQUEST['_status']);
886 886
 
887
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
888
-            return;
887
+		if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
888
+			return;
889 889
 
890
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
891
-            return;
890
+		if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
891
+			return;
892 892
 
893
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
894
-            return;
893
+		if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
894
+			return;
895 895
 
896
-        geodir_save_listing($_REQUEST);
897
-    }
896
+		geodir_save_listing($_REQUEST);
897
+	}
898 898
 }
899 899
 
900 900
 /**
@@ -910,102 +910,102 @@  discard block
 block discarded – undo
910 910
  */
911 911
 function geodir_admin_fields($options)
912 912
 {
913
-    global $geodirectory;
914
-
915
-    $first_title = true;
916
-    $tab_id = '';
917
-    $i = 0;
918
-    foreach ($options as $value) :
919
-        if (!isset($value['name'])) $value['name'] = '';
920
-        if (!isset($value['class'])) $value['class'] = '';
921
-        if (!isset($value['css'])) $value['css'] = '';
922
-        if (!isset($value['std'])) $value['std'] = '';
923
-        $desc = '';
924
-        switch ($value['type']) :
925
-            case 'dummy_installer':
926
-                $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
927
-                geodir_autoinstall_admin_header($post_type);
928
-                break;
929
-            case 'title':
930
-
931
-                if ($i == 0) {
932
-                    echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
933
-                    echo '<div class="inner_content_tab_main">';
934
-                }
913
+	global $geodirectory;
914
+
915
+	$first_title = true;
916
+	$tab_id = '';
917
+	$i = 0;
918
+	foreach ($options as $value) :
919
+		if (!isset($value['name'])) $value['name'] = '';
920
+		if (!isset($value['class'])) $value['class'] = '';
921
+		if (!isset($value['css'])) $value['css'] = '';
922
+		if (!isset($value['std'])) $value['std'] = '';
923
+		$desc = '';
924
+		switch ($value['type']) :
925
+			case 'dummy_installer':
926
+				$post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
927
+				geodir_autoinstall_admin_header($post_type);
928
+				break;
929
+			case 'title':
930
+
931
+				if ($i == 0) {
932
+					echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
933
+					echo '<div class="inner_content_tab_main">';
934
+				}
935 935
 
936
-                $i++;
936
+				$i++;
937 937
 
938
-                if (isset($value['id']) && $value['id'])
939
-                    $tab_id = $value['id'];
938
+				if (isset($value['id']) && $value['id'])
939
+					$tab_id = $value['id'];
940 940
 
941
-                if (isset($value['desc']) && $value['desc'])
942
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
941
+				if (isset($value['desc']) && $value['desc'])
942
+					$desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
943 943
 
944
-                if (isset($value['name']) && $value['name']) {
945
-                    if ($first_title === true) {
946
-                        $first_title = false;
947
-                    } else {
948
-                        echo '</div>';
949
-                    }
950
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
944
+				if (isset($value['name']) && $value['name']) {
945
+					if ($first_title === true) {
946
+						$first_title = false;
947
+					} else {
948
+						echo '</div>';
949
+					}
950
+					echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
951 951
 
952
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
953
-                }
952
+					echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
953
+				}
954 954
 
955
-                /**
956
-                 * Called after a GeoDirectory settings title is output in the GD settings page.
957
-                 *
958
-                 * The action is called dynamically geodir_settings_$value['id'].
959
-                 *
960
-                 * @since 1.0.0
961
-                 */
962
-                do_action('geodir_settings_' . sanitize_title($value['id']));
963
-                break;
964
-
965
-            case 'no_tabs':
966
-
967
-                echo '<div class="inner_content_tab_main">';
968
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
969
-
970
-                break;
971
-
972
-            case 'sectionstart':
973
-                if (isset($value['desc']) && $value['desc'])
974
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
975
-                if (isset($value['name']) && $value['name'])
976
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
977
-                /**
978
-                 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
979
-                 *
980
-                 * The action is called dynamically geodir_settings_$value['id']_start.
981
-                 *
982
-                 * @since 1.0.0
983
-                 */
984
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
985
-                echo '<table class="form-table">' . "\n\n";
986
-
987
-                break;
988
-            case 'sectionend':
989
-                /**
990
-                 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
991
-                 *
992
-                 * The action is called dynamically geodir_settings_$value['id']_end.
993
-                 *
994
-                 * @since 1.0.0
995
-                 */
996
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
997
-                echo '</table>';
998
-                /**
999
-                 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1000
-                 *
1001
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1002
-                 *
1003
-                 * @since 1.0.0
1004
-                 */
1005
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1006
-                break;
1007
-            case 'text':
1008
-                ?>
955
+				/**
956
+				 * Called after a GeoDirectory settings title is output in the GD settings page.
957
+				 *
958
+				 * The action is called dynamically geodir_settings_$value['id'].
959
+				 *
960
+				 * @since 1.0.0
961
+				 */
962
+				do_action('geodir_settings_' . sanitize_title($value['id']));
963
+				break;
964
+
965
+			case 'no_tabs':
966
+
967
+				echo '<div class="inner_content_tab_main">';
968
+				echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
969
+
970
+				break;
971
+
972
+			case 'sectionstart':
973
+				if (isset($value['desc']) && $value['desc'])
974
+					$desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
975
+				if (isset($value['name']) && $value['name'])
976
+					echo '<h3>' . $value['name'] . $desc . '</h3>';
977
+				/**
978
+				 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
979
+				 *
980
+				 * The action is called dynamically geodir_settings_$value['id']_start.
981
+				 *
982
+				 * @since 1.0.0
983
+				 */
984
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
985
+				echo '<table class="form-table">' . "\n\n";
986
+
987
+				break;
988
+			case 'sectionend':
989
+				/**
990
+				 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
991
+				 *
992
+				 * The action is called dynamically geodir_settings_$value['id']_end.
993
+				 *
994
+				 * @since 1.0.0
995
+				 */
996
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
997
+				echo '</table>';
998
+				/**
999
+				 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1000
+				 *
1001
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1002
+				 *
1003
+				 * @since 1.0.0
1004
+				 */
1005
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1006
+				break;
1007
+			case 'text':
1008
+				?>
1009 1009
                 <tr valign="top">
1010 1010
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1011 1011
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1014,15 +1014,15 @@  discard block
 block discarded – undo
1014 1014
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1015 1015
                                            style=" <?php echo esc_attr($value['css']); ?>"
1016 1016
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1017
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1018
-                                           } else {
1019
-                                               echo esc_attr($value['std']);
1020
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1017
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1018
+										   } else {
1019
+											   echo esc_attr($value['std']);
1020
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1021 1021
                 </tr><?php
1022
-                break;
1022
+				break;
1023 1023
 
1024
-            case 'map-key':
1025
-                ?>
1024
+			case 'map-key':
1025
+				?>
1026 1026
                 <tr valign="top">
1027 1027
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1028 1028
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1031,18 +1031,18 @@  discard block
 block discarded – undo
1031 1031
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1032 1032
                                            style=" <?php echo esc_attr($value['css']); ?>"
1033 1033
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1034
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1035
-                                           } else {
1036
-                                               echo esc_attr($value['std']);
1037
-                                           } ?>"/>
1034
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1035
+										   } else {
1036
+											   echo esc_attr($value['std']);
1037
+										   } ?>"/>
1038 1038
                     <?php $gm_api_url = 'https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]';?>
1039 1039
                     <a id="gd-api-key" onclick='window.open("<?php echo wp_slash($gm_api_url);?>", "newwindow", "width=600, height=400"); return false;' href='<?php echo $gm_api_url;?>' class="button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )','geodirectory');?>" ><?php _e('Generate API Key','geodirectory');?></a>
1040 1040
                     <span class="description"><?php echo $value['desc']; ?></span></td>
1041 1041
                 </tr><?php
1042
-                break;
1042
+				break;
1043 1043
 
1044
-            case 'password':
1045
-                ?>
1044
+			case 'password':
1045
+				?>
1046 1046
                 <tr valign="top">
1047 1047
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1048 1048
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1051,42 +1051,42 @@  discard block
 block discarded – undo
1051 1051
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1052 1052
                                            style="<?php echo esc_attr($value['css']); ?>"
1053 1053
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1054
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1055
-                                           } else {
1056
-                                               echo esc_attr($value['std']);
1057
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1054
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1055
+										   } else {
1056
+											   echo esc_attr($value['std']);
1057
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1058 1058
                 </tr><?php
1059
-                break;
1059
+				break;
1060 1060
 
1061
-            case 'html_content':
1062
-                ?>
1061
+			case 'html_content':
1062
+				?>
1063 1063
                 <tr valign="top">
1064 1064
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1065 1065
                 <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td>
1066 1066
                 </tr><?php
1067
-                break;
1067
+				break;
1068 1068
 
1069
-            case 'color' :
1070
-                ?>
1069
+			case 'color' :
1070
+				?>
1071 1071
                 <tr valign="top">
1072 1072
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1073 1073
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1074 1074
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
1075 1075
                                            style="<?php echo esc_attr($value['css']); ?>"
1076 1076
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1077
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1078
-                                           } else {
1079
-                                               echo esc_attr($value['std']);
1080
-                                           } ?>" class="colorpick"/> <span
1077
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1078
+										   } else {
1079
+											   echo esc_attr($value['std']);
1080
+										   } ?>" class="colorpick"/> <span
1081 1081
                         class="description"><?php echo $value['desc']; ?></span>
1082 1082
 
1083 1083
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
1084 1084
                          style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
1085 1085
                 </td>
1086 1086
                 </tr><?php
1087
-                break;
1088
-            case 'image_width' :
1089
-                ?>
1087
+				break;
1088
+			case 'image_width' :
1089
+				?>
1090 1090
                 <tr valign="top">
1091 1091
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1092 1092
                 <td class="forminp">
@@ -1108,11 +1108,11 @@  discard block
 block discarded – undo
1108 1108
 
1109 1109
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1110 1110
                 </tr><?php
1111
-                break;
1112
-            case 'select':
1113
-                $option_value = get_option($value['id']);
1114
-                $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1115
-                ?>
1111
+				break;
1112
+			case 'select':
1113
+				$option_value = get_option($value['id']);
1114
+				$option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1115
+				?>
1116 1116
                 <tr valign="top">
1117 1117
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1118 1118
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1121,33 +1121,33 @@  discard block
 block discarded – undo
1121 1121
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1122 1122
                                             option-ajaxchosen="false">
1123 1123
                         <?php
1124
-                        foreach ($value['options'] as $key => $val) {
1125
-                            $geodir_select_value = '';
1126
-                            if ($option_value != '') {
1127
-                                if ($option_value != '' && $option_value == $key)
1128
-                                    $geodir_select_value = ' selected="selected" ';
1129
-                            } else {
1130
-                                if ($value['std'] == $key)
1131
-                                    $geodir_select_value = ' selected="selected" ';
1132
-                            }
1133
-                            ?>
1124
+						foreach ($value['options'] as $key => $val) {
1125
+							$geodir_select_value = '';
1126
+							if ($option_value != '') {
1127
+								if ($option_value != '' && $option_value == $key)
1128
+									$geodir_select_value = ' selected="selected" ';
1129
+							} else {
1130
+								if ($value['std'] == $key)
1131
+									$geodir_select_value = ' selected="selected" ';
1132
+							}
1133
+							?>
1134 1134
                             <option
1135 1135
                                 value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo geodir_utf8_ucfirst($val) ?></option>
1136 1136
                         <?php
1137
-                        }
1138
-                        ?>
1137
+						}
1138
+						?>
1139 1139
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1140 1140
                 </td>
1141 1141
                 </tr><?php
1142
-                break;
1142
+				break;
1143 1143
 
1144
-            case 'multiselect':
1145
-                $option_values = get_option($value['id']);
1146
-                if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1147
-                   $option_values = $value['std'];
1148
-                }
1149
-                $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1150
-                ?>
1144
+			case 'multiselect':
1145
+				$option_values = get_option($value['id']);
1146
+				if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1147
+				   $option_values = $value['std'];
1148
+				}
1149
+				$option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1150
+				?>
1151 1151
                 <tr valign="top">
1152 1152
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1153 1153
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
@@ -1157,26 +1157,26 @@  discard block
 block discarded – undo
1157 1157
                                             data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1158 1158
                                             option-ajaxchosen="false">
1159 1159
                         <?php
1160
-                        foreach ($value['options'] as $key => $val) {
1161
-                            if (strpos($key, 'optgroup_start-') === 0) {
1162
-                                ?><optgroup label="<?php echo geodir_utf8_ucfirst($val); ?>"><?php
1163
-                            } else if (strpos($key, 'optgroup_end-') === 0) {
1164
-                                ?></optgroup><?php
1165
-                            } else {
1166
-                                ?>
1160
+						foreach ($value['options'] as $key => $val) {
1161
+							if (strpos($key, 'optgroup_start-') === 0) {
1162
+								?><optgroup label="<?php echo geodir_utf8_ucfirst($val); ?>"><?php
1163
+							} else if (strpos($key, 'optgroup_end-') === 0) {
1164
+								?></optgroup><?php
1165
+							} else {
1166
+								?>
1167 1167
                                 <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>>
1168 1168
                                     <?php echo geodir_utf8_ucfirst($val) ?>
1169 1169
                                 </option>
1170 1170
                             <?php
1171
-                            }
1172
-                        }
1173
-                        ?>
1171
+							}
1172
+						}
1173
+						?>
1174 1174
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1175 1175
                 </td>
1176 1176
                 </tr><?php
1177
-                break;
1178
-            case 'file':
1179
-                ?>
1177
+				break;
1178
+			case 'file':
1179
+				?>
1180 1180
                 <tr valign="top">
1181 1181
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1182 1182
                 <td class="forminp">
@@ -1196,87 +1196,87 @@  discard block
 block discarded – undo
1196 1196
                     <?php } ?>
1197 1197
                 </td>
1198 1198
                 </tr><?php
1199
-                break;
1200
-            case 'map_default_settings' :
1201
-                ?>
1199
+				break;
1200
+			case 'map_default_settings' :
1201
+				?>
1202 1202
 
1203 1203
                 <tr valign="top">
1204 1204
                     <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1205 1205
                     <td width="60%">
1206 1206
                         <select name="geodir_default_map_language" style="width:60%">
1207 1207
                             <?php
1208
-                            $arr_map_langages = array(
1209
-                                'ar' => __('ARABIC', 'geodirectory'),
1210
-                                'eu' => __('BASQUE', 'geodirectory'),
1211
-                                'bg' => __('BULGARIAN', 'geodirectory'),
1212
-                                'bn' => __('BENGALI', 'geodirectory'),
1213
-                                'ca' => __('CATALAN', 'geodirectory'),
1214
-                                'cs' => __('CZECH', 'geodirectory'),
1215
-                                'da' => __('DANISH', 'geodirectory'),
1216
-                                'de' => __('GERMAN', 'geodirectory'),
1217
-                                'el' => __('GREEK', 'geodirectory'),
1218
-                                'en' => __('ENGLISH', 'geodirectory'),
1219
-                                'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1220
-                                'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1221
-                                'es' => __('SPANISH', 'geodirectory'),
1222
-                                'eu' => __('BASQUE', 'geodirectory'),
1223
-                                'fa' => __('FARSI', 'geodirectory'),
1224
-                                'fi' => __('FINNISH', 'geodirectory'),
1225
-                                'fil' => __('FILIPINO', 'geodirectory'),
1226
-                                'fr' => __('FRENCH', 'geodirectory'),
1227
-                                'gl' => __('GALICIAN', 'geodirectory'),
1228
-                                'gu' => __('GUJARATI', 'geodirectory'),
1229
-                                'hi' => __('HINDI', 'geodirectory'),
1230
-                                'hr' => __('CROATIAN', 'geodirectory'),
1231
-                                'hu' => __('HUNGARIAN', 'geodirectory'),
1232
-                                'id' => __('INDONESIAN', 'geodirectory'),
1233
-                                'it' => __('ITALIAN', 'geodirectory'),
1234
-                                'iw' => __('HEBREW', 'geodirectory'),
1235
-                                'ja' => __('JAPANESE', 'geodirectory'),
1236
-                                'kn' => __('KANNADA', 'geodirectory'),
1237
-                                'ko' => __('KOREAN', 'geodirectory'),
1238
-                                'lt' => __('LITHUANIAN', 'geodirectory'),
1239
-                                'lv' => __('LATVIAN', 'geodirectory'),
1240
-                                'ml' => __('MALAYALAM', 'geodirectory'),
1241
-                                'mr' => __('MARATHI', 'geodirectory'),
1242
-                                'nl' => __('DUTCH', 'geodirectory'),
1243
-                                'no' => __('NORWEGIAN', 'geodirectory'),
1244
-                                'pl' => __('POLISH', 'geodirectory'),
1245
-                                'pt' => __('PORTUGUESE', 'geodirectory'),
1246
-                                'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1247
-                                'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1248
-                                'ro' => __('ROMANIAN', 'geodirectory'),
1249
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1250
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1251
-                                'sk' => __('SLOVAK', 'geodirectory'),
1252
-                                'sl' => __('SLOVENIAN', 'geodirectory'),
1253
-                                'sr' => __('SERBIAN', 'geodirectory'),
1254
-                                'sv' => __('	SWEDISH', 'geodirectory'),
1255
-                                'tl' => __('TAGALOG', 'geodirectory'),
1256
-                                'ta' => __('TAMIL', 'geodirectory'),
1257
-                                'te' => __('TELUGU', 'geodirectory'),
1258
-                                'th' => __('THAI', 'geodirectory'),
1259
-                                'tr' => __('TURKISH', 'geodirectory'),
1260
-                                'uk' => __('UKRAINIAN', 'geodirectory'),
1261
-                                'vi' => __('VIETNAMESE', 'geodirectory'),
1262
-                                'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1263
-                                'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1264
-                            );
1265
-                            $geodir_default_map_language = get_option('geodir_default_map_language');
1266
-                            if (empty($geodir_default_map_language))
1267
-                                $geodir_default_map_language = 'en';
1268
-                            foreach ($arr_map_langages as $language_key => $language_txt) {
1269
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1270
-                                    $geodir_default_language_selected = "selected='selected'";
1271
-                                else
1272
-                                    $geodir_default_language_selected = '';
1273
-
1274
-                                ?>
1208
+							$arr_map_langages = array(
1209
+								'ar' => __('ARABIC', 'geodirectory'),
1210
+								'eu' => __('BASQUE', 'geodirectory'),
1211
+								'bg' => __('BULGARIAN', 'geodirectory'),
1212
+								'bn' => __('BENGALI', 'geodirectory'),
1213
+								'ca' => __('CATALAN', 'geodirectory'),
1214
+								'cs' => __('CZECH', 'geodirectory'),
1215
+								'da' => __('DANISH', 'geodirectory'),
1216
+								'de' => __('GERMAN', 'geodirectory'),
1217
+								'el' => __('GREEK', 'geodirectory'),
1218
+								'en' => __('ENGLISH', 'geodirectory'),
1219
+								'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1220
+								'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1221
+								'es' => __('SPANISH', 'geodirectory'),
1222
+								'eu' => __('BASQUE', 'geodirectory'),
1223
+								'fa' => __('FARSI', 'geodirectory'),
1224
+								'fi' => __('FINNISH', 'geodirectory'),
1225
+								'fil' => __('FILIPINO', 'geodirectory'),
1226
+								'fr' => __('FRENCH', 'geodirectory'),
1227
+								'gl' => __('GALICIAN', 'geodirectory'),
1228
+								'gu' => __('GUJARATI', 'geodirectory'),
1229
+								'hi' => __('HINDI', 'geodirectory'),
1230
+								'hr' => __('CROATIAN', 'geodirectory'),
1231
+								'hu' => __('HUNGARIAN', 'geodirectory'),
1232
+								'id' => __('INDONESIAN', 'geodirectory'),
1233
+								'it' => __('ITALIAN', 'geodirectory'),
1234
+								'iw' => __('HEBREW', 'geodirectory'),
1235
+								'ja' => __('JAPANESE', 'geodirectory'),
1236
+								'kn' => __('KANNADA', 'geodirectory'),
1237
+								'ko' => __('KOREAN', 'geodirectory'),
1238
+								'lt' => __('LITHUANIAN', 'geodirectory'),
1239
+								'lv' => __('LATVIAN', 'geodirectory'),
1240
+								'ml' => __('MALAYALAM', 'geodirectory'),
1241
+								'mr' => __('MARATHI', 'geodirectory'),
1242
+								'nl' => __('DUTCH', 'geodirectory'),
1243
+								'no' => __('NORWEGIAN', 'geodirectory'),
1244
+								'pl' => __('POLISH', 'geodirectory'),
1245
+								'pt' => __('PORTUGUESE', 'geodirectory'),
1246
+								'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1247
+								'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1248
+								'ro' => __('ROMANIAN', 'geodirectory'),
1249
+								'ru' => __('RUSSIAN', 'geodirectory'),
1250
+								'ru' => __('RUSSIAN', 'geodirectory'),
1251
+								'sk' => __('SLOVAK', 'geodirectory'),
1252
+								'sl' => __('SLOVENIAN', 'geodirectory'),
1253
+								'sr' => __('SERBIAN', 'geodirectory'),
1254
+								'sv' => __('	SWEDISH', 'geodirectory'),
1255
+								'tl' => __('TAGALOG', 'geodirectory'),
1256
+								'ta' => __('TAMIL', 'geodirectory'),
1257
+								'te' => __('TELUGU', 'geodirectory'),
1258
+								'th' => __('THAI', 'geodirectory'),
1259
+								'tr' => __('TURKISH', 'geodirectory'),
1260
+								'uk' => __('UKRAINIAN', 'geodirectory'),
1261
+								'vi' => __('VIETNAMESE', 'geodirectory'),
1262
+								'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1263
+								'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1264
+							);
1265
+							$geodir_default_map_language = get_option('geodir_default_map_language');
1266
+							if (empty($geodir_default_map_language))
1267
+								$geodir_default_map_language = 'en';
1268
+							foreach ($arr_map_langages as $language_key => $language_txt) {
1269
+								if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1270
+									$geodir_default_language_selected = "selected='selected'";
1271
+								else
1272
+									$geodir_default_language_selected = '';
1273
+
1274
+								?>
1275 1275
                                 <option
1276 1276
                                     value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option>
1277 1277
 
1278 1278
                             <?php }
1279
-                            ?>
1279
+							?>
1280 1280
                         </select>
1281 1281
                     </td>
1282 1282
                 </tr>
@@ -1287,46 +1287,46 @@  discard block
 block discarded – undo
1287 1287
                     <td width="60%">
1288 1288
                         <select name="geodir_default_map_search_pt" style="width:60%">
1289 1289
                             <?php
1290
-                            $post_types = geodir_get_posttypes('array');
1291
-                            $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1292
-                            if (empty($geodir_default_map_search_pt))
1293
-                                $geodir_default_map_search_pt = 'gd_place';
1294
-                            if (is_array($post_types)) {
1295
-                                foreach ($post_types as $key => $post_types_obj) {
1296
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1297
-                                        $geodir_search_pt_selected = "selected='selected'";
1298
-                                    else
1299
-                                        $geodir_search_pt_selected = '';
1300
-
1301
-                                    ?>
1290
+							$post_types = geodir_get_posttypes('array');
1291
+							$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1292
+							if (empty($geodir_default_map_search_pt))
1293
+								$geodir_default_map_search_pt = 'gd_place';
1294
+							if (is_array($post_types)) {
1295
+								foreach ($post_types as $key => $post_types_obj) {
1296
+									if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1297
+										$geodir_search_pt_selected = "selected='selected'";
1298
+									else
1299
+										$geodir_search_pt_selected = '';
1300
+
1301
+									?>
1302 1302
                                     <option
1303 1303
                                         value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo __($post_types_obj['labels']['singular_name'], 'geodirectory'); ?></option>
1304 1304
 
1305 1305
                                 <?php }
1306 1306
 
1307
-                            }
1307
+							}
1308 1308
 
1309
-                            ?>
1309
+							?>
1310 1310
                         </select>
1311 1311
                     </td>
1312 1312
                 </tr>
1313 1313
 
1314 1314
                 <?php
1315
-                break;
1315
+				break;
1316 1316
 
1317
-            case 'map':
1318
-                ?>
1317
+			case 'map':
1318
+				?>
1319 1319
                 <tr valign="top">
1320 1320
                     <td class="forminp">
1321 1321
                         <?php
1322
-                        global $post_cat, $cat_display;
1323
-                        $post_types = geodir_get_posttypes('object');
1324
-                        $cat_display = 'checkbox';
1325
-                        $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1326
-                        $gd_cats = get_option('geodir_exclude_cat_on_map');
1327
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1328
-                        $count = 1;
1329
-                        ?>
1322
+						global $post_cat, $cat_display;
1323
+						$post_types = geodir_get_posttypes('object');
1324
+						$cat_display = 'checkbox';
1325
+						$gd_post_types = get_option('geodir_exclude_post_type_on_map');
1326
+						$gd_cats = get_option('geodir_exclude_cat_on_map');
1327
+						$gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1328
+						$count = 1;
1329
+						?>
1330 1330
                         <table width="70%" class="widefat">
1331 1331
                             <thead>
1332 1332
                             <tr>
@@ -1335,18 +1335,18 @@  discard block
 block discarded – undo
1335 1335
                                 <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th>
1336 1336
                             </tr>
1337 1337
                             <?php
1338
-                            $gd_categs = $gd_cats;
1339
-                            foreach ($post_types as $key => $post_types_obj) :
1340
-                                $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1341
-                                $gd_taxonomy = geodir_get_taxonomies($key);
1342
-                                if ($gd_cats_upgrade) {
1343
-                                    $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1344
-                                    $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1345
-                                    $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1346
-                                }
1347
-                                $post_cat = implode(',', $gd_cats);
1348
-                                $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1349
-                                ?>
1338
+							$gd_categs = $gd_cats;
1339
+							foreach ($post_types as $key => $post_types_obj) :
1340
+								$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1341
+								$gd_taxonomy = geodir_get_taxonomies($key);
1342
+								if ($gd_cats_upgrade) {
1343
+									$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1344
+									$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1345
+									$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1346
+								}
1347
+								$post_cat = implode(',', $gd_cats);
1348
+								$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1349
+								?>
1350 1350
                                 <tr>
1351 1351
                                     <td valign="top" width="5%"><?php echo $count; ?></td>
1352 1352
                                     <td valign="top" width="25%" id="td_post_types"><input type="checkbox"
@@ -1367,19 +1367,19 @@  discard block
 block discarded – undo
1367 1367
                     </td>
1368 1368
                 </tr>
1369 1369
                 <?php
1370
-                break;
1370
+				break;
1371 1371
 
1372
-            case 'checkbox' :
1372
+			case 'checkbox' :
1373 1373
 
1374
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1375
-                    ?>
1374
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1375
+					?>
1376 1376
                     <tr valign="top">
1377 1377
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1378 1378
                     <td class="forminp">
1379 1379
                 <?php
1380
-                endif;
1380
+				endif;
1381 1381
 
1382
-                ?>
1382
+				?>
1383 1383
                 <fieldset>
1384 1384
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1385 1385
                     <label for="<?php echo $value['id'] ?>">
@@ -1389,49 +1389,49 @@  discard block
 block discarded – undo
1389 1389
                 </fieldset>
1390 1390
                 <?php
1391 1391
 
1392
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1393
-                    ?>
1392
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1393
+					?>
1394 1394
                     </td>
1395 1395
                     </tr>
1396 1396
                 <?php
1397
-                endif;
1397
+				endif;
1398 1398
 
1399
-                break;
1399
+				break;
1400 1400
 
1401
-            case 'radio' :
1401
+			case 'radio' :
1402 1402
 
1403
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1404
-                    ?>
1403
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1404
+					?>
1405 1405
                     <tr valign="top">
1406 1406
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1407 1407
                     <td class="forminp">
1408 1408
                 <?php
1409
-                endif;
1409
+				endif;
1410 1410
 
1411
-                ?>
1411
+				?>
1412 1412
                 <fieldset>
1413 1413
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1414 1414
                     <label for="<?php echo $value['id'];?>">
1415 1415
                         <input name="<?php echo esc_attr($value['id']); ?>"
1416 1416
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1417 1417
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1418
-                            echo 'checked="checked"';
1419
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1418
+							echo 'checked="checked"';
1419
+						}elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1420 1420
                         <?php echo $value['desc']; ?></label><br>
1421 1421
                 </fieldset>
1422 1422
                 <?php
1423 1423
 
1424
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1425
-                    ?>
1424
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1425
+					?>
1426 1426
                     </td>
1427 1427
                     </tr>
1428 1428
                 <?php
1429
-                endif;
1429
+				endif;
1430 1430
 
1431
-                break;
1431
+				break;
1432 1432
 
1433
-            case 'textarea':
1434
-                ?>
1433
+			case 'textarea':
1434
+				?>
1435 1435
                 <tr valign="top">
1436 1436
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1437 1437
                 <td class="forminp">
@@ -1444,30 +1444,30 @@  discard block
 block discarded – undo
1444 1444
 
1445 1445
                 </td>
1446 1446
                 </tr><?php
1447
-                break;
1447
+				break;
1448 1448
 
1449
-            case 'editor':
1450
-                ?>
1449
+			case 'editor':
1450
+				?>
1451 1451
                 <tr valign="top">
1452 1452
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1453 1453
                 <td class="forminp"><?php
1454
-                    if (get_option($value['id']))
1455
-                        $content = stripslashes(get_option($value['id']));
1456
-                    else
1457
-                        $content = $value['std'];
1454
+					if (get_option($value['id']))
1455
+						$content = stripslashes(get_option($value['id']));
1456
+					else
1457
+						$content = $value['std'];
1458 1458
 
1459
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1459
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1460 1460
 
1461
-                    wp_editor($content, esc_attr($value['id']), $editor_settings);
1461
+					wp_editor($content, esc_attr($value['id']), $editor_settings);
1462 1462
 
1463
-                    ?> <span class="description"><?php echo $value['desc'] ?></span>
1463
+					?> <span class="description"><?php echo $value['desc'] ?></span>
1464 1464
 
1465 1465
                 </td>
1466 1466
                 </tr><?php
1467
-                break;
1467
+				break;
1468 1468
 
1469
-            case 'single_select_page' :
1470
-                // WPML
1469
+			case 'single_select_page' :
1470
+				// WPML
1471 1471
 				$switch_lang = false;
1472 1472
 				$disabled = '';
1473 1473
 				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -1485,18 +1485,18 @@  discard block
 block discarded – undo
1485 1485
 				//
1486 1486
 				$page_setting = (int)get_option($value['id']);
1487 1487
 
1488
-                $args = array('name' => $value['id'],
1489
-                    'id' => $value['id'],
1490
-                    'sort_column' => 'menu_order',
1491
-                    'sort_order' => 'ASC',
1492
-                    'show_option_none' => ' ',
1493
-                    'class' => $value['class'],
1494
-                    'echo' => false,
1495
-                    'selected' => $page_setting);
1488
+				$args = array('name' => $value['id'],
1489
+					'id' => $value['id'],
1490
+					'sort_column' => 'menu_order',
1491
+					'sort_order' => 'ASC',
1492
+					'show_option_none' => ' ',
1493
+					'class' => $value['class'],
1494
+					'echo' => false,
1495
+					'selected' => $page_setting);
1496 1496
 
1497
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1497
+				if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1498 1498
 
1499
-                ?>
1499
+				?>
1500 1500
                 <tr valign="top" class="single_select_page">
1501 1501
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1502 1502
                 <td class="forminp">
@@ -1507,17 +1507,17 @@  discard block
 block discarded – undo
1507 1507
 				if ($switch_lang) {
1508 1508
 					$sitepress->switch_lang($switch_lang, true);
1509 1509
 				}
1510
-                break;
1511
-            case 'single_select_country' :
1512
-                $country_setting = (string)get_option($value['id']);
1513
-                if (strstr($country_setting, ':')) :
1514
-                    $country = current(explode(':', $country_setting));
1515
-                    $state = end(explode(':', $country_setting));
1516
-                else :
1517
-                    $country = $country_setting;
1518
-                    $state = '*';
1519
-                endif;
1520
-                ?>
1510
+				break;
1511
+			case 'single_select_country' :
1512
+				$country_setting = (string)get_option($value['id']);
1513
+				if (strstr($country_setting, ':')) :
1514
+					$country = current(explode(':', $country_setting));
1515
+					$state = end(explode(':', $country_setting));
1516
+				else :
1517
+					$country = $country_setting;
1518
+					$state = '*';
1519
+				endif;
1520
+				?>
1521 1521
                 <tr valign="top">
1522 1522
                 <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
1523 1523
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1528,12 +1528,12 @@  discard block
 block discarded – undo
1528 1528
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1529 1529
                 </td>
1530 1530
                 </tr><?php
1531
-                break;
1532
-            case 'multi_select_countries' :
1533
-                $countries = $geodirectory->countries->countries;
1534
-                asort($countries);
1535
-                $selections = (array)get_option($value['id']);
1536
-                ?>
1531
+				break;
1532
+			case 'multi_select_countries' :
1533
+				$countries = $geodirectory->countries->countries;
1534
+				asort($countries);
1535
+				$selections = (array)get_option($value['id']);
1536
+				?>
1537 1537
                 <tr valign="top">
1538 1538
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1539 1539
                 <td class="forminp">
@@ -1541,21 +1541,21 @@  discard block
 block discarded – undo
1541 1541
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1542 1542
                             title="Country" class="chosen_select">
1543 1543
                         <?php
1544
-                        if ($countries) foreach ($countries as $key => $val) :
1545
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1546
-                        endforeach;
1547
-                        ?>
1544
+						if ($countries) foreach ($countries as $key => $val) :
1545
+							echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1546
+						endforeach;
1547
+						?>
1548 1548
                     </select>
1549 1549
                 </td>
1550 1550
                 </tr>
1551 1551
 
1552 1552
                 <?php
1553 1553
 
1554
-                break;
1554
+				break;
1555 1555
 
1556
-            case 'google_analytics' :
1557
-                $selections = (array)get_option($value['id']);
1558
-                    ?>
1556
+			case 'google_analytics' :
1557
+				$selections = (array)get_option($value['id']);
1558
+					?>
1559 1559
                     <tr valign="top">
1560 1560
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1561 1561
                         <td class="forminp">
@@ -1563,62 +1563,62 @@  discard block
 block discarded – undo
1563 1563
 
1564 1564
                             <?php
1565 1565
 
1566
-                            $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1567
-                            $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1568
-                            $state = "&state=123";//any string
1569
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1570
-                            $response_type = "&response_type=code";
1571
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1572
-                            $access_type = "&access_type=offline";
1573
-                            $approval_prompt = "&approval_prompt=force";
1566
+							$oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1567
+							$scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1568
+							$state = "&state=123";//any string
1569
+							$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1570
+							$response_type = "&response_type=code";
1571
+							$client_id = "&client_id=".get_option('geodir_ga_client_id');
1572
+							$access_type = "&access_type=offline";
1573
+							$approval_prompt = "&approval_prompt=force";
1574 1574
 
1575
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1575
+							$auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1576 1576
 
1577 1577
 
1578
-                            if (get_option('geodir_ga_auth_token')) {
1579
-                                ?>
1578
+							if (get_option('geodir_ga_auth_token')) {
1579
+								?>
1580 1580
                                 <span class="button-primary"
1581 1581
                                       onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize');?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1582 1582
                                 <span style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1583 1583
                             <?php
1584
-                                global $gd_ga_errors;
1585
-                                if(!empty($gd_ga_errors)){
1586
-                                    print_r($gd_ga_errors);
1587
-                                }
1588
-                            } else {
1589
-                                ?>
1584
+								global $gd_ga_errors;
1585
+								if(!empty($gd_ga_errors)){
1586
+									print_r($gd_ga_errors);
1587
+								}
1588
+							} else {
1589
+								?>
1590 1590
                                 <span class="button-primary"
1591 1591
                                       onclick="window.open('<?php echo  geodir_ga_activation_url();?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory');?></span>
1592 1592
                             <?php
1593
-                            }
1594
-                            ?>
1593
+							}
1594
+							?>
1595 1595
                         </td>
1596 1596
                     </tr>
1597 1597
 
1598 1598
                 <?php
1599 1599
 
1600 1600
 
1601
-                break;
1601
+				break;
1602 1602
 
1603
-            case 'field_seperator' :
1603
+			case 'field_seperator' :
1604 1604
 
1605
-                ?>
1605
+				?>
1606 1606
                 <tr valign="top">
1607 1607
                     <td colspan="2" class="forminp geodir_line_seperator"></td>
1608 1608
                 </tr>
1609 1609
                 <?php
1610 1610
 
1611
-                break;
1611
+				break;
1612 1612
 
1613
-        endswitch;
1613
+		endswitch;
1614 1614
 
1615
-    endforeach;
1615
+	endforeach;
1616 1616
 
1617
-    if ($first_title === false) {
1618
-        echo "</div>";
1619
-    }
1617
+	if ($first_title === false) {
1618
+		echo "</div>";
1619
+	}
1620 1620
 
1621
-    ?>
1621
+	?>
1622 1622
 
1623 1623
     <script type="text/javascript">
1624 1624
 
@@ -1678,33 +1678,33 @@  discard block
 block discarded – undo
1678 1678
  */
1679 1679
 function geodir_post_info_setting()
1680 1680
 {
1681
-    global $post, $post_id;
1682
-
1683
-    $post_type = get_post_type();
1684
-
1685
-    $package_info = array();
1686
-
1687
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1688
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1689
-    echo '<div id="geodir_wrapper">';
1690
-    /**
1691
-     * Called before the GD custom fields are output in the wp-admin area.
1692
-     *
1693
-     * @since 1.0.0
1694
-     * @see 'geodir_after_default_field_in_meta_box'
1695
-     */
1696
-    do_action('geodir_before_default_field_in_meta_box');
1697
-    //geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1698
-    // to display all fields in one information box
1699
-    geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1700
-    /**
1701
-     * Called after the GD custom fields are output in the wp-admin area.
1702
-     *
1703
-     * @since 1.0.0
1704
-     * @see 'geodir_before_default_field_in_meta_box'
1705
-     */
1706
-    do_action('geodir_after_default_field_in_meta_box');
1707
-    echo '</div>';
1681
+	global $post, $post_id;
1682
+
1683
+	$post_type = get_post_type();
1684
+
1685
+	$package_info = array();
1686
+
1687
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1688
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1689
+	echo '<div id="geodir_wrapper">';
1690
+	/**
1691
+	 * Called before the GD custom fields are output in the wp-admin area.
1692
+	 *
1693
+	 * @since 1.0.0
1694
+	 * @see 'geodir_after_default_field_in_meta_box'
1695
+	 */
1696
+	do_action('geodir_before_default_field_in_meta_box');
1697
+	//geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1698
+	// to display all fields in one information box
1699
+	geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1700
+	/**
1701
+	 * Called after the GD custom fields are output in the wp-admin area.
1702
+	 *
1703
+	 * @since 1.0.0
1704
+	 * @see 'geodir_before_default_field_in_meta_box'
1705
+	 */
1706
+	do_action('geodir_after_default_field_in_meta_box');
1707
+	echo '</div>';
1708 1708
 }
1709 1709
 
1710 1710
 /**
@@ -1717,18 +1717,18 @@  discard block
 block discarded – undo
1717 1717
  */
1718 1718
 function geodir_post_addinfo_setting()
1719 1719
 {
1720
-    global $post, $post_id;
1720
+	global $post, $post_id;
1721 1721
 
1722
-    $post_type = get_post_type();
1722
+	$post_type = get_post_type();
1723 1723
 
1724
-    $package_info = array();
1724
+	$package_info = array();
1725 1725
 
1726
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1726
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1727 1727
 
1728
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
1729
-    echo '<div id="geodir_wrapper">';
1730
-    geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
1731
-    echo '</div>';
1728
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
1729
+	echo '<div id="geodir_wrapper">';
1730
+	geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
1731
+	echo '</div>';
1732 1732
 
1733 1733
 }
1734 1734
 
@@ -1742,60 +1742,60 @@  discard block
 block discarded – undo
1742 1742
  */
1743 1743
 function geodir_post_attachments()
1744 1744
 {
1745
-    global $post, $post_id;
1745
+	global $post, $post_id;
1746 1746
 
1747
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1747
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1748 1748
 
1749
-    if (geodir_get_featured_image($post_id, 'thumbnail')) {
1750
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1751
-        geodir_show_featured_image($post_id, 'thumbnail');
1752
-    }
1749
+	if (geodir_get_featured_image($post_id, 'thumbnail')) {
1750
+		echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1751
+		geodir_show_featured_image($post_id, 'thumbnail');
1752
+	}
1753 1753
 
1754
-    $image_limit = 0;
1754
+	$image_limit = 0;
1755 1755
 
1756
-    ?>
1756
+	?>
1757 1757
 
1758 1758
 
1759 1759
     <h5 class="form_title">
1760 1760
         <?php if ($image_limit != 0 && $image_limit == 1) {
1761
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1762
-        } ?>
1761
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1762
+		} ?>
1763 1763
         <?php if ($image_limit != 0 && $image_limit > 1) {
1764
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1765
-        } ?>
1764
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1765
+		} ?>
1766 1766
         <?php if ($image_limit == 0) {
1767
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1768
-        } ?>
1767
+			echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1768
+		} ?>
1769 1769
     </h5>
1770 1770
 
1771 1771
 
1772 1772
     <?php
1773 1773
 
1774
-    $curImages = geodir_get_images($post_id);
1775
-    $place_img_array = array();
1774
+	$curImages = geodir_get_images($post_id);
1775
+	$place_img_array = array();
1776 1776
 
1777
-    if (!empty($curImages)):
1778
-        foreach ($curImages as $p_img):
1779
-            $place_img_array[] = $p_img->src;
1780
-        endforeach;
1781
-    endif;
1777
+	if (!empty($curImages)):
1778
+		foreach ($curImages as $p_img):
1779
+			$place_img_array[] = $p_img->src;
1780
+		endforeach;
1781
+	endif;
1782 1782
 
1783
-    if (!empty($place_img_array))
1784
-        $curImages = implode(',', $place_img_array);
1783
+	if (!empty($place_img_array))
1784
+		$curImages = implode(',', $place_img_array);
1785 1785
 
1786 1786
 
1787
-    // adjust values here
1788
-    $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
1787
+	// adjust values here
1788
+	$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
1789 1789
 
1790
-    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
1790
+	$svalue = $curImages; // this will be initial value of the above form field. Image urls.
1791 1791
 
1792
-    $multiple = true; // allow multiple files upload
1792
+	$multiple = true; // allow multiple files upload
1793 1793
 
1794
-    $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1794
+	$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1795 1795
 
1796
-    $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1796
+	$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1797 1797
 
1798
-    ?>
1798
+	?>
1799 1799
 
1800 1800
     <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;">
1801 1801
         <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/>
@@ -1837,13 +1837,13 @@  discard block
 block discarded – undo
1837 1837
  */
1838 1838
 function geodir_action_post_updated($post_ID, $post_after, $post_before)
1839 1839
 {
1840
-    $post_type = get_post_type($post_ID);
1840
+	$post_type = get_post_type($post_ID);
1841 1841
 
1842
-    if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1843
-        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) {
1844
-            geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
1845
-        }
1846
-    }
1842
+	if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1843
+		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) {
1844
+			geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
1845
+		}
1846
+	}
1847 1847
 }
1848 1848
 
1849 1849
 /**
@@ -1858,39 +1858,39 @@  discard block
 block discarded – undo
1858 1858
  */
1859 1859
 function geodir_notification_add_bcc_option($settings)
1860 1860
 {
1861
-    if (!empty($settings)) {
1862
-        $new_settings = array();
1863
-        foreach ($settings as $setting) {
1864
-            if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
1865
-                $geodir_bcc_listing_published_yes = array(
1866
-                    'name' => __('Listing published', 'geodirectory'),
1867
-                    'desc' => __('Yes', 'geodirectory'),
1868
-                    'id' => 'geodir_bcc_listing_published',
1869
-                    'std' => 'yes',
1870
-                    'type' => 'radio',
1871
-                    'value' => '1',
1872
-                    'radiogroup' => 'start'
1873
-                );
1874
-
1875
-                $geodir_bcc_listing_published_no = array(
1876
-                    'name' => __('Listing published', 'geodirectory'),
1877
-                    'desc' => __('No', 'geodirectory'),
1878
-                    'id' => 'geodir_bcc_listing_published',
1879
-                    'std' => 'yes',
1880
-                    'type' => 'radio',
1881
-                    'value' => '0',
1882
-                    'radiogroup' => 'end'
1883
-                );
1884
-
1885
-                $new_settings[] = $geodir_bcc_listing_published_yes;
1886
-                $new_settings[] = $geodir_bcc_listing_published_no;
1887
-            }
1888
-            $new_settings[] = $setting;
1889
-        }
1890
-        $settings = $new_settings;
1891
-    }
1861
+	if (!empty($settings)) {
1862
+		$new_settings = array();
1863
+		foreach ($settings as $setting) {
1864
+			if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
1865
+				$geodir_bcc_listing_published_yes = array(
1866
+					'name' => __('Listing published', 'geodirectory'),
1867
+					'desc' => __('Yes', 'geodirectory'),
1868
+					'id' => 'geodir_bcc_listing_published',
1869
+					'std' => 'yes',
1870
+					'type' => 'radio',
1871
+					'value' => '1',
1872
+					'radiogroup' => 'start'
1873
+				);
1874
+
1875
+				$geodir_bcc_listing_published_no = array(
1876
+					'name' => __('Listing published', 'geodirectory'),
1877
+					'desc' => __('No', 'geodirectory'),
1878
+					'id' => 'geodir_bcc_listing_published',
1879
+					'std' => 'yes',
1880
+					'type' => 'radio',
1881
+					'value' => '0',
1882
+					'radiogroup' => 'end'
1883
+				);
1884
+
1885
+				$new_settings[] = $geodir_bcc_listing_published_yes;
1886
+				$new_settings[] = $geodir_bcc_listing_published_no;
1887
+			}
1888
+			$new_settings[] = $setting;
1889
+		}
1890
+		$settings = $new_settings;
1891
+	}
1892 1892
 
1893
-    return $settings;
1893
+	return $settings;
1894 1894
 }
1895 1895
 
1896 1896
 
@@ -1905,19 +1905,19 @@  discard block
 block discarded – undo
1905 1905
  */
1906 1906
 function get_gd_theme_compat_callback()
1907 1907
 {
1908
-    global $wpdb;
1909
-    $themes = get_option('gd_theme_compats');
1910
-
1911
-    if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
1912
-        if (isset($_POST['export'])) {
1913
-            echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
1914
-        } else {
1915
-            echo json_encode($themes[$_POST['theme']]);
1916
-        }
1908
+	global $wpdb;
1909
+	$themes = get_option('gd_theme_compats');
1917 1910
 
1918
-    }
1911
+	if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
1912
+		if (isset($_POST['export'])) {
1913
+			echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
1914
+		} else {
1915
+			echo json_encode($themes[$_POST['theme']]);
1916
+		}
1919 1917
 
1920
-    die();
1918
+	}
1919
+
1920
+	die();
1921 1921
 }
1922 1922
 
1923 1923
 add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
@@ -1931,20 +1931,20 @@  discard block
 block discarded – undo
1931 1931
  */
1932 1932
 function get_gd_theme_compat_import_callback()
1933 1933
 {
1934
-    global $wpdb;
1935
-    $themes = get_option('gd_theme_compats');
1936
-    if (isset($_POST['theme']) && !empty($_POST['theme'])) {
1937
-        $json = json_decode(stripslashes($_POST['theme']), true);
1938
-        if (!empty($json) && is_array($json)) {
1939
-            $key = sanitize_text_field(key($json));
1940
-            $themes[$key] = $json[$key];
1941
-            update_option('gd_theme_compats', $themes);
1942
-            echo $key;
1943
-            die();
1944
-        }
1945
-    }
1946
-    echo '0';
1947
-    die();
1934
+	global $wpdb;
1935
+	$themes = get_option('gd_theme_compats');
1936
+	if (isset($_POST['theme']) && !empty($_POST['theme'])) {
1937
+		$json = json_decode(stripslashes($_POST['theme']), true);
1938
+		if (!empty($json) && is_array($json)) {
1939
+			$key = sanitize_text_field(key($json));
1940
+			$themes[$key] = $json[$key];
1941
+			update_option('gd_theme_compats', $themes);
1942
+			echo $key;
1943
+			die();
1944
+		}
1945
+	}
1946
+	echo '0';
1947
+	die();
1948 1948
 }
1949 1949
 
1950 1950
 
@@ -1957,39 +1957,39 @@  discard block
 block discarded – undo
1957 1957
  */
1958 1958
 function gd_set_theme_compat()
1959 1959
 {
1960
-    global $wpdb;
1961
-    $theme = wp_get_theme();
1960
+	global $wpdb;
1961
+	$theme = wp_get_theme();
1962 1962
 
1963
-    if ($theme->parent()) {
1964
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
1965
-    } else {
1966
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
1967
-    }
1963
+	if ($theme->parent()) {
1964
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
1965
+	} else {
1966
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
1967
+	}
1968 1968
 
1969
-    $theme_compats = get_option('gd_theme_compats');
1970
-    $current_compat = get_option('gd_theme_compat');
1971
-    $current_compat = str_replace("_custom", "", $current_compat);
1969
+	$theme_compats = get_option('gd_theme_compats');
1970
+	$current_compat = get_option('gd_theme_compat');
1971
+	$current_compat = str_replace("_custom", "", $current_compat);
1972 1972
  
1973
-    if ($current_compat == $theme_name && strpos(get_option('gd_theme_compat'), "_custom") !== false) {
1974
-        return;
1975
-    }// if already running correct compat then bail
1973
+	if ($current_compat == $theme_name && strpos(get_option('gd_theme_compat'), "_custom") !== false) {
1974
+		return;
1975
+	}// if already running correct compat then bail
1976 1976
 
1977
-    if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
1978
-        update_option('gd_theme_compat', $theme_name);
1979
-        update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
1977
+	if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
1978
+		update_option('gd_theme_compat', $theme_name);
1979
+		update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
1980 1980
 
1981
-        // if there are default options to set then set them
1982
-        if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
1981
+		// if there are default options to set then set them
1982
+		if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
1983 1983
 
1984
-            foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
1985
-                update_option($key, $val);
1986
-            }
1987
-        }
1984
+			foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
1985
+				update_option($key, $val);
1986
+			}
1987
+		}
1988 1988
 
1989
-    } else {
1990
-        update_option('gd_theme_compat', '');
1991
-        update_option('theme_compatibility_setting', '');
1992
-    }
1989
+	} else {
1990
+		update_option('gd_theme_compat', '');
1991
+		update_option('theme_compatibility_setting', '');
1992
+	}
1993 1993
 
1994 1994
 
1995 1995
 }
@@ -2004,9 +2004,9 @@  discard block
 block discarded – undo
2004 2004
  */
2005 2005
 function gd_check_avada_compat()
2006 2006
 {
2007
-    if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2008
-        add_action('admin_notices', 'gd_avada_compat_warning');
2009
-    }
2007
+	if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2008
+		add_action('admin_notices', 'gd_avada_compat_warning');
2009
+	}
2010 2010
 }
2011 2011
 
2012 2012
 
@@ -2019,22 +2019,22 @@  discard block
 block discarded – undo
2019 2019
 function gd_avada_compat_warning()
2020 2020
 {
2021 2021
 
2022
-    /*
2022
+	/*
2023 2023
     $msg_type = error
2024 2024
     $msg_type = updated fade
2025 2025
     $msg_type = update-nag
2026 2026
     */
2027 2027
 
2028
-    $plugin = 'avada-nag';
2029
-    $timestamp = 'avada-nag1234';
2030
-    $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');
2031
-    echo '<div id="' . $timestamp . '"  class="error">';
2032
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fas fa-times"></i></span>';
2033
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2034
-    echo "<p>$message</p>";
2035
-    echo "</div>";
2028
+	$plugin = 'avada-nag';
2029
+	$timestamp = 'avada-nag1234';
2030
+	$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');
2031
+	echo '<div id="' . $timestamp . '"  class="error">';
2032
+	echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fas fa-times"></i></span>';
2033
+	echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2034
+	echo "<p>$message</p>";
2035
+	echo "</div>";
2036 2036
 
2037
-    ?>
2037
+	?>
2038 2038
     <script>
2039 2039
         function gdRemoveANotification($plugin, $timestamp) {
2040 2040
 
@@ -2102,10 +2102,10 @@  discard block
 block discarded – undo
2102 2102
  */
2103 2103
 function geodir_avada_remove_notification()
2104 2104
 {
2105
-    update_option('avada_nag', TRUE);
2105
+	update_option('avada_nag', TRUE);
2106 2106
 
2107
-    // Always die in functions echoing ajax content
2108
-    die();
2107
+	// Always die in functions echoing ajax content
2108
+	die();
2109 2109
 }
2110 2110
 
2111 2111
 
@@ -2127,11 +2127,11 @@  discard block
 block discarded – undo
2127 2127
 	global $post, $typenow, $current_screen;
2128 2128
 	
2129 2129
 	$post_type = NULL;
2130
-    if (isset($_REQUEST['post_type']))
2130
+	if (isset($_REQUEST['post_type']))
2131 2131
 		$post_type = sanitize_key($_REQUEST['post_type']);
2132
-    elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2132
+	elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2133 2133
 		$post_type = get_post_type($_REQUEST['post']);
2134
-    elseif ($post && isset($post->post_type))
2134
+	elseif ($post && isset($post->post_type))
2135 2135
 		$post_type = $post->post_type;
2136 2136
 	elseif ($typenow)
2137 2137
 		$post_type = $typenow;
@@ -2165,7 +2165,7 @@  discard block
 block discarded – undo
2165 2165
 		// Don't allow same slug url for listing and location
2166 2166
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2167 2167
 			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2168
-        	wp_redirect($redirect_url);
2168
+			wp_redirect($redirect_url);
2169 2169
 			exit;
2170 2170
 		}
2171 2171
 		
@@ -2195,10 +2195,10 @@  discard block
 block discarded – undo
2195 2195
  * @package GeoDirectory
2196 2196
  */
2197 2197
 function geodir_hide_admin_preview_button() {
2198
-    global $post_type;
2199
-    $post_types = geodir_get_posttypes();
2200
-    if(in_array($post_type, $post_types))
2201
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2198
+	global $post_type;
2199
+	$post_types = geodir_get_posttypes();
2200
+	if(in_array($post_type, $post_types))
2201
+		echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2202 2202
 }
2203 2203
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2204 2204
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
  */
2214 2214
 function geodir_import_export_tab( $tabs ) {
2215 2215
 	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2216
-    return $tabs;
2216
+	return $tabs;
2217 2217
 }
2218 2218
 
2219 2219
 /**
@@ -2228,26 +2228,26 @@  discard block
 block discarded – undo
2228 2228
 function geodir_import_export_page() {
2229 2229
 	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2230 2230
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2231
-    /**
2232
-     * Filter sample category data csv file url.
2233
-     *
2234
-     * @since 1.0.0
2235
-     * @package GeoDirectory
2236
-     *
2237
-     * @param string $gd_cats_sample_csv Sample category data csv file url.
2238
-     */
2231
+	/**
2232
+	 * Filter sample category data csv file url.
2233
+	 *
2234
+	 * @since 1.0.0
2235
+	 * @package GeoDirectory
2236
+	 *
2237
+	 * @param string $gd_cats_sample_csv Sample category data csv file url.
2238
+	 */
2239 2239
 	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2240 2240
 	
2241 2241
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2242
-    /**
2243
-     * Filter sample post data csv file url.
2244
-     *
2245
-     * @since 1.0.0
2246
-     * @package GeoDirectory
2247
-     *
2248
-     * @param string $gd_posts_sample_csv Sample post data csv file url.
2249
-     */
2250
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2242
+	/**
2243
+	 * Filter sample post data csv file url.
2244
+	 *
2245
+	 * @since 1.0.0
2246
+	 * @package GeoDirectory
2247
+	 *
2248
+	 * @param string $gd_posts_sample_csv Sample post data csv file url.
2249
+	 */
2250
+	$gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2251 2251
 	
2252 2252
 	$gd_posttypes = geodir_get_posttypes( 'array' );
2253 2253
 	
@@ -2270,14 +2270,14 @@  discard block
 block discarded – undo
2270 2270
 	$gd_chunksize_options[100000] = 100000;
2271 2271
 	 
2272 2272
 	 /**
2273
-     * Filter max entries per export csv file.
2274
-     *
2275
-     * @since 1.5.6
2276
-     * @package GeoDirectory
2277
-     *
2278
-     * @param string $gd_chunksize_options Entries options.
2279
-     */
2280
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2273
+	  * Filter max entries per export csv file.
2274
+	  *
2275
+	  * @since 1.5.6
2276
+	  * @package GeoDirectory
2277
+	  *
2278
+	  * @param string $gd_chunksize_options Entries options.
2279
+	  */
2280
+	$gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2281 2281
 	
2282 2282
 	$gd_chunksize_option = '';
2283 2283
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2294,12 +2294,12 @@  discard block
 block discarded – undo
2294 2294
   <div class="gd-content-heading">
2295 2295
 
2296 2296
   <?php
2297
-    @ini_set('max_execution_time', 999999);
2298
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2299
-    @ini_restore('max_execution_time');
2297
+	@ini_set('max_execution_time', 999999);
2298
+	$ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2299
+	@ini_restore('max_execution_time');
2300 2300
 
2301
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2302
-        ?>
2301
+	if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2302
+		?>
2303 2303
 	<div id="gd_ie_reqs" class="metabox-holder">
2304 2304
       <div class="meta-box-sortables ui-sortable">
2305 2305
         <div class="postbox">
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
 						 * Called just after the sample CSV download link.
2475 2475
 						 *
2476 2476
 						 * @since 1.0.0
2477
-                         * @package GeoDirectory
2477
+						 * @package GeoDirectory
2478 2478
 						 */
2479 2479
 						do_action('geodir_sample_cats_csv_download_link');
2480 2480
 						?>
@@ -2559,11 +2559,11 @@  discard block
 block discarded – undo
2559 2559
 	 *
2560 2560
 	 * Called after the last setting on the GD > Import & Export page.
2561 2561
 	 * @since 1.4.6
2562
-     * @package GeoDirectory
2562
+	 * @package GeoDirectory
2563 2563
 	 *
2564 2564
 	 * @param array $gd_posttypes GD post types.
2565
-     * @param array $gd_chunksize_options File chunk size options.
2566
-     * @param string $nonce Wordpress security token for GD import & export.
2565
+	 * @param array $gd_chunksize_options File chunk size options.
2566
+	 * @param string $nonce Wordpress security token for GD import & export.
2567 2567
 	 */
2568 2568
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2569 2569
 	?>
@@ -3250,44 +3250,44 @@  discard block
 block discarded – undo
3250 3250
 function geodir_init_filesystem()
3251 3251
 {
3252 3252
 
3253
-    if(!function_exists('get_filesystem_method')){
3254
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3255
-    }
3256
-    $access_type = get_filesystem_method();
3257
-    if ($access_type === 'direct') {
3258
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3259
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3260
-
3261
-        /* initialize the API */
3262
-        if (!WP_Filesystem($creds)) {
3263
-            /* any problems and we exit */
3264
-            //return '@@@3';
3265
-            return false;
3266
-        }
3267
-
3268
-        global $wp_filesystem;
3269
-        return $wp_filesystem;
3270
-        /* do our file manipulations below */
3271
-    } elseif (defined('FTP_USER')) {
3272
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3253
+	if(!function_exists('get_filesystem_method')){
3254
+		require_once(ABSPATH."/wp-admin/includes/file.php");
3255
+	}
3256
+	$access_type = get_filesystem_method();
3257
+	if ($access_type === 'direct') {
3258
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3259
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3260
+
3261
+		/* initialize the API */
3262
+		if (!WP_Filesystem($creds)) {
3263
+			/* any problems and we exit */
3264
+			//return '@@@3';
3265
+			return false;
3266
+		}
3273 3267
 
3274
-        /* initialize the API */
3275
-        if (!WP_Filesystem($creds)) {
3276
-            /* any problems and we exit */
3277
-            //return '@@@33';
3278
-            return false;
3279
-        }
3268
+		global $wp_filesystem;
3269
+		return $wp_filesystem;
3270
+		/* do our file manipulations below */
3271
+	} elseif (defined('FTP_USER')) {
3272
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3273
+
3274
+		/* initialize the API */
3275
+		if (!WP_Filesystem($creds)) {
3276
+			/* any problems and we exit */
3277
+			//return '@@@33';
3278
+			return false;
3279
+		}
3280 3280
 
3281
-        global $wp_filesystem;
3282
-        //return '@@@1';
3283
-        return $wp_filesystem;
3281
+		global $wp_filesystem;
3282
+		//return '@@@1';
3283
+		return $wp_filesystem;
3284 3284
 
3285
-    } else {
3286
-        //return '@@@2';
3287
-        /* don't have direct write access. Prompt user with our notice */
3288
-        add_action('admin_notice', 'geodir_filesystem_notice');
3289
-        return false;
3290
-    }
3285
+	} else {
3286
+		//return '@@@2';
3287
+		/* don't have direct write access. Prompt user with our notice */
3288
+		add_action('admin_notice', 'geodir_filesystem_notice');
3289
+		return false;
3290
+	}
3291 3291
 
3292 3292
 }
3293 3293
 
@@ -3305,10 +3305,10 @@  discard block
 block discarded – undo
3305 3305
  */
3306 3306
 function geodir_filesystem_notice()
3307 3307
 {   if ( defined( 'DOING_AJAX' ) ){return;}
3308
-    $access_type = get_filesystem_method();
3309
-    if ($access_type === 'direct') {
3310
-    } elseif (!defined('FTP_USER')) {
3311
-        ?>
3308
+	$access_type = get_filesystem_method();
3309
+	if ($access_type === 'direct') {
3310
+	} elseif (!defined('FTP_USER')) {
3311
+		?>
3312 3312
         <div class="error">
3313 3313
             <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'); ?>
3314 3314
                 <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>
@@ -3336,1280 +3336,1280 @@  discard block
 block discarded – undo
3336 3336
  * @return string Json data.
3337 3337
  */
3338 3338
 function geodir_ajax_import_export() {
3339
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3339
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3340 3340
     
3341
-    error_reporting(0);
3341
+	error_reporting(0);
3342 3342
 
3343
-    $xstart = microtime(true);
3343
+	$xstart = microtime(true);
3344 3344
 
3345
-    // try to set higher limits for import
3346
-    $max_input_time = ini_get('max_input_time');
3347
-    $max_execution_time = ini_get('max_execution_time');
3348
-    $memory_limit= ini_get('memory_limit');
3345
+	// try to set higher limits for import
3346
+	$max_input_time = ini_get('max_input_time');
3347
+	$max_execution_time = ini_get('max_execution_time');
3348
+	$memory_limit= ini_get('memory_limit');
3349 3349
 
3350
-    if(!$max_input_time || $max_input_time<3000){
3351
-        @ini_set('max_input_time', 3000);
3352
-    }
3350
+	if(!$max_input_time || $max_input_time<3000){
3351
+		@ini_set('max_input_time', 3000);
3352
+	}
3353 3353
 
3354
-    if(!$max_execution_time || $max_execution_time<3000){
3355
-        @ini_set('max_execution_time', 3000);
3356
-    }
3354
+	if(!$max_execution_time || $max_execution_time<3000){
3355
+		@ini_set('max_execution_time', 3000);
3356
+	}
3357 3357
 
3358
-    if($memory_limit && str_replace('M','',$memory_limit)){
3359
-        if(str_replace('M','',$memory_limit)<256){
3360
-            @ini_set('memory_limit', '256M');
3361
-        }
3362
-    }
3358
+	if($memory_limit && str_replace('M','',$memory_limit)){
3359
+		if(str_replace('M','',$memory_limit)<256){
3360
+			@ini_set('memory_limit', '256M');
3361
+		}
3362
+	}
3363 3363
 
3364
-    $json = array();
3364
+	$json = array();
3365 3365
 
3366
-    if ( !current_user_can( 'manage_options' ) ) {
3367
-        wp_send_json( $json );
3368
-    }
3366
+	if ( !current_user_can( 'manage_options' ) ) {
3367
+		wp_send_json( $json );
3368
+	}
3369 3369
 
3370
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3371
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3372
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3370
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3371
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3372
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3373 3373
 
3374
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3375
-        wp_send_json( $json );
3376
-    }
3374
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3375
+		wp_send_json( $json );
3376
+	}
3377 3377
 
3378
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3379
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3380
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3381
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3378
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3379
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3380
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3381
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3382 3382
 
3383
-    $wp_filesystem = geodir_init_filesystem();
3384
-    if (!$wp_filesystem) {
3385
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3386
-        wp_send_json( $json );
3387
-    }
3383
+	$wp_filesystem = geodir_init_filesystem();
3384
+	if (!$wp_filesystem) {
3385
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3386
+		wp_send_json( $json );
3387
+	}
3388 3388
 
3389
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3390
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3391
-        wp_send_json( $json );
3392
-    }
3389
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3390
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3391
+		wp_send_json( $json );
3392
+	}
3393 3393
 
3394
-    $csv_file_dir = geodir_path_import_export( false );
3395
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3396
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3397
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3398
-            wp_send_json( $json );
3399
-        }
3400
-    }
3394
+	$csv_file_dir = geodir_path_import_export( false );
3395
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3396
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3397
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3398
+			wp_send_json( $json );
3399
+		}
3400
+	}
3401 3401
     
3402
-    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3403
-    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3404
-
3405
-    switch ( $task ) {
3406
-        case 'export_posts': {
3407
-            // WPML
3408
-            $is_wpml = geodir_is_wpml();
3409
-            if ($is_wpml) {
3410
-                global $sitepress;
3411
-                $active_lang = ICL_LANGUAGE_CODE;
3402
+	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3403
+	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3404
+
3405
+	switch ( $task ) {
3406
+		case 'export_posts': {
3407
+			// WPML
3408
+			$is_wpml = geodir_is_wpml();
3409
+			if ($is_wpml) {
3410
+				global $sitepress;
3411
+				$active_lang = ICL_LANGUAGE_CODE;
3412 3412
                 
3413
-                $sitepress->switch_lang('all', true);
3414
-            }
3415
-            // WPML
3416
-            if ( $post_type == 'gd_event' ) {
3417
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3418
-            }
3419
-            $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3413
+				$sitepress->switch_lang('all', true);
3414
+			}
3415
+			// WPML
3416
+			if ( $post_type == 'gd_event' ) {
3417
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3418
+			}
3419
+			$filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3420 3420
             
3421
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3422
-            if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3423
-                $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3424
-            }
3425
-            $posts_count = geodir_get_posts_count( $post_type );
3426
-            $file_url_base = geodir_path_import_export() . '/';
3427
-            $file_url = $file_url_base . $file_name . '.csv';
3428
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3429
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3421
+			$file_name = $post_type . '_' . date( 'dmyHi' );
3422
+			if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3423
+				$file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3424
+			}
3425
+			$posts_count = geodir_get_posts_count( $post_type );
3426
+			$file_url_base = geodir_path_import_export() . '/';
3427
+			$file_url = $file_url_base . $file_name . '.csv';
3428
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3429
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3430 3430
             
3431
-            $chunk_file_paths = array();
3431
+			$chunk_file_paths = array();
3432 3432
 
3433
-            if ( isset( $_REQUEST['_c'] ) ) {
3434
-                $json['total'] = $posts_count;
3435
-                // WPML
3436
-                if ($is_wpml) {
3437
-                    $sitepress->switch_lang($active_lang, true);
3438
-                }
3439
-                // WPML
3440
-                wp_send_json( $json );
3441
-                gd_die();
3442
-            } else if ( isset( $_REQUEST['_st'] ) ) {
3443
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3444
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3445
-                $percentage = min( $percentage, 100 );
3433
+			if ( isset( $_REQUEST['_c'] ) ) {
3434
+				$json['total'] = $posts_count;
3435
+				// WPML
3436
+				if ($is_wpml) {
3437
+					$sitepress->switch_lang($active_lang, true);
3438
+				}
3439
+				// WPML
3440
+				wp_send_json( $json );
3441
+				gd_die();
3442
+			} else if ( isset( $_REQUEST['_st'] ) ) {
3443
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3444
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3445
+				$percentage = min( $percentage, 100 );
3446 3446
                 
3447
-                $json['percentage'] = $percentage;
3448
-                // WPML
3449
-                if ($is_wpml) {
3450
-                    $sitepress->switch_lang($active_lang, true);
3451
-                }
3452
-                // WPML
3453
-                wp_send_json( $json );
3454
-                gd_die();
3455
-            } else {
3456
-                if ( !$posts_count > 0 ) {
3457
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3458
-                } else {
3459
-                    $total_posts = $posts_count;
3460
-                    if ($chunk_per_page > $total_posts) {
3461
-                        $chunk_per_page = $total_posts;
3462
-                    }
3463
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3447
+				$json['percentage'] = $percentage;
3448
+				// WPML
3449
+				if ($is_wpml) {
3450
+					$sitepress->switch_lang($active_lang, true);
3451
+				}
3452
+				// WPML
3453
+				wp_send_json( $json );
3454
+				gd_die();
3455
+			} else {
3456
+				if ( !$posts_count > 0 ) {
3457
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3458
+				} else {
3459
+					$total_posts = $posts_count;
3460
+					if ($chunk_per_page > $total_posts) {
3461
+						$chunk_per_page = $total_posts;
3462
+					}
3463
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3464 3464
                     
3465
-                    $j = $chunk_page_no;
3466
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3465
+					$j = $chunk_page_no;
3466
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3467 3467
                     
3468
-                    $per_page = 500;
3469
-                    if ($per_page > $chunk_per_page) {
3470
-                        $per_page = $chunk_per_page;
3471
-                    }
3472
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3468
+					$per_page = 500;
3469
+					if ($per_page > $chunk_per_page) {
3470
+						$per_page = $chunk_per_page;
3471
+					}
3472
+					$total_pages = ceil( $chunk_per_page / $per_page );
3473 3473
                     
3474
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3475
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3474
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3475
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3476 3476
                         
3477
-                        $clear = $i == 0 ? true : false;
3478
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3479
-                    }
3477
+						$clear = $i == 0 ? true : false;
3478
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3479
+					}
3480 3480
                         
3481
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3482
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3483
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3484
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3485
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3481
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3482
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3483
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3484
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3485
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3486 3486
                         
3487
-                        $file_url = $file_url_base . $chunk_file_name;
3488
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3489
-                    }
3487
+						$file_url = $file_url_base . $chunk_file_name;
3488
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3489
+					}
3490 3490
                     
3491
-                    if ( !empty($chunk_file_paths) ) {
3492
-                        $json['total'] = $posts_count;
3493
-                        $json['files'] = $chunk_file_paths;
3494
-                    } else {
3495
-                        if ($j > 1) {
3496
-                            $json['total'] = $posts_count;
3497
-                            $json['files'] = array();
3498
-                        } else {
3499
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3500
-                        }
3501
-                    }
3502
-                }
3503
-                // WPML
3504
-                if ($is_wpml) {
3505
-                    $sitepress->switch_lang($active_lang, true);
3506
-                }
3507
-                // WPML
3508
-                wp_send_json( $json );
3509
-            }
3510
-        }
3511
-        break;
3512
-        case 'export_cats': {
3513
-            // WPML
3514
-            $is_wpml = geodir_is_wpml();
3515
-            if ($is_wpml) {
3516
-                global $sitepress;
3517
-                $active_lang = ICL_LANGUAGE_CODE;
3491
+					if ( !empty($chunk_file_paths) ) {
3492
+						$json['total'] = $posts_count;
3493
+						$json['files'] = $chunk_file_paths;
3494
+					} else {
3495
+						if ($j > 1) {
3496
+							$json['total'] = $posts_count;
3497
+							$json['files'] = array();
3498
+						} else {
3499
+							$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3500
+						}
3501
+					}
3502
+				}
3503
+				// WPML
3504
+				if ($is_wpml) {
3505
+					$sitepress->switch_lang($active_lang, true);
3506
+				}
3507
+				// WPML
3508
+				wp_send_json( $json );
3509
+			}
3510
+		}
3511
+		break;
3512
+		case 'export_cats': {
3513
+			// WPML
3514
+			$is_wpml = geodir_is_wpml();
3515
+			if ($is_wpml) {
3516
+				global $sitepress;
3517
+				$active_lang = ICL_LANGUAGE_CODE;
3518 3518
                 
3519
-                $sitepress->switch_lang('all', true);
3520
-            }
3521
-            // WPML
3522
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3519
+				$sitepress->switch_lang('all', true);
3520
+			}
3521
+			// WPML
3522
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
3523 3523
             
3524
-            $terms_count = geodir_get_terms_count( $post_type );
3525
-            $file_url_base = geodir_path_import_export() . '/';
3526
-            $file_url = $file_url_base . $file_name . '.csv';
3527
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3528
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3524
+			$terms_count = geodir_get_terms_count( $post_type );
3525
+			$file_url_base = geodir_path_import_export() . '/';
3526
+			$file_url = $file_url_base . $file_name . '.csv';
3527
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3528
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3529 3529
             
3530
-            $chunk_file_paths = array();
3530
+			$chunk_file_paths = array();
3531 3531
             
3532
-            if ( isset( $_REQUEST['_st'] ) ) {
3533
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3534
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3535
-                $percentage = min( $percentage, 100 );
3532
+			if ( isset( $_REQUEST['_st'] ) ) {
3533
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3534
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3535
+				$percentage = min( $percentage, 100 );
3536 3536
                 
3537
-                $json['percentage'] = $percentage;
3538
-                // WPML
3539
-                if ($is_wpml) {
3540
-                    $sitepress->switch_lang($active_lang, true);
3541
-                }
3542
-                // WPML
3543
-                wp_send_json( $json );
3544
-            } else {
3545
-                if ( !$terms_count > 0 ) {
3546
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3547
-                } else {
3548
-                    $total_terms = $terms_count;
3549
-                    if ($chunk_per_page > $terms_count) {
3550
-                        $chunk_per_page = $terms_count;
3551
-                    }
3552
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3537
+				$json['percentage'] = $percentage;
3538
+				// WPML
3539
+				if ($is_wpml) {
3540
+					$sitepress->switch_lang($active_lang, true);
3541
+				}
3542
+				// WPML
3543
+				wp_send_json( $json );
3544
+			} else {
3545
+				if ( !$terms_count > 0 ) {
3546
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3547
+				} else {
3548
+					$total_terms = $terms_count;
3549
+					if ($chunk_per_page > $terms_count) {
3550
+						$chunk_per_page = $terms_count;
3551
+					}
3552
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3553 3553
                     
3554
-                    $j = $chunk_page_no;
3555
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3554
+					$j = $chunk_page_no;
3555
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3556 3556
                     
3557
-                    $per_page = 500;
3558
-                    if ($per_page > $chunk_per_page) {
3559
-                        $per_page = $chunk_per_page;
3560
-                    }
3561
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3557
+					$per_page = 500;
3558
+					if ($per_page > $chunk_per_page) {
3559
+						$per_page = $chunk_per_page;
3560
+					}
3561
+					$total_pages = ceil( $chunk_per_page / $per_page );
3562 3562
                     
3563
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3564
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3563
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3564
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3565 3565
                         
3566
-                        $clear = $i == 0 ? true : false;
3567
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3568
-                    }
3566
+						$clear = $i == 0 ? true : false;
3567
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3568
+					}
3569 3569
                     
3570
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3571
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3572
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3573
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3574
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3570
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3571
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3572
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3573
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3574
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3575 3575
                         
3576
-                        $file_url = $file_url_base . $chunk_file_name;
3577
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3578
-                    }
3576
+						$file_url = $file_url_base . $chunk_file_name;
3577
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3578
+					}
3579 3579
                     
3580
-                    if ( !empty($chunk_file_paths) ) {
3581
-                        $json['total'] = $terms_count;
3582
-                        $json['files'] = $chunk_file_paths;
3583
-                    } else {
3584
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3585
-                    }
3586
-                }
3587
-                // WPML
3588
-                if ($is_wpml) {
3589
-                    $sitepress->switch_lang($active_lang, true);
3590
-                }
3591
-                // WPML
3592
-                wp_send_json( $json );
3593
-            }
3594
-        }
3595
-        break;
3596
-        case 'export_locations': {
3597
-            $file_url_base = geodir_path_import_export() . '/';
3598
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3599
-            $file_url = $file_url_base . $file_name . '.csv';
3600
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3601
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3580
+					if ( !empty($chunk_file_paths) ) {
3581
+						$json['total'] = $terms_count;
3582
+						$json['files'] = $chunk_file_paths;
3583
+					} else {
3584
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3585
+					}
3586
+				}
3587
+				// WPML
3588
+				if ($is_wpml) {
3589
+					$sitepress->switch_lang($active_lang, true);
3590
+				}
3591
+				// WPML
3592
+				wp_send_json( $json );
3593
+			}
3594
+		}
3595
+		break;
3596
+		case 'export_locations': {
3597
+			$file_url_base = geodir_path_import_export() . '/';
3598
+			$file_name = 'gd_locations_' . date( 'dmyHi' );
3599
+			$file_url = $file_url_base . $file_name . '.csv';
3600
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3601
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3602 3602
             
3603
-            $items_count = (int)geodir_location_imex_count_locations();
3603
+			$items_count = (int)geodir_location_imex_count_locations();
3604 3604
             
3605
-            if ( isset( $_REQUEST['_st'] ) ) {
3606
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3607
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3608
-                $percentage = min( $percentage, 100 );
3605
+			if ( isset( $_REQUEST['_st'] ) ) {
3606
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3607
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3608
+				$percentage = min( $percentage, 100 );
3609 3609
                 
3610
-                $json['percentage'] = $percentage;
3611
-                wp_send_json( $json );
3612
-            } else {
3613
-                $chunk_file_paths = array();
3610
+				$json['percentage'] = $percentage;
3611
+				wp_send_json( $json );
3612
+			} else {
3613
+				$chunk_file_paths = array();
3614 3614
                 
3615
-                if ( !$items_count > 0 ) {
3616
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3617
-                } else {
3618
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3619
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3615
+				if ( !$items_count > 0 ) {
3616
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3617
+				} else {
3618
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3619
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3620 3620
                     
3621
-                    $j = $chunk_page_no;
3622
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3621
+					$j = $chunk_page_no;
3622
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3623 3623
                     
3624
-                    $per_page = 500;
3625
-                    $per_page = min( $per_page, $chunk_per_page );
3626
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3624
+					$per_page = 500;
3625
+					$per_page = min( $per_page, $chunk_per_page );
3626
+					$total_pages = ceil( $chunk_per_page / $per_page );
3627 3627
                     
3628
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3629
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3628
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3629
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3630 3630
                         
3631
-                        $clear = $i == 0 ? true : false;
3632
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3633
-                    }
3631
+						$clear = $i == 0 ? true : false;
3632
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3633
+					}
3634 3634
                     
3635
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3636
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3637
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3638
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3639
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3635
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3636
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3637
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3638
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3639
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3640 3640
                         
3641
-                        $file_url = $file_url_base . $chunk_file_name;
3642
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3643
-                    }
3641
+						$file_url = $file_url_base . $chunk_file_name;
3642
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3643
+					}
3644 3644
                     
3645
-                    if ( !empty($chunk_file_paths) ) {
3646
-                        $json['total'] = $items_count;
3647
-                        $json['files'] = $chunk_file_paths;
3648
-                    } else {
3649
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3650
-                    }
3651
-                }
3652
-                wp_send_json( $json );
3653
-            }
3654
-        }
3655
-        break;
3656
-        case 'export_hoods': {
3657
-            $file_url_base = geodir_path_import_export() . '/';
3658
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3659
-            $file_url = $file_url_base . $file_name . '.csv';
3660
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3661
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3645
+					if ( !empty($chunk_file_paths) ) {
3646
+						$json['total'] = $items_count;
3647
+						$json['files'] = $chunk_file_paths;
3648
+					} else {
3649
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3650
+					}
3651
+				}
3652
+				wp_send_json( $json );
3653
+			}
3654
+		}
3655
+		break;
3656
+		case 'export_hoods': {
3657
+			$file_url_base = geodir_path_import_export() . '/';
3658
+			$file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3659
+			$file_url = $file_url_base . $file_name . '.csv';
3660
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3661
+			$file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3662 3662
             
3663
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3663
+			$items_count = (int)geodir_location_imex_count_neighbourhoods();
3664 3664
             
3665
-            if ( isset( $_REQUEST['_st'] ) ) {
3666
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3667
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3668
-                $percentage = min( $percentage, 100 );
3665
+			if ( isset( $_REQUEST['_st'] ) ) {
3666
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3667
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3668
+				$percentage = min( $percentage, 100 );
3669 3669
                 
3670
-                $json['percentage'] = $percentage;
3671
-                wp_send_json( $json );
3672
-            } else {
3673
-                $chunk_file_paths = array();
3670
+				$json['percentage'] = $percentage;
3671
+				wp_send_json( $json );
3672
+			} else {
3673
+				$chunk_file_paths = array();
3674 3674
                 
3675
-                if ( !$items_count > 0 ) {
3676
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3677
-                } else {
3678
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3679
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3675
+				if ( !$items_count > 0 ) {
3676
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3677
+				} else {
3678
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3679
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3680 3680
                     
3681
-                    $j = $chunk_page_no;
3682
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3681
+					$j = $chunk_page_no;
3682
+					$chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3683 3683
                     
3684
-                    $per_page = 500;
3685
-                    $per_page = min( $per_page, $chunk_per_page );
3686
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3684
+					$per_page = 500;
3685
+					$per_page = min( $per_page, $chunk_per_page );
3686
+					$total_pages = ceil( $chunk_per_page / $per_page );
3687 3687
                     
3688
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3689
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3688
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3689
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3690 3690
                         
3691
-                        $clear = $i == 0 ? true : false;
3692
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3693
-                    }
3691
+						$clear = $i == 0 ? true : false;
3692
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3693
+					}
3694 3694
                     
3695
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3696
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3697
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3698
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3699
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3695
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3696
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3697
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3698
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3699
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3700 3700
                         
3701
-                        $file_url = $file_url_base . $chunk_file_name;
3702
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3703
-                    }
3701
+						$file_url = $file_url_base . $chunk_file_name;
3702
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3703
+					}
3704 3704
                     
3705
-                    if ( !empty($chunk_file_paths) ) {
3706
-                        $json['total'] = $items_count;
3707
-                        $json['files'] = $chunk_file_paths;
3708
-                    } else {
3709
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3710
-                    }
3711
-                }
3712
-                wp_send_json( $json );
3713
-            }
3714
-        }
3715
-        break;
3716
-        case 'prepare_import':
3717
-        case 'import_cat':
3718
-        case 'import_post':
3719
-        case 'import_loc':
3720
-        case 'import_hood': {
3721
-            // WPML
3722
-            $is_wpml = geodir_is_wpml();
3723
-            if ($is_wpml) {
3724
-                global $sitepress;
3725
-                $active_lang = ICL_LANGUAGE_CODE;
3726
-            }
3727
-            // WPML
3705
+					if ( !empty($chunk_file_paths) ) {
3706
+						$json['total'] = $items_count;
3707
+						$json['files'] = $chunk_file_paths;
3708
+					} else {
3709
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3710
+					}
3711
+				}
3712
+				wp_send_json( $json );
3713
+			}
3714
+		}
3715
+		break;
3716
+		case 'prepare_import':
3717
+		case 'import_cat':
3718
+		case 'import_post':
3719
+		case 'import_loc':
3720
+		case 'import_hood': {
3721
+			// WPML
3722
+			$is_wpml = geodir_is_wpml();
3723
+			if ($is_wpml) {
3724
+				global $sitepress;
3725
+				$active_lang = ICL_LANGUAGE_CODE;
3726
+			}
3727
+			// WPML
3728 3728
             
3729
-            @ini_set( 'auto_detect_line_endings', true );
3729
+			@ini_set( 'auto_detect_line_endings', true );
3730 3730
             
3731
-            $uploads = wp_upload_dir();
3732
-            $uploads_dir = $uploads['path'];
3733
-            $uploads_subdir = $uploads['subdir'];
3731
+			$uploads = wp_upload_dir();
3732
+			$uploads_dir = $uploads['path'];
3733
+			$uploads_subdir = $uploads['subdir'];
3734 3734
             
3735
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3736
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3735
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3736
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3737 3737
             
3738
-            $csv_file_arr = explode( '/', $csv_file );
3739
-            $csv_filename = end( $csv_file_arr );
3740
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3738
+			$csv_file_arr = explode( '/', $csv_file );
3739
+			$csv_filename = end( $csv_file_arr );
3740
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3741 3741
             
3742
-            $json['file'] = $csv_file;
3743
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3744
-            $file = array();
3745
-
3746
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3747
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3748
-
3749
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3750
-                    $json['error'] = NULL;
3751
-
3752
-                    $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3753
-                    setlocale(LC_ALL, 'en_US.UTF-8');
3754
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3755
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3756
-                            if ( !empty( $data ) ) {
3757
-                                $file[] = $data;
3758
-                            }
3759
-                        }
3760
-                        fclose($handle);
3761
-                    }
3762
-                    setlocale(LC_ALL, $lc_all);
3742
+			$json['file'] = $csv_file;
3743
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3744
+			$file = array();
3745
+
3746
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3747
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3748
+
3749
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3750
+					$json['error'] = NULL;
3751
+
3752
+					$lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3753
+					setlocale(LC_ALL, 'en_US.UTF-8');
3754
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3755
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3756
+							if ( !empty( $data ) ) {
3757
+								$file[] = $data;
3758
+							}
3759
+						}
3760
+						fclose($handle);
3761
+					}
3762
+					setlocale(LC_ALL, $lc_all);
3763 3763
 
3764
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
3764
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
3765 3765
                     
3766
-                    if (!$json['rows'] > 0) {
3767
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
3768
-                    }
3769
-                } else {
3770
-                    wp_send_json( $json );
3771
-                }
3772
-            } else {
3773
-                wp_send_json( $json );
3774
-            }
3766
+					if (!$json['rows'] > 0) {
3767
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
3768
+					}
3769
+				} else {
3770
+					wp_send_json( $json );
3771
+				}
3772
+			} else {
3773
+				wp_send_json( $json );
3774
+			}
3775 3775
             
3776
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3777
-                wp_send_json( $json );
3778
-            }
3776
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3777
+				wp_send_json( $json );
3778
+			}
3779 3779
             
3780
-            $total = $json['rows'];
3781
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3782
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3780
+			$total = $json['rows'];
3781
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3782
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3783 3783
             
3784
-            $count = $limit;
3784
+			$count = $limit;
3785 3785
             
3786
-            if ($count < $total) {
3787
-                $count = $processed + $count;
3788
-                if ($count > $total) {
3789
-                    $count = $total;
3790
-                }
3791
-            } else {
3792
-                $count = $total;
3793
-            }
3786
+			if ($count < $total) {
3787
+				$count = $processed + $count;
3788
+				if ($count > $total) {
3789
+					$count = $total;
3790
+				}
3791
+			} else {
3792
+				$count = $total;
3793
+			}
3794 3794
             
3795
-            $created = 0;
3796
-            $updated = 0;
3797
-            $skipped = 0;
3798
-            $invalid = 0;
3799
-            $invalid_addr = 0;
3800
-            $images = 0;
3795
+			$created = 0;
3796
+			$updated = 0;
3797
+			$skipped = 0;
3798
+			$invalid = 0;
3799
+			$invalid_addr = 0;
3800
+			$images = 0;
3801 3801
             
3802
-            $gd_post_info = array();
3803
-            $countpost = 0;
3802
+			$gd_post_info = array();
3803
+			$countpost = 0;
3804 3804
             
3805
-            $post_types = geodir_get_posttypes();
3805
+			$post_types = geodir_get_posttypes();
3806 3806
 
3807
-            if ( $task == 'import_cat' ) {
3808
-                if (!empty($file)) {
3809
-                    $columns = isset($file[0]) ? $file[0] : NULL;
3807
+			if ( $task == 'import_cat' ) {
3808
+				if (!empty($file)) {
3809
+					$columns = isset($file[0]) ? $file[0] : NULL;
3810 3810
                     
3811
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3812
-                        $json['error'] = CSV_INVAILD_FILE;
3813
-                        wp_send_json( $json );
3814
-                        exit;
3815
-                    }
3811
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3812
+						$json['error'] = CSV_INVAILD_FILE;
3813
+						wp_send_json( $json );
3814
+						exit;
3815
+					}
3816 3816
                     
3817
-                    $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
3817
+					$gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
3818 3818
                     
3819
-                    for ($i = 1; $i <= $limit; $i++) {
3820
-                        $index = $processed + $i;
3819
+					for ($i = 1; $i <= $limit; $i++) {
3820
+						$index = $processed + $i;
3821 3821
                         
3822
-                        if (isset($file[$index])) {
3823
-                            $row = $file[$index];
3824
-                            $row = array_map( 'trim', $row );
3825
-                            //$row = array_map( 'utf8_encode', $row );
3822
+						if (isset($file[$index])) {
3823
+							$row = $file[$index];
3824
+							$row = array_map( 'trim', $row );
3825
+							//$row = array_map( 'utf8_encode', $row );
3826 3826
                             
3827
-                            $cat_id = '';
3828
-                            $cat_name = '';
3829
-                            $cat_slug = '';
3830
-                            $cat_posttype = '';
3831
-                            $cat_parent = '';
3832
-                            $cat_description = '';
3833
-                            $cat_schema = '';
3834
-                            $cat_top_description = '';
3835
-                            $cat_image = '';
3836
-                            $cat_icon = '';
3837
-                            $cat_language = '';
3838
-                            $cat_id_original = '';
3827
+							$cat_id = '';
3828
+							$cat_name = '';
3829
+							$cat_slug = '';
3830
+							$cat_posttype = '';
3831
+							$cat_parent = '';
3832
+							$cat_description = '';
3833
+							$cat_schema = '';
3834
+							$cat_top_description = '';
3835
+							$cat_image = '';
3836
+							$cat_icon = '';
3837
+							$cat_language = '';
3838
+							$cat_id_original = '';
3839 3839
                             
3840
-                            $c = 0;
3841
-                            foreach ($columns as $column ) {
3842
-                                if ( $column == 'cat_id' ) {
3843
-                                    $cat_id = (int)$row[$c];
3844
-                                } else if ( $column == 'cat_name' ) {
3845
-                                    $cat_name = $row[$c];
3846
-                                } else if ( $column == 'cat_slug' ) {
3847
-                                    $cat_slug = $row[$c];
3848
-                                } else if ( $column == 'cat_posttype' ) {
3849
-                                    $cat_posttype = $row[$c];
3850
-                                } else if ( $column == 'cat_parent' ) {
3851
-                                    $cat_parent = trim($row[$c]);
3852
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3853
-                                    $cat_schema = $row[$c];
3854
-                                } else if ( $column == 'cat_description' ) {
3855
-                                    $cat_description = $row[$c];
3856
-                                } else if ( $column == 'cat_top_description' ) {
3857
-                                    $cat_top_description = $row[$c];
3858
-                                } else if ( $column == 'cat_image' ) {
3859
-                                    $cat_image = $row[$c];
3860
-                                } else if ( $column == 'cat_icon' ) {
3861
-                                    $cat_icon = $row[$c];
3862
-                                }
3863
-                                // WPML
3864
-                                if ( $is_wpml ) {
3865
-                                    if ( $column == 'cat_language' ) {
3866
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
3867
-                                    } else if ( $column == 'cat_id_original' ) {
3868
-                                        $cat_id_original = (int)$row[$c];
3869
-                                    }
3870
-                                }
3871
-                                // WPML
3872
-                                $c++;
3873
-                            }
3840
+							$c = 0;
3841
+							foreach ($columns as $column ) {
3842
+								if ( $column == 'cat_id' ) {
3843
+									$cat_id = (int)$row[$c];
3844
+								} else if ( $column == 'cat_name' ) {
3845
+									$cat_name = $row[$c];
3846
+								} else if ( $column == 'cat_slug' ) {
3847
+									$cat_slug = $row[$c];
3848
+								} else if ( $column == 'cat_posttype' ) {
3849
+									$cat_posttype = $row[$c];
3850
+								} else if ( $column == 'cat_parent' ) {
3851
+									$cat_parent = trim($row[$c]);
3852
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3853
+									$cat_schema = $row[$c];
3854
+								} else if ( $column == 'cat_description' ) {
3855
+									$cat_description = $row[$c];
3856
+								} else if ( $column == 'cat_top_description' ) {
3857
+									$cat_top_description = $row[$c];
3858
+								} else if ( $column == 'cat_image' ) {
3859
+									$cat_image = $row[$c];
3860
+								} else if ( $column == 'cat_icon' ) {
3861
+									$cat_icon = $row[$c];
3862
+								}
3863
+								// WPML
3864
+								if ( $is_wpml ) {
3865
+									if ( $column == 'cat_language' ) {
3866
+										$cat_language = geodir_strtolower( trim( $row[$c] ) );
3867
+									} else if ( $column == 'cat_id_original' ) {
3868
+										$cat_id_original = (int)$row[$c];
3869
+									}
3870
+								}
3871
+								// WPML
3872
+								$c++;
3873
+							}
3874 3874
                             
3875
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3876
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3875
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3876
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3877 3877
                                 
3878
-                                $invalid++;
3879
-                                continue;
3880
-                            }
3878
+								$invalid++;
3879
+								continue;
3880
+							}
3881 3881
                             
3882
-                            // WPML
3883
-                            if ($is_wpml && $cat_language != '') {
3884
-                                $sitepress->switch_lang($cat_language, true);
3885
-                            }
3886
-                            // WPML
3882
+							// WPML
3883
+							if ($is_wpml && $cat_language != '') {
3884
+								$sitepress->switch_lang($cat_language, true);
3885
+							}
3886
+							// WPML
3887 3887
                                                         
3888
-                            $term_data = array();
3889
-                            $term_data['name'] = $cat_name;
3890
-                            $term_data['slug'] = $cat_slug;
3891
-                            $term_data['description'] = $cat_description;
3892
-                            $term_data['cat_schema'] = $cat_schema;
3893
-                            $term_data['top_description'] = $cat_top_description;
3894
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3895
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3888
+							$term_data = array();
3889
+							$term_data['name'] = $cat_name;
3890
+							$term_data['slug'] = $cat_slug;
3891
+							$term_data['description'] = $cat_description;
3892
+							$term_data['cat_schema'] = $cat_schema;
3893
+							$term_data['top_description'] = $cat_top_description;
3894
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3895
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3896 3896
                             
3897
-                            //$term_data = array_map( 'utf8_encode', $term_data );
3897
+							//$term_data = array_map( 'utf8_encode', $term_data );
3898 3898
                             
3899
-                            $taxonomy = $cat_posttype . 'category';
3899
+							$taxonomy = $cat_posttype . 'category';
3900 3900
                             
3901
-                            $term_data['taxonomy'] = $taxonomy;
3901
+							$term_data['taxonomy'] = $taxonomy;
3902 3902
 
3903
-                            $term_parent_id = 0;
3904
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
3905
-                                $term_parent = '';
3903
+							$term_parent_id = 0;
3904
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
3905
+								$term_parent = '';
3906 3906
                                 
3907
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3908
-                                    //
3909
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3910
-                                    //
3911
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3912
-                                    //
3913
-                                } else {
3914
-                                    $term_parent_data = array();
3915
-                                    $term_parent_data['name'] = $cat_parent;
3916
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3917
-                                    $term_parent_data['taxonomy'] = $taxonomy;
3907
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3908
+									//
3909
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3910
+									//
3911
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3912
+									//
3913
+								} else {
3914
+									$term_parent_data = array();
3915
+									$term_parent_data['name'] = $cat_parent;
3916
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3917
+									$term_parent_data['taxonomy'] = $taxonomy;
3918 3918
                                     
3919
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3920
-                                }
3919
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3920
+								}
3921 3921
                                 
3922
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3923
-                                    $term_parent_id = (int)$term_parent->term_id;
3924
-                                }
3925
-                            }
3926
-                            $term_data['parent'] = (int)$term_parent_id;
3922
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3923
+									$term_parent_id = (int)$term_parent->term_id;
3924
+								}
3925
+							}
3926
+							$term_data['parent'] = (int)$term_parent_id;
3927 3927
 
3928
-                            $term_id = NULL;
3929
-                            if ( $import_choice == 'update' ) {
3930
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3931
-                                    $term_data['term_id'] = $term['term_id'];
3928
+							$term_id = NULL;
3929
+							if ( $import_choice == 'update' ) {
3930
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3931
+									$term_data['term_id'] = $term['term_id'];
3932 3932
                                     
3933
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3934
-                                        $updated++;
3935
-                                    } else {
3936
-                                        $invalid++;
3937
-                                        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' ) );
3938
-                                    }
3939
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3940
-                                    $term_data['term_id'] = $term['term_id'];
3933
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3934
+										$updated++;
3935
+									} else {
3936
+										$invalid++;
3937
+										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' ) );
3938
+									}
3939
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3940
+									$term_data['term_id'] = $term['term_id'];
3941 3941
                                     
3942
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3943
-                                        $updated++;
3944
-                                    } else {
3945
-                                        $invalid++;
3946
-                                        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' ) );
3947
-                                    }
3948
-                                } else {
3949
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3950
-                                        $created++;
3951
-                                    } else {
3952
-                                        $invalid++;
3953
-                                        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' ) );
3954
-                                    }
3955
-                                }
3956
-                            } else if ( $import_choice == 'skip' ) {
3957
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3958
-                                    $skipped++;
3959
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3960
-                                    $skipped++;
3961
-                                } else {
3962
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3963
-                                        $created++;
3964
-                                    } else {
3965
-                                        $invalid++;
3966
-                                        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' ) );
3967
-                                    }
3968
-                                }
3969
-                            } else {
3970
-                                $invalid++;
3971
-                                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' ) );
3972
-                            }
3942
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3943
+										$updated++;
3944
+									} else {
3945
+										$invalid++;
3946
+										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' ) );
3947
+									}
3948
+								} else {
3949
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3950
+										$created++;
3951
+									} else {
3952
+										$invalid++;
3953
+										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' ) );
3954
+									}
3955
+								}
3956
+							} else if ( $import_choice == 'skip' ) {
3957
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3958
+									$skipped++;
3959
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3960
+									$skipped++;
3961
+								} else {
3962
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3963
+										$created++;
3964
+									} else {
3965
+										$invalid++;
3966
+										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' ) );
3967
+									}
3968
+								}
3969
+							} else {
3970
+								$invalid++;
3971
+								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' ) );
3972
+							}
3973 3973
                             
3974
-                            if ( $term_id ) {
3975
-                                // WPML
3976
-                                if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
3977
-                                    $wpml_element_type = 'tax_' . $taxonomy;
3978
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3979
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3980
-
3981
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3974
+							if ( $term_id ) {
3975
+								// WPML
3976
+								if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
3977
+									$wpml_element_type = 'tax_' . $taxonomy;
3978
+									$source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3979
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3980
+
3981
+									$trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3982 3982
                                     
3983
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3984
-                                }
3985
-                                // WPML
3983
+									$sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3984
+								}
3985
+								// WPML
3986 3986
                                 
3987
-                                if ( isset( $term_data['top_description'] ) ) {
3988
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3989
-                                }
3987
+								if ( isset( $term_data['top_description'] ) ) {
3988
+									geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3989
+								}
3990 3990
                                 
3991
-                                if ( isset( $term_data['cat_schema'] ) ) {
3992
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3993
-                                }
3991
+								if ( isset( $term_data['cat_schema'] ) ) {
3992
+									geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3993
+								}
3994 3994
             
3995
-                                $attachment = false;
3996
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3997
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3998
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3995
+								$attachment = false;
3996
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3997
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3998
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3999 3999
                                     
4000
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4001
-                                        $attachment = true;
4002
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4003
-                                    }
4004
-                                }
4000
+									if ( basename($cat_image) != $term_data['image'] ) {
4001
+										$attachment = true;
4002
+										geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4003
+									}
4004
+								}
4005 4005
                                 
4006
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4007
-                                    $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4008
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4009
-
4010
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4011
-                                        $attachment = true;
4012
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4013
-                                    }
4014
-                                }
4006
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4007
+									$cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4008
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4009
+
4010
+									if ( basename($cat_icon) != $term_data['icon'] ) {
4011
+										$attachment = true;
4012
+										geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4013
+									}
4014
+								}
4015 4015
                                 
4016
-                                if ( $attachment ) {
4017
-                                    $images++;
4018
-                                }
4019
-                            }
4016
+								if ( $attachment ) {
4017
+									$images++;
4018
+								}
4019
+							}
4020 4020
                             
4021
-                            // WPML
4022
-                            if ($is_wpml && $cat_language != '') {
4023
-                                $sitepress->switch_lang($active_lang, true);
4024
-                            }
4025
-                            // WPML
4026
-                        }
4027
-                    }
4028
-                }
4021
+							// WPML
4022
+							if ($is_wpml && $cat_language != '') {
4023
+								$sitepress->switch_lang($active_lang, true);
4024
+							}
4025
+							// WPML
4026
+						}
4027
+					}
4028
+				}
4029 4029
                 
4030
-                $json = array();
4031
-                $json['processed'] = $limit;
4032
-                $json['created'] = $created;
4033
-                $json['updated'] = $updated;
4034
-                $json['skipped'] = $skipped;
4035
-                $json['invalid'] = $invalid;
4036
-                $json['images'] = $images;
4030
+				$json = array();
4031
+				$json['processed'] = $limit;
4032
+				$json['created'] = $created;
4033
+				$json['updated'] = $updated;
4034
+				$json['skipped'] = $skipped;
4035
+				$json['invalid'] = $invalid;
4036
+				$json['images'] = $images;
4037 4037
                 
4038
-                wp_send_json( $json );
4039
-                exit;
4040
-            } else if ( $task == 'import_post' ) {
4041
-                $xtimings['###1'] = microtime(true)-$xstart;
4042
-                //run some stuff to make the import quicker
4043
-                wp_defer_term_counting( true );
4044
-                wp_defer_comment_counting( true );
4045
-                $wpdb->query( 'SET autocommit = 0;' );
4038
+				wp_send_json( $json );
4039
+				exit;
4040
+			} else if ( $task == 'import_post' ) {
4041
+				$xtimings['###1'] = microtime(true)-$xstart;
4042
+				//run some stuff to make the import quicker
4043
+				wp_defer_term_counting( true );
4044
+				wp_defer_comment_counting( true );
4045
+				$wpdb->query( 'SET autocommit = 0;' );
4046 4046
 //
4047 4047
 //                remove_all_actions('publish_post');
4048 4048
 //                remove_all_actions('transition_post_status');
4049 4049
 //                remove_all_actions('publish_future_post');
4050 4050
 
4051
-                if (!empty($file)) {
4052
-                    $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4053
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4054
-                    $default_status = 'publish';
4055
-                    $current_date = date_i18n( 'Y-m-d', time() );
4051
+				if (!empty($file)) {
4052
+					$is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4053
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4054
+					$default_status = 'publish';
4055
+					$current_date = date_i18n( 'Y-m-d', time() );
4056 4056
                     
4057
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4057
+					$columns = isset($file[0]) ? $file[0] : NULL;
4058 4058
                     
4059
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4060
-                        $json['error'] = CSV_INVAILD_FILE;
4061
-                        wp_send_json( $json );
4062
-                        exit;
4063
-                    }
4064
-                    $xtimings['###2'] = microtime(true)-$xstart;
4065
-                    $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4066
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4067
-                    $processed_actual = 0;
4068
-                    for ($i = 1; $i <= $limit; $i++) {
4069
-                        $index = $processed + $i;
4070
-                        $gd_post = array();
4059
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4060
+						$json['error'] = CSV_INVAILD_FILE;
4061
+						wp_send_json( $json );
4062
+						exit;
4063
+					}
4064
+					$xtimings['###2'] = microtime(true)-$xstart;
4065
+					$gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4066
+					$wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4067
+					$processed_actual = 0;
4068
+					for ($i = 1; $i <= $limit; $i++) {
4069
+						$index = $processed + $i;
4070
+						$gd_post = array();
4071 4071
                         
4072
-                        if (isset($file[$index])) {
4073
-                            $processed_actual++;
4074
-                            $row = $file[$index];
4075
-                            $row = array_map( 'trim', $row );
4076
-                            //$row = array_map( 'utf8_encode', $row );
4077
-                            $row = array_map( 'addslashes_gpc', $row );
4072
+						if (isset($file[$index])) {
4073
+							$processed_actual++;
4074
+							$row = $file[$index];
4075
+							$row = array_map( 'trim', $row );
4076
+							//$row = array_map( 'utf8_encode', $row );
4077
+							$row = array_map( 'addslashes_gpc', $row );
4078 4078
                             
4079
-                            $post_id = '';
4080
-                            $post_title = '';
4081
-                            $post_date = '';
4082
-                            $post_author = '';
4083
-                            $post_content = '';
4084
-                            $post_category_arr = array();
4085
-                            $default_category = '';
4086
-                            $post_tags = array();
4087
-                            $post_type = '';
4088
-                            $post_status = '';
4089
-                            $is_featured = 0;
4090
-                            $geodir_video = '';
4091
-                            $post_address = '';
4092
-                            $post_city = '';
4093
-                            $post_region = '';
4094
-                            $post_country = '';
4095
-                            $post_zip = '';
4096
-                            $post_latitude = '';
4097
-                            $post_longitude = '';
4098
-                            $post_neighbourhood = '';
4099
-                            $neighbourhood_latitude = '';
4100
-                            $neighbourhood_longitude = '';
4101
-                            $geodir_timing = '';
4102
-                            $geodir_contact = '';
4103
-                            $geodir_email = '';
4104
-                            $geodir_website = '';
4105
-                            $geodir_twitter = '';
4106
-                            $geodir_facebook = '';
4107
-                            $geodir_twitter = '';
4108
-                            $geodir_link_business = null;
4109
-                            $post_images = array();
4079
+							$post_id = '';
4080
+							$post_title = '';
4081
+							$post_date = '';
4082
+							$post_author = '';
4083
+							$post_content = '';
4084
+							$post_category_arr = array();
4085
+							$default_category = '';
4086
+							$post_tags = array();
4087
+							$post_type = '';
4088
+							$post_status = '';
4089
+							$is_featured = 0;
4090
+							$geodir_video = '';
4091
+							$post_address = '';
4092
+							$post_city = '';
4093
+							$post_region = '';
4094
+							$post_country = '';
4095
+							$post_zip = '';
4096
+							$post_latitude = '';
4097
+							$post_longitude = '';
4098
+							$post_neighbourhood = '';
4099
+							$neighbourhood_latitude = '';
4100
+							$neighbourhood_longitude = '';
4101
+							$geodir_timing = '';
4102
+							$geodir_contact = '';
4103
+							$geodir_email = '';
4104
+							$geodir_website = '';
4105
+							$geodir_twitter = '';
4106
+							$geodir_facebook = '';
4107
+							$geodir_twitter = '';
4108
+							$geodir_link_business = null;
4109
+							$post_images = array();
4110 4110
                             
4111
-                            $expire_date = 'Never';
4111
+							$expire_date = 'Never';
4112 4112
                             
4113
-                            $language = '';
4114
-                            $original_post_id = '';
4113
+							$language = '';
4114
+							$original_post_id = '';
4115 4115
                             
4116
-                            $c = 0;
4117
-                            foreach ($columns as $column ) {
4118
-                                $gd_post[$column] = $row[$c];
4116
+							$c = 0;
4117
+							foreach ($columns as $column ) {
4118
+								$gd_post[$column] = $row[$c];
4119 4119
                                 
4120
-                                if ( $column == 'post_id' ) {
4121
-                                    $post_id = $row[$c];
4122
-                                } else if ( $column == 'post_title' ) {
4123
-                                    $post_title = sanitize_text_field($row[$c]);
4124
-                                } else if ( $column == 'post_author' ) {
4125
-                                    $post_author = $row[$c];
4126
-                                } else if ( $column == 'post_date' ) {
4127
-                                    $post_date = $row[$c];
4128
-                                } else if ( $column == 'post_content' ) {
4129
-                                    $post_content = $row[$c];
4130
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4131
-                                    $post_category_arr = explode( ',', $row[$c] );
4132
-                                } else if ( $column == 'default_category' ) {
4133
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
4134
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4135
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4136
-                                } else if ( $column == 'post_type' ) {
4137
-                                    $post_type = $row[$c];
4138
-                                } else if ( $column == 'post_status' ) {
4139
-                                    $post_status = sanitize_key( $row[$c] );
4140
-                                } else if ( $column == 'is_featured' ) {
4141
-                                    $is_featured = (int)$row[$c];
4142
-                                } else if ( $column == 'geodir_video' ) {
4143
-                                    $geodir_video = $row[$c];
4144
-                                } else if ( $column == 'post_address' ) {
4145
-                                    $post_address = sanitize_text_field($row[$c]);
4146
-                                } else if ( $column == 'post_city' ) {
4147
-                                    $post_city = sanitize_text_field($row[$c]);
4148
-                                } else if ( $column == 'post_region' ) {
4149
-                                    $post_region = sanitize_text_field($row[$c]);
4150
-                                } else if ( $column == 'post_country' ) {
4151
-                                    $post_country = sanitize_text_field($row[$c]);
4152
-                                } else if ( $column == 'post_zip' ) {
4153
-                                    $post_zip = sanitize_text_field($row[$c]);
4154
-                                } else if ( $column == 'post_latitude' ) {
4155
-                                    $post_latitude = sanitize_text_field($row[$c]);
4156
-                                } else if ( $column == 'post_longitude' ) {
4157
-                                    $post_longitude = sanitize_text_field($row[$c]);
4158
-                                } else if ( $column == 'post_neighbourhood' ) {
4159
-                                    $post_neighbourhood = sanitize_text_field($row[$c]);
4160
-                                    unset($gd_post[$column]);
4161
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4162
-                                    $neighbourhood_latitude = sanitize_text_field($row[$c]);
4163
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4164
-                                    $neighbourhood_longitude = sanitize_text_field($row[$c]);
4165
-                                } else if ( $column == 'geodir_timing' ) {
4166
-                                    $geodir_timing = sanitize_text_field($row[$c]);
4167
-                                } else if ( $column == 'geodir_contact' ) {
4168
-                                    $geodir_contact = sanitize_text_field($row[$c]);
4169
-                                } else if ( $column == 'geodir_email' ) {
4170
-                                    $geodir_email = sanitize_email($row[$c]);
4171
-                                } else if ( $column == 'geodir_website' ) {
4172
-                                    $geodir_website = sanitize_text_field($row[$c]);
4173
-                                } else if ( $column == 'geodir_twitter' ) {
4174
-                                    $geodir_twitter = sanitize_text_field($row[$c]);
4175
-                                } else if ( $column == 'geodir_facebook' ) {
4176
-                                    $geodir_facebook = sanitize_text_field($row[$c]);
4177
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4178
-                                    $post_images[] = $row[$c];
4179
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4180
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4181
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4182
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
4183
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4184
-                                } else if ( strpos( $column, 'linked_' ) === 0 ) {
4185
-                                    $geodir_link_business = (int)$row[$c];
4186
-                                }
4187
-                                // WPML
4188
-                                if ($is_wpml) {
4189
-                                    if ($column == 'language') {
4190
-                                        $language = geodir_strtolower(trim($row[$c]));
4191
-                                    } else if ($column == 'original_post_id') {
4192
-                                        $original_post_id = (int)$row[$c];
4193
-                                    }
4194
-                                }
4195
-                                // WPML
4196
-                                $c++;
4197
-                            }
4198
-                            // listing claimed or not
4199
-                            if ($is_claim_active && isset($gd_post['claimed'])) {
4200
-                                $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4201
-                            }
4120
+								if ( $column == 'post_id' ) {
4121
+									$post_id = $row[$c];
4122
+								} else if ( $column == 'post_title' ) {
4123
+									$post_title = sanitize_text_field($row[$c]);
4124
+								} else if ( $column == 'post_author' ) {
4125
+									$post_author = $row[$c];
4126
+								} else if ( $column == 'post_date' ) {
4127
+									$post_date = $row[$c];
4128
+								} else if ( $column == 'post_content' ) {
4129
+									$post_content = $row[$c];
4130
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
4131
+									$post_category_arr = explode( ',', $row[$c] );
4132
+								} else if ( $column == 'default_category' ) {
4133
+									$default_category = wp_kses_normalize_entities($row[$c]);
4134
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
4135
+									$post_tags = explode( ',', sanitize_text_field($row[$c]) );
4136
+								} else if ( $column == 'post_type' ) {
4137
+									$post_type = $row[$c];
4138
+								} else if ( $column == 'post_status' ) {
4139
+									$post_status = sanitize_key( $row[$c] );
4140
+								} else if ( $column == 'is_featured' ) {
4141
+									$is_featured = (int)$row[$c];
4142
+								} else if ( $column == 'geodir_video' ) {
4143
+									$geodir_video = $row[$c];
4144
+								} else if ( $column == 'post_address' ) {
4145
+									$post_address = sanitize_text_field($row[$c]);
4146
+								} else if ( $column == 'post_city' ) {
4147
+									$post_city = sanitize_text_field($row[$c]);
4148
+								} else if ( $column == 'post_region' ) {
4149
+									$post_region = sanitize_text_field($row[$c]);
4150
+								} else if ( $column == 'post_country' ) {
4151
+									$post_country = sanitize_text_field($row[$c]);
4152
+								} else if ( $column == 'post_zip' ) {
4153
+									$post_zip = sanitize_text_field($row[$c]);
4154
+								} else if ( $column == 'post_latitude' ) {
4155
+									$post_latitude = sanitize_text_field($row[$c]);
4156
+								} else if ( $column == 'post_longitude' ) {
4157
+									$post_longitude = sanitize_text_field($row[$c]);
4158
+								} else if ( $column == 'post_neighbourhood' ) {
4159
+									$post_neighbourhood = sanitize_text_field($row[$c]);
4160
+									unset($gd_post[$column]);
4161
+								} else if ( $column == 'neighbourhood_latitude' ) {
4162
+									$neighbourhood_latitude = sanitize_text_field($row[$c]);
4163
+								} else if ( $column == 'neighbourhood_longitude' ) {
4164
+									$neighbourhood_longitude = sanitize_text_field($row[$c]);
4165
+								} else if ( $column == 'geodir_timing' ) {
4166
+									$geodir_timing = sanitize_text_field($row[$c]);
4167
+								} else if ( $column == 'geodir_contact' ) {
4168
+									$geodir_contact = sanitize_text_field($row[$c]);
4169
+								} else if ( $column == 'geodir_email' ) {
4170
+									$geodir_email = sanitize_email($row[$c]);
4171
+								} else if ( $column == 'geodir_website' ) {
4172
+									$geodir_website = sanitize_text_field($row[$c]);
4173
+								} else if ( $column == 'geodir_twitter' ) {
4174
+									$geodir_twitter = sanitize_text_field($row[$c]);
4175
+								} else if ( $column == 'geodir_facebook' ) {
4176
+									$geodir_facebook = sanitize_text_field($row[$c]);
4177
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4178
+									$post_images[] = $row[$c];
4179
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4180
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4181
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4182
+									$row[$c] = str_replace('/', '-', $row[$c]);
4183
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4184
+								} else if ( strpos( $column, 'linked_' ) === 0 ) {
4185
+									$geodir_link_business = (int)$row[$c];
4186
+								}
4187
+								// WPML
4188
+								if ($is_wpml) {
4189
+									if ($column == 'language') {
4190
+										$language = geodir_strtolower(trim($row[$c]));
4191
+									} else if ($column == 'original_post_id') {
4192
+										$original_post_id = (int)$row[$c];
4193
+									}
4194
+								}
4195
+								// WPML
4196
+								$c++;
4197
+							}
4198
+							// listing claimed or not
4199
+							if ($is_claim_active && isset($gd_post['claimed'])) {
4200
+								$gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4201
+							}
4202 4202
                             
4203
-                            // WPML
4204
-                            if ($is_wpml && $language != '') {
4205
-                                $sitepress->switch_lang($language, true);
4206
-                            }
4207
-                            // WPML
4203
+							// WPML
4204
+							if ($is_wpml && $language != '') {
4205
+								$sitepress->switch_lang($language, true);
4206
+							}
4207
+							// WPML
4208 4208
 
4209
-                            $gd_post['IMAGE'] = $post_images;
4209
+							$gd_post['IMAGE'] = $post_images;
4210 4210
                             
4211
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4212
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4211
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4212
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4213 4213
                                                                                                                 
4214
-                            $valid = true;
4214
+							$valid = true;
4215 4215
                             
4216
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4217
-                                $invalid++;
4218
-                                $valid = false;
4219
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4220
-                            }
4221
-                            $xtimings['###3'] = microtime(true)-$xstart;
4222
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4223
-                            if ( $location_allowed ) {
4224
-                                $location_result = geodir_get_default_location();
4225
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4226
-                                    $invalid_addr++;
4227
-                                    $valid = false;
4228
-                                    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' ) );
4229
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4230
-                                    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 ) ) ) {
4231
-                                        $invalid_addr++;
4232
-                                        $valid = false;
4233
-                                        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' ) );
4234
-                                    } else {
4235
-                                        if (!$location_manager) {
4236
-                                            $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.
4237
-                                        }
4238
-                                    }
4239
-                                }
4240
-                            }
4241
-                            $xtimings['###4']   = microtime(true)-$xstart;
4242
-                            if ( !$valid ) {
4243
-                                continue;
4244
-                            }
4216
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4217
+								$invalid++;
4218
+								$valid = false;
4219
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4220
+							}
4221
+							$xtimings['###3'] = microtime(true)-$xstart;
4222
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4223
+							if ( $location_allowed ) {
4224
+								$location_result = geodir_get_default_location();
4225
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4226
+									$invalid_addr++;
4227
+									$valid = false;
4228
+									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' ) );
4229
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4230
+									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 ) ) ) {
4231
+										$invalid_addr++;
4232
+										$valid = false;
4233
+										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' ) );
4234
+									} else {
4235
+										if (!$location_manager) {
4236
+											$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.
4237
+										}
4238
+									}
4239
+								}
4240
+							}
4241
+							$xtimings['###4']   = microtime(true)-$xstart;
4242
+							if ( !$valid ) {
4243
+								continue;
4244
+							}
4245 4245
 
4246
-                            $cat_taxonomy = $post_type . 'category';
4247
-                            $tags_taxonomy = $post_type . '_tags';
4246
+							$cat_taxonomy = $post_type . 'category';
4247
+							$tags_taxonomy = $post_type . '_tags';
4248 4248
                             
4249
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4250
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
4251
-                            }
4249
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4250
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
4251
+							}
4252 4252
 
4253
-                            $post_category = array();
4254
-                            $default_category_id = NULL;
4255
-                            if ( !empty( $post_category_arr ) ) {
4256
-                                foreach ( $post_category_arr as $value ) {
4257
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4253
+							$post_category = array();
4254
+							$default_category_id = NULL;
4255
+							if ( !empty( $post_category_arr ) ) {
4256
+								foreach ( $post_category_arr as $value ) {
4257
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
4258 4258
                                     
4259
-                                    if ( $category_name != '' ) {
4260
-                                        $term_category = array();
4259
+									if ( $category_name != '' ) {
4260
+										$term_category = array();
4261 4261
                                         
4262
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4263
-                                            $term_category = $term;
4264
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4265
-                                            $term_category = $term;
4266
-                                        } else {
4267
-                                            $term_data = array();
4268
-                                            $term_data['name'] = $category_name;
4269
-                                            $term_data['taxonomy'] = $cat_taxonomy;
4262
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4263
+											$term_category = $term;
4264
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4265
+											$term_category = $term;
4266
+										} else {
4267
+											$term_data = array();
4268
+											$term_data['name'] = $category_name;
4269
+											$term_data['taxonomy'] = $cat_taxonomy;
4270 4270
                                             
4271
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4272
-                                            if ( $term_id ) {
4273
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4274
-                                            }
4275
-                                        }
4271
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4272
+											if ( $term_id ) {
4273
+												$term_category = get_term( $term_id, $cat_taxonomy );
4274
+											}
4275
+										}
4276 4276
                                         
4277
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4278
-                                            $post_category[] = intval($term_category->term_id);
4277
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4278
+											$post_category[] = intval($term_category->term_id);
4279 4279
                                             
4280
-                                            if ($category_name == $default_category) {
4281
-                                                $default_category_id = intval($term_category->term_id);
4282
-                                            }
4283
-                                        }
4284
-                                    }
4285
-                                }
4286
-                            }
4287
-                            $xtimings['###5'] = microtime(true)-$xstart;
4288
-                            $save_post = array();
4289
-                            $save_post['post_title'] = $post_title;
4290
-                            if (!empty($post_date)) {
4291
-                                $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4280
+											if ($category_name == $default_category) {
4281
+												$default_category_id = intval($term_category->term_id);
4282
+											}
4283
+										}
4284
+									}
4285
+								}
4286
+							}
4287
+							$xtimings['###5'] = microtime(true)-$xstart;
4288
+							$save_post = array();
4289
+							$save_post['post_title'] = $post_title;
4290
+							if (!empty($post_date)) {
4291
+								$post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4292 4292
                                 
4293
-                                $save_post['post_date'] = $post_date;
4294
-                                $save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4295
-                            }
4296
-                            $save_post['post_content'] = $post_content;
4297
-                            $save_post['post_type'] = $post_type;
4298
-                            $save_post['post_author'] = $post_author;
4299
-                            $save_post['post_status'] = $post_status;
4300
-                            $save_post['post_category'] = $post_category;
4301
-                            $save_post['post_tags'] = $post_tags;
4302
-
4303
-                            $saved_post_id = NULL;
4304
-                            if ( $import_choice == 'update' ) {
4305
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4293
+								$save_post['post_date'] = $post_date;
4294
+								$save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4295
+							}
4296
+							$save_post['post_content'] = $post_content;
4297
+							$save_post['post_type'] = $post_type;
4298
+							$save_post['post_author'] = $post_author;
4299
+							$save_post['post_status'] = $post_status;
4300
+							$save_post['post_category'] = $post_category;
4301
+							$save_post['post_tags'] = $post_tags;
4302
+
4303
+							$saved_post_id = NULL;
4304
+							if ( $import_choice == 'update' ) {
4305
+								$gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4306 4306
                                 
4307
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4308
-                                    $save_post['ID'] = $post_id;
4307
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4308
+									$save_post['ID'] = $post_id;
4309 4309
                                     
4310
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4311
-                                        if ( is_wp_error( $saved_post_id ) ) {
4312
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4313
-                                            $saved_post_id = 0;
4314
-                                        } else {
4315
-                                            $saved_post_id = $post_id;
4316
-                                            $updated++;
4317
-                                        }
4318
-                                    }
4319
-                                } else {
4320
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4321
-                                        if ( is_wp_error( $saved_post_id ) ) {
4322
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4323
-                                            $saved_post_id = 0;
4324
-                                        } else {
4325
-                                            $created++;
4326
-                                        }
4327
-                                    }
4328
-                                }
4310
+									if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4311
+										if ( is_wp_error( $saved_post_id ) ) {
4312
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4313
+											$saved_post_id = 0;
4314
+										} else {
4315
+											$saved_post_id = $post_id;
4316
+											$updated++;
4317
+										}
4318
+									}
4319
+								} else {
4320
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4321
+										if ( is_wp_error( $saved_post_id ) ) {
4322
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4323
+											$saved_post_id = 0;
4324
+										} else {
4325
+											$created++;
4326
+										}
4327
+									}
4328
+								}
4329 4329
                                 
4330
-                                if ( !$saved_post_id > 0 ) {
4331
-                                    $invalid++;
4332
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4333
-                                }
4334
-                            } else if ( $import_choice == 'skip' ) {
4335
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4336
-                                    $skipped++;	
4337
-                                } else {
4338
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4339
-                                        if ( is_wp_error( $saved_post_id ) ) {
4340
-                                            $invalid++;
4330
+								if ( !$saved_post_id > 0 ) {
4331
+									$invalid++;
4332
+									geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4333
+								}
4334
+							} else if ( $import_choice == 'skip' ) {
4335
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4336
+									$skipped++;	
4337
+								} else {
4338
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4339
+										if ( is_wp_error( $saved_post_id ) ) {
4340
+											$invalid++;
4341 4341
                                             
4342
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4343
-                                            $saved_post_id = 0;
4344
-                                        } else {
4345
-                                            $created++;
4346
-                                        }
4347
-                                    } else {
4348
-                                        $invalid++;
4342
+											geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4343
+											$saved_post_id = 0;
4344
+										} else {
4345
+											$created++;
4346
+										}
4347
+									} else {
4348
+										$invalid++;
4349 4349
                                         
4350
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4351
-                                    }
4352
-                                }
4353
-                            } else {
4354
-                                $invalid++;
4350
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4351
+									}
4352
+								}
4353
+							} else {
4354
+								$invalid++;
4355 4355
                                 
4356
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4357
-                            }
4358
-                            $xtimings['###6'] = microtime(true)-$xstart;
4359
-                            if ( (int)$saved_post_id > 0 ) {
4360
-                                // WPML
4361
-                                if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
4362
-                                    $wpml_post_type = 'post_' . $post_type;
4363
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4364
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4365
-
4366
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4356
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4357
+							}
4358
+							$xtimings['###6'] = microtime(true)-$xstart;
4359
+							if ( (int)$saved_post_id > 0 ) {
4360
+								// WPML
4361
+								if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
4362
+									$wpml_post_type = 'post_' . $post_type;
4363
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4364
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4365
+
4366
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4367 4367
                                     
4368
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4369
-                                }
4370
-                                // WPML
4371
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4368
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4369
+								}
4370
+								// WPML
4371
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
4372 4372
                                 
4373
-                                $gd_post['post_id'] = $saved_post_id;
4374
-                                $gd_post['ID'] = $saved_post_id;
4375
-                                $gd_post['post_tags'] = $post_tags;
4376
-                                $gd_post['post_title'] = $post_title;
4377
-                                $gd_post['post_status'] = $post_status;
4378
-                                $gd_post['submit_time'] = time();
4379
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4373
+								$gd_post['post_id'] = $saved_post_id;
4374
+								$gd_post['ID'] = $saved_post_id;
4375
+								$gd_post['post_tags'] = $post_tags;
4376
+								$gd_post['post_title'] = $post_title;
4377
+								$gd_post['post_status'] = $post_status;
4378
+								$gd_post['submit_time'] = time();
4379
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4380 4380
                                                     
4381
-                                // post location
4382
-                                $post_location_id = 0;
4383
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4384
-                                    $gd_post['post_neighbourhood'] = '';
4381
+								// post location
4382
+								$post_location_id = 0;
4383
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4384
+									$gd_post['post_neighbourhood'] = '';
4385 4385
                                     
4386
-                                    $post_location_info = array(
4387
-                                                                'city' => $post_city,
4388
-                                                                'region' => $post_region,
4389
-                                                                'country' => $post_country,
4390
-                                                                'geo_lat' => $post_latitude,
4391
-                                                                'geo_lng' => $post_longitude
4392
-                                                            );
4393
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4394
-                                        $post_location_id = $location_id;
4395
-                                    }
4386
+									$post_location_info = array(
4387
+																'city' => $post_city,
4388
+																'region' => $post_region,
4389
+																'country' => $post_country,
4390
+																'geo_lat' => $post_latitude,
4391
+																'geo_lng' => $post_longitude
4392
+															);
4393
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4394
+										$post_location_id = $location_id;
4395
+									}
4396 4396
                                     
4397
-                                    if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4398
-                                        $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4397
+									if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4398
+										$neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4399 4399
 
4400
-                                        $hood_data = array();
4401
-                                        $hood_data['hood_location_id'] = $post_location_id;
4402
-                                        $hood_data['hood_name'] = $post_neighbourhood;
4400
+										$hood_data = array();
4401
+										$hood_data['hood_location_id'] = $post_location_id;
4402
+										$hood_data['hood_name'] = $post_neighbourhood;
4403 4403
                                         
4404
-                                        if (!empty($neighbourhood_info)) {
4405
-                                            $hood_data['hood_id'] = $neighbourhood_info->hood_id;
4406
-                                            $hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4404
+										if (!empty($neighbourhood_info)) {
4405
+											$hood_data['hood_id'] = $neighbourhood_info->hood_id;
4406
+											$hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4407 4407
                                             
4408
-                                            if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4409
-                                                $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4410
-                                                $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4411
-                                            }
4412
-                                        }
4408
+											if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4409
+												$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4410
+												$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4411
+											}
4412
+										}
4413 4413
                                         
4414
-                                        if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4415
-                                            $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4416
-                                            $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4417
-                                        }
4414
+										if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4415
+											$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4416
+											$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4417
+										}
4418 4418
                                         
4419
-                                        $hood_data['hood_latitude'] = $post_latitude;
4420
-                                        $hood_data['hood_longitude'] = $post_longitude;
4421
-
4422
-                                        $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4423
-                                        if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4424
-                                            $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4425
-                                        }
4426
-                                    }
4427
-                                }
4428
-                                $gd_post['post_location_id'] = $post_location_id;
4419
+										$hood_data['hood_latitude'] = $post_latitude;
4420
+										$hood_data['hood_longitude'] = $post_longitude;
4421
+
4422
+										$neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4423
+										if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4424
+											$gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4425
+										}
4426
+									}
4427
+								}
4428
+								$gd_post['post_location_id'] = $post_location_id;
4429 4429
                                 
4430
-                                if ($geodir_link_business !== null) {
4431
-                                    $gd_post['geodir_link_business'] = $geodir_link_business > 0 ? $geodir_link_business : '';
4432
-                                }
4430
+								if ($geodir_link_business !== null) {
4431
+									$gd_post['geodir_link_business'] = $geodir_link_business > 0 ? $geodir_link_business : '';
4432
+								}
4433 4433
                                 
4434
-                                // post package info
4435
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4436
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4437
-                                    $package_id = $gd_post_info->package_id;
4438
-                                }
4434
+								// post package info
4435
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4436
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4437
+									$package_id = $gd_post_info->package_id;
4438
+								}
4439 4439
                                 
4440
-                                $package_info = array();
4441
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4442
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4440
+								$package_info = array();
4441
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4442
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
4443 4443
                                     
4444
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4445
-                                        $package_info = array();
4446
-                                    }
4447
-                                }
4444
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4445
+										$package_info = array();
4446
+									}
4447
+								}
4448 4448
                                 
4449
-                                if (empty($package_info)) {
4450
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4451
-                                }
4449
+								if (empty($package_info)) {
4450
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
4451
+								}
4452 4452
                                  
4453
-                                if (!empty($package_info))	 {
4454
-                                    $package_id = $package_info['pid'];
4453
+								if (!empty($package_info))	 {
4454
+									$package_id = $package_info['pid'];
4455 4455
                                     
4456
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4457
-                                        $gd_post['expire_date'] = $expire_date;
4458
-                                    } else {
4459
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4460
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4461
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4462
-                                        } else {
4463
-                                            $gd_post['expire_date'] = 'Never';
4464
-                                        }
4465
-                                    }
4456
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4457
+										$gd_post['expire_date'] = $expire_date;
4458
+									} else {
4459
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4460
+											$gd_post['alive_days'] = (int)$package_info['days'];
4461
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4462
+										} else {
4463
+											$gd_post['expire_date'] = 'Never';
4464
+										}
4465
+									}
4466 4466
                                     
4467
-                                    $gd_post['package_id'] = $package_id;
4468
-                                }
4467
+									$gd_post['package_id'] = $package_id;
4468
+								}
4469 4469
 
4470
-                                $table = $plugin_prefix . $post_type . '_detail';
4470
+								$table = $plugin_prefix . $post_type . '_detail';
4471 4471
                                 
4472
-                                if ($post_type == 'gd_event') {
4473
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
4474
-                                }
4472
+								if ($post_type == 'gd_event') {
4473
+									$gd_post = geodir_imex_process_event_data($gd_post);
4474
+								}
4475 4475
                                 
4476
-                                if (isset($gd_post['post_id'])) {
4477
-                                    unset($gd_post['post_id']);
4478
-                                }
4476
+								if (isset($gd_post['post_id'])) {
4477
+									unset($gd_post['post_id']);
4478
+								}
4479 4479
 
4480
-                                // Export franchise fields
4481
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4482
-                                if ($is_franchise_active) {
4483
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
4484
-                                        if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
4485
-                                            $gd_franchise_lock = array();
4480
+								// Export franchise fields
4481
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4482
+								if ($is_franchise_active) {
4483
+									if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
4484
+										if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
4485
+											$gd_franchise_lock = array();
4486 4486
                                             
4487
-                                            if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4488
-                                                $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4489
-                                                $gd_franchise_lock = trim( $gd_franchise_lock );
4490
-                                                $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4491
-                                            }
4487
+											if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4488
+												$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4489
+												$gd_franchise_lock = trim( $gd_franchise_lock );
4490
+												$gd_franchise_lock = explode( ",", $gd_franchise_lock );
4491
+											}
4492 4492
                                             
4493
-                                            update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4494
-                                            update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4495
-                                        } else {
4496
-                                            if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
4497
-                                                geodir_franchise_remove_franchise( $saved_post_id );
4498
-                                            }
4499
-                                        }
4500
-                                    } else {
4501
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4502
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4503
-                                        }
4504
-                                    }
4505
-                                }
4493
+											update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4494
+											update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4495
+										} else {
4496
+											if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
4497
+												geodir_franchise_remove_franchise( $saved_post_id );
4498
+											}
4499
+										}
4500
+									} else {
4501
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4502
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4503
+										}
4504
+									}
4505
+								}
4506 4506
                                 
4507
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4508
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4509
-                                    if ($default_category_id) {
4510
-                                        $save_post['post_default_category'] = $default_category_id;
4511
-                                        $gd_post['default_category'] = $default_category_id;
4512
-                                    }
4513
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
4514
-                                }
4515
-                                $xtimings['###7'] = microtime(true)-$xstart;
4516
-                                // Save post info
4517
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4518
-                                $xtimings['###8'] = microtime(true)-$xstart;
4519
-                                // post taxonomies
4520
-                                if ( !empty( $save_post['post_category'] ) ) {
4521
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4507
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4508
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4509
+									if ($default_category_id) {
4510
+										$save_post['post_default_category'] = $default_category_id;
4511
+										$gd_post['default_category'] = $default_category_id;
4512
+									}
4513
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
4514
+								}
4515
+								$xtimings['###7'] = microtime(true)-$xstart;
4516
+								// Save post info
4517
+								geodir_save_post_info( $saved_post_id, $gd_post );
4518
+								$xtimings['###8'] = microtime(true)-$xstart;
4519
+								// post taxonomies
4520
+								if ( !empty( $save_post['post_category'] ) ) {
4521
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4522 4522
                                     
4523
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4524
-                                    if ($default_category_id) {
4525
-                                        $post_default_category = $default_category_id;
4526
-                                    }
4527
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4528
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4529
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4523
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4524
+									if ($default_category_id) {
4525
+										$post_default_category = $default_category_id;
4526
+									}
4527
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4528
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4529
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4530 4530
                                     
4531
-                                    if ($post_category_str != '' && $post_default_category) {
4532
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4533
-                                    }
4531
+									if ($post_category_str != '' && $post_default_category) {
4532
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4533
+									}
4534 4534
                                     
4535
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4535
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4536 4536
                                     
4537
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4538
-                                }
4539
-                                $xtimings['###8.1'] = microtime(true)-$xstart;
4540
-                                if ( !empty( $save_post['post_tags'] ) ) {
4541
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4542
-                                }
4543
-                                $xtimings['###9'] = microtime(true)-$xstart;
4544
-                                // Post images
4545
-                                if ( !empty( $post_images ) ) {
4546
-                                    $post_images = array_unique($post_images);
4537
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4538
+								}
4539
+								$xtimings['###8.1'] = microtime(true)-$xstart;
4540
+								if ( !empty( $save_post['post_tags'] ) ) {
4541
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4542
+								}
4543
+								$xtimings['###9'] = microtime(true)-$xstart;
4544
+								// Post images
4545
+								if ( !empty( $post_images ) ) {
4546
+									$post_images = array_unique($post_images);
4547 4547
                                     
4548
-                                    $old_post_images_arr = array();
4549
-                                    $saved_post_images_arr = array();
4548
+									$old_post_images_arr = array();
4549
+									$saved_post_images_arr = array();
4550 4550
                                     
4551
-                                    $order = 1;
4551
+									$order = 1;
4552 4552
                                     
4553
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4554
-                                    $xtimings['###9.1'] = microtime(true)-$xstart;
4555
-                                    if (!empty($old_post_images)) {
4556
-                                        foreach( $old_post_images as $old_post_image ) {
4557
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4558
-                                                $old_post_images_arr[] = $old_post_image->file;
4559
-                                            }
4560
-                                        }
4561
-                                    }
4553
+									$old_post_images = geodir_get_images( $saved_post_id );
4554
+									$xtimings['###9.1'] = microtime(true)-$xstart;
4555
+									if (!empty($old_post_images)) {
4556
+										foreach( $old_post_images as $old_post_image ) {
4557
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4558
+												$old_post_images_arr[] = $old_post_image->file;
4559
+											}
4560
+										}
4561
+									}
4562 4562
 
4563
-                                    foreach ( $post_images as $post_image ) {
4564
-                                        $image_name = basename( $post_image );
4565
-                                        $saved_post_images_arr[] = $image_name;
4563
+									foreach ( $post_images as $post_image ) {
4564
+										$image_name = basename( $post_image );
4565
+										$saved_post_images_arr[] = $image_name;
4566 4566
                                         
4567
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4568
-                                            continue; // Skip if image already exists.
4569
-                                        }
4567
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4568
+											continue; // Skip if image already exists.
4569
+										}
4570 4570
                                         
4571
-                                        $image_name_parts = explode( '.', $image_name );
4572
-                                        array_pop( $image_name_parts );
4573
-                                        $proper_image_name = implode( '.', $image_name_parts );
4574
-                                        $xtimings['###9.2'] = microtime(true)-$xstart;
4575
-                                        $arr_file_type = wp_check_filetype( $image_name );
4576
-                                        $xtimings['###9.3'] = microtime(true)-$xstart;
4577
-                                        if ( !empty( $arr_file_type ) ) {
4578
-                                            $uploaded_file_type = $arr_file_type['type'];
4571
+										$image_name_parts = explode( '.', $image_name );
4572
+										array_pop( $image_name_parts );
4573
+										$proper_image_name = implode( '.', $image_name_parts );
4574
+										$xtimings['###9.2'] = microtime(true)-$xstart;
4575
+										$arr_file_type = wp_check_filetype( $image_name );
4576
+										$xtimings['###9.3'] = microtime(true)-$xstart;
4577
+										if ( !empty( $arr_file_type ) ) {
4578
+											$uploaded_file_type = $arr_file_type['type'];
4579 4579
                                             
4580
-                                            $attachment = array();
4581
-                                            $attachment['post_id'] = $saved_post_id;
4582
-                                            $attachment['title'] = $proper_image_name;
4583
-                                            $attachment['content'] = '';
4584
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4585
-                                            $attachment['mime_type'] = $uploaded_file_type;
4586
-                                            $attachment['menu_order'] = $order;
4587
-                                            $attachment['is_featured'] = 0;
4588
-
4589
-                                            $attachment_set = '';
4590
-                                            foreach ( $attachment as $key => $val ) {
4591
-                                                if ( $val != '' ) {
4592
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4593
-                                                }
4594
-                                            }
4595
-                                            $attachment_set = trim( $attachment_set, ", " );
4580
+											$attachment = array();
4581
+											$attachment['post_id'] = $saved_post_id;
4582
+											$attachment['title'] = $proper_image_name;
4583
+											$attachment['content'] = '';
4584
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
4585
+											$attachment['mime_type'] = $uploaded_file_type;
4586
+											$attachment['menu_order'] = $order;
4587
+											$attachment['is_featured'] = 0;
4588
+
4589
+											$attachment_set = '';
4590
+											foreach ( $attachment as $key => $val ) {
4591
+												if ( $val != '' ) {
4592
+													$attachment_set .= $key . " = '" . $val . "', ";
4593
+												}
4594
+											}
4595
+											$attachment_set = trim( $attachment_set, ", " );
4596 4596
                                                                                         
4597
-                                            // Add new attachment
4598
-                                            $xtimings['###9.4'] = microtime(true)-$xstart;
4599
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4600
-                                            $xtimings['###9.5'] = microtime(true)-$xstart;
4601
-                                            $order++;
4602
-                                        }
4603
-                                    }
4604
-
4605
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4606
-                                    // Remove previous attachment
4607
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4608
-                                    $xtimings['###9.6'] = microtime(true)-$xstart;
4609
-                                    if ( !empty( $saved_post_images_arr ) ) {
4610
-                                        geodir_set_wp_featured_image($saved_post_id);
4611
-                                        $xtimings['###9.7'] = microtime(true)-$xstart;
4612
-                                        /*
4597
+											// Add new attachment
4598
+											$xtimings['###9.4'] = microtime(true)-$xstart;
4599
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4600
+											$xtimings['###9.5'] = microtime(true)-$xstart;
4601
+											$order++;
4602
+										}
4603
+									}
4604
+
4605
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4606
+									// Remove previous attachment
4607
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4608
+									$xtimings['###9.6'] = microtime(true)-$xstart;
4609
+									if ( !empty( $saved_post_images_arr ) ) {
4610
+										geodir_set_wp_featured_image($saved_post_id);
4611
+										$xtimings['###9.7'] = microtime(true)-$xstart;
4612
+										/*
4613 4613
                                         $menu_order = 1;
4614 4614
                                         
4615 4615
                                         foreach ( $saved_post_images_arr as $img_name ) {
@@ -4622,288 +4622,288 @@  discard block
 block discarded – undo
4622 4622
                                             }
4623 4623
                                             $menu_order++;
4624 4624
                                         }*/
4625
-                                    }
4625
+									}
4626 4626
                                     
4627
-                                    if ( $order > 1 ) {
4628
-                                        $images++;
4629
-                                    }
4630
-                                }
4631
-                                $xtimings['###10'] = microtime(true)-$xstart;
4632
-                                /** This action is documented in geodirectory-functions/post-functions.php */
4633
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4634
-                                $xtimings['###11'] = microtime(true)-$xstart;
4635
-                                if (isset($is_featured)) {
4636
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4637
-                                }
4638
-                                if (isset($gd_post['alive_days'])) {
4639
-                                    geodir_save_post_meta($saved_post_id, 'alive_days', $gd_post['alive_days']);
4640
-                                }
4641
-                                if (isset($gd_post['expire_date'])) {
4642
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4643
-                                }
4644
-                                $xtimings['###12'] = microtime(true)-$xstart;
4645
-                            }
4627
+									if ( $order > 1 ) {
4628
+										$images++;
4629
+									}
4630
+								}
4631
+								$xtimings['###10'] = microtime(true)-$xstart;
4632
+								/** This action is documented in geodirectory-functions/post-functions.php */
4633
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4634
+								$xtimings['###11'] = microtime(true)-$xstart;
4635
+								if (isset($is_featured)) {
4636
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4637
+								}
4638
+								if (isset($gd_post['alive_days'])) {
4639
+									geodir_save_post_meta($saved_post_id, 'alive_days', $gd_post['alive_days']);
4640
+								}
4641
+								if (isset($gd_post['expire_date'])) {
4642
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4643
+								}
4644
+								$xtimings['###12'] = microtime(true)-$xstart;
4645
+							}
4646 4646
                             
4647
-                            // WPML
4648
-                            if ($is_wpml && $language != '') {
4649
-                                $sitepress->switch_lang($active_lang, true);
4650
-                            }
4651
-                            // WPML
4652
-                        }
4653
-                    }
4654
-                }
4647
+							// WPML
4648
+							if ($is_wpml && $language != '') {
4649
+								$sitepress->switch_lang($active_lang, true);
4650
+							}
4651
+							// WPML
4652
+						}
4653
+					}
4654
+				}
4655 4655
 
4656
-                //undo some stuff to make the import quicker
4657
-                wp_defer_term_counting( false );
4658
-                wp_defer_comment_counting( false );
4659
-                $wpdb->query( 'COMMIT;' );
4660
-                $wpdb->query( 'SET autocommit = 1;' );
4661
-                $xtimings['###13'] = microtime(true)-$xstart;
4662
-                $json = array();
4663
-                $json['processed'] = $processed_actual;
4664
-                $json['created'] = $created;
4665
-                $json['updated'] = $updated;
4666
-                $json['skipped'] = $skipped;
4667
-                $json['invalid'] = $invalid;
4668
-                $json['invalid_addr'] = $invalid_addr;
4669
-                $json['images'] = $images;
4670
-                $json['timing'] = microtime(true)-$xstart;
4671
-                $json['timings'] = $xtimings;
4656
+				//undo some stuff to make the import quicker
4657
+				wp_defer_term_counting( false );
4658
+				wp_defer_comment_counting( false );
4659
+				$wpdb->query( 'COMMIT;' );
4660
+				$wpdb->query( 'SET autocommit = 1;' );
4661
+				$xtimings['###13'] = microtime(true)-$xstart;
4662
+				$json = array();
4663
+				$json['processed'] = $processed_actual;
4664
+				$json['created'] = $created;
4665
+				$json['updated'] = $updated;
4666
+				$json['skipped'] = $skipped;
4667
+				$json['invalid'] = $invalid;
4668
+				$json['invalid_addr'] = $invalid_addr;
4669
+				$json['images'] = $images;
4670
+				$json['timing'] = microtime(true)-$xstart;
4671
+				$json['timings'] = $xtimings;
4672 4672
                 
4673 4673
 
4674
-                wp_send_json( $json );
4675
-                exit;
4676
-            } else if ( $task == 'import_loc' ) {
4677
-                global $gd_post_types;
4678
-                $gd_post_types = $post_types;
4674
+				wp_send_json( $json );
4675
+				exit;
4676
+			} else if ( $task == 'import_loc' ) {
4677
+				global $gd_post_types;
4678
+				$gd_post_types = $post_types;
4679 4679
                 
4680
-                if (!empty($file)) {
4681
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4680
+				if (!empty($file)) {
4681
+					$columns = isset($file[0]) ? $file[0] : NULL;
4682 4682
                     
4683
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4684
-                        $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4685
-                        wp_send_json( $json );
4686
-                    }
4683
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4684
+						$json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4685
+						wp_send_json( $json );
4686
+					}
4687 4687
                     
4688
-                    $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4689
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4690
-                    for ($i = 1; $i <= $limit; $i++) {
4691
-                        $index = $processed + $i;
4688
+					$gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4689
+					$gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4690
+					for ($i = 1; $i <= $limit; $i++) {
4691
+						$index = $processed + $i;
4692 4692
                         
4693
-                        if (isset($file[$index])) {
4694
-                            $row = $file[$index];
4695
-                            $row = array_map( 'trim', $row );
4696
-                            $data = array();
4693
+						if (isset($file[$index])) {
4694
+							$row = $file[$index];
4695
+							$row = array_map( 'trim', $row );
4696
+							$data = array();
4697 4697
                             
4698
-                            foreach ($columns as $c => $column ) {
4699
-                                if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4700
-                                    $data[$column] = $row[$c];
4701
-                                }
4702
-                            }
4698
+							foreach ($columns as $c => $column ) {
4699
+								if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4700
+									$data[$column] = $row[$c];
4701
+								}
4702
+							}
4703 4703
 
4704
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4705
-                                $invalid++;
4706
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4707
-                                continue;
4708
-                            }
4704
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4705
+								$invalid++;
4706
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4707
+								continue;
4708
+							}
4709 4709
                             
4710
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4710
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4711 4711
                             
4712
-                            if ( $import_choice == 'update' ) {
4713
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4714
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4715
-                                        $updated++;
4716
-                                    } else {
4717
-                                        $invalid++;
4718
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4719
-                                    }
4720
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4721
-                                    $data['location_id'] = (int)$location->location_id;
4712
+							if ( $import_choice == 'update' ) {
4713
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4714
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4715
+										$updated++;
4716
+									} else {
4717
+										$invalid++;
4718
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4719
+									}
4720
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4721
+									$data['location_id'] = (int)$location->location_id;
4722 4722
                                     
4723
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4724
-                                        $data['location_id'] = (int)$location->location_id;
4725
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4726
-                                        $data['location_id'] = (int)$location->location_id;
4727
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4728
-                                        $data['location_id'] = (int)$location->location_id;
4729
-                                    }
4723
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4724
+										$data['location_id'] = (int)$location->location_id;
4725
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4726
+										$data['location_id'] = (int)$location->location_id;
4727
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4728
+										$data['location_id'] = (int)$location->location_id;
4729
+									}
4730 4730
                                     
4731
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4732
-                                        $updated++;
4733
-                                    } else {
4734
-                                        $invalid++;
4735
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4736
-                                    }
4737
-                                } else {
4738
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4739
-                                        $created++;
4740
-                                    } else {
4741
-                                        $invalid++;
4742
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4743
-                                    }
4744
-                                }
4745
-                            } elseif ( $import_choice == 'skip' ) {
4746
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4747
-                                    $skipped++;
4748
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4749
-                                    $skipped++;
4750
-                                } else {
4751
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4752
-                                        $created++;
4753
-                                    } else {
4754
-                                        $invalid++;
4755
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4756
-                                    }
4757
-                                }
4758
-                            } else {
4759
-                                $invalid++;
4760
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4761
-                            }
4762
-                        }
4763
-                    }
4764
-                }
4731
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4732
+										$updated++;
4733
+									} else {
4734
+										$invalid++;
4735
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4736
+									}
4737
+								} else {
4738
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4739
+										$created++;
4740
+									} else {
4741
+										$invalid++;
4742
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4743
+									}
4744
+								}
4745
+							} elseif ( $import_choice == 'skip' ) {
4746
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4747
+									$skipped++;
4748
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4749
+									$skipped++;
4750
+								} else {
4751
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4752
+										$created++;
4753
+									} else {
4754
+										$invalid++;
4755
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4756
+									}
4757
+								}
4758
+							} else {
4759
+								$invalid++;
4760
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4761
+							}
4762
+						}
4763
+					}
4764
+				}
4765 4765
                 
4766
-                $json = array();
4767
-                $json['processed'] = $limit;
4768
-                $json['created'] = $created;
4769
-                $json['updated'] = $updated;
4770
-                $json['skipped'] = $skipped;
4771
-                $json['invalid'] = $invalid;
4772
-                $json['images'] = $images;
4766
+				$json = array();
4767
+				$json['processed'] = $limit;
4768
+				$json['created'] = $created;
4769
+				$json['updated'] = $updated;
4770
+				$json['skipped'] = $skipped;
4771
+				$json['invalid'] = $invalid;
4772
+				$json['images'] = $images;
4773 4773
                 
4774
-                wp_send_json( $json );
4775
-            } else if ( $task == 'import_hood' ) {               
4776
-                if (!empty($file)) {
4777
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4774
+				wp_send_json( $json );
4775
+			} else if ( $task == 'import_hood' ) {               
4776
+				if (!empty($file)) {
4777
+					$columns = isset($file[0]) ? $file[0] : NULL;
4778 4778
                     
4779
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4780
-                        $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4781
-                        wp_send_json( $json );
4782
-                    }
4779
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4780
+						$json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4781
+						wp_send_json( $json );
4782
+					}
4783 4783
                     
4784
-                    $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4785
-                    $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' );
4786
-                    for ($i = 1; $i <= $limit; $i++) {
4787
-                        $index = $processed + $i;
4784
+					$gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4785
+					$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' );
4786
+					for ($i = 1; $i <= $limit; $i++) {
4787
+						$index = $processed + $i;
4788 4788
                         
4789
-                        if (isset($file[$index])) {
4790
-                            $row = $file[$index];
4791
-                            $row = array_map( 'trim', $row );
4792
-                            $data = array();
4789
+						if (isset($file[$index])) {
4790
+							$row = $file[$index];
4791
+							$row = array_map( 'trim', $row );
4792
+							$data = array();
4793 4793
                             
4794
-                            foreach ($columns as $c => $column) {
4795
-                                if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4796
-                                    $data[$column] = sanitize_text_field($row[$c]);
4797
-                                }
4798
-                            }
4794
+							foreach ($columns as $c => $column) {
4795
+								if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4796
+									$data[$column] = sanitize_text_field($row[$c]);
4797
+								}
4798
+							}
4799 4799
 
4800
-                            if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4801
-                                $invalid++;
4802
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4803
-                                continue;
4804
-                            }
4800
+							if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4801
+								$invalid++;
4802
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4803
+								continue;
4804
+							}
4805 4805
                             
4806
-                            $location_info = array();
4807
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4808
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4809
-                            } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4810
-                                $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4811
-                            }
4806
+							$location_info = array();
4807
+							if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4808
+								$location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4809
+							} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4810
+								$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4811
+							}
4812 4812
 
4813
-                            if (empty($location_info)) {
4814
-                                $invalid++;
4815
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4816
-                                continue;
4817
-                            }
4813
+							if (empty($location_info)) {
4814
+								$invalid++;
4815
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4816
+								continue;
4817
+							}
4818 4818
                             
4819
-                            $location_id = $location_info->location_id;
4819
+							$location_id = $location_info->location_id;
4820 4820
 
4821
-                            $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4821
+							$data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4822 4822
                             
4823
-                            $hood_data = array();
4824
-                            $hood_data['hood_name'] = $data['neighbourhood_name'];
4825
-                            $hood_data['hood_slug'] = $data['neighbourhood_slug'];
4826
-                            $hood_data['hood_latitude'] = $data['latitude'];
4827
-                            $hood_data['hood_longitude'] = $data['longitude'];
4828
-                            $hood_data['hood_location_id'] = $location_id;
4823
+							$hood_data = array();
4824
+							$hood_data['hood_name'] = $data['neighbourhood_name'];
4825
+							$hood_data['hood_slug'] = $data['neighbourhood_slug'];
4826
+							$hood_data['hood_latitude'] = $data['latitude'];
4827
+							$hood_data['hood_longitude'] = $data['longitude'];
4828
+							$hood_data['hood_location_id'] = $location_id;
4829 4829
                                     
4830
-                            if ( $import_choice == 'update' ) {
4831
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4832
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4830
+							if ( $import_choice == 'update' ) {
4831
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4832
+									$hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4833 4833
                                     
4834
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4835
-                                        $updated++;
4836
-                                    } else {
4837
-                                        $invalid++;
4838
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4839
-                                    }
4840
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4841
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4834
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4835
+										$updated++;
4836
+									} else {
4837
+										$invalid++;
4838
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4839
+									}
4840
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4841
+									$hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4842 4842
                                     
4843
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4844
-                                        $updated++;
4845
-                                    } else {
4846
-                                        $invalid++;
4847
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4848
-                                    }
4849
-                                } else {
4850
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4851
-                                        $created++;
4852
-                                    } else {
4853
-                                        $invalid++;
4854
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4855
-                                    }
4856
-                                }
4857
-                            } elseif ( $import_choice == 'skip' ) {
4858
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4859
-                                    $skipped++;
4860
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4861
-                                    $skipped++;
4862
-                                } else {
4843
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4844
+										$updated++;
4845
+									} else {
4846
+										$invalid++;
4847
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4848
+									}
4849
+								} else {
4850
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4851
+										$created++;
4852
+									} else {
4853
+										$invalid++;
4854
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4855
+									}
4856
+								}
4857
+							} elseif ( $import_choice == 'skip' ) {
4858
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4859
+									$skipped++;
4860
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4861
+									$skipped++;
4862
+								} else {
4863 4863
                                     
4864
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4865
-                                        $created++;
4866
-                                    } else {
4867
-                                        $invalid++;
4868
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4869
-                                    }
4870
-                                }
4871
-                            } else {
4872
-                                $invalid++;
4873
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4874
-                            }
4875
-                        }
4876
-                    }
4877
-                }
4864
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4865
+										$created++;
4866
+									} else {
4867
+										$invalid++;
4868
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4869
+									}
4870
+								}
4871
+							} else {
4872
+								$invalid++;
4873
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4874
+							}
4875
+						}
4876
+					}
4877
+				}
4878 4878
                 
4879
-                $json = array();
4880
-                $json['processed'] = $limit;
4881
-                $json['created'] = $created;
4882
-                $json['updated'] = $updated;
4883
-                $json['skipped'] = $skipped;
4884
-                $json['invalid'] = $invalid;
4885
-                $json['images'] = $images;
4879
+				$json = array();
4880
+				$json['processed'] = $limit;
4881
+				$json['created'] = $created;
4882
+				$json['updated'] = $updated;
4883
+				$json['skipped'] = $skipped;
4884
+				$json['invalid'] = $invalid;
4885
+				$json['images'] = $images;
4886 4886
                 
4887
-                wp_send_json( $json );
4888
-            }
4889
-        }
4890
-        break;
4891
-        case 'import_finish':{
4892
-            /**
4893
-             * Run an action when an import finishes.
4894
-             *
4895
-             * This action can be used to fire functions after an import ends.
4896
-             *
4897
-             * @since 1.5.3
4898
-             * @package GeoDirectory
4899
-             */
4900
-            do_action('geodir_import_finished');
4901
-        }
4902
-        break;
4887
+				wp_send_json( $json );
4888
+			}
4889
+		}
4890
+		break;
4891
+		case 'import_finish':{
4892
+			/**
4893
+			 * Run an action when an import finishes.
4894
+			 *
4895
+			 * This action can be used to fire functions after an import ends.
4896
+			 *
4897
+			 * @since 1.5.3
4898
+			 * @package GeoDirectory
4899
+			 */
4900
+			do_action('geodir_import_finished');
4901
+		}
4902
+		break;
4903 4903
 
4904
-    }
4905
-    echo '0';
4906
-    gd_die();
4904
+	}
4905
+	echo '0';
4906
+	gd_die();
4907 4907
 }
4908 4908
 
4909 4909
 /**
@@ -4947,12 +4947,12 @@  discard block
 block discarded – undo
4947 4947
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
4948 4948
 	}
4949 4949
 	
4950
-    if( !empty( $term ) ) {
4950
+	if( !empty( $term ) ) {
4951 4951
 		$result = wp_insert_term( $term, $taxonomy, $args );
4952
-        if( !is_wp_error( $result ) ) {
4953
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4954
-        }
4955
-    }
4952
+		if( !is_wp_error( $result ) ) {
4953
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4954
+		}
4955
+	}
4956 4956
 	
4957 4957
 	return false;
4958 4958
 }
@@ -4998,16 +4998,16 @@  discard block
 block discarded – undo
4998 4998
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
4999 4999
 		
5000 5000
 		if( !is_wp_error( $result ) ) {
5001
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5002
-        }
5001
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5002
+		}
5003 5003
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5004 5004
 		$term_data['term_id'] = $term_info['term_id'];
5005 5005
 		
5006 5006
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5007 5007
 		
5008 5008
 		if( !is_wp_error( $result ) ) {
5009
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5010
-        }
5009
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5010
+		}
5011 5011
 	} else {
5012 5012
 		return geodir_imex_insert_term( $taxonomy, $term_data );
5013 5013
 	}
@@ -5029,47 +5029,47 @@  discard block
 block discarded – undo
5029 5029
  * @return int Posts count.
5030 5030
  */
5031 5031
 function geodir_get_posts_count( $post_type ) {
5032
-    global $wpdb, $plugin_prefix;
5032
+	global $wpdb, $plugin_prefix;
5033 5033
 
5034
-    if ( !post_type_exists( $post_type ) ) {
5035
-        return 0;
5036
-    }
5034
+	if ( !post_type_exists( $post_type ) ) {
5035
+		return 0;
5036
+	}
5037 5037
         
5038
-    $table = $plugin_prefix . $post_type . '_detail';
5038
+	$table = $plugin_prefix . $post_type . '_detail';
5039 5039
 
5040
-    // Skip listing with statuses trash, auto-draft etc...
5041
-    $skip_statuses = geodir_imex_export_skip_statuses();
5042
-    $where_statuses = '';
5043
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5044
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5045
-    }
5040
+	// Skip listing with statuses trash, auto-draft etc...
5041
+	$skip_statuses = geodir_imex_export_skip_statuses();
5042
+	$where_statuses = '';
5043
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5044
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5045
+	}
5046 5046
     
5047
-    /**
5048
-     * Filter the SQL where clause part to filter posts count in import/export.
5049
-     *
5050
-     * @since 1.6.4
5051
-     * @package GeoDirectory
5052
-     *
5053
-     * @param string $where SQL where clause part.
5054
-     */
5055
-    $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5056
-
5057
-    $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 );
5058
-
5059
-    $posts_count = (int)$wpdb->get_var( $query );
5047
+	/**
5048
+	 * Filter the SQL where clause part to filter posts count in import/export.
5049
+	 *
5050
+	 * @since 1.6.4
5051
+	 * @package GeoDirectory
5052
+	 *
5053
+	 * @param string $where SQL where clause part.
5054
+	 */
5055
+	$where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5056
+
5057
+	$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 );
5058
+
5059
+	$posts_count = (int)$wpdb->get_var( $query );
5060 5060
     
5061
-    /**
5062
-     * Modify returned post counts for the current post type.
5063
-     *
5064
-     * @since 1.4.6
5065
-     * @package GeoDirectory
5066
-     *
5067
-     * @param int $posts_count Post counts.
5068
-     * @param string $post_type Post type.
5069
-     */
5070
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5071
-
5072
-    return $posts_count;
5061
+	/**
5062
+	 * Modify returned post counts for the current post type.
5063
+	 *
5064
+	 * @since 1.4.6
5065
+	 * @package GeoDirectory
5066
+	 *
5067
+	 * @param int $posts_count Post counts.
5068
+	 * @param string $post_type Post type.
5069
+	 */
5070
+	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5071
+
5072
+	return $posts_count;
5073 5073
 }
5074 5074
 
5075 5075
 /**
@@ -5137,7 +5137,7 @@  discard block
 block discarded – undo
5137 5137
 		}
5138 5138
 		$csv_row[] = 'post_status';
5139 5139
 		$csv_row[] = 'is_featured';
5140
-        // Export claim listing field
5140
+		// Export claim listing field
5141 5141
 		if ($is_claim_active) {
5142 5142
 			$csv_row[] = 'claimed';
5143 5143
 		}
@@ -5146,7 +5146,7 @@  discard block
 block discarded – undo
5146 5146
 			$csv_row[] = 'alive_days';
5147 5147
 			$csv_row[] = 'expire_date';
5148 5148
 		}
5149
-        $csv_row[] = 'post_date';
5149
+		$csv_row[] = 'post_date';
5150 5150
 		$csv_row[] = 'post_address';
5151 5151
 		$csv_row[] = 'post_city';
5152 5152
 		$csv_row[] = 'post_region';
@@ -5154,11 +5154,11 @@  discard block
 block discarded – undo
5154 5154
 		$csv_row[] = 'post_zip';
5155 5155
 		$csv_row[] = 'post_latitude';
5156 5156
 		$csv_row[] = 'post_longitude';
5157
-        if ($neighbourhood_active) {
5158
-            $csv_row[] = 'post_neighbourhood';
5159
-            $csv_row[] = 'neighbourhood_latitude';
5160
-            $csv_row[] = 'neighbourhood_longitude';
5161
-        }
5157
+		if ($neighbourhood_active) {
5158
+			$csv_row[] = 'post_neighbourhood';
5159
+			$csv_row[] = 'neighbourhood_latitude';
5160
+			$csv_row[] = 'neighbourhood_longitude';
5161
+		}
5162 5162
 		$csv_row[] = 'geodir_timing';
5163 5163
 		$csv_row[] = 'geodir_contact';
5164 5164
 		$csv_row[] = 'geodir_email';
@@ -5193,21 +5193,21 @@  discard block
 block discarded – undo
5193 5193
 			$csv_row[] = 'franchise';
5194 5194
 		}
5195 5195
         
5196
-        /**
5197
-         * Filter columns field names of gd export listings csv.
5198
-         *
5199
-         * @since 1.6.5
5200
-         * @package GeoDirectory
5201
-         *
5202
-         * @param array $csv_row Column names being exported in csv.
5203
-         * @param string $post_type The post type.
5204
-         */
5205
-        $csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
5196
+		/**
5197
+		 * Filter columns field names of gd export listings csv.
5198
+		 *
5199
+		 * @since 1.6.5
5200
+		 * @package GeoDirectory
5201
+		 *
5202
+		 * @param array $csv_row Column names being exported in csv.
5203
+		 * @param string $post_type The post type.
5204
+		 */
5205
+		$csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
5206 5206
 		
5207 5207
 		$csv_rows[] = $csv_row;
5208 5208
 
5209 5209
 		$images_count = 5;
5210
-        $xx=0;
5210
+		$xx=0;
5211 5211
 		foreach ( $posts as $post ) {$xx++;
5212 5212
 			$post_id = $post['ID'];
5213 5213
 			
@@ -5338,15 +5338,15 @@  discard block
 block discarded – undo
5338 5338
 			}
5339 5339
 			$csv_row[] = $post_info['post_status']; // post_status
5340 5340
 			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5341
-            if ($is_claim_active) {
5342
-                $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5343
-            }
5341
+			if ($is_claim_active) {
5342
+				$csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5343
+			}
5344 5344
 			if ($is_payment_plugin) {
5345 5345
 				$csv_row[] = (int)$post_info['package_id']; // package_id
5346 5346
 				$csv_row[] = $post_info['alive_days'] !== '' ? absint($post_info['alive_days']) : ''; // alive_days
5347 5347
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
5348 5348
 			}
5349
-            $csv_row[] = $post_info['post_date']; // post_date
5349
+			$csv_row[] = $post_info['post_date']; // post_date
5350 5350
 			$csv_row[] = stripslashes($post_info['post_address']); // post_address
5351 5351
 			$csv_row[] = stripslashes($post_info['post_city']); // post_city
5352 5352
 			$csv_row[] = stripslashes($post_info['post_region']); // post_region
@@ -5354,21 +5354,21 @@  discard block
 block discarded – undo
5354 5354
 			$csv_row[] = stripslashes($post_info['post_zip']); // post_zip
5355 5355
 			$csv_row[] = $post_info['post_latitude']; // post_latitude
5356 5356
 			$csv_row[] = $post_info['post_longitude']; // post_longitude
5357
-            if ($neighbourhood_active) {
5358
-                $post_neighbourhood = '';
5359
-                $neighbourhood_latitude = '';
5360
-                $neighbourhood_longitude = '';
5361
-                if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5362
-                    if (!empty($hood_info)) {
5363
-                        $post_neighbourhood = $hood_info->hood_name;
5364
-                        $neighbourhood_latitude = $hood_info->hood_latitude;
5365
-                        $neighbourhood_longitude = $hood_info->hood_longitude;
5366
-                    }
5367
-                }
5368
-                $csv_row[] = stripslashes($post_neighbourhood); // post_neighbourhood
5369
-                $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5370
-                $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5371
-            }
5357
+			if ($neighbourhood_active) {
5358
+				$post_neighbourhood = '';
5359
+				$neighbourhood_latitude = '';
5360
+				$neighbourhood_longitude = '';
5361
+				if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5362
+					if (!empty($hood_info)) {
5363
+						$post_neighbourhood = $hood_info->hood_name;
5364
+						$neighbourhood_latitude = $hood_info->hood_latitude;
5365
+						$neighbourhood_longitude = $hood_info->hood_longitude;
5366
+					}
5367
+				}
5368
+				$csv_row[] = stripslashes($post_neighbourhood); // post_neighbourhood
5369
+				$csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5370
+				$csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5371
+			}
5372 5372
 			$csv_row[] = stripslashes($post_info['geodir_timing']); // geodir_timing
5373 5373
 			$csv_row[] = stripslashes($post_info['geodir_contact']); // geodir_contact
5374 5374
 			$csv_row[] = stripslashes($post_info['geodir_email']); // geodir_email
@@ -5411,16 +5411,16 @@  discard block
 block discarded – undo
5411 5411
 				$csv_row[] = (int)$franchise; // franchise id
5412 5412
 			}
5413 5413
             
5414
-            /**
5415
-             * Filter columns values of gd export listings csv file
5416
-             *
5417
-             * @since 1.6.5
5418
-             * @package GeoDirectory
5419
-             *
5420
-             * @param array $csv_row Field values being exported in csv.
5421
-             * @param array $post_info The post info.
5422
-             */
5423
-            $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5414
+			/**
5415
+			 * Filter columns values of gd export listings csv file
5416
+			 *
5417
+			 * @since 1.6.5
5418
+			 * @package GeoDirectory
5419
+			 *
5420
+			 * @param array $csv_row Field values being exported in csv.
5421
+			 * @param array $post_info The post info.
5422
+			 */
5423
+			$csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5424 5424
 			
5425 5425
 			for ( $c = 0; $c < $images_count; $c++ ) {
5426 5426
 				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
@@ -5453,64 +5453,64 @@  discard block
 block discarded – undo
5453 5453
  * @return array Array of posts data.
5454 5454
  */
5455 5455
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5456
-    global $wpdb, $plugin_prefix;
5456
+	global $wpdb, $plugin_prefix;
5457 5457
 
5458
-    if ( ! post_type_exists( $post_type ) )
5459
-        return new stdClass;
5458
+	if ( ! post_type_exists( $post_type ) )
5459
+		return new stdClass;
5460 5460
         
5461
-    $table = $plugin_prefix . $post_type . '_detail';
5461
+	$table = $plugin_prefix . $post_type . '_detail';
5462 5462
 
5463
-    $limit = '';
5464
-    if ( $per_page > 0 && $page_no > 0 ) {
5465
-        $offset = ( $page_no - 1 ) * $per_page;
5463
+	$limit = '';
5464
+	if ( $per_page > 0 && $page_no > 0 ) {
5465
+		$offset = ( $page_no - 1 ) * $per_page;
5466 5466
         
5467
-        if ( $offset > 0 ) {
5468
-            $limit = " LIMIT " . $offset . "," . $per_page;
5469
-        } else {
5470
-            $limit = " LIMIT " . $per_page;
5471
-        }
5472
-    }
5467
+		if ( $offset > 0 ) {
5468
+			$limit = " LIMIT " . $offset . "," . $per_page;
5469
+		} else {
5470
+			$limit = " LIMIT " . $per_page;
5471
+		}
5472
+	}
5473 5473
 
5474
-    // Skip listing with statuses trash, auto-draft etc...
5475
-    $skip_statuses = geodir_imex_export_skip_statuses();
5476
-    $where_statuses = '';
5477
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5478
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5479
-    }
5474
+	// Skip listing with statuses trash, auto-draft etc...
5475
+	$skip_statuses = geodir_imex_export_skip_statuses();
5476
+	$where_statuses = '';
5477
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5478
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5479
+	}
5480 5480
     
5481
-    /**
5482
-     * Filter the SQL where clause part to filter posts in import/export.
5483
-     *
5484
-     * @since 1.6.4
5485
-     * @package GeoDirectory
5486
-     *
5487
-     * @param string $where SQL where clause part.
5488
-     */
5489
-    $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5490
-
5491
-    $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
5492
-    /**
5493
-     * Modify returned posts SQL query for the current post type.
5494
-     *
5495
-     * @since 1.4.6
5496
-     * @package GeoDirectory
5497
-     *
5498
-     * @param int $query The SQL query.
5499
-     * @param string $post_type Post type.
5500
-     */
5501
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5502
-    $results = (array)$wpdb->get_results( $query, ARRAY_A );
5503
-
5504
-    /**
5505
-     * Modify returned post results for the current post type.
5506
-     *
5507
-     * @since 1.4.6
5508
-     * @package GeoDirectory
5509
-     *
5510
-     * @param object $results An object containing all post ids.
5511
-     * @param string $post_type Post type.
5512
-     */
5513
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5481
+	/**
5482
+	 * Filter the SQL where clause part to filter posts in import/export.
5483
+	 *
5484
+	 * @since 1.6.4
5485
+	 * @package GeoDirectory
5486
+	 *
5487
+	 * @param string $where SQL where clause part.
5488
+	 */
5489
+	$where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5490
+
5491
+	$query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
5492
+	/**
5493
+	 * Modify returned posts SQL query for the current post type.
5494
+	 *
5495
+	 * @since 1.4.6
5496
+	 * @package GeoDirectory
5497
+	 *
5498
+	 * @param int $query The SQL query.
5499
+	 * @param string $post_type Post type.
5500
+	 */
5501
+	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5502
+	$results = (array)$wpdb->get_results( $query, ARRAY_A );
5503
+
5504
+	/**
5505
+	 * Modify returned post results for the current post type.
5506
+	 *
5507
+	 * @since 1.4.6
5508
+	 * @package GeoDirectory
5509
+	 *
5510
+	 * @param object $results An object containing all post ids.
5511
+	 * @param string $post_type Post type.
5512
+	 */
5513
+	return apply_filters( 'geodir_export_posts', $results, $post_type );
5514 5514
 }
5515 5515
 
5516 5516
 /**
@@ -5529,26 +5529,26 @@  discard block
 block discarded – undo
5529 5529
  * @return string The SQL query.
5530 5530
  */
5531 5531
 function geodir_imex_get_events_query( $query, $post_type ) {
5532
-    if ( $post_type == 'gd_event' ) {
5533
-        global $wpdb, $plugin_prefix;
5532
+	if ( $post_type == 'gd_event' ) {
5533
+		global $wpdb, $plugin_prefix;
5534 5534
         
5535
-        $table = $plugin_prefix . $post_type . '_detail';
5536
-        $schedule_table = EVENT_SCHEDULE;
5535
+		$table = $plugin_prefix . $post_type . '_detail';
5536
+		$schedule_table = EVENT_SCHEDULE;
5537 5537
         
5538
-        // Skip listing with statuses trash, auto-draft etc...
5539
-        $skip_statuses = geodir_imex_export_skip_statuses();
5540
-        $where_statuses = '';
5541
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5542
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5543
-        }
5538
+		// Skip listing with statuses trash, auto-draft etc...
5539
+		$skip_statuses = geodir_imex_export_skip_statuses();
5540
+		$where_statuses = '';
5541
+		if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5542
+			$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5543
+		}
5544 5544
         
5545
-        /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5546
-        $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5545
+		/** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5546
+		$where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5547 5547
 
5548
-        $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
5549
-    }
5548
+		$query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
5549
+	}
5550 5550
 
5551
-    return $query;
5551
+	return $query;
5552 5552
 }
5553 5553
 
5554 5554
 /**
@@ -5570,36 +5570,36 @@  discard block
 block discarded – undo
5570 5570
  * @return int Total terms count.
5571 5571
  */
5572 5572
 function geodir_get_terms_count( $post_type ) {
5573
-    $args = array( 'hide_empty' => 0 );
5573
+	$args = array( 'hide_empty' => 0 );
5574 5574
 
5575
-    remove_all_filters( 'get_terms' );
5575
+	remove_all_filters( 'get_terms' );
5576 5576
 
5577
-    $taxonomy = $post_type . 'category';
5577
+	$taxonomy = $post_type . 'category';
5578 5578
 
5579
-    // WPML
5580
-    $is_wpml = geodir_is_wpml();
5581
-    $active_lang = 'all';
5582
-    if ( $is_wpml ) {
5583
-        global $sitepress;
5584
-        $active_lang = $sitepress->get_current_language();
5579
+	// WPML
5580
+	$is_wpml = geodir_is_wpml();
5581
+	$active_lang = 'all';
5582
+	if ( $is_wpml ) {
5583
+		global $sitepress;
5584
+		$active_lang = $sitepress->get_current_language();
5585 5585
         
5586
-        if ( $active_lang != 'all' ) {
5587
-            $sitepress->switch_lang( 'all', true );
5588
-        }
5589
-    }
5590
-    // WPML
5586
+		if ( $active_lang != 'all' ) {
5587
+			$sitepress->switch_lang( 'all', true );
5588
+		}
5589
+	}
5590
+	// WPML
5591 5591
             
5592
-    $count_terms = wp_count_terms( $taxonomy, $args );
5592
+	$count_terms = wp_count_terms( $taxonomy, $args );
5593 5593
 
5594
-    // WPML
5595
-    if ( $is_wpml && $active_lang !== 'all' ) {
5596
-        global $sitepress;
5597
-        $sitepress->switch_lang( $active_lang, true );
5598
-    }
5599
-    // WPML
5600
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5594
+	// WPML
5595
+	if ( $is_wpml && $active_lang !== 'all' ) {
5596
+		global $sitepress;
5597
+		$sitepress->switch_lang( $active_lang, true );
5598
+	}
5599
+	// WPML
5600
+	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5601 5601
      
5602
-    return $count_terms;
5602
+	return $count_terms;
5603 5603
 }
5604 5604
 
5605 5605
 /**
@@ -5638,11 +5638,11 @@  discard block
 block discarded – undo
5638 5638
 		$csv_row[] = 'cat_posttype';
5639 5639
 		$csv_row[] = 'cat_parent';
5640 5640
 		$csv_row[] = 'cat_schema';
5641
-        // WPML
5641
+		// WPML
5642 5642
 		$is_wpml = geodir_wpml_is_taxonomy_translated( $taxonomy );
5643 5643
 		if ($is_wpml) {
5644 5644
 			$csv_row[] = 'cat_language';
5645
-            $csv_row[] = 'cat_id_original';
5645
+			$csv_row[] = 'cat_id_original';
5646 5646
 		}
5647 5647
 		// WPML
5648 5648
 		$csv_row[] = 'cat_description';
@@ -5672,10 +5672,10 @@  discard block
 block discarded – undo
5672 5672
 			$csv_row[] = $post_type;
5673 5673
 			$csv_row[] = $cat_parent;
5674 5674
 			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5675
-            // WPML
5675
+			// WPML
5676 5676
 			if ($is_wpml) {
5677 5677
 				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5678
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5678
+				$csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5679 5679
 			}
5680 5680
 			// WPML
5681 5681
 			$csv_row[] = $term->description;
@@ -6093,43 +6093,43 @@  discard block
 block discarded – undo
6093 6093
  * @param string $status Post status.
6094 6094
  */
6095 6095
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
6096
-    global $wpdb, $current_user;
6097
-
6098
-    $option_value = get_option($option);
6099
-
6100
-    if ($option_value > 0) :
6101
-        if (get_post($option_value)) :
6102
-            // Page exists
6103
-            return;
6104
-        endif;
6105
-    endif;
6106
-
6107
-    $page_found = $wpdb->get_var(
6108
-        $wpdb->prepare(
6109
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6110
-            array($slug)
6111
-        )
6112
-    );
6113
-
6114
-    if ($page_found) :
6115
-        // Page exists
6116
-        if (!$option_value) update_option($option, $page_found);
6117
-        return;
6118
-    endif;
6119
-
6120
-    $page_data = array(
6121
-        'post_status' => $status,
6122
-        'post_type' => 'page',
6123
-        'post_author' => $current_user->ID,
6124
-        'post_name' => $slug,
6125
-        'post_title' => $page_title,
6126
-        'post_content' => $page_content,
6127
-        'post_parent' => $post_parent,
6128
-        'comment_status' => 'closed'
6129
-    );
6130
-    $page_id = wp_insert_post($page_data);
6131
-
6132
-    add_option($option, $page_id);
6096
+	global $wpdb, $current_user;
6097
+
6098
+	$option_value = get_option($option);
6099
+
6100
+	if ($option_value > 0) :
6101
+		if (get_post($option_value)) :
6102
+			// Page exists
6103
+			return;
6104
+		endif;
6105
+	endif;
6106
+
6107
+	$page_found = $wpdb->get_var(
6108
+		$wpdb->prepare(
6109
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6110
+			array($slug)
6111
+		)
6112
+	);
6113
+
6114
+	if ($page_found) :
6115
+		// Page exists
6116
+		if (!$option_value) update_option($option, $page_found);
6117
+		return;
6118
+	endif;
6119
+
6120
+	$page_data = array(
6121
+		'post_status' => $status,
6122
+		'post_type' => 'page',
6123
+		'post_author' => $current_user->ID,
6124
+		'post_name' => $slug,
6125
+		'post_title' => $page_title,
6126
+		'post_content' => $page_content,
6127
+		'post_parent' => $post_parent,
6128
+		'comment_status' => 'closed'
6129
+	);
6130
+	$page_id = wp_insert_post($page_data);
6131
+
6132
+	add_option($option, $page_id);
6133 6133
 
6134 6134
 }
6135 6135
 
@@ -6160,9 +6160,9 @@  discard block
 block discarded – undo
6160 6160
  * @package GeoDirectory
6161 6161
  */
6162 6162
 function geodir_admin_upgrade_notice() {
6163
-    $class = "error";
6164
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6165
-    echo"<div class=\"$class\"> <p>$message</p></div>";
6163
+	$class = "error";
6164
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6165
+	echo"<div class=\"$class\"> <p>$message</p></div>";
6166 6166
 }
6167 6167
 
6168 6168
 /**
@@ -6175,18 +6175,18 @@  discard block
 block discarded – undo
6175 6175
  */
6176 6176
 function geodire_admin_upgrade_notice( $plugin_data, $r )
6177 6177
 {
6178
-    // readme contents
6179
-    $args = array(
6180
-        'timeout'     => 15,
6181
-        'redirection' => 5
6182
-    );
6183
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6184
-    $data       = wp_remote_get( $url, $args );
6178
+	// readme contents
6179
+	$args = array(
6180
+		'timeout'     => 15,
6181
+		'redirection' => 5
6182
+	);
6183
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6184
+	$data       = wp_remote_get( $url, $args );
6185 6185
 
6186
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
6186
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
6187 6187
 
6188
-        geodir_in_plugin_update_message($data['body']);
6189
-    }
6188
+		geodir_in_plugin_update_message($data['body']);
6189
+	}
6190 6190
 }
6191 6191
 
6192 6192
 
@@ -6194,28 +6194,28 @@  discard block
 block discarded – undo
6194 6194
 * @param string $content http response body
6195 6195
 */
6196 6196
 function geodir_in_plugin_update_message($content) {
6197
-    // Output Upgrade Notice
6198
-    $matches        = null;
6199
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6200
-    $upgrade_notice = '';
6201
-    if ( preg_match( $regexp, $content, $matches ) ) {
6202
-        if(empty($matches)){return;}
6203
-
6204
-        $version = trim( $matches[1] );
6205
-        if($version && $version>GEODIRECTORY_VERSION){
6206
-
6207
-
6208
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6209
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6210
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6211
-            foreach ( $notices as $index => $line ) {
6212
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6213
-            }
6214
-            $upgrade_notice .= '</div> ';
6215
-        }
6216
-        }
6217
-    }
6218
-    echo $upgrade_notice;
6197
+	// Output Upgrade Notice
6198
+	$matches        = null;
6199
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6200
+	$upgrade_notice = '';
6201
+	if ( preg_match( $regexp, $content, $matches ) ) {
6202
+		if(empty($matches)){return;}
6203
+
6204
+		$version = trim( $matches[1] );
6205
+		if($version && $version>GEODIRECTORY_VERSION){
6206
+
6207
+
6208
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6209
+		if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6210
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6211
+			foreach ( $notices as $index => $line ) {
6212
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6213
+			}
6214
+			$upgrade_notice .= '</div> ';
6215
+		}
6216
+		}
6217
+	}
6218
+	echo $upgrade_notice;
6219 6219
 }
6220 6220
 
6221 6221
 /**
@@ -6248,19 +6248,19 @@  discard block
 block discarded – undo
6248 6248
  * @param array Listing statuses to be skipped.
6249 6249
  */
6250 6250
 function geodir_imex_export_skip_statuses() {
6251
-    $statuses = array( 'trash', 'auto-draft' );
6251
+	$statuses = array( 'trash', 'auto-draft' );
6252 6252
     
6253
-    /**
6254
-     * Filter the statuses to skip during GD export listings.
6255
-     *
6256
-     * @since 1.6.0
6257
-     * @package GeoDirectory
6258
-     *
6259
-     * @param array $statuses Listing statuses to be skipped.
6260
-     */
6261
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6253
+	/**
6254
+	 * Filter the statuses to skip during GD export listings.
6255
+	 *
6256
+	 * @since 1.6.0
6257
+	 * @package GeoDirectory
6258
+	 *
6259
+	 * @param array $statuses Listing statuses to be skipped.
6260
+	 */
6261
+	$statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6262 6262
      
6263
-    return $statuses;
6263
+	return $statuses;
6264 6264
 }
6265 6265
 
6266 6266
 /**
@@ -6276,42 +6276,42 @@  discard block
 block discarded – undo
6276 6276
  * @global string $typenow Current post type.
6277 6277
  */
6278 6278
 function geodir_admin_dequeue_scripts() {
6279
-    global $typenow;
6279
+	global $typenow;
6280 6280
     
6281
-    // EDD
6282
-    if (wp_script_is('jquery-chosen', 'enqueued')) {
6283
-        wp_dequeue_script('jquery-chosen');
6284
-    }
6281
+	// EDD
6282
+	if (wp_script_is('jquery-chosen', 'enqueued')) {
6283
+		wp_dequeue_script('jquery-chosen');
6284
+	}
6285 6285
     
6286
-    // Ultimate Addons for Visual Composer
6287
-    if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6288
-        wp_dequeue_script('ultimate-vc-backend-script');
6289
-    }
6286
+	// Ultimate Addons for Visual Composer
6287
+	if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6288
+		wp_dequeue_script('ultimate-vc-backend-script');
6289
+	}
6290 6290
     
6291
-    // VC editor conflicts
6292
-    if (class_exists('Vc_Role_Access_Controller') && wp_script_is('dfd_vc_damin_scripts', 'enqueued')) {
6293
-        wp_dequeue_script('dfd_vc_damin_scripts');
6294
-    }
6291
+	// VC editor conflicts
6292
+	if (class_exists('Vc_Role_Access_Controller') && wp_script_is('dfd_vc_damin_scripts', 'enqueued')) {
6293
+		wp_dequeue_script('dfd_vc_damin_scripts');
6294
+	}
6295 6295
     
6296
-    // Ultimate chosen
6297
-    if (wp_script_is('ultimate-chosen-script', 'enqueued')) {
6298
-        wp_dequeue_script('ultimate-chosen-script');
6299
-    }
6296
+	// Ultimate chosen
6297
+	if (wp_script_is('ultimate-chosen-script', 'enqueued')) {
6298
+		wp_dequeue_script('ultimate-chosen-script');
6299
+	}
6300 6300
     
6301
-    // Crum composer choosen
6302
-    if (wp_script_is('crum-composer-choosen', 'enqueued')) {
6303
-        wp_dequeue_script('crum-composer-choosen');
6304
-    }
6301
+	// Crum composer choosen
6302
+	if (wp_script_is('crum-composer-choosen', 'enqueued')) {
6303
+		wp_dequeue_script('crum-composer-choosen');
6304
+	}
6305 6305
     
6306
-    // Fix conflict Fusion Builder jquery chosen with GD jquery chosen.
6307
-    if (class_exists('FusionBuilder') && wp_script_is('fusion_builder_chosen_js', 'enqueued')) {
6308
-        wp_dequeue_script('fusion_builder_chosen_js');
6309
-    }
6306
+	// Fix conflict Fusion Builder jquery chosen with GD jquery chosen.
6307
+	if (class_exists('FusionBuilder') && wp_script_is('fusion_builder_chosen_js', 'enqueued')) {
6308
+		wp_dequeue_script('fusion_builder_chosen_js');
6309
+	}
6310 6310
     
6311
-    // Fix conflicts timepicker & setting date value.
6312
-    if (class_exists('acf') && wp_script_is('acf-timepicker', 'enqueued')) {
6313
-        wp_dequeue_script('acf-timepicker');
6314
-    }
6311
+	// Fix conflicts timepicker & setting date value.
6312
+	if (class_exists('acf') && wp_script_is('acf-timepicker', 'enqueued')) {
6313
+		wp_dequeue_script('acf-timepicker');
6314
+	}
6315 6315
 }
6316 6316
 
6317 6317
 /**
@@ -6327,48 +6327,48 @@  discard block
 block discarded – undo
6327 6327
  * @return string SQL where clause part.
6328 6328
  */
6329 6329
 function geodir_imex_get_filter_where($where = '', $post_type = '') {
6330
-    global $wpdb;
6330
+	global $wpdb;
6331 6331
     
6332
-    $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6332
+	$filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6333 6333
     
6334
-    if ( !empty( $filters ) ) {
6335
-        foreach ( $filters as $field => $value ) {
6336
-            switch ($field) {
6337
-                case 'start_date':
6338
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6339
-                break;
6340
-                case 'end_date':
6341
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6342
-                break;
6343
-            }
6344
-        }
6345
-    }
6334
+	if ( !empty( $filters ) ) {
6335
+		foreach ( $filters as $field => $value ) {
6336
+			switch ($field) {
6337
+				case 'start_date':
6338
+					$where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6339
+				break;
6340
+				case 'end_date':
6341
+					$where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6342
+				break;
6343
+			}
6344
+		}
6345
+	}
6346 6346
     
6347
-    return $where;
6347
+	return $where;
6348 6348
 }
6349 6349
 add_filter('geodir_get_posts_count', 'geodir_imex_get_filter_where', 10, 2);
6350 6350
 add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
6351 6351
 
6352 6352
 
6353 6353
 function geodir_fix_for_primer_theme(){
6354
-    if(!defined( 'PRIMER_VERSION' )){return;}
6355
-    global $pagenow;
6354
+	if(!defined( 'PRIMER_VERSION' )){return;}
6355
+	global $pagenow;
6356 6356
 
6357
-    if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6357
+	if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6358 6358
 
6359
-        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6359
+		$post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6360 6360
 
6361
-        $post_types = geodir_get_posttypes();
6362
-        if ($post_type && in_array($post_type, $post_types) ) {
6363
-            global $primer_customizer_layouts;
6364
-            remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6365
-        }
6366
-    }
6361
+		$post_types = geodir_get_posttypes();
6362
+		if ($post_type && in_array($post_type, $post_types) ) {
6363
+			global $primer_customizer_layouts;
6364
+			remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6365
+		}
6366
+	}
6367 6367
 
6368 6368
 }
6369 6369
 
6370 6370
 if(is_admin()){
6371
-    add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6371
+	add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6372 6372
 }
6373 6373
 
6374 6374
 
@@ -6501,96 +6501,96 @@  discard block
 block discarded – undo
6501 6501
 
6502 6502
 function geodir_ga_activation_url() {
6503 6503
 
6504
-    return add_query_arg( array(
6505
-        'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6506
-        'scope'         => GEODIR_GA_SCOPE,
6507
-        'response_type' => 'code',
6508
-        'redirect_uri'  => GEODIR_GA_REDIRECT,
6509
-        'client_id'     => GEODIR_GA_CLIENTID,
6510
-    ), 'https://accounts.google.com/o/oauth2/auth' );
6504
+	return add_query_arg( array(
6505
+		'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6506
+		'scope'         => GEODIR_GA_SCOPE,
6507
+		'response_type' => 'code',
6508
+		'redirect_uri'  => GEODIR_GA_REDIRECT,
6509
+		'client_id'     => GEODIR_GA_CLIENTID,
6510
+	), 'https://accounts.google.com/o/oauth2/auth' );
6511 6511
 
6512
-    return $url;
6512
+	return $url;
6513 6513
 }
6514 6514
 
6515 6515
 function geodir_gd_accounts(){
6516
-    $accounts = array();
6517
-    $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6518
-    if($useAuth){
6519
-        try {
6520
-            $accounts = geodir_ga_get_analytics_accounts();
6521
-        } catch (Exception $e) {
6522
-            geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6523
-        }
6516
+	$accounts = array();
6517
+	$useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6518
+	if($useAuth){
6519
+		try {
6520
+			$accounts = geodir_ga_get_analytics_accounts();
6521
+		} catch (Exception $e) {
6522
+			geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6523
+		}
6524 6524
         
6525
-        if(is_array($accounts)){
6526
-            $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6527
-        }elseif(get_option('geodir_ga_account_id')){
6528
-            $accounts = array();
6529
-            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6530
-        }
6531
-    }
6532
-    return $accounts;
6525
+		if(is_array($accounts)){
6526
+			$accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6527
+		}elseif(get_option('geodir_ga_account_id')){
6528
+			$accounts = array();
6529
+			$accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6530
+		}
6531
+	}
6532
+	return $accounts;
6533 6533
 }
6534 6534
 
6535 6535
 function geodir_ga_get_analytics_accounts()
6536 6536
 {
6537
-    global $gd_ga_errors;
6538
-    $accounts = array();
6537
+	global $gd_ga_errors;
6538
+	$accounts = array();
6539 6539
 
6540
-    if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6540
+	if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6541 6541
 
6542 6542
 
6543
-    if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6544
-      return get_option('geodir_gd_uids');
6545
-    }
6543
+	if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6544
+	  return get_option('geodir_gd_uids');
6545
+	}
6546 6546
 
6547
-    # Create a new Gdata call
6548
-    if ( trim(get_option('geodir_ga_auth_code')) != '' )
6549
-        $stats = new GDGoogleAnalyticsStats();
6550
-    else
6551
-        return false;
6547
+	# Create a new Gdata call
6548
+	if ( trim(get_option('geodir_ga_auth_code')) != '' )
6549
+		$stats = new GDGoogleAnalyticsStats();
6550
+	else
6551
+		return false;
6552 6552
 
6553
-    # Check if Google sucessfully logged in
6554
-    if ( ! $stats->checkLogin() )
6555
-        return false;
6553
+	# Check if Google sucessfully logged in
6554
+	if ( ! $stats->checkLogin() )
6555
+		return false;
6556 6556
 
6557
-    # Get a list of accounts
6558
-    try {
6559
-        $accounts = $stats->getAllProfiles();
6560
-    } catch (Exception $e) {
6561
-        $gd_ga_errors[] = $e->getMessage();
6562
-        return false;
6563
-    }
6557
+	# Get a list of accounts
6558
+	try {
6559
+		$accounts = $stats->getAllProfiles();
6560
+	} catch (Exception $e) {
6561
+		$gd_ga_errors[] = $e->getMessage();
6562
+		return false;
6563
+	}
6564 6564
 
6565 6565
 
6566
-    natcasesort ($accounts);
6566
+	natcasesort ($accounts);
6567 6567
 
6568
-    # Return the account array if there are accounts
6569
-    if ( count($accounts) > 0 ){
6570
-        update_option('geodir_gd_uids',$accounts);
6571
-        return $accounts;
6572
-    }
6573
-    else
6574
-        return false;
6568
+	# Return the account array if there are accounts
6569
+	if ( count($accounts) > 0 ){
6570
+		update_option('geodir_gd_uids',$accounts);
6571
+		return $accounts;
6572
+	}
6573
+	else
6574
+		return false;
6575 6575
 }
6576 6576
 
6577 6577
 add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' );
6578 6578
 function geodir_ga_deauthorize(){
6579 6579
 
6580
-    if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6580
+	if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6581 6581
 
6582
-        die( 'Security check' );
6582
+		die( 'Security check' );
6583 6583
 
6584
-    } else {
6585
-        update_option('geodir_ga_auth_token','');
6586
-        update_option('geodir_ga_auth_code','');
6587
-        update_option('geodir_gd_uids','');
6584
+	} else {
6585
+		update_option('geodir_ga_auth_token','');
6586
+		update_option('geodir_ga_auth_code','');
6587
+		update_option('geodir_gd_uids','');
6588 6588
 
6589 6589
 
6590
-        echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
6591
-    }
6590
+		echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
6591
+	}
6592 6592
 
6593
-    die();
6593
+	die();
6594 6594
 }
6595 6595
 
6596 6596
 
@@ -6601,14 +6601,14 @@  discard block
 block discarded – undo
6601 6601
  * @package GeoDirectory
6602 6602
  */
6603 6603
 function geodir_post_type_setting_fun() {
6604
-    $post_type_arr = array();
6604
+	$post_type_arr = array();
6605 6605
 
6606
-    $post_types = geodir_get_posttypes('object');
6606
+	$post_types = geodir_get_posttypes('object');
6607 6607
 
6608
-    foreach ($post_types as $key => $post_types_obj) {
6609
-        $post_type_arr[$key] = $post_types_obj->labels->singular_name;
6610
-    }
6611
-    return $post_type_arr;
6608
+	foreach ($post_types as $key => $post_types_obj) {
6609
+		$post_type_arr[$key] = $post_types_obj->labels->singular_name;
6610
+	}
6611
+	return $post_type_arr;
6612 6612
 }
6613 6613
 
6614 6614
 /**
@@ -6619,35 +6619,35 @@  discard block
 block discarded – undo
6619 6619
  */
6620 6620
 function geodir_listing_image_size_arr(){
6621 6621
 
6622
-    global $_wp_additional_image_sizes;
6623
-
6624
-    $sizes = array();
6625
-
6626
-    foreach ( get_intermediate_image_sizes() as $_size ) {
6627
-        if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
6628
-            $sizes[ $_size ]['width']  = get_option( "{$_size}_size_w" );
6629
-            $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
6630
-            $sizes[ $_size ]['crop']   = (bool) get_option( "{$_size}_crop" );
6631
-        } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
6632
-            $sizes[ $_size ] = array(
6633
-                'width'  => $_wp_additional_image_sizes[ $_size ]['width'],
6634
-                'height' => $_wp_additional_image_sizes[ $_size ]['height'],
6635
-                'crop'   => $_wp_additional_image_sizes[ $_size ]['crop'],
6636
-            );
6637
-        }
6638
-    }
6622
+	global $_wp_additional_image_sizes;
6623
+
6624
+	$sizes = array();
6625
+
6626
+	foreach ( get_intermediate_image_sizes() as $_size ) {
6627
+		if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
6628
+			$sizes[ $_size ]['width']  = get_option( "{$_size}_size_w" );
6629
+			$sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
6630
+			$sizes[ $_size ]['crop']   = (bool) get_option( "{$_size}_crop" );
6631
+		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
6632
+			$sizes[ $_size ] = array(
6633
+				'width'  => $_wp_additional_image_sizes[ $_size ]['width'],
6634
+				'height' => $_wp_additional_image_sizes[ $_size ]['height'],
6635
+				'crop'   => $_wp_additional_image_sizes[ $_size ]['crop'],
6636
+			);
6637
+		}
6638
+	}
6639 6639
 
6640 6640
 
6641 6641
 
6642
-    $options = array();
6642
+	$options = array();
6643 6643
 
6644
-    $options['default'] = __('GD Default', 'geodirectory');
6644
+	$options['default'] = __('GD Default', 'geodirectory');
6645 6645
 
6646
-    if(!empty($sizes)){
6647
-        foreach($sizes as $key=>$val){
6648
-            $options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )';
6649
-        }
6650
-    }
6646
+	if(!empty($sizes)){
6647
+		foreach($sizes as $key=>$val){
6648
+			$options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )';
6649
+		}
6650
+	}
6651 6651
 
6652
-    return $options;
6652
+	return $options;
6653 6653
 }
6654 6654
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +962 added lines, -962 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
      * @package GeoDirectory
29 29
      */
30 30
     function geodir_admin_styles() {
31
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
31
+        wp_register_style('geodirectory-admin-css', geodir_plugin_url().'/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32 32
         wp_enqueue_style('geodirectory-admin-css');
33 33
 
34
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
34
+        wp_register_style('geodirectory-frontend-style', geodir_plugin_url().'/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35 35
         wp_enqueue_style('geodirectory-frontend-style');
36 36
 
37
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
37
+        wp_register_style('geodir-chosen-style', geodir_plugin_url().'/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38 38
         wp_enqueue_style('geodir-chosen-style');
39 39
 
40
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
40
+        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url().'/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41 41
         wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
42 42
 
43
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
43
+        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url().'/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44 44
         wp_enqueue_style('geodirectory-jquery-ui-css');
45 45
 
46
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
46
+        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url().'/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47 47
         wp_enqueue_style('geodirectory-custom-fields-css');
48 48
 
49
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
49
+        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url().'/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50 50
         wp_enqueue_style('geodirectory-pluplodar-css');
51 51
 
52
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
52
+        wp_register_style('geodir-rating-style', geodir_plugin_url().'/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53 53
         wp_enqueue_style('geodir-rating-style');
54 54
 
55
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
55
+        wp_register_style('geodir-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56 56
         wp_enqueue_style('geodir-rtl-style');
57 57
     }
58 58
 }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 
70 70
         wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION);
71 71
         wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
72
-        wp_enqueue_script( 'font-awesome' );
72
+        wp_enqueue_script('font-awesome');
73 73
 
74
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
74
+        wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
75 75
         wp_enqueue_script('geodirectory-admin');
76 76
 
77 77
     }
@@ -90,68 +90,68 @@  discard block
 block discarded – undo
90 90
         
91 91
         wp_enqueue_script('jquery');
92 92
 
93
-        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);
93
+        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);
94 94
 
95
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
95
+        wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
96 96
         wp_enqueue_script('chosen');
97 97
 
98
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
98
+        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
99 99
         wp_enqueue_script('geodirectory-choose-ajax');
100 100
 
101 101
         if (isset($_REQUEST['listing_type'])) {
102
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
102
+            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url().'/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
103 103
         }
104 104
 
105 105
         wp_enqueue_script('geodirectory-custom-fields-script');
106
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
106
+        $plugin_path = geodir_plugin_url().'/geodirectory-functions/cat-meta-functions';
107 107
 
108
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
108
+        wp_enqueue_script('tax-meta-clss', $plugin_path.'/js/tax-meta-clss.js', array('jquery'), null, true);
109 109
 
110 110
         if (in_array($geodir_map_name, array('auto', 'google'))) {
111
-            $map_lang = "&language=" . geodir_get_map_default_language();
112
-            $map_key = "&key=" . geodir_get_map_api_key();
111
+            $map_lang = "&language=".geodir_get_map_default_language();
112
+            $map_key = "&key=".geodir_get_map_api_key();
113 113
             /** This filter is documented in geodirectory_template_tags.php */
114 114
             $map_extra = apply_filters('geodir_googlemap_script_extra', '');
115
-            wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
115
+            wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
116 116
             
117 117
             // Overlapping Marker Spiderfier
118
-            wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
118
+            wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
119 119
             wp_enqueue_script('geodirectory-g-overlappingmarker-script');
120 120
         }
121 121
         
122 122
         if ($geodir_map_name == 'osm') {
123 123
             // Leaflet OpenStreetMap
124
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
124
+            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
125 125
             wp_enqueue_style('geodirectory-leaflet-style');
126 126
                 
127
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
127
+            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
128 128
             wp_enqueue_script('geodirectory-leaflet-script');
129 129
             
130
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
130
+            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
131 131
             wp_enqueue_script('geodirectory-leaflet-geo-script');
132 132
             
133 133
             // Overlapping Marker Spiderfier Leaflet
134
-            wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
134
+            wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
135 135
             wp_enqueue_script('geodirectory-o-overlappingmarker-script');
136 136
         }
137
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
137
+        wp_enqueue_script('jquery-ui-autocomplete');
138 138
         
139
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
139
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
140 140
         wp_enqueue_script('geodirectory-goMap-script');
141 141
 
142
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
142
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
143 143
         wp_enqueue_script('geodirectory-goMap-script');
144 144
 
145 145
 		// font awesome rating script
146 146
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
147
-			wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
147
+			wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
148 148
 			wp_enqueue_script('geodir-barrating-js');
149 149
 		} else { // default rating script
150
-			wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
150
+			wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
151 151
 			wp_enqueue_script('geodir-jRating-js');
152 152
 		}
153 153
 
154
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
154
+        wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
155 155
         wp_enqueue_script('geodir-on-document-load');
156 156
 
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         wp_enqueue_script('plupload-all');
160 160
         wp_enqueue_script('jquery-ui-sortable');
161 161
 
162
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
162
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
163 163
         wp_enqueue_script('geodirectory-plupload-script');
164 164
 
165 165
         // SCRIPT FOR UPLOAD END
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
214 214
 
215 215
 
216
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
216
+        wp_register_script('geodirectory-admin-script', geodir_plugin_url().'/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
217 217
         wp_enqueue_script('geodirectory-admin-script');
218 218
 
219 219
         wp_enqueue_style('farbtastic');
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 
222 222
         $screen = get_current_screen();
223 223
         if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
224
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
224
+            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation_admin.js');
225 225
         }
226 226
 
227
-        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
227
+        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl').'?geodir_ajax=true')));
228 228
         wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
229 229
 
230 230
     }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
         if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
249 249
 
250
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
250
+        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url().'/geodirectory-assets/images/favicon.ico', '55.1984');
251 251
 
252 252
 
253 253
     }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 $geodir_menu_order[] = 'separator-geodirectory';
282 282
                 if (!empty($post_types)) {
283 283
                     foreach ($post_types as $post_type) {
284
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
284
+                        $geodir_menu_order[] = 'edit.php?post_type='.$post_type;
285 285
                     }
286 286
                 }
287 287
                 $geodir_menu_order[] = $item;
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 {
325 325
     if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326 326
         echo '<div id="message" class="updated fade">
327
-                        <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
328
-                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
327
+                        <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory').' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">'.__('Support us by leaving a rating!', 'geodirectory').'</a></p>
328
+                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory').'</strong></p>
329 329
                 </div>';
330 330
 
331 331
     }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334 334
         switch ($_REQUEST['msg']) {
335 335
             case 'success':
336
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
336
+                echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.', 'geodirectory').'</strong></p></div>';
337 337
                 flush_rewrite_rules(false);
338 338
 
339 339
                 break;
@@ -341,30 +341,30 @@  discard block
 block discarded – undo
341 341
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
342 342
 				
343 343
 				if ($gderr == 21)
344
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
344
+			    	echo '<div id="message" class="error fade"><p><strong>'.__('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory').'</strong></p></div>';
345 345
 				else
346
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
346
+					echo '<div id="message" class="error fade"><p><strong>'.__('Error: Your settings have not been saved, please try again.', 'geodirectory').'</strong></p></div>';
347 347
                 break;
348 348
         }
349 349
     }
350 350
 
351 351
     $geodir_load_map = get_option('geodir_load_map');
352 352
     $need_map_key = false;
353
-    if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
353
+    if ($geodir_load_map == '' || $geodir_load_map == 'google' || $geodir_load_map == 'auto') {
354 354
         $need_map_key = true;
355 355
     }
356 356
 
357 357
     if (!geodir_get_map_api_key() && $need_map_key) {
358
-        echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
358
+        echo '<div class="error"><p><strong>'.sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings').'\'>', '</a>').'</strong></p></div>';
359 359
     }
360 360
 
361 361
     if (!geodir_is_default_location_set()) {
362
-        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
+        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>';
363 363
 
364 364
     }
365 365
 
366 366
     if (!function_exists('curl_init')) {
367
-        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
+        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>';
368 368
 
369 369
     }
370 370
 
@@ -384,18 +384,18 @@  discard block
 block discarded – undo
384 384
 function geodir_handle_option_form_submit($current_tab)
385 385
 {
386 386
     global $geodir_settings;
387
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
387
+    if (file_exists(dirname(__FILE__).'/option-pages/'.$current_tab.'_array.php')) {
388 388
         /**
389 389
          * Contains settings array for current tab.
390 390
          *
391 391
          * @since 1.0.0
392 392
          * @package GeoDirectory
393 393
          */
394
-        include_once('option-pages/' . $current_tab . '_array.php');
394
+        include_once('option-pages/'.$current_tab.'_array.php');
395 395
     }
396 396
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
397 397
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
398
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
398
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-'.$current_tab], 'geodir-settings-'.$current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
399 399
 		
400 400
 		/**
401 401
 		 * Fires before updating geodirectory admin settings.
@@ -428,13 +428,13 @@  discard block
 block discarded – undo
428 428
          * @param string $current_tab The current settings tab name.
429 429
          * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
430 430
          */
431
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
431
+        do_action('geodir_update_options_'.$current_tab, $geodir_settings[$current_tab]);
432 432
 
433 433
         flush_rewrite_rules(false);
434 434
 
435 435
         $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
436 436
 
437
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
437
+        $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$_REQUEST['active_tab'].'&msg=success');
438 438
 
439 439
         wp_redirect($redirect_url);
440 440
         exit();
@@ -473,18 +473,18 @@  discard block
 block discarded – undo
473 473
 
474 474
         elseif (isset($value['type']) && $value['type'] == 'image_width') :
475 475
 
476
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
477
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
478
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
479
-                if (isset($_POST[$value['id'] . '_crop'])) :
480
-                    update_option($value['id'] . '_crop', 1);
476
+            if (isset($value['id']) && isset($_POST[$value['id'].'_width'])) {
477
+                update_option($value['id'].'_width', $_POST[$value['id'].'_width']);
478
+                update_option($value['id'].'_height', $_POST[$value['id'].'_height']);
479
+                if (isset($_POST[$value['id'].'_crop'])) :
480
+                    update_option($value['id'].'_crop', 1);
481 481
                 else :
482
-                    update_option($value['id'] . '_crop', 0);
482
+                    update_option($value['id'].'_crop', 0);
483 483
                 endif;
484 484
             } else {
485
-                update_option($value['id'] . '_width', $value['std']);
486
-                update_option($value['id'] . '_height', $value['std']);
487
-                update_option($value['id'] . '_crop', 1);
485
+                update_option($value['id'].'_width', $value['std']);
486
+                update_option($value['id'].'_height', $value['std']);
487
+                update_option($value['id'].'_crop', 1);
488 488
             }
489 489
 
490 490
         elseif (isset($value['type']) && $value['type'] == 'map') :
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
         elseif (isset($value['type']) && $value['type'] == 'file') :
527 527
 
528 528
 
529
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
529
+            if (isset($_POST[$value['id'].'_remove']) && $_POST[$value['id'].'_remove']) {// if remove is set then remove the file
530 530
 
531 531
                 if (get_option($value['id'])) {
532 532
                     $image_name_arr = explode('/', get_option($value['id']));
533 533
                     $noimg_name = end($image_name_arr);
534
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
534
+                    $img_path = $uploads['path'].'/'.$noimg_name;
535 535
                     if (file_exists($img_path))
536 536
                         unlink($img_path);
537 537
                 }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
                 if (get_option($value['id'])) {
560 560
                     $image_name_arr = explode('/', get_option($value['id']));
561 561
                     $noimg_name = end($image_name_arr);
562
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
562
+                    $img_path = $uploads['path'].'/'.$noimg_name;
563 563
                     if (file_exists($img_path))
564 564
                         unlink($img_path);
565 565
                 }
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
             // same menu setting per theme.
581 581
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
582 582
                 $theme = wp_get_theme();
583
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
583
+                update_option('geodir_theme_location_nav_'.$theme->name, $_POST[$value['id']]);
584 584
             }
585 585
 
586 586
             if (isset($value['id']) && isset($_POST[$value['id']])) {
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 
651 651
             $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
652 652
 
653
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
653
+            $tabs[$geodir_post_type.'_fields_settings'] = array(
654 654
                 'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
655 655
                 'subtabs' => array(
656 656
                     array('subtab' => 'custom_fields',
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
  */
685 685
 function geodir_tools_setting_tab($tabs)
686 686
 {
687
-    wp_enqueue_script( 'jquery-ui-progressbar' );
687
+    wp_enqueue_script('jquery-ui-progressbar');
688 688
     $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
689 689
     return $tabs;
690 690
 }
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
  */
719 719
 function geodir_extend_geodirectory_setting_tab($tabs)
720 720
 {
721
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
721
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory').' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
722 722
     return $tabs;
723 723
 }
724 724
 
@@ -778,8 +778,8 @@  discard block
 block discarded – undo
778 778
                     _e('Unknown', 'geodirectory');
779 779
                 } else {
780 780
                     /* If there is a city id, append 'city name' to the text string. */
781
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
782
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
781
+                    $add_location_id = $location_id > 0 ? ' ('.$location_id.')' : '';
782
+                    echo(__($location->country, 'geodirectory').'-'.$location->region.'-'.$location->city.$add_location_id);
783 783
                 }
784 784
                 break;
785 785
 
@@ -797,14 +797,14 @@  discard block
 block discarded – undo
797 797
                         $expire_class = 'expire_over';
798 798
                     }
799 799
                     $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
800
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
800
+                    $date_diff_text = '<br /><span class="'.$expire_class.'">('.$date_diff.' '.$state.')</span>';
801 801
                 }
802 802
                 /* If no expire_date is found, output a default message. */
803 803
                 if (empty($expire_date))
804 804
                     echo __('Unknown', 'geodirectory');
805 805
                 /* If there is a expire_date, append 'days left' to the text string. */
806 806
                 else
807
-                    echo $expire_date . $date_diff_text;
807
+                    echo $expire_date.$date_diff_text;
808 808
                 break;
809 809
 
810 810
             /* If displaying the 'categorys' column. */
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 function geodir_post_information_save($post_id, $post) {
872 872
     global $wpdb, $current_user;
873 873
 
874
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
874
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
875 875
         return;
876 876
     }
877 877
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
                     $tab_id = $value['id'];
940 940
 
941 941
                 if (isset($value['desc']) && $value['desc'])
942
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
942
+                    $desc = '<span style=" text-transform:none;">:- '.$value['desc'].'</span>';
943 943
 
944 944
                 if (isset($value['name']) && $value['name']) {
945 945
                     if ($first_title === true) {
@@ -947,9 +947,9 @@  discard block
 block discarded – undo
947 947
                     } else {
948 948
                         echo '</div>';
949 949
                     }
950
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
950
+                    echo '<dd id="'.trim($tab_id).'" class="geodir_option_tabs" ><a href="javascript:void(0);">'.$value['name'].'</a></dd>';
951 951
 
952
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
952
+                    echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
953 953
                 }
954 954
 
955 955
                 /**
@@ -959,21 +959,21 @@  discard block
 block discarded – undo
959 959
                  *
960 960
                  * @since 1.0.0
961 961
                  */
962
-                do_action('geodir_settings_' . sanitize_title($value['id']));
962
+                do_action('geodir_settings_'.sanitize_title($value['id']));
963 963
                 break;
964 964
 
965 965
             case 'no_tabs':
966 966
 
967 967
                 echo '<div class="inner_content_tab_main">';
968
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
968
+                echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
969 969
 
970 970
                 break;
971 971
 
972 972
             case 'sectionstart':
973 973
                 if (isset($value['desc']) && $value['desc'])
974
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
974
+                    $desc = '<span style=" text-transform:none;"> - '.$value['desc'].'</span>';
975 975
                 if (isset($value['name']) && $value['name'])
976
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
976
+                    echo '<h3>'.$value['name'].$desc.'</h3>';
977 977
                 /**
978 978
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
979 979
                  *
@@ -981,8 +981,8 @@  discard block
 block discarded – undo
981 981
                  *
982 982
                  * @since 1.0.0
983 983
                  */
984
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
985
-                echo '<table class="form-table">' . "\n\n";
984
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_start');
985
+                echo '<table class="form-table">'."\n\n";
986 986
 
987 987
                 break;
988 988
             case 'sectionend':
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
                  *
994 994
                  * @since 1.0.0
995 995
                  */
996
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
996
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_end');
997 997
                 echo '</table>';
998 998
                 /**
999 999
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
                  *
1003 1003
                  * @since 1.0.0
1004 1004
                  */
1005
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1005
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_after');
1006 1006
                 break;
1007 1007
             case 'text':
1008 1008
                 ?>
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1012 1012
                                            id="<?php echo esc_attr($value['id']); ?>"
1013 1013
                                            type="<?php echo esc_attr($value['type']); ?>"
1014
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1014
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1015 1015
                                            style=" <?php echo esc_attr($value['css']); ?>"
1016 1016
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1017 1017
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1028,15 +1028,15 @@  discard block
 block discarded – undo
1028 1028
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1029 1029
                                            id="<?php echo esc_attr($value['id']); ?>"
1030 1030
                                            type="<?php echo esc_attr($value['type']); ?>"
1031
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1031
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1032 1032
                                            style=" <?php echo esc_attr($value['css']); ?>"
1033 1033
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1034 1034
                                                echo esc_attr(stripslashes(get_option($value['id'])));
1035 1035
                                            } else {
1036 1036
                                                echo esc_attr($value['std']);
1037 1037
                                            } ?>"/>
1038
-                    <?php $gm_api_url = 'https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]';?>
1039
-                    <a id="gd-api-key" onclick='window.open("<?php echo wp_slash($gm_api_url);?>", "newwindow", "width=600, height=400"); return false;' href='<?php echo $gm_api_url;?>' class="button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )','geodirectory');?>" ><?php _e('Generate API Key','geodirectory');?></a>
1038
+                    <?php $gm_api_url = 'https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]'; ?>
1039
+                    <a id="gd-api-key" onclick='window.open("<?php echo wp_slash($gm_api_url); ?>", "newwindow", "width=600, height=400"); return false;' href='<?php echo $gm_api_url; ?>' class="button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )', 'geodirectory'); ?>" ><?php _e('Generate API Key', 'geodirectory'); ?></a>
1040 1040
                     <span class="description"><?php echo $value['desc']; ?></span></td>
1041 1041
                 </tr><?php
1042 1042
                 break;
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1049 1049
                                            id="<?php echo esc_attr($value['id']); ?>"
1050 1050
                                            type="<?php echo esc_attr($value['type']); ?>"
1051
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1051
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1052 1052
                                            style="<?php echo esc_attr($value['css']); ?>"
1053 1053
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1054 1054
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1094,17 +1094,17 @@  discard block
 block discarded – undo
1094 1094
                     <?php _e('Width', 'geodirectory'); ?> <input
1095 1095
                         name="<?php echo esc_attr($value['id']); ?>_width"
1096 1096
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1097
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1097
+                        value="<?php if ($size = get_option($value['id'].'_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1098 1098
 
1099 1099
                     <?php _e('Height', 'geodirectory'); ?> <input
1100 1100
                         name="<?php echo esc_attr($value['id']); ?>_height"
1101 1101
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1102
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1102
+                        value="<?php if ($size = get_option($value['id'].'_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1103 1103
 
1104 1104
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1105 1105
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1106 1106
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1107
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1107
+                            type="checkbox" <?php if (get_option($value['id'].'_crop') != '') checked(get_option($value['id'].'_crop'), 1); else checked(1); ?> /></label>
1108 1108
 
1109 1109
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1110 1110
                 </tr><?php
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
                                             id="<?php echo esc_attr($value['id']); ?>"
1155 1155
                                             style="<?php echo esc_attr($value['css']); ?>"
1156 1156
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1157
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1157
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
1158 1158
                                             option-ajaxchosen="false">
1159 1159
                         <?php
1160 1160
                         foreach ($value['options'] as $key => $val) {
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
                                 ?></optgroup><?php
1165 1165
                             } else {
1166 1166
                                 ?>
1167
-                                <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>>
1167
+                                <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>>
1168 1168
                                     <?php echo geodir_utf8_ucfirst($val) ?>
1169 1169
                                 </option>
1170 1170
                             <?php
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
                 ?>
1202 1202
 
1203 1203
                 <tr valign="top">
1204
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1204
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
1205 1205
                     <td width="60%">
1206 1206
                         <select name="geodir_default_map_language" style="width:60%">
1207 1207
                             <?php
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
 
1284 1284
                 <tr valign="top">
1285 1285
                     <th class="titledesc"
1286
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
1286
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
1287 1287
                     <td width="60%">
1288 1288
                         <select name="geodir_default_map_search_pt" style="width:60%">
1289 1289
                             <?php
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
                         $cat_display = 'checkbox';
1325 1325
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1326 1326
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
1327
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1327
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
1328 1328
                         $count = 1;
1329 1329
                         ?>
1330 1330
                         <table width="70%" class="widefat">
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
                                                                                            name="home_map_post_types[]"
1354 1354
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
1355 1355
                                                                                            value="<?php echo $key; ?>"
1356
-                                                                                           class="map_post_type" <?php echo $checked;?> />
1356
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
1357 1357
                                         <?php echo __($post_types_obj->labels->singular_name, 'geodirectory'); ?></td>
1358 1358
                                     <td width="40%">
1359 1359
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -1411,12 +1411,12 @@  discard block
 block discarded – undo
1411 1411
                 ?>
1412 1412
                 <fieldset>
1413 1413
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1414
-                    <label for="<?php echo $value['id'];?>">
1414
+                    <label for="<?php echo $value['id']; ?>">
1415 1415
                         <input name="<?php echo esc_attr($value['id']); ?>"
1416
-                               id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1416
+                               id="<?php echo esc_attr($value['id'].$value['value']); ?>" type="radio"
1417 1417
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1418 1418
                             echo 'checked="checked"';
1419
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1419
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
1420 1420
                         <?php echo $value['desc']; ?></label><br>
1421 1421
                 </fieldset>
1422 1422
                 <?php
@@ -1436,9 +1436,9 @@  discard block
 block discarded – undo
1436 1436
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1437 1437
                 <td class="forminp">
1438 1438
                     <textarea
1439
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1439
+                        <?php if (isset($value['args'])) echo $value['args'].' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1440 1440
                         id="<?php echo esc_attr($value['id']); ?>"
1441
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1441
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1442 1442
                         style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
1443 1443
                         class="description"><?php echo $value['desc'] ?></span>
1444 1444
 
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 					}
1484 1484
 				}
1485 1485
 				//
1486
-				$page_setting = (int)get_option($value['id']);
1486
+				$page_setting = (int) get_option($value['id']);
1487 1487
 
1488 1488
                 $args = array('name' => $value['id'],
1489 1489
                     'id' => $value['id'],
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
                 <tr valign="top" class="single_select_page">
1501 1501
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1502 1502
                 <td class="forminp">
1503
-                    <?php echo str_replace(' id=', " data-placeholder='" . __('Select a page...', 'geodirectory') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' " . $disabled . " id=", wp_dropdown_pages($args)); ?>
1503
+                    <?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'geodirectory')."' style='".$value['css']."' class='".$value['class']."' ".$disabled." id=", wp_dropdown_pages($args)); ?>
1504 1504
                     <span class="description"><?php echo $value['desc'] ?></span>
1505 1505
                 </td>
1506 1506
                 </tr><?php
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
 				}
1510 1510
                 break;
1511 1511
             case 'single_select_country' :
1512
-                $country_setting = (string)get_option($value['id']);
1512
+                $country_setting = (string) get_option($value['id']);
1513 1513
                 if (strstr($country_setting, ':')) :
1514 1514
                     $country = current(explode(':', $country_setting));
1515 1515
                     $state = end(explode(':', $country_setting));
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
             case 'multi_select_countries' :
1533 1533
                 $countries = $geodirectory->countries->countries;
1534 1534
                 asort($countries);
1535
-                $selections = (array)get_option($value['id']);
1535
+                $selections = (array) get_option($value['id']);
1536 1536
                 ?>
1537 1537
                 <tr valign="top">
1538 1538
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
                             title="Country" class="chosen_select">
1543 1543
                         <?php
1544 1544
                         if ($countries) foreach ($countries as $key => $val) :
1545
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1545
+                            echo '<option value="'.$key.'" '.selected(in_array($key, $selections), true, false).'>'.$val.'</option>';
1546 1546
                         endforeach;
1547 1547
                         ?>
1548 1548
                     </select>
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
                 break;
1555 1555
 
1556 1556
             case 'google_analytics' :
1557
-                $selections = (array)get_option($value['id']);
1557
+                $selections = (array) get_option($value['id']);
1558 1558
                     ?>
1559 1559
                     <tr valign="top">
1560 1560
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1565,30 +1565,30 @@  discard block
 block discarded – undo
1565 1565
 
1566 1566
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1567 1567
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1568
-                            $state = "&state=123";//any string
1569
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1568
+                            $state = "&state=123"; //any string
1569
+                            $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
1570 1570
                             $response_type = "&response_type=code";
1571 1571
                             $client_id = "&client_id=".get_option('geodir_ga_client_id');
1572 1572
                             $access_type = "&access_type=offline";
1573 1573
                             $approval_prompt = "&approval_prompt=force";
1574 1574
 
1575
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1575
+                            $auth_url = $oAuthURL.$scope.$state.$redirect_uri.$response_type.$client_id.$access_type.$approval_prompt;
1576 1576
 
1577 1577
 
1578 1578
                             if (get_option('geodir_ga_auth_token')) {
1579 1579
                                 ?>
1580 1580
                                 <span class="button-primary"
1581
-                                      onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize');?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1581
+                                      onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize'); ?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1582 1582
                                 <span style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1583 1583
                             <?php
1584 1584
                                 global $gd_ga_errors;
1585
-                                if(!empty($gd_ga_errors)){
1585
+                                if (!empty($gd_ga_errors)) {
1586 1586
                                     print_r($gd_ga_errors);
1587 1587
                                 }
1588 1588
                             } else {
1589 1589
                                 ?>
1590 1590
                                 <span class="button-primary"
1591
-                                      onclick="window.open('<?php echo  geodir_ga_activation_url();?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory');?></span>
1591
+                                      onclick="window.open('<?php echo  geodir_ga_activation_url(); ?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory'); ?></span>
1592 1592
                             <?php
1593 1593
                             }
1594 1594
                             ?>
@@ -1659,9 +1659,9 @@  discard block
 block discarded – undo
1659 1659
 
1660 1660
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
1661 1661
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
1662
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
1662
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
1663 1663
             jQuery('.gd-content-heading').hide();
1664
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
1664
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
1665 1665
             <?php } ?>
1666 1666
         });
1667 1667
     </script>
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
     wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1748 1748
 
1749 1749
     if (geodir_get_featured_image($post_id, 'thumbnail')) {
1750
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1750
+        echo '<h4>'.__('Featured Image', 'geodirectory').'</h4>';
1751 1751
         geodir_show_featured_image($post_id, 'thumbnail');
1752 1752
     }
1753 1753
 
@@ -1758,13 +1758,13 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
     <h5 class="form_title">
1760 1760
         <?php if ($image_limit != 0 && $image_limit == 1) {
1761
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1761
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
1762 1762
         } ?>
1763 1763
         <?php if ($image_limit != 0 && $image_limit > 1) {
1764
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1764
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
1765 1765
         } ?>
1766 1766
         <?php if ($image_limit == 0) {
1767
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1767
+            echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
1768 1768
         } ?>
1769 1769
     </h5>
1770 1770
 
@@ -1803,10 +1803,10 @@  discard block
 block discarded – undo
1803 1803
         <div
1804 1804
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1805 1805
             id="<?php echo $id; ?>plupload-upload-ui">
1806
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
1806
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
1807 1807
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
1808 1808
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
1809
-            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
1809
+            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
1810 1810
             <?php if ($width && $height): ?>
1811 1811
                 <span class="plupload-resize"></span>
1812 1812
                 <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -1818,7 +1818,7 @@  discard block
 block discarded – undo
1818 1818
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
1819 1819
         </div>
1820 1820
         <span
1821
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
1821
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
1822 1822
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
1823 1823
     </div>
1824 1824
 
@@ -2028,9 +2028,9 @@  discard block
 block discarded – undo
2028 2028
     $plugin = 'avada-nag';
2029 2029
     $timestamp = 'avada-nag1234';
2030 2030
     $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');
2031
-    echo '<div id="' . $timestamp . '"  class="error">';
2032
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fas fa-times"></i></span>';
2033
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2031
+    echo '<div id="'.$timestamp.'"  class="error">';
2032
+    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\''.$plugin.'\',\''.$timestamp.'\');" ><i class="fas fa-times"></i></span>';
2033
+    echo "<img class='gd-icon-noti' src='".plugin_dir_url('')."geodirectory/geodirectory-assets/images/favicon.ico' > ";
2034 2034
     echo "<p>$message</p>";
2035 2035
     echo "</div>";
2036 2036
 
@@ -2164,7 +2164,7 @@  discard block
 block discarded – undo
2164 2164
 		
2165 2165
 		// Don't allow same slug url for listing and location
2166 2166
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2167
-			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2167
+			$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab.'&msg=fail&gderr=21');
2168 2168
         	wp_redirect($redirect_url);
2169 2169
 			exit;
2170 2170
 		}
@@ -2176,7 +2176,7 @@  discard block
 block discarded – undo
2176 2176
 			$default_language = $sitepress->get_default_language();
2177 2177
 			
2178 2178
 			if ($current_language != 'all' && $current_language != $default_language) {
2179
-				$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
2179
+				$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab);
2180 2180
 				wp_redirect($redirect_url);
2181 2181
 				exit;
2182 2182
 			}
@@ -2197,11 +2197,11 @@  discard block
 block discarded – undo
2197 2197
 function geodir_hide_admin_preview_button() {
2198 2198
     global $post_type;
2199 2199
     $post_types = geodir_get_posttypes();
2200
-    if(in_array($post_type, $post_types))
2200
+    if (in_array($post_type, $post_types))
2201 2201
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2202 2202
 }
2203
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2204
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2203
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
2204
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
2205 2205
 
2206 2206
 /**
2207 2207
  * Add the tab in left sidebar menu fro import & export page.
@@ -2211,8 +2211,8 @@  discard block
 block discarded – undo
2211 2211
  *
2212 2212
  * @return array Array of tab data.
2213 2213
  */
2214
-function geodir_import_export_tab( $tabs ) {
2215
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2214
+function geodir_import_export_tab($tabs) {
2215
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
2216 2216
     return $tabs;
2217 2217
 }
2218 2218
 
@@ -2226,8 +2226,8 @@  discard block
 block discarded – undo
2226 2226
  * @return string Html content.
2227 2227
  */
2228 2228
 function geodir_import_export_page() {
2229
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2230
-	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2229
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
2230
+	$gd_cats_sample_csv = geodir_plugin_url().'/geodirectory-assets/gd_sample_categories.csv';
2231 2231
     /**
2232 2232
      * Filter sample category data csv file url.
2233 2233
      *
@@ -2236,9 +2236,9 @@  discard block
 block discarded – undo
2236 2236
      *
2237 2237
      * @param string $gd_cats_sample_csv Sample category data csv file url.
2238 2238
      */
2239
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2239
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
2240 2240
 	
2241
-	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2241
+	$gd_posts_sample_csv = geodir_plugin_url().'/geodirectory-assets/place_listing.csv';
2242 2242
     /**
2243 2243
      * Filter sample post data csv file url.
2244 2244
      *
@@ -2247,15 +2247,15 @@  discard block
 block discarded – undo
2247 2247
      *
2248 2248
      * @param string $gd_posts_sample_csv Sample post data csv file url.
2249 2249
      */
2250
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2250
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
2251 2251
 	
2252
-	$gd_posttypes = geodir_get_posttypes( 'array' );
2252
+	$gd_posttypes = geodir_get_posttypes('array');
2253 2253
 	
2254 2254
 	$gd_posttypes_option = '';
2255
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
2256
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
2255
+	foreach ($gd_posttypes as $gd_posttype => $row) {
2256
+		$gd_posttypes_option .= '<option value="'.$gd_posttype.'" data-cats="'.(int) geodir_get_terms_count($gd_posttype).'" data-posts="'.(int) geodir_get_posts_count($gd_posttype).'">'.__($row['labels']['name'], 'geodirectory').'</option>';
2257 2257
 	}
2258
-	wp_enqueue_script( 'jquery-ui-progressbar' );
2258
+	wp_enqueue_script('jquery-ui-progressbar');
2259 2259
 	
2260 2260
 	$gd_chunksize_options = array();
2261 2261
 	$gd_chunksize_options[100] = 100;
@@ -2277,50 +2277,50 @@  discard block
 block discarded – undo
2277 2277
      *
2278 2278
      * @param string $gd_chunksize_options Entries options.
2279 2279
      */
2280
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2280
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
2281 2281
 	
2282 2282
 	$gd_chunksize_option = '';
2283 2283
 	foreach ($gd_chunksize_options as $value => $title) {
2284
-		$gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
2284
+		$gd_chunksize_option .= '<option value="'.$value.'" '.selected($value, 5000, false).'>'.$title.'</option>';
2285 2285
 	}
2286 2286
 	
2287 2287
 	$uploads = wp_upload_dir();
2288
-	$upload_dir = wp_sprintf( CSV_TRANSFER_IMG_FOLDER, str_replace( ABSPATH, '', $uploads['path'] ) );
2288
+	$upload_dir = wp_sprintf(CSV_TRANSFER_IMG_FOLDER, str_replace(ABSPATH, '', $uploads['path']));
2289 2289
 ?>
2290 2290
 </form>
2291 2291
 <div class="inner_content_tab_main gd-import-export">
2292
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
2293
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
2292
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
2293
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
2294 2294
   <div class="gd-content-heading">
2295 2295
 
2296 2296
   <?php
2297 2297
     @ini_set('max_execution_time', 999999);
2298
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2298
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
2299 2299
     @ini_restore('max_execution_time');
2300 2300
 
2301
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2301
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
2302 2302
         ?>
2303 2303
 	<div id="gd_ie_reqs" class="metabox-holder">
2304 2304
       <div class="meta-box-sortables ui-sortable">
2305 2305
         <div class="postbox">
2306
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
2306
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
2307 2307
           <div class="inside">
2308
-            <span class="description"><?php echo __( 'Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory' );?></span>
2308
+            <span class="description"><?php echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory'); ?></span>
2309 2309
 			<table class="form-table">
2310 2310
 				<thead>
2311 2311
 				  <tr>
2312
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
2312
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
2313 2313
 				  </tr>
2314 2314
 				</thead>
2315 2315
 				<tbody>
2316 2316
 				  <tr>
2317
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
2317
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
2318 2318
 				  </tr>
2319 2319
 				  <tr>
2320
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
2320
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
2321 2321
 				  </tr>
2322 2322
 				  <tr>
2323
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
2323
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
2324 2324
 				  </tr>
2325 2325
 				</tbody>
2326 2326
 		    </table>
@@ -2332,21 +2332,21 @@  discard block
 block discarded – undo
2332 2332
 	<div id="gd_ie_imposts" class="metabox-holder">
2333 2333
       <div class="meta-box-sortables ui-sortable">
2334 2334
         <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox">
2335
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Listings: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2336
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
2335
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Listings: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2336
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
2337 2337
           <div class="inside">
2338 2338
             <table class="form-table">
2339 2339
 				<tbody>
2340 2340
 				  <tr>
2341 2341
 					<td class="gd-imex-box">
2342 2342
 						<div class="gd-im-choices">
2343
-						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e( 'Update listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2344
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2343
+						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e('Update listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2344
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e('Ignore listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2345 2345
 						</div>
2346 2346
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
2347 2347
 							<input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
2348
-							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2349
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
2348
+							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2349
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
2350 2350
 						<input type="hidden" id="gd_im_post_allowed_types" data-exts=".csv" value="csv" />
2351 2351
 							<?php
2352 2352
 							/**
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 							 */
2357 2357
 							do_action('geodir_sample_csv_download_link');
2358 2358
 							?>
2359
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
2359
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
2360 2360
 							<div class="filelist"></div>
2361 2361
 						</div>
2362 2362
 						<span id="gd_im_postupload-error" style="display:none"></span>
@@ -2374,7 +2374,7 @@  discard block
 block discarded – undo
2374 2374
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2375 2375
 						</div>
2376 2376
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2377
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2377
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2378 2378
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2379 2379
 									id="gd-import-perc">0%</font> )
2380 2380
 								<div class="gd-fileprogress"></div>
@@ -2386,10 +2386,10 @@  discard block
 block discarded – undo
2386 2386
                     	<div class="gd-imex-btns" style="display:none;">
2387 2387
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2388 2388
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2389
-                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2390
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2389
+                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2390
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2391 2391
 							<div id="gd_process_data" style="display:none">
2392
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2392
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2393 2393
 							</div>
2394 2394
 						</div>
2395 2395
 					</td>
@@ -2403,30 +2403,30 @@  discard block
 block discarded – undo
2403 2403
 	<div id="gd_ie_excategs" class="metabox-holder">
2404 2404
 	  <div class="meta-box-sortables ui-sortable">
2405 2405
 		<div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox">
2406
-		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - Listings: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2407
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
2406
+		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - Listings: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2407
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
2408 2408
 		  <div class="inside">
2409 2409
 			<table class="form-table">
2410 2410
 			  <tbody>
2411 2411
 				<tr>
2412 2412
 				  <td class="fld"><label for="gd_post_type">
2413
-					<?php _e( 'Post Type:', 'geodirectory' );?>
2413
+					<?php _e('Post Type:', 'geodirectory'); ?>
2414 2414
 					</label></td>
2415 2415
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
2416
-					  <?php echo $gd_posttypes_option;?>
2416
+					  <?php echo $gd_posttypes_option; ?>
2417 2417
 					</select></td>
2418 2418
 				</tr>
2419 2419
 				<tr>
2420
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2421
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2420
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2421
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2422 2422
 				</tr>
2423 2423
                 <tr class="gd-imex-dates">
2424
-					<td class="fld"><label><?php _e( 'Published Date:', 'geodirectory' );?></label></td>
2425
-					<td><label><span class="label-responsive"><?php _e( 'Start date:', 'geodirectory' );?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e( 'End date:', 'geodirectory' );?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
2424
+					<td class="fld"><label><?php _e('Published Date:', 'geodirectory'); ?></label></td>
2425
+					<td><label><span class="label-responsive"><?php _e('Start date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e('End date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
2426 2426
 				</tr>
2427 2427
 				<tr>
2428 2428
 				  <td class="fld" style="vertical-align:top"><label>
2429
-					<?php _e( 'Progress:', 'geodirectory' );?>
2429
+					<?php _e('Progress:', 'geodirectory'); ?>
2430 2430
 					</label></td>
2431 2431
 				  <td><div id='gd_progressbar_box'>
2432 2432
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -2434,13 +2434,13 @@  discard block
 block discarded – undo
2434 2434
 					  </div>
2435 2435
 					</div>
2436 2436
 					<p style="display:inline-block">
2437
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
2437
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
2438 2438
 					</p>
2439 2439
 					  
2440 2440
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2441 2441
 				</tr>
2442 2442
 				<tr class="gd-ie-actions">
2443
-				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2443
+				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2444 2444
 				  </td>
2445 2445
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
2446 2446
 				</tr>
@@ -2453,21 +2453,21 @@  discard block
 block discarded – undo
2453 2453
 	<div id="gd_ie_imcategs" class="metabox-holder">
2454 2454
       <div class="meta-box-sortables ui-sortable">
2455 2455
         <div id="gd_ie_imcats" class="postbox gd-hndle-pbox">
2456
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2457
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
2456
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2457
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
2458 2458
           <div class="inside">
2459 2459
             <table class="form-table">
2460 2460
 				<tbody>
2461 2461
 				  <tr>
2462 2462
 					<td class="gd-imex-box">
2463 2463
 						<div class="gd-im-choices">
2464
-						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2465
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2464
+						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2465
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2466 2466
 						</div>
2467 2467
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
2468 2468
 							<input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
2469
-							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2470
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
2469
+							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2470
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
2471 2471
 						<input type="hidden" id="gd_im_cat_allowed_types" data-exts=".csv" value="csv" />
2472 2472
 						<?php
2473 2473
 						/**
@@ -2478,7 +2478,7 @@  discard block
 block discarded – undo
2478 2478
 						 */
2479 2479
 						do_action('geodir_sample_cats_csv_download_link');
2480 2480
 						?>
2481
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
2481
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
2482 2482
 							<div class="filelist"></div>
2483 2483
 						</div>
2484 2484
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2496 2496
 						</div>
2497 2497
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2498
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2498
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2499 2499
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2500 2500
 									id="gd-import-perc">0%</font> )
2501 2501
 								<div class="gd-fileprogress"></div>
@@ -2507,10 +2507,10 @@  discard block
 block discarded – undo
2507 2507
                     	<div class="gd-imex-btns" style="display:none;">
2508 2508
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2509 2509
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2510
-                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2511
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2510
+                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2511
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2512 2512
 							<div id="gd_process_data" style="display:none">
2513
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2513
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2514 2514
 							</div>
2515 2515
 						</div>
2516 2516
 					</td>
@@ -2524,26 +2524,26 @@  discard block
 block discarded – undo
2524 2524
 	<div id="gd_ie_excategs" class="metabox-holder">
2525 2525
       <div class="meta-box-sortables ui-sortable">
2526 2526
         <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox">
2527
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2528
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
2527
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2528
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
2529 2529
           <div class="inside">
2530 2530
             <table class="form-table">
2531 2531
 				<tbody>
2532 2532
 				  <tr>
2533
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
2534
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
2533
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
2534
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
2535 2535
 				  </tr>
2536 2536
 				   <tr>
2537
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2538
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2537
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2538
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2539 2539
 				  </tr>
2540 2540
 				  <tr>
2541
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
2542
-					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2541
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
2542
+					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2543 2543
 				  </tr>
2544 2544
 				  <tr class="gd-ie-actions">
2545 2545
 					<td style="vertical-align:top">
2546
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2546
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2547 2547
 					</td>
2548 2548
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
2549 2549
 				  </tr>
@@ -2565,7 +2565,7 @@  discard block
 block discarded – undo
2565 2565
      * @param array $gd_chunksize_options File chunk size options.
2566 2566
      * @param string $nonce Wordpress security token for GD import & export.
2567 2567
 	 */
2568
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2568
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
2569 2569
 	?>
2570 2570
   </div>
2571 2571
 </div>
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
         jQuery.ajax({
2585 2585
             url: ajaxurl,
2586 2586
             type: "POST",
2587
-            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
2587
+            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
2588 2588
             dataType: 'json',
2589 2589
             cache: false,
2590 2590
             success: function(data) {
@@ -2636,7 +2636,7 @@  discard block
 block discarded – undo
2636 2636
 
2637 2637
         jQuery(cont).find('.filelist .file').remove();
2638 2638
         
2639
-        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
2639
+        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
2640 2640
         jQuery('#gd-import-msg', cont).show();
2641 2641
         
2642 2642
         return false;
@@ -2695,7 +2695,7 @@  discard block
 block discarded – undo
2695 2695
     jQuery.ajax({
2696 2696
         url: ajaxurl,
2697 2697
         type: "POST",
2698
-        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
2698
+        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
2699 2699
         dataType : 'json',
2700 2700
         cache: false,
2701 2701
         success: function (data) {
@@ -2884,27 +2884,27 @@  discard block
 block discarded – undo
2884 2884
 
2885 2885
     var gdMsg = '<p></p>';
2886 2886
     if ( processed > 0 ) {
2887
-        var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
2887
+        var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
2888 2888
         msgParse = msgParse.replace("%s", processed);
2889 2889
         gdMsg += msgParse;
2890 2890
     }
2891 2891
 
2892 2892
     if ( updated > 0 ) {
2893
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2893
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
2894 2894
         msgParse = msgParse.replace("%s", updated);
2895 2895
         msgParse = msgParse.replace("%d", processed);
2896 2896
         gdMsg += msgParse;
2897 2897
     }
2898 2898
 
2899 2899
     if ( created > 0 ) {
2900
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2900
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
2901 2901
         msgParse = msgParse.replace("%s", created);
2902 2902
         msgParse = msgParse.replace("%d", processed);
2903 2903
         gdMsg += msgParse;
2904 2904
     }
2905 2905
 
2906 2906
     if ( skipped > 0 ) {
2907
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2907
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
2908 2908
         msgParse = msgParse.replace("%s", skipped);
2909 2909
         msgParse = msgParse.replace("%d", processed);
2910 2910
         gdMsg += msgParse;
@@ -2914,17 +2914,17 @@  discard block
 block discarded – undo
2914 2914
         if (type=='loc') {
2915 2915
             invalid_addr = invalid;
2916 2916
         }
2917
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>';
2917
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
2918 2918
         msgParse = msgParse.replace("%s", invalid_addr);
2919 2919
         msgParse = msgParse.replace("%d", total);
2920 2920
         gdMsg += msgParse;
2921 2921
     }
2922 2922
 
2923 2923
     if (invalid > 0 && type!='loc') {
2924
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2924
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory'), '%s', '%d')); ?></p>';
2925 2925
         
2926 2926
         if (type=='hood') {
2927
-            msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ), '%s', '%d' ) );?></p>';
2927
+            msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory'), '%s', '%d')); ?></p>';
2928 2928
         }
2929 2929
         msgParse = msgParse.replace("%s", invalid);
2930 2930
         msgParse = msgParse.replace("%d", total);
@@ -2932,7 +2932,7 @@  discard block
 block discarded – undo
2932 2932
     }
2933 2933
 
2934 2934
     if (images > 0) {
2935
-        gdMsg += '<p><?php echo addslashes( $upload_dir );?></p>';
2935
+        gdMsg += '<p><?php echo addslashes($upload_dir); ?></p>';
2936 2936
     }
2937 2937
     gdMsg += '<p></p>';
2938 2938
     jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -3096,9 +3096,9 @@  discard block
 block discarded – undo
3096 3096
             if (typeof filters !== 'undefined' && filters && doFilter) {
3097 3097
                 getTotal = true;
3098 3098
                 attach += '&_c=1';
3099
-                gd_progressbar(el, 0, '<i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Preparing...', 'geodirectory' ) );?>');
3099
+                gd_progressbar(el, 0, '<i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Preparing...', 'geodirectory')); ?>');
3100 3100
             } else {
3101
-                gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3101
+                gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3102 3102
             }
3103 3103
             jQuery(el).find('#gd_timer').text('00:00:01');
3104 3104
             jQuery('#gd_ie_ex_files', el).html('');
@@ -3107,7 +3107,7 @@  discard block
 block discarded – undo
3107 3107
         jQuery.ajax({
3108 3108
             url: ajaxurl,
3109 3109
             type: "POST",
3110
-            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page + attach,
3110
+            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page + attach,
3111 3111
             dataType : 'json',
3112 3112
             cache: false,
3113 3113
             beforeSend: function (jqXHR, settings) {},
@@ -3132,11 +3132,11 @@  discard block
 block discarded – undo
3132 3132
                         } else {
3133 3133
                             if (pages < page || pages == page) {
3134 3134
                                 window.clearInterval(timer_posts);
3135
-                                gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fas fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3135
+                                gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fas fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3136 3136
                             } else {
3137 3137
                                 var percentage = Math.round(((page * chunk_size) / total_posts) * 100);
3138 3138
                                 percentage = percentage > 100 ? 100 : percentage;
3139
-                                gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3139
+                                gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3140 3140
                             }
3141 3141
                             if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3142 3142
                                 var obj_files = data.files;
@@ -3167,7 +3167,7 @@  discard block
 block discarded – undo
3167 3167
 
3168 3168
     function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
3169 3169
         if (page < 2) {
3170
-            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3170
+            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3171 3171
             jQuery(el).find('#gd_timer').text('00:00:01');
3172 3172
             jQuery('#gd_ie_ex_files', el).html('');
3173 3173
         }
@@ -3175,7 +3175,7 @@  discard block
 block discarded – undo
3175 3175
         jQuery.ajax({
3176 3176
             url: ajaxurl,
3177 3177
             type: "POST",
3178
-            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3178
+            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3179 3179
             dataType : 'json',
3180 3180
             cache: false,
3181 3181
             beforeSend: function (jqXHR, settings) {},
@@ -3189,11 +3189,11 @@  discard block
 block discarded – undo
3189 3189
                     } else {
3190 3190
                         if (pages < page || pages == page) {
3191 3191
                             window.clearInterval(timer_cats);
3192
-                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fas fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3192
+                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fas fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3193 3193
                         } else {
3194 3194
                             var percentage = Math.round(((page * chunk_size) / total_cats) * 100);
3195 3195
                             percentage = percentage > 100 ? 100 : percentage;
3196
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
3196
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
3197 3197
                         }
3198 3198
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3199 3199
                             var obj_files = data.files;
@@ -3250,13 +3250,13 @@  discard block
 block discarded – undo
3250 3250
 function geodir_init_filesystem()
3251 3251
 {
3252 3252
 
3253
-    if(!function_exists('get_filesystem_method')){
3253
+    if (!function_exists('get_filesystem_method')) {
3254 3254
         require_once(ABSPATH."/wp-admin/includes/file.php");
3255 3255
     }
3256 3256
     $access_type = get_filesystem_method();
3257 3257
     if ($access_type === 'direct') {
3258 3258
         /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3259
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3259
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3260 3260
 
3261 3261
         /* initialize the API */
3262 3262
         if (!WP_Filesystem($creds)) {
@@ -3269,7 +3269,7 @@  discard block
 block discarded – undo
3269 3269
         return $wp_filesystem;
3270 3270
         /* do our file manipulations below */
3271 3271
     } elseif (defined('FTP_USER')) {
3272
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3272
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3273 3273
 
3274 3274
         /* initialize the API */
3275 3275
         if (!WP_Filesystem($creds)) {
@@ -3304,7 +3304,7 @@  discard block
 block discarded – undo
3304 3304
  * @package GeoDirectory
3305 3305
  */
3306 3306
 function geodir_filesystem_notice()
3307
-{   if ( defined( 'DOING_AJAX' ) ){return;}
3307
+{   if (defined('DOING_AJAX')) {return; }
3308 3308
     $access_type = get_filesystem_method();
3309 3309
     if ($access_type === 'direct') {
3310 3310
     } elseif (!defined('FTP_USER')) {
@@ -3345,64 +3345,64 @@  discard block
 block discarded – undo
3345 3345
     // try to set higher limits for import
3346 3346
     $max_input_time = ini_get('max_input_time');
3347 3347
     $max_execution_time = ini_get('max_execution_time');
3348
-    $memory_limit= ini_get('memory_limit');
3348
+    $memory_limit = ini_get('memory_limit');
3349 3349
 
3350
-    if(!$max_input_time || $max_input_time<3000){
3350
+    if (!$max_input_time || $max_input_time < 3000) {
3351 3351
         @ini_set('max_input_time', 3000);
3352 3352
     }
3353 3353
 
3354
-    if(!$max_execution_time || $max_execution_time<3000){
3354
+    if (!$max_execution_time || $max_execution_time < 3000) {
3355 3355
         @ini_set('max_execution_time', 3000);
3356 3356
     }
3357 3357
 
3358
-    if($memory_limit && str_replace('M','',$memory_limit)){
3359
-        if(str_replace('M','',$memory_limit)<256){
3358
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
3359
+        if (str_replace('M', '', $memory_limit) < 256) {
3360 3360
             @ini_set('memory_limit', '256M');
3361 3361
         }
3362 3362
     }
3363 3363
 
3364 3364
     $json = array();
3365 3365
 
3366
-    if ( !current_user_can( 'manage_options' ) ) {
3367
-        wp_send_json( $json );
3366
+    if (!current_user_can('manage_options')) {
3367
+        wp_send_json($json);
3368 3368
     }
3369 3369
 
3370
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3371
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3372
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3370
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
3371
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
3372
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
3373 3373
 
3374
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3375
-        wp_send_json( $json );
3374
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
3375
+        wp_send_json($json);
3376 3376
     }
3377 3377
 
3378
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3379
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3378
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
3379
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
3380 3380
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3381
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3381
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
3382 3382
 
3383 3383
     $wp_filesystem = geodir_init_filesystem();
3384 3384
     if (!$wp_filesystem) {
3385
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3386
-        wp_send_json( $json );
3385
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
3386
+        wp_send_json($json);
3387 3387
     }
3388 3388
 
3389 3389
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3390
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3391
-        wp_send_json( $json );
3390
+        $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
3391
+        wp_send_json($json);
3392 3392
     }
3393 3393
 
3394
-    $csv_file_dir = geodir_path_import_export( false );
3395
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3396
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3397
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3398
-            wp_send_json( $json );
3394
+    $csv_file_dir = geodir_path_import_export(false);
3395
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
3396
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
3397
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
3398
+            wp_send_json($json);
3399 3399
         }
3400 3400
     }
3401 3401
     
3402 3402
     $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3403 3403
     $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3404 3404
 
3405
-    switch ( $task ) {
3405
+    switch ($task) {
3406 3406
         case 'export_posts': {
3407 3407
             // WPML
3408 3408
             $is_wpml = geodir_is_wpml();
@@ -3413,36 +3413,36 @@  discard block
 block discarded – undo
3413 3413
                 $sitepress->switch_lang('all', true);
3414 3414
             }
3415 3415
             // WPML
3416
-            if ( $post_type == 'gd_event' ) {
3417
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3416
+            if ($post_type == 'gd_event') {
3417
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
3418 3418
             }
3419
-            $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3419
+            $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
3420 3420
             
3421
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3422
-            if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3423
-                $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3421
+            $file_name = $post_type.'_'.date('dmyHi');
3422
+            if ($filters && isset($filters['start_date']) && isset($filters['end_date'])) {
3423
+                $file_name = $post_type.'_'.date_i18n('dmy', strtotime($filters['start_date'])).'_'.date_i18n('dmy', strtotime($filters['end_date']));
3424 3424
             }
3425
-            $posts_count = geodir_get_posts_count( $post_type );
3426
-            $file_url_base = geodir_path_import_export() . '/';
3427
-            $file_url = $file_url_base . $file_name . '.csv';
3428
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3429
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3425
+            $posts_count = geodir_get_posts_count($post_type);
3426
+            $file_url_base = geodir_path_import_export().'/';
3427
+            $file_url = $file_url_base.$file_name.'.csv';
3428
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3429
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv';
3430 3430
             
3431 3431
             $chunk_file_paths = array();
3432 3432
 
3433
-            if ( isset( $_REQUEST['_c'] ) ) {
3433
+            if (isset($_REQUEST['_c'])) {
3434 3434
                 $json['total'] = $posts_count;
3435 3435
                 // WPML
3436 3436
                 if ($is_wpml) {
3437 3437
                     $sitepress->switch_lang($active_lang, true);
3438 3438
                 }
3439 3439
                 // WPML
3440
-                wp_send_json( $json );
3440
+                wp_send_json($json);
3441 3441
                 gd_die();
3442
-            } else if ( isset( $_REQUEST['_st'] ) ) {
3443
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3444
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3445
-                $percentage = min( $percentage, 100 );
3442
+            } else if (isset($_REQUEST['_st'])) {
3443
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3444
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
3445
+                $percentage = min($percentage, 100);
3446 3446
                 
3447 3447
                 $json['percentage'] = $percentage;
3448 3448
                 // WPML
@@ -3450,45 +3450,45 @@  discard block
 block discarded – undo
3450 3450
                     $sitepress->switch_lang($active_lang, true);
3451 3451
                 }
3452 3452
                 // WPML
3453
-                wp_send_json( $json );
3453
+                wp_send_json($json);
3454 3454
                 gd_die();
3455 3455
             } else {
3456
-                if ( !$posts_count > 0 ) {
3457
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3456
+                if (!$posts_count > 0) {
3457
+                    $json['error'] = __('No records to export.', 'geodirectory');
3458 3458
                 } else {
3459 3459
                     $total_posts = $posts_count;
3460 3460
                     if ($chunk_per_page > $total_posts) {
3461 3461
                         $chunk_per_page = $total_posts;
3462 3462
                     }
3463
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3463
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
3464 3464
                     
3465 3465
                     $j = $chunk_page_no;
3466
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3466
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
3467 3467
                     
3468 3468
                     $per_page = 500;
3469 3469
                     if ($per_page > $chunk_per_page) {
3470 3470
                         $per_page = $chunk_per_page;
3471 3471
                     }
3472
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3472
+                    $total_pages = ceil($chunk_per_page / $per_page);
3473 3473
                     
3474
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3475
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3474
+                    for ($i = 0; $i <= $total_pages; $i++) {
3475
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
3476 3476
                         
3477 3477
                         $clear = $i == 0 ? true : false;
3478
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3478
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
3479 3479
                     }
3480 3480
                         
3481
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3482
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3483
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3484
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3485
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3481
+                    if ($wp_filesystem->exists($file_path_temp)) {
3482
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3483
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3484
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3485
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3486 3486
                         
3487
-                        $file_url = $file_url_base . $chunk_file_name;
3488
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3487
+                        $file_url = $file_url_base.$chunk_file_name;
3488
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3489 3489
                     }
3490 3490
                     
3491
-                    if ( !empty($chunk_file_paths) ) {
3491
+                    if (!empty($chunk_file_paths)) {
3492 3492
                         $json['total'] = $posts_count;
3493 3493
                         $json['files'] = $chunk_file_paths;
3494 3494
                     } else {
@@ -3496,7 +3496,7 @@  discard block
 block discarded – undo
3496 3496
                             $json['total'] = $posts_count;
3497 3497
                             $json['files'] = array();
3498 3498
                         } else {
3499
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3499
+                            $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3500 3500
                         }
3501 3501
                     }
3502 3502
                 }
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
                     $sitepress->switch_lang($active_lang, true);
3506 3506
                 }
3507 3507
                 // WPML
3508
-                wp_send_json( $json );
3508
+                wp_send_json($json);
3509 3509
             }
3510 3510
         }
3511 3511
         break;
@@ -3519,20 +3519,20 @@  discard block
 block discarded – undo
3519 3519
                 $sitepress->switch_lang('all', true);
3520 3520
             }
3521 3521
             // WPML
3522
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3522
+            $file_name = $post_type.'category_'.date('dmyHi');
3523 3523
             
3524
-            $terms_count = geodir_get_terms_count( $post_type );
3525
-            $file_url_base = geodir_path_import_export() . '/';
3526
-            $file_url = $file_url_base . $file_name . '.csv';
3527
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3528
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3524
+            $terms_count = geodir_get_terms_count($post_type);
3525
+            $file_url_base = geodir_path_import_export().'/';
3526
+            $file_url = $file_url_base.$file_name.'.csv';
3527
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3528
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv';
3529 3529
             
3530 3530
             $chunk_file_paths = array();
3531 3531
             
3532
-            if ( isset( $_REQUEST['_st'] ) ) {
3533
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3534
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3535
-                $percentage = min( $percentage, 100 );
3532
+            if (isset($_REQUEST['_st'])) {
3533
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3534
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
3535
+                $percentage = min($percentage, 100);
3536 3536
                 
3537 3537
                 $json['percentage'] = $percentage;
3538 3538
                 // WPML
@@ -3540,48 +3540,48 @@  discard block
 block discarded – undo
3540 3540
                     $sitepress->switch_lang($active_lang, true);
3541 3541
                 }
3542 3542
                 // WPML
3543
-                wp_send_json( $json );
3543
+                wp_send_json($json);
3544 3544
             } else {
3545
-                if ( !$terms_count > 0 ) {
3546
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3545
+                if (!$terms_count > 0) {
3546
+                    $json['error'] = __('No records to export.', 'geodirectory');
3547 3547
                 } else {
3548 3548
                     $total_terms = $terms_count;
3549 3549
                     if ($chunk_per_page > $terms_count) {
3550 3550
                         $chunk_per_page = $terms_count;
3551 3551
                     }
3552
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3552
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
3553 3553
                     
3554 3554
                     $j = $chunk_page_no;
3555
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3555
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
3556 3556
                     
3557 3557
                     $per_page = 500;
3558 3558
                     if ($per_page > $chunk_per_page) {
3559 3559
                         $per_page = $chunk_per_page;
3560 3560
                     }
3561
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3561
+                    $total_pages = ceil($chunk_per_page / $per_page);
3562 3562
                     
3563
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3564
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3563
+                    for ($i = 0; $i <= $total_pages; $i++) {
3564
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
3565 3565
                         
3566 3566
                         $clear = $i == 0 ? true : false;
3567
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3567
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
3568 3568
                     }
3569 3569
                     
3570
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3571
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3572
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3573
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3574
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3570
+                    if ($wp_filesystem->exists($file_path_temp)) {
3571
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3572
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3573
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3574
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3575 3575
                         
3576
-                        $file_url = $file_url_base . $chunk_file_name;
3577
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3576
+                        $file_url = $file_url_base.$chunk_file_name;
3577
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3578 3578
                     }
3579 3579
                     
3580
-                    if ( !empty($chunk_file_paths) ) {
3580
+                    if (!empty($chunk_file_paths)) {
3581 3581
                         $json['total'] = $terms_count;
3582 3582
                         $json['files'] = $chunk_file_paths;
3583 3583
                     } else {
3584
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3584
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3585 3585
                     }
3586 3586
                 }
3587 3587
                 // WPML
@@ -3589,127 +3589,127 @@  discard block
 block discarded – undo
3589 3589
                     $sitepress->switch_lang($active_lang, true);
3590 3590
                 }
3591 3591
                 // WPML
3592
-                wp_send_json( $json );
3592
+                wp_send_json($json);
3593 3593
             }
3594 3594
         }
3595 3595
         break;
3596 3596
         case 'export_locations': {
3597
-            $file_url_base = geodir_path_import_export() . '/';
3598
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3599
-            $file_url = $file_url_base . $file_name . '.csv';
3600
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3601
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3597
+            $file_url_base = geodir_path_import_export().'/';
3598
+            $file_name = 'gd_locations_'.date('dmyHi');
3599
+            $file_url = $file_url_base.$file_name.'.csv';
3600
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3601
+            $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv';
3602 3602
             
3603
-            $items_count = (int)geodir_location_imex_count_locations();
3603
+            $items_count = (int) geodir_location_imex_count_locations();
3604 3604
             
3605
-            if ( isset( $_REQUEST['_st'] ) ) {
3606
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3607
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3608
-                $percentage = min( $percentage, 100 );
3605
+            if (isset($_REQUEST['_st'])) {
3606
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3607
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3608
+                $percentage = min($percentage, 100);
3609 3609
                 
3610 3610
                 $json['percentage'] = $percentage;
3611
-                wp_send_json( $json );
3611
+                wp_send_json($json);
3612 3612
             } else {
3613 3613
                 $chunk_file_paths = array();
3614 3614
                 
3615
-                if ( !$items_count > 0 ) {
3616
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3615
+                if (!$items_count > 0) {
3616
+                    $json['error'] = __('No records to export.', 'geodirectory');
3617 3617
                 } else {
3618
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3619
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3618
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3619
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3620 3620
                     
3621 3621
                     $j = $chunk_page_no;
3622
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3622
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
3623 3623
                     
3624 3624
                     $per_page = 500;
3625
-                    $per_page = min( $per_page, $chunk_per_page );
3626
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3625
+                    $per_page = min($per_page, $chunk_per_page);
3626
+                    $total_pages = ceil($chunk_per_page / $per_page);
3627 3627
                     
3628
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3629
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3628
+                    for ($i = 0; $i <= $total_pages; $i++) {
3629
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3630 3630
                         
3631 3631
                         $clear = $i == 0 ? true : false;
3632
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3632
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3633 3633
                     }
3634 3634
                     
3635
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3636
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3637
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3638
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3639
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3635
+                    if ($wp_filesystem->exists($file_path_temp)) {
3636
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3637
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3638
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3639
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3640 3640
                         
3641
-                        $file_url = $file_url_base . $chunk_file_name;
3642
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3641
+                        $file_url = $file_url_base.$chunk_file_name;
3642
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3643 3643
                     }
3644 3644
                     
3645
-                    if ( !empty($chunk_file_paths) ) {
3645
+                    if (!empty($chunk_file_paths)) {
3646 3646
                         $json['total'] = $items_count;
3647 3647
                         $json['files'] = $chunk_file_paths;
3648 3648
                     } else {
3649
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3649
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3650 3650
                     }
3651 3651
                 }
3652
-                wp_send_json( $json );
3652
+                wp_send_json($json);
3653 3653
             }
3654 3654
         }
3655 3655
         break;
3656 3656
         case 'export_hoods': {
3657
-            $file_url_base = geodir_path_import_export() . '/';
3658
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3659
-            $file_url = $file_url_base . $file_name . '.csv';
3660
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3661
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3657
+            $file_url_base = geodir_path_import_export().'/';
3658
+            $file_name = 'gd_neighbourhoods_'.date('dmyHi');
3659
+            $file_url = $file_url_base.$file_name.'.csv';
3660
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3661
+            $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv';
3662 3662
             
3663
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3663
+            $items_count = (int) geodir_location_imex_count_neighbourhoods();
3664 3664
             
3665
-            if ( isset( $_REQUEST['_st'] ) ) {
3666
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3667
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3668
-                $percentage = min( $percentage, 100 );
3665
+            if (isset($_REQUEST['_st'])) {
3666
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3667
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3668
+                $percentage = min($percentage, 100);
3669 3669
                 
3670 3670
                 $json['percentage'] = $percentage;
3671
-                wp_send_json( $json );
3671
+                wp_send_json($json);
3672 3672
             } else {
3673 3673
                 $chunk_file_paths = array();
3674 3674
                 
3675
-                if ( !$items_count > 0 ) {
3676
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3675
+                if (!$items_count > 0) {
3676
+                    $json['error'] = __('No records to export.', 'geodirectory');
3677 3677
                 } else {
3678
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3679
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3678
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3679
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3680 3680
                     
3681 3681
                     $j = $chunk_page_no;
3682
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3682
+                    $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j);
3683 3683
                     
3684 3684
                     $per_page = 500;
3685
-                    $per_page = min( $per_page, $chunk_per_page );
3686
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3685
+                    $per_page = min($per_page, $chunk_per_page);
3686
+                    $total_pages = ceil($chunk_per_page / $per_page);
3687 3687
                     
3688
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3689
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3688
+                    for ($i = 0; $i <= $total_pages; $i++) {
3689
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3690 3690
                         
3691 3691
                         $clear = $i == 0 ? true : false;
3692
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3692
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3693 3693
                     }
3694 3694
                     
3695
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3696
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3697
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3698
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3699
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3695
+                    if ($wp_filesystem->exists($file_path_temp)) {
3696
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3697
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3698
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3699
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3700 3700
                         
3701
-                        $file_url = $file_url_base . $chunk_file_name;
3702
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3701
+                        $file_url = $file_url_base.$chunk_file_name;
3702
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3703 3703
                     }
3704 3704
                     
3705
-                    if ( !empty($chunk_file_paths) ) {
3705
+                    if (!empty($chunk_file_paths)) {
3706 3706
                         $json['total'] = $items_count;
3707 3707
                         $json['files'] = $chunk_file_paths;
3708 3708
                     } else {
3709
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3709
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3710 3710
                     }
3711 3711
                 }
3712
-                wp_send_json( $json );
3712
+                wp_send_json($json);
3713 3713
             }
3714 3714
         }
3715 3715
         break;
@@ -3726,34 +3726,34 @@  discard block
 block discarded – undo
3726 3726
             }
3727 3727
             // WPML
3728 3728
             
3729
-            @ini_set( 'auto_detect_line_endings', true );
3729
+            @ini_set('auto_detect_line_endings', true);
3730 3730
             
3731 3731
             $uploads = wp_upload_dir();
3732 3732
             $uploads_dir = $uploads['path'];
3733 3733
             $uploads_subdir = $uploads['subdir'];
3734 3734
             
3735
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3736
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3735
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
3736
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
3737 3737
             
3738
-            $csv_file_arr = explode( '/', $csv_file );
3739
-            $csv_filename = end( $csv_file_arr );
3740
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3738
+            $csv_file_arr = explode('/', $csv_file);
3739
+            $csv_filename = end($csv_file_arr);
3740
+            $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename;
3741 3741
             
3742 3742
             $json['file'] = $csv_file;
3743
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3743
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
3744 3744
             $file = array();
3745 3745
 
3746
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3747
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3746
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
3747
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
3748 3748
 
3749 3749
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3750 3750
                     $json['error'] = NULL;
3751 3751
 
3752 3752
                     $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3753 3753
                     setlocale(LC_ALL, 'en_US.UTF-8');
3754
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3755
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3756
-                            if ( !empty( $data ) ) {
3754
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
3755
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
3756
+                            if (!empty($data)) {
3757 3757
                                 $file[] = $data;
3758 3758
                             }
3759 3759
                         }
@@ -3767,19 +3767,19 @@  discard block
 block discarded – undo
3767 3767
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
3768 3768
                     }
3769 3769
                 } else {
3770
-                    wp_send_json( $json );
3770
+                    wp_send_json($json);
3771 3771
                 }
3772 3772
             } else {
3773
-                wp_send_json( $json );
3773
+                wp_send_json($json);
3774 3774
             }
3775 3775
             
3776
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3777
-                wp_send_json( $json );
3776
+            if ($task == 'prepare_import' || !empty($json['error'])) {
3777
+                wp_send_json($json);
3778 3778
             }
3779 3779
             
3780 3780
             $total = $json['rows'];
3781
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3782
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3781
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
3782
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
3783 3783
             
3784 3784
             $count = $limit;
3785 3785
             
@@ -3804,13 +3804,13 @@  discard block
 block discarded – undo
3804 3804
             
3805 3805
             $post_types = geodir_get_posttypes();
3806 3806
 
3807
-            if ( $task == 'import_cat' ) {
3807
+            if ($task == 'import_cat') {
3808 3808
                 if (!empty($file)) {
3809 3809
                     $columns = isset($file[0]) ? $file[0] : NULL;
3810 3810
                     
3811 3811
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3812 3812
                         $json['error'] = CSV_INVAILD_FILE;
3813
-                        wp_send_json( $json );
3813
+                        wp_send_json($json);
3814 3814
                         exit;
3815 3815
                     }
3816 3816
                     
@@ -3821,7 +3821,7 @@  discard block
 block discarded – undo
3821 3821
                         
3822 3822
                         if (isset($file[$index])) {
3823 3823
                             $row = $file[$index];
3824
-                            $row = array_map( 'trim', $row );
3824
+                            $row = array_map('trim', $row);
3825 3825
                             //$row = array_map( 'utf8_encode', $row );
3826 3826
                             
3827 3827
                             $cat_id = '';
@@ -3838,42 +3838,42 @@  discard block
 block discarded – undo
3838 3838
                             $cat_id_original = '';
3839 3839
                             
3840 3840
                             $c = 0;
3841
-                            foreach ($columns as $column ) {
3842
-                                if ( $column == 'cat_id' ) {
3843
-                                    $cat_id = (int)$row[$c];
3844
-                                } else if ( $column == 'cat_name' ) {
3841
+                            foreach ($columns as $column) {
3842
+                                if ($column == 'cat_id') {
3843
+                                    $cat_id = (int) $row[$c];
3844
+                                } else if ($column == 'cat_name') {
3845 3845
                                     $cat_name = $row[$c];
3846
-                                } else if ( $column == 'cat_slug' ) {
3846
+                                } else if ($column == 'cat_slug') {
3847 3847
                                     $cat_slug = $row[$c];
3848
-                                } else if ( $column == 'cat_posttype' ) {
3848
+                                } else if ($column == 'cat_posttype') {
3849 3849
                                     $cat_posttype = $row[$c];
3850
-                                } else if ( $column == 'cat_parent' ) {
3850
+                                } else if ($column == 'cat_parent') {
3851 3851
                                     $cat_parent = trim($row[$c]);
3852
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3852
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
3853 3853
                                     $cat_schema = $row[$c];
3854
-                                } else if ( $column == 'cat_description' ) {
3854
+                                } else if ($column == 'cat_description') {
3855 3855
                                     $cat_description = $row[$c];
3856
-                                } else if ( $column == 'cat_top_description' ) {
3856
+                                } else if ($column == 'cat_top_description') {
3857 3857
                                     $cat_top_description = $row[$c];
3858
-                                } else if ( $column == 'cat_image' ) {
3858
+                                } else if ($column == 'cat_image') {
3859 3859
                                     $cat_image = $row[$c];
3860
-                                } else if ( $column == 'cat_icon' ) {
3860
+                                } else if ($column == 'cat_icon') {
3861 3861
                                     $cat_icon = $row[$c];
3862 3862
                                 }
3863 3863
                                 // WPML
3864
-                                if ( $is_wpml ) {
3865
-                                    if ( $column == 'cat_language' ) {
3866
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
3867
-                                    } else if ( $column == 'cat_id_original' ) {
3868
-                                        $cat_id_original = (int)$row[$c];
3864
+                                if ($is_wpml) {
3865
+                                    if ($column == 'cat_language') {
3866
+                                        $cat_language = geodir_strtolower(trim($row[$c]));
3867
+                                    } else if ($column == 'cat_id_original') {
3868
+                                        $cat_id_original = (int) $row[$c];
3869 3869
                                     }
3870 3870
                                 }
3871 3871
                                 // WPML
3872 3872
                                 $c++;
3873 3873
                             }
3874 3874
                             
3875
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3876
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3875
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
3876
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
3877 3877
                                 
3878 3878
                                 $invalid++;
3879 3879
                                 continue;
@@ -3891,24 +3891,24 @@  discard block
 block discarded – undo
3891 3891
                             $term_data['description'] = $cat_description;
3892 3892
                             $term_data['cat_schema'] = $cat_schema;
3893 3893
                             $term_data['top_description'] = $cat_top_description;
3894
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3895
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3894
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
3895
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
3896 3896
                             
3897 3897
                             //$term_data = array_map( 'utf8_encode', $term_data );
3898 3898
                             
3899
-                            $taxonomy = $cat_posttype . 'category';
3899
+                            $taxonomy = $cat_posttype.'category';
3900 3900
                             
3901 3901
                             $term_data['taxonomy'] = $taxonomy;
3902 3902
 
3903 3903
                             $term_parent_id = 0;
3904
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
3904
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
3905 3905
                                 $term_parent = '';
3906 3906
                                 
3907
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3907
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
3908 3908
                                     //
3909
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3909
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
3910 3910
                                     //
3911
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3911
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
3912 3912
                                     //
3913 3913
                                 } else {
3914 3914
                                     $term_parent_data = array();
@@ -3916,104 +3916,104 @@  discard block
 block discarded – undo
3916 3916
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3917 3917
                                     $term_parent_data['taxonomy'] = $taxonomy;
3918 3918
                                     
3919
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3919
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
3920 3920
                                 }
3921 3921
                                 
3922
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3923
-                                    $term_parent_id = (int)$term_parent->term_id;
3922
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
3923
+                                    $term_parent_id = (int) $term_parent->term_id;
3924 3924
                                 }
3925 3925
                             }
3926
-                            $term_data['parent'] = (int)$term_parent_id;
3926
+                            $term_data['parent'] = (int) $term_parent_id;
3927 3927
 
3928 3928
                             $term_id = NULL;
3929
-                            if ( $import_choice == 'update' ) {
3930
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3929
+                            if ($import_choice == 'update') {
3930
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
3931 3931
                                     $term_data['term_id'] = $term['term_id'];
3932 3932
                                     
3933
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3933
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
3934 3934
                                         $updated++;
3935 3935
                                     } else {
3936 3936
                                         $invalid++;
3937
-                                        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' ) );
3937
+                                        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'));
3938 3938
                                     }
3939
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3939
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
3940 3940
                                     $term_data['term_id'] = $term['term_id'];
3941 3941
                                     
3942
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3942
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
3943 3943
                                         $updated++;
3944 3944
                                     } else {
3945 3945
                                         $invalid++;
3946
-                                        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' ) );
3946
+                                        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'));
3947 3947
                                     }
3948 3948
                                 } else {
3949
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3949
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
3950 3950
                                         $created++;
3951 3951
                                     } else {
3952 3952
                                         $invalid++;
3953
-                                        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' ) );
3953
+                                        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'));
3954 3954
                                     }
3955 3955
                                 }
3956
-                            } else if ( $import_choice == 'skip' ) {
3957
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3956
+                            } else if ($import_choice == 'skip') {
3957
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
3958 3958
                                     $skipped++;
3959
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3959
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
3960 3960
                                     $skipped++;
3961 3961
                                 } else {
3962
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3962
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
3963 3963
                                         $created++;
3964 3964
                                     } else {
3965 3965
                                         $invalid++;
3966
-                                        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' ) );
3966
+                                        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'));
3967 3967
                                     }
3968 3968
                                 }
3969 3969
                             } else {
3970 3970
                                 $invalid++;
3971
-                                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' ) );
3971
+                                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'));
3972 3972
                             }
3973 3973
                             
3974
-                            if ( $term_id ) {
3974
+                            if ($term_id) {
3975 3975
                                 // WPML
3976 3976
                                 if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
3977
-                                    $wpml_element_type = 'tax_' . $taxonomy;
3978
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3977
+                                    $wpml_element_type = 'tax_'.$taxonomy;
3978
+                                    $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type);
3979 3979
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3980 3980
 
3981
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3981
+                                    $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type);
3982 3982
                                     
3983
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3983
+                                    $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language);
3984 3984
                                 }
3985 3985
                                 // WPML
3986 3986
                                 
3987
-                                if ( isset( $term_data['top_description'] ) ) {
3988
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3987
+                                if (isset($term_data['top_description'])) {
3988
+                                    geodir_update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
3989 3989
                                 }
3990 3990
                                 
3991
-                                if ( isset( $term_data['cat_schema'] ) ) {
3992
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3991
+                                if (isset($term_data['cat_schema'])) {
3992
+                                    geodir_update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
3993 3993
                                 }
3994 3994
             
3995 3995
                                 $attachment = false;
3996
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3997
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3998
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3996
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
3997
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
3998
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
3999 3999
                                     
4000
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4000
+                                    if (basename($cat_image) != $term_data['image']) {
4001 4001
                                         $attachment = true;
4002
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4002
+                                        geodir_update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
4003 4003
                                     }
4004 4004
                                 }
4005 4005
                                 
4006
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4007
-                                    $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4008
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4006
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
4007
+                                    $cat_icon = geodir_get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
4008
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
4009 4009
 
4010
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4010
+                                    if (basename($cat_icon) != $term_data['icon']) {
4011 4011
                                         $attachment = true;
4012
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4012
+                                        geodir_update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
4013 4013
                                     }
4014 4014
                                 }
4015 4015
                                 
4016
-                                if ( $attachment ) {
4016
+                                if ($attachment) {
4017 4017
                                     $images++;
4018 4018
                                 }
4019 4019
                             }
@@ -4035,35 +4035,35 @@  discard block
 block discarded – undo
4035 4035
                 $json['invalid'] = $invalid;
4036 4036
                 $json['images'] = $images;
4037 4037
                 
4038
-                wp_send_json( $json );
4038
+                wp_send_json($json);
4039 4039
                 exit;
4040
-            } else if ( $task == 'import_post' ) {
4041
-                $xtimings['###1'] = microtime(true)-$xstart;
4040
+            } else if ($task == 'import_post') {
4041
+                $xtimings['###1'] = microtime(true) - $xstart;
4042 4042
                 //run some stuff to make the import quicker
4043
-                wp_defer_term_counting( true );
4044
-                wp_defer_comment_counting( true );
4045
-                $wpdb->query( 'SET autocommit = 0;' );
4043
+                wp_defer_term_counting(true);
4044
+                wp_defer_comment_counting(true);
4045
+                $wpdb->query('SET autocommit = 0;');
4046 4046
 //
4047 4047
 //                remove_all_actions('publish_post');
4048 4048
 //                remove_all_actions('transition_post_status');
4049 4049
 //                remove_all_actions('publish_future_post');
4050 4050
 
4051 4051
                 if (!empty($file)) {
4052
-                    $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4052
+                    $is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
4053 4053
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4054 4054
                     $default_status = 'publish';
4055
-                    $current_date = date_i18n( 'Y-m-d', time() );
4055
+                    $current_date = date_i18n('Y-m-d', time());
4056 4056
                     
4057 4057
                     $columns = isset($file[0]) ? $file[0] : NULL;
4058 4058
                     
4059 4059
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4060 4060
                         $json['error'] = CSV_INVAILD_FILE;
4061
-                        wp_send_json( $json );
4061
+                        wp_send_json($json);
4062 4062
                         exit;
4063 4063
                     }
4064
-                    $xtimings['###2'] = microtime(true)-$xstart;
4064
+                    $xtimings['###2'] = microtime(true) - $xstart;
4065 4065
                     $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4066
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4066
+                    $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
4067 4067
                     $processed_actual = 0;
4068 4068
                     for ($i = 1; $i <= $limit; $i++) {
4069 4069
                         $index = $processed + $i;
@@ -4072,9 +4072,9 @@  discard block
 block discarded – undo
4072 4072
                         if (isset($file[$index])) {
4073 4073
                             $processed_actual++;
4074 4074
                             $row = $file[$index];
4075
-                            $row = array_map( 'trim', $row );
4075
+                            $row = array_map('trim', $row);
4076 4076
                             //$row = array_map( 'utf8_encode', $row );
4077
-                            $row = array_map( 'addslashes_gpc', $row );
4077
+                            $row = array_map('addslashes_gpc', $row);
4078 4078
                             
4079 4079
                             $post_id = '';
4080 4080
                             $post_title = '';
@@ -4114,82 +4114,82 @@  discard block
 block discarded – undo
4114 4114
                             $original_post_id = '';
4115 4115
                             
4116 4116
                             $c = 0;
4117
-                            foreach ($columns as $column ) {
4117
+                            foreach ($columns as $column) {
4118 4118
                                 $gd_post[$column] = $row[$c];
4119 4119
                                 
4120
-                                if ( $column == 'post_id' ) {
4120
+                                if ($column == 'post_id') {
4121 4121
                                     $post_id = $row[$c];
4122
-                                } else if ( $column == 'post_title' ) {
4122
+                                } else if ($column == 'post_title') {
4123 4123
                                     $post_title = sanitize_text_field($row[$c]);
4124
-                                } else if ( $column == 'post_author' ) {
4124
+                                } else if ($column == 'post_author') {
4125 4125
                                     $post_author = $row[$c];
4126
-                                } else if ( $column == 'post_date' ) {
4126
+                                } else if ($column == 'post_date') {
4127 4127
                                     $post_date = $row[$c];
4128
-                                } else if ( $column == 'post_content' ) {
4128
+                                } else if ($column == 'post_content') {
4129 4129
                                     $post_content = $row[$c];
4130
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4131
-                                    $post_category_arr = explode( ',', $row[$c] );
4132
-                                } else if ( $column == 'default_category' ) {
4130
+                                } else if ($column == 'post_category' && $row[$c] != '') {
4131
+                                    $post_category_arr = explode(',', $row[$c]);
4132
+                                } else if ($column == 'default_category') {
4133 4133
                                     $default_category = wp_kses_normalize_entities($row[$c]);
4134
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4135
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4136
-                                } else if ( $column == 'post_type' ) {
4134
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
4135
+                                    $post_tags = explode(',', sanitize_text_field($row[$c]));
4136
+                                } else if ($column == 'post_type') {
4137 4137
                                     $post_type = $row[$c];
4138
-                                } else if ( $column == 'post_status' ) {
4139
-                                    $post_status = sanitize_key( $row[$c] );
4140
-                                } else if ( $column == 'is_featured' ) {
4141
-                                    $is_featured = (int)$row[$c];
4142
-                                } else if ( $column == 'geodir_video' ) {
4138
+                                } else if ($column == 'post_status') {
4139
+                                    $post_status = sanitize_key($row[$c]);
4140
+                                } else if ($column == 'is_featured') {
4141
+                                    $is_featured = (int) $row[$c];
4142
+                                } else if ($column == 'geodir_video') {
4143 4143
                                     $geodir_video = $row[$c];
4144
-                                } else if ( $column == 'post_address' ) {
4144
+                                } else if ($column == 'post_address') {
4145 4145
                                     $post_address = sanitize_text_field($row[$c]);
4146
-                                } else if ( $column == 'post_city' ) {
4146
+                                } else if ($column == 'post_city') {
4147 4147
                                     $post_city = sanitize_text_field($row[$c]);
4148
-                                } else if ( $column == 'post_region' ) {
4148
+                                } else if ($column == 'post_region') {
4149 4149
                                     $post_region = sanitize_text_field($row[$c]);
4150
-                                } else if ( $column == 'post_country' ) {
4150
+                                } else if ($column == 'post_country') {
4151 4151
                                     $post_country = sanitize_text_field($row[$c]);
4152
-                                } else if ( $column == 'post_zip' ) {
4152
+                                } else if ($column == 'post_zip') {
4153 4153
                                     $post_zip = sanitize_text_field($row[$c]);
4154
-                                } else if ( $column == 'post_latitude' ) {
4154
+                                } else if ($column == 'post_latitude') {
4155 4155
                                     $post_latitude = sanitize_text_field($row[$c]);
4156
-                                } else if ( $column == 'post_longitude' ) {
4156
+                                } else if ($column == 'post_longitude') {
4157 4157
                                     $post_longitude = sanitize_text_field($row[$c]);
4158
-                                } else if ( $column == 'post_neighbourhood' ) {
4158
+                                } else if ($column == 'post_neighbourhood') {
4159 4159
                                     $post_neighbourhood = sanitize_text_field($row[$c]);
4160 4160
                                     unset($gd_post[$column]);
4161
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4161
+                                } else if ($column == 'neighbourhood_latitude') {
4162 4162
                                     $neighbourhood_latitude = sanitize_text_field($row[$c]);
4163
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4163
+                                } else if ($column == 'neighbourhood_longitude') {
4164 4164
                                     $neighbourhood_longitude = sanitize_text_field($row[$c]);
4165
-                                } else if ( $column == 'geodir_timing' ) {
4165
+                                } else if ($column == 'geodir_timing') {
4166 4166
                                     $geodir_timing = sanitize_text_field($row[$c]);
4167
-                                } else if ( $column == 'geodir_contact' ) {
4167
+                                } else if ($column == 'geodir_contact') {
4168 4168
                                     $geodir_contact = sanitize_text_field($row[$c]);
4169
-                                } else if ( $column == 'geodir_email' ) {
4169
+                                } else if ($column == 'geodir_email') {
4170 4170
                                     $geodir_email = sanitize_email($row[$c]);
4171
-                                } else if ( $column == 'geodir_website' ) {
4171
+                                } else if ($column == 'geodir_website') {
4172 4172
                                     $geodir_website = sanitize_text_field($row[$c]);
4173
-                                } else if ( $column == 'geodir_twitter' ) {
4173
+                                } else if ($column == 'geodir_twitter') {
4174 4174
                                     $geodir_twitter = sanitize_text_field($row[$c]);
4175
-                                } else if ( $column == 'geodir_facebook' ) {
4175
+                                } else if ($column == 'geodir_facebook') {
4176 4176
                                     $geodir_facebook = sanitize_text_field($row[$c]);
4177
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4177
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
4178 4178
                                     $post_images[] = $row[$c];
4179
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4180
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4181
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4179
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
4180
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
4181
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
4182 4182
                                     $row[$c] = str_replace('/', '-', $row[$c]);
4183
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4184
-                                } else if ( strpos( $column, 'linked_' ) === 0 ) {
4185
-                                    $geodir_link_business = (int)$row[$c];
4183
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
4184
+                                } else if (strpos($column, 'linked_') === 0) {
4185
+                                    $geodir_link_business = (int) $row[$c];
4186 4186
                                 }
4187 4187
                                 // WPML
4188 4188
                                 if ($is_wpml) {
4189 4189
                                     if ($column == 'language') {
4190 4190
                                         $language = geodir_strtolower(trim($row[$c]));
4191 4191
                                     } else if ($column == 'original_post_id') {
4192
-                                        $original_post_id = (int)$row[$c];
4192
+                                        $original_post_id = (int) $row[$c];
4193 4193
                                     }
4194 4194
                                 }
4195 4195
                                 // WPML
@@ -4197,7 +4197,7 @@  discard block
 block discarded – undo
4197 4197
                             }
4198 4198
                             // listing claimed or not
4199 4199
                             if ($is_claim_active && isset($gd_post['claimed'])) {
4200
-                                $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4200
+                                $gd_post['claimed'] = (int) $gd_post['claimed'] == 1 ? 1 : 0;
4201 4201
                             }
4202 4202
                             
4203 4203
                             // WPML
@@ -4208,43 +4208,43 @@  discard block
 block discarded – undo
4208 4208
 
4209 4209
                             $gd_post['IMAGE'] = $post_images;
4210 4210
                             
4211
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4212
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4211
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
4212
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
4213 4213
                                                                                                                 
4214 4214
                             $valid = true;
4215 4215
                             
4216
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4216
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
4217 4217
                                 $invalid++;
4218 4218
                                 $valid = false;
4219
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4219
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
4220 4220
                             }
4221
-                            $xtimings['###3'] = microtime(true)-$xstart;
4222
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4223
-                            if ( $location_allowed ) {
4221
+                            $xtimings['###3'] = microtime(true) - $xstart;
4222
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
4223
+                            if ($location_allowed) {
4224 4224
                                 $location_result = geodir_get_default_location();
4225
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4225
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
4226 4226
                                     $invalid_addr++;
4227 4227
                                     $valid = false;
4228
-                                    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' ) );
4229
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4230
-                                    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 ) ) ) {
4228
+                                    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'));
4229
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
4230
+                                    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))) {
4231 4231
                                         $invalid_addr++;
4232 4232
                                         $valid = false;
4233
-                                        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' ) );
4233
+                                        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'));
4234 4234
                                     } else {
4235 4235
                                         if (!$location_manager) {
4236
-                                            $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.
4236
+                                            $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.
4237 4237
                                         }
4238 4238
                                     }
4239 4239
                                 }
4240 4240
                             }
4241
-                            $xtimings['###4']   = microtime(true)-$xstart;
4242
-                            if ( !$valid ) {
4241
+                            $xtimings['###4'] = microtime(true) - $xstart;
4242
+                            if (!$valid) {
4243 4243
                                 continue;
4244 4244
                             }
4245 4245
 
4246
-                            $cat_taxonomy = $post_type . 'category';
4247
-                            $tags_taxonomy = $post_type . '_tags';
4246
+                            $cat_taxonomy = $post_type.'category';
4247
+                            $tags_taxonomy = $post_type.'_tags';
4248 4248
                             
4249 4249
                             if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4250 4250
                                 $post_category_arr = array_merge(array($default_category), $post_category_arr);
@@ -4252,29 +4252,29 @@  discard block
 block discarded – undo
4252 4252
 
4253 4253
                             $post_category = array();
4254 4254
                             $default_category_id = NULL;
4255
-                            if ( !empty( $post_category_arr ) ) {
4256
-                                foreach ( $post_category_arr as $value ) {
4257
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4255
+                            if (!empty($post_category_arr)) {
4256
+                                foreach ($post_category_arr as $value) {
4257
+                                    $category_name = wp_kses_normalize_entities(trim($value));
4258 4258
                                     
4259
-                                    if ( $category_name != '' ) {
4259
+                                    if ($category_name != '') {
4260 4260
                                         $term_category = array();
4261 4261
                                         
4262
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4262
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
4263 4263
                                             $term_category = $term;
4264
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4264
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
4265 4265
                                             $term_category = $term;
4266 4266
                                         } else {
4267 4267
                                             $term_data = array();
4268 4268
                                             $term_data['name'] = $category_name;
4269 4269
                                             $term_data['taxonomy'] = $cat_taxonomy;
4270 4270
                                             
4271
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4272
-                                            if ( $term_id ) {
4273
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4271
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
4272
+                                            if ($term_id) {
4273
+                                                $term_category = get_term($term_id, $cat_taxonomy);
4274 4274
                                             }
4275 4275
                                         }
4276 4276
                                         
4277
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4277
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
4278 4278
                                             $post_category[] = intval($term_category->term_id);
4279 4279
                                             
4280 4280
                                             if ($category_name == $default_category) {
@@ -4284,14 +4284,14 @@  discard block
 block discarded – undo
4284 4284
                                     }
4285 4285
                                 }
4286 4286
                             }
4287
-                            $xtimings['###5'] = microtime(true)-$xstart;
4287
+                            $xtimings['###5'] = microtime(true) - $xstart;
4288 4288
                             $save_post = array();
4289 4289
                             $save_post['post_title'] = $post_title;
4290 4290
                             if (!empty($post_date)) {
4291
-                                $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4291
+                                $post_date = geodir_date($post_date, 'Y-m-d H:i:s'); // convert to mysql date format.
4292 4292
                                 
4293 4293
                                 $save_post['post_date'] = $post_date;
4294
-                                $save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4294
+                                $save_post['post_date_gmt'] = get_gmt_from_date($post_date);
4295 4295
                             }
4296 4296
                             $save_post['post_content'] = $post_content;
4297 4297
                             $save_post['post_type'] = $post_type;
@@ -4301,15 +4301,15 @@  discard block
 block discarded – undo
4301 4301
                             $save_post['post_tags'] = $post_tags;
4302 4302
 
4303 4303
                             $saved_post_id = NULL;
4304
-                            if ( $import_choice == 'update' ) {
4305
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4304
+                            if ($import_choice == 'update') {
4305
+                                $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
4306 4306
                                 
4307
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4307
+                                if ($post_id > 0 && get_post($post_id)) {
4308 4308
                                     $save_post['ID'] = $post_id;
4309 4309
                                     
4310
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4311
-                                        if ( is_wp_error( $saved_post_id ) ) {
4312
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4310
+                                    if ($saved_post_id = wp_update_post($save_post, true)) {
4311
+                                        if (is_wp_error($saved_post_id)) {
4312
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4313 4313
                                             $saved_post_id = 0;
4314 4314
                                         } else {
4315 4315
                                             $saved_post_id = $post_id;
@@ -4317,9 +4317,9 @@  discard block
 block discarded – undo
4317 4317
                                         }
4318 4318
                                     }
4319 4319
                                 } else {
4320
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4321
-                                        if ( is_wp_error( $saved_post_id ) ) {
4322
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4320
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4321
+                                        if (is_wp_error($saved_post_id)) {
4322
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4323 4323
                                             $saved_post_id = 0;
4324 4324
                                         } else {
4325 4325
                                             $created++;
@@ -4327,19 +4327,19 @@  discard block
 block discarded – undo
4327 4327
                                     }
4328 4328
                                 }
4329 4329
                                 
4330
-                                if ( !$saved_post_id > 0 ) {
4330
+                                if (!$saved_post_id > 0) {
4331 4331
                                     $invalid++;
4332
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4332
+                                    geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error);
4333 4333
                                 }
4334
-                            } else if ( $import_choice == 'skip' ) {
4335
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4334
+                            } else if ($import_choice == 'skip') {
4335
+                                if ($post_id > 0 && get_post($post_id)) {
4336 4336
                                     $skipped++;	
4337 4337
                                 } else {
4338
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4339
-                                        if ( is_wp_error( $saved_post_id ) ) {
4338
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4339
+                                        if (is_wp_error($saved_post_id)) {
4340 4340
                                             $invalid++;
4341 4341
                                             
4342
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4342
+                                            geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error);
4343 4343
                                             $saved_post_id = 0;
4344 4344
                                         } else {
4345 4345
                                             $created++;
@@ -4347,28 +4347,28 @@  discard block
 block discarded – undo
4347 4347
                                     } else {
4348 4348
                                         $invalid++;
4349 4349
                                         
4350
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4350
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4351 4351
                                     }
4352 4352
                                 }
4353 4353
                             } else {
4354 4354
                                 $invalid++;
4355 4355
                                 
4356
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4356
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4357 4357
                             }
4358
-                            $xtimings['###6'] = microtime(true)-$xstart;
4359
-                            if ( (int)$saved_post_id > 0 ) {
4358
+                            $xtimings['###6'] = microtime(true) - $xstart;
4359
+                            if ((int) $saved_post_id > 0) {
4360 4360
                                 // WPML
4361 4361
                                 if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
4362
-                                    $wpml_post_type = 'post_' . $post_type;
4363
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4362
+                                    $wpml_post_type = 'post_'.$post_type;
4363
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
4364 4364
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4365 4365
 
4366
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4366
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
4367 4367
                                     
4368
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4368
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
4369 4369
                                 }
4370 4370
                                 // WPML
4371
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4371
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
4372 4372
                                 
4373 4373
                                 $gd_post['post_id'] = $saved_post_id;
4374 4374
                                 $gd_post['ID'] = $saved_post_id;
@@ -4380,7 +4380,7 @@  discard block
 block discarded – undo
4380 4380
                                                     
4381 4381
                                 // post location
4382 4382
                                 $post_location_id = 0;
4383
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4383
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
4384 4384
                                     $gd_post['post_neighbourhood'] = '';
4385 4385
                                     
4386 4386
                                     $post_location_info = array(
@@ -4390,7 +4390,7 @@  discard block
 block discarded – undo
4390 4390
                                                                 'geo_lat' => $post_latitude,
4391 4391
                                                                 'geo_lng' => $post_longitude
4392 4392
                                                             );
4393
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4393
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
4394 4394
                                         $post_location_id = $location_id;
4395 4395
                                     }
4396 4396
                                     
@@ -4432,14 +4432,14 @@  discard block
 block discarded – undo
4432 4432
                                 }
4433 4433
                                 
4434 4434
                                 // post package info
4435
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4435
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
4436 4436
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4437 4437
                                     $package_id = $gd_post_info->package_id;
4438 4438
                                 }
4439 4439
                                 
4440 4440
                                 $package_info = array();
4441 4441
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4442
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4442
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
4443 4443
                                     
4444 4444
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4445 4445
                                         $package_info = array();
@@ -4447,18 +4447,18 @@  discard block
 block discarded – undo
4447 4447
                                 }
4448 4448
                                 
4449 4449
                                 if (empty($package_info)) {
4450
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4450
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
4451 4451
                                 }
4452 4452
                                  
4453
-                                if (!empty($package_info))	 {
4453
+                                if (!empty($package_info)) {
4454 4454
                                     $package_id = $package_info['pid'];
4455 4455
                                     
4456 4456
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4457 4457
                                         $gd_post['expire_date'] = $expire_date;
4458 4458
                                     } else {
4459
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4460
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4461
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4459
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
4460
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
4461
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
4462 4462
                                         } else {
4463 4463
                                             $gd_post['expire_date'] = 'Never';
4464 4464
                                         }
@@ -4467,7 +4467,7 @@  discard block
 block discarded – undo
4467 4467
                                     $gd_post['package_id'] = $package_id;
4468 4468
                                 }
4469 4469
 
4470
-                                $table = $plugin_prefix . $post_type . '_detail';
4470
+                                $table = $plugin_prefix.$post_type.'_detail';
4471 4471
                                 
4472 4472
                                 if ($post_type == 'gd_event') {
4473 4473
                                     $gd_post = geodir_imex_process_event_data($gd_post);
@@ -4478,71 +4478,71 @@  discard block
 block discarded – undo
4478 4478
                                 }
4479 4479
 
4480 4480
                                 // Export franchise fields
4481
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4481
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
4482 4482
                                 if ($is_franchise_active) {
4483
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
4484
-                                        if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
4483
+                                    if (isset($gd_post['gd_is_franchise']) && empty($gd_post['franchise'])) {
4484
+                                        if (absint($gd_post['gd_is_franchise']) != 0) {
4485 4485
                                             $gd_franchise_lock = array();
4486 4486
                                             
4487
-                                            if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4488
-                                                $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4489
-                                                $gd_franchise_lock = trim( $gd_franchise_lock );
4490
-                                                $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4487
+                                            if (isset($gd_post['gd_franchise_lock'])) {
4488
+                                                $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
4489
+                                                $gd_franchise_lock = trim($gd_franchise_lock);
4490
+                                                $gd_franchise_lock = explode(",", $gd_franchise_lock);
4491 4491
                                             }
4492 4492
                                             
4493
-                                            update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4494
-                                            update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4493
+                                            update_post_meta($saved_post_id, 'gd_is_franchise', 1);
4494
+                                            update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
4495 4495
                                         } else {
4496
-                                            if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
4497
-                                                geodir_franchise_remove_franchise( $saved_post_id );
4496
+                                            if (function_exists('geodir_franchise_remove_franchise')) {
4497
+                                                geodir_franchise_remove_franchise($saved_post_id);
4498 4498
                                             }
4499 4499
                                         }
4500 4500
                                     } else {
4501
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4502
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4501
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
4502
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
4503 4503
                                         }
4504 4504
                                     }
4505 4505
                                 }
4506 4506
                                 
4507 4507
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4508
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4508
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
4509 4509
                                     if ($default_category_id) {
4510 4510
                                         $save_post['post_default_category'] = $default_category_id;
4511 4511
                                         $gd_post['default_category'] = $default_category_id;
4512 4512
                                     }
4513 4513
                                     $gd_post[$cat_taxonomy] = $save_post['post_category'];
4514 4514
                                 }
4515
-                                $xtimings['###7'] = microtime(true)-$xstart;
4515
+                                $xtimings['###7'] = microtime(true) - $xstart;
4516 4516
                                 // Save post info
4517
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4518
-                                $xtimings['###8'] = microtime(true)-$xstart;
4517
+                                geodir_save_post_info($saved_post_id, $gd_post);
4518
+                                $xtimings['###8'] = microtime(true) - $xstart;
4519 4519
                                 // post taxonomies
4520
-                                if ( !empty( $save_post['post_category'] ) ) {
4521
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4520
+                                if (!empty($save_post['post_category'])) {
4521
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
4522 4522
                                     
4523
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4523
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
4524 4524
                                     if ($default_category_id) {
4525 4525
                                         $post_default_category = $default_category_id;
4526 4526
                                     }
4527 4527
                                     $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4528 4528
                                     $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4529
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4529
+                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
4530 4530
                                     
4531 4531
                                     if ($post_category_str != '' && $post_default_category) {
4532
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4532
+                                        $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str);
4533 4533
                                     }
4534 4534
                                     
4535 4535
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4536 4536
                                     
4537
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4537
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
4538 4538
                                 }
4539
-                                $xtimings['###8.1'] = microtime(true)-$xstart;
4540
-                                if ( !empty( $save_post['post_tags'] ) ) {
4541
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4539
+                                $xtimings['###8.1'] = microtime(true) - $xstart;
4540
+                                if (!empty($save_post['post_tags'])) {
4541
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
4542 4542
                                 }
4543
-                                $xtimings['###9'] = microtime(true)-$xstart;
4543
+                                $xtimings['###9'] = microtime(true) - $xstart;
4544 4544
                                 // Post images
4545
-                                if ( !empty( $post_images ) ) {
4545
+                                if (!empty($post_images)) {
4546 4546
                                     $post_images = array_unique($post_images);
4547 4547
                                     
4548 4548
                                     $old_post_images_arr = array();
@@ -4550,65 +4550,65 @@  discard block
 block discarded – undo
4550 4550
                                     
4551 4551
                                     $order = 1;
4552 4552
                                     
4553
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4554
-                                    $xtimings['###9.1'] = microtime(true)-$xstart;
4553
+                                    $old_post_images = geodir_get_images($saved_post_id);
4554
+                                    $xtimings['###9.1'] = microtime(true) - $xstart;
4555 4555
                                     if (!empty($old_post_images)) {
4556
-                                        foreach( $old_post_images as $old_post_image ) {
4556
+                                        foreach ($old_post_images as $old_post_image) {
4557 4557
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4558 4558
                                                 $old_post_images_arr[] = $old_post_image->file;
4559 4559
                                             }
4560 4560
                                         }
4561 4561
                                     }
4562 4562
 
4563
-                                    foreach ( $post_images as $post_image ) {
4564
-                                        $image_name = basename( $post_image );
4563
+                                    foreach ($post_images as $post_image) {
4564
+                                        $image_name = basename($post_image);
4565 4565
                                         $saved_post_images_arr[] = $image_name;
4566 4566
                                         
4567
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4567
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
4568 4568
                                             continue; // Skip if image already exists.
4569 4569
                                         }
4570 4570
                                         
4571
-                                        $image_name_parts = explode( '.', $image_name );
4572
-                                        array_pop( $image_name_parts );
4573
-                                        $proper_image_name = implode( '.', $image_name_parts );
4574
-                                        $xtimings['###9.2'] = microtime(true)-$xstart;
4575
-                                        $arr_file_type = wp_check_filetype( $image_name );
4576
-                                        $xtimings['###9.3'] = microtime(true)-$xstart;
4577
-                                        if ( !empty( $arr_file_type ) ) {
4571
+                                        $image_name_parts = explode('.', $image_name);
4572
+                                        array_pop($image_name_parts);
4573
+                                        $proper_image_name = implode('.', $image_name_parts);
4574
+                                        $xtimings['###9.2'] = microtime(true) - $xstart;
4575
+                                        $arr_file_type = wp_check_filetype($image_name);
4576
+                                        $xtimings['###9.3'] = microtime(true) - $xstart;
4577
+                                        if (!empty($arr_file_type)) {
4578 4578
                                             $uploaded_file_type = $arr_file_type['type'];
4579 4579
                                             
4580 4580
                                             $attachment = array();
4581 4581
                                             $attachment['post_id'] = $saved_post_id;
4582 4582
                                             $attachment['title'] = $proper_image_name;
4583 4583
                                             $attachment['content'] = '';
4584
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4584
+                                            $attachment['file'] = $uploads_subdir.'/'.$image_name;
4585 4585
                                             $attachment['mime_type'] = $uploaded_file_type;
4586 4586
                                             $attachment['menu_order'] = $order;
4587 4587
                                             $attachment['is_featured'] = 0;
4588 4588
 
4589 4589
                                             $attachment_set = '';
4590
-                                            foreach ( $attachment as $key => $val ) {
4591
-                                                if ( $val != '' ) {
4592
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4590
+                                            foreach ($attachment as $key => $val) {
4591
+                                                if ($val != '') {
4592
+                                                    $attachment_set .= $key." = '".$val."', ";
4593 4593
                                                 }
4594 4594
                                             }
4595
-                                            $attachment_set = trim( $attachment_set, ", " );
4595
+                                            $attachment_set = trim($attachment_set, ", ");
4596 4596
                                                                                         
4597 4597
                                             // Add new attachment
4598
-                                            $xtimings['###9.4'] = microtime(true)-$xstart;
4599
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4600
-                                            $xtimings['###9.5'] = microtime(true)-$xstart;
4598
+                                            $xtimings['###9.4'] = microtime(true) - $xstart;
4599
+                                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
4600
+                                            $xtimings['###9.5'] = microtime(true) - $xstart;
4601 4601
                                             $order++;
4602 4602
                                         }
4603 4603
                                     }
4604 4604
 
4605
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4605
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
4606 4606
                                     // Remove previous attachment
4607
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4608
-                                    $xtimings['###9.6'] = microtime(true)-$xstart;
4609
-                                    if ( !empty( $saved_post_images_arr ) ) {
4607
+                                    $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
4608
+                                    $xtimings['###9.6'] = microtime(true) - $xstart;
4609
+                                    if (!empty($saved_post_images_arr)) {
4610 4610
                                         geodir_set_wp_featured_image($saved_post_id);
4611
-                                        $xtimings['###9.7'] = microtime(true)-$xstart;
4611
+                                        $xtimings['###9.7'] = microtime(true) - $xstart;
4612 4612
                                         /*
4613 4613
                                         $menu_order = 1;
4614 4614
                                         
@@ -4624,14 +4624,14 @@  discard block
 block discarded – undo
4624 4624
                                         }*/
4625 4625
                                     }
4626 4626
                                     
4627
-                                    if ( $order > 1 ) {
4627
+                                    if ($order > 1) {
4628 4628
                                         $images++;
4629 4629
                                     }
4630 4630
                                 }
4631
-                                $xtimings['###10'] = microtime(true)-$xstart;
4631
+                                $xtimings['###10'] = microtime(true) - $xstart;
4632 4632
                                 /** This action is documented in geodirectory-functions/post-functions.php */
4633
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4634
-                                $xtimings['###11'] = microtime(true)-$xstart;
4633
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
4634
+                                $xtimings['###11'] = microtime(true) - $xstart;
4635 4635
                                 if (isset($is_featured)) {
4636 4636
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4637 4637
                                 }
@@ -4641,7 +4641,7 @@  discard block
 block discarded – undo
4641 4641
                                 if (isset($gd_post['expire_date'])) {
4642 4642
                                     geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4643 4643
                                 }
4644
-                                $xtimings['###12'] = microtime(true)-$xstart;
4644
+                                $xtimings['###12'] = microtime(true) - $xstart;
4645 4645
                             }
4646 4646
                             
4647 4647
                             // WPML
@@ -4654,11 +4654,11 @@  discard block
 block discarded – undo
4654 4654
                 }
4655 4655
 
4656 4656
                 //undo some stuff to make the import quicker
4657
-                wp_defer_term_counting( false );
4658
-                wp_defer_comment_counting( false );
4659
-                $wpdb->query( 'COMMIT;' );
4660
-                $wpdb->query( 'SET autocommit = 1;' );
4661
-                $xtimings['###13'] = microtime(true)-$xstart;
4657
+                wp_defer_term_counting(false);
4658
+                wp_defer_comment_counting(false);
4659
+                $wpdb->query('COMMIT;');
4660
+                $wpdb->query('SET autocommit = 1;');
4661
+                $xtimings['###13'] = microtime(true) - $xstart;
4662 4662
                 $json = array();
4663 4663
                 $json['processed'] = $processed_actual;
4664 4664
                 $json['created'] = $created;
@@ -4667,13 +4667,13 @@  discard block
 block discarded – undo
4667 4667
                 $json['invalid'] = $invalid;
4668 4668
                 $json['invalid_addr'] = $invalid_addr;
4669 4669
                 $json['images'] = $images;
4670
-                $json['timing'] = microtime(true)-$xstart;
4670
+                $json['timing'] = microtime(true) - $xstart;
4671 4671
                 $json['timings'] = $xtimings;
4672 4672
                 
4673 4673
 
4674
-                wp_send_json( $json );
4674
+                wp_send_json($json);
4675 4675
                 exit;
4676
-            } else if ( $task == 'import_loc' ) {
4676
+            } else if ($task == 'import_loc') {
4677 4677
                 global $gd_post_types;
4678 4678
                 $gd_post_types = $post_types;
4679 4679
                 
@@ -4682,82 +4682,82 @@  discard block
 block discarded – undo
4682 4682
                     
4683 4683
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4684 4684
                         $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4685
-                        wp_send_json( $json );
4685
+                        wp_send_json($json);
4686 4686
                     }
4687 4687
                     
4688 4688
                     $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4689
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4689
+                    $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
4690 4690
                     for ($i = 1; $i <= $limit; $i++) {
4691 4691
                         $index = $processed + $i;
4692 4692
                         
4693 4693
                         if (isset($file[$index])) {
4694 4694
                             $row = $file[$index];
4695
-                            $row = array_map( 'trim', $row );
4695
+                            $row = array_map('trim', $row);
4696 4696
                             $data = array();
4697 4697
                             
4698
-                            foreach ($columns as $c => $column ) {
4698
+                            foreach ($columns as $c => $column) {
4699 4699
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4700 4700
                                     $data[$column] = $row[$c];
4701 4701
                                 }
4702 4702
                             }
4703 4703
 
4704
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4704
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
4705 4705
                                 $invalid++;
4706
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4706
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4707 4707
                                 continue;
4708 4708
                             }
4709 4709
                             
4710 4710
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4711 4711
                             
4712
-                            if ( $import_choice == 'update' ) {
4713
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4714
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4712
+                            if ($import_choice == 'update') {
4713
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4714
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4715 4715
                                         $updated++;
4716 4716
                                     } else {
4717 4717
                                         $invalid++;
4718
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4718
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4719 4719
                                     }
4720
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4721
-                                    $data['location_id'] = (int)$location->location_id;
4720
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4721
+                                    $data['location_id'] = (int) $location->location_id;
4722 4722
                                     
4723
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4724
-                                        $data['location_id'] = (int)$location->location_id;
4725
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4726
-                                        $data['location_id'] = (int)$location->location_id;
4727
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4728
-                                        $data['location_id'] = (int)$location->location_id;
4723
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
4724
+                                        $data['location_id'] = (int) $location->location_id;
4725
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
4726
+                                        $data['location_id'] = (int) $location->location_id;
4727
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
4728
+                                        $data['location_id'] = (int) $location->location_id;
4729 4729
                                     }
4730 4730
                                     
4731
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4731
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4732 4732
                                         $updated++;
4733 4733
                                     } else {
4734 4734
                                         $invalid++;
4735
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4735
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4736 4736
                                     }
4737 4737
                                 } else {
4738
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4738
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4739 4739
                                         $created++;
4740 4740
                                     } else {
4741 4741
                                         $invalid++;
4742
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4742
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4743 4743
                                     }
4744 4744
                                 }
4745
-                            } elseif ( $import_choice == 'skip' ) {
4746
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4745
+                            } elseif ($import_choice == 'skip') {
4746
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4747 4747
                                     $skipped++;
4748
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4748
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4749 4749
                                     $skipped++;
4750 4750
                                 } else {
4751
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4751
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4752 4752
                                         $created++;
4753 4753
                                     } else {
4754 4754
                                         $invalid++;
4755
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4755
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4756 4756
                                     }
4757 4757
                                 }
4758 4758
                             } else {
4759 4759
                                 $invalid++;
4760
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4760
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4761 4761
                             }
4762 4762
                         }
4763 4763
                     }
@@ -4771,24 +4771,24 @@  discard block
 block discarded – undo
4771 4771
                 $json['invalid'] = $invalid;
4772 4772
                 $json['images'] = $images;
4773 4773
                 
4774
-                wp_send_json( $json );
4775
-            } else if ( $task == 'import_hood' ) {               
4774
+                wp_send_json($json);
4775
+            } else if ($task == 'import_hood') {               
4776 4776
                 if (!empty($file)) {
4777 4777
                     $columns = isset($file[0]) ? $file[0] : NULL;
4778 4778
                     
4779 4779
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4780 4780
                         $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4781
-                        wp_send_json( $json );
4781
+                        wp_send_json($json);
4782 4782
                     }
4783 4783
                     
4784 4784
                     $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4785
-                    $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' );
4785
+                    $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');
4786 4786
                     for ($i = 1; $i <= $limit; $i++) {
4787 4787
                         $index = $processed + $i;
4788 4788
                         
4789 4789
                         if (isset($file[$index])) {
4790 4790
                             $row = $file[$index];
4791
-                            $row = array_map( 'trim', $row );
4791
+                            $row = array_map('trim', $row);
4792 4792
                             $data = array();
4793 4793
                             
4794 4794
                             foreach ($columns as $c => $column) {
@@ -4799,20 +4799,20 @@  discard block
 block discarded – undo
4799 4799
 
4800 4800
                             if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4801 4801
                                 $invalid++;
4802
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4802
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4803 4803
                                 continue;
4804 4804
                             }
4805 4805
                             
4806 4806
                             $location_info = array();
4807
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4808
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4807
+                            if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
4808
+                                $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
4809 4809
                             } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4810 4810
                                 $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4811 4811
                             }
4812 4812
 
4813 4813
                             if (empty($location_info)) {
4814 4814
                                 $invalid++;
4815
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4815
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4816 4816
                                 continue;
4817 4817
                             }
4818 4818
                             
@@ -4827,35 +4827,35 @@  discard block
 block discarded – undo
4827 4827
                             $hood_data['hood_longitude'] = $data['longitude'];
4828 4828
                             $hood_data['hood_location_id'] = $location_id;
4829 4829
                                     
4830
-                            if ( $import_choice == 'update' ) {
4831
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4832
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4830
+                            if ($import_choice == 'update') {
4831
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4832
+                                    $hood_data['hood_id'] = (int) $data['neighbourhood_id'];
4833 4833
                                     
4834 4834
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4835 4835
                                         $updated++;
4836 4836
                                     } else {
4837 4837
                                         $invalid++;
4838
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4838
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4839 4839
                                     }
4840 4840
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4841
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4841
+                                    $hood_data['hood_id'] = (int) $neighbourhood->hood_id;
4842 4842
                                     
4843 4843
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4844 4844
                                         $updated++;
4845 4845
                                     } else {
4846 4846
                                         $invalid++;
4847
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4847
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4848 4848
                                     }
4849 4849
                                 } else {
4850 4850
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4851 4851
                                         $created++;
4852 4852
                                     } else {
4853 4853
                                         $invalid++;
4854
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4854
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4855 4855
                                     }
4856 4856
                                 }
4857
-                            } elseif ( $import_choice == 'skip' ) {
4858
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4857
+                            } elseif ($import_choice == 'skip') {
4858
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4859 4859
                                     $skipped++;
4860 4860
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4861 4861
                                     $skipped++;
@@ -4865,12 +4865,12 @@  discard block
 block discarded – undo
4865 4865
                                         $created++;
4866 4866
                                     } else {
4867 4867
                                         $invalid++;
4868
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4868
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4869 4869
                                     }
4870 4870
                                 }
4871 4871
                             } else {
4872 4872
                                 $invalid++;
4873
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4873
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4874 4874
                             }
4875 4875
                         }
4876 4876
                     }
@@ -4884,7 +4884,7 @@  discard block
 block discarded – undo
4884 4884
                 $json['invalid'] = $invalid;
4885 4885
                 $json['images'] = $images;
4886 4886
                 
4887
-                wp_send_json( $json );
4887
+                wp_send_json($json);
4888 4888
             }
4889 4889
         }
4890 4890
         break;
@@ -4928,29 +4928,29 @@  discard block
 block discarded – undo
4928 4928
  * }
4929 4929
  * @return int|bool Term id when success, false when fail.
4930 4930
  */
4931
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
4932
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
4931
+function geodir_imex_insert_term($taxonomy, $term_data) {
4932
+	if (empty($taxonomy) || empty($term_data)) {
4933 4933
 		return false;
4934 4934
 	}
4935 4935
 	
4936
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
4936
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
4937 4937
 	$args = array();
4938
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
4939
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
4940
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
4938
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
4939
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
4940
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
4941 4941
 	
4942
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
4943
-		$term_args = array_merge( $term_data, $args );
4944
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
4945
-		$term_args = wp_parse_args( $term_args, $defaults );
4946
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
4947
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
4942
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
4943
+		$term_args = array_merge($term_data, $args);
4944
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
4945
+		$term_args = wp_parse_args($term_args, $defaults);
4946
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
4947
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
4948 4948
 	}
4949 4949
 	
4950
-    if( !empty( $term ) ) {
4951
-		$result = wp_insert_term( $term, $taxonomy, $args );
4952
-        if( !is_wp_error( $result ) ) {
4953
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4950
+    if (!empty($term)) {
4951
+		$result = wp_insert_term($term, $taxonomy, $args);
4952
+        if (!is_wp_error($result)) {
4953
+            return isset($result['term_id']) ? $result['term_id'] : 0;
4954 4954
         }
4955 4955
     }
4956 4956
 	
@@ -4980,36 +4980,36 @@  discard block
 block discarded – undo
4980 4980
  * }
4981 4981
  * @return int|bool Term id when success, false when fail.
4982 4982
  */
4983
-function geodir_imex_update_term( $taxonomy, $term_data ) {
4984
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
4983
+function geodir_imex_update_term($taxonomy, $term_data) {
4984
+	if (empty($taxonomy) || empty($term_data)) {
4985 4985
 		return false;
4986 4986
 	}
4987 4987
 	
4988
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
4988
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
4989 4989
 	
4990 4990
 	$args = array();
4991
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
4992
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
4993
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
4991
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
4992
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
4993
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
4994 4994
 	
4995
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
4995
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
4996 4996
 		$term_data['term_id'] = $term_info['term_id'];
4997 4997
 		
4998
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
4998
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
4999 4999
 		
5000
-		if( !is_wp_error( $result ) ) {
5001
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5000
+		if (!is_wp_error($result)) {
5001
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5002 5002
         }
5003
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5003
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
5004 5004
 		$term_data['term_id'] = $term_info['term_id'];
5005 5005
 		
5006
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5006
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5007 5007
 		
5008
-		if( !is_wp_error( $result ) ) {
5009
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5008
+		if (!is_wp_error($result)) {
5009
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5010 5010
         }
5011 5011
 	} else {
5012
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5012
+		return geodir_imex_insert_term($taxonomy, $term_data);
5013 5013
 	}
5014 5014
 	
5015 5015
 	return false;
@@ -5028,20 +5028,20 @@  discard block
 block discarded – undo
5028 5028
  * @param string $post_type Post type.
5029 5029
  * @return int Posts count.
5030 5030
  */
5031
-function geodir_get_posts_count( $post_type ) {
5031
+function geodir_get_posts_count($post_type) {
5032 5032
     global $wpdb, $plugin_prefix;
5033 5033
 
5034
-    if ( !post_type_exists( $post_type ) ) {
5034
+    if (!post_type_exists($post_type)) {
5035 5035
         return 0;
5036 5036
     }
5037 5037
         
5038
-    $table = $plugin_prefix . $post_type . '_detail';
5038
+    $table = $plugin_prefix.$post_type.'_detail';
5039 5039
 
5040 5040
     // Skip listing with statuses trash, auto-draft etc...
5041 5041
     $skip_statuses = geodir_imex_export_skip_statuses();
5042 5042
     $where_statuses = '';
5043
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5044
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5043
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5044
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5045 5045
     }
5046 5046
     
5047 5047
     /**
@@ -5052,11 +5052,11 @@  discard block
 block discarded – undo
5052 5052
      *
5053 5053
      * @param string $where SQL where clause part.
5054 5054
      */
5055
-    $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5055
+    $where_statuses = apply_filters('geodir_get_posts_count', $where_statuses, $post_type);
5056 5056
 
5057
-    $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 );
5057
+    $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);
5058 5058
 
5059
-    $posts_count = (int)$wpdb->get_var( $query );
5059
+    $posts_count = (int) $wpdb->get_var($query);
5060 5060
     
5061 5061
     /**
5062 5062
      * Modify returned post counts for the current post type.
@@ -5067,7 +5067,7 @@  discard block
 block discarded – undo
5067 5067
      * @param int $posts_count Post counts.
5068 5068
      * @param string $post_type Post type.
5069 5069
      */
5070
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5070
+    $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
5071 5071
 
5072 5072
     return $posts_count;
5073 5073
 }
@@ -5089,19 +5089,19 @@  discard block
 block discarded – undo
5089 5089
  * @param int $page_no Page number. Default 0.
5090 5090
  * @return array Array of posts data.
5091 5091
  */
5092
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5092
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5093 5093
 	global $wp_filesystem;
5094 5094
 
5095
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5095
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5096 5096
 
5097 5097
 	$csv_rows = array();
5098 5098
 	
5099
-	if ( !empty( $posts ) ) {
5100
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5099
+	if (!empty($posts)) {
5100
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5101 5101
 		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5102
-		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5102
+		$location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5103 5103
 		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5104
-		$is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
5104
+		$is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
5105 5105
 		$is_events_active = function_exists('geodir_event_plugin_activated') ? true : false;
5106 5106
 		$is_custom_posts_active = function_exists('geodir_custom_post_type_plugin_activated') ? true : false;
5107 5107
 		
@@ -5116,7 +5116,7 @@  discard block
 block discarded – undo
5116 5116
 		$csv_row[] = 'default_category';
5117 5117
 		$csv_row[] = 'post_tags';
5118 5118
 		$csv_row[] = 'post_type';
5119
-		if ( $post_type == 'gd_event' ) {
5119
+		if ($post_type == 'gd_event') {
5120 5120
 			$csv_row[] = 'event_date';
5121 5121
 			$csv_row[] = 'event_enddate';
5122 5122
 			$csv_row[] = 'starttime';
@@ -5168,25 +5168,25 @@  discard block
 block discarded – undo
5168 5168
 		$csv_row[] = 'geodir_video';
5169 5169
 		$csv_row[] = 'geodir_special_offers';
5170 5170
 		if ($is_events_active || $is_custom_posts_active) {
5171
-			$csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_' . $post_ypes[$post_type]['linkable_to'] . '_ID' : 'linked_cpt_ID';
5171
+			$csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_'.$post_ypes[$post_type]['linkable_to'].'_ID' : 'linked_cpt_ID';
5172 5172
 		}
5173 5173
 		// WPML
5174
-		$is_wpml = geodir_wpml_is_post_type_translated( $post_type );
5174
+		$is_wpml = geodir_wpml_is_post_type_translated($post_type);
5175 5175
 		if ($is_wpml) {
5176 5176
 			$csv_row[] = 'language';
5177 5177
 			$csv_row[] = 'original_post_id';
5178 5178
 		}
5179 5179
 		// WPML
5180 5180
 
5181
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5182
-		if ( !empty( $custom_fields ) ) {
5183
-			foreach ( $custom_fields as $custom_field ) {
5181
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5182
+		if (!empty($custom_fields)) {
5183
+			foreach ($custom_fields as $custom_field) {
5184 5184
 				$csv_row[] = $custom_field->htmlvar_name;
5185 5185
 			}
5186 5186
 		}
5187 5187
 
5188 5188
 		// Export franchise fields
5189
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5189
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5190 5190
 		if ($is_franchise_active) {
5191 5191
 			$csv_row[] = 'gd_is_franchise';
5192 5192
 			$csv_row[] = 'gd_franchise_lock';
@@ -5207,28 +5207,28 @@  discard block
 block discarded – undo
5207 5207
 		$csv_rows[] = $csv_row;
5208 5208
 
5209 5209
 		$images_count = 5;
5210
-        $xx=0;
5211
-		foreach ( $posts as $post ) {$xx++;
5210
+        $xx = 0;
5211
+		foreach ($posts as $post) {$xx++;
5212 5212
 			$post_id = $post['ID'];
5213 5213
 			
5214
-			$gd_post_info = geodir_get_post_info( $post_id );
5215
-			$post_info = (array)$gd_post_info;
5214
+			$gd_post_info = geodir_get_post_info($post_id);
5215
+			$post_info = (array) $gd_post_info;
5216 5216
 			
5217
-			$taxonomy_category = $post_type . 'category';
5218
-			$taxonomy_tags = $post_type . '_tags';
5217
+			$taxonomy_category = $post_type.'category';
5218
+			$taxonomy_tags = $post_type.'_tags';
5219 5219
 			
5220 5220
 			$post_category = '';
5221 5221
 			$default_category_id = $gd_post_info->default_category;
5222 5222
 			$default_category = '';
5223 5223
 			$post_tags = '';
5224
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
5224
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
5225 5225
 			
5226
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
5226
+			if (!empty($terms) && !is_wp_error($terms)) {
5227 5227
 				$post_category = array();
5228 5228
 				$post_tags = array();
5229 5229
 			
5230
-				foreach ( $terms as $term ) {
5231
-					if ( $term->taxonomy == $taxonomy_category ) {
5230
+				foreach ($terms as $term) {
5231
+					if ($term->taxonomy == $taxonomy_category) {
5232 5232
 						$post_category[] = $term->name;
5233 5233
 						
5234 5234
 						if ($default_category_id == $term->term_id) {
@@ -5236,7 +5236,7 @@  discard block
 block discarded – undo
5236 5236
 						}
5237 5237
 					}
5238 5238
 					
5239
-					if ( $term->taxonomy == $taxonomy_tags ) {
5239
+					if ($term->taxonomy == $taxonomy_tags) {
5240 5240
 						$post_tags[] = $term->name;
5241 5241
 					}
5242 5242
 				}
@@ -5244,47 +5244,47 @@  discard block
 block discarded – undo
5244 5244
 				if (empty($default_category) && !empty($post_category)) {
5245 5245
 					$default_category = $post_category[0]; // Set first one as default category.
5246 5246
 				}
5247
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
5248
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
5247
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
5248
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
5249 5249
 			}
5250 5250
 
5251 5251
 			// Franchise data
5252
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
5252
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
5253 5253
 				$franchise_id = $post_info['franchise'];
5254 5254
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
5255 5255
 
5256 5256
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
5257
-					$franchise_info = (array)$gd_franchise_info;
5257
+					$franchise_info = (array) $gd_franchise_info;
5258 5258
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
5259 5259
 					
5260 5260
 					if (!empty($locked_fields)) {
5261
-						foreach( $locked_fields as $locked_field) {
5261
+						foreach ($locked_fields as $locked_field) {
5262 5262
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
5263 5263
 								$post_info[$locked_field] = $franchise_info[$locked_field];
5264 5264
 							}
5265 5265
 							
5266 5266
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
5267
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
5267
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
5268 5268
 			
5269
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
5269
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
5270 5270
 									$franchise_post_category = array();
5271 5271
 									$franchise_post_tags = array();
5272 5272
 								
5273
-									foreach ( $franchise_terms as $franchise_term ) {
5274
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
5273
+									foreach ($franchise_terms as $franchise_term) {
5274
+										if ($franchise_term->taxonomy == $taxonomy_category) {
5275 5275
 											$franchise_post_category[] = $franchise_term->name;
5276 5276
 										}
5277 5277
 										
5278
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
5278
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
5279 5279
 											$franchise_post_tags[] = $franchise_term->name;
5280 5280
 										}
5281 5281
 									}
5282 5282
 									
5283 5283
 									if (in_array($taxonomy_category, $locked_fields)) {
5284
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
5284
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
5285 5285
 									}
5286 5286
 									if (in_array('post_tags', $locked_fields)) {
5287
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
5287
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
5288 5288
 									}
5289 5289
 								}
5290 5290
 							}
@@ -5293,18 +5293,18 @@  discard block
 block discarded – undo
5293 5293
 				}
5294 5294
 			}
5295 5295
 						
5296
-			$post_images = geodir_get_images( $post_id );
5296
+			$post_images = geodir_get_images($post_id);
5297 5297
 			$current_images = array();
5298
-			if ( !empty( $post_images ) ) {
5299
-				foreach ( $post_images as $post_image ) {
5300
-					$post_image = (array)$post_image;
5301
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
5302
-					if ( $image ) {
5298
+			if (!empty($post_images)) {
5299
+				foreach ($post_images as $post_image) {
5300
+					$post_image = (array) $post_image;
5301
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
5302
+					if ($image) {
5303 5303
 						$current_images[] = $image;
5304 5304
 					}
5305 5305
 				}
5306 5306
 				
5307
-				$images_count = max( $images_count, count( $current_images ) );
5307
+				$images_count = max($images_count, count($current_images));
5308 5308
 			}
5309 5309
 
5310 5310
 			$csv_row = array();
@@ -5316,7 +5316,7 @@  discard block
 block discarded – undo
5316 5316
 			$csv_row[] = $default_category; // default_category
5317 5317
 			$csv_row[] = $post_tags; // post_tags
5318 5318
 			$csv_row[] = $post_type; // post_type
5319
-			if ( $post_type == 'gd_event' ) {
5319
+			if ($post_type == 'gd_event') {
5320 5320
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
5321 5321
 				$csv_row[] = $event_data['event_date']; // event_date
5322 5322
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -5337,12 +5337,12 @@  discard block
 block discarded – undo
5337 5337
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
5338 5338
 			}
5339 5339
 			$csv_row[] = $post_info['post_status']; // post_status
5340
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5340
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5341 5341
             if ($is_claim_active) {
5342
-                $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5342
+                $csv_row[] = !empty($post_info['claimed']) && (int) $post_info['claimed'] == 1 ? 1 : ''; // claimed
5343 5343
             }
5344 5344
 			if ($is_payment_plugin) {
5345
-				$csv_row[] = (int)$post_info['package_id']; // package_id
5345
+				$csv_row[] = (int) $post_info['package_id']; // package_id
5346 5346
 				$csv_row[] = $post_info['alive_days'] !== '' ? absint($post_info['alive_days']) : ''; // alive_days
5347 5347
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
5348 5348
 			}
@@ -5378,18 +5378,18 @@  discard block
 block discarded – undo
5378 5378
 			$csv_row[] = stripslashes($post_info['geodir_video']); // geodir_video
5379 5379
 			$csv_row[] = stripslashes($post_info['geodir_special_offers']); // geodir_special_offers
5380 5380
 			if ($is_events_active || $is_custom_posts_active) {
5381
-				$csv_row[] = !empty($post_info['geodir_link_business']) ? (int)$post_info['geodir_link_business'] : ''; // linked business
5381
+				$csv_row[] = !empty($post_info['geodir_link_business']) ? (int) $post_info['geodir_link_business'] : ''; // linked business
5382 5382
 			}
5383 5383
 			// WPML
5384 5384
 			if ($is_wpml) {
5385
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
5386
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
5385
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type);
5386
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type);
5387 5387
 			}
5388 5388
 			// WPML
5389 5389
 			
5390
-			if ( !empty( $custom_fields ) ) {
5391
-				foreach ( $custom_fields as $custom_field ) {
5392
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
5390
+			if (!empty($custom_fields)) {
5391
+				foreach ($custom_fields as $custom_field) {
5392
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
5393 5393
 				}
5394 5394
 			}
5395 5395
 			
@@ -5400,15 +5400,15 @@  discard block
 block discarded – undo
5400 5400
 				$franchise = '';
5401 5401
 					
5402 5402
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
5403
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
5404
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
5403
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
5404
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
5405 5405
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
5406
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
5406
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
5407 5407
 				}
5408 5408
 				
5409
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
5409
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
5410 5410
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
5411
-				$csv_row[] = (int)$franchise; // franchise id
5411
+				$csv_row[] = (int) $franchise; // franchise id
5412 5412
 			}
5413 5413
             
5414 5414
             /**
@@ -5422,15 +5422,15 @@  discard block
 block discarded – undo
5422 5422
              */
5423 5423
             $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5424 5424
 			
5425
-			for ( $c = 0; $c < $images_count; $c++ ) {
5426
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
5425
+			for ($c = 0; $c < $images_count; $c++) {
5426
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
5427 5427
 			}
5428 5428
 			
5429 5429
 			$csv_rows[] = $csv_row;
5430 5430
 
5431 5431
 		}
5432 5432
 
5433
-		for ( $c = 0; $c < $images_count; $c++ ) {
5433
+		for ($c = 0; $c < $images_count; $c++) {
5434 5434
 			$csv_rows[0][] = 'IMAGE';
5435 5435
 		}
5436 5436
 	}
@@ -5452,30 +5452,30 @@  discard block
 block discarded – undo
5452 5452
  * @param int $page_no Page number. Default 0.
5453 5453
  * @return array Array of posts data.
5454 5454
  */
5455
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5455
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
5456 5456
     global $wpdb, $plugin_prefix;
5457 5457
 
5458
-    if ( ! post_type_exists( $post_type ) )
5458
+    if (!post_type_exists($post_type))
5459 5459
         return new stdClass;
5460 5460
         
5461
-    $table = $plugin_prefix . $post_type . '_detail';
5461
+    $table = $plugin_prefix.$post_type.'_detail';
5462 5462
 
5463 5463
     $limit = '';
5464
-    if ( $per_page > 0 && $page_no > 0 ) {
5465
-        $offset = ( $page_no - 1 ) * $per_page;
5464
+    if ($per_page > 0 && $page_no > 0) {
5465
+        $offset = ($page_no - 1) * $per_page;
5466 5466
         
5467
-        if ( $offset > 0 ) {
5468
-            $limit = " LIMIT " . $offset . "," . $per_page;
5467
+        if ($offset > 0) {
5468
+            $limit = " LIMIT ".$offset.",".$per_page;
5469 5469
         } else {
5470
-            $limit = " LIMIT " . $per_page;
5470
+            $limit = " LIMIT ".$per_page;
5471 5471
         }
5472 5472
     }
5473 5473
 
5474 5474
     // Skip listing with statuses trash, auto-draft etc...
5475 5475
     $skip_statuses = geodir_imex_export_skip_statuses();
5476 5476
     $where_statuses = '';
5477
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5478
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5477
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5478
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5479 5479
     }
5480 5480
     
5481 5481
     /**
@@ -5486,9 +5486,9 @@  discard block
 block discarded – undo
5486 5486
      *
5487 5487
      * @param string $where SQL where clause part.
5488 5488
      */
5489
-    $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5489
+    $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
5490 5490
 
5491
-    $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
5491
+    $query = $wpdb->prepare("SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." ORDER BY {$wpdb->posts}.ID ASC".$limit, $post_type);
5492 5492
     /**
5493 5493
      * Modify returned posts SQL query for the current post type.
5494 5494
      *
@@ -5498,8 +5498,8 @@  discard block
 block discarded – undo
5498 5498
      * @param int $query The SQL query.
5499 5499
      * @param string $post_type Post type.
5500 5500
      */
5501
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5502
-    $results = (array)$wpdb->get_results( $query, ARRAY_A );
5501
+    $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
5502
+    $results = (array) $wpdb->get_results($query, ARRAY_A);
5503 5503
 
5504 5504
     /**
5505 5505
      * Modify returned post results for the current post type.
@@ -5510,7 +5510,7 @@  discard block
 block discarded – undo
5510 5510
      * @param object $results An object containing all post ids.
5511 5511
      * @param string $post_type Post type.
5512 5512
      */
5513
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5513
+    return apply_filters('geodir_export_posts', $results, $post_type);
5514 5514
 }
5515 5515
 
5516 5516
 /**
@@ -5528,24 +5528,24 @@  discard block
 block discarded – undo
5528 5528
  * @param string $post_type Post type.
5529 5529
  * @return string The SQL query.
5530 5530
  */
5531
-function geodir_imex_get_events_query( $query, $post_type ) {
5532
-    if ( $post_type == 'gd_event' ) {
5531
+function geodir_imex_get_events_query($query, $post_type) {
5532
+    if ($post_type == 'gd_event') {
5533 5533
         global $wpdb, $plugin_prefix;
5534 5534
         
5535
-        $table = $plugin_prefix . $post_type . '_detail';
5535
+        $table = $plugin_prefix.$post_type.'_detail';
5536 5536
         $schedule_table = EVENT_SCHEDULE;
5537 5537
         
5538 5538
         // Skip listing with statuses trash, auto-draft etc...
5539 5539
         $skip_statuses = geodir_imex_export_skip_statuses();
5540 5540
         $where_statuses = '';
5541
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5542
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5541
+        if (!empty($skip_statuses) && is_array($skip_statuses)) {
5542
+            $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5543 5543
         }
5544 5544
         
5545 5545
         /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5546
-        $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5546
+        $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
5547 5547
 
5548
-        $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
5548
+        $query = $wpdb->prepare("SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type);
5549 5549
     }
5550 5550
 
5551 5551
     return $query;
@@ -5569,35 +5569,35 @@  discard block
 block discarded – undo
5569 5569
  * @param  string $post_type Post type.
5570 5570
  * @return int Total terms count.
5571 5571
  */
5572
-function geodir_get_terms_count( $post_type ) {
5573
-    $args = array( 'hide_empty' => 0 );
5572
+function geodir_get_terms_count($post_type) {
5573
+    $args = array('hide_empty' => 0);
5574 5574
 
5575
-    remove_all_filters( 'get_terms' );
5575
+    remove_all_filters('get_terms');
5576 5576
 
5577
-    $taxonomy = $post_type . 'category';
5577
+    $taxonomy = $post_type.'category';
5578 5578
 
5579 5579
     // WPML
5580 5580
     $is_wpml = geodir_is_wpml();
5581 5581
     $active_lang = 'all';
5582
-    if ( $is_wpml ) {
5582
+    if ($is_wpml) {
5583 5583
         global $sitepress;
5584 5584
         $active_lang = $sitepress->get_current_language();
5585 5585
         
5586
-        if ( $active_lang != 'all' ) {
5587
-            $sitepress->switch_lang( 'all', true );
5586
+        if ($active_lang != 'all') {
5587
+            $sitepress->switch_lang('all', true);
5588 5588
         }
5589 5589
     }
5590 5590
     // WPML
5591 5591
             
5592
-    $count_terms = wp_count_terms( $taxonomy, $args );
5592
+    $count_terms = wp_count_terms($taxonomy, $args);
5593 5593
 
5594 5594
     // WPML
5595
-    if ( $is_wpml && $active_lang !== 'all' ) {
5595
+    if ($is_wpml && $active_lang !== 'all') {
5596 5596
         global $sitepress;
5597
-        $sitepress->switch_lang( $active_lang, true );
5597
+        $sitepress->switch_lang($active_lang, true);
5598 5598
     }
5599 5599
     // WPML
5600
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5600
+    $count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
5601 5601
      
5602 5602
     return $count_terms;
5603 5603
 }
@@ -5614,23 +5614,23 @@  discard block
 block discarded – undo
5614 5614
  * @param int $page_no Page number. Default 0.
5615 5615
  * @return array Array of terms data.
5616 5616
  */
5617
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
5618
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
5617
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
5618
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
5619 5619
 	
5620
-	remove_all_filters( 'get_terms' );
5620
+	remove_all_filters('get_terms');
5621 5621
 	
5622
-	$taxonomy = $post_type . 'category';
5622
+	$taxonomy = $post_type.'category';
5623 5623
 	
5624
-	if ( $per_page > 0 && $page_no > 0 ) {
5625
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
5624
+	if ($per_page > 0 && $page_no > 0) {
5625
+		$args['offset'] = ($page_no - 1) * $per_page;
5626 5626
 		$args['number'] = $per_page;
5627 5627
 	}
5628 5628
 	
5629
-	$terms = get_terms( $taxonomy, $args );
5629
+	$terms = get_terms($taxonomy, $args);
5630 5630
 
5631 5631
 	$csv_rows = array();
5632 5632
 	
5633
-	if ( !empty( $terms ) ) {
5633
+	if (!empty($terms)) {
5634 5634
 		$csv_row = array();
5635 5635
 		$csv_row[] = 'cat_id';
5636 5636
 		$csv_row[] = 'cat_name';
@@ -5639,7 +5639,7 @@  discard block
 block discarded – undo
5639 5639
 		$csv_row[] = 'cat_parent';
5640 5640
 		$csv_row[] = 'cat_schema';
5641 5641
         // WPML
5642
-		$is_wpml = geodir_wpml_is_taxonomy_translated( $taxonomy );
5642
+		$is_wpml = geodir_wpml_is_taxonomy_translated($taxonomy);
5643 5643
 		if ($is_wpml) {
5644 5644
 			$csv_row[] = 'cat_language';
5645 5645
             $csv_row[] = 'cat_id_original';
@@ -5652,16 +5652,16 @@  discard block
 block discarded – undo
5652 5652
 		
5653 5653
 		$csv_rows[] = $csv_row;
5654 5654
 		
5655
-		foreach ( $terms as $term ) {
5656
-			$cat_icon = geodir_get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
5657
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5655
+		foreach ($terms as $term) {
5656
+			$cat_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
5657
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5658 5658
 			
5659
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
5660
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
5659
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
5660
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
5661 5661
 			
5662 5662
 			$cat_parent = '';
5663
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
5664
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
5663
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
5664
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
5665 5665
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
5666 5666
 			}
5667 5667
 			
@@ -5671,15 +5671,15 @@  discard block
 block discarded – undo
5671 5671
 			$csv_row[] = $term->slug;
5672 5672
 			$csv_row[] = $post_type;
5673 5673
 			$csv_row[] = $cat_parent;
5674
-			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5674
+			$csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
5675 5675
             // WPML
5676 5676
 			if ($is_wpml) {
5677
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5678
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5677
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy);
5678
+                $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy);
5679 5679
 			}
5680 5680
 			// WPML
5681 5681
 			$csv_row[] = $term->description;
5682
-			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
5682
+			$csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
5683 5683
 			$csv_row[] = $cat_image;
5684 5684
 			$csv_row[] = $cat_icon;
5685 5685
 			
@@ -5698,10 +5698,10 @@  discard block
 block discarded – undo
5698 5698
  * @param  bool $relative True for relative path & False for absolute path.
5699 5699
  * @return string Path to the cache directory.
5700 5700
  */
5701
-function geodir_path_import_export( $relative = true ) {
5701
+function geodir_path_import_export($relative = true) {
5702 5702
 	$upload_dir = wp_upload_dir();
5703 5703
 	
5704
-	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
5704
+	return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache';
5705 5705
 }
5706 5706
 
5707 5707
 /**
@@ -5717,8 +5717,8 @@  discard block
 block discarded – undo
5717 5717
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
5718 5718
  * @return bool true if success otherwise false.
5719 5719
  */
5720
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
5721
-	if ( empty( $csv_data ) ) {
5720
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
5721
+	if (empty($csv_data)) {
5722 5722
 		return false;
5723 5723
 	}
5724 5724
 	
@@ -5726,17 +5726,17 @@  discard block
 block discarded – undo
5726 5726
 	
5727 5727
 	$mode = $clear ? 'w+' : 'a+';
5728 5728
 	
5729
-	if ( function_exists( 'fputcsv' ) ) {
5730
-		$file = fopen( $file_path, $mode );
5731
-		foreach( $csv_data as $csv_row ) {
5729
+	if (function_exists('fputcsv')) {
5730
+		$file = fopen($file_path, $mode);
5731
+		foreach ($csv_data as $csv_row) {
5732 5732
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5733
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
5733
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
5734 5734
 		}
5735
-		fclose( $file );
5735
+		fclose($file);
5736 5736
 	} else {
5737
-		foreach( $csv_data as $csv_row ) {
5737
+		foreach ($csv_data as $csv_row) {
5738 5738
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5739
-			$wp_filesystem->put_contents( $file_path, $csv_row );
5739
+			$wp_filesystem->put_contents($file_path, $csv_row);
5740 5740
 		}
5741 5741
 	}
5742 5742
 		
@@ -5754,14 +5754,14 @@  discard block
 block discarded – undo
5754 5754
  * @param  string $file Full path to file.
5755 5755
  * @return int No of file rows.
5756 5756
  */
5757
-function geodir_import_export_line_count( $file ) {
5757
+function geodir_import_export_line_count($file) {
5758 5758
 	global $wp_filesystem;
5759 5759
 	
5760
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
5761
-		$contents = $wp_filesystem->get_contents_array( $file );
5760
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
5761
+		$contents = $wp_filesystem->get_contents_array($file);
5762 5762
 		
5763
-		if ( !empty( $contents ) && is_array( $contents ) ) {
5764
-			return count( $contents ) - 1;
5763
+		if (!empty($contents) && is_array($contents)) {
5764
+			return count($contents) - 1;
5765 5765
 		}
5766 5766
 	}
5767 5767
 	
@@ -5778,11 +5778,11 @@  discard block
 block discarded – undo
5778 5778
  * @param string $post_type The post type.
5779 5779
  * @return object Queried object.
5780 5780
  */
5781
-function geodir_imex_get_custom_fields( $post_type ) {
5781
+function geodir_imex_get_custom_fields($post_type) {
5782 5782
 	global $wpdb;
5783 5783
 	 
5784
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
5785
-	$rows = $wpdb->get_results( $sql );
5784
+	$sql = $wpdb->prepare("SELECT htmlvar_name FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array($post_type));
5785
+	$rows = $wpdb->get_results($sql);
5786 5786
 	 
5787 5787
 	return $rows;
5788 5788
 }
@@ -5798,10 +5798,10 @@  discard block
 block discarded – undo
5798 5798
  * @return array Event data array.
5799 5799
  */
5800 5800
 function geodir_imex_get_event_data($post, $gd_post_info) {
5801
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
5801
+	$event_date = isset($post['event_date']) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($post['event_date'])) : '';
5802 5802
 	$event_enddate = $event_date;
5803
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
5804
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
5803
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
5804
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
5805 5805
 	
5806 5806
 	$is_recurring_event = '';
5807 5807
 	$event_duration_days = '';
@@ -5818,15 +5818,15 @@  discard block
 block discarded – undo
5818 5818
 		
5819 5819
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
5820 5820
 	if (!empty($recurring_data)) {
5821
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
5822
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
5823
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
5824
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
5821
+		$event_date = isset($recurring_data['event_start']) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_start'])) : $event_date;
5822
+		$event_enddate = isset($recurring_data['event_end']) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_end'])) : $event_date;
5823
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
5824
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
5825 5825
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
5826 5826
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
5827 5827
 	
5828
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
5829
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
5828
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
5829
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
5830 5830
 			
5831 5831
 		if ($recurring_pkg && $is_recurring) {
5832 5832
 			$recurring_dates = $event_date;
@@ -5836,13 +5836,13 @@  discard block
 block discarded – undo
5836 5836
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
5837 5837
 			
5838 5838
 			if (!empty($recurring_data['event_recurring_dates'])) {
5839
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
5839
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
5840 5840
 				
5841 5841
 				if (!empty($event_recurring_dates)) {
5842 5842
 					$recurring_dates = array();
5843 5843
 					
5844 5844
 					foreach ($event_recurring_dates as $date) {
5845
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
5845
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
5846 5846
 					}
5847 5847
 					
5848 5848
 					$recurring_dates = implode(",", $recurring_dates);
@@ -5858,7 +5858,7 @@  discard block
 block discarded – undo
5858 5858
 						$times = array();
5859 5859
 						
5860 5860
 						foreach ($recurring_data['starttimes'] as $time) {
5861
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
5861
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
5862 5862
 						}
5863 5863
 						
5864 5864
 						$event_starttimes = implode(",", $times);
@@ -5868,7 +5868,7 @@  discard block
 block discarded – undo
5868 5868
 						$times = array();
5869 5869
 						
5870 5870
 						foreach ($recurring_data['endtimes'] as $time) {
5871
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
5871
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
5872 5872
 						}
5873 5873
 						
5874 5874
 						$event_endtimes = implode(",", $times);
@@ -5880,8 +5880,8 @@  discard block
 block discarded – undo
5880 5880
 					}
5881 5881
 				}
5882 5882
 			} else {
5883
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
5884
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
5883
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
5884
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
5885 5885
 				
5886 5886
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
5887 5887
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -5897,11 +5897,11 @@  discard block
 block discarded – undo
5897 5897
 				}
5898 5898
 				
5899 5899
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
5900
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
5901
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
5900
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
5901
+					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
5902 5902
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
5903 5903
 				} else {
5904
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
5904
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
5905 5905
 				}
5906 5906
 			}
5907 5907
 		}
@@ -5965,9 +5965,9 @@  discard block
 block discarded – undo
5965 5965
  * @return array Event data array.
5966 5966
  */
5967 5967
 function geodir_imex_process_event_data($gd_post) {
5968
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
5968
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
5969 5969
 
5970
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
5970
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
5971 5971
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_date($gd_post['event_date'], 'Y-m-d') : '';
5972 5972
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_date($gd_post['event_enddate'], 'Y-m-d') : $event_date;
5973 5973
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -6014,17 +6014,17 @@  discard block
 block discarded – undo
6014 6014
 				$event_recurring_dates = implode(",", $event_recurring_dates);
6015 6015
 			}
6016 6016
 		} else {
6017
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6018
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6019
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6020
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : '';
6017
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6018
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6019
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6020
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : '';
6021 6021
 			
6022 6022
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6023 6023
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6024 6024
 			
6025 6025
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6026 6026
 			
6027
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6027
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6028 6028
 			$repeat_days = array();
6029 6029
 			if (!empty($a_repeat_days)) {
6030 6030
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6042,7 +6042,7 @@  discard block
 block discarded – undo
6042 6042
 			$repeat_weeks = array();
6043 6043
 			if (!empty($a_repeat_weeks)) {
6044 6044
 				foreach ($a_repeat_weeks as $repeat_week) {
6045
-					$repeat_weeks[] = (int)$repeat_week;
6045
+					$repeat_weeks[] = (int) $repeat_week;
6046 6046
 				}
6047 6047
 				
6048 6048
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -6106,7 +6106,7 @@  discard block
 block discarded – undo
6106 6106
 
6107 6107
     $page_found = $wpdb->get_var(
6108 6108
         $wpdb->prepare(
6109
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6109
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
6110 6110
             array($slug)
6111 6111
         )
6112 6112
     );
@@ -6161,7 +6161,7 @@  discard block
 block discarded – undo
6161 6161
  */
6162 6162
 function geodir_admin_upgrade_notice() {
6163 6163
     $class = "error";
6164
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6164
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
6165 6165
     echo"<div class=\"$class\"> <p>$message</p></div>";
6166 6166
 }
6167 6167
 
@@ -6173,7 +6173,7 @@  discard block
 block discarded – undo
6173 6173
  * @param (object) $r
6174 6174
  * @return (string) $output
6175 6175
  */
6176
-function geodire_admin_upgrade_notice( $plugin_data, $r )
6176
+function geodire_admin_upgrade_notice($plugin_data, $r)
6177 6177
 {
6178 6178
     // readme contents
6179 6179
     $args = array(
@@ -6181,7 +6181,7 @@  discard block
 block discarded – undo
6181 6181
         'redirection' => 5
6182 6182
     );
6183 6183
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6184
-    $data       = wp_remote_get( $url, $args );
6184
+    $data = wp_remote_get($url, $args);
6185 6185
 
6186 6186
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
6187 6187
 
@@ -6196,20 +6196,20 @@  discard block
 block discarded – undo
6196 6196
 function geodir_in_plugin_update_message($content) {
6197 6197
     // Output Upgrade Notice
6198 6198
     $matches        = null;
6199
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6199
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis';
6200 6200
     $upgrade_notice = '';
6201
-    if ( preg_match( $regexp, $content, $matches ) ) {
6202
-        if(empty($matches)){return;}
6201
+    if (preg_match($regexp, $content, $matches)) {
6202
+        if (empty($matches)) {return; }
6203 6203
 
6204
-        $version = trim( $matches[1] );
6205
-        if($version && $version>GEODIRECTORY_VERSION){
6204
+        $version = trim($matches[1]);
6205
+        if ($version && $version > GEODIRECTORY_VERSION) {
6206 6206
 
6207 6207
 
6208
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6209
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6208
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
6209
+        if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
6210 6210
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6211
-            foreach ( $notices as $index => $line ) {
6212
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6211
+            foreach ($notices as $index => $line) {
6212
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
6213 6213
             }
6214 6214
             $upgrade_notice .= '</div> ';
6215 6215
         }
@@ -6233,7 +6233,7 @@  discard block
 block discarded – undo
6233 6233
 		$default_language = $sitepress->get_default_language();
6234 6234
 		if ($current_language != 'all' && $current_language != $default_language) {
6235 6235
 	?>
6236
-	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
6236
+	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?></strong></p></div>
6237 6237
 	<?php
6238 6238
 		}
6239 6239
 	}
@@ -6248,7 +6248,7 @@  discard block
 block discarded – undo
6248 6248
  * @param array Listing statuses to be skipped.
6249 6249
  */
6250 6250
 function geodir_imex_export_skip_statuses() {
6251
-    $statuses = array( 'trash', 'auto-draft' );
6251
+    $statuses = array('trash', 'auto-draft');
6252 6252
     
6253 6253
     /**
6254 6254
      * Filter the statuses to skip during GD export listings.
@@ -6258,7 +6258,7 @@  discard block
 block discarded – undo
6258 6258
      *
6259 6259
      * @param array $statuses Listing statuses to be skipped.
6260 6260
      */
6261
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6261
+    $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
6262 6262
      
6263 6263
     return $statuses;
6264 6264
 }
@@ -6329,16 +6329,16 @@  discard block
 block discarded – undo
6329 6329
 function geodir_imex_get_filter_where($where = '', $post_type = '') {
6330 6330
     global $wpdb;
6331 6331
     
6332
-    $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6332
+    $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
6333 6333
     
6334
-    if ( !empty( $filters ) ) {
6335
-        foreach ( $filters as $field => $value ) {
6334
+    if (!empty($filters)) {
6335
+        foreach ($filters as $field => $value) {
6336 6336
             switch ($field) {
6337 6337
                 case 'start_date':
6338
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6338
+                    $where .= " AND `".$wpdb->posts."`.`post_date` >= '".sanitize_text_field($value)." 00:00:00'";
6339 6339
                 break;
6340 6340
                 case 'end_date':
6341
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6341
+                    $where .= " AND `".$wpdb->posts."`.`post_date` <= '".sanitize_text_field($value)." 23:59:59'";
6342 6342
                 break;
6343 6343
             }
6344 6344
         }
@@ -6350,25 +6350,25 @@  discard block
 block discarded – undo
6350 6350
 add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
6351 6351
 
6352 6352
 
6353
-function geodir_fix_for_primer_theme(){
6354
-    if(!defined( 'PRIMER_VERSION' )){return;}
6353
+function geodir_fix_for_primer_theme() {
6354
+    if (!defined('PRIMER_VERSION')) {return; }
6355 6355
     global $pagenow;
6356 6356
 
6357
-    if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6357
+    if (('post.php' === $pagenow || 'post-new.php' === $pagenow) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']))) {
6358 6358
 
6359
-        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6359
+        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type($_GET['post']);
6360 6360
 
6361 6361
         $post_types = geodir_get_posttypes();
6362
-        if ($post_type && in_array($post_type, $post_types) ) {
6362
+        if ($post_type && in_array($post_type, $post_types)) {
6363 6363
             global $primer_customizer_layouts;
6364
-            remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6364
+            remove_action('add_meta_boxes', array($primer_customizer_layouts, 'add_meta_box'), 10);
6365 6365
         }
6366 6366
     }
6367 6367
 
6368 6368
 }
6369 6369
 
6370
-if(is_admin()){
6371
-    add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6370
+if (is_admin()) {
6371
+    add_action('add_meta_boxes', 'geodir_fix_for_primer_theme', 0);  
6372 6372
 }
6373 6373
 
6374 6374
 
@@ -6501,32 +6501,32 @@  discard block
 block discarded – undo
6501 6501
 
6502 6502
 function geodir_ga_activation_url() {
6503 6503
 
6504
-    return add_query_arg( array(
6504
+    return add_query_arg(array(
6505 6505
         'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6506 6506
         'scope'         => GEODIR_GA_SCOPE,
6507 6507
         'response_type' => 'code',
6508 6508
         'redirect_uri'  => GEODIR_GA_REDIRECT,
6509 6509
         'client_id'     => GEODIR_GA_CLIENTID,
6510
-    ), 'https://accounts.google.com/o/oauth2/auth' );
6510
+    ), 'https://accounts.google.com/o/oauth2/auth');
6511 6511
 
6512 6512
     return $url;
6513 6513
 }
6514 6514
 
6515
-function geodir_gd_accounts(){
6515
+function geodir_gd_accounts() {
6516 6516
     $accounts = array();
6517
-    $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6518
-    if($useAuth){
6517
+    $useAuth = (get_option('geodir_ga_auth_code') == '' ? false : true);
6518
+    if ($useAuth) {
6519 6519
         try {
6520 6520
             $accounts = geodir_ga_get_analytics_accounts();
6521 6521
         } catch (Exception $e) {
6522
-            geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6522
+            geodir_error_log(wp_sprintf(__('GD Google Analytics API Error(%s) : %s', 'geodirectory'), $e->getCode(), $e->getMessage()));
6523 6523
         }
6524 6524
         
6525
-        if(is_array($accounts)){
6526
-            $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6527
-        }elseif(get_option('geodir_ga_account_id')){
6525
+        if (is_array($accounts)) {
6526
+            $accounts = array_merge(array(__('Select Account', 'geodirectory')), $accounts);
6527
+        }elseif (get_option('geodir_ga_account_id')) {
6528 6528
             $accounts = array();
6529
-            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6529
+            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required', 'geodirectory').' ('.get_option('geodir_ga_account_id').')';
6530 6530
         }
6531 6531
     }
6532 6532
     return $accounts;
@@ -6537,21 +6537,21 @@  discard block
 block discarded – undo
6537 6537
     global $gd_ga_errors;
6538 6538
     $accounts = array();
6539 6539
 
6540
-    if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6540
+    if (get_option('geodir_ga_auth_token') === false) {update_option('geodir_ga_auth_token', ''); }
6541 6541
 
6542 6542
 
6543
-    if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6543
+    if (get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])) {
6544 6544
       return get_option('geodir_gd_uids');
6545 6545
     }
6546 6546
 
6547 6547
     # Create a new Gdata call
6548
-    if ( trim(get_option('geodir_ga_auth_code')) != '' )
6548
+    if (trim(get_option('geodir_ga_auth_code')) != '')
6549 6549
         $stats = new GDGoogleAnalyticsStats();
6550 6550
     else
6551 6551
         return false;
6552 6552
 
6553 6553
     # Check if Google sucessfully logged in
6554
-    if ( ! $stats->checkLogin() )
6554
+    if (!$stats->checkLogin())
6555 6555
         return false;
6556 6556
 
6557 6557
     # Get a list of accounts
@@ -6563,28 +6563,28 @@  discard block
 block discarded – undo
6563 6563
     }
6564 6564
 
6565 6565
 
6566
-    natcasesort ($accounts);
6566
+    natcasesort($accounts);
6567 6567
 
6568 6568
     # Return the account array if there are accounts
6569
-    if ( count($accounts) > 0 ){
6570
-        update_option('geodir_gd_uids',$accounts);
6569
+    if (count($accounts) > 0) {
6570
+        update_option('geodir_gd_uids', $accounts);
6571 6571
         return $accounts;
6572 6572
     }
6573 6573
     else
6574 6574
         return false;
6575 6575
 }
6576 6576
 
6577
-add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' );
6578
-function geodir_ga_deauthorize(){
6577
+add_action('wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize');
6578
+function geodir_ga_deauthorize() {
6579 6579
 
6580
-    if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6580
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'gd_ga_deauthorize')) {
6581 6581
 
6582
-        die( 'Security check' );
6582
+        die('Security check');
6583 6583
 
6584 6584
     } else {
6585
-        update_option('geodir_ga_auth_token','');
6586
-        update_option('geodir_ga_auth_code','');
6587
-        update_option('geodir_gd_uids','');
6585
+        update_option('geodir_ga_auth_token', '');
6586
+        update_option('geodir_ga_auth_code', '');
6587
+        update_option('geodir_gd_uids', '');
6588 6588
 
6589 6589
 
6590 6590
         echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
@@ -6617,22 +6617,22 @@  discard block
 block discarded – undo
6617 6617
  * @since 1.6.21
6618 6618
  * @return array
6619 6619
  */
6620
-function geodir_listing_image_size_arr(){
6620
+function geodir_listing_image_size_arr() {
6621 6621
 
6622 6622
     global $_wp_additional_image_sizes;
6623 6623
 
6624 6624
     $sizes = array();
6625 6625
 
6626
-    foreach ( get_intermediate_image_sizes() as $_size ) {
6627
-        if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
6628
-            $sizes[ $_size ]['width']  = get_option( "{$_size}_size_w" );
6629
-            $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
6630
-            $sizes[ $_size ]['crop']   = (bool) get_option( "{$_size}_crop" );
6631
-        } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
6632
-            $sizes[ $_size ] = array(
6633
-                'width'  => $_wp_additional_image_sizes[ $_size ]['width'],
6634
-                'height' => $_wp_additional_image_sizes[ $_size ]['height'],
6635
-                'crop'   => $_wp_additional_image_sizes[ $_size ]['crop'],
6626
+    foreach (get_intermediate_image_sizes() as $_size) {
6627
+        if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
6628
+            $sizes[$_size]['width']  = get_option("{$_size}_size_w");
6629
+            $sizes[$_size]['height'] = get_option("{$_size}_size_h");
6630
+            $sizes[$_size]['crop']   = (bool) get_option("{$_size}_crop");
6631
+        } elseif (isset($_wp_additional_image_sizes[$_size])) {
6632
+            $sizes[$_size] = array(
6633
+                'width'  => $_wp_additional_image_sizes[$_size]['width'],
6634
+                'height' => $_wp_additional_image_sizes[$_size]['height'],
6635
+                'crop'   => $_wp_additional_image_sizes[$_size]['crop'],
6636 6636
             );
6637 6637
         }
6638 6638
     }
@@ -6643,9 +6643,9 @@  discard block
 block discarded – undo
6643 6643
 
6644 6644
     $options['default'] = __('GD Default', 'geodirectory');
6645 6645
 
6646
-    if(!empty($sizes)){
6647
-        foreach($sizes as $key=>$val){
6648
-            $options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )';
6646
+    if (!empty($sizes)) {
6647
+        foreach ($sizes as $key=>$val) {
6648
+            $options[$key] = $key.' ( '.$val['width'].' x '.$val['height'].' )';
6649 6649
         }
6650 6650
     }
6651 6651
 
Please login to merge, or discard this patch.
geodirectory_template_tags.php 2 patches
Indentation   +343 added lines, -343 removed lines patch added patch discarded remove patch
@@ -36,177 +36,177 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function geodir_templates_scripts()
38 38
 {
39
-    $is_detail_page = false;
40
-    $geodir_map_name = geodir_map_name();
39
+	$is_detail_page = false;
40
+	$geodir_map_name = geodir_map_name();
41 41
 
42
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
43
-        $is_detail_page = true;
44
-    }
42
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
43
+		$is_detail_page = true;
44
+	}
45 45
 
46
-    wp_enqueue_script('jquery');
46
+	wp_enqueue_script('jquery');
47 47
 
48
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
49
-    wp_enqueue_script('geodirectory-script');
48
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
49
+	wp_enqueue_script('geodirectory-script');
50 50
 
51
-    $geodir_vars_data = array(
52
-        'siteurl' => get_option('siteurl'),
53
-        'geodir_plugin_url' => geodir_plugin_url(),
54
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
55
-        'geodir_ajax_url' => geodir_get_ajax_url(),
56
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
57
-        'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue
51
+	$geodir_vars_data = array(
52
+		'siteurl' => get_option('siteurl'),
53
+		'geodir_plugin_url' => geodir_plugin_url(),
54
+		'geodir_lazy_load' => get_option('geodir_lazy_load',1),
55
+		'geodir_ajax_url' => geodir_get_ajax_url(),
56
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
57
+		'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue
58 58
 		'lightBox_txtImage' => addslashes(__('Image', 'geodirectory')),
59 59
 		'lightBox_txtOf' => addslashes(__('of', 'geodirectory')),
60
-    );
61
-
62
-    /**
63
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
64
-     *
65
-     * This is used by addons to add JS translatable variables.
66
-     *
67
-     * @since 1.4.4
68
-     * @param array $geodir_vars_data {
69
-     *    geodir var data used by addons to add JS translatable variables.
70
-     *
71
-     *    @type string $siteurl Site url.
72
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
73
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
74
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
75
-     *    @type int $is_rtl Checks if current locale is RTL.
76
-     *
77
-     * }
78
-     */
79
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
80
-
81
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
82
-
83
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
84
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
85
-
86
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
87
-    wp_enqueue_script('geodirectory-lightbox-jquery');
88
-
89
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
90
-    if ($is_detail_page) {
91
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
92
-    }
60
+	);
61
+
62
+	/**
63
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
64
+	 *
65
+	 * This is used by addons to add JS translatable variables.
66
+	 *
67
+	 * @since 1.4.4
68
+	 * @param array $geodir_vars_data {
69
+	 *    geodir var data used by addons to add JS translatable variables.
70
+	 *
71
+	 *    @type string $siteurl Site url.
72
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
73
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
74
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
75
+	 *    @type int $is_rtl Checks if current locale is RTL.
76
+	 *
77
+	 * }
78
+	 */
79
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
80
+
81
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
82
+
83
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
84
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
85
+
86
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
87
+	wp_enqueue_script('geodirectory-lightbox-jquery');
88
+
89
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
90
+	if ($is_detail_page) {
91
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
92
+	}
93 93
 
94
-    if (in_array($geodir_map_name, array('auto', 'google'))) {
95
-        $map_lang = "&language=" . geodir_get_map_default_language();
96
-        $map_key = "&key=" . geodir_get_map_api_key();
97
-        /**
98
-         * Filter the variables that are added to the end of the google maps script call.
99
-         *
100
-         * This i used to change things like google maps language etc.
101
-         *
102
-         * @since 1.0.0
103
-         * @param string $var The string to filter, default is empty string.
104
-         */
105
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
106
-        wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
94
+	if (in_array($geodir_map_name, array('auto', 'google'))) {
95
+		$map_lang = "&language=" . geodir_get_map_default_language();
96
+		$map_key = "&key=" . geodir_get_map_api_key();
97
+		/**
98
+		 * Filter the variables that are added to the end of the google maps script call.
99
+		 *
100
+		 * This i used to change things like google maps language etc.
101
+		 *
102
+		 * @since 1.0.0
103
+		 * @param string $var The string to filter, default is empty string.
104
+		 */
105
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
106
+		wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
107 107
         
108
-        // Overlapping Marker Spiderfier
109
-        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
110
-        wp_enqueue_script('geodirectory-g-overlappingmarker-script');
111
-    }
108
+		// Overlapping Marker Spiderfier
109
+		wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
110
+		wp_enqueue_script('geodirectory-g-overlappingmarker-script');
111
+	}
112 112
     
113
-    if ($geodir_map_name == 'osm') {
114
-        // Leaflet OpenStreetMap
115
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
116
-        wp_enqueue_style('geodirectory-leaflet-style');
113
+	if ($geodir_map_name == 'osm') {
114
+		// Leaflet OpenStreetMap
115
+		wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
116
+		wp_enqueue_style('geodirectory-leaflet-style');
117 117
             
118
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
119
-        wp_enqueue_script('geodirectory-leaflet-script');
118
+		wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
119
+		wp_enqueue_script('geodirectory-leaflet-script');
120 120
         
121
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
122
-        wp_enqueue_script('geodirectory-leaflet-geo-script');
121
+		wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
122
+		wp_enqueue_script('geodirectory-leaflet-geo-script');
123 123
         
124
-        if ($is_detail_page) {
125
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
126
-            wp_enqueue_style('geodirectory-leaflet-routing-style');
124
+		if ($is_detail_page) {
125
+			wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
126
+			wp_enqueue_style('geodirectory-leaflet-routing-style');
127 127
                 
128
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
129
-            wp_enqueue_script('geodirectory-leaflet-routing-script');
130
-        }
128
+			wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
129
+			wp_enqueue_script('geodirectory-leaflet-routing-script');
130
+		}
131 131
         
132
-        // Overlapping Marker Spiderfier Leaflet
133
-        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
134
-        wp_enqueue_script('geodirectory-o-overlappingmarker-script');
135
-    }
136
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
132
+		// Overlapping Marker Spiderfier Leaflet
133
+		wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
134
+		wp_enqueue_script('geodirectory-o-overlappingmarker-script');
135
+	}
136
+	wp_enqueue_script( 'jquery-ui-autocomplete' );
137 137
     
138
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
139
-    wp_enqueue_script('geodirectory-goMap-script');
140
-
141
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
142
-    wp_enqueue_script('chosen');
143
-
144
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
145
-    wp_enqueue_script('geodirectory-choose-ajax');
146
-
147
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
148
-
149
-    if (is_page() && geodir_is_page('add-listing')) {
150
-        // SCRIPT FOR UPLOAD
151
-        wp_enqueue_script('plupload-all');
152
-        wp_enqueue_script('jquery-ui-sortable');
153
-
154
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
155
-        wp_enqueue_script('geodirectory-plupload-script');
156
-        // SCRIPT FOR UPLOAD END
157
-
158
-        // 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
159
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
160
-            $ajax_url = admin_url('admin-ajax.php');
161
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
162
-            $ajax_url = admin_url('admin-ajax.php');
163
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
164
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
165
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
166
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
167
-        } else {
168
-            $ajax_url = admin_url('admin-ajax.php');
169
-        }
138
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
139
+	wp_enqueue_script('geodirectory-goMap-script');
140
+
141
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
142
+	wp_enqueue_script('chosen');
143
+
144
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
145
+	wp_enqueue_script('geodirectory-choose-ajax');
146
+
147
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
148
+
149
+	if (is_page() && geodir_is_page('add-listing')) {
150
+		// SCRIPT FOR UPLOAD
151
+		wp_enqueue_script('plupload-all');
152
+		wp_enqueue_script('jquery-ui-sortable');
153
+
154
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
155
+		wp_enqueue_script('geodirectory-plupload-script');
156
+		// SCRIPT FOR UPLOAD END
157
+
158
+		// 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
159
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
160
+			$ajax_url = admin_url('admin-ajax.php');
161
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
162
+			$ajax_url = admin_url('admin-ajax.php');
163
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
164
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
165
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
166
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
167
+		} else {
168
+			$ajax_url = admin_url('admin-ajax.php');
169
+		}
170 170
 
171
-        // place js config array for plupload
172
-        $plupload_init = array(
173
-            'runtimes' => 'html5,silverlight,browserplus,gears,html4',
174
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
175
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
176
-            'drop_element' => 'dropbox', // will be adjusted per uploader
177
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
178
-            'multiple_queues' => true,
179
-            'max_file_size' => geodir_max_upload_size(),
180
-            'url' => $ajax_url,
181
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
182
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
183
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
184
-            'multipart' => true,
185
-            'urlstream_upload' => true,
186
-            'multi_selection' => false, // will be added per uploader
187
-            // additional post data to send to our ajax hook
188
-            'multipart_params' => array(
189
-                '_ajax_nonce' => "", // will be added per uploader
190
-                'action' => 'plupload_action', // the ajax action name
191
-                'imgid' => 0 // will be added per uploader
192
-            )
193
-        );
194
-        $base_plupload_config = json_encode($plupload_init);
195
-
196
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
197
-            'upload_img_size' => geodir_max_upload_size());
198
-
199
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
200
-
201
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
202
-    } // End if for add place page
203
-
204
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
205
-    if ($is_detail_page) {
171
+		// place js config array for plupload
172
+		$plupload_init = array(
173
+			'runtimes' => 'html5,silverlight,browserplus,gears,html4',
174
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
175
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
176
+			'drop_element' => 'dropbox', // will be adjusted per uploader
177
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
178
+			'multiple_queues' => true,
179
+			'max_file_size' => geodir_max_upload_size(),
180
+			'url' => $ajax_url,
181
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
182
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
183
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
184
+			'multipart' => true,
185
+			'urlstream_upload' => true,
186
+			'multi_selection' => false, // will be added per uploader
187
+			// additional post data to send to our ajax hook
188
+			'multipart_params' => array(
189
+				'_ajax_nonce' => "", // will be added per uploader
190
+				'action' => 'plupload_action', // the ajax action name
191
+				'imgid' => 0 // will be added per uploader
192
+			)
193
+		);
194
+		$base_plupload_config = json_encode($plupload_init);
195
+
196
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
197
+			'upload_img_size' => geodir_max_upload_size());
198
+
199
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
200
+
201
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
202
+	} // End if for add place page
203
+
204
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
205
+	if ($is_detail_page) {
206 206
 		wp_enqueue_script('geodirectory-post-custom-js');
207 207
 	}
208 208
 
209
-    // font awesome rating script
209
+	// font awesome rating script
210 210
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
211 211
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
212 212
 		wp_enqueue_script('geodir-barrating-js');
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 		wp_enqueue_script('geodir-jRating-js');
216 216
 	}
217 217
 
218
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
219
-    wp_enqueue_script('geodir-on-document-load');
218
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
219
+	wp_enqueue_script('geodir-on-document-load');
220 220
 
221
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
222
-    wp_enqueue_script('google-geometa');
221
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
222
+	wp_enqueue_script('google-geometa');
223 223
 }
224 224
 
225 225
 /**
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
  */
234 234
 function geodir_header_scripts()
235 235
 {
236
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
237
-    echo stripslashes(get_option('geodir_header_scripts'));
236
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
237
+	echo stripslashes(get_option('geodir_header_scripts'));
238 238
 }
239 239
 
240 240
 /**
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
  */
248 248
 function geodir_google_analytics_tracking_code()
249 249
 {
250
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
250
+	if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
251 251
 
252 252
         <script>
253 253
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
         </script>
263 263
 
264 264
         <?php
265
-    }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
266
-        echo stripslashes(get_option('geodir_ga_tracking_code'));
267
-    }
265
+	}elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
266
+		echo stripslashes(get_option('geodir_ga_tracking_code'));
267
+	}
268 268
 }
269 269
 
270 270
 /**
@@ -278,16 +278,16 @@  discard block
 block discarded – undo
278 278
 function geodir_footer_scripts()
279 279
 {
280 280
 
281
-    echo stripslashes(get_option('geodir_footer_scripts'));
281
+	echo stripslashes(get_option('geodir_footer_scripts'));
282 282
 
283
-    /*
283
+	/*
284 284
      * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041
285 285
      *
286 286
      * Flexbox wont wrap on ios for search form items
287 287
      */
288
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
289
-        echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
290
-    }
288
+	if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
289
+		echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
290
+	}
291 291
 }
292 292
 
293 293
 
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
  */
302 302
 function geodir_add_async_forscript($url)
303 303
 {
304
-    if (strpos($url, '#asyncload')===false)
305
-        return $url;
306
-    else if (is_admin())
307
-        return str_replace('#asyncload', '', $url);
308
-    else
309
-        return str_replace('#asyncload', '', $url)."' async='async";
304
+	if (strpos($url, '#asyncload')===false)
305
+		return $url;
306
+	else if (is_admin())
307
+		return str_replace('#asyncload', '', $url);
308
+	else
309
+		return str_replace('#asyncload', '', $url)."' async='async";
310 310
 }
311 311
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
312 312
 
@@ -319,18 +319,18 @@  discard block
 block discarded – undo
319 319
 function geodir_templates_styles()
320 320
 {
321 321
 
322
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
323
-    wp_enqueue_style('geodir-core-scss');
324
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
322
+	wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
323
+	wp_enqueue_style('geodir-core-scss');
324
+	wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
325 325
 
326
-    if(is_rtl()){
327
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
328
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
329
-    }
326
+	if(is_rtl()){
327
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
328
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
329
+	}
330 330
 
331
-    wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION);
332
-    wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
333
-    wp_enqueue_script( 'font-awesome' );
331
+	wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION);
332
+	wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
333
+	wp_enqueue_script( 'font-awesome' );
334 334
 
335 335
 
336 336
 }
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
  */
345 345
 function geodir_get_sidebar()
346 346
 {
347
-    get_sidebar('geodirectory');
347
+	get_sidebar('geodirectory');
348 348
 }
349 349
 
350 350
 /**
@@ -363,122 +363,122 @@  discard block
 block discarded – undo
363 363
  * @param bool $always_show Do you want to show the pagination always? Default: false.
364 364
  */
365 365
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
366
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
366
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
367 367
 
368
-    if (empty($prelabel)) {
369
-        $prelabel = '<strong>&lt;</strong>';
370
-    }
368
+	if (empty($prelabel)) {
369
+		$prelabel = '<strong>&lt;</strong>';
370
+	}
371 371
 
372
-    if (empty($nxtlabel)) {
373
-        $nxtlabel = '<strong>&gt;</strong>';
374
-    }
372
+	if (empty($nxtlabel)) {
373
+		$nxtlabel = '<strong>&gt;</strong>';
374
+	}
375 375
 
376
-    $half_pages_to_show = round($pages_to_show / 2);
376
+	$half_pages_to_show = round($pages_to_show / 2);
377 377
 
378
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
379
-        return;
378
+	if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
379
+		return;
380 380
 
381
-    if (!is_single()) {
382
-        if (function_exists('geodir_location_geo_home_link')) {
383
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
384
-        }
385
-        $numposts = $wp_query->found_posts;
381
+	if (!is_single()) {
382
+		if (function_exists('geodir_location_geo_home_link')) {
383
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
384
+		}
385
+		$numposts = $wp_query->found_posts;
386 386
 
387
-        $max_page = ceil($numposts / $posts_per_page);
387
+		$max_page = ceil($numposts / $posts_per_page);
388 388
 
389
-        if (empty($paged)) {
390
-            $paged = 1;
391
-        }
389
+		if (empty($paged)) {
390
+			$paged = 1;
391
+		}
392 392
         
393
-        $post_type = geodir_get_current_posttype();
394
-        $listing_type_name = get_post_type_plural_label($post_type);
395
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
396
-            $term = array();
393
+		$post_type = geodir_get_current_posttype();
394
+		$listing_type_name = get_post_type_plural_label($post_type);
395
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
396
+			$term = array();
397 397
             
398
-            if (is_tax()) {
399
-                $term_id = get_queried_object_id();
400
-                $taxonomy = get_query_var('taxonomy');
398
+			if (is_tax()) {
399
+				$term_id = get_queried_object_id();
400
+				$taxonomy = get_query_var('taxonomy');
401 401
 
402
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
403
-                    $term = get_term($term_id, $post_type . 'category');
404
-                }
405
-            }
402
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
403
+					$term = get_term($term_id, $post_type . 'category');
404
+				}
405
+			}
406 406
             
407
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
408
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
407
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
408
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
409 409
                 
410
-                if (!is_array($taxonomy_search)) {
411
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
412
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
413
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
414
-                }
415
-            }
410
+				if (!is_array($taxonomy_search)) {
411
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
412
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
413
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
414
+				}
415
+			}
416 416
             
417
-            if (!empty($term) && !is_wp_error($term)) {
418
-                $listing_type_name = $term->name;
419
-            }
420
-        }
417
+			if (!empty($term) && !is_wp_error($term)) {
418
+				$listing_type_name = $term->name;
419
+			}
420
+		}
421 421
 
422
-        if ($max_page > 1 || $always_show) {            
423
-            // Extra pagination info
424
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
425
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
426
-            $end_no = min($paged * $posts_per_page, $numposts);
422
+		if ($max_page > 1 || $always_show) {            
423
+			// Extra pagination info
424
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
425
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
426
+			$end_no = min($paged * $posts_per_page, $numposts);
427 427
 
428
-            if ($geodir_pagination_more_info != '') {
429
-                if ($listing_type_name) {
430
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
431
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
432
-                } else {
433
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
434
-                }
435
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
436
-                /**
437
-                 * Adds an extra pagination info above/under pagination.
438
-                 *
439
-                 * @since 1.5.9
440
-                 *
441
-                 * @param string $pagination_info Extra pagination info content.
442
-                 * @param string $listing_type_name Listing results type.
443
-                 * @param string $start_no First result number.
444
-                 * @param string $end_no Last result number.
445
-                 * @param string $numposts Total number of listings.
446
-                 * @param string $post_type The post type.
447
-                 */
448
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
428
+			if ($geodir_pagination_more_info != '') {
429
+				if ($listing_type_name) {
430
+					$listing_type_name = __($listing_type_name, 'geodirectory');
431
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
432
+				} else {
433
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
434
+				}
435
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
436
+				/**
437
+				 * Adds an extra pagination info above/under pagination.
438
+				 *
439
+				 * @since 1.5.9
440
+				 *
441
+				 * @param string $pagination_info Extra pagination info content.
442
+				 * @param string $listing_type_name Listing results type.
443
+				 * @param string $start_no First result number.
444
+				 * @param string $end_no Last result number.
445
+				 * @param string $numposts Total number of listings.
446
+				 * @param string $post_type The post type.
447
+				 */
448
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
449 449
                 
450
-                if ($geodir_pagination_more_info == 'before') {
451
-                    $before = $before . $pagination_info;
452
-                } else if ($geodir_pagination_more_info == 'after') {
453
-                    $after = $pagination_info . $after;
454
-                }
455
-            }
450
+				if ($geodir_pagination_more_info == 'before') {
451
+					$before = $before . $pagination_info;
452
+				} else if ($geodir_pagination_more_info == 'after') {
453
+					$after = $pagination_info . $after;
454
+				}
455
+			}
456 456
             
457
-            echo "$before <div class='Navi gd-navi'>";
458
-            if ($paged >= ($pages_to_show - 1)) {
459
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
460
-            }
461
-            previous_posts_link($prelabel);
462
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
463
-                if ($i >= 1 && $i <= $max_page) {
464
-                    if ($i == $paged) {
465
-                        echo "<strong class='on'>$i</strong>";
466
-                    } else {
467
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
468
-                    }
469
-                }
470
-            }
471
-            next_posts_link($nxtlabel, $max_page);
472
-            if (($paged + $half_pages_to_show) < ($max_page)) {
473
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
474
-            }
475
-            echo "</div> $after";
476
-        }
457
+			echo "$before <div class='Navi gd-navi'>";
458
+			if ($paged >= ($pages_to_show - 1)) {
459
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
460
+			}
461
+			previous_posts_link($prelabel);
462
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
463
+				if ($i >= 1 && $i <= $max_page) {
464
+					if ($i == $paged) {
465
+						echo "<strong class='on'>$i</strong>";
466
+					} else {
467
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
468
+					}
469
+				}
470
+			}
471
+			next_posts_link($nxtlabel, $max_page);
472
+			if (($paged + $half_pages_to_show) < ($max_page)) {
473
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
474
+			}
475
+			echo "</div> $after";
476
+		}
477 477
         
478
-        if (function_exists('geodir_location_geo_home_link')) {
479
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
480
-        }
481
-    }
478
+		if (function_exists('geodir_location_geo_home_link')) {
479
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
480
+		}
481
+	}
482 482
 }
483 483
 
484 484
 /**
@@ -489,20 +489,20 @@  discard block
 block discarded – undo
489 489
  */
490 490
 function geodir_listingsearch_scripts()
491 491
 {
492
-    if (get_option('gd_search_dist') != '') {
493
-        $dist = get_option('gd_search_dist');
494
-    } else {
495
-        $dist = 500;
496
-    }
497
-    $dist_dif = 1000;
498
-
499
-    if ($dist <= 5000) $dist_dif = 500;
500
-    if ($dist <= 1000) $dist_dif = 100;
501
-    if ($dist <= 500) $dist_dif = 50;
502
-    if ($dist <= 100) $dist_dif = 10;
503
-    if ($dist <= 50) $dist_dif = 5;
504
-
505
-    ?>
492
+	if (get_option('gd_search_dist') != '') {
493
+		$dist = get_option('gd_search_dist');
494
+	} else {
495
+		$dist = 500;
496
+	}
497
+	$dist_dif = 1000;
498
+
499
+	if ($dist <= 5000) $dist_dif = 500;
500
+	if ($dist <= 1000) $dist_dif = 100;
501
+	if ($dist <= 500) $dist_dif = 50;
502
+	if ($dist <= 100) $dist_dif = 10;
503
+	if ($dist <= 50) $dist_dif = 5;
504
+
505
+	?>
506 506
     <script type="text/javascript">
507 507
 
508 508
         jQuery(function ($) {
@@ -560,20 +560,20 @@  discard block
 block discarded – undo
560 560
  * @package GeoDirectory
561 561
  */
562 562
 function geodir_add_sharelocation_scripts() {
563
-    $default_search_for_text = SEARCH_FOR_TEXT;
564
-    if (get_option('geodir_search_field_default_text'))
565
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
563
+	$default_search_for_text = SEARCH_FOR_TEXT;
564
+	if (get_option('geodir_search_field_default_text'))
565
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
566 566
 
567
-    $default_near_text = NEAR_TEXT;
568
-    if (get_option('geodir_near_field_default_text'))
569
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
567
+	$default_near_text = NEAR_TEXT;
568
+	if (get_option('geodir_near_field_default_text'))
569
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
570 570
     
571
-    $search_location = geodir_get_default_location();
571
+	$search_location = geodir_get_default_location();
572 572
     
573
-    $default_search_for_text = addslashes(stripslashes($default_search_for_text));
574
-    $default_near_text = addslashes(stripslashes($default_near_text));
575
-    $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
576
-    ?>
573
+	$default_search_for_text = addslashes(stripslashes($default_search_for_text));
574
+	$default_near_text = addslashes(stripslashes($default_near_text));
575
+	$city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
576
+	?>
577 577
     <script type="text/javascript">
578 578
         var default_location = '<?php echo $city ;?>';
579 579
         var latlng;
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
                     initialise2();
666 666
                 } else {
667 667
                     <?php
668
-                    $near_add = get_option('geodir_search_near_addition');
669
-                    /**
670
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
671
-                     *
672
-                     * @since 1.0.0
673
-                     */
674
-                    $near_add2 = apply_filters('geodir_search_near_addition', '');
675
-                    ?>
668
+					$near_add = get_option('geodir_search_near_addition');
669
+					/**
670
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
671
+					 *
672
+					 * @since 1.0.0
673
+					 */
674
+					$near_add2 = apply_filters('geodir_search_near_addition', '');
675
+					?>
676 676
                     if (window.gdMaps === 'google') {
677 677
                         Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
678 678
                             function (results, status) {
@@ -786,32 +786,32 @@  discard block
 block discarded – undo
786 786
  */
787 787
 function geodir_show_badges_on_image($which, $post, $link)
788 788
 {
789
-    $return = '';
790
-    switch ($which) {
791
-        case 'featured':
792
-            /**
793
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
794
-             *
795
-             * @since 1.0.0
796
-             * @param object $post The post object.
797
-             * @param string $link The link to the post.
798
-             */
799
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
800
-            break;
801
-        case 'new' :
802
-            /**
803
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
804
-             *
805
-             * @since 1.0.0
806
-             * @param object $post The post object.
807
-             * @param string $link The link to the post.
808
-             */
809
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
810
-            break;
811
-
812
-    }
789
+	$return = '';
790
+	switch ($which) {
791
+		case 'featured':
792
+			/**
793
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
794
+			 *
795
+			 * @since 1.0.0
796
+			 * @param object $post The post object.
797
+			 * @param string $link The link to the post.
798
+			 */
799
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
800
+			break;
801
+		case 'new' :
802
+			/**
803
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
804
+			 *
805
+			 * @since 1.0.0
806
+			 * @param object $post The post object.
807
+			 * @param string $link The link to the post.
808
+			 */
809
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
810
+			break;
811
+
812
+	}
813 813
     
814
-    return $return;
814
+	return $return;
815 815
 }
816 816
 
817 817
 /**
@@ -820,8 +820,8 @@  discard block
 block discarded – undo
820 820
  * @since 1.6.22
821 821
  */
822 822
 function geodir_fix_script_conflict() {
823
-    if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
824
-        wp_dequeue_script( 'flexslider' );
825
-    }
823
+	if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
824
+		wp_dequeue_script( 'flexslider' );
825
+	}
826 826
 }
827 827
 add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 );
828 828
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
     $is_detail_page = false;
40 40
     $geodir_map_name = geodir_map_name();
41 41
 
42
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
+    if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
43 43
         $is_detail_page = true;
44 44
     }
45 45
 
46 46
     wp_enqueue_script('jquery');
47 47
 
48
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48
+    wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
49 49
     wp_enqueue_script('geodirectory-script');
50 50
 
51 51
     $geodir_vars_data = array(
52 52
         'siteurl' => get_option('siteurl'),
53 53
         'geodir_plugin_url' => geodir_plugin_url(),
54
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
+        'geodir_lazy_load' => get_option('geodir_lazy_load', 1),
55 55
         'geodir_ajax_url' => geodir_get_ajax_url(),
56
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
+        'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
57 57
         'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue
58 58
 		'lightBox_txtImage' => addslashes(__('Image', 'geodirectory')),
59 59
 		'lightBox_txtOf' => addslashes(__('of', 'geodirectory')),
@@ -76,24 +76,24 @@  discard block
 block discarded – undo
76 76
      *
77 77
      * }
78 78
      */
79
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
79
+    $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
80 80
 
81 81
     wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
82 82
 
83
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
84
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
83
+    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
84
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
85 85
 
86
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
86
+    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
87 87
     wp_enqueue_script('geodirectory-lightbox-jquery');
88 88
 
89
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
89
+    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
90 90
     if ($is_detail_page) {
91 91
         wp_enqueue_script('geodirectory-jquery-simplemodal');
92 92
     }
93 93
 
94 94
     if (in_array($geodir_map_name, array('auto', 'google'))) {
95
-        $map_lang = "&language=" . geodir_get_map_default_language();
96
-        $map_key = "&key=" . geodir_get_map_api_key();
95
+        $map_lang = "&language=".geodir_get_map_default_language();
96
+        $map_key = "&key=".geodir_get_map_api_key();
97 97
         /**
98 98
          * Filter the variables that are added to the end of the google maps script call.
99 99
          *
@@ -103,55 +103,55 @@  discard block
 block discarded – undo
103 103
          * @param string $var The string to filter, default is empty string.
104 104
          */
105 105
         $map_extra = apply_filters('geodir_googlemap_script_extra', '');
106
-        wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
106
+        wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
107 107
         
108 108
         // Overlapping Marker Spiderfier
109
-        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
109
+        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
110 110
         wp_enqueue_script('geodirectory-g-overlappingmarker-script');
111 111
     }
112 112
     
113 113
     if ($geodir_map_name == 'osm') {
114 114
         // Leaflet OpenStreetMap
115
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
115
+        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
116 116
         wp_enqueue_style('geodirectory-leaflet-style');
117 117
             
118
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
118
+        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
119 119
         wp_enqueue_script('geodirectory-leaflet-script');
120 120
         
121
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
121
+        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
122 122
         wp_enqueue_script('geodirectory-leaflet-geo-script');
123 123
         
124 124
         if ($is_detail_page) {
125
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
125
+            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
126 126
             wp_enqueue_style('geodirectory-leaflet-routing-style');
127 127
                 
128
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
128
+            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
129 129
             wp_enqueue_script('geodirectory-leaflet-routing-script');
130 130
         }
131 131
         
132 132
         // Overlapping Marker Spiderfier Leaflet
133
-        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
133
+        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
134 134
         wp_enqueue_script('geodirectory-o-overlappingmarker-script');
135 135
     }
136
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
136
+    wp_enqueue_script('jquery-ui-autocomplete');
137 137
     
138
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
138
+    wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
139 139
     wp_enqueue_script('geodirectory-goMap-script');
140 140
 
141
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
141
+    wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
142 142
     wp_enqueue_script('chosen');
143 143
 
144
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
144
+    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
145 145
     wp_enqueue_script('geodirectory-choose-ajax');
146 146
 
147
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
147
+    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
148 148
 
149 149
     if (is_page() && geodir_is_page('add-listing')) {
150 150
         // SCRIPT FOR UPLOAD
151 151
         wp_enqueue_script('plupload-all');
152 152
         wp_enqueue_script('jquery-ui-sortable');
153 153
 
154
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
154
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
155 155
         wp_enqueue_script('geodirectory-plupload-script');
156 156
         // SCRIPT FOR UPLOAD END
157 157
 
@@ -198,27 +198,27 @@  discard block
 block discarded – undo
198 198
 
199 199
         wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
200 200
 
201
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
201
+        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload');
202 202
     } // End if for add place page
203 203
 
204
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
204
+    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
205 205
     if ($is_detail_page) {
206 206
 		wp_enqueue_script('geodirectory-post-custom-js');
207 207
 	}
208 208
 
209 209
     // font awesome rating script
210 210
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
211
-		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
211
+		wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
212 212
 		wp_enqueue_script('geodir-barrating-js');
213 213
 	} else { // default rating script
214
-		wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
214
+		wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
215 215
 		wp_enqueue_script('geodir-jRating-js');
216 216
 	}
217 217
 
218
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
218
+    wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
219 219
     wp_enqueue_script('geodir-on-document-load');
220 220
 
221
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
221
+    wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
222 222
     wp_enqueue_script('google-geometa');
223 223
 }
224 224
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
  */
234 234
 function geodir_header_scripts()
235 235
 {
236
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
236
+    echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>';
237 237
     echo stripslashes(get_option('geodir_header_scripts'));
238 238
 }
239 239
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
  */
248 248
 function geodir_google_analytics_tracking_code()
249 249
 {
250
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
250
+    if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?>
251 251
 
252 252
         <script>
253 253
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
                 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
256 256
             })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
257 257
 
258
-            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto');
259
-            <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?>
258
+            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto');
259
+            <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?>
260 260
             ga('send', 'pageview');
261 261
 
262 262
         </script>
263 263
 
264 264
         <?php
265
-    }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
265
+    }elseif (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) {
266 266
         echo stripslashes(get_option('geodir_ga_tracking_code'));
267 267
     }
268 268
 }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      *
286 286
      * Flexbox wont wrap on ios for search form items
287 287
      */
288
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
288
+    if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) {
289 289
         echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
290 290
     }
291 291
 }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
  */
302 302
 function geodir_add_async_forscript($url)
303 303
 {
304
-    if (strpos($url, '#asyncload')===false)
304
+    if (strpos($url, '#asyncload') === false)
305 305
         return $url;
306 306
     else if (is_admin())
307 307
         return str_replace('#asyncload', '', $url);
@@ -319,18 +319,18 @@  discard block
 block discarded – undo
319 319
 function geodir_templates_styles()
320 320
 {
321 321
 
322
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
322
+    wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
323 323
     wp_enqueue_style('geodir-core-scss');
324
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
324
+    wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
325 325
 
326
-    if(is_rtl()){
327
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
326
+    if (is_rtl()) {
327
+    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
328 328
     wp_enqueue_style('geodirectory-frontend-rtl-style');
329 329
     }
330 330
 
331 331
     wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION);
332 332
     wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
333
-    wp_enqueue_script( 'font-awesome' );
333
+    wp_enqueue_script('font-awesome');
334 334
 
335 335
 
336 336
 }
@@ -399,18 +399,18 @@  discard block
 block discarded – undo
399 399
                 $term_id = get_queried_object_id();
400 400
                 $taxonomy = get_query_var('taxonomy');
401 401
 
402
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
403
-                    $term = get_term($term_id, $post_type . 'category');
402
+                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') {
403
+                    $term = get_term($term_id, $post_type.'category');
404 404
                 }
405 405
             }
406 406
             
407
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
408
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
407
+            if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) {
408
+                $taxonomy_search = $_REQUEST['s'.$post_type.'category'];
409 409
                 
410 410
                 if (!is_array($taxonomy_search)) {
411
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
412
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
413
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
411
+                    $term = get_term((int) $taxonomy_search, $post_type.'category');
412
+                } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
413
+                    $term = get_term((int) $taxonomy_search[0], $post_type.'category');
414 414
                 }
415 415
             }
416 416
             
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         if ($max_page > 1 || $always_show) {            
423 423
             // Extra pagination info
424 424
             $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
425
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
425
+            $start_no = ($paged - 1) * $posts_per_page + 1;
426 426
             $end_no = min($paged * $posts_per_page, $numposts);
427 427
 
428 428
             if ($geodir_pagination_more_info != '') {
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                 } else {
433 433
                     $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
434 434
                 }
435
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
435
+                $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>';
436 436
                 /**
437 437
                  * Adds an extra pagination info above/under pagination.
438 438
                  *
@@ -448,15 +448,15 @@  discard block
 block discarded – undo
448 448
                 $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
449 449
                 
450 450
                 if ($geodir_pagination_more_info == 'before') {
451
-                    $before = $before . $pagination_info;
451
+                    $before = $before.$pagination_info;
452 452
                 } else if ($geodir_pagination_more_info == 'after') {
453
-                    $after = $pagination_info . $after;
453
+                    $after = $pagination_info.$after;
454 454
                 }
455 455
             }
456 456
             
457 457
             echo "$before <div class='Navi gd-navi'>";
458 458
             if ($paged >= ($pages_to_show - 1)) {
459
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
459
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link()).'">&laquo;</a>';
460 460
             }
461 461
             previous_posts_link($prelabel);
462 462
             for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
                     if ($i == $paged) {
465 465
                         echo "<strong class='on'>$i</strong>";
466 466
                     } else {
467
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
467
+                        echo ' <a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($i)).'">'.$i.'</a> ';
468 468
                     }
469 469
                 }
470 470
             }
471 471
             next_posts_link($nxtlabel, $max_page);
472 472
             if (($paged + $half_pages_to_show) < ($max_page)) {
473
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
473
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)).'">&raquo;</a>';
474 474
             }
475 475
             echo "</div> $after";
476 476
         }
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
         jQuery(function ($) {
509 509
             $("#distance_slider").slider({
510 510
                 range: true,
511
-                values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
511
+                values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
512 512
                 min: 0,
513 513
                 max: <?php echo $dist; ?>,
514 514
                 step: <?php echo $dist_dif; ?>,
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
     $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
576 576
     ?>
577 577
     <script type="text/javascript">
578
-        var default_location = '<?php echo $city ;?>';
578
+        var default_location = '<?php echo $city; ?>';
579 579
         var latlng;
580 580
         var address;
581 581
         var dist = 0;
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 				var $form = jQuery(this).closest('form');
592 592
 
593 593
 				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
594
-				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
594
+				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
595 595
 				
596 596
 				// Disable location based search for disabled location post type.
597 597
 				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 					}
606 606
 				}
607 607
 				
608
-				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) {
608
+				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) {
609 609
 
610 610
                     // OSM can't handel post code with no space so we test for it and add one if needed
611 611
                     if(window.gdMaps === 'osm'){
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
         });
635 635
         
636 636
 		function geodir_setsearch($form) {
637
-			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location);
637
+			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location);
638 638
 			geocodeAddress($form);
639 639
 		}
640 640
 
@@ -653,15 +653,15 @@  discard block
 block discarded – undo
653 653
             // Call the geocode function
654 654
             Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
655 655
 
656
-            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
657
-                if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
656
+            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
657
+                if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
658 658
                     jQuery(".snear", $form).val('');
659 659
                 }
660 660
                 jQuery($form).submit();
661 661
             } else {
662 662
                 var address = jQuery(".snear", $form).val();
663 663
 
664
-                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
664
+                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
665 665
                     initialise2();
666 666
                 } else {
667 667
                     <?php
@@ -674,21 +674,21 @@  discard block
 block discarded – undo
674 674
                     $near_add2 = apply_filters('geodir_search_near_addition', '');
675 675
                     ?>
676 676
                     if (window.gdMaps === 'google') {
677
-                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
677
+                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>},
678 678
                             function (results, status) {
679 679
                                 if (status == google.maps.GeocoderStatus.OK) {
680 680
                                     updateSearchPosition(results[0].geometry.location, $form);
681 681
                                 } else {
682
-                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status);
682
+                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status);
683 683
                                 }
684 684
                             });
685 685
                     } else if (window.gdMaps === 'osm') {
686
-                        geocodePositionOSM(false, address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>, false, false,
686
+                        geocodePositionOSM(false, address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>, false, false,
687 687
                             function(geo) {
688 688
                                 if (typeof geo !== 'undefined' && geo.lat && geo.lon) {
689 689
                                     updateSearchPosition(geo, $form);
690 690
                                 } else {
691
-                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>");
691
+                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>");
692 692
                                 }
693 693
                             });
694 694
                     } else {
@@ -734,19 +734,19 @@  discard block
 block discarded – undo
734 734
             var msg;
735 735
             switch (err.code) {
736 736
                 case err.UNKNOWN_ERROR:
737
-                    msg = "<?php _e('Unable to find your location','geodirectory');?>";
737
+                    msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
738 738
                     break;
739 739
                 case err.PERMISSION_DENINED:
740
-                    msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
740
+                    msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
741 741
                     break;
742 742
                 case err.POSITION_UNAVAILABLE:
743
-                    msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
743
+                    msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
744 744
                     break;
745 745
                 case err.BREAK:
746
-                    msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
746
+                    msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
747 747
                     break;
748 748
                 default:
749
-                    msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
749
+                    msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
750 750
             }
751 751
             jQuery('#info').html(msg);
752 752
         }
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
              * @param object $post The post object.
797 797
              * @param string $link The link to the post.
798 798
              */
799
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
799
+            $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img">&nbsp;</span></a>', $post, $link);
800 800
             break;
801 801
         case 'new' :
802 802
             /**
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
              * @param object $post The post object.
807 807
              * @param string $link The link to the post.
808 808
              */
809
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
809
+            $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing">&nbsp;</span></a>', $post, $link);
810 810
             break;
811 811
 
812 812
     }
@@ -820,8 +820,8 @@  discard block
 block discarded – undo
820 820
  * @since 1.6.22
821 821
  */
822 822
 function geodir_fix_script_conflict() {
823
-    if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
824
-        wp_dequeue_script( 'flexslider' );
823
+    if (wp_script_is('flexslider', 'enqueued') && wp_script_is('geodirectory-jquery-flexslider-js', 'enqueued')) {
824
+        wp_dequeue_script('flexslider');
825 825
     }
826 826
 }
827
-add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 );
828 827
\ No newline at end of file
828
+add_action('wp_enqueue_scripts', 'geodir_fix_script_conflict', 100);
829 829
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 2 patches
Spacing   +718 added lines, -718 removed lines patch added patch discarded remove patch
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
53 53
 			}
54 54
 
55
-			jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
55
+			jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
56 56
 				//alert(data );
57 57
 			});
58 58
 		}
59 59
 	</script>
60 60
 	<div class="geodir-list-view-select">
61 61
 		<select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
62
-			<?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?>
63
-			<option value=""><?php _e( 'View:', 'geodirectory' ); ?></option>
62
+			<?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
63
+			<option value=""><?php _e('View:', 'geodirectory'); ?></option>
64 64
 			<option
65
-				value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option>
65
+				value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
66 66
 			<option
67
-				value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option>
67
+				value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
68 68
 			<option
69
-				value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option>
69
+				value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
70 70
 			<option
71
-				value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option>
71
+				value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
72 72
 			<option
73
-				value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option>
73
+				value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
74 74
 		</select>
75 75
 	</div>
76 76
 	<?php
77 77
 }
78 78
 
79
-add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 );
79
+add_action('geodir_before_listing', 'geodir_list_view_select', 100);
80 80
 
81 81
 /**
82 82
  * Limit the listing excerpt.
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
  * @global object $post          The current post object.
92 92
  * @return string The modified excerpt.
93 93
  */
94
-function geodir_max_excerpt( $charlength ) {
94
+function geodir_max_excerpt($charlength) {
95 95
 	global $post;
96
-	if ( $charlength == '0' ) {
96
+	if ($charlength == '0') {
97 97
 		return;
98 98
 	}
99 99
 	$out = '';
@@ -101,46 +101,46 @@  discard block
 block discarded – undo
101 101
 	$temp_post = $post;
102 102
 	$excerpt   = get_the_excerpt();
103 103
 
104
-	$charlength ++;
105
-	$excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' );
106
-	if ( geodir_utf8_strlen( $excerpt ) > $charlength ) {
107
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
109
-			$subex = geodir_utf8_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && geodir_utf8_strlen( $subex ) > $charlength ) {
111
-				$subex = geodir_utf8_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (geodir_utf8_strlen($excerpt) > $charlength) {
107
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (geodir_utf8_strlen($excerpt_more));
109
+			$subex = geodir_utf8_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && geodir_utf8_strlen($subex) > $charlength) {
111
+				$subex = geodir_utf8_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = geodir_utf8_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( geodir_utf8_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= geodir_utf8_substr( $subex, 0, $excut );
115
+			$subex   = geodir_utf8_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (geodir_utf8_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= geodir_utf8_substr($subex, 0, $excut);
120 120
 			} else {
121 121
 				$out .= $subex;
122 122
 			}
123 123
 		}
124
-		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
124
+		$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
125 125
 		/**
126 126
 		 * Filter excerpt read more text.
127 127
 		 *
128 128
 		 * @since 1.0.0
129 129
 		 */
130
-		$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
130
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
131 131
 		$out .= '</a>';
132 132
 
133 133
 	} else {
134
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
136
-			$out .= geodir_utf8_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (geodir_utf8_strlen($excerpt_more));
136
+			$out .= geodir_utf8_substr($excerpt, 0, $excut);
137
+			$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
138 138
 			/**
139 139
 			 * Filter excerpt read more text.
140 140
 			 *
141 141
 			 * @since 1.0.0
142 142
 			 */
143
-			$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
143
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
144 144
 			$out .= '</a>';
145 145
 		} else {
146 146
 			$out .= $excerpt;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return object Returns filtered package info as an object.
165 165
  */
166
-function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
166
+function geodir_post_package_info($package_info, $post = '', $post_type = '') {
167 167
 	$package_info['pid']              = 0;
168 168
 	$package_info['days']             = 0;
169 169
 	$package_info['amount']           = 0;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param object|string $post  The post object.
193 193
 	 * @param string $post_type    The post type.
194 194
 	 */
195
-	return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type );
195
+	return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
196 196
 
197 197
 }
198 198
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * }
222 222
  */
223
-function geodir_send_inquiry( $request ) {
223
+function geodir_send_inquiry($request) {
224 224
 	global $wpdb;
225 225
 
226 226
 	// strip slashes from text
227
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
227
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
228 228
 
229 229
 	$yourname      = sanitize_text_field($request['inq_name']);
230 230
 	$youremail     = sanitize_email($request['inq_email']);
@@ -232,25 +232,25 @@  discard block
 block discarded – undo
232 232
 	$frnd_comments = sanitize_text_field($request['inq_msg']);
233 233
 	$pid           = absint($request['pid']);
234 234
 
235
-	$author_id  = '';
235
+	$author_id = '';
236 236
 
237
-	if ( $pid && 'publish' == get_post_status ( $pid  ) ) {
237
+	if ($pid && 'publish' == get_post_status($pid)) {
238 238
 
239
-		check_ajax_referer( 'send_inquiry_'.$pid );
239
+		check_ajax_referer('send_inquiry_'.$pid);
240 240
 
241 241
 		$p_post = get_post($pid);
242 242
 
243
-		$author_id  = $p_post->post_author;
243
+		$author_id = $p_post->post_author;
244 244
 
245
-	}else{
245
+	} else {
246 246
 		gd_die();
247 247
 	}
248 248
 
249
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
250
-	$to_name   = geodir_get_client_name( $author_id );
249
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
250
+	$to_name   = geodir_get_client_name($author_id);
251 251
 
252
-	if ( $to_email == '' ) {
253
-		$to_email = get_option( 'admin_email' );
252
+	if ($to_email == '') {
253
+		$to_email = get_option('admin_email');
254 254
 	}
255 255
 
256 256
 	/**
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 	 * }
272 272
 	 * @param string $type     The form type, default: `Enquiry`.
273 273
 	 */
274
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
274
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
275 275
 
276 276
 	$client_message = $frnd_comments;
277
-	$client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.';
277
+	$client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
278 278
 	/**
279 279
 	 * Filter client message text.
280 280
 	 *
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * @param string $client_message Client message text.
284 284
 	 */
285
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
285
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
286 286
 
287 287
 	/**
288 288
 	 * Called before the send enquiry email is sent.
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 	 *
302 302
 	 * }
303 303
 	 */
304
-	do_action( 'geodir_before_send_enquiry_email', $request );
305
-	if ( $to_email ) {
304
+	do_action('geodir_before_send_enquiry_email', $request);
305
+	if ($to_email) {
306 306
 		// strip slashes message
307
-		$client_message = stripslashes_deep( $client_message );
307
+		$client_message = stripslashes_deep($client_message);
308 308
 
309
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
309
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
310 310
 	}
311 311
 
312 312
 	/**
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 *
327 327
 	 * }
328 328
 	 */
329
-	do_action( 'geodir_after_send_enquiry_email', $request );
330
-	$url = get_permalink( $pid );
331
-	if ( strstr( $url, '?' ) ) {
332
-		$url = $url . "&send_inquiry=success";
329
+	do_action('geodir_after_send_enquiry_email', $request);
330
+	$url = get_permalink($pid);
331
+	if (strstr($url, '?')) {
332
+		$url = $url."&send_inquiry=success";
333 333
 	} else {
334
-		$url = $url . "?send_inquiry=success";
334
+		$url = $url."?send_inquiry=success";
335 335
 	}
336 336
 	/**
337 337
 	 * Filter redirect url after the send enquiry email is sent.
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @param string $url Redirect url.
342 342
 	 */
343
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
344
-	wp_redirect( $url );
343
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
344
+	wp_redirect($url);
345 345
 	gd_die();
346 346
 
347 347
 }
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
  *
373 373
  * @deprecated 1.6.26
374 374
  */
375
-function geodir_send_friend( $request ) {
375
+function geodir_send_friend($request) {
376 376
 	global $wpdb;
377 377
 
378 378
 	// strip slashes from text
379
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
379
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
380 380
 
381 381
 	$yourname      = sanitize_text_field($request['yourname']);
382 382
 	$youremail     = sanitize_email($request['youremail']);
@@ -385,11 +385,11 @@  discard block
 block discarded – undo
385 385
 	$pid           = absint($request['pid']);
386 386
 	$to_email      = sanitize_email($request['to_email']);
387 387
 	$to_name       = sanitize_text_field($request['to_name']);
388
-	if ( $pid && 'publish' == get_post_status ( $pid  ) ) {
388
+	if ($pid && 'publish' == get_post_status($pid)) {
389 389
 
390
-		check_ajax_referer( 'send_to_frnd_'.$pid );
390
+		check_ajax_referer('send_to_frnd_'.$pid);
391 391
 
392
-	}else{
392
+	} else {
393 393
 		gd_die();
394 394
 	}
395 395
 
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * }
414 414
 	 */
415
-	do_action( 'geodir_before_send_to_friend_email', $request );
416
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
415
+	do_action('geodir_before_send_to_friend_email', $request);
416
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
417 417
 
418 418
 	/**
419 419
 	 * Called after the send to friend email is sent.
@@ -434,13 +434,13 @@  discard block
 block discarded – undo
434 434
 	 *
435 435
 	 * }
436 436
 	 */
437
-	do_action( 'geodir_after_send_to_friend_email', $request );
437
+	do_action('geodir_after_send_to_friend_email', $request);
438 438
 
439
-	$url = get_permalink( $pid );
440
-	if ( strstr( $url, '?' ) ) {
441
-		$url = $url . "&sendtofrnd=success";
439
+	$url = get_permalink($pid);
440
+	if (strstr($url, '?')) {
441
+		$url = $url."&sendtofrnd=success";
442 442
 	} else {
443
-		$url = $url . "?sendtofrnd=success";
443
+		$url = $url."?sendtofrnd=success";
444 444
 	}
445 445
 	/**
446 446
 	 * Filter redirect url after the send to friend email is sent.
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 	 *
450 450
 	 * @param string $url Redirect url.
451 451
 	 */
452
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
453
-	wp_redirect( $url );
452
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
453
+	wp_redirect($url);
454 454
 	gd_die();
455 455
 }
456 456
 
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
  *
465 465
  * @param string $hash_key
466 466
  */
467
-function geodir_before_tab_content( $hash_key ) {
468
-	switch ( $hash_key ) {
467
+function geodir_before_tab_content($hash_key) {
468
+	switch ($hash_key) {
469 469
 		case 'post_info' :
470 470
 			echo '<div class="geodir-company_info field-group">';
471 471
 			break;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 			 *
476 476
 			 * @since 1.0.0
477 477
 			 */
478
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
478
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
479 479
 			break;
480 480
 		case 'reviews' :
481 481
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
  *
500 500
  * @param string $hash_key
501 501
  */
502
-function geodir_after_tab_content( $hash_key ) {
503
-	switch ( $hash_key ) {
502
+function geodir_after_tab_content($hash_key) {
503
+	switch ($hash_key) {
504 504
 		case 'post_info' :
505 505
 			echo '</div>';
506 506
 			break;
@@ -531,25 +531,25 @@  discard block
 block discarded – undo
531 531
  * @global object $wpdb     WordPress Database object.
532 532
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
533 533
  */
534
-function geodir_get_posts_default_sort( $post_type ) {
534
+function geodir_get_posts_default_sort($post_type) {
535 535
 
536 536
 	global $wpdb;
537 537
 
538
-	if ( $post_type != '' ) {
538
+	if ($post_type != '') {
539 539
 
540 540
 		$all_postypes = geodir_get_posttypes();
541 541
 
542
-		if ( ! in_array( $post_type, $all_postypes ) ) {
542
+		if (!in_array($post_type, $all_postypes)) {
543 543
 			return false;
544 544
 		}
545 545
 
546
-		$sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array(
546
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array(
547 547
 			$post_type,
548 548
 			1,
549 549
 			1
550
-		) ) );
550
+		)));
551 551
 
552
-		if ( ! empty( $sort_field_info ) ) {
552
+		if (!empty($sort_field_info)) {
553 553
 			return $sort_field_info;
554 554
 		}
555 555
 
@@ -569,20 +569,20 @@  discard block
 block discarded – undo
569 569
  * @global object $wpdb     WordPress Database object.
570 570
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
571 571
  */
572
-function geodir_get_sort_options( $post_type ) {
572
+function geodir_get_sort_options($post_type) {
573 573
 	global $wpdb;
574 574
 
575
-	if ( $post_type != '' ) {
575
+	if ($post_type != '') {
576 576
 		$all_postypes = geodir_get_posttypes();
577 577
 
578
-		if ( ! in_array( $post_type, $all_postypes ) ) {
578
+		if (!in_array($post_type, $all_postypes)) {
579 579
 			return false;
580 580
 		}
581 581
 
582
-		$sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
582
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
583 583
 			$post_type,
584 584
 			1
585
-		) ) );
585
+		)));
586 586
 
587 587
 		/**
588 588
 		 * Filter post sort options.
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		 * @param array $sort_field_info Unfiltered sort field array.
593 593
 		 * @param string $post_type      Post type.
594 594
 		 */
595
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
595
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
596 596
 	}
597 597
 
598 598
 }
@@ -613,63 +613,63 @@  discard block
 block discarded – undo
613 613
 	 *
614 614
 	 * @since 1.4.4
615 615
 	 */
616
-	if ( is_search() ) {
616
+	if (is_search()) {
617 617
 		return;
618 618
 	}
619 619
 
620 620
 	$sort_by = '';
621 621
 
622
-	if ( isset( $_REQUEST['sort_by'] ) ) {
622
+	if (isset($_REQUEST['sort_by'])) {
623 623
 		$sort_by = $_REQUEST['sort_by'];
624 624
 	}
625 625
 
626 626
 	$gd_post_type = geodir_get_current_posttype();
627 627
 
628
-	$sort_options = geodir_get_sort_options( $gd_post_type );
628
+	$sort_options = geodir_get_sort_options($gd_post_type);
629 629
 
630 630
 
631 631
 	$sort_field_options = '';
632 632
 
633
-	if ( ! empty( $sort_options ) ) {
634
-		foreach ( $sort_options as $sort ) {
635
-			$sort = stripslashes_deep( $sort ); // strip slashes
633
+	if (!empty($sort_options)) {
634
+		foreach ($sort_options as $sort) {
635
+			$sort = stripslashes_deep($sort); // strip slashes
636 636
 
637
-			$label = __( $sort->site_title, 'geodirectory' );
637
+			$label = __($sort->site_title, 'geodirectory');
638 638
 
639
-			if ( $sort->field_type == 'random' ) {
639
+			if ($sort->field_type == 'random') {
640 640
 				$key = $sort->field_type;
641
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
642
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
641
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
642
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
643 643
 			}
644 644
 
645
-			if ( $sort->htmlvar_name == 'comment_count' ) {
645
+			if ($sort->htmlvar_name == 'comment_count') {
646 646
 				$sort->htmlvar_name = 'rating_count';
647 647
 			}
648 648
 
649
-			if ( $sort->sort_asc ) {
650
-				$key   = $sort->htmlvar_name . '_asc';
649
+			if ($sort->sort_asc) {
650
+				$key   = $sort->htmlvar_name.'_asc';
651 651
 				$label = $sort->site_title;
652
-				if ( $sort->asc_title ) {
652
+				if ($sort->asc_title) {
653 653
 					$label = $sort->asc_title;
654 654
 				}
655
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
656
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
655
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
656
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
657 657
 			}
658 658
 
659
-			if ( $sort->sort_desc ) {
660
-				$key   = $sort->htmlvar_name . '_desc';
659
+			if ($sort->sort_desc) {
660
+				$key   = $sort->htmlvar_name.'_desc';
661 661
 				$label = $sort->site_title;
662
-				if ( $sort->desc_title ) {
662
+				if ($sort->desc_title) {
663 663
 					$label = $sort->desc_title;
664 664
 				}
665
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
666
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
665
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
666
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
667 667
 			}
668 668
 
669 669
 		}
670 670
 	}
671 671
 
672
-	if ( $sort_field_options != '' ) {
672
+	if ($sort_field_options != '') {
673 673
 
674 674
 		?>
675 675
 
@@ -678,9 +678,9 @@  discard block
 block discarded – undo
678 678
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
679 679
 
680 680
 				<option
681
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
681
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
682 682
 					echo 'selected="selected"';
683
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
683
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
684 684
 
685 685
 				echo $sort_field_options; ?>
686 686
 
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
  *
709 709
  * @return string Returns the section title.
710 710
  */
711
-function geodir_advance_customfields_heading( $title, $field_type ) {
711
+function geodir_advance_customfields_heading($title, $field_type) {
712 712
 
713
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
713
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
714 714
 		$title = '';
715 715
 	}
716 716
 
@@ -732,34 +732,34 @@  discard block
 block discarded – undo
732 732
  * @global object $gd_session       GeoDirectory Session object.
733 733
  * @return string Returns related posts html.
734 734
  */
735
-function geodir_related_posts_display( $request ) {
736
-	if ( ! empty( $request ) ) {
737
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
738
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
739
-
740
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
741
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
742
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
743
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
744
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
745
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
746
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
747
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
735
+function geodir_related_posts_display($request) {
736
+	if (!empty($request)) {
737
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
738
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
739
+
740
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
741
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
742
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
743
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
744
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
745
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
746
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
747
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
748 748
 
749 749
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
750
-		$related_parent_lat   = !empty($post->post_latitude) && geodir_is_page( 'detail' ) ? $post->post_latitude : '';
751
-		$related_parent_lon   = !empty($post->post_longitude) && geodir_is_page( 'detail' ) ? $post->post_longitude : '';
750
+		$related_parent_lat   = !empty($post->post_latitude) && geodir_is_page('detail') ? $post->post_latitude : '';
751
+		$related_parent_lon   = !empty($post->post_longitude) && geodir_is_page('detail') ? $post->post_longitude : '';
752 752
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
753 753
 
754 754
 		$related_listing_array = array();
755
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
756
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
755
+		if (get_option('geodir_add_related_listing_posttypes')) {
756
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
757 757
 		}
758
-		if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
758
+		if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
759 759
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
760 760
 		}
761 761
 
762
-		$is_display        = ! empty( $arr_detail_page_tabs['related_listing'] ) && isset( $arr_detail_page_tabs['related_listing']['is_display'] ) ? $arr_detail_page_tabs['related_listing']['is_display'] : false;
762
+		$is_display        = !empty($arr_detail_page_tabs['related_listing']) && isset($arr_detail_page_tabs['related_listing']['is_display']) ? $arr_detail_page_tabs['related_listing']['is_display'] : false;
763 763
 		$origi_post        = $post;
764 764
 		$post_type         = '';
765 765
 		$post_id           = '';
@@ -767,90 +767,90 @@  discard block
 block discarded – undo
767 767
 		$tax_field         = 'id';
768 768
 		$category          = array();
769 769
 
770
-		if ( isset( $_REQUEST['backandedit'] ) ) {
771
-			$post      = (object) $gd_session->get( 'listing' );
770
+		if (isset($_REQUEST['backandedit'])) {
771
+			$post      = (object) $gd_session->get('listing');
772 772
 			$post_type = $post->listing_type;
773
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
773
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
774 774
 				$post_id = $_REQUEST['pid'];
775 775
 			}
776
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
777
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
776
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
777
+			$post      = geodir_get_post_info($_REQUEST['pid']);
778 778
 			$post_type = $post->post_type;
779 779
 			$post_id   = $_REQUEST['pid'];
780
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
780
+		} elseif (isset($post->post_type) && $post->post_type != '') {
781 781
 			$post_type = $post->post_type;
782 782
 			$post_id   = $post->ID;
783 783
 		}
784 784
 
785
-		if ( $relate_to == 'category' ) {
785
+		if ($relate_to == 'category') {
786 786
 
787
-			$category_taxonomy = $post_type . $relate_to;
788
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
789
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
787
+			$category_taxonomy = $post_type.$relate_to;
788
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
789
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
790 790
 			}
791 791
 
792
-		} elseif ( $relate_to == 'tags' ) {
792
+		} elseif ($relate_to == 'tags') {
793 793
 
794
-			$category_taxonomy = $post_type . '_' . $relate_to;
795
-			if ( $post->post_tags != '' ) {
796
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
794
+			$category_taxonomy = $post_type.'_'.$relate_to;
795
+			if ($post->post_tags != '') {
796
+				$category = explode(',', trim($post->post_tags, ','));
797 797
 			}
798 798
 			$tax_field = 'name';
799 799
 		}
800 800
 
801 801
 		/* --- return false in invalid request --- */
802
-		if ( empty( $category ) ) {
802
+		if (empty($category)) {
803 803
 			return false;
804 804
 		}
805 805
 
806 806
 		$all_postypes = geodir_get_posttypes();
807 807
 
808
-		if ( ! in_array( $post_type, $all_postypes ) ) {
808
+		if (!in_array($post_type, $all_postypes)) {
809 809
 			return false;
810 810
 		}
811 811
 
812 812
 		/* --- return false in invalid request --- */
813 813
 
814 814
 		$location_url = '';
815
-		if ( $add_location_filter != '0' ) {
815
+		if ($add_location_filter != '0') {
816 816
 			$location_url             = array();
817
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
817
+			$geodir_show_location_url = get_option('geodir_show_location_url');
818 818
 
819
-			$gd_city = get_query_var( 'gd_city' );
819
+			$gd_city = get_query_var('gd_city');
820 820
 
821
-			if ( $gd_city ) {
822
-				$gd_country = get_query_var( 'gd_country' );
823
-				$gd_region  = get_query_var( 'gd_region' );
821
+			if ($gd_city) {
822
+				$gd_country = get_query_var('gd_country');
823
+				$gd_region  = get_query_var('gd_region');
824 824
 			} else {
825 825
 				$location = geodir_get_default_location();
826 826
 
827
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
828
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
829
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
827
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
828
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
829
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
830 830
 			}
831 831
 
832
-			if ( $geodir_show_location_url == 'all' ) {
832
+			if ($geodir_show_location_url == 'all') {
833 833
 				$location_url[] = $gd_country;
834 834
 				$location_url[] = $gd_region;
835
-			} else if ( $geodir_show_location_url == 'country_city' ) {
835
+			} else if ($geodir_show_location_url == 'country_city') {
836 836
 				$location_url[] = $gd_country;
837
-			} else if ( $geodir_show_location_url == 'region_city' ) {
837
+			} else if ($geodir_show_location_url == 'region_city') {
838 838
 				$location_url[] = $gd_region;
839 839
 			}
840 840
 
841 841
 			$location_url[] = $gd_city;
842 842
 
843
-			$location_url = implode( '/', $location_url );
843
+			$location_url = implode('/', $location_url);
844 844
 		}
845 845
 
846 846
 
847
-		if ( ! empty( $category ) ) {
847
+		if (!empty($category)) {
848 848
 			global $geodir_add_location_url;
849 849
 			$geodir_add_location_url = '0';
850
-			if ( $add_location_filter != '0' ) {
850
+			if ($add_location_filter != '0') {
851 851
 				$geodir_add_location_url = '1';
852 852
 			}
853
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
853
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
854 854
 			$geodir_add_location_url = null;
855 855
 		}
856 856
 		ob_start();
@@ -860,24 +860,24 @@  discard block
 block discarded – undo
860 860
 		<div class="geodir_locations geodir_location_listing">
861 861
 
862 862
 			<?php
863
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
863
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
864 864
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
865
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
865
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
866 866
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
867
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
867
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
868 868
 				?>
869 869
 				<div class="location_list_heading clearfix">
870
-					<?php echo $before_title . $title . $after_title; ?>
870
+					<?php echo $before_title.$title.$after_title; ?>
871 871
 				</div>
872 872
 				<?php
873 873
 			}
874 874
 			$query_args = array(
875 875
 				'posts_per_page'   => $post_number,
876 876
 				'is_geodir_loop'   => true,
877
-				'gd_location'      => ( $add_location_filter ) ? true : false,
877
+				'gd_location'      => ($add_location_filter) ? true : false,
878 878
 				'post_type'        => $post_type,
879 879
 				'order_by'         => $list_sort,
880
-				'post__not_in'     => array( $post_id ),
880
+				'post__not_in'     => array($post_id),
881 881
 				'excerpt_length'   => $character_count,
882 882
 				'related_listings' => $is_display
883 883
 			);
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 				'terms'    => $category
889 889
 			);
890 890
 
891
-			$query_args['tax_query'] = array( $tax_query );
891
+			$query_args['tax_query'] = array($tax_query);
892 892
 
893 893
 			global $gridview_columns_widget, $post;
894 894
 
@@ -900,21 +900,21 @@  discard block
 block discarded – undo
900 900
 			 * @param array $query_args The query array.
901 901
 			 * @param array $request Related posts request array.
902 902
 			 */
903
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
903
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
904 904
 
905
-			query_posts( $query_args );
905
+			query_posts($query_args);
906 906
 
907
-			if ( strstr( $layout, 'gridview' ) ) {
908
-				$listing_view_exp = explode( '_', $layout );
907
+			if (strstr($layout, 'gridview')) {
908
+				$listing_view_exp = explode('_', $layout);
909 909
 				$gridview_columns_widget = $layout;
910 910
 				$layout           = $listing_view_exp[0];
911
-			} else if ( $layout == 'list' ) {
911
+			} else if ($layout == 'list') {
912 912
 				$gridview_columns_widget = '';
913 913
 			}
914 914
 			$related_posts = true;
915 915
 
916 916
 			$related_nearest = false;
917
-			if ( $list_sort == 'nearest' ) {
917
+			if ($list_sort == 'nearest') {
918 918
 				$related_nearest = true;
919 919
 			}
920 920
 
@@ -931,14 +931,14 @@  discard block
 block discarded – undo
931 931
 			 *
932 932
 			 * @since 1.0.0
933 933
 			 */
934
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
934
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('widget-listing-listview'));
935 935
 
936 936
 			/**
937 937
 			 * Includes related listing listview template.
938 938
 			 *
939 939
 			 * @since 1.0.0
940 940
 			 */
941
-			include( $template );
941
+			include($template);
942 942
 
943 943
 			wp_reset_query();
944 944
 			$post            = $origi_post;
@@ -966,12 +966,12 @@  discard block
 block discarded – undo
966 966
 function geodir_category_count_script() {
967 967
 	global $geodir_post_category_str;
968 968
 
969
-	if ( ! empty( $geodir_post_category_str ) ) {
970
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
969
+	if (!empty($geodir_post_category_str)) {
970
+		$geodir_post_category_str = serialize($geodir_post_category_str);
971 971
 	}
972 972
 
973
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
974
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
973
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
974
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
975 975
 	echo '<script>';
976 976
 	echo $script;
977 977
 	echo '</script>';
@@ -986,8 +986,8 @@  discard block
 block discarded – undo
986 986
  * @return string Returns the default language.
987 987
  */
988 988
 function geodir_get_map_default_language() {
989
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
990
-	if ( empty( $geodir_default_map_language ) ) {
989
+	$geodir_default_map_language = get_option('geodir_default_map_language');
990
+	if (empty($geodir_default_map_language)) {
991 991
 		$geodir_default_map_language = 'en';
992 992
 	}
993 993
 
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 	 *
999 999
 	 * @param string $geodir_default_map_language Default map language.
1000 1000
 	 */
1001
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
1001
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
1002 1002
 }
1003 1003
 
1004 1004
 /**
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
  * @return string Returns the api key.
1010 1010
  */
1011 1011
 function geodir_get_map_api_key() {
1012
-	$key = get_option( 'geodir_google_api_key' );
1012
+	$key = get_option('geodir_google_api_key');
1013 1013
 
1014 1014
 	/**
1015 1015
 	 * Filter Google maps api key.
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 	 *
1019 1019
 	 * @param string $key Google maps api key.
1020 1020
 	 */
1021
-	return apply_filters( 'geodir_google_api_key', $key );
1021
+	return apply_filters('geodir_google_api_key', $key);
1022 1022
 }
1023 1023
 
1024 1024
 
@@ -1038,20 +1038,20 @@  discard block
 block discarded – undo
1038 1038
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1039 1039
 
1040 1040
 	$is_geodir_page = geodir_is_geodir_page();
1041
-	if ( ! $is_geodir_page ) {
1041
+	if (!$is_geodir_page) {
1042 1042
 		return;
1043 1043
 	}// if non GD page, bail
1044 1044
 
1045 1045
 	$use_gd_meta = true;
1046
-	if ( ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) && !geodir_disable_yoast_seo_metas() ) {
1046
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1047 1047
 		$use_gd_meta = false;
1048 1048
 
1049
-		if ( geodir_is_page( 'search' ) ) {
1049
+		if (geodir_is_page('search')) {
1050 1050
 			$use_gd_meta = true;
1051 1051
 		}
1052 1052
 	}
1053 1053
 
1054
-	if ( ! $use_gd_meta ) {
1054
+	if (!$use_gd_meta) {
1055 1055
 		return;
1056 1056
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1057 1057
 
@@ -1059,68 +1059,68 @@  discard block
 block discarded – undo
1059 1059
 
1060 1060
 	$all_postypes = geodir_get_posttypes();
1061 1061
 
1062
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1062
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1063 1063
 
1064 1064
 	$meta_desc = '';
1065 1065
 	$meta_key  = '';
1066
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1066
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1067 1067
 		/**
1068 1068
 		 * Filter SEO meta location description.
1069 1069
 		 *
1070 1070
 		 * @since 1.0.0
1071 1071
 		 */
1072
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1072
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1073 1073
 		$meta_desc .= '';
1074 1074
 	}
1075
-	if ( have_posts() && is_single() OR is_page() ) {
1076
-		while ( have_posts() ) {
1075
+	if (have_posts() && is_single() OR is_page()) {
1076
+		while (have_posts()) {
1077 1077
 			the_post();
1078 1078
 
1079
-			if ( has_excerpt() ) {
1080
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1081
-				if ( empty( $out_excerpt ) ) {
1082
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1079
+			if (has_excerpt()) {
1080
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1081
+				if (empty($out_excerpt)) {
1082
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1083 1083
 				}
1084
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1084
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1085 1085
 			} else {
1086
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1087
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1088
-				if ( empty( $out_excerpt ) ) {
1089
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1086
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1087
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1088
+				if (empty($out_excerpt)) {
1089
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1090 1090
 				}
1091
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1091
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1092 1092
 			}
1093 1093
 
1094 1094
 			$meta_desc .= $out_excerpt;
1095 1095
 		}
1096
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1097
-		if ( is_category() ) {
1098
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) );
1099
-		} elseif ( is_tag() ) {
1100
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) );
1096
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1097
+		if (is_category()) {
1098
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false));
1099
+		} elseif (is_tag()) {
1100
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false));
1101 1101
 		}
1102
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1103
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1102
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1103
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1104 1104
 	}
1105 1105
 
1106 1106
 
1107 1107
 	$geodir_post_type       = geodir_get_current_posttype();
1108
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1109
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1110
-
1111
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1112
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1113
-
1114
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1115
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1116
-
1117
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1118
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1119
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1120
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1121
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1122
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1123
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1108
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1109
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1110
+
1111
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1112
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1113
+
1114
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1115
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1116
+
1117
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1118
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1119
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1120
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1121
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1122
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1123
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1124 1124
 	/**
1125 1125
 	 * Filter the Everywhere text in location description.
1126 1126
 	 *
@@ -1128,108 +1128,108 @@  discard block
 block discarded – undo
1128 1128
 	 *
1129 1129
 	 * @param string $replace_location Everywhere text.
1130 1130
 	 */
1131
-	$replace_location        = apply_filters( 'geodir_location_description_everywhere_text', __( 'Everywhere', 'geodirectory' ) );
1131
+	$replace_location        = apply_filters('geodir_location_description_everywhere_text', __('Everywhere', 'geodirectory'));
1132 1132
 	$location_id             = null;
1133
-	if ( $geodir_location_manager ) {
1134
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1135
-		$location_id   = (int) $wpdb->get_var( $sql );
1133
+	if ($geodir_location_manager) {
1134
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1135
+		$location_id   = (int) $wpdb->get_var($sql);
1136 1136
 		$location_type = geodir_what_is_current_location();
1137
-		if ( $location_type == 'city' ) {
1138
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1139
-		} elseif ( $location_type == 'region' ) {
1140
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1141
-		} elseif ( $location_type == 'country' ) {
1142
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1143
-			$replace_location = __( $replace_location, 'geodirectory' );
1144
-		}
1145
-		$country          = get_query_var( 'gd_country' );
1146
-		$region           = get_query_var( 'gd_region' );
1147
-		$city             = get_query_var( 'gd_city' );
1137
+		if ($location_type == 'city') {
1138
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1139
+		} elseif ($location_type == 'region') {
1140
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1141
+		} elseif ($location_type == 'country') {
1142
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1143
+			$replace_location = __($replace_location, 'geodirectory');
1144
+		}
1145
+		$country          = get_query_var('gd_country');
1146
+		$region           = get_query_var('gd_region');
1147
+		$city             = get_query_var('gd_city');
1148 1148
 		$current_location = '';
1149
-		if ( $country != '' ) {
1150
-			$current_location = get_actual_location_name( 'country', $country, true );
1149
+		if ($country != '') {
1150
+			$current_location = get_actual_location_name('country', $country, true);
1151 1151
 		}
1152
-		if ( $region != '' ) {
1153
-			$current_location = get_actual_location_name( 'region', $region );
1152
+		if ($region != '') {
1153
+			$current_location = get_actual_location_name('region', $region);
1154 1154
 		}
1155
-		if ( $city != '' ) {
1156
-			$current_location = get_actual_location_name( 'city', $city );
1155
+		if ($city != '') {
1156
+			$current_location = get_actual_location_name('city', $city);
1157 1157
 		}
1158 1158
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1159 1159
 	}
1160 1160
 
1161 1161
 	$geodir_meta_keys = '';
1162 1162
 	$geodir_meta_desc = '';
1163
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1164
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1165
-			$geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1163
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1164
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1165
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1166 1166
 
1167
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1168
-			$geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1167
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1168
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1169 1169
 
1170
-			if ( $geodir_is_category ) {
1171
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1172
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1170
+			if ($geodir_is_category) {
1171
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1172
+				if (isset($category->term_id) && !empty($category->term_id)) {
1173 1173
 					$category_id   = $category->term_id;
1174
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : geodir_get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1175
-					if ( $location_id ) {
1176
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1177
-						$cat_loc_option = get_option( $option_name );
1178
-
1179
-						$gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1180
-						if ( ! $gd_cat_loc_default ) {
1181
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1182
-							$option        = get_option( $option_name );
1183
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1174
+					$category_desc = trim($category->description) != '' ? trim($category->description) : geodir_get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1175
+					if ($location_id) {
1176
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1177
+						$cat_loc_option = get_option($option_name);
1178
+
1179
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1180
+						if (!$gd_cat_loc_default) {
1181
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1182
+							$option        = get_option($option_name);
1183
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1184 1184
 						}
1185 1185
 					}
1186
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1186
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)).'. '.$category_desc;
1187 1187
 				}
1188
-			} else if ( $geodir_is_tag ) {
1189
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1188
+			} else if ($geodir_is_tag) {
1189
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1190 1190
 			}
1191 1191
 		}
1192 1192
 	}
1193 1193
 
1194 1194
 
1195 1195
 	$gd_page = '';
1196
-	if ( geodir_is_page( 'home' ) ) {
1196
+	if (geodir_is_page('home')) {
1197 1197
 		$gd_page   = 'home';
1198
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1199
-	} elseif ( geodir_is_page( 'detail' ) ) {
1198
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1199
+	} elseif (geodir_is_page('detail')) {
1200 1200
 		$gd_page   = 'detail';
1201
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1202
-	} elseif ( geodir_is_page( 'pt' ) ) {
1201
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1202
+	} elseif (geodir_is_page('pt')) {
1203 1203
 		$gd_page   = 'pt';
1204
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1205
-	} elseif ( geodir_is_page( 'listing' ) ) {
1204
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1205
+	} elseif (geodir_is_page('listing')) {
1206 1206
 		$gd_page   = 'listing';
1207
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1208
-	} elseif ( geodir_is_page( 'location' ) ) {
1207
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1208
+	} elseif (geodir_is_page('location')) {
1209 1209
 		$gd_page   = 'location';
1210
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1211
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1210
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1211
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1212 1212
 
1213
-	} elseif ( geodir_is_page( 'search' ) ) {
1213
+	} elseif (geodir_is_page('search')) {
1214 1214
 		$gd_page   = 'search';
1215
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1216
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1215
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1216
+	} elseif (geodir_is_page('add-listing')) {
1217 1217
 		$gd_page   = 'add-listing';
1218
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1219
-	} elseif ( geodir_is_page( 'author' ) ) {
1218
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1219
+	} elseif (geodir_is_page('author')) {
1220 1220
 		$gd_page   = 'author';
1221
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1222
-	} elseif ( geodir_is_page( 'login' ) ) {
1221
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1222
+	} elseif (geodir_is_page('login')) {
1223 1223
 		$gd_page   = 'login';
1224
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1225
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1224
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1225
+	} elseif (geodir_is_page('listing-success')) {
1226 1226
 		$gd_page   = 'listing-success';
1227
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1227
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1228 1228
 	}
1229 1229
 
1230 1230
 
1231
-	if ( $meta_desc ) {
1232
-		$meta_desc = stripslashes_deep( $meta_desc );
1231
+	if ($meta_desc) {
1232
+		$meta_desc = stripslashes_deep($meta_desc);
1233 1233
 		/**
1234 1234
 		 * Filter page description to replace variables.
1235 1235
 		 *
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 		 * @param string $title   The page description including variables.
1239 1239
 		 * @param string $gd_page The GeoDirectory page type if any.
1240 1240
 		 */
1241
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1241
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1242 1242
 
1243 1243
 		/**
1244 1244
 		 * Filter SEO meta description.
@@ -1247,20 +1247,20 @@  discard block
 block discarded – undo
1247 1247
 		 *
1248 1248
 		 * @param string $meta_desc Meta description content.
1249 1249
 		 */
1250
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1250
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1251 1251
 	}
1252 1252
 
1253 1253
 	// meta keywords
1254
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1255
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1256
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1254
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1255
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1256
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1257 1257
 
1258
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1258
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1259 1259
 	} else {
1260 1260
 		$posttags = get_the_tags();
1261
-		if ( $posttags ) {
1262
-			foreach ( $posttags as $tag ) {
1263
-				$meta_key .= $tag->name . ' ';
1261
+		if ($posttags) {
1262
+			foreach ($posttags as $tag) {
1263
+				$meta_key .= $tag->name.' ';
1264 1264
 			}
1265 1265
 		} else {
1266 1266
 //			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
@@ -1276,20 +1276,20 @@  discard block
 block discarded – undo
1276 1276
 		}
1277 1277
 	}
1278 1278
 
1279
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1280
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1281
-	if ( $geodir_meta_keys != '' ) {
1282
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1283
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1284
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1285
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1286
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1279
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1280
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1281
+	if ($geodir_meta_keys != '') {
1282
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1283
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1284
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1285
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1286
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1287 1287
 
1288
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1288
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1289 1289
 	}
1290 1290
 
1291
-	if ( $meta_key ) {
1292
-		$meta_key = stripslashes_deep( $meta_key );
1291
+	if ($meta_key) {
1292
+		$meta_key = stripslashes_deep($meta_key);
1293 1293
 		/**
1294 1294
 		 * Filter SEO meta keywords.
1295 1295
 		 *
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 		 *
1298 1298
 		 * @param string $meta_desc Meta keywords.
1299 1299
 		 */
1300
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1300
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1301 1301
 	}
1302 1302
 
1303 1303
 }
@@ -1317,8 +1317,8 @@  discard block
 block discarded – undo
1317 1317
 
1318 1318
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1319 1319
 
1320
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1321
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1320
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1321
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1322 1322
 	}
1323 1323
 
1324 1324
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1340,57 +1340,57 @@  discard block
 block discarded – undo
1340 1340
 	 * @since 1.0.0
1341 1341
 	 */
1342 1342
 	$arr_tabs['post_profile'] = array(
1343
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1343
+		'heading_text'  => __('Profile', 'geodirectory'),
1344 1344
 		'is_active_tab' => true,
1345
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1345
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1346 1346
 		'tab_content'   => ''
1347 1347
 	);
1348
-	$arr_tabs['post_info']    = array(
1349
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1348
+	$arr_tabs['post_info'] = array(
1349
+		'heading_text'  => __('More Info', 'geodirectory'),
1350 1350
 		'is_active_tab' => false,
1351
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1351
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1352 1352
 		'tab_content'   => ''
1353 1353
 	);
1354 1354
 
1355 1355
 	$arr_tabs['post_images'] = array(
1356
-		'heading_text'  => __( 'Photos', 'geodirectory' ),
1356
+		'heading_text'  => __('Photos', 'geodirectory'),
1357 1357
 		'is_active_tab' => false,
1358
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1358
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1359 1359
 		'tab_content'   => ''
1360 1360
 	);
1361 1361
 
1362 1362
 	$arr_tabs['post_video'] = array(
1363
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1363
+		'heading_text'  => __('Video', 'geodirectory'),
1364 1364
 		'is_active_tab' => false,
1365
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1365
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1366 1366
 		'tab_content'   => ''
1367 1367
 	);
1368 1368
 
1369 1369
 	$arr_tabs['special_offers'] = array(
1370
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1370
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1371 1371
 		'is_active_tab' => false,
1372
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1372
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1373 1373
 		'tab_content'   => ''
1374 1374
 	);
1375 1375
 
1376 1376
 	$arr_tabs['post_map'] = array(
1377
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1377
+		'heading_text'  => __('Map', 'geodirectory'),
1378 1378
 		'is_active_tab' => false,
1379
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1379
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1380 1380
 		'tab_content'   => ''
1381 1381
 	);
1382 1382
 
1383 1383
 	$arr_tabs['reviews'] = array(
1384
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1384
+		'heading_text'  => __('Reviews', 'geodirectory'),
1385 1385
 		'is_active_tab' => false,
1386
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1386
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1387 1387
 		'tab_content'   => 'review display'
1388 1388
 	);
1389 1389
 
1390 1390
 	$arr_tabs['related_listing'] = array(
1391
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1391
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1392 1392
 		'is_active_tab' => false,
1393
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1393
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1394 1394
 		'tab_content'   => ''
1395 1395
 	);
1396 1396
 
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 	 *
1400 1400
 	 * @since 1.0.0
1401 1401
 	 */
1402
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1402
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1403 1403
 
1404 1404
 
1405 1405
 }
@@ -1413,13 +1413,13 @@  discard block
 block discarded – undo
1413 1413
  * @return mixed|array Tabs array.
1414 1414
  */
1415 1415
 function geodir_detail_page_tabs_list() {
1416
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1416
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1417 1417
 	$tabs_array    = geodir_detail_page_tabs_array();
1418 1418
 
1419
-	if ( ! empty( $tabs_excluded ) ) {
1420
-		foreach ( $tabs_excluded as $tab ) {
1421
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1422
-				unset( $tabs_array[ $tab ] );
1419
+	if (!empty($tabs_excluded)) {
1420
+		foreach ($tabs_excluded as $tab) {
1421
+			if (array_key_exists($tab, $tabs_array)) {
1422
+				unset($tabs_array[$tab]);
1423 1423
 			}
1424 1424
 		}
1425 1425
 	}
@@ -1443,66 +1443,66 @@  discard block
 block discarded – undo
1443 1443
 function geodir_show_detail_page_tabs() {
1444 1444
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1445 1445
 
1446
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1447
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1448
-	$is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend
1446
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1447
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1448
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1449 1449
 
1450
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1451
-		$post = geodir_get_post_info( $request_post_id );
1452
-		setup_postdata( $post );
1450
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1451
+		$post = geodir_get_post_info($request_post_id);
1452
+		setup_postdata($post);
1453 1453
 	}
1454 1454
 
1455
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1455
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1456 1456
 
1457 1457
 	$package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1458 1458
 	$image_limit = '';
1459 1459
 	if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1460
-		$image_limit = (int)$package_info->image_limit;
1460
+		$image_limit = (int) $package_info->image_limit;
1461 1461
 	}
1462 1462
 
1463
-	if ( geodir_is_page( 'detail' ) ) {
1464
-		$video                 = geodir_get_video( $post->ID );
1465
-		$special_offers        = geodir_get_special_offers( $post->ID );
1463
+	if (geodir_is_page('detail')) {
1464
+		$video                 = geodir_get_video($post->ID);
1465
+		$special_offers        = geodir_get_special_offers($post->ID);
1466 1466
 		$related_listing_array = array();
1467
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1468
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1467
+		if (get_option('geodir_add_related_listing_posttypes')) {
1468
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1469 1469
 		}
1470 1470
 
1471
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1472
-		if ( ! $excluded_tabs ) {
1471
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1472
+		if (!$excluded_tabs) {
1473 1473
 			$excluded_tabs = array();
1474 1474
 		}
1475 1475
 
1476 1476
 		$related_listing = '';
1477
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1477
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1478 1478
 			$request = array(
1479
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1480
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1481
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1482
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1483
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1484
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1479
+				'post_number'         => get_option('geodir_related_post_count'),
1480
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1481
+				'layout'              => get_option('geodir_related_post_listing_view'),
1482
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1483
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1484
+				'character_count'     => get_option('geodir_related_post_excerpt')
1485 1485
 			);
1486 1486
 
1487
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1488
-				$related_listing = geodir_get_detail_page_related_events( $request );
1487
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1488
+				$related_listing = geodir_get_detail_page_related_events($request);
1489 1489
 			} else {
1490
-				$related_listing = geodir_related_posts_display( $request );
1490
+				$related_listing = geodir_related_posts_display($request);
1491 1491
 			}
1492 1492
 
1493 1493
 		}
1494 1494
 
1495
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1495
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1496 1496
 		$thumb_image = '';
1497
-		if ( ! empty( $post_images ) ) {
1497
+		if (!empty($post_images)) {
1498 1498
 			$count = 1;
1499
-			foreach ( $post_images as $image ) {
1499
+			foreach ($post_images as $image) {
1500 1500
 				if ($image_limit !== '' && $count > $image_limit) {
1501 1501
 					break;
1502 1502
 				}
1503
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1504
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1505
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1503
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1504
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1505
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1506 1506
 				$thumb_image .= '</a>';
1507 1507
 				$count++;
1508 1508
 			}
@@ -1512,11 +1512,11 @@  discard block
 block discarded – undo
1512 1512
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1513 1513
 		$map_args['width']           = '600';
1514 1514
 		$map_args['height']          = '300';
1515
-		if ( $post->post_mapzoom ) {
1516
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1515
+		if ($post->post_mapzoom) {
1516
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1517 1517
 		}
1518 1518
 		$map_args['autozoom']                 = false;
1519
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1519
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1520 1520
 		$map_args['child_collapse']           = '0';
1521 1521
 		$map_args['enable_cat_filters']       = false;
1522 1522
 		$map_args['enable_text_search']       = false;
@@ -1525,29 +1525,29 @@  discard block
 block discarded – undo
1525 1525
 		$map_args['enable_jason_on_load']     = true;
1526 1526
 		$map_args['enable_map_direction']     = true;
1527 1527
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1528
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1529
-	} else if ( geodir_is_page( 'preview' ) ) {
1530
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1531
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1528
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1529
+	} else if (geodir_is_page('preview')) {
1530
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1531
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1532 1532
 
1533
-		if ( isset( $post->post_images ) ) {
1534
-			$post->post_images = trim( $post->post_images, "," );
1533
+		if (isset($post->post_images)) {
1534
+			$post->post_images = trim($post->post_images, ",");
1535 1535
 		}
1536 1536
 
1537
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1538
-			$post_images = explode( ",", $post->post_images );
1537
+		if (isset($post->post_images) && !empty($post->post_images)) {
1538
+			$post_images = explode(",", $post->post_images);
1539 1539
 		}
1540 1540
 
1541 1541
 		$thumb_image = '';
1542
-		if ( ! empty( $post_images ) ) {
1542
+		if (!empty($post_images)) {
1543 1543
 			$count = 1;
1544
-			foreach ( $post_images as $image ) {
1545
-				if ( $image != '' ) {
1544
+			foreach ($post_images as $image) {
1545
+				if ($image != '') {
1546 1546
 					if ($image_limit !== '' && $count > $image_limit) {
1547 1547
 						break;
1548 1548
 					}
1549
-					$thumb_image .= '<a href="' . $image . '">';
1550
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1549
+					$thumb_image .= '<a href="'.$image.'">';
1550
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1551 1551
 					$thumb_image .= '</a>';
1552 1552
 					$count++;
1553 1553
 				}
@@ -1555,18 +1555,18 @@  discard block
 block discarded – undo
1555 1555
 		}
1556 1556
 
1557 1557
 		global $map_jason;
1558
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1559
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1560
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1558
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1559
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1560
+		$icon_size        = geodir_get_marker_size($marker_icon);
1561 1561
 		$marker_json['w'] = $icon_size['w'];
1562 1562
 		$marker_json['h'] = $icon_size['h'];
1563
-		$map_jason[]      = json_encode( $marker_json );
1563
+		$map_jason[]      = json_encode($marker_json);
1564 1564
 
1565
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1566
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1567
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1568
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1569
-		if ( ! $mapzoom ) {
1565
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1566
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1567
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1568
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1569
+		if (!$mapzoom) {
1570 1570
 			$mapzoom = 12;
1571 1571
 		}
1572 1572
 
@@ -1589,37 +1589,37 @@  discard block
 block discarded – undo
1589 1589
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1590 1590
 	}
1591 1591
 
1592
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1592
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1593 1593
 
1594 1594
 	$active_tab       = '';
1595 1595
 	$active_tab_name  = '';
1596 1596
 	$default_tab      = '';
1597 1597
 	$default_tab_name = '';
1598
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1599
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1598
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1599
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1600 1600
 			$active_tab      = $tab_index;
1601
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1601
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1602 1602
 		}
1603 1603
 
1604
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1604
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1605 1605
 			$default_tab      = $tab_index;
1606
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1606
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1607 1607
 		}
1608 1608
 	}
1609 1609
 
1610
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab as a active tab if not any tab is active.
1611
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1612
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1610
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab as a active tab if not any tab is active.
1611
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1612
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1613 1613
 		}
1614 1614
 
1615
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1615
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1616 1616
 		$active_tab                                            = $default_tab;
1617 1617
 		$active_tab_name                                       = $default_tab_name;
1618 1618
 	}
1619
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1619
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1620 1620
 	?>
1621 1621
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1622
-		<?php if ( ! $tab_list ){ ?>
1622
+		<?php if (!$tab_list) { ?>
1623 1623
 		<div id="geodir-tab-mobile-menu">
1624 1624
 			<i class="fas fa-bars"></i>
1625 1625
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1634,26 +1634,26 @@  discard block
 block discarded – undo
1634 1634
 			 * @since 1.0.0
1635 1635
 			 * @see   'geodir_after_tab_list'
1636 1636
 			 */
1637
-			do_action( 'geodir_before_tab_list' ); ?>
1637
+			do_action('geodir_before_tab_list'); ?>
1638 1638
 			<?php
1639 1639
 
1640
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1641
-				if ( $detail_page_tab['is_display'] ) {
1640
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1641
+				if ($detail_page_tab['is_display']) {
1642 1642
 
1643
-					if ( ! $tab_list ) {
1643
+					if (!$tab_list) {
1644 1644
 						?>
1645 1645
 						<dt></dt> <!-- added to comply with validation -->
1646
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1646
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1647 1647
 								data-tab="#<?php echo $tab_index; ?>"
1648
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1648
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1649 1649
 						</dd>
1650 1650
 						<?php
1651 1651
 					}
1652 1652
 					ob_start() // start tab content buffering
1653 1653
 					?>
1654 1654
 					<li id="<?php echo $tab_index; ?>Tab">
1655
-						<?php if ( $tab_list ) {
1656
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1655
+						<?php if ($tab_list) {
1656
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1657 1657
 							/**
1658 1658
 							 * Filter the tab list title html.
1659 1659
 							 *
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
 							 * @param string $tab_index      The tab index type.
1664 1664
 							 * @param array $detail_page_tab The array of values including title text.
1665 1665
 							 */
1666
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1666
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1667 1667
 						} ?>
1668 1668
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1669 1669
 						<?php
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
 						 *
1675 1675
 						 * @param string $tab_index The tab name ID.
1676 1676
 						 */
1677
-						do_action( 'geodir_before_tab_content', $tab_index );
1677
+						do_action('geodir_before_tab_content', $tab_index);
1678 1678
 
1679 1679
 						/**
1680 1680
 						 * Called before the details tab content is output per tab.
@@ -1684,21 +1684,21 @@  discard block
 block discarded – undo
1684 1684
 						 * @since 1.0.0
1685 1685
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1686 1686
 						 */
1687
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1687
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1688 1688
 						/// write a code to generate content of each tab
1689
-						switch ( $tab_index ) {
1689
+						switch ($tab_index) {
1690 1690
 							case 'post_profile':
1691 1691
 								/**
1692 1692
 								 * Called before the listing description content on the details page tab.
1693 1693
 								 *
1694 1694
 								 * @since 1.0.0
1695 1695
 								 */
1696
-								do_action( 'geodir_before_description_on_listing_detail' );
1697
-								if ( geodir_is_page( 'detail' ) ) {
1696
+								do_action('geodir_before_description_on_listing_detail');
1697
+								if (geodir_is_page('detail')) {
1698 1698
 									the_content();
1699 1699
 								} else {
1700 1700
 									/** This action is documented in geodirectory_template_actions.php */
1701
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1701
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1702 1702
 								}
1703 1703
 
1704 1704
 								/**
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
 								 *
1707 1707
 								 * @since 1.0.0
1708 1708
 								 */
1709
-								do_action( 'geodir_after_description_on_listing_detail' );
1709
+								do_action('geodir_after_description_on_listing_detail');
1710 1710
 								break;
1711 1711
 							case 'post_info':
1712 1712
 								echo $geodir_post_detail_fields;
@@ -1716,32 +1716,32 @@  discard block
 block discarded – undo
1716 1716
 								break;
1717 1717
 							case 'post_video':
1718 1718
 								// some browsers hide $_POST data if used for embeds so we replace with a placeholder
1719
-								if ( $preview ) {
1720
-									if ( $video ) {
1721
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fas fa-video\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1719
+								if ($preview) {
1720
+									if ($video) {
1721
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fas fa-video\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1722 1722
 									}
1723 1723
 								} else {
1724 1724
 
1725 1725
 									// stop payment manager filtering content length
1726
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1727
-									if ( false !== $filter_priority ) {
1728
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1726
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1727
+									if (false !== $filter_priority) {
1728
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1729 1729
 									}
1730 1730
 
1731 1731
 									/** This action is documented in geodirectory_template_actions.php */
1732
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1732
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1733 1733
 
1734
-									if ( false !== $filter_priority ) {
1735
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1734
+									if (false !== $filter_priority) {
1735
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1736 1736
 									}
1737 1737
 								}
1738 1738
 								break;
1739 1739
 							case 'special_offers':
1740
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1740
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1741 1741
 
1742 1742
 								break;
1743 1743
 							case 'post_map':
1744
-								geodir_draw_map( $map_args );
1744
+								geodir_draw_map($map_args);
1745 1745
 								break;
1746 1746
 							case 'reviews':
1747 1747
 								comments_template();
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
 								echo $related_listing;
1751 1751
 								break;
1752 1752
 							default: {
1753
-								if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
1753
+								if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1754 1754
 									echo $detail_page_tab['tab_content'];
1755 1755
 								}
1756 1756
 							}
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
 						 *
1763 1763
 						 * @since 1.0.0
1764 1764
 						 */
1765
-						do_action( 'geodir_after_tab_content', $tab_index );
1765
+						do_action('geodir_after_tab_content', $tab_index);
1766 1766
 
1767 1767
 						/**
1768 1768
 						 * Called after the details tab content is output per tab.
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 						 * @since 1.0.0
1773 1773
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1774 1774
 						 */
1775
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1775
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1776 1776
 						?> </li>
1777 1777
 					<?php
1778 1778
 					/**
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
 					 *
1781 1781
 					 * @since 1.0.0
1782 1782
 					 */
1783
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1783
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1784 1784
 				} // end of if for is_display
1785 1785
 			}// end of foreach
1786 1786
 
@@ -1790,14 +1790,14 @@  discard block
 block discarded – undo
1790 1790
 			 * @since 1.0.0
1791 1791
 			 * @see   'geodir_before_tab_list'
1792 1792
 			 */
1793
-			do_action( 'geodir_after_tab_list' );
1793
+			do_action('geodir_after_tab_list');
1794 1794
 			?>
1795
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1796
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1795
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1796
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1797 1797
 		    style="position:relative;">
1798 1798
 			<?php
1799
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1800
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1799
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1800
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1801 1801
 					echo $detail_page_tab['tab_content'];
1802 1802
 				}// end of if
1803 1803
 			}// end of foreach
@@ -1807,11 +1807,11 @@  discard block
 block discarded – undo
1807 1807
 			 *
1808 1808
 			 * @since 1.0.0
1809 1809
 			 */
1810
-			do_action( 'geodir_add_tab_content' ); ?>
1810
+			do_action('geodir_add_tab_content'); ?>
1811 1811
 		</ul>
1812 1812
 		<!--gd-tabs-content ul end-->
1813 1813
 	</div>
1814
-	<?php if ( ! $tab_list ) { ?>
1814
+	<?php if (!$tab_list) { ?>
1815 1815
 		<script>
1816 1816
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1817 1817
 				hashVal = window.location.hash;
@@ -1843,31 +1843,31 @@  discard block
 block discarded – undo
1843 1843
  *
1844 1844
  * @return mixed Image file.
1845 1845
  */
1846
-function geodir_exif( $file ) {
1847
-	if ( empty( $file ) || ! is_array( $file ) ) {
1846
+function geodir_exif($file) {
1847
+	if (empty($file) || !is_array($file)) {
1848 1848
 		return $file;
1849 1849
 	}
1850 1850
 
1851
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1852
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1851
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1852
+	if (!($file_path && file_exists($file_path))) {
1853 1853
 		return $file;
1854 1854
 	}
1855 1855
 	$file['file'] = $file_path;
1856 1856
 
1857
-	if ( ! file_is_valid_image( $file_path ) ) {
1857
+	if (!file_is_valid_image($file_path)) {
1858 1858
 		return $file; // Bail if file is not an image.
1859 1859
 	}
1860 1860
 
1861
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1861
+	if (!function_exists('wp_get_image_editor')) {
1862 1862
 		return $file;
1863 1863
 	}
1864 1864
 
1865 1865
 	$mime_type = $file['type'];
1866 1866
 	$exif      = array();
1867
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1867
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1868 1868
 		try {
1869
-			$exif = exif_read_data( $file_path );
1870
-		} catch ( Exception $e ) {
1869
+			$exif = exif_read_data($file_path);
1870
+		} catch (Exception $e) {
1871 1871
 			$exif = array();
1872 1872
 		}
1873 1873
 	}
@@ -1876,13 +1876,13 @@  discard block
 block discarded – undo
1876 1876
 	$flip        = false;
1877 1877
 	$modify      = false;
1878 1878
 	$orientation = 0;
1879
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1880
-		switch ( (int) $exif['Orientation'] ) {
1879
+	if (!empty($exif) && isset($exif['Orientation'])) {
1880
+		switch ((int) $exif['Orientation']) {
1881 1881
 			case 1:
1882 1882
 				// do nothing
1883 1883
 				break;
1884 1884
 			case 2:
1885
-				$flip   = array( false, true );
1885
+				$flip   = array(false, true);
1886 1886
 				$modify = true;
1887 1887
 				break;
1888 1888
 			case 3:
@@ -1891,13 +1891,13 @@  discard block
 block discarded – undo
1891 1891
 				$modify      = true;
1892 1892
 				break;
1893 1893
 			case 4:
1894
-				$flip   = array( true, false );
1894
+				$flip   = array(true, false);
1895 1895
 				$modify = true;
1896 1896
 				break;
1897 1897
 			case 5:
1898 1898
 				$orientation = - 90;
1899 1899
 				$rotate      = true;
1900
-				$flip        = array( false, true );
1900
+				$flip        = array(false, true);
1901 1901
 				$modify      = true;
1902 1902
 				break;
1903 1903
 			case 6:
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 			case 7:
1909 1909
 				$orientation = - 270;
1910 1910
 				$rotate      = true;
1911
-				$flip        = array( false, true );
1911
+				$flip        = array(false, true);
1912 1912
 				$modify      = true;
1913 1913
 				break;
1914 1914
 			case 8:
@@ -1934,31 +1934,31 @@  discard block
 block discarded – undo
1934 1934
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1935 1935
 	 * @param string $quality   Image mime type.
1936 1936
 	 */
1937
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1938
-	if ( $quality !== null ) {
1937
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1938
+	if ($quality !== null) {
1939 1939
 		$modify = true;
1940 1940
 	}
1941 1941
 
1942
-	if ( ! $modify ) {
1942
+	if (!$modify) {
1943 1943
 		return $file; // no change
1944 1944
 	}
1945 1945
 
1946
-	$image = wp_get_image_editor( $file_path );
1947
-	if ( ! is_wp_error( $image ) ) {
1948
-		if ( $rotate ) {
1949
-			$image->rotate( $orientation );
1946
+	$image = wp_get_image_editor($file_path);
1947
+	if (!is_wp_error($image)) {
1948
+		if ($rotate) {
1949
+			$image->rotate($orientation);
1950 1950
 		}
1951 1951
 
1952
-		if ( ! empty( $flip ) ) {
1953
-			$image->flip( $flip[0], $flip[1] );
1952
+		if (!empty($flip)) {
1953
+			$image->flip($flip[0], $flip[1]);
1954 1954
 		}
1955 1955
 
1956
-		if ( $quality !== null ) {
1957
-			$image->set_quality( (int) $quality );
1956
+		if ($quality !== null) {
1957
+			$image->set_quality((int) $quality);
1958 1958
 		}
1959 1959
 
1960
-		$result = $image->save( $file_path );
1961
-		if ( ! is_wp_error( $result ) ) {
1960
+		$result = $image->save($file_path);
1961
+		if (!is_wp_error($result)) {
1962 1962
 			$file['file']     = $result['path'];
1963 1963
 			$file['tmp_name'] = $result['path'];
1964 1964
 		}
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
  *
1987 1987
  * @return string Returns the recent reviews html.
1988 1988
  */
1989
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false ) {
1989
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false) {
1990 1990
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session, $table_prefix;
1991 1991
 	$tablecomments = $wpdb->comments;
1992 1992
 	$tableposts    = $wpdb->posts;
@@ -1996,17 +1996,17 @@  discard block
 block discarded – undo
1996 1996
 	$region_filter  = '';
1997 1997
 	$country_filter = '';
1998 1998
 
1999
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
2000
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
2001
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1999
+	if ($gd_session->get('gd_multi_location')) {
2000
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
2001
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
2002 2002
 		}
2003 2003
 
2004
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
2005
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
2004
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
2005
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
2006 2006
 		}
2007 2007
 
2008
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
2009
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
2008
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
2009
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
2010 2010
 		}
2011 2011
 	}
2012 2012
 
@@ -2017,84 +2017,84 @@  discard block
 block discarded – undo
2017 2017
 		$lang_code = ICL_LANGUAGE_CODE;
2018 2018
 
2019 2019
 		if ($lang_code) {
2020
-			$join .= " JOIN " . $table_prefix . "icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN " . $table_prefix . "icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
2021
-			$where .= " AND icltr2.language_code = '" . $lang_code . "' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2020
+			$join .= " JOIN ".$table_prefix."icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN ".$table_prefix."icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
2021
+			$where .= " AND icltr2.language_code = '".$lang_code."' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2022 2022
 		}
2023 2023
 	}
2024 2024
 
2025
-	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM " . GEODIR_REVIEW_TABLE . " AS r JOIN " . $wpdb->comments . " AS c ON c.comment_ID = r.comment_id JOIN " . $wpdb->posts . " AS p ON p.ID = c.comment_post_ID " . $join . " WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' " . $where . " ORDER BY r.post_date DESC, r.id DESC LIMIT ". $no_comments;
2025
+	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM ".GEODIR_REVIEW_TABLE." AS r JOIN ".$wpdb->comments." AS c ON c.comment_ID = r.comment_id JOIN ".$wpdb->posts." AS p ON p.ID = c.comment_post_ID ".$join." WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' ".$where." ORDER BY r.post_date DESC, r.id DESC LIMIT ".$no_comments;
2026 2026
 
2027
-	$comments = $wpdb->get_results( $request );
2027
+	$comments = $wpdb->get_results($request);
2028 2028
 
2029
-	foreach ( $comments as $comment ) {
2029
+	foreach ($comments as $comment) {
2030 2030
 		// Set the extra comment info needed.
2031
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
2031
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
2032 2032
 		$comment->comment_content      = $comment_extra->comment_content;
2033 2033
 		$comment->comment_author       = $comment_extra->comment_author;
2034 2034
 		$comment->comment_author_email = $comment_extra->comment_author_email;
2035 2035
 
2036 2036
 		$comment_id      = '';
2037 2037
 		$comment_id      = $comment->comment_ID;
2038
-		$comment_content = strip_tags( $comment->comment_content );
2038
+		$comment_content = strip_tags($comment->comment_content);
2039 2039
 
2040
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2040
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2041 2041
 
2042
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2042
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2043 2043
 		$comment_author_email = $comment->comment_author_email;
2044 2044
 		$comment_post_ID      = $comment->post_id;
2045 2045
 
2046
-		$post_title        = get_the_title( $comment_post_ID );
2047
-		$permalink         = get_permalink( $comment_post_ID );
2048
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2049
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2046
+		$post_title        = get_the_title($comment_post_ID);
2047
+		$permalink         = get_permalink($comment_post_ID);
2048
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2049
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2050 2050
 
2051
-		$comment_content_length = strlen( $comment_content );
2052
-		if ( $comment_content_length > $comment_lenth ) {
2053
-			$comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2051
+		$comment_content_length = strlen($comment_content);
2052
+		if ($comment_content_length > $comment_lenth) {
2053
+			$comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2054 2054
 		} else {
2055 2055
 			$comment_excerpt = $comment_content;
2056 2056
 		}
2057 2057
 
2058
-		if ( $comment->user_id ) {
2059
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2058
+		if ($comment->user_id) {
2059
+			$user_profile_url = get_author_posts_url($comment->user_id);
2060 2060
 		} else {
2061 2061
 			$user_profile_url = '';
2062 2062
 		}
2063 2063
 
2064
-		if ( $comment_id ) {
2064
+		if ($comment_id) {
2065 2065
 			$comments_echo .= '<li class="clearfix">';
2066
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2067
-			if ( function_exists( 'get_avatar' ) ) {
2068
-				if ( ! isset( $comment->comment_type ) ) {
2069
-					if ( $user_profile_url ) {
2070
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2066
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2067
+			if (function_exists('get_avatar')) {
2068
+				if (!isset($comment->comment_type)) {
2069
+					if ($user_profile_url) {
2070
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2071 2071
 					}
2072
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2073
-					if ( $user_profile_url ) {
2072
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2073
+					if ($user_profile_url) {
2074 2074
 						$comments_echo .= '</a>';
2075 2075
 					}
2076
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2077
-					if ( $user_profile_url ) {
2078
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2076
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2077
+					if ($user_profile_url) {
2078
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2079 2079
 					}
2080
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2080
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2081 2081
 				}
2082
-			} elseif ( function_exists( 'gravatar' ) ) {
2083
-				if ( $user_profile_url ) {
2084
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2082
+			} elseif (function_exists('gravatar')) {
2083
+				if ($user_profile_url) {
2084
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2085 2085
 				}
2086 2086
 				$comments_echo .= "<img src=\"";
2087
-				if ( '' == $comment->comment_type ) {
2088
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2089
-					if ( $user_profile_url ) {
2087
+				if ('' == $comment->comment_type) {
2088
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2089
+					if ($user_profile_url) {
2090 2090
 						$comments_echo .= '</a>';
2091 2091
 					}
2092
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2093
-					if ( $user_profile_url ) {
2094
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2092
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2093
+					if ($user_profile_url) {
2094
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2095 2095
 					}
2096
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2097
-					if ( $user_profile_url ) {
2096
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2097
+					if ($user_profile_url) {
2098 2098
 						$comments_echo .= '</a>';
2099 2099
 					}
2100 2100
 				}
@@ -2105,17 +2105,17 @@  discard block
 block discarded – undo
2105 2105
 
2106 2106
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2107 2107
 			$author_link = apply_filters('geodir_reviewer_content_author_link', true);
2108
-			if ( $comment->user_id && $author_link ) {
2109
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2108
+			if ($comment->user_id && $author_link) {
2109
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2110 2110
 			}
2111
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2112
-			if ( $comment->user_id && $author_link ) {
2111
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2112
+			if ($comment->user_id && $author_link) {
2113 2113
 				$comments_echo .= '</a>';
2114 2114
 			}
2115
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2116
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2117
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2118
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2115
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2116
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2117
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2118
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2119 2119
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2120 2120
 			$comments_echo .= '</p>';
2121 2121
 
@@ -2135,25 +2135,25 @@  discard block
 block discarded – undo
2135 2135
  * @return array Returns post categories as an array.
2136 2136
  */
2137 2137
 function geodir_home_map_cats_key_value_array() {
2138
-	$post_types = geodir_get_posttypes( 'object' );
2138
+	$post_types = geodir_get_posttypes('object');
2139 2139
 
2140 2140
 	$return = array();
2141
-	if ( ! empty( $post_types ) ) {
2142
-		foreach ( $post_types as $key => $post_type ) {
2143
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2144
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2145
-			$taxonomies     = geodir_get_taxonomies( $key );
2146
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2147
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2148
-
2149
-			if ( ! empty( $cat_terms ) ) {
2150
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2151
-
2152
-				foreach ( $cat_terms as $cat_term ) {
2153
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2141
+	if (!empty($post_types)) {
2142
+		foreach ($post_types as $key => $post_type) {
2143
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2144
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2145
+			$taxonomies     = geodir_get_taxonomies($key);
2146
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2147
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2148
+
2149
+			if (!empty($cat_terms)) {
2150
+				$return['optgroup_start-'.$key] = $post_type_name;
2151
+
2152
+				foreach ($cat_terms as $cat_term) {
2153
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2154 2154
 				}
2155 2155
 
2156
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2156
+				$return['optgroup_end-'.$key] = $post_type_name;
2157 2157
 			}
2158 2158
 		}
2159 2159
 	}
@@ -2169,14 +2169,14 @@  discard block
 block discarded – undo
2169 2169
  * @package GeoDirectory
2170 2170
  */
2171 2171
 function geodir_twitter_tweet_button() {
2172
-	if ( isset( $_GET['gde'] ) ) {
2173
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2172
+	if (isset($_GET['gde'])) {
2173
+		$link = '?url='.urlencode(geodir_curPageURL());
2174 2174
 	} else {
2175 2175
 		$link = '';
2176 2176
 	}
2177 2177
 	?>
2178 2178
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2179
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2179
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2180 2180
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2181 2181
 	<?php
2182 2182
 }
@@ -2193,10 +2193,10 @@  discard block
 block discarded – undo
2193 2193
 function geodir_fb_like_button() {
2194 2194
 	global $post;
2195 2195
 	?>
2196
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2196
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2197 2197
 		echo 'allowtransparency="true"';
2198 2198
 	} ?> class="facebook"
2199
-	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2199
+	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2200 2200
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2201 2201
 	<?php
2202 2202
 }
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
 
2228 2228
 
2229 2229
 function geodir_listing_bounce_map_pin_on_hover() {
2230
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2230
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2231 2231
 		?>
2232 2232
 		<script>
2233 2233
 			jQuery(function ($) {
@@ -2250,44 +2250,44 @@  discard block
 block discarded – undo
2250 2250
 	}
2251 2251
 }
2252 2252
 
2253
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2253
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2254 2254
 
2255
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2256
-function geodir_output_favourite_html_listings( $post_id ) {
2257
-	geodir_favourite_html( '', $post_id );
2255
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2256
+function geodir_output_favourite_html_listings($post_id) {
2257
+	geodir_favourite_html('', $post_id);
2258 2258
 }
2259 2259
 
2260
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2261
-function geodir_output_pinpoint_html_listings( $post_id, $post = array() ) {
2260
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2261
+function geodir_output_pinpoint_html_listings($post_id, $post = array()) {
2262 2262
 	global $wp_query;
2263 2263
 
2264 2264
 	$show_pin_point = $wp_query->is_main_query();
2265 2265
 
2266
-	if ( ! empty( $post ) && ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2267
-		$term_icon_url = geodir_get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2268
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2266
+	if (!empty($post) && !empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2267
+		$term_icon_url = geodir_get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2268
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2269 2269
 		?>
2270 2270
 		<span class="geodir-pinpoint"
2271
-		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
2271
+		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2272 2272
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2273 2273
 		   onclick="if(typeof openMarker=='function'){openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2274 2274
 		   onmouseover="if(typeof animate_marker=='function'){animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2275
-		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2275
+		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2276 2276
 		<?php
2277 2277
 	}
2278 2278
 }
2279 2279
 
2280 2280
 function geodir_search_form_submit_button() {
2281 2281
 
2282
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2282
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2283 2283
 
2284
-	if ( $new_style ) {
2284
+	if ($new_style) {
2285 2285
 		$default_search_button_label = '<i class="fas fa-search" aria-hidden="true"></i>';
2286
-	}else{
2286
+	} else {
2287 2287
 		$default_search_button_label = 'Search';
2288 2288
 	}
2289
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2290
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2289
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2290
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2291 2291
 	}
2292 2292
 
2293 2293
 	/**
@@ -2299,78 +2299,78 @@  discard block
 block discarded – undo
2299 2299
 	 *
2300 2300
 	 * @param string $default_search_button_label The current search button text.
2301 2301
 	 */
2302
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2302
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2303 2303
 
2304 2304
 	$fa_class = '';
2305
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2305
+	if (strpos($default_search_button_label, '&#') !== false) {
2306 2306
 		$fa_class = 'fa';
2307 2307
 	}
2308 2308
 
2309 2309
 
2310
-	if ( $new_style ) {
2310
+	if ($new_style) {
2311 2311
 		?>
2312
-		<button class="geodir_submit_search "><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2313
-	<?php }else{?>
2314
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2312
+		<button class="geodir_submit_search "><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2313
+	<?php } else {?>
2314
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2315 2315
 		       class="geodir_submit_search "/>
2316 2316
 	<?php }
2317 2317
 }
2318 2318
 
2319
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2319
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2320 2320
 
2321 2321
 function geodir_search_form_post_type_input() {
2322 2322
 	global $geodir_search_post_type;
2323
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2323
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2324 2324
 	$curr_post_type = $geodir_search_post_type;
2325 2325
 
2326
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2326
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2327 2327
 
2328
-		foreach ( $post_types as $post_type => $info ){
2328
+		foreach ($post_types as $post_type => $info) {
2329 2329
 			global $wpdb;
2330
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2331
-			if ( ! $has_posts ) {
2330
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2331
+			if (!$has_posts) {
2332 2332
 				unset($post_types->{$post_type});
2333 2333
 			}
2334 2334
 		}
2335 2335
 
2336
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2336
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2337 2337
 
2338
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2339
-			if ( $new_style ) {
2338
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2339
+			if ($new_style) {
2340 2340
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2341 2341
 			}
2342 2342
 			?>
2343 2343
 			<select name="stype" class="search_by_post">
2344
-				<?php foreach ( $post_types as $post_type => $info ):
2344
+				<?php foreach ($post_types as $post_type => $info):
2345 2345
 					global $wpdb;
2346 2346
 					?>
2347 2347
 
2348
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2349
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2350
-						if ( $post_type == $_REQUEST['stype'] ) {
2348
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2349
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2350
+						if ($post_type == $_REQUEST['stype']) {
2351 2351
 							echo 'selected="selected"';
2352 2352
 						}
2353
-					} elseif ( $curr_post_type == $post_type ) {
2353
+					} elseif ($curr_post_type == $post_type) {
2354 2354
 						echo 'selected="selected"';
2355
-					} ?>><?php _e( geodir_utf8_ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2355
+					} ?>><?php _e(geodir_utf8_ucfirst($info->labels->name), 'geodirectory'); ?></option>
2356 2356
 
2357 2357
 				<?php endforeach; ?>
2358 2358
 			</select>
2359 2359
 			<?php
2360
-			if ( $new_style ) {
2360
+			if ($new_style) {
2361 2361
 				echo "</div>";
2362 2362
 			}
2363
-		}else{
2364
-			if(! empty( $post_types )){
2365
-				$pt_arr = (array)$post_types;
2366
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2367
-			}else{
2363
+		} else {
2364
+			if (!empty($post_types)) {
2365
+				$pt_arr = (array) $post_types;
2366
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2367
+			} else {
2368 2368
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2369 2369
 			}
2370 2370
 
2371 2371
 		}
2372 2372
 
2373
-	}elseif ( ! empty( $post_types ) ) {
2373
+	}elseif (!empty($post_types)) {
2374 2374
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2375 2375
 	}
2376 2376
 }
@@ -2378,27 +2378,27 @@  discard block
 block discarded – undo
2378 2378
 function geodir_search_form_search_input() {
2379 2379
 
2380 2380
 	$default_search_for_text = SEARCH_FOR_TEXT;
2381
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2382
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2381
+	if (get_option('geodir_search_field_default_text')) {
2382
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2383 2383
 	}
2384 2384
 
2385 2385
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2386
-	if($new_style){
2386
+	if ($new_style) {
2387 2387
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2388 2388
 	}
2389 2389
 	?>
2390 2390
 	<input class="search_text" name="s"
2391
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2392
-		       $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2391
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2392
+		       $search_term = esc_attr(stripslashes_deep($_REQUEST['s']));
2393 2393
 		       echo $search_term;
2394 2394
 	       } else {
2395 2395
 		       echo $default_search_for_text;
2396 2396
 	       } ?>" type="text"
2397
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2398
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2397
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2398
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2399 2399
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2400 2400
 	<?php
2401
-	if($new_style){
2401
+	if ($new_style) {
2402 2402
 		echo "</div>";
2403 2403
 	}
2404 2404
 }
@@ -2406,12 +2406,12 @@  discard block
 block discarded – undo
2406 2406
 function geodir_search_form_near_input() {
2407 2407
 
2408 2408
 	$default_near_text = NEAR_TEXT;
2409
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2410
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2409
+	if (get_option('geodir_near_field_default_text')) {
2410
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2411 2411
 	}
2412 2412
 
2413
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2414
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2413
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2414
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2415 2415
 	} else {
2416 2416
 		$near = $default_near_text;
2417 2417
 	}
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
 	 * @since 1.6.9
2426 2426
 	 * @param string $curr_post_type The current post type.
2427 2427
 	 */
2428
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2428
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2429 2429
 
2430 2430
 
2431 2431
 	/**
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
 	 * @param string $near              The current near value.
2439 2439
 	 * @param string $default_near_text The default near value.
2440 2440
 	 */
2441
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2441
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2442 2442
 	/**
2443 2443
 	 * Filter the default "Near" text value for the search form.
2444 2444
 	 *
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
 	 * @param string $near              The current near value.
2450 2450
 	 * @param string $default_near_text The default near value.
2451 2451
 	 */
2452
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2452
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2453 2453
 	/**
2454 2454
 	 * Filter the class for the near search input.
2455 2455
 	 *
@@ -2457,10 +2457,10 @@  discard block
 block discarded – undo
2457 2457
 	 *
2458 2458
 	 * @param string $class The class for the HTML near input, default is blank.
2459 2459
 	 */
2460
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2460
+	$near_class = apply_filters('geodir_search_near_class', '');
2461 2461
 
2462 2462
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2463
-	if($new_style){
2463
+	if ($new_style) {
2464 2464
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2465 2465
 
2466 2466
 		do_action('geodir_before_near_input');
@@ -2468,30 +2468,30 @@  discard block
 block discarded – undo
2468 2468
 
2469 2469
 	?>
2470 2470
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2471
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2472
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2473
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2471
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2472
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2473
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2474 2474
 	<?php
2475
-	if($new_style){
2475
+	if ($new_style) {
2476 2476
 		do_action('geodir_after_near_input');
2477 2477
 
2478 2478
 		echo "</div>";
2479 2479
 	}
2480 2480
 }
2481 2481
 
2482
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2483
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2484
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2482
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2483
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2484
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2485 2485
 
2486
-function geodir_get_search_post_type($pt=''){
2486
+function geodir_get_search_post_type($pt = '') {
2487 2487
 	global $geodir_search_post_type;
2488 2488
 
2489
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2490
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2489
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2490
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2491 2491
 
2492 2492
 	$geodir_search_post_type = geodir_get_current_posttype();
2493 2493
 
2494
-	if(!$geodir_search_post_type) {
2494
+	if (!$geodir_search_post_type) {
2495 2495
 		$geodir_search_post_type = geodir_get_default_posttype();
2496 2496
 	}
2497 2497
 
@@ -2499,7 +2499,7 @@  discard block
 block discarded – undo
2499 2499
 	return $geodir_search_post_type;
2500 2500
 }
2501 2501
 
2502
-function geodir_search_form(){
2502
+function geodir_search_form() {
2503 2503
 
2504 2504
 	geodir_get_search_post_type();
2505 2505
 
@@ -2509,8 +2509,8 @@  discard block
 block discarded – undo
2509 2509
 	die();
2510 2510
 }
2511 2511
 
2512
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2513
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2512
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2513
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2514 2514
 
2515 2515
 /**
2516 2516
  * Check wpml active or not.
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
 		}
2585 2585
 	}
2586 2586
 }
2587
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2587
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2588 2588
 
2589 2589
 /**
2590 2590
  * Duplicate post listing manually after listing saved.
@@ -2608,7 +2608,7 @@  discard block
 block discarded – undo
2608 2608
 		foreach ($post_duplicates as $lang => $dup_post_id) {
2609 2609
 			geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2610 2610
 		}
2611
-		do_action( 'geodir_wpml_listing_duplicated', $post_id, $request_info );
2611
+		do_action('geodir_wpml_listing_duplicated', $post_id, $request_info);
2612 2612
 	}
2613 2613
 }
2614 2614
 
@@ -2627,7 +2627,7 @@  discard block
 block discarded – undo
2627 2627
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2628 2628
 	global $wpdb;
2629 2629
 
2630
-	$reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2630
+	$reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2631 2631
 
2632 2632
 	if (!empty($reviews)) {
2633 2633
 		foreach ($reviews as $review) {
@@ -2656,15 +2656,15 @@  discard block
 block discarded – undo
2656 2656
 	global $wpdb, $plugin_prefix;
2657 2657
 
2658 2658
 	$post_type = get_post_type($master_post_id);
2659
-	$post_table = $plugin_prefix . $post_type . '_detail';
2659
+	$post_table = $plugin_prefix.$post_type.'_detail';
2660 2660
 
2661
-	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2662
-	$data = (array)$wpdb->get_row($query);
2661
+	$query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
2662
+	$data = (array) $wpdb->get_row($query);
2663 2663
 
2664
-	if ( !empty( $data ) ) {
2665
-		$data = apply_filters( 'geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang );
2664
+	if (!empty($data)) {
2665
+		$data = apply_filters('geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang);
2666 2666
 		$data['post_id'] = $tr_post_id;
2667
-		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2667
+		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']);
2668 2668
 		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2669 2669
 		return true;
2670 2670
 	}
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
 	global $sitepress, $wpdb;
2690 2690
 	$post_type = get_post_type($master_post_id);
2691 2691
 
2692
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2692
+	remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
2693 2693
 
2694 2694
 	$taxonomies = get_object_taxonomies($post_type);
2695 2695
 	foreach ($taxonomies as $taxonomy) {
@@ -2698,9 +2698,9 @@  discard block
 block discarded – undo
2698 2698
 
2699 2699
 		if ($terms) {
2700 2700
 			foreach ($terms as $term) {
2701
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2701
+				$tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
2702 2702
 
2703
-				if (!is_null($tr_id)){
2703
+				if (!is_null($tr_id)) {
2704 2704
 					// not using get_term - unfiltered get_term
2705 2705
 					$translated_term = $wpdb->get_row($wpdb->prepare("
2706 2706
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -2709,14 +2709,14 @@  discard block
 block discarded – undo
2709 2709
 				}
2710 2710
 			}
2711 2711
 
2712
-			if (!is_taxonomy_hierarchical($taxonomy)){
2713
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
2712
+			if (!is_taxonomy_hierarchical($taxonomy)) {
2713
+				$terms_array = array_unique(array_map('intval', $terms_array));
2714 2714
 			}
2715 2715
 
2716 2716
 			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2717 2717
 
2718
-			if ($taxonomy == $post_type . 'category') {
2719
-				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2718
+			if ($taxonomy == $post_type.'category') {
2719
+				geodir_set_postcat_structure($tr_post_id, $post_type.'category');
2720 2720
 			}
2721 2721
 		}
2722 2722
 	}
@@ -2737,15 +2737,15 @@  discard block
 block discarded – undo
2737 2737
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2738 2738
 	global $wpdb;
2739 2739
 
2740
-	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2740
+	$query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2741 2741
 	$wpdb->query($query);
2742 2742
 
2743
-	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2743
+	$query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2744 2744
 	$post_images = $wpdb->get_results($query);
2745 2745
 
2746
-	if ( !empty( $post_images ) ) {
2747
-		foreach ( $post_images as $post_image) {
2748
-			$image_data = (array)$post_image;
2746
+	if (!empty($post_images)) {
2747
+		foreach ($post_images as $post_image) {
2748
+			$image_data = (array) $post_image;
2749 2749
 			unset($image_data['ID']);
2750 2750
 			$image_data['post_id'] = $tr_post_id;
2751 2751
 
@@ -2778,13 +2778,13 @@  discard block
 block discarded – undo
2778 2778
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2779 2779
 	global $wpdb, $plugin_prefix, $sitepress;
2780 2780
 
2781
-	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2781
+	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2782 2782
 
2783 2783
 	if (empty($review)) {
2784 2784
 		return false;
2785 2785
 	}
2786 2786
 	if ($review['post_id'] != $master_post_id) {
2787
-		$wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2787
+		$wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2788 2788
 		geodir_update_postrating($master_post_id, $post_type);
2789 2789
 	}
2790 2790
 
@@ -2795,9 +2795,9 @@  discard block
 block discarded – undo
2795 2795
 	}
2796 2796
 
2797 2797
 	$post_type = get_post_type($master_post_id);
2798
-	$post_table = $plugin_prefix . $post_type . '_detail';
2798
+	$post_table = $plugin_prefix.$post_type.'_detail';
2799 2799
 
2800
-	$translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2800
+	$translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A);
2801 2801
 	if (empty($translated_post)) {
2802 2802
 		return false;
2803 2803
 	}
@@ -2815,7 +2815,7 @@  discard block
 block discarded – undo
2815 2815
 		unset($review['id']);
2816 2816
 	}
2817 2817
 
2818
-	$tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2818
+	$tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2819 2819
 
2820 2820
 	if ($tr_review_id) { // update review
2821 2821
 		$wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
@@ -2828,8 +2828,8 @@  discard block
 block discarded – undo
2828 2828
 		geodir_update_postrating($tr_post_id, $post_type);
2829 2829
 
2830 2830
 		if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2831
-			$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2832
-			$likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2831
+			$wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
2832
+			$likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2833 2833
 
2834 2834
 			if (!empty($likes)) {
2835 2835
 				foreach ($likes as $like) {
@@ -2931,7 +2931,7 @@  discard block
 block discarded – undo
2931 2931
  * @return bool True if review star disabled, otherwise false.
2932 2932
  */
2933 2933
 function geodir_rating_disabled_post_types() {
2934
-	$post_types = get_option( 'geodir_disable_rating_cpt' );
2934
+	$post_types = get_option('geodir_disable_rating_cpt');
2935 2935
 
2936 2936
 	/**
2937 2937
 	 * Filter the post types array which have rating disabled.
@@ -2940,7 +2940,7 @@  discard block
 block discarded – undo
2940 2940
 	 *
2941 2941
 	 * @param array $post_types Array of post types which have rating starts disabled.
2942 2942
 	 */
2943
-	return apply_filters( 'geodir_rating_disabled_post_types', $post_types );
2943
+	return apply_filters('geodir_rating_disabled_post_types', $post_types);
2944 2944
 }
2945 2945
 
2946 2946
 /**
@@ -2952,30 +2952,30 @@  discard block
 block discarded – undo
2952 2952
  * @param bool $taxonomy Whether $post_type is taxonomy or not.
2953 2953
  * @return bool True if review star disabled, otherwise false.
2954 2954
  */
2955
-function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
2955
+function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
2956 2956
 	$post_types = geodir_rating_disabled_post_types();
2957 2957
 
2958
-	if ( empty( $post_types ) ) {
2958
+	if (empty($post_types)) {
2959 2959
 		return false;
2960 2960
 	}
2961 2961
 
2962
-	if ( is_int( $post_type ) ) {
2963
-		$post_type = get_post_type( $post_type );
2962
+	if (is_int($post_type)) {
2963
+		$post_type = get_post_type($post_type);
2964 2964
 	}
2965 2965
 
2966
-	if ( $taxonomy && !empty( $post_types ) ) {
2966
+	if ($taxonomy && !empty($post_types)) {
2967 2967
 		$posttypes = array();
2968 2968
 
2969
-		foreach ( $post_types as $posttype ) {
2970
-			$posttypes[] = $posttype . 'category';
2971
-			$posttypes[] = $posttype . '_tags';
2969
+		foreach ($post_types as $posttype) {
2970
+			$posttypes[] = $posttype.'category';
2971
+			$posttypes[] = $posttype.'_tags';
2972 2972
 		}
2973 2973
 
2974 2974
 		$post_types = $posttypes;
2975 2975
 	}
2976 2976
 
2977 2977
 	$return = false;
2978
-	if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
2978
+	if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
2979 2979
 		$return = true;
2980 2980
 	}
2981 2981
 
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
  * @return bool True if Yoast SEO disabled on GD pages.
2991 2991
  */
2992 2992
 function geodir_disable_yoast_seo_metas() {
2993
-	return (bool)get_option( 'geodir_disable_yoast_meta' );
2993
+	return (bool) get_option('geodir_disable_yoast_meta');
2994 2994
 }
2995 2995
 
2996 2996
 /**
@@ -3001,30 +3001,30 @@  discard block
 block discarded – undo
3001 3001
  * @param int $post_id The post ID.
3002 3002
  * @return bool True if allowed.
3003 3003
  */
3004
-function geodir_wpml_allowed_to_duplicate( $post_id ) {
3004
+function geodir_wpml_allowed_to_duplicate($post_id) {
3005 3005
 	$allowed = false;
3006 3006
 
3007
-	if ( !geodir_is_wpml() || empty( $post_id ) ) {
3007
+	if (!geodir_is_wpml() || empty($post_id)) {
3008 3008
 		return $allowed;
3009 3009
 	}
3010 3010
 
3011
-	$user_id = (int)get_current_user_id();
3011
+	$user_id = (int) get_current_user_id();
3012 3012
 
3013
-	if ( empty( $user_id ) ) {
3013
+	if (empty($user_id)) {
3014 3014
 		return $allowed;
3015 3015
 	}
3016 3016
 
3017
-	$post_type = get_post_type( $post_id );
3018
-	if ( !geodir_wpml_is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
3017
+	$post_type = get_post_type($post_id);
3018
+	if (!geodir_wpml_is_post_type_translated($post_type) || get_post_meta($post_id, '_icl_lang_duplicate_of', true)) {
3019 3019
 		return $allowed;
3020 3020
 	}
3021 3021
 
3022
-	if ( geodir_listing_belong_to_current_user( $post_id ) ) {
3022
+	if (geodir_listing_belong_to_current_user($post_id)) {
3023 3023
 		$allowed = true;
3024 3024
 	}
3025 3025
 
3026
-	$disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
3027
-	if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
3026
+	$disable_cpts = get_option('geodir_wpml_disable_duplicate');
3027
+	if ($allowed && !empty($disable_cpts) && in_array($post_type, $disable_cpts)) {
3028 3028
 		$allowed = false;
3029 3029
 	}
3030 3030
 
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
 	 * @param bool $allowed True if allowed.
3035 3035
 	 * @param int $post_id The post ID.
3036 3036
 	 */
3037
-	return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3037
+	return apply_filters('geodir_wpml_allowed_to_duplicate', $allowed, $post_id);
3038 3038
 }
3039 3039
 
3040 3040
 /**
@@ -3049,61 +3049,61 @@  discard block
 block discarded – undo
3049 3049
  * @param string $content_html The output html of the geodir_edit_post_link() function.
3050 3050
  * @return string Filtered html of the geodir_edit_post_link() function.
3051 3051
  */
3052
-function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3052
+function geodir_wpml_frontend_duplicate_listing($content_html) {
3053 3053
 	global $post, $preview, $sitepress;
3054 3054
 
3055
-	if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3055
+	if (!empty($post->ID) && !$preview && geodir_is_page('detail') && geodir_wpml_allowed_to_duplicate($post->ID)) {
3056 3056
 		$post_id = $post->ID;
3057
-		$element_type = 'post_' . get_post_type( $post_id );
3058
-		$original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3057
+		$element_type = 'post_'.get_post_type($post_id);
3058
+		$original_post_id = $sitepress->get_original_element_id($post_id, $element_type);
3059 3059
 
3060
-		if ( $original_post_id == $post_id ) {
3060
+		if ($original_post_id == $post_id) {
3061 3061
 			$wpml_languages = $sitepress->get_active_languages();
3062
-			$post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3062
+			$post_language = $sitepress->get_language_for_element($post_id, $element_type);
3063 3063
 
3064
-			if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3065
-				unset( $wpml_languages[ $post_language ] );
3064
+			if (!empty($wpml_languages) && isset($wpml_languages[$post_language])) {
3065
+				unset($wpml_languages[$post_language]);
3066 3066
 			}
3067 3067
 
3068
-			if ( !empty( $wpml_languages ) ) {
3069
-				$trid  = $sitepress->get_element_trid( $post_id, $element_type );
3070
-				$element_translations = $sitepress->get_element_translations( $trid, $element_type );
3071
-				$duplicates = $sitepress->get_duplicates( $post_id );
3068
+			if (!empty($wpml_languages)) {
3069
+				$trid = $sitepress->get_element_trid($post_id, $element_type);
3070
+				$element_translations = $sitepress->get_element_translations($trid, $element_type);
3071
+				$duplicates = $sitepress->get_duplicates($post_id);
3072 3072
 
3073
-				$wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3073
+				$wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">'.__('Translate Listing', 'geodirectory').'</h3>';
3074 3074
 				$wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3075
-				$wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3075
+				$wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">'.__('Language', 'geodirectory').'</th><th style="width:25px;"></th><th style="width:5em;text-align:center">'.__('Translate', 'geodirectory').'</th></tr>';
3076 3076
 
3077 3077
 				$needs_translation = false;
3078 3078
 
3079
-				foreach ( $wpml_languages as $lang_code => $lang ) {
3079
+				foreach ($wpml_languages as $lang_code => $lang) {
3080 3080
 					$duplicates_text = '';
3081 3081
 					$translated = false;
3082 3082
 
3083
-					if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3083
+					if (!empty($element_translations) && isset($element_translations[$lang_code])) {
3084 3084
 						$translated = true;
3085 3085
 
3086
-						if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3087
-							$duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3086
+						if (!empty($duplicates) && isset($duplicates[$lang_code])) {
3087
+							$duplicates_text = ' '.__('(duplicate)', 'geodirectory');
3088 3088
 						}
3089 3089
 					} else {
3090 3090
 						$needs_translation = true;
3091 3091
 					}
3092 3092
 
3093
-					$wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3093
+					$wpml_content .= '<tr><td style="padding:4px">'.$lang['english_name'].$duplicates_text.'</td><td>&nbsp;</td><td style="text-align:center;">';
3094 3094
 
3095
-					if ( $translated ) {
3095
+					if ($translated) {
3096 3096
 						$wpml_content .= '<i class="fas fa-check" style="color:orange"></i>';
3097 3097
 					} else {
3098
-						$wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3098
+						$wpml_content .= '<input name="gd_icl_dup[]" value="'.$lang_code.'" title="'.esc_attr__('Create duplicate', 'geodirectory').'" type="checkbox">';
3099 3099
 					}
3100 3100
 
3101 3101
 					$wpml_content .= '</td></tr>';
3102 3102
 				}
3103 3103
 
3104
-				if ( $needs_translation ) {
3105
-					$nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3106
-					$wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fas fa-spin fa-sync"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3104
+				if ($needs_translation) {
3105
+					$nonce = wp_create_nonce('geodir_duplicate_nonce');
3106
+					$wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fas fa-spin fa-sync"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="'.esc_attr($nonce).'" data-post-id="'.$post_id.'" id="gd_make_duplicates" class="button-secondary">'.__('Duplicate', 'geodirectory').'</button></td></tr>';
3107 3107
 				}
3108 3108
 
3109 3109
 				$wpml_content .= '</tbody></table>';
@@ -3125,12 +3125,12 @@  discard block
 block discarded – undo
3125 3125
  * @param array $settings GD design settings array.
3126 3126
  * @return array Filtered GD design settings array..
3127 3127
  */
3128
-function geodir_wpml_duplicate_settings( $settings = array() ) {
3128
+function geodir_wpml_duplicate_settings($settings = array()) {
3129 3129
 	$new_settings = array();
3130 3130
 
3131
-	foreach ( $settings as $key => $setting ) {
3131
+	foreach ($settings as $key => $setting) {
3132 3132
 
3133
-		if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3133
+		if (isset($setting['type']) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings') {
3134 3134
 			$new_settings[] = array(
3135 3135
 				'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3136 3136
 				'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
@@ -3158,12 +3158,12 @@  discard block
 block discarded – undo
3158 3158
  * @param string $taxonomy name/slug of a taxonomy.
3159 3159
  * @return bool true if the taxonomy is currently set to being translatable in WPML.
3160 3160
  */
3161
-function geodir_wpml_is_taxonomy_translated( $taxonomy ) {
3162
-	if ( empty( $taxonomy ) || !geodir_is_wpml() || !function_exists( 'is_taxonomy_translated' ) ) {
3161
+function geodir_wpml_is_taxonomy_translated($taxonomy) {
3162
+	if (empty($taxonomy) || !geodir_is_wpml() || !function_exists('is_taxonomy_translated')) {
3163 3163
 		return false;
3164 3164
 	}
3165 3165
 
3166
-	if ( is_taxonomy_translated( $taxonomy ) ) {
3166
+	if (is_taxonomy_translated($taxonomy)) {
3167 3167
 		return true;
3168 3168
 	}
3169 3169
 
@@ -3178,12 +3178,12 @@  discard block
 block discarded – undo
3178 3178
  * @param string $post_type name/slug of a post_type.
3179 3179
  * @return bool true if the post_type is currently set to being translatable in WPML.
3180 3180
  */
3181
-function geodir_wpml_is_post_type_translated( $post_type ) {
3182
-	if ( empty( $post_type ) || !geodir_is_wpml() || !function_exists( 'is_post_type_translated' ) ) {
3181
+function geodir_wpml_is_post_type_translated($post_type) {
3182
+	if (empty($post_type) || !geodir_is_wpml() || !function_exists('is_post_type_translated')) {
3183 3183
 		return false;
3184 3184
 	}
3185 3185
 
3186
-	if ( is_post_type_translated( $post_type ) ) {
3186
+	if (is_post_type_translated($post_type)) {
3187 3187
 		return true;
3188 3188
 	}
3189 3189
 
@@ -3205,12 +3205,12 @@  discard block
 block discarded – undo
3205 3205
  *
3206 3206
  * @return int|NULL
3207 3207
  */
3208
-function geodir_wpml_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) {
3209
-	if ( geodir_is_wpml() ) {
3210
-		if ( function_exists( 'wpml_object_id_filter' ) ) {
3211
-			return apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3208
+function geodir_wpml_object_id($element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null) {
3209
+	if (geodir_is_wpml()) {
3210
+		if (function_exists('wpml_object_id_filter')) {
3211
+			return apply_filters('wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code);
3212 3212
 		} else {
3213
-			return icl_object_id( $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3213
+			return icl_object_id($element_id, $element_type, $return_original_if_missing, $ulanguage_code);
3214 3214
 		}
3215 3215
 	}
3216 3216
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 		$author_id  = $p_post->post_author;
244 244
 
245
-	}else{
245
+	} else{
246 246
 		gd_die();
247 247
 	}
248 248
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
 		check_ajax_referer( 'send_to_frnd_'.$pid );
391 391
 
392
-	}else{
392
+	} else{
393 393
 		gd_die();
394 394
 	}
395 395
 
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
 
2284 2284
 	if ( $new_style ) {
2285 2285
 		$default_search_button_label = '<i class="fas fa-search" aria-hidden="true"></i>';
2286
-	}else{
2286
+	} else{
2287 2287
 		$default_search_button_label = 'Search';
2288 2288
 	}
2289 2289
 	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
 	if ( $new_style ) {
2311 2311
 		?>
2312 2312
 		<button class="geodir_submit_search "><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2313
-	<?php }else{?>
2313
+	<?php } else{?>
2314 2314
 		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2315 2315
 		       class="geodir_submit_search "/>
2316 2316
 	<?php }
@@ -2360,17 +2360,17 @@  discard block
 block discarded – undo
2360 2360
 			if ( $new_style ) {
2361 2361
 				echo "</div>";
2362 2362
 			}
2363
-		}else{
2363
+		} else{
2364 2364
 			if(! empty( $post_types )){
2365 2365
 				$pt_arr = (array)$post_types;
2366 2366
 				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2367
-			}else{
2367
+			} else{
2368 2368
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2369 2369
 			}
2370 2370
 
2371 2371
 		}
2372 2372
 
2373
-	}elseif ( ! empty( $post_types ) ) {
2373
+	} elseif ( ! empty( $post_types ) ) {
2374 2374
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2375 2375
 	}
2376 2376
 }
Please login to merge, or discard this patch.