Test Failed
Push — master ( ca8ef6...ca4a77 )
by Stiofan
09:14
created
geodirectory-functions/custom_fields_output_functions.php 2 patches
Indentation   +1540 added lines, -1540 removed lines patch added patch discarded remove patch
@@ -21,84 +21,84 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24
-    // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
27
-
28
-    if(!is_array($cf) && $cf!=''){
29
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
31
-    }
32
-
33
-    $html_var = $cf['htmlvar_name'];
34
-
35
-    // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
-        /**
38
-         * Filter the checkbox html by location.
39
-         *
40
-         * @param string $html The html to filter.
41
-         * @param array $cf The custom field array.
42
-         * @since 1.6.6
43
-         */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
-    }
46
-
47
-    // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
-        /**
50
-         * Filter the checkbox html by individual custom field.
51
-         *
52
-         * @param string $html The html to filter.
53
-         * @param string $location The location to output the html.
54
-         * @param array $cf The custom field array.
55
-         * @since 1.6.6
56
-         */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
-    }
59
-
60
-    // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
-        /**
63
-         * Filter the checkbox html by field type key.
64
-         *
65
-         * @param string $html The html to filter.
66
-         * @param string $location The location to output the html.
67
-         * @param array $cf The custom field array.
68
-         * @since 1.6.6
69
-         */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
-    }
72
-
73
-    // If not html then we run the standard output.
74
-    if(empty($html)){
75
-
76
-        if ( (int) $post->{$html_var} == 1 ):
77
-
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
81
-                $html_val = __( 'No', 'geodirectory' );
82
-            endif;
83
-
84
-            $field_icon = geodir_field_icon_proccess($cf);
85
-            if (strpos($field_icon, 'http') !== false) {
86
-                $field_icon_af = '';
87
-            } elseif ($field_icon == '') {
88
-                $field_icon_af = '';
89
-            } else {
90
-                $field_icon_af = $field_icon;
91
-                $field_icon = '';
92
-            }
93
-
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
97
-        endif;
98
-
99
-    }
100
-
101
-    return $html;
24
+	// check we have the post value
25
+	if(is_int($p)){$post = geodir_get_post_info($p);}
26
+	else{ global $post;}
27
+
28
+	if(!is_array($cf) && $cf!=''){
29
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
+		if(!$cf){return NULL;}
31
+	}
32
+
33
+	$html_var = $cf['htmlvar_name'];
34
+
35
+	// Check if there is a location specific filter.
36
+	if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
+		/**
38
+		 * Filter the checkbox html by location.
39
+		 *
40
+		 * @param string $html The html to filter.
41
+		 * @param array $cf The custom field array.
42
+		 * @since 1.6.6
43
+		 */
44
+		$html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
+	}
46
+
47
+	// Check if there is a custom field specific filter.
48
+	if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
+		/**
50
+		 * Filter the checkbox html by individual custom field.
51
+		 *
52
+		 * @param string $html The html to filter.
53
+		 * @param string $location The location to output the html.
54
+		 * @param array $cf The custom field array.
55
+		 * @since 1.6.6
56
+		 */
57
+		$html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
+	}
59
+
60
+	// Check if there is a custom field key specific filter.
61
+	if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
+		/**
63
+		 * Filter the checkbox html by field type key.
64
+		 *
65
+		 * @param string $html The html to filter.
66
+		 * @param string $location The location to output the html.
67
+		 * @param array $cf The custom field array.
68
+		 * @since 1.6.6
69
+		 */
70
+		$html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
+	}
72
+
73
+	// If not html then we run the standard output.
74
+	if(empty($html)){
75
+
76
+		if ( (int) $post->{$html_var} == 1 ):
77
+
78
+			if ( $post->{$html_var} == '1' ):
79
+				$html_val = __( 'Yes', 'geodirectory' );
80
+			else:
81
+				$html_val = __( 'No', 'geodirectory' );
82
+			endif;
83
+
84
+			$field_icon = geodir_field_icon_proccess($cf);
85
+			if (strpos($field_icon, 'http') !== false) {
86
+				$field_icon_af = '';
87
+			} elseif ($field_icon == '') {
88
+				$field_icon_af = '';
89
+			} else {
90
+				$field_icon_af = $field_icon;
91
+				$field_icon = '';
92
+			}
93
+
94
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
+			$html .= '</span>' . $html_val . '</div>';
97
+		endif;
98
+
99
+	}
100
+
101
+	return $html;
102 102
 }
103 103
 add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
104 104
 
@@ -115,71 +115,71 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 117
 
118
-    // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
121
-
122
-    if(!is_array($cf) && $cf!=''){
123
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
125
-    }
126
-
127
-    $html_var = $cf['htmlvar_name'];
128
-
129
-    // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
-        /**
132
-         * Filter the fieldset html by location.
133
-         *
134
-         * @param string $html The html to filter.
135
-         * @param array $cf The custom field array.
136
-         * @since 1.6.6
137
-         */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
-    }
140
-
141
-    // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
-        /**
144
-         * Filter the fieldset html by individual custom field.
145
-         *
146
-         * @param string $html The html to filter.
147
-         * @param string $location The location to output the html.
148
-         * @param array $cf The custom field array.
149
-         * @since 1.6.6
150
-         */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
-    }
153
-
154
-    // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
-        /**
157
-         * Filter the fieldset html by field type key.
158
-         *
159
-         * @param string $html The html to filter.
160
-         * @param string $location The location to output the html.
161
-         * @param array $cf The custom field array.
162
-         * @since 1.6.6
163
-         */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
-    }
166
-
167
-    // If not html then we run the standard output.
168
-    if(empty($html)){
169
-
170
-        global $field_set_start;
171
-        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
-
173
-        if ($field_set_start == 1) {
174
-            $html = '';
175
-        } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
-            //$field_set_start = 1;
178
-        }
179
-
180
-    }
181
-
182
-    return $html;
118
+	// check we have the post value
119
+	if(is_int($p)){$post = geodir_get_post_info($p);}
120
+	else{ global $post;}
121
+
122
+	if(!is_array($cf) && $cf!=''){
123
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
+		if(!$cf){return NULL;}
125
+	}
126
+
127
+	$html_var = $cf['htmlvar_name'];
128
+
129
+	// Check if there is a location specific filter.
130
+	if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
+		/**
132
+		 * Filter the fieldset html by location.
133
+		 *
134
+		 * @param string $html The html to filter.
135
+		 * @param array $cf The custom field array.
136
+		 * @since 1.6.6
137
+		 */
138
+		$html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
+	}
140
+
141
+	// Check if there is a custom field specific filter.
142
+	if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
+		/**
144
+		 * Filter the fieldset html by individual custom field.
145
+		 *
146
+		 * @param string $html The html to filter.
147
+		 * @param string $location The location to output the html.
148
+		 * @param array $cf The custom field array.
149
+		 * @since 1.6.6
150
+		 */
151
+		$html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
+	}
153
+
154
+	// Check if there is a custom field key specific filter.
155
+	if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
+		/**
157
+		 * Filter the fieldset html by field type key.
158
+		 *
159
+		 * @param string $html The html to filter.
160
+		 * @param string $location The location to output the html.
161
+		 * @param array $cf The custom field array.
162
+		 * @since 1.6.6
163
+		 */
164
+		$html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
+	}
166
+
167
+	// If not html then we run the standard output.
168
+	if(empty($html)){
169
+
170
+		global $field_set_start;
171
+		$fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
+
173
+		if ($field_set_start == 1) {
174
+			$html = '';
175
+		} else {
176
+			$html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
+			//$field_set_start = 1;
178
+		}
179
+
180
+	}
181
+
182
+	return $html;
183 183
 }
184 184
 add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
185 185
 
@@ -196,106 +196,106 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199
-    // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
202
-
203
-    if(!is_array($cf) && $cf!=''){
204
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
206
-    }
207
-
208
-    $html_var = $cf['htmlvar_name'];
209
-
210
-    // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
-        /**
213
-         * Filter the url html by location.
214
-         *
215
-         * @param string $html The html to filter.
216
-         * @param array $cf The custom field array.
217
-         * @since 1.6.6
218
-         */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
-    }
221
-
222
-    // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
-        /**
225
-         * Filter the url html by individual custom field.
226
-         *
227
-         * @param string $html The html to filter.
228
-         * @param string $location The location to output the html.
229
-         * @param array $cf The custom field array.
230
-         * @since 1.6.6
231
-         */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
-    }
234
-
235
-    // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
-        /**
238
-         * Filter the url html by field type key.
239
-         *
240
-         * @param string $html The html to filter.
241
-         * @param string $location The location to output the html.
242
-         * @param array $cf The custom field array.
243
-         * @since 1.6.6
244
-         */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
-    }
247
-
248
-    // If not html then we run the standard output.
249
-    if(empty($html)){
250
-
251
-        if ($post->{$cf['htmlvar_name']}):
252
-
253
-            $field_icon = geodir_field_icon_proccess($cf);
254
-            if (strpos($field_icon, 'http') !== false) {
255
-                $field_icon_af = '';
256
-            } elseif ($field_icon == '') {
257
-
258
-                if ($cf['name'] == 'geodir_facebook') {
259
-                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
-                } elseif ($cf['name'] == 'geodir_twitter') {
261
-                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
-                } else {
263
-                    $field_icon_af = '<i class="fa fa-link"></i>';
264
-                }
265
-
266
-            } else {
267
-                $field_icon_af = $field_icon;
268
-                $field_icon = '';
269
-            }
270
-
271
-            $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
-
273
-
274
-            $website = !empty($a_url['url']) ? $a_url['url'] : '';
275
-            $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
-            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
-
279
-
280
-
281
-            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
-            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
-            /**
284
-             * Filter custom field website name.
285
-             *
286
-             * @since 1.0.0
287
-             *
288
-             * @param string $title Website Title.
289
-             * @param string $website Website URL.
290
-             * @param int $post->ID Post ID.
291
-             */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
-
294
-        endif;
295
-
296
-    }
297
-
298
-    return $html;
199
+	// check we have the post value
200
+	if(is_int($p)){$post = geodir_get_post_info($p);}
201
+	else{ global $post;}
202
+
203
+	if(!is_array($cf) && $cf!=''){
204
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
+		if(!$cf){return NULL;}
206
+	}
207
+
208
+	$html_var = $cf['htmlvar_name'];
209
+
210
+	// Check if there is a location specific filter.
211
+	if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
+		/**
213
+		 * Filter the url html by location.
214
+		 *
215
+		 * @param string $html The html to filter.
216
+		 * @param array $cf The custom field array.
217
+		 * @since 1.6.6
218
+		 */
219
+		$html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
+	}
221
+
222
+	// Check if there is a custom field specific filter.
223
+	if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
+		/**
225
+		 * Filter the url html by individual custom field.
226
+		 *
227
+		 * @param string $html The html to filter.
228
+		 * @param string $location The location to output the html.
229
+		 * @param array $cf The custom field array.
230
+		 * @since 1.6.6
231
+		 */
232
+		$html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
+	}
234
+
235
+	// Check if there is a custom field key specific filter.
236
+	if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
+		/**
238
+		 * Filter the url html by field type key.
239
+		 *
240
+		 * @param string $html The html to filter.
241
+		 * @param string $location The location to output the html.
242
+		 * @param array $cf The custom field array.
243
+		 * @since 1.6.6
244
+		 */
245
+		$html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
+	}
247
+
248
+	// If not html then we run the standard output.
249
+	if(empty($html)){
250
+
251
+		if ($post->{$cf['htmlvar_name']}):
252
+
253
+			$field_icon = geodir_field_icon_proccess($cf);
254
+			if (strpos($field_icon, 'http') !== false) {
255
+				$field_icon_af = '';
256
+			} elseif ($field_icon == '') {
257
+
258
+				if ($cf['name'] == 'geodir_facebook') {
259
+					$field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
+				} elseif ($cf['name'] == 'geodir_twitter') {
261
+					$field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
+				} else {
263
+					$field_icon_af = '<i class="fa fa-link"></i>';
264
+				}
265
+
266
+			} else {
267
+				$field_icon_af = $field_icon;
268
+				$field_icon = '';
269
+			}
270
+
271
+			$a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
+
273
+
274
+			$website = !empty($a_url['url']) ? $a_url['url'] : '';
275
+			$title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
+			if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
+			$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
+
279
+
280
+
281
+			// all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
+			$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
+			/**
284
+			 * Filter custom field website name.
285
+			 *
286
+			 * @since 1.0.0
287
+			 *
288
+			 * @param string $title Website Title.
289
+			 * @param string $website Website URL.
290
+			 * @param int $post->ID Post ID.
291
+			 */
292
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
+
294
+		endif;
295
+
296
+	}
297
+
298
+	return $html;
299 299
 }
300 300
 add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
301 301
 
@@ -312,80 +312,80 @@  discard block
 block discarded – undo
312 312
  */
313 313
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 314
 
315
-    // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
318
-
319
-    if(!is_array($cf) && $cf!=''){
320
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
322
-    }
323
-
324
-    $html_var = $cf['htmlvar_name'];
325
-
326
-    // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
-        /**
329
-         * Filter the phone html by location.
330
-         *
331
-         * @param string $html The html to filter.
332
-         * @param array $cf The custom field array.
333
-         * @since 1.6.6
334
-         */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
-    }
337
-
338
-    // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
-        /**
341
-         * Filter the phone html by individual custom field.
342
-         *
343
-         * @param string $html The html to filter.
344
-         * @param string $location The location to output the html.
345
-         * @param array $cf The custom field array.
346
-         * @since 1.6.6
347
-         */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
-    }
350
-
351
-    // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
-        /**
354
-         * Filter the phone html by field type key.
355
-         *
356
-         * @param string $html The html to filter.
357
-         * @param string $location The location to output the html.
358
-         * @param array $cf The custom field array.
359
-         * @since 1.6.6
360
-         */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
-    }
363
-
364
-    // If not html then we run the standard output.
365
-    if(empty($html)){
366
-
367
-        if ($post->{$cf['htmlvar_name']}):
368
-
369
-            $field_icon = geodir_field_icon_proccess($cf);
370
-            if (strpos($field_icon, 'http') !== false) {
371
-                $field_icon_af = '';
372
-            } elseif ($field_icon == '') {
373
-                $field_icon_af = '<i class="fa fa-phone"></i>';
374
-            } else {
375
-                $field_icon_af = $field_icon;
376
-                $field_icon = '';
377
-            }
378
-
379
-
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
-
384
-        endif;
385
-
386
-    }
387
-
388
-    return $html;
315
+	// check we have the post value
316
+	if(is_int($p)){$post = geodir_get_post_info($p);}
317
+	else{ global $post;}
318
+
319
+	if(!is_array($cf) && $cf!=''){
320
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
+		if(!$cf){return NULL;}
322
+	}
323
+
324
+	$html_var = $cf['htmlvar_name'];
325
+
326
+	// Check if there is a location specific filter.
327
+	if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
+		/**
329
+		 * Filter the phone html by location.
330
+		 *
331
+		 * @param string $html The html to filter.
332
+		 * @param array $cf The custom field array.
333
+		 * @since 1.6.6
334
+		 */
335
+		$html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
+	}
337
+
338
+	// Check if there is a custom field specific filter.
339
+	if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
+		/**
341
+		 * Filter the phone html by individual custom field.
342
+		 *
343
+		 * @param string $html The html to filter.
344
+		 * @param string $location The location to output the html.
345
+		 * @param array $cf The custom field array.
346
+		 * @since 1.6.6
347
+		 */
348
+		$html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
+	}
350
+
351
+	// Check if there is a custom field key specific filter.
352
+	if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
+		/**
354
+		 * Filter the phone html by field type key.
355
+		 *
356
+		 * @param string $html The html to filter.
357
+		 * @param string $location The location to output the html.
358
+		 * @param array $cf The custom field array.
359
+		 * @since 1.6.6
360
+		 */
361
+		$html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
+	}
363
+
364
+	// If not html then we run the standard output.
365
+	if(empty($html)){
366
+
367
+		if ($post->{$cf['htmlvar_name']}):
368
+
369
+			$field_icon = geodir_field_icon_proccess($cf);
370
+			if (strpos($field_icon, 'http') !== false) {
371
+				$field_icon_af = '';
372
+			} elseif ($field_icon == '') {
373
+				$field_icon_af = '<i class="fa fa-phone"></i>';
374
+			} else {
375
+				$field_icon_af = $field_icon;
376
+				$field_icon = '';
377
+			}
378
+
379
+
380
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
+					$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
+			$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
+
384
+		endif;
385
+
386
+	}
387
+
388
+	return $html;
389 389
 }
390 390
 add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
391 391
 
@@ -402,85 +402,85 @@  discard block
 block discarded – undo
402 402
  */
403 403
 function geodir_cf_time($html,$location,$cf,$p=''){
404 404
 
405
-    // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
408
-
409
-    if(!is_array($cf) && $cf!=''){
410
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
412
-    }
413
-
414
-    $html_var = $cf['htmlvar_name'];
415
-
416
-    // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
-        /**
419
-         * Filter the time html by location.
420
-         *
421
-         * @param string $html The html to filter.
422
-         * @param array $cf The custom field array.
423
-         * @since 1.6.6
424
-         */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
-    }
427
-
428
-    // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
-        /**
431
-         * Filter the time html by individual custom field.
432
-         *
433
-         * @param string $html The html to filter.
434
-         * @param string $location The location to output the html.
435
-         * @param array $cf The custom field array.
436
-         * @since 1.6.6
437
-         */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
-    }
440
-
441
-    // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
-        /**
444
-         * Filter the time html by field type key.
445
-         *
446
-         * @param string $html The html to filter.
447
-         * @param string $location The location to output the html.
448
-         * @param array $cf The custom field array.
449
-         * @since 1.6.6
450
-         */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
-    }
453
-
454
-    // If not html then we run the standard output.
455
-    if(empty($html)){
456
-
457
-        if ($post->{$cf['htmlvar_name']}):
458
-
459
-            $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
-                $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
-
464
-            $field_icon = geodir_field_icon_proccess($cf);
465
-            if (strpos($field_icon, 'http') !== false) {
466
-                $field_icon_af = '';
467
-            } elseif ($field_icon == '') {
468
-                $field_icon_af = '<i class="fa fa-clock-o"></i>';
469
-            } else {
470
-                $field_icon_af = $field_icon;
471
-                $field_icon = '';
472
-            }
473
-
474
-
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
478
-
479
-        endif;
480
-
481
-    }
482
-
483
-    return $html;
405
+	// check we have the post value
406
+	if(is_int($p)){$post = geodir_get_post_info($p);}
407
+	else{ global $post;}
408
+
409
+	if(!is_array($cf) && $cf!=''){
410
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
+		if(!$cf){return NULL;}
412
+	}
413
+
414
+	$html_var = $cf['htmlvar_name'];
415
+
416
+	// Check if there is a location specific filter.
417
+	if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
+		/**
419
+		 * Filter the time html by location.
420
+		 *
421
+		 * @param string $html The html to filter.
422
+		 * @param array $cf The custom field array.
423
+		 * @since 1.6.6
424
+		 */
425
+		$html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
+	}
427
+
428
+	// Check if there is a custom field specific filter.
429
+	if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
+		/**
431
+		 * Filter the time html by individual custom field.
432
+		 *
433
+		 * @param string $html The html to filter.
434
+		 * @param string $location The location to output the html.
435
+		 * @param array $cf The custom field array.
436
+		 * @since 1.6.6
437
+		 */
438
+		$html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
+	}
440
+
441
+	// Check if there is a custom field key specific filter.
442
+	if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
+		/**
444
+		 * Filter the time html by field type key.
445
+		 *
446
+		 * @param string $html The html to filter.
447
+		 * @param string $location The location to output the html.
448
+		 * @param array $cf The custom field array.
449
+		 * @since 1.6.6
450
+		 */
451
+		$html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
+	}
453
+
454
+	// If not html then we run the standard output.
455
+	if(empty($html)){
456
+
457
+		if ($post->{$cf['htmlvar_name']}):
458
+
459
+			$value = '';
460
+			if ($post->{$cf['htmlvar_name']} != '')
461
+				//$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
+				$value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
+
464
+			$field_icon = geodir_field_icon_proccess($cf);
465
+			if (strpos($field_icon, 'http') !== false) {
466
+				$field_icon_af = '';
467
+			} elseif ($field_icon == '') {
468
+				$field_icon_af = '<i class="fa fa-clock-o"></i>';
469
+			} else {
470
+				$field_icon_af = $field_icon;
471
+				$field_icon = '';
472
+			}
473
+
474
+
475
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
+			$html .= '</span>' . $value . '</div>';
478
+
479
+		endif;
480
+
481
+	}
482
+
483
+	return $html;
484 484
 }
485 485
 add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
486 486
 
@@ -496,111 +496,111 @@  discard block
 block discarded – undo
496 496
  * @return string The html to output for the custom field.
497 497
  */
498 498
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499
-    global $preview;
500
-    // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
503
-
504
-    if(!is_array($cf) && $cf!=''){
505
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
507
-    }
508
-
509
-    $html_var = $cf['htmlvar_name'];
510
-
511
-    // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
-        /**
514
-         * Filter the datepicker html by location.
515
-         *
516
-         * @param string $html The html to filter.
517
-         * @param array $cf The custom field array.
518
-         * @since 1.6.6
519
-         */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
-    }
522
-
523
-    // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
-        /**
526
-         * Filter the datepicker html by individual custom field.
527
-         *
528
-         * @param string $html The html to filter.
529
-         * @param string $location The location to output the html.
530
-         * @param array $cf The custom field array.
531
-         * @since 1.6.6
532
-         */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
-    }
535
-
536
-    // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
-        /**
539
-         * Filter the datepicker html by field type key.
540
-         *
541
-         * @param string $html The html to filter.
542
-         * @param string $location The location to output the html.
543
-         * @param array $cf The custom field array.
544
-         * @since 1.6.6
545
-         */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
-    }
548
-
549
-    // If not html then we run the standard output.
550
-    if(empty($html)){
551
-
552
-        if ($post->{$cf['htmlvar_name']}):
553
-
554
-            $date_format = geodir_default_date_format();
555
-            if ($cf['extra_fields'] != '') {
556
-                $date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
-                $date_format = $date_format['date_format'];
558
-            }
559
-            // check if we need to change the format or not
560
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
562
-
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
565
-
566
-                $date_format = str_replace($search, $replace, $date_format);
567
-
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
570
-                $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
-            }
572
-
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
-                $date_format_from = $preview ? $date_format : 'Y-m-d';
575
-                $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
-                //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
-                //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
579
-                return '';
580
-            }
581
-
582
-            $field_icon = geodir_field_icon_proccess($cf);
583
-
584
-            if (strpos($field_icon, 'http') !== false) {
585
-                $field_icon_af = '';
586
-            } elseif ($field_icon == '') {
587
-                $field_icon_af = '<i class="fa fa-calendar"></i>';
588
-            } else {
589
-                $field_icon_af = $field_icon;
590
-                $field_icon = '';
591
-            }
592
-
593
-
594
-
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
598
-
599
-        endif;
600
-
601
-    }
602
-
603
-    return $html;
499
+	global $preview;
500
+	// check we have the post value
501
+	if(is_int($p)){$post = geodir_get_post_info($p);}
502
+	else{ global $post;}
503
+
504
+	if(!is_array($cf) && $cf!=''){
505
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
+		if(!$cf){return NULL;}
507
+	}
508
+
509
+	$html_var = $cf['htmlvar_name'];
510
+
511
+	// Check if there is a location specific filter.
512
+	if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
+		/**
514
+		 * Filter the datepicker html by location.
515
+		 *
516
+		 * @param string $html The html to filter.
517
+		 * @param array $cf The custom field array.
518
+		 * @since 1.6.6
519
+		 */
520
+		$html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
+	}
522
+
523
+	// Check if there is a custom field specific filter.
524
+	if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
+		/**
526
+		 * Filter the datepicker html by individual custom field.
527
+		 *
528
+		 * @param string $html The html to filter.
529
+		 * @param string $location The location to output the html.
530
+		 * @param array $cf The custom field array.
531
+		 * @since 1.6.6
532
+		 */
533
+		$html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
+	}
535
+
536
+	// Check if there is a custom field key specific filter.
537
+	if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
+		/**
539
+		 * Filter the datepicker html by field type key.
540
+		 *
541
+		 * @param string $html The html to filter.
542
+		 * @param string $location The location to output the html.
543
+		 * @param array $cf The custom field array.
544
+		 * @since 1.6.6
545
+		 */
546
+		$html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
+	}
548
+
549
+	// If not html then we run the standard output.
550
+	if(empty($html)){
551
+
552
+		if ($post->{$cf['htmlvar_name']}):
553
+
554
+			$date_format = geodir_default_date_format();
555
+			if ($cf['extra_fields'] != '') {
556
+				$date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
+				$date_format = $date_format['date_format'];
558
+			}
559
+			// check if we need to change the format or not
560
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
561
+			if($date_format_len>5){// if greater then 4 then it's the old style format.
562
+
563
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
565
+
566
+				$date_format = str_replace($search, $replace, $date_format);
567
+
568
+				$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+			}else{
570
+				$post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
+			}
572
+
573
+			if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
+				$date_format_from = $preview ? $date_format : 'Y-m-d';
575
+				$value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
+				//$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
+				//$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
+			}else{
579
+				return '';
580
+			}
581
+
582
+			$field_icon = geodir_field_icon_proccess($cf);
583
+
584
+			if (strpos($field_icon, 'http') !== false) {
585
+				$field_icon_af = '';
586
+			} elseif ($field_icon == '') {
587
+				$field_icon_af = '<i class="fa fa-calendar"></i>';
588
+			} else {
589
+				$field_icon_af = $field_icon;
590
+				$field_icon = '';
591
+			}
592
+
593
+
594
+
595
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
+			$html .= '</span>' . $value . '</div>';
598
+
599
+		endif;
600
+
601
+	}
602
+
603
+	return $html;
604 604
 }
605 605
 add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
606 606
 
@@ -617,97 +617,97 @@  discard block
 block discarded – undo
617 617
  */
618 618
 function geodir_cf_text($html,$location,$cf,$p=''){
619 619
 
620
-    // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
623
-
624
-    if(!is_array($cf) && $cf!=''){
625
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
627
-    }
628
-
629
-    $html_var = $cf['htmlvar_name'];
630
-
631
-    // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
-        /**
634
-         * Filter the text html by location.
635
-         *
636
-         * @param string $html The html to filter.
637
-         * @param array $cf The custom field array.
638
-         * @since 1.6.6
639
-         */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
-    }
642
-
643
-    // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
-        /**
646
-         * Filter the text html by individual custom field.
647
-         *
648
-         * @param string $html The html to filter.
649
-         * @param string $location The location to output the html.
650
-         * @param array $cf The custom field array.
651
-         * @since 1.6.6
652
-         */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
-    }
655
-
656
-    // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
-        /**
659
-         * Filter the text html by field type key.
660
-         *
661
-         * @param string $html The html to filter.
662
-         * @param string $location The location to output the html.
663
-         * @param array $cf The custom field array.
664
-         * @since 1.6.6
665
-         */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
-    }
620
+	// check we have the post value
621
+	if(is_int($p)){$post = geodir_get_post_info($p);}
622
+	else{ global $post;}
623
+
624
+	if(!is_array($cf) && $cf!=''){
625
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
+		if(!$cf){return NULL;}
627
+	}
628
+
629
+	$html_var = $cf['htmlvar_name'];
630
+
631
+	// Check if there is a location specific filter.
632
+	if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
+		/**
634
+		 * Filter the text html by location.
635
+		 *
636
+		 * @param string $html The html to filter.
637
+		 * @param array $cf The custom field array.
638
+		 * @since 1.6.6
639
+		 */
640
+		$html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
+	}
642
+
643
+	// Check if there is a custom field specific filter.
644
+	if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
+		/**
646
+		 * Filter the text html by individual custom field.
647
+		 *
648
+		 * @param string $html The html to filter.
649
+		 * @param string $location The location to output the html.
650
+		 * @param array $cf The custom field array.
651
+		 * @since 1.6.6
652
+		 */
653
+		$html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
+	}
655
+
656
+	// Check if there is a custom field key specific filter.
657
+	if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
+		/**
659
+		 * Filter the text html by field type key.
660
+		 *
661
+		 * @param string $html The html to filter.
662
+		 * @param string $location The location to output the html.
663
+		 * @param array $cf The custom field array.
664
+		 * @since 1.6.6
665
+		 */
666
+		$html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
+	}
668 668
 
669 669
     
670 670
 
671
-    // If not html then we run the standard output.
672
-    if(empty($html)){
671
+	// If not html then we run the standard output.
672
+	if(empty($html)){
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
675 675
 
676
-            $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
676
+			$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
678
-            $field_icon = geodir_field_icon_proccess($cf);
679
-            if (strpos($field_icon, 'http') !== false) {
680
-                $field_icon_af = '';
681
-            } elseif ($field_icon == '') {
682
-                $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
-            } else {
684
-                $field_icon_af = $field_icon;
685
-                $field_icon = '';
686
-            }
678
+			$field_icon = geodir_field_icon_proccess($cf);
679
+			if (strpos($field_icon, 'http') !== false) {
680
+				$field_icon_af = '';
681
+			} elseif ($field_icon == '') {
682
+				$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
+			} else {
684
+				$field_icon_af = $field_icon;
685
+				$field_icon = '';
686
+			}
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
-            $html .= '</span>';
689
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
+			$html .= '</span>';
692 692
 
693
-            $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
-                $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
699
-                }
700
-            }
693
+			$value = $post->{$cf['htmlvar_name']};
694
+			if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
+				$extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
+				if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
+					if(!ceil($value) > 0){return '';}// dont output blank prices
698
+					$value = geodir_currency_format_number($value,$cf);
699
+				}
700
+			}
701 701
 
702 702
 
703
-            $html .= $value;
704
-            $html .= '</div>';
703
+			$html .= $value;
704
+			$html .= '</div>';
705 705
 
706
-        endif;
706
+		endif;
707 707
 
708
-    }
708
+	}
709 709
 
710
-    return $html;
710
+	return $html;
711 711
 }
712 712
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
713 713
 
@@ -724,98 +724,98 @@  discard block
 block discarded – undo
724 724
  */
725 725
 function geodir_cf_radio($html,$location,$cf,$p=''){
726 726
 
727
-    // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
730
-
731
-    if(!is_array($cf) && $cf!=''){
732
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
734
-    }
735
-
736
-    $html_var = $cf['htmlvar_name'];
737
-
738
-    // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
-        /**
741
-         * Filter the radio html by location.
742
-         *
743
-         * @param string $html The html to filter.
744
-         * @param array $cf The custom field array.
745
-         * @since 1.6.6
746
-         */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
-    }
749
-
750
-    // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
-        /**
753
-         * Filter the radio html by individual custom field.
754
-         *
755
-         * @param string $html The html to filter.
756
-         * @param string $location The location to output the html.
757
-         * @param array $cf The custom field array.
758
-         * @since 1.6.6
759
-         */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
-    }
762
-
763
-    // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
-        /**
766
-         * Filter the radio html by field type key.
767
-         *
768
-         * @param string $html The html to filter.
769
-         * @param string $location The location to output the html.
770
-         * @param array $cf The custom field array.
771
-         * @since 1.6.6
772
-         */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
-    }
775
-
776
-    // If not html then we run the standard output.
777
-    if(empty($html)){
778
-
779
-        $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
-
782
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
-                $html_val = __('No', 'geodirectory');
784
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
-                $html_val = __('Yes', 'geodirectory');
786
-            } else {
787
-                if (!empty($cf['option_values'])) {
788
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
-
790
-                    if (!empty($cf_option_values)) {
791
-                        foreach ($cf_option_values as $cf_option_value) {
792
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
-                                $html_val = $cf_option_value['label'];
794
-                            }
795
-                        }
796
-                    }
797
-                }
798
-            }
799
-
800
-            $field_icon = geodir_field_icon_proccess($cf);
801
-            if (strpos($field_icon, 'http') !== false) {
802
-                $field_icon_af = '';
803
-            } elseif ($field_icon == '') {
804
-                $field_icon_af = '';
805
-            } else {
806
-                $field_icon_af = $field_icon;
807
-                $field_icon = '';
808
-            }
809
-
810
-
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
814
-        endif;
815
-
816
-    }
817
-
818
-    return $html;
727
+	// check we have the post value
728
+	if(is_int($p)){$post = geodir_get_post_info($p);}
729
+	else{ global $post;}
730
+
731
+	if(!is_array($cf) && $cf!=''){
732
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
+		if(!$cf){return NULL;}
734
+	}
735
+
736
+	$html_var = $cf['htmlvar_name'];
737
+
738
+	// Check if there is a location specific filter.
739
+	if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
+		/**
741
+		 * Filter the radio html by location.
742
+		 *
743
+		 * @param string $html The html to filter.
744
+		 * @param array $cf The custom field array.
745
+		 * @since 1.6.6
746
+		 */
747
+		$html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
+	}
749
+
750
+	// Check if there is a custom field specific filter.
751
+	if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
+		/**
753
+		 * Filter the radio html by individual custom field.
754
+		 *
755
+		 * @param string $html The html to filter.
756
+		 * @param string $location The location to output the html.
757
+		 * @param array $cf The custom field array.
758
+		 * @since 1.6.6
759
+		 */
760
+		$html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
+	}
762
+
763
+	// Check if there is a custom field key specific filter.
764
+	if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
+		/**
766
+		 * Filter the radio html by field type key.
767
+		 *
768
+		 * @param string $html The html to filter.
769
+		 * @param string $location The location to output the html.
770
+		 * @param array $cf The custom field array.
771
+		 * @since 1.6.6
772
+		 */
773
+		$html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
+	}
775
+
776
+	// If not html then we run the standard output.
777
+	if(empty($html)){
778
+
779
+		$html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
+
782
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
+				$html_val = __('No', 'geodirectory');
784
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
+				$html_val = __('Yes', 'geodirectory');
786
+			} else {
787
+				if (!empty($cf['option_values'])) {
788
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
+
790
+					if (!empty($cf_option_values)) {
791
+						foreach ($cf_option_values as $cf_option_value) {
792
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
+								$html_val = $cf_option_value['label'];
794
+							}
795
+						}
796
+					}
797
+				}
798
+			}
799
+
800
+			$field_icon = geodir_field_icon_proccess($cf);
801
+			if (strpos($field_icon, 'http') !== false) {
802
+				$field_icon_af = '';
803
+			} elseif ($field_icon == '') {
804
+				$field_icon_af = '';
805
+			} else {
806
+				$field_icon_af = $field_icon;
807
+				$field_icon = '';
808
+			}
809
+
810
+
811
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
+			$html .= '</span>' . $html_val . '</div>';
814
+		endif;
815
+
816
+	}
817
+
818
+	return $html;
819 819
 }
820 820
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
821 821
 
@@ -832,92 +832,92 @@  discard block
 block discarded – undo
832 832
  */
833 833
 function geodir_cf_select($html,$location,$cf,$p=''){
834 834
 
835
-    // check we have the post value
836
-    if(is_int($p)){$post = geodir_get_post_info($p);}
837
-    else{ global $post;}
838
-
839
-    if(!is_array($cf) && $cf!=''){
840
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
841
-        if(!$cf){return NULL;}
842
-    }
843
-
844
-    $html_var = $cf['htmlvar_name'];
845
-
846
-    // Check if there is a location specific filter.
847
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
848
-        /**
849
-         * Filter the select html by location.
850
-         *
851
-         * @param string $html The html to filter.
852
-         * @param array $cf The custom field array.
853
-         * @since 1.6.6
854
-         */
855
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
856
-    }
857
-
858
-    // Check if there is a custom field specific filter.
859
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
860
-        /**
861
-         * Filter the select html by individual custom field.
862
-         *
863
-         * @param string $html The html to filter.
864
-         * @param string $location The location to output the html.
865
-         * @param array $cf The custom field array.
866
-         * @since 1.6.6
867
-         */
868
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
869
-    }
870
-
871
-    // Check if there is a custom field key specific filter.
872
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
873
-        /**
874
-         * Filter the select html by field type key.
875
-         *
876
-         * @param string $html The html to filter.
877
-         * @param string $location The location to output the html.
878
-         * @param array $cf The custom field array.
879
-         * @since 1.6.6
880
-         */
881
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
882
-    }
883
-
884
-    // If not html then we run the standard output.
885
-    if(empty($html)){
886
-
887
-        if ($post->{$cf['htmlvar_name']}):
888
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
889
-
890
-            if (!empty($cf['option_values'])) {
891
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
892
-
893
-                if (!empty($cf_option_values)) {
894
-                    foreach ($cf_option_values as $cf_option_value) {
895
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
896
-                            //$field_value = $cf_option_value['label']; // no longer needed here.
897
-                        }
898
-                    }
899
-                }
900
-            }
901
-
902
-            $field_icon = geodir_field_icon_proccess($cf);
903
-            if (strpos($field_icon, 'http') !== false) {
904
-                $field_icon_af = '';
905
-            } elseif ($field_icon == '') {
906
-                $field_icon_af = '';
907
-            } else {
908
-                $field_icon_af = $field_icon;
909
-                $field_icon = '';
910
-            }
911
-
912
-
913
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
914
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
915
-            $html .= '</span>' . $field_value . '</div>';
916
-        endif;
917
-
918
-    }
919
-
920
-    return $html;
835
+	// check we have the post value
836
+	if(is_int($p)){$post = geodir_get_post_info($p);}
837
+	else{ global $post;}
838
+
839
+	if(!is_array($cf) && $cf!=''){
840
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
841
+		if(!$cf){return NULL;}
842
+	}
843
+
844
+	$html_var = $cf['htmlvar_name'];
845
+
846
+	// Check if there is a location specific filter.
847
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
848
+		/**
849
+		 * Filter the select html by location.
850
+		 *
851
+		 * @param string $html The html to filter.
852
+		 * @param array $cf The custom field array.
853
+		 * @since 1.6.6
854
+		 */
855
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
856
+	}
857
+
858
+	// Check if there is a custom field specific filter.
859
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
860
+		/**
861
+		 * Filter the select html by individual custom field.
862
+		 *
863
+		 * @param string $html The html to filter.
864
+		 * @param string $location The location to output the html.
865
+		 * @param array $cf The custom field array.
866
+		 * @since 1.6.6
867
+		 */
868
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
869
+	}
870
+
871
+	// Check if there is a custom field key specific filter.
872
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
873
+		/**
874
+		 * Filter the select html by field type key.
875
+		 *
876
+		 * @param string $html The html to filter.
877
+		 * @param string $location The location to output the html.
878
+		 * @param array $cf The custom field array.
879
+		 * @since 1.6.6
880
+		 */
881
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
882
+	}
883
+
884
+	// If not html then we run the standard output.
885
+	if(empty($html)){
886
+
887
+		if ($post->{$cf['htmlvar_name']}):
888
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
889
+
890
+			if (!empty($cf['option_values'])) {
891
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
892
+
893
+				if (!empty($cf_option_values)) {
894
+					foreach ($cf_option_values as $cf_option_value) {
895
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
896
+							//$field_value = $cf_option_value['label']; // no longer needed here.
897
+						}
898
+					}
899
+				}
900
+			}
901
+
902
+			$field_icon = geodir_field_icon_proccess($cf);
903
+			if (strpos($field_icon, 'http') !== false) {
904
+				$field_icon_af = '';
905
+			} elseif ($field_icon == '') {
906
+				$field_icon_af = '';
907
+			} else {
908
+				$field_icon_af = $field_icon;
909
+				$field_icon = '';
910
+			}
911
+
912
+
913
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
914
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
915
+			$html .= '</span>' . $field_value . '</div>';
916
+		endif;
917
+
918
+	}
919
+
920
+	return $html;
921 921
 }
922 922
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
923 923
 
@@ -934,117 +934,117 @@  discard block
 block discarded – undo
934 934
  */
935 935
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
936 936
 
937
-    // check we have the post value
938
-    if(is_int($p)){$post = geodir_get_post_info($p);}
939
-    else{ global $post;}
940
-
941
-    if(!is_array($cf) && $cf!=''){
942
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
943
-        if(!$cf){return NULL;}
944
-    }
945
-
946
-    $html_var = $cf['htmlvar_name'];
947
-
948
-    // Check if there is a location specific filter.
949
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
950
-        /**
951
-         * Filter the multiselect html by location.
952
-         *
953
-         * @param string $html The html to filter.
954
-         * @param array $cf The custom field array.
955
-         * @since 1.6.6
956
-         */
957
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
958
-    }
959
-
960
-    // Check if there is a custom field specific filter.
961
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
962
-        /**
963
-         * Filter the multiselect html by individual custom field.
964
-         *
965
-         * @param string $html The html to filter.
966
-         * @param string $location The location to output the html.
967
-         * @param array $cf The custom field array.
968
-         * @since 1.6.6
969
-         */
970
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
971
-    }
972
-
973
-    // Check if there is a custom field key specific filter.
974
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
975
-        /**
976
-         * Filter the multiselect html by field type key.
977
-         *
978
-         * @param string $html The html to filter.
979
-         * @param string $location The location to output the html.
980
-         * @param array $cf The custom field array.
981
-         * @since 1.6.6
982
-         */
983
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
984
-    }
985
-
986
-    // If not html then we run the standard output.
987
-    if(empty($html)){
988
-
989
-
990
-        if (!empty($post->{$cf['htmlvar_name']})):
991
-
992
-            if (is_array($post->{$cf['htmlvar_name']})) {
993
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
994
-            }
995
-
996
-            $field_icon = geodir_field_icon_proccess($cf);
997
-            if (strpos($field_icon, 'http') !== false) {
998
-                $field_icon_af = '';
999
-            } elseif ($field_icon == '') {
1000
-                $field_icon_af = '';
1001
-            } else {
1002
-                $field_icon_af = $field_icon;
1003
-                $field_icon = '';
1004
-            }
1005
-
1006
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1007
-
1008
-            if(is_array($field_values)){
1009
-                $field_values = array_map('trim', $field_values);
1010
-            }
1011
-
1012
-            $option_values = array();
1013
-            if (!empty($cf['option_values'])) {
1014
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1015
-
1016
-                if (!empty($cf_option_values)) {
1017
-                    foreach ($cf_option_values as $cf_option_value) {
1018
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1019
-                            $option_values[] = $cf_option_value['label'];
1020
-                        }
1021
-                    }
1022
-                }
1023
-            }
1024
-
1025
-
1026
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1027
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1028
-            $html .= '</span>';
1029
-
1030
-            if (count($option_values) > 1) {
1031
-                $html .= '<ul>';
1032
-
1033
-                foreach ($option_values as $val) {
1034
-                    $html .= '<li>' . $val . '</li>';
1035
-                }
1036
-
1037
-                $html .= '</ul>';
1038
-            } else {
1039
-                $html .= $post->{$cf['htmlvar_name']};
1040
-            }
1041
-
1042
-            $html .= '</div>';
1043
-        endif;
1044
-
1045
-    }
1046
-
1047
-    return $html;
937
+	// check we have the post value
938
+	if(is_int($p)){$post = geodir_get_post_info($p);}
939
+	else{ global $post;}
940
+
941
+	if(!is_array($cf) && $cf!=''){
942
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
943
+		if(!$cf){return NULL;}
944
+	}
945
+
946
+	$html_var = $cf['htmlvar_name'];
947
+
948
+	// Check if there is a location specific filter.
949
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
950
+		/**
951
+		 * Filter the multiselect html by location.
952
+		 *
953
+		 * @param string $html The html to filter.
954
+		 * @param array $cf The custom field array.
955
+		 * @since 1.6.6
956
+		 */
957
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
958
+	}
959
+
960
+	// Check if there is a custom field specific filter.
961
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
962
+		/**
963
+		 * Filter the multiselect html by individual custom field.
964
+		 *
965
+		 * @param string $html The html to filter.
966
+		 * @param string $location The location to output the html.
967
+		 * @param array $cf The custom field array.
968
+		 * @since 1.6.6
969
+		 */
970
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
971
+	}
972
+
973
+	// Check if there is a custom field key specific filter.
974
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
975
+		/**
976
+		 * Filter the multiselect html by field type key.
977
+		 *
978
+		 * @param string $html The html to filter.
979
+		 * @param string $location The location to output the html.
980
+		 * @param array $cf The custom field array.
981
+		 * @since 1.6.6
982
+		 */
983
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
984
+	}
985
+
986
+	// If not html then we run the standard output.
987
+	if(empty($html)){
988
+
989
+
990
+		if (!empty($post->{$cf['htmlvar_name']})):
991
+
992
+			if (is_array($post->{$cf['htmlvar_name']})) {
993
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
994
+			}
995
+
996
+			$field_icon = geodir_field_icon_proccess($cf);
997
+			if (strpos($field_icon, 'http') !== false) {
998
+				$field_icon_af = '';
999
+			} elseif ($field_icon == '') {
1000
+				$field_icon_af = '';
1001
+			} else {
1002
+				$field_icon_af = $field_icon;
1003
+				$field_icon = '';
1004
+			}
1005
+
1006
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1007
+
1008
+			if(is_array($field_values)){
1009
+				$field_values = array_map('trim', $field_values);
1010
+			}
1011
+
1012
+			$option_values = array();
1013
+			if (!empty($cf['option_values'])) {
1014
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1015
+
1016
+				if (!empty($cf_option_values)) {
1017
+					foreach ($cf_option_values as $cf_option_value) {
1018
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1019
+							$option_values[] = $cf_option_value['label'];
1020
+						}
1021
+					}
1022
+				}
1023
+			}
1024
+
1025
+
1026
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1027
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1028
+			$html .= '</span>';
1029
+
1030
+			if (count($option_values) > 1) {
1031
+				$html .= '<ul>';
1032
+
1033
+				foreach ($option_values as $val) {
1034
+					$html .= '<li>' . $val . '</li>';
1035
+				}
1036
+
1037
+				$html .= '</ul>';
1038
+			} else {
1039
+				$html .= $post->{$cf['htmlvar_name']};
1040
+			}
1041
+
1042
+			$html .= '</div>';
1043
+		endif;
1044
+
1045
+	}
1046
+
1047
+	return $html;
1048 1048
 }
1049 1049
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1050 1050
 
@@ -1061,153 +1061,153 @@  discard block
 block discarded – undo
1061 1061
  */
1062 1062
 function geodir_cf_email($html,$location,$cf,$p=''){
1063 1063
 
1064
-    // check we have the post value
1065
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1066
-    else{ global $post;}
1067
-
1068
-    if(!is_array($cf) && $cf!=''){
1069
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1070
-        if(!$cf){return NULL;}
1071
-    }
1072
-
1073
-    $html_var = $cf['htmlvar_name'];
1074
-
1075
-    // Check if there is a location specific filter.
1076
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1077
-        /**
1078
-         * Filter the email html by location.
1079
-         *
1080
-         * @param string $html The html to filter.
1081
-         * @param array $cf The custom field array.
1082
-         * @since 1.6.6
1083
-         */
1084
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1085
-    }
1086
-
1087
-    // Check if there is a custom field specific filter.
1088
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1089
-        /**
1090
-         * Filter the email html by individual custom field.
1091
-         *
1092
-         * @param string $html The html to filter.
1093
-         * @param string $location The location to output the html.
1094
-         * @param array $cf The custom field array.
1095
-         * @since 1.6.6
1096
-         */
1097
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1098
-    }
1099
-
1100
-    // Check if there is a custom field key specific filter.
1101
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1102
-        /**
1103
-         * Filter the email html by field type key.
1104
-         *
1105
-         * @param string $html The html to filter.
1106
-         * @param string $location The location to output the html.
1107
-         * @param array $cf The custom field array.
1108
-         * @since 1.6.6
1109
-         */
1110
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1111
-    }
1112
-
1113
-    // If not html then we run the standard output.
1114
-    if(empty($html)){
1115
-
1116
-        global $preview;
1117
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1118
-            return ''; // Remove Send Enquiry | Send To Friend from listings page
1119
-        }
1120
-
1121
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1122
-
1123
-        if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1124
-            global $send_to_friend;
1125
-            $send_to_friend = true;
1126
-            $b_send_inquiry = '';
1127
-            $b_sendtofriend = '';
1128
-
1129
-            $html = '';
1130
-            if (!$preview) {
1131
-                $b_send_inquiry = 'b_send_inquiry';
1132
-                $b_sendtofriend = 'b_sendtofriend';
1133
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1134
-            }
1135
-
1136
-            $field_icon = geodir_field_icon_proccess($cf);
1137
-            if (strpos($field_icon, 'http') !== false) {
1138
-                $field_icon_af = '';
1139
-            } elseif ($field_icon == '') {
1140
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1141
-            } else {
1142
-                $field_icon_af = $field_icon;
1143
-                $field_icon = '';
1144
-            }
1145
-
1146
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1147
-            $seperator = '';
1148
-            if ($post->{$cf['htmlvar_name']}) {
1149
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1150
-                $seperator = ' | ';
1151
-            }
1152
-
1153
-            if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1154
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1155
-            }
1156
-
1157
-            $html .= '</span></div>';
1158
-
1159
-
1160
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1161
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1162
-            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1163
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1164
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1165
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1166
-            }
1167
-
1168
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1169
-
1170
-        } else {
1171
-
1172
-            if ($post->{$cf['htmlvar_name']}) {
1173
-
1174
-                $field_icon = geodir_field_icon_proccess($cf);
1175
-                if (strpos($field_icon, 'http') !== false) {
1176
-                    $field_icon_af = '';
1177
-                } elseif ($field_icon == '') {
1178
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1179
-                } else {
1180
-                    $field_icon_af = $field_icon;
1181
-                    $field_icon = '';
1182
-                }
1183
-
1184
-
1185
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1186
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1187
-                $html .= '</span><span class="geodir-email-address-output">';
1188
-                $email = $post->{$cf['htmlvar_name']} ;
1189
-                if($e_split = explode('@',$email)){
1190
-                    /**
1191
-                     * Filter email custom field name output.
1192
-                     *
1193
-                     * @since 1.5.3
1194
-                     *
1195
-                     * @param string $email The email string being output.
1196
-                     * @param array $cf Custom field variables array.
1197
-                     */
1198
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1199
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1200
-                }else{
1201
-                    $html .=  $email;
1202
-                }
1203
-                $html .= '</span></div>';
1204
-            }
1205
-
1206
-        }
1207
-
1208
-    }
1209
-
1210
-    return $html;
1064
+	// check we have the post value
1065
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1066
+	else{ global $post;}
1067
+
1068
+	if(!is_array($cf) && $cf!=''){
1069
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1070
+		if(!$cf){return NULL;}
1071
+	}
1072
+
1073
+	$html_var = $cf['htmlvar_name'];
1074
+
1075
+	// Check if there is a location specific filter.
1076
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1077
+		/**
1078
+		 * Filter the email html by location.
1079
+		 *
1080
+		 * @param string $html The html to filter.
1081
+		 * @param array $cf The custom field array.
1082
+		 * @since 1.6.6
1083
+		 */
1084
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1085
+	}
1086
+
1087
+	// Check if there is a custom field specific filter.
1088
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1089
+		/**
1090
+		 * Filter the email html by individual custom field.
1091
+		 *
1092
+		 * @param string $html The html to filter.
1093
+		 * @param string $location The location to output the html.
1094
+		 * @param array $cf The custom field array.
1095
+		 * @since 1.6.6
1096
+		 */
1097
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1098
+	}
1099
+
1100
+	// Check if there is a custom field key specific filter.
1101
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1102
+		/**
1103
+		 * Filter the email html by field type key.
1104
+		 *
1105
+		 * @param string $html The html to filter.
1106
+		 * @param string $location The location to output the html.
1107
+		 * @param array $cf The custom field array.
1108
+		 * @since 1.6.6
1109
+		 */
1110
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1111
+	}
1112
+
1113
+	// If not html then we run the standard output.
1114
+	if(empty($html)){
1115
+
1116
+		global $preview;
1117
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1118
+			return ''; // Remove Send Enquiry | Send To Friend from listings page
1119
+		}
1120
+
1121
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1122
+
1123
+		if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1124
+			global $send_to_friend;
1125
+			$send_to_friend = true;
1126
+			$b_send_inquiry = '';
1127
+			$b_sendtofriend = '';
1128
+
1129
+			$html = '';
1130
+			if (!$preview) {
1131
+				$b_send_inquiry = 'b_send_inquiry';
1132
+				$b_sendtofriend = 'b_sendtofriend';
1133
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1134
+			}
1135
+
1136
+			$field_icon = geodir_field_icon_proccess($cf);
1137
+			if (strpos($field_icon, 'http') !== false) {
1138
+				$field_icon_af = '';
1139
+			} elseif ($field_icon == '') {
1140
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1141
+			} else {
1142
+				$field_icon_af = $field_icon;
1143
+				$field_icon = '';
1144
+			}
1145
+
1146
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1147
+			$seperator = '';
1148
+			if ($post->{$cf['htmlvar_name']}) {
1149
+				$html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1150
+				$seperator = ' | ';
1151
+			}
1152
+
1153
+			if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1154
+				$html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1155
+			}
1156
+
1157
+			$html .= '</span></div>';
1158
+
1159
+
1160
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1161
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1162
+			} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1163
+				$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1164
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1165
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1166
+			}
1167
+
1168
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1169
+
1170
+		} else {
1171
+
1172
+			if ($post->{$cf['htmlvar_name']}) {
1173
+
1174
+				$field_icon = geodir_field_icon_proccess($cf);
1175
+				if (strpos($field_icon, 'http') !== false) {
1176
+					$field_icon_af = '';
1177
+				} elseif ($field_icon == '') {
1178
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1179
+				} else {
1180
+					$field_icon_af = $field_icon;
1181
+					$field_icon = '';
1182
+				}
1183
+
1184
+
1185
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1186
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1187
+				$html .= '</span><span class="geodir-email-address-output">';
1188
+				$email = $post->{$cf['htmlvar_name']} ;
1189
+				if($e_split = explode('@',$email)){
1190
+					/**
1191
+					 * Filter email custom field name output.
1192
+					 *
1193
+					 * @since 1.5.3
1194
+					 *
1195
+					 * @param string $email The email string being output.
1196
+					 * @param array $cf Custom field variables array.
1197
+					 */
1198
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1199
+					$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1200
+				}else{
1201
+					$html .=  $email;
1202
+				}
1203
+				$html .= '</span></div>';
1204
+			}
1205
+
1206
+		}
1207
+
1208
+	}
1209
+
1210
+	return $html;
1211 1211
 }
1212 1212
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1213 1213
 
@@ -1224,130 +1224,130 @@  discard block
 block discarded – undo
1224 1224
  */
1225 1225
 function geodir_cf_file($html,$location,$cf,$p=''){
1226 1226
 
1227
-    // check we have the post value
1228
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1229
-    else{ global $post;}
1230
-
1231
-    if(!is_array($cf) && $cf!=''){
1232
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1233
-        if(!$cf){return NULL;}
1234
-    }
1235
-
1236
-    $html_var = $cf['htmlvar_name'];
1237
-
1238
-    // Check if there is a location specific filter.
1239
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1240
-        /**
1241
-         * Filter the file html by location.
1242
-         *
1243
-         * @param string $html The html to filter.
1244
-         * @param array $cf The custom field array.
1245
-         * @since 1.6.6
1246
-         */
1247
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1248
-    }
1249
-
1250
-    // Check if there is a custom field specific filter.
1251
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1252
-        /**
1253
-         * Filter the file html by individual custom field.
1254
-         *
1255
-         * @param string $html The html to filter.
1256
-         * @param string $location The location to output the html.
1257
-         * @param array $cf The custom field array.
1258
-         * @since 1.6.6
1259
-         */
1260
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1261
-    }
1262
-
1263
-    // Check if there is a custom field key specific filter.
1264
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1265
-        /**
1266
-         * Filter the file html by field type key.
1267
-         *
1268
-         * @param string $html The html to filter.
1269
-         * @param string $location The location to output the html.
1270
-         * @param array $cf The custom field array.
1271
-         * @since 1.6.6
1272
-         */
1273
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1274
-    }
1275
-
1276
-    // If not html then we run the standard output.
1277
-    if(empty($html)){
1278
-
1279
-        if (!empty($post->{$cf['htmlvar_name']})):
1280
-
1281
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1282
-            if (!empty($files)):
1283
-
1284
-                $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1285
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1286
-
1287
-                $file_paths = '';
1288
-                foreach ($files as $file) {
1289
-                    if (!empty($file)) {
1290
-
1291
-                        // $filetype = wp_check_filetype($file);
1292
-
1293
-                        $image_name_arr = explode('/', $file);
1294
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1295
-                        $filename = end($image_name_arr);
1296
-                        $img_name_arr = explode('.', $filename);
1297
-
1298
-                        $arr_file_type = wp_check_filetype($filename);
1299
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1300
-                            continue;
1301
-                        }
1302
-
1303
-                        $uploaded_file_type = $arr_file_type['type'];
1304
-                        $uploaded_file_ext = $arr_file_type['ext'];
1305
-
1306
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1307
-                            continue; // Invalid file type.
1308
-                        }
1309
-
1310
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1311
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1312
-
1313
-                        // If the uploaded file is image
1314
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1315
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1316
-                            $file_paths .= '<a href="'.$file.'">';
1317
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1318
-                            $file_paths .= '</a>';
1319
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1320
-                            $file_paths .= '</div>';
1321
-                        } else {
1322
-                            $ext_path = '_' . $html_var . '_';
1323
-                            $filename = explode($ext_path, $filename);
1324
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1325
-                        }
1326
-                    }
1327
-                }
1328
-
1329
-                $field_icon = geodir_field_icon_proccess($cf);
1330
-                if (strpos($field_icon, 'http') !== false) {
1331
-                    $field_icon_af = '';
1332
-                } elseif ($field_icon == '') {
1333
-                    $field_icon_af = '';
1334
-                } else {
1335
-                    $field_icon_af = $field_icon;
1336
-                    $field_icon = '';
1337
-                }
1338
-
1339
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1340
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1341
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1342
-                $html .= '</span>';
1343
-                $html .= $file_paths . '</div></div>';
1344
-
1345
-            endif;
1346
-        endif;
1347
-
1348
-    }
1349
-
1350
-    return $html;
1227
+	// check we have the post value
1228
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1229
+	else{ global $post;}
1230
+
1231
+	if(!is_array($cf) && $cf!=''){
1232
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1233
+		if(!$cf){return NULL;}
1234
+	}
1235
+
1236
+	$html_var = $cf['htmlvar_name'];
1237
+
1238
+	// Check if there is a location specific filter.
1239
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1240
+		/**
1241
+		 * Filter the file html by location.
1242
+		 *
1243
+		 * @param string $html The html to filter.
1244
+		 * @param array $cf The custom field array.
1245
+		 * @since 1.6.6
1246
+		 */
1247
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1248
+	}
1249
+
1250
+	// Check if there is a custom field specific filter.
1251
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1252
+		/**
1253
+		 * Filter the file html by individual custom field.
1254
+		 *
1255
+		 * @param string $html The html to filter.
1256
+		 * @param string $location The location to output the html.
1257
+		 * @param array $cf The custom field array.
1258
+		 * @since 1.6.6
1259
+		 */
1260
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1261
+	}
1262
+
1263
+	// Check if there is a custom field key specific filter.
1264
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1265
+		/**
1266
+		 * Filter the file html by field type key.
1267
+		 *
1268
+		 * @param string $html The html to filter.
1269
+		 * @param string $location The location to output the html.
1270
+		 * @param array $cf The custom field array.
1271
+		 * @since 1.6.6
1272
+		 */
1273
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1274
+	}
1275
+
1276
+	// If not html then we run the standard output.
1277
+	if(empty($html)){
1278
+
1279
+		if (!empty($post->{$cf['htmlvar_name']})):
1280
+
1281
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1282
+			if (!empty($files)):
1283
+
1284
+				$extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1285
+				$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1286
+
1287
+				$file_paths = '';
1288
+				foreach ($files as $file) {
1289
+					if (!empty($file)) {
1290
+
1291
+						// $filetype = wp_check_filetype($file);
1292
+
1293
+						$image_name_arr = explode('/', $file);
1294
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1295
+						$filename = end($image_name_arr);
1296
+						$img_name_arr = explode('.', $filename);
1297
+
1298
+						$arr_file_type = wp_check_filetype($filename);
1299
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1300
+							continue;
1301
+						}
1302
+
1303
+						$uploaded_file_type = $arr_file_type['type'];
1304
+						$uploaded_file_ext = $arr_file_type['ext'];
1305
+
1306
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1307
+							continue; // Invalid file type.
1308
+						}
1309
+
1310
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1311
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1312
+
1313
+						// If the uploaded file is image
1314
+						if (in_array($uploaded_file_type, $image_file_types)) {
1315
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1316
+							$file_paths .= '<a href="'.$file.'">';
1317
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1318
+							$file_paths .= '</a>';
1319
+							//$file_paths .= '<img src="'.$file.'"  />';	
1320
+							$file_paths .= '</div>';
1321
+						} else {
1322
+							$ext_path = '_' . $html_var . '_';
1323
+							$filename = explode($ext_path, $filename);
1324
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1325
+						}
1326
+					}
1327
+				}
1328
+
1329
+				$field_icon = geodir_field_icon_proccess($cf);
1330
+				if (strpos($field_icon, 'http') !== false) {
1331
+					$field_icon_af = '';
1332
+				} elseif ($field_icon == '') {
1333
+					$field_icon_af = '';
1334
+				} else {
1335
+					$field_icon_af = $field_icon;
1336
+					$field_icon = '';
1337
+				}
1338
+
1339
+				$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1340
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1341
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1342
+				$html .= '</span>';
1343
+				$html .= $file_paths . '</div></div>';
1344
+
1345
+			endif;
1346
+		endif;
1347
+
1348
+	}
1349
+
1350
+	return $html;
1351 1351
 }
1352 1352
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1353 1353
 
@@ -1365,80 +1365,80 @@  discard block
 block discarded – undo
1365 1365
  */
1366 1366
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1367 1367
 
1368
-    // check we have the post value
1369
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1370
-    else{ global $post;}
1371
-
1372
-    if(!is_array($cf) && $cf!=''){
1373
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1374
-        if(!$cf){return NULL;}
1375
-    }
1376
-
1377
-    $html_var = $cf['htmlvar_name'];
1378
-
1379
-    // Check if there is a location specific filter.
1380
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1381
-        /**
1382
-         * Filter the textarea html by location.
1383
-         *
1384
-         * @param string $html The html to filter.
1385
-         * @param array $cf The custom field array.
1386
-         * @since 1.6.6
1387
-         */
1388
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1389
-    }
1390
-
1391
-    // Check if there is a custom field specific filter.
1392
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1393
-        /**
1394
-         * Filter the textarea html by individual custom field.
1395
-         *
1396
-         * @param string $html The html to filter.
1397
-         * @param string $location The location to output the html.
1398
-         * @param array $cf The custom field array.
1399
-         * @since 1.6.6
1400
-         */
1401
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1402
-    }
1403
-
1404
-    // Check if there is a custom field key specific filter.
1405
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1406
-        /**
1407
-         * Filter the textarea html by field type key.
1408
-         *
1409
-         * @param string $html The html to filter.
1410
-         * @param string $location The location to output the html.
1411
-         * @param array $cf The custom field array.
1412
-         * @since 1.6.6
1413
-         */
1414
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1415
-    }
1416
-
1417
-    // If not html then we run the standard output.
1418
-    if(empty($html)){
1419
-
1420
-        if (!empty($post->{$cf['htmlvar_name']})) {
1421
-
1422
-            $field_icon = geodir_field_icon_proccess($cf);
1423
-            if (strpos($field_icon, 'http') !== false) {
1424
-                $field_icon_af = '';
1425
-            } elseif ($field_icon == '') {
1426
-                $field_icon_af = '';
1427
-            } else {
1428
-                $field_icon_af = $field_icon;
1429
-                $field_icon = '';
1430
-            }
1431
-
1432
-
1433
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1434
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1435
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1436
-
1437
-        }
1438
-
1439
-    }
1440
-
1441
-    return $html;
1368
+	// check we have the post value
1369
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1370
+	else{ global $post;}
1371
+
1372
+	if(!is_array($cf) && $cf!=''){
1373
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1374
+		if(!$cf){return NULL;}
1375
+	}
1376
+
1377
+	$html_var = $cf['htmlvar_name'];
1378
+
1379
+	// Check if there is a location specific filter.
1380
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1381
+		/**
1382
+		 * Filter the textarea html by location.
1383
+		 *
1384
+		 * @param string $html The html to filter.
1385
+		 * @param array $cf The custom field array.
1386
+		 * @since 1.6.6
1387
+		 */
1388
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1389
+	}
1390
+
1391
+	// Check if there is a custom field specific filter.
1392
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1393
+		/**
1394
+		 * Filter the textarea html by individual custom field.
1395
+		 *
1396
+		 * @param string $html The html to filter.
1397
+		 * @param string $location The location to output the html.
1398
+		 * @param array $cf The custom field array.
1399
+		 * @since 1.6.6
1400
+		 */
1401
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1402
+	}
1403
+
1404
+	// Check if there is a custom field key specific filter.
1405
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1406
+		/**
1407
+		 * Filter the textarea html by field type key.
1408
+		 *
1409
+		 * @param string $html The html to filter.
1410
+		 * @param string $location The location to output the html.
1411
+		 * @param array $cf The custom field array.
1412
+		 * @since 1.6.6
1413
+		 */
1414
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1415
+	}
1416
+
1417
+	// If not html then we run the standard output.
1418
+	if(empty($html)){
1419
+
1420
+		if (!empty($post->{$cf['htmlvar_name']})) {
1421
+
1422
+			$field_icon = geodir_field_icon_proccess($cf);
1423
+			if (strpos($field_icon, 'http') !== false) {
1424
+				$field_icon_af = '';
1425
+			} elseif ($field_icon == '') {
1426
+				$field_icon_af = '';
1427
+			} else {
1428
+				$field_icon_af = $field_icon;
1429
+				$field_icon = '';
1430
+			}
1431
+
1432
+
1433
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1434
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1435
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1436
+
1437
+		}
1438
+
1439
+	}
1440
+
1441
+	return $html;
1442 1442
 }
1443 1443
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1444 1444
 
@@ -1456,79 +1456,79 @@  discard block
 block discarded – undo
1456 1456
  */
1457 1457
 function geodir_cf_html($html,$location,$cf,$p=''){
1458 1458
 
1459
-    // check we have the post value
1460
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1461
-    else{ global $post;}
1462
-
1463
-    if(!is_array($cf) && $cf!=''){
1464
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1465
-        if(!$cf){return NULL;}
1466
-    }
1467
-
1468
-    $html_var = $cf['htmlvar_name'];
1469
-
1470
-    // Check if there is a location specific filter.
1471
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1472
-        /**
1473
-         * Filter the html html by location.
1474
-         *
1475
-         * @param string $html The html to filter.
1476
-         * @param array $cf The custom field array.
1477
-         * @since 1.6.6
1478
-         */
1479
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1480
-    }
1481
-
1482
-    // Check if there is a custom field specific filter.
1483
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1484
-        /**
1485
-         * Filter the html html by individual custom field.
1486
-         *
1487
-         * @param string $html The html to filter.
1488
-         * @param string $location The location to output the html.
1489
-         * @param array $cf The custom field array.
1490
-         * @since 1.6.6
1491
-         */
1492
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1493
-    }
1494
-
1495
-    // Check if there is a custom field key specific filter.
1496
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1497
-        /**
1498
-         * Filter the html html by field type key.
1499
-         *
1500
-         * @param string $html The html to filter.
1501
-         * @param string $location The location to output the html.
1502
-         * @param array $cf The custom field array.
1503
-         * @since 1.6.6
1504
-         */
1505
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1506
-    }
1507
-
1508
-    // If not html then we run the standard output.
1509
-    if(empty($html)){
1510
-
1511
-        if (!empty($post->{$cf['htmlvar_name']})) {
1512
-
1513
-            $field_icon = geodir_field_icon_proccess($cf);
1514
-            if (strpos($field_icon, 'http') !== false) {
1515
-                $field_icon_af = '';
1516
-            } elseif ($field_icon == '') {
1517
-                $field_icon_af = '';
1518
-            } else {
1519
-                $field_icon_af = $field_icon;
1520
-                $field_icon = '';
1521
-            }
1522
-
1523
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1524
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1525
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1526
-
1527
-        }
1528
-
1529
-    }
1530
-
1531
-    return $html;
1459
+	// check we have the post value
1460
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1461
+	else{ global $post;}
1462
+
1463
+	if(!is_array($cf) && $cf!=''){
1464
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1465
+		if(!$cf){return NULL;}
1466
+	}
1467
+
1468
+	$html_var = $cf['htmlvar_name'];
1469
+
1470
+	// Check if there is a location specific filter.
1471
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1472
+		/**
1473
+		 * Filter the html html by location.
1474
+		 *
1475
+		 * @param string $html The html to filter.
1476
+		 * @param array $cf The custom field array.
1477
+		 * @since 1.6.6
1478
+		 */
1479
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1480
+	}
1481
+
1482
+	// Check if there is a custom field specific filter.
1483
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1484
+		/**
1485
+		 * Filter the html html by individual custom field.
1486
+		 *
1487
+		 * @param string $html The html to filter.
1488
+		 * @param string $location The location to output the html.
1489
+		 * @param array $cf The custom field array.
1490
+		 * @since 1.6.6
1491
+		 */
1492
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1493
+	}
1494
+
1495
+	// Check if there is a custom field key specific filter.
1496
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1497
+		/**
1498
+		 * Filter the html html by field type key.
1499
+		 *
1500
+		 * @param string $html The html to filter.
1501
+		 * @param string $location The location to output the html.
1502
+		 * @param array $cf The custom field array.
1503
+		 * @since 1.6.6
1504
+		 */
1505
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1506
+	}
1507
+
1508
+	// If not html then we run the standard output.
1509
+	if(empty($html)){
1510
+
1511
+		if (!empty($post->{$cf['htmlvar_name']})) {
1512
+
1513
+			$field_icon = geodir_field_icon_proccess($cf);
1514
+			if (strpos($field_icon, 'http') !== false) {
1515
+				$field_icon_af = '';
1516
+			} elseif ($field_icon == '') {
1517
+				$field_icon_af = '';
1518
+			} else {
1519
+				$field_icon_af = $field_icon;
1520
+				$field_icon = '';
1521
+			}
1522
+
1523
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1524
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1525
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1526
+
1527
+		}
1528
+
1529
+	}
1530
+
1531
+	return $html;
1532 1532
 }
1533 1533
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1534 1534
 
@@ -1546,113 +1546,113 @@  discard block
 block discarded – undo
1546 1546
  */
1547 1547
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1548 1548
 
1549
-    // check we have the post value
1550
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1551
-    else{ global $post;}
1552
-
1553
-    if(!is_array($cf) && $cf!=''){
1554
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1555
-        if(!$cf){return NULL;}
1556
-    }
1557
-
1558
-    $html_var = $cf['htmlvar_name'];
1559
-
1560
-    // Check if there is a location specific filter.
1561
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1562
-        /**
1563
-         * Filter the taxonomy html by location.
1564
-         *
1565
-         * @param string $html The html to filter.
1566
-         * @param array $cf The custom field array.
1567
-         * @since 1.6.6
1568
-         */
1569
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1570
-    }
1571
-
1572
-    // Check if there is a custom field specific filter.
1573
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1574
-        /**
1575
-         * Filter the taxonomy html by individual custom field.
1576
-         *
1577
-         * @param string $html The html to filter.
1578
-         * @param string $location The location to output the html.
1579
-         * @param array $cf The custom field array.
1580
-         * @since 1.6.6
1581
-         */
1582
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1583
-    }
1584
-
1585
-    // Check if there is a custom field key specific filter.
1586
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1587
-        /**
1588
-         * Filter the taxonomy html by field type key.
1589
-         *
1590
-         * @param string $html The html to filter.
1591
-         * @param string $location The location to output the html.
1592
-         * @param array $cf The custom field array.
1593
-         * @since 1.6.6
1594
-         */
1595
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1596
-    }
1597
-
1598
-    // If not html then we run the standard output.
1599
-    if(empty($html)){
1600
-
1601
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1602
-            $post_taxonomy = $post->post_type . 'category';
1603
-            $field_value = $post->{$html_var};
1604
-            $links = array();
1605
-            $terms = array();
1606
-            $termsOrdered = array();
1607
-            if (!is_array($field_value)) {
1608
-                $field_value = explode(",", trim($field_value, ","));
1609
-            }
1610
-
1611
-            $field_value = array_unique($field_value);
1612
-
1613
-            if (!empty($field_value)) {
1614
-                foreach ($field_value as $term) {
1615
-                    $term = trim($term);
1616
-
1617
-                    if ($term != '') {
1618
-                        $term = get_term_by('id', $term, $html_var);
1619
-                        if (is_object($term)) {
1620
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1621
-                            $terms[] = $term;
1622
-                        }
1623
-                    }
1624
-                }
1625
-                if (!empty($links)) {
1626
-                    // order alphabetically
1627
-                    asort($links);
1628
-                    foreach (array_keys($links) as $key) {
1629
-                        $termsOrdered[$key] = $terms[$key];
1630
-                    }
1631
-                    $terms = $termsOrdered;
1632
-                }
1633
-            }
1634
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1635
-
1636
-            if ($html_value != '') {
1637
-                $field_icon = geodir_field_icon_proccess($cf);
1638
-                if (strpos($field_icon, 'http') !== false) {
1639
-                    $field_icon_af = '';
1640
-                } else if ($field_icon == '') {
1641
-                    $field_icon_af = '';
1642
-                } else {
1643
-                    $field_icon_af = $field_icon;
1644
-                    $field_icon = '';
1645
-                }
1646
-
1647
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1648
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1649
-                $html .= '</span> ' . $html_value . '</div>';
1650
-            }
1651
-        }
1652
-
1653
-    }
1654
-
1655
-    return $html;
1549
+	// check we have the post value
1550
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1551
+	else{ global $post;}
1552
+
1553
+	if(!is_array($cf) && $cf!=''){
1554
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1555
+		if(!$cf){return NULL;}
1556
+	}
1557
+
1558
+	$html_var = $cf['htmlvar_name'];
1559
+
1560
+	// Check if there is a location specific filter.
1561
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1562
+		/**
1563
+		 * Filter the taxonomy html by location.
1564
+		 *
1565
+		 * @param string $html The html to filter.
1566
+		 * @param array $cf The custom field array.
1567
+		 * @since 1.6.6
1568
+		 */
1569
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1570
+	}
1571
+
1572
+	// Check if there is a custom field specific filter.
1573
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1574
+		/**
1575
+		 * Filter the taxonomy html by individual custom field.
1576
+		 *
1577
+		 * @param string $html The html to filter.
1578
+		 * @param string $location The location to output the html.
1579
+		 * @param array $cf The custom field array.
1580
+		 * @since 1.6.6
1581
+		 */
1582
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1583
+	}
1584
+
1585
+	// Check if there is a custom field key specific filter.
1586
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1587
+		/**
1588
+		 * Filter the taxonomy html by field type key.
1589
+		 *
1590
+		 * @param string $html The html to filter.
1591
+		 * @param string $location The location to output the html.
1592
+		 * @param array $cf The custom field array.
1593
+		 * @since 1.6.6
1594
+		 */
1595
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1596
+	}
1597
+
1598
+	// If not html then we run the standard output.
1599
+	if(empty($html)){
1600
+
1601
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1602
+			$post_taxonomy = $post->post_type . 'category';
1603
+			$field_value = $post->{$html_var};
1604
+			$links = array();
1605
+			$terms = array();
1606
+			$termsOrdered = array();
1607
+			if (!is_array($field_value)) {
1608
+				$field_value = explode(",", trim($field_value, ","));
1609
+			}
1610
+
1611
+			$field_value = array_unique($field_value);
1612
+
1613
+			if (!empty($field_value)) {
1614
+				foreach ($field_value as $term) {
1615
+					$term = trim($term);
1616
+
1617
+					if ($term != '') {
1618
+						$term = get_term_by('id', $term, $html_var);
1619
+						if (is_object($term)) {
1620
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1621
+							$terms[] = $term;
1622
+						}
1623
+					}
1624
+				}
1625
+				if (!empty($links)) {
1626
+					// order alphabetically
1627
+					asort($links);
1628
+					foreach (array_keys($links) as $key) {
1629
+						$termsOrdered[$key] = $terms[$key];
1630
+					}
1631
+					$terms = $termsOrdered;
1632
+				}
1633
+			}
1634
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1635
+
1636
+			if ($html_value != '') {
1637
+				$field_icon = geodir_field_icon_proccess($cf);
1638
+				if (strpos($field_icon, 'http') !== false) {
1639
+					$field_icon_af = '';
1640
+				} else if ($field_icon == '') {
1641
+					$field_icon_af = '';
1642
+				} else {
1643
+					$field_icon_af = $field_icon;
1644
+					$field_icon = '';
1645
+				}
1646
+
1647
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1648
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1649
+				$html .= '</span> ' . $html_value . '</div>';
1650
+			}
1651
+		}
1652
+
1653
+	}
1654
+
1655
+	return $html;
1656 1656
 }
1657 1657
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1658 1658
 
@@ -1669,161 +1669,161 @@  discard block
 block discarded – undo
1669 1669
  */
1670 1670
 function geodir_cf_address($html,$location,$cf,$p=''){
1671 1671
 
1672
-    // check we have the post value
1673
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1674
-    else{ global $post;}
1675
-
1676
-    if(!is_array($cf) && $cf!=''){
1677
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1678
-        if(!$cf){return NULL;}
1679
-    }
1680
-
1681
-    $html_var = $cf['htmlvar_name'];
1682
-
1683
-    // Check if there is a location specific filter.
1684
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1685
-        /**
1686
-         * Filter the address html by location.
1687
-         *
1688
-         * @param string $html The html to filter.
1689
-         * @param array $cf The custom field array.
1690
-         * @since 1.6.6
1691
-         */
1692
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1693
-    }
1694
-
1695
-    // Check if there is a custom field specific filter.
1696
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1697
-        /**
1698
-         * Filter the address html by individual custom field.
1699
-         *
1700
-         * @param string $html The html to filter.
1701
-         * @param string $location The location to output the html.
1702
-         * @param array $cf The custom field array.
1703
-         * @since 1.6.6
1704
-         */
1705
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1706
-    }
1707
-
1708
-    // Check if there is a custom field key specific filter.
1709
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1710
-        /**
1711
-         * Filter the address html by field type key.
1712
-         *
1713
-         * @param string $html The html to filter.
1714
-         * @param string $location The location to output the html.
1715
-         * @param array $cf The custom field array.
1716
-         * @since 1.6.6
1717
-         */
1718
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1719
-    }
1720
-
1721
-    // If not html then we run the standard output.
1722
-    if(empty($html)){
1723
-
1724
-        global $preview;
1725
-        $html_var = $cf['htmlvar_name'] . '_address';
1726
-
1727
-        if ($cf['extra_fields']) {
1728
-
1729
-            $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1730
-
1731
-            $addition_fields = '';
1732
-
1733
-            if (!empty($extra_fields)) {
1734
-
1735
-                $show_city_in_address = false;
1736
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1737
-                    $show_city_in_address = true;
1738
-                }
1739
-                /**
1740
-                 * Filter "show city in address" value.
1741
-                 *
1742
-                 * @since 1.0.0
1743
-                 */
1744
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1745
-
1746
-
1747
-                $show_region_in_address = false;
1748
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1749
-                    $show_region_in_address = true;
1750
-                }
1751
-                /**
1752
-                 * Filter "show region in address" value.
1753
-                 *
1754
-                 * @since 1.6.6
1755
-                 */
1756
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1757
-
1758
-                $show_country_in_address = false;
1759
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1760
-                    $show_country_in_address = true;
1761
-                }
1762
-                /**
1763
-                 * Filter "show country in address" value.
1764
-                 *
1765
-                 * @since 1.6.6
1766
-                 */
1767
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1768
-
1769
-                $show_zip_in_address = false;
1770
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1771
-                    $show_zip_in_address = true;
1772
-                }
1773
-                /**
1774
-                 * Filter "show zip in address" value.
1775
-                 *
1776
-                 * @since 1.6.6
1777
-                 */
1778
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1779
-
1780
-
1781
-            }
1782
-
1783
-        }
1784
-
1785
-
1786
-        if ($post->{$html_var}) {
1787
-
1788
-            $field_icon = geodir_field_icon_proccess( $cf );
1789
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1790
-                $field_icon_af = '';
1791
-            } elseif ( $field_icon == '' ) {
1792
-                $field_icon_af = '<i class="fa fa-home"></i>';
1793
-            } else {
1794
-                $field_icon_af = $field_icon;
1795
-                $field_icon    = '';
1796
-            }
1672
+	// check we have the post value
1673
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1674
+	else{ global $post;}
1675
+
1676
+	if(!is_array($cf) && $cf!=''){
1677
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1678
+		if(!$cf){return NULL;}
1679
+	}
1680
+
1681
+	$html_var = $cf['htmlvar_name'];
1682
+
1683
+	// Check if there is a location specific filter.
1684
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1685
+		/**
1686
+		 * Filter the address html by location.
1687
+		 *
1688
+		 * @param string $html The html to filter.
1689
+		 * @param array $cf The custom field array.
1690
+		 * @since 1.6.6
1691
+		 */
1692
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1693
+	}
1694
+
1695
+	// Check if there is a custom field specific filter.
1696
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1697
+		/**
1698
+		 * Filter the address html by individual custom field.
1699
+		 *
1700
+		 * @param string $html The html to filter.
1701
+		 * @param string $location The location to output the html.
1702
+		 * @param array $cf The custom field array.
1703
+		 * @since 1.6.6
1704
+		 */
1705
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1706
+	}
1707
+
1708
+	// Check if there is a custom field key specific filter.
1709
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1710
+		/**
1711
+		 * Filter the address html by field type key.
1712
+		 *
1713
+		 * @param string $html The html to filter.
1714
+		 * @param string $location The location to output the html.
1715
+		 * @param array $cf The custom field array.
1716
+		 * @since 1.6.6
1717
+		 */
1718
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1719
+	}
1720
+
1721
+	// If not html then we run the standard output.
1722
+	if(empty($html)){
1723
+
1724
+		global $preview;
1725
+		$html_var = $cf['htmlvar_name'] . '_address';
1726
+
1727
+		if ($cf['extra_fields']) {
1728
+
1729
+			$extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1730
+
1731
+			$addition_fields = '';
1732
+
1733
+			if (!empty($extra_fields)) {
1734
+
1735
+				$show_city_in_address = false;
1736
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1737
+					$show_city_in_address = true;
1738
+				}
1739
+				/**
1740
+				 * Filter "show city in address" value.
1741
+				 *
1742
+				 * @since 1.0.0
1743
+				 */
1744
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1745
+
1746
+
1747
+				$show_region_in_address = false;
1748
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1749
+					$show_region_in_address = true;
1750
+				}
1751
+				/**
1752
+				 * Filter "show region in address" value.
1753
+				 *
1754
+				 * @since 1.6.6
1755
+				 */
1756
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1757
+
1758
+				$show_country_in_address = false;
1759
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1760
+					$show_country_in_address = true;
1761
+				}
1762
+				/**
1763
+				 * Filter "show country in address" value.
1764
+				 *
1765
+				 * @since 1.6.6
1766
+				 */
1767
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1768
+
1769
+				$show_zip_in_address = false;
1770
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1771
+					$show_zip_in_address = true;
1772
+				}
1773
+				/**
1774
+				 * Filter "show zip in address" value.
1775
+				 *
1776
+				 * @since 1.6.6
1777
+				 */
1778
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1779
+
1780
+
1781
+			}
1782
+
1783
+		}
1784
+
1785
+
1786
+		if ($post->{$html_var}) {
1787
+
1788
+			$field_icon = geodir_field_icon_proccess( $cf );
1789
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1790
+				$field_icon_af = '';
1791
+			} elseif ( $field_icon == '' ) {
1792
+				$field_icon_af = '<i class="fa fa-home"></i>';
1793
+			} else {
1794
+				$field_icon_af = $field_icon;
1795
+				$field_icon    = '';
1796
+			}
1797 1797
             
1798 1798
 
1799 1799
 
1800
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1801
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1802
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1803
-            $html .= '</span>';
1800
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1801
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1802
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1803
+			$html .= '</span>';
1804 1804
 
1805
-            if ( isset($post->post_address) ) {
1806
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1807
-            }
1808
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1809
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1810
-            }
1811
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1812
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1813
-            }
1814
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1815
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1816
-            }
1817
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1818
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1819
-            }
1820
-            $html .= '</div>';
1805
+			if ( isset($post->post_address) ) {
1806
+				$html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1807
+			}
1808
+			if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1809
+				$html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1810
+			}
1811
+			if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1812
+				$html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1813
+			}
1814
+			if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1815
+				$html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1816
+			}
1817
+			if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1818
+				$html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1819
+			}
1820
+			$html .= '</div>';
1821 1821
 
1822
-        }
1822
+		}
1823 1823
 
1824
-    }
1824
+	}
1825 1825
 
1826 1826
 
1827
-    return $html;
1827
+	return $html;
1828 1828
 }
1829 1829
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1830 1830
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +302 added lines, -302 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return string The html to output for the custom field.
21 21
  */
22
-function geodir_cf_checkbox($html,$location,$cf,$p=''){
22
+function geodir_cf_checkbox($html, $location, $cf, $p = '') {
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
26
+    else { global $post; }
27 27
 
28
-    if(!is_array($cf) && $cf!=''){
28
+    if (!is_array($cf) && $cf != '') {
29 29
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
30
+        if (!$cf) {return NULL; }
31 31
     }
32 32
 
33 33
     $html_var = $cf['htmlvar_name'];
34 34
 
35 35
     // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
36
+    if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) {
37 37
         /**
38 38
          * Filter the checkbox html by location.
39 39
          *
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
          * @param array $cf The custom field array.
42 42
          * @since 1.6.6
43 43
          */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
44
+        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf);
45 45
     }
46 46
 
47 47
     // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
48
+    if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) {
49 49
         /**
50 50
          * Filter the checkbox html by individual custom field.
51 51
          *
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
          * @param array $cf The custom field array.
55 55
          * @since 1.6.6
56 56
          */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
57
+        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf);
58 58
     }
59 59
 
60 60
     // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
61
+    if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) {
62 62
         /**
63 63
          * Filter the checkbox html by field type key.
64 64
          *
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
          * @param array $cf The custom field array.
68 68
          * @since 1.6.6
69 69
          */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
70
+        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf);
71 71
     }
72 72
 
73 73
     // If not html then we run the standard output.
74
-    if(empty($html)){
74
+    if (empty($html)) {
75 75
 
76
-        if ( (int) $post->{$html_var} == 1 ):
76
+        if ((int) $post->{$html_var} == 1):
77 77
 
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
78
+            if ($post->{$html_var} == '1'):
79
+                $html_val = __('Yes', 'geodirectory');
80 80
             else:
81
-                $html_val = __( 'No', 'geodirectory' );
81
+                $html_val = __('No', 'geodirectory');
82 82
             endif;
83 83
 
84 84
             $field_icon = geodir_field_icon_proccess($cf);
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
                 $field_icon = '';
92 92
             }
93 93
 
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
94
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;
95
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
96
+            $html .= '</span>'.$html_val.'</div>';
97 97
         endif;
98 98
 
99 99
     }
100 100
 
101 101
     return $html;
102 102
 }
103
-add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
103
+add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3);
104 104
 
105 105
 
106 106
 /**
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string The html to output for the custom field.
115 115
  */
116
-function geodir_cf_fieldset($html,$location,$cf,$p=''){
116
+function geodir_cf_fieldset($html, $location, $cf, $p = '') {
117 117
 
118 118
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
119
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
120
+    else { global $post; }
121 121
 
122
-    if(!is_array($cf) && $cf!=''){
122
+    if (!is_array($cf) && $cf != '') {
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
124
+        if (!$cf) {return NULL; }
125 125
     }
126 126
 
127 127
     $html_var = $cf['htmlvar_name'];
128 128
 
129 129
     // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
130
+    if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) {
131 131
         /**
132 132
          * Filter the fieldset html by location.
133 133
          *
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
          * @param array $cf The custom field array.
136 136
          * @since 1.6.6
137 137
          */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
138
+        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf);
139 139
     }
140 140
 
141 141
     // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
142
+    if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) {
143 143
         /**
144 144
          * Filter the fieldset html by individual custom field.
145 145
          *
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
          * @param array $cf The custom field array.
149 149
          * @since 1.6.6
150 150
          */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
151
+        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf);
152 152
     }
153 153
 
154 154
     // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
155
+    if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) {
156 156
         /**
157 157
          * Filter the fieldset html by field type key.
158 158
          *
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
          * @param array $cf The custom field array.
162 162
          * @since 1.6.6
163 163
          */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
164
+        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf);
165 165
     }
166 166
 
167 167
     // If not html then we run the standard output.
168
-    if(empty($html)){
168
+    if (empty($html)) {
169 169
 
170 170
         global $field_set_start;
171 171
         $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         if ($field_set_start == 1) {
174 174
             $html = '';
175 175
         } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
176
+            $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
177 177
             //$field_set_start = 1;
178 178
         }
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     return $html;
183 183
 }
184
-add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
184
+add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3);
185 185
 
186 186
 
187 187
 /**
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return string The html to output for the custom field.
196 196
  */
197
-function geodir_cf_url($html,$location,$cf,$p=''){
197
+function geodir_cf_url($html, $location, $cf, $p = '') {
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
201
+    else { global $post; }
202 202
 
203
-    if(!is_array($cf) && $cf!=''){
203
+    if (!is_array($cf) && $cf != '') {
204 204
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
205
+        if (!$cf) {return NULL; }
206 206
     }
207 207
 
208 208
     $html_var = $cf['htmlvar_name'];
209 209
 
210 210
     // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
211
+    if (has_filter("geodir_custom_field_output_url_loc_{$location}")) {
212 212
         /**
213 213
          * Filter the url html by location.
214 214
          *
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
          * @param array $cf The custom field array.
217 217
          * @since 1.6.6
218 218
          */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
219
+        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf);
220 220
     }
221 221
 
222 222
     // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
223
+    if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) {
224 224
         /**
225 225
          * Filter the url html by individual custom field.
226 226
          *
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
          * @param array $cf The custom field array.
230 230
          * @since 1.6.6
231 231
          */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
232
+        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf);
233 233
     }
234 234
 
235 235
     // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
236
+    if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) {
237 237
         /**
238 238
          * Filter the url html by field type key.
239 239
          *
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
          * @param array $cf The custom field array.
243 243
          * @since 1.6.6
244 244
          */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
245
+        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf);
246 246
     }
247 247
 
248 248
     // If not html then we run the standard output.
249
-    if(empty($html)){
249
+    if (empty($html)) {
250 250
 
251 251
         if ($post->{$cf['htmlvar_name']}):
252 252
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
             $website = !empty($a_url['url']) ? $a_url['url'] : '';
275 275
             $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
276
+            if (!empty($cf['default_value'])) {$title = $cf['default_value']; }
277 277
             $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278 278
 
279 279
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
              * @param string $website Website URL.
290 290
              * @param int $post->ID Post ID.
291 291
              */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
292
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
293 293
 
294 294
         endif;
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
     return $html;
299 299
 }
300
-add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
300
+add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3);
301 301
 
302 302
 
303 303
 /**
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
  *
311 311
  * @return string The html to output for the custom field.
312 312
  */
313
-function geodir_cf_phone($html,$location,$cf,$p=''){
313
+function geodir_cf_phone($html, $location, $cf, $p = '') {
314 314
 
315 315
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
316
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
317
+    else { global $post; }
318 318
 
319
-    if(!is_array($cf) && $cf!=''){
319
+    if (!is_array($cf) && $cf != '') {
320 320
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
321
+        if (!$cf) {return NULL; }
322 322
     }
323 323
 
324 324
     $html_var = $cf['htmlvar_name'];
325 325
 
326 326
     // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
327
+    if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) {
328 328
         /**
329 329
          * Filter the phone html by location.
330 330
          *
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
          * @param array $cf The custom field array.
333 333
          * @since 1.6.6
334 334
          */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
335
+        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf);
336 336
     }
337 337
 
338 338
     // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
339
+    if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) {
340 340
         /**
341 341
          * Filter the phone html by individual custom field.
342 342
          *
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
          * @param array $cf The custom field array.
346 346
          * @since 1.6.6
347 347
          */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
348
+        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf);
349 349
     }
350 350
 
351 351
     // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
352
+    if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) {
353 353
         /**
354 354
          * Filter the phone html by field type key.
355 355
          *
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
          * @param array $cf The custom field array.
359 359
          * @since 1.6.6
360 360
          */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
361
+        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf);
362 362
     }
363 363
 
364 364
     // If not html then we run the standard output.
365
-    if(empty($html)){
365
+    if (empty($html)) {
366 366
 
367 367
         if ($post->{$cf['htmlvar_name']}):
368 368
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
             }
378 378
 
379 379
 
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
380
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af.
381
+                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
382
+            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>';
383 383
 
384 384
         endif;
385 385
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     return $html;
389 389
 }
390
-add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
390
+add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3);
391 391
 
392 392
 
393 393
 /**
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return string The html to output for the custom field.
402 402
  */
403
-function geodir_cf_time($html,$location,$cf,$p=''){
403
+function geodir_cf_time($html, $location, $cf, $p = '') {
404 404
 
405 405
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
406
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
407
+    else { global $post; }
408 408
 
409
-    if(!is_array($cf) && $cf!=''){
409
+    if (!is_array($cf) && $cf != '') {
410 410
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
411
+        if (!$cf) {return NULL; }
412 412
     }
413 413
 
414 414
     $html_var = $cf['htmlvar_name'];
415 415
 
416 416
     // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
417
+    if (has_filter("geodir_custom_field_output_time_loc_{$location}")) {
418 418
         /**
419 419
          * Filter the time html by location.
420 420
          *
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
          * @param array $cf The custom field array.
423 423
          * @since 1.6.6
424 424
          */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
425
+        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf);
426 426
     }
427 427
 
428 428
     // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
429
+    if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) {
430 430
         /**
431 431
          * Filter the time html by individual custom field.
432 432
          *
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
          * @param array $cf The custom field array.
436 436
          * @since 1.6.6
437 437
          */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
438
+        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf);
439 439
     }
440 440
 
441 441
     // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
442
+    if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) {
443 443
         /**
444 444
          * Filter the time html by field type key.
445 445
          *
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
          * @param array $cf The custom field array.
449 449
          * @since 1.6.6
450 450
          */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
451
+        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf);
452 452
     }
453 453
 
454 454
     // If not html then we run the standard output.
455
-    if(empty($html)){
455
+    if (empty($html)) {
456 456
 
457 457
         if ($post->{$cf['htmlvar_name']}):
458 458
 
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
             }
473 473
 
474 474
 
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
475
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;
476
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
477
+            $html .= '</span>'.$value.'</div>';
478 478
 
479 479
         endif;
480 480
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
     return $html;
484 484
 }
485
-add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
485
+add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3);
486 486
 
487 487
 
488 488
 /**
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string The html to output for the custom field.
497 497
  */
498
-function geodir_cf_datepicker($html,$location,$cf,$p=''){
498
+function geodir_cf_datepicker($html, $location, $cf, $p = '') {
499 499
     global $preview;
500 500
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
501
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
502
+    else { global $post; }
503 503
 
504
-    if(!is_array($cf) && $cf!=''){
504
+    if (!is_array($cf) && $cf != '') {
505 505
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
506
+        if (!$cf) {return NULL; }
507 507
     }
508 508
 
509 509
     $html_var = $cf['htmlvar_name'];
510 510
 
511 511
     // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
512
+    if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) {
513 513
         /**
514 514
          * Filter the datepicker html by location.
515 515
          *
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
          * @param array $cf The custom field array.
518 518
          * @since 1.6.6
519 519
          */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
520
+        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf);
521 521
     }
522 522
 
523 523
     // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
524
+    if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) {
525 525
         /**
526 526
          * Filter the datepicker html by individual custom field.
527 527
          *
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
          * @param array $cf The custom field array.
531 531
          * @since 1.6.6
532 532
          */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
533
+        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf);
534 534
     }
535 535
 
536 536
     // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
537
+    if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) {
538 538
         /**
539 539
          * Filter the datepicker html by field type key.
540 540
          *
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
          * @param array $cf The custom field array.
544 544
          * @since 1.6.6
545 545
          */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
546
+        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf);
547 547
     }
548 548
 
549 549
     // If not html then we run the standard output.
550
-    if(empty($html)){
550
+    if (empty($html)) {
551 551
 
552 552
         if ($post->{$cf['htmlvar_name']}):
553 553
 
@@ -558,24 +558,24 @@  discard block
 block discarded – undo
558 558
             }
559 559
             // check if we need to change the format or not
560 560
             $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
561
+            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
562 562
 
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
563
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
564
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
565 565
 
566 566
                 $date_format = str_replace($search, $replace, $date_format);
567 567
 
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
568
+                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+            } else {
570 570
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 571
             }
572 572
 
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
573
+            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") {
574 574
                 $date_format_from = $preview ? $date_format : 'Y-m-d';
575 575
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 576
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 577
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
578
+            } else {
579 579
                 return '';
580 580
             }
581 581
 
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 
593 593
 
594 594
 
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
595
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;
596
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
597
+            $html .= '</span>'.$value.'</div>';
598 598
 
599 599
         endif;
600 600
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
     return $html;
604 604
 }
605
-add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
605
+add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3);
606 606
 
607 607
 
608 608
 /**
@@ -615,21 +615,21 @@  discard block
 block discarded – undo
615 615
  *
616 616
  * @return string The html to output for the custom field.
617 617
  */
618
-function geodir_cf_text($html,$location,$cf,$p=''){
618
+function geodir_cf_text($html, $location, $cf, $p = '') {
619 619
 
620 620
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
621
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
622
+    else { global $post; }
623 623
 
624
-    if(!is_array($cf) && $cf!=''){
624
+    if (!is_array($cf) && $cf != '') {
625 625
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
626
+        if (!$cf) {return NULL; }
627 627
     }
628 628
 
629 629
     $html_var = $cf['htmlvar_name'];
630 630
 
631 631
     // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
632
+    if (has_filter("geodir_custom_field_output_text_loc_{$location}")) {
633 633
         /**
634 634
          * Filter the text html by location.
635 635
          *
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
          * @param array $cf The custom field array.
638 638
          * @since 1.6.6
639 639
          */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
640
+        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf);
641 641
     }
642 642
 
643 643
     // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
644
+    if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) {
645 645
         /**
646 646
          * Filter the text html by individual custom field.
647 647
          *
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
          * @param array $cf The custom field array.
651 651
          * @since 1.6.6
652 652
          */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
653
+        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf);
654 654
     }
655 655
 
656 656
     // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
657
+    if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) {
658 658
         /**
659 659
          * Filter the text html by field type key.
660 660
          *
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
          * @param array $cf The custom field array.
664 664
          * @since 1.6.6
665 665
          */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
666
+        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf);
667 667
     }
668 668
 
669 669
     
670 670
 
671 671
     // If not html then we run the standard output.
672
-    if(empty($html)){
672
+    if (empty($html)) {
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
675 675
 
676 676
             $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
@@ -686,16 +686,16 @@  discard block
 block discarded – undo
686 686
             }
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
689
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af;
690
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
691 691
             $html .= '</span>';
692 692
 
693 693
             $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
694
+            if (isset($cf['data_type']) && ($cf['data_type'] == 'INT' || $cf['data_type'] == 'FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']) {
695 695
                 $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
696
+                if (isset($extra_fields['is_price']) && $extra_fields['is_price']) {
697
+                    if (!ceil($value) > 0) {return ''; }// dont output blank prices
698
+                    $value = geodir_currency_format_number($value, $cf);
699 699
                 }
700 700
             }
701 701
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 
710 710
     return $html;
711 711
 }
712
-add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
712
+add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3);
713 713
 
714 714
 
715 715
 /**
@@ -722,21 +722,21 @@  discard block
 block discarded – undo
722 722
  *
723 723
  * @return string The html to output for the custom field.
724 724
  */
725
-function geodir_cf_radio($html,$location,$cf,$p=''){
725
+function geodir_cf_radio($html, $location, $cf, $p = '') {
726 726
 
727 727
     // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
728
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
729
+    else { global $post; }
730 730
 
731
-    if(!is_array($cf) && $cf!=''){
731
+    if (!is_array($cf) && $cf != '') {
732 732
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
733
+        if (!$cf) {return NULL; }
734 734
     }
735 735
 
736 736
     $html_var = $cf['htmlvar_name'];
737 737
 
738 738
     // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
739
+    if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) {
740 740
         /**
741 741
          * Filter the radio html by location.
742 742
          *
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
          * @param array $cf The custom field array.
745 745
          * @since 1.6.6
746 746
          */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
747
+        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf);
748 748
     }
749 749
 
750 750
     // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
751
+    if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) {
752 752
         /**
753 753
          * Filter the radio html by individual custom field.
754 754
          *
@@ -757,11 +757,11 @@  discard block
 block discarded – undo
757 757
          * @param array $cf The custom field array.
758 758
          * @since 1.6.6
759 759
          */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
760
+        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf);
761 761
     }
762 762
 
763 763
     // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
764
+    if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) {
765 765
         /**
766 766
          * Filter the radio html by field type key.
767 767
          *
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
          * @param array $cf The custom field array.
771 771
          * @since 1.6.6
772 772
          */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
773
+        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf);
774 774
     }
775 775
 
776 776
     // If not html then we run the standard output.
777
-    if(empty($html)){
777
+    if (empty($html)) {
778 778
 
779 779
         $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780 780
         if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
@@ -808,16 +808,16 @@  discard block
 block discarded – undo
808 808
             }
809 809
 
810 810
 
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
811
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;
812
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
813
+            $html .= '</span>'.$html_val.'</div>';
814 814
         endif;
815 815
 
816 816
     }
817 817
 
818 818
     return $html;
819 819
 }
820
-add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
820
+add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3);
821 821
 
822 822
 
823 823
 /**
@@ -830,21 +830,21 @@  discard block
 block discarded – undo
830 830
  *
831 831
  * @return string The html to output for the custom field.
832 832
  */
833
-function geodir_cf_select($html,$location,$cf,$p=''){
833
+function geodir_cf_select($html, $location, $cf, $p = '') {
834 834
 
835 835
     // check we have the post value
836
-    if(is_int($p)){$post = geodir_get_post_info($p);}
837
-    else{ global $post;}
836
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
837
+    else { global $post; }
838 838
 
839
-    if(!is_array($cf) && $cf!=''){
839
+    if (!is_array($cf) && $cf != '') {
840 840
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
841
-        if(!$cf){return NULL;}
841
+        if (!$cf) {return NULL; }
842 842
     }
843 843
 
844 844
     $html_var = $cf['htmlvar_name'];
845 845
 
846 846
     // Check if there is a location specific filter.
847
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
847
+    if (has_filter("geodir_custom_field_output_select_loc_{$location}")) {
848 848
         /**
849 849
          * Filter the select html by location.
850 850
          *
@@ -852,11 +852,11 @@  discard block
 block discarded – undo
852 852
          * @param array $cf The custom field array.
853 853
          * @since 1.6.6
854 854
          */
855
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
855
+        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf);
856 856
     }
857 857
 
858 858
     // Check if there is a custom field specific filter.
859
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
859
+    if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) {
860 860
         /**
861 861
          * Filter the select html by individual custom field.
862 862
          *
@@ -865,11 +865,11 @@  discard block
 block discarded – undo
865 865
          * @param array $cf The custom field array.
866 866
          * @since 1.6.6
867 867
          */
868
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
868
+        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf);
869 869
     }
870 870
 
871 871
     // Check if there is a custom field key specific filter.
872
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
872
+    if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) {
873 873
         /**
874 874
          * Filter the select html by field type key.
875 875
          *
@@ -878,11 +878,11 @@  discard block
 block discarded – undo
878 878
          * @param array $cf The custom field array.
879 879
          * @since 1.6.6
880 880
          */
881
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
881
+        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf);
882 882
     }
883 883
 
884 884
     // If not html then we run the standard output.
885
-    if(empty($html)){
885
+    if (empty($html)) {
886 886
 
887 887
         if ($post->{$cf['htmlvar_name']}):
888 888
             $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
@@ -910,16 +910,16 @@  discard block
 block discarded – undo
910 910
             }
911 911
 
912 912
 
913
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
914
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
915
-            $html .= '</span>' . $field_value . '</div>';
913
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
914
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
915
+            $html .= '</span>'.$field_value.'</div>';
916 916
         endif;
917 917
 
918 918
     }
919 919
 
920 920
     return $html;
921 921
 }
922
-add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
922
+add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3);
923 923
 
924 924
 
925 925
 /**
@@ -932,21 +932,21 @@  discard block
 block discarded – undo
932 932
  *
933 933
  * @return string The html to output for the custom field.
934 934
  */
935
-function geodir_cf_multiselect($html,$location,$cf,$p=''){
935
+function geodir_cf_multiselect($html, $location, $cf, $p = '') {
936 936
 
937 937
     // check we have the post value
938
-    if(is_int($p)){$post = geodir_get_post_info($p);}
939
-    else{ global $post;}
938
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
939
+    else { global $post; }
940 940
 
941
-    if(!is_array($cf) && $cf!=''){
941
+    if (!is_array($cf) && $cf != '') {
942 942
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
943
-        if(!$cf){return NULL;}
943
+        if (!$cf) {return NULL; }
944 944
     }
945 945
 
946 946
     $html_var = $cf['htmlvar_name'];
947 947
 
948 948
     // Check if there is a location specific filter.
949
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
949
+    if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) {
950 950
         /**
951 951
          * Filter the multiselect html by location.
952 952
          *
@@ -954,11 +954,11 @@  discard block
 block discarded – undo
954 954
          * @param array $cf The custom field array.
955 955
          * @since 1.6.6
956 956
          */
957
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
957
+        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf);
958 958
     }
959 959
 
960 960
     // Check if there is a custom field specific filter.
961
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
961
+    if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) {
962 962
         /**
963 963
          * Filter the multiselect html by individual custom field.
964 964
          *
@@ -967,11 +967,11 @@  discard block
 block discarded – undo
967 967
          * @param array $cf The custom field array.
968 968
          * @since 1.6.6
969 969
          */
970
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
970
+        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf);
971 971
     }
972 972
 
973 973
     // Check if there is a custom field key specific filter.
974
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
974
+    if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) {
975 975
         /**
976 976
          * Filter the multiselect html by field type key.
977 977
          *
@@ -980,11 +980,11 @@  discard block
 block discarded – undo
980 980
          * @param array $cf The custom field array.
981 981
          * @since 1.6.6
982 982
          */
983
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
983
+        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf);
984 984
     }
985 985
 
986 986
     // If not html then we run the standard output.
987
-    if(empty($html)){
987
+    if (empty($html)) {
988 988
 
989 989
 
990 990
         if (!empty($post->{$cf['htmlvar_name']})):
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
             $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1007 1007
 
1008
-            if(is_array($field_values)){
1008
+            if (is_array($field_values)) {
1009 1009
                 $field_values = array_map('trim', $field_values);
1010 1010
             }
1011 1011
 
@@ -1023,15 +1023,15 @@  discard block
 block discarded – undo
1023 1023
             }
1024 1024
 
1025 1025
 
1026
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1027
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1026
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1027
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1028 1028
             $html .= '</span>';
1029 1029
 
1030 1030
             if (count($option_values) > 1) {
1031 1031
                 $html .= '<ul>';
1032 1032
 
1033 1033
                 foreach ($option_values as $val) {
1034
-                    $html .= '<li>' . $val . '</li>';
1034
+                    $html .= '<li>'.$val.'</li>';
1035 1035
                 }
1036 1036
 
1037 1037
                 $html .= '</ul>';
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 
1047 1047
     return $html;
1048 1048
 }
1049
-add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1049
+add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3);
1050 1050
 
1051 1051
 
1052 1052
 /**
@@ -1059,21 +1059,21 @@  discard block
 block discarded – undo
1059 1059
  *
1060 1060
  * @return string The html to output for the custom field.
1061 1061
  */
1062
-function geodir_cf_email($html,$location,$cf,$p=''){
1062
+function geodir_cf_email($html, $location, $cf, $p = '') {
1063 1063
 
1064 1064
     // check we have the post value
1065
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1066
-    else{ global $post;}
1065
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1066
+    else { global $post; }
1067 1067
 
1068
-    if(!is_array($cf) && $cf!=''){
1068
+    if (!is_array($cf) && $cf != '') {
1069 1069
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1070
-        if(!$cf){return NULL;}
1070
+        if (!$cf) {return NULL; }
1071 1071
     }
1072 1072
 
1073 1073
     $html_var = $cf['htmlvar_name'];
1074 1074
 
1075 1075
     // Check if there is a location specific filter.
1076
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1076
+    if (has_filter("geodir_custom_field_output_email_loc_{$location}")) {
1077 1077
         /**
1078 1078
          * Filter the email html by location.
1079 1079
          *
@@ -1081,11 +1081,11 @@  discard block
 block discarded – undo
1081 1081
          * @param array $cf The custom field array.
1082 1082
          * @since 1.6.6
1083 1083
          */
1084
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1084
+        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf);
1085 1085
     }
1086 1086
 
1087 1087
     // Check if there is a custom field specific filter.
1088
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1088
+    if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) {
1089 1089
         /**
1090 1090
          * Filter the email html by individual custom field.
1091 1091
          *
@@ -1094,11 +1094,11 @@  discard block
 block discarded – undo
1094 1094
          * @param array $cf The custom field array.
1095 1095
          * @since 1.6.6
1096 1096
          */
1097
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1097
+        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf);
1098 1098
     }
1099 1099
 
1100 1100
     // Check if there is a custom field key specific filter.
1101
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1101
+    if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) {
1102 1102
         /**
1103 1103
          * Filter the email html by field type key.
1104 1104
          *
@@ -1107,18 +1107,18 @@  discard block
 block discarded – undo
1107 1107
          * @param array $cf The custom field array.
1108 1108
          * @since 1.6.6
1109 1109
          */
1110
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1110
+        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf);
1111 1111
     }
1112 1112
 
1113 1113
     // If not html then we run the standard output.
1114
-    if(empty($html)){
1114
+    if (empty($html)) {
1115 1115
 
1116 1116
         global $preview;
1117 1117
         if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1118 1118
             return ''; // Remove Send Enquiry | Send To Friend from listings page
1119 1119
         }
1120 1120
 
1121
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1121
+        $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type);
1122 1122
 
1123 1123
         if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1124 1124
             global $send_to_friend;
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
             if (!$preview) {
1131 1131
                 $b_send_inquiry = 'b_send_inquiry';
1132 1132
                 $b_sendtofriend = 'b_sendtofriend';
1133
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1133
+                $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';
1134 1134
             }
1135 1135
 
1136 1136
             $field_icon = geodir_field_icon_proccess($cf);
@@ -1143,26 +1143,26 @@  discard block
 block discarded – undo
1143 1143
                 $field_icon = '';
1144 1144
             }
1145 1145
 
1146
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1146
+            $html .= '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1147 1147
             $seperator = '';
1148 1148
             if ($post->{$cf['htmlvar_name']}) {
1149
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1149
+                $html .= '<a href="javascript:void(0);" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';
1150 1150
                 $seperator = ' | ';
1151 1151
             }
1152 1152
 
1153 1153
             if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1154
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1154
+                $html .= $seperator.'<a href="javascript:void(0);" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>';
1155 1155
             }
1156 1156
 
1157 1157
             $html .= '</span></div>';
1158 1158
 
1159 1159
 
1160 1160
             if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1161
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1161
+                $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';
1162 1162
             } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1163
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1163
+                $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>';
1164 1164
             } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1165
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1165
+                $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';
1166 1166
             }
1167 1167
 
1168 1168
             /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
@@ -1182,11 +1182,11 @@  discard block
 block discarded – undo
1182 1182
                 }
1183 1183
 
1184 1184
 
1185
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1186
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1185
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1186
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1187 1187
                 $html .= '</span><span class="geodir-email-address-output">';
1188 1188
                 $email = $post->{$cf['htmlvar_name']} ;
1189
-                if($e_split = explode('@',$email)){
1189
+                if ($e_split = explode('@', $email)) {
1190 1190
                     /**
1191 1191
                      * Filter email custom field name output.
1192 1192
                      *
@@ -1195,10 +1195,10 @@  discard block
 block discarded – undo
1195 1195
                      * @param string $email The email string being output.
1196 1196
                      * @param array $cf Custom field variables array.
1197 1197
                      */
1198
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1199
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1200
-                }else{
1201
-                    $html .=  $email;
1198
+                    $email_name = apply_filters('geodir_email_field_name_output', $email, $cf);
1199
+                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1200
+                } else {
1201
+                    $html .= $email;
1202 1202
                 }
1203 1203
                 $html .= '</span></div>';
1204 1204
             }
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
     return $html;
1211 1211
 }
1212
-add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1212
+add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3);
1213 1213
 
1214 1214
 
1215 1215
 /**
@@ -1222,21 +1222,21 @@  discard block
 block discarded – undo
1222 1222
  *
1223 1223
  * @return string The html to output for the custom field.
1224 1224
  */
1225
-function geodir_cf_file($html,$location,$cf,$p=''){
1225
+function geodir_cf_file($html, $location, $cf, $p = '') {
1226 1226
 
1227 1227
     // check we have the post value
1228
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1229
-    else{ global $post;}
1228
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1229
+    else { global $post; }
1230 1230
 
1231
-    if(!is_array($cf) && $cf!=''){
1231
+    if (!is_array($cf) && $cf != '') {
1232 1232
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1233
-        if(!$cf){return NULL;}
1233
+        if (!$cf) {return NULL; }
1234 1234
     }
1235 1235
 
1236 1236
     $html_var = $cf['htmlvar_name'];
1237 1237
 
1238 1238
     // Check if there is a location specific filter.
1239
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1239
+    if (has_filter("geodir_custom_field_output_file_loc_{$location}")) {
1240 1240
         /**
1241 1241
          * Filter the file html by location.
1242 1242
          *
@@ -1244,11 +1244,11 @@  discard block
 block discarded – undo
1244 1244
          * @param array $cf The custom field array.
1245 1245
          * @since 1.6.6
1246 1246
          */
1247
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1247
+        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf);
1248 1248
     }
1249 1249
 
1250 1250
     // Check if there is a custom field specific filter.
1251
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1251
+    if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) {
1252 1252
         /**
1253 1253
          * Filter the file html by individual custom field.
1254 1254
          *
@@ -1257,11 +1257,11 @@  discard block
 block discarded – undo
1257 1257
          * @param array $cf The custom field array.
1258 1258
          * @since 1.6.6
1259 1259
          */
1260
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1260
+        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf);
1261 1261
     }
1262 1262
 
1263 1263
     // Check if there is a custom field key specific filter.
1264
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1264
+    if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) {
1265 1265
         /**
1266 1266
          * Filter the file html by field type key.
1267 1267
          *
@@ -1270,11 +1270,11 @@  discard block
 block discarded – undo
1270 1270
          * @param array $cf The custom field array.
1271 1271
          * @since 1.6.6
1272 1272
          */
1273
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1273
+        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf);
1274 1274
     }
1275 1275
 
1276 1276
     // If not html then we run the standard output.
1277
-    if(empty($html)){
1277
+    if (empty($html)) {
1278 1278
 
1279 1279
         if (!empty($post->{$cf['htmlvar_name']})):
1280 1280
 
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
             if (!empty($files)):
1283 1283
 
1284 1284
                 $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1285
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1285
+                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
1286 1286
 
1287 1287
                 $file_paths = '';
1288 1288
                 foreach ($files as $file) {
@@ -1319,9 +1319,9 @@  discard block
 block discarded – undo
1319 1319
                             //$file_paths .= '<img src="'.$file.'"  />';	
1320 1320
                             $file_paths .= '</div>';
1321 1321
                         } else {
1322
-                            $ext_path = '_' . $html_var . '_';
1322
+                            $ext_path = '_'.$html_var.'_';
1323 1323
                             $filename = explode($ext_path, $filename);
1324
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1324
+                            $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
1325 1325
                         }
1326 1326
                     }
1327 1327
                 }
@@ -1336,11 +1336,11 @@  discard block
 block discarded – undo
1336 1336
                     $field_icon = '';
1337 1337
                 }
1338 1338
 
1339
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1339
+                $html = '<div class="geodir_more_info  '.$cf['css_class'].' geodir-custom-file-box '.$cf['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1340 1340
                 $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1341
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1341
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1342 1342
                 $html .= '</span>';
1343
-                $html .= $file_paths . '</div></div>';
1343
+                $html .= $file_paths.'</div></div>';
1344 1344
 
1345 1345
             endif;
1346 1346
         endif;
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
 
1350 1350
     return $html;
1351 1351
 }
1352
-add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1352
+add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3);
1353 1353
 
1354 1354
 
1355 1355
 
@@ -1363,21 +1363,21 @@  discard block
 block discarded – undo
1363 1363
  *
1364 1364
  * @return string The html to output for the custom field.
1365 1365
  */
1366
-function geodir_cf_textarea($html,$location,$cf,$p=''){
1366
+function geodir_cf_textarea($html, $location, $cf, $p = '') {
1367 1367
 
1368 1368
     // check we have the post value
1369
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1370
-    else{ global $post;}
1369
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1370
+    else { global $post; }
1371 1371
 
1372
-    if(!is_array($cf) && $cf!=''){
1372
+    if (!is_array($cf) && $cf != '') {
1373 1373
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1374
-        if(!$cf){return NULL;}
1374
+        if (!$cf) {return NULL; }
1375 1375
     }
1376 1376
 
1377 1377
     $html_var = $cf['htmlvar_name'];
1378 1378
 
1379 1379
     // Check if there is a location specific filter.
1380
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1380
+    if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) {
1381 1381
         /**
1382 1382
          * Filter the textarea html by location.
1383 1383
          *
@@ -1385,11 +1385,11 @@  discard block
 block discarded – undo
1385 1385
          * @param array $cf The custom field array.
1386 1386
          * @since 1.6.6
1387 1387
          */
1388
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1388
+        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf);
1389 1389
     }
1390 1390
 
1391 1391
     // Check if there is a custom field specific filter.
1392
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1392
+    if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) {
1393 1393
         /**
1394 1394
          * Filter the textarea html by individual custom field.
1395 1395
          *
@@ -1398,11 +1398,11 @@  discard block
 block discarded – undo
1398 1398
          * @param array $cf The custom field array.
1399 1399
          * @since 1.6.6
1400 1400
          */
1401
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1401
+        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf);
1402 1402
     }
1403 1403
 
1404 1404
     // Check if there is a custom field key specific filter.
1405
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1405
+    if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) {
1406 1406
         /**
1407 1407
          * Filter the textarea html by field type key.
1408 1408
          *
@@ -1411,11 +1411,11 @@  discard block
 block discarded – undo
1411 1411
          * @param array $cf The custom field array.
1412 1412
          * @since 1.6.6
1413 1413
          */
1414
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1414
+        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf);
1415 1415
     }
1416 1416
 
1417 1417
     // If not html then we run the standard output.
1418
-    if(empty($html)){
1418
+    if (empty($html)) {
1419 1419
 
1420 1420
         if (!empty($post->{$cf['htmlvar_name']})) {
1421 1421
 
@@ -1430,9 +1430,9 @@  discard block
 block discarded – undo
1430 1430
             }
1431 1431
 
1432 1432
 
1433
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1434
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1435
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1433
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1434
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1435
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1436 1436
 
1437 1437
         }
1438 1438
 
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 
1441 1441
     return $html;
1442 1442
 }
1443
-add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1443
+add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3);
1444 1444
 
1445 1445
 
1446 1446
 
@@ -1454,21 +1454,21 @@  discard block
 block discarded – undo
1454 1454
  *
1455 1455
  * @return string The html to output for the custom field.
1456 1456
  */
1457
-function geodir_cf_html($html,$location,$cf,$p=''){
1457
+function geodir_cf_html($html, $location, $cf, $p = '') {
1458 1458
 
1459 1459
     // check we have the post value
1460
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1461
-    else{ global $post;}
1460
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1461
+    else { global $post; }
1462 1462
 
1463
-    if(!is_array($cf) && $cf!=''){
1463
+    if (!is_array($cf) && $cf != '') {
1464 1464
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1465
-        if(!$cf){return NULL;}
1465
+        if (!$cf) {return NULL; }
1466 1466
     }
1467 1467
 
1468 1468
     $html_var = $cf['htmlvar_name'];
1469 1469
 
1470 1470
     // Check if there is a location specific filter.
1471
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1471
+    if (has_filter("geodir_custom_field_output_html_loc_{$location}")) {
1472 1472
         /**
1473 1473
          * Filter the html html by location.
1474 1474
          *
@@ -1476,11 +1476,11 @@  discard block
 block discarded – undo
1476 1476
          * @param array $cf The custom field array.
1477 1477
          * @since 1.6.6
1478 1478
          */
1479
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1479
+        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf);
1480 1480
     }
1481 1481
 
1482 1482
     // Check if there is a custom field specific filter.
1483
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1483
+    if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) {
1484 1484
         /**
1485 1485
          * Filter the html html by individual custom field.
1486 1486
          *
@@ -1489,11 +1489,11 @@  discard block
 block discarded – undo
1489 1489
          * @param array $cf The custom field array.
1490 1490
          * @since 1.6.6
1491 1491
          */
1492
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1492
+        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf);
1493 1493
     }
1494 1494
 
1495 1495
     // Check if there is a custom field key specific filter.
1496
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1496
+    if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) {
1497 1497
         /**
1498 1498
          * Filter the html html by field type key.
1499 1499
          *
@@ -1502,11 +1502,11 @@  discard block
 block discarded – undo
1502 1502
          * @param array $cf The custom field array.
1503 1503
          * @since 1.6.6
1504 1504
          */
1505
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1505
+        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf);
1506 1506
     }
1507 1507
 
1508 1508
     // If not html then we run the standard output.
1509
-    if(empty($html)){
1509
+    if (empty($html)) {
1510 1510
 
1511 1511
         if (!empty($post->{$cf['htmlvar_name']})) {
1512 1512
 
@@ -1520,9 +1520,9 @@  discard block
 block discarded – undo
1520 1520
                 $field_icon = '';
1521 1521
             }
1522 1522
 
1523
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1524
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1525
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1523
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1524
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1525
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1526 1526
 
1527 1527
         }
1528 1528
 
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
 
1531 1531
     return $html;
1532 1532
 }
1533
-add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1533
+add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3);
1534 1534
 
1535 1535
 
1536 1536
 
@@ -1544,21 +1544,21 @@  discard block
 block discarded – undo
1544 1544
  *
1545 1545
  * @return string The html to output for the custom field.
1546 1546
  */
1547
-function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1547
+function geodir_cf_taxonomy($html, $location, $cf, $p = '') {
1548 1548
 
1549 1549
     // check we have the post value
1550
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1551
-    else{ global $post;}
1550
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1551
+    else { global $post; }
1552 1552
 
1553
-    if(!is_array($cf) && $cf!=''){
1553
+    if (!is_array($cf) && $cf != '') {
1554 1554
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1555
-        if(!$cf){return NULL;}
1555
+        if (!$cf) {return NULL; }
1556 1556
     }
1557 1557
 
1558 1558
     $html_var = $cf['htmlvar_name'];
1559 1559
 
1560 1560
     // Check if there is a location specific filter.
1561
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1561
+    if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) {
1562 1562
         /**
1563 1563
          * Filter the taxonomy html by location.
1564 1564
          *
@@ -1566,11 +1566,11 @@  discard block
 block discarded – undo
1566 1566
          * @param array $cf The custom field array.
1567 1567
          * @since 1.6.6
1568 1568
          */
1569
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1569
+        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf);
1570 1570
     }
1571 1571
 
1572 1572
     // Check if there is a custom field specific filter.
1573
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1573
+    if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) {
1574 1574
         /**
1575 1575
          * Filter the taxonomy html by individual custom field.
1576 1576
          *
@@ -1579,11 +1579,11 @@  discard block
 block discarded – undo
1579 1579
          * @param array $cf The custom field array.
1580 1580
          * @since 1.6.6
1581 1581
          */
1582
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1582
+        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf);
1583 1583
     }
1584 1584
 
1585 1585
     // Check if there is a custom field key specific filter.
1586
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1586
+    if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) {
1587 1587
         /**
1588 1588
          * Filter the taxonomy html by field type key.
1589 1589
          *
@@ -1592,14 +1592,14 @@  discard block
 block discarded – undo
1592 1592
          * @param array $cf The custom field array.
1593 1593
          * @since 1.6.6
1594 1594
          */
1595
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1595
+        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf);
1596 1596
     }
1597 1597
 
1598 1598
     // If not html then we run the standard output.
1599
-    if(empty($html)){
1599
+    if (empty($html)) {
1600 1600
 
1601
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1602
-            $post_taxonomy = $post->post_type . 'category';
1601
+        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
1602
+            $post_taxonomy = $post->post_type.'category';
1603 1603
             $field_value = $post->{$html_var};
1604 1604
             $links = array();
1605 1605
             $terms = array();
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
                     if ($term != '') {
1618 1618
                         $term = get_term_by('id', $term, $html_var);
1619 1619
                         if (is_object($term)) {
1620
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1620
+                            $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";
1621 1621
                             $terms[] = $term;
1622 1622
                         }
1623 1623
                     }
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
                     $terms = $termsOrdered;
1632 1632
                 }
1633 1633
             }
1634
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1634
+            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
1635 1635
 
1636 1636
             if ($html_value != '') {
1637 1637
                 $field_icon = geodir_field_icon_proccess($cf);
@@ -1644,9 +1644,9 @@  discard block
 block discarded – undo
1644 1644
                     $field_icon = '';
1645 1645
                 }
1646 1646
 
1647
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1648
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1649
-                $html .= '</span> ' . $html_value . '</div>';
1647
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af;
1648
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1649
+                $html .= '</span> '.$html_value.'</div>';
1650 1650
             }
1651 1651
         }
1652 1652
 
@@ -1654,7 +1654,7 @@  discard block
 block discarded – undo
1654 1654
 
1655 1655
     return $html;
1656 1656
 }
1657
-add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1657
+add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3);
1658 1658
 
1659 1659
 
1660 1660
 /**
@@ -1667,21 +1667,21 @@  discard block
 block discarded – undo
1667 1667
  *
1668 1668
  * @return string The html to output for the custom field.
1669 1669
  */
1670
-function geodir_cf_address($html,$location,$cf,$p=''){
1670
+function geodir_cf_address($html, $location, $cf, $p = '') {
1671 1671
 
1672 1672
     // check we have the post value
1673
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1674
-    else{ global $post;}
1673
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1674
+    else { global $post; }
1675 1675
 
1676
-    if(!is_array($cf) && $cf!=''){
1676
+    if (!is_array($cf) && $cf != '') {
1677 1677
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1678
-        if(!$cf){return NULL;}
1678
+        if (!$cf) {return NULL; }
1679 1679
     }
1680 1680
 
1681 1681
     $html_var = $cf['htmlvar_name'];
1682 1682
 
1683 1683
     // Check if there is a location specific filter.
1684
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1684
+    if (has_filter("geodir_custom_field_output_address_loc_{$location}")) {
1685 1685
         /**
1686 1686
          * Filter the address html by location.
1687 1687
          *
@@ -1689,11 +1689,11 @@  discard block
 block discarded – undo
1689 1689
          * @param array $cf The custom field array.
1690 1690
          * @since 1.6.6
1691 1691
          */
1692
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1692
+        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf);
1693 1693
     }
1694 1694
 
1695 1695
     // Check if there is a custom field specific filter.
1696
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1696
+    if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) {
1697 1697
         /**
1698 1698
          * Filter the address html by individual custom field.
1699 1699
          *
@@ -1702,11 +1702,11 @@  discard block
 block discarded – undo
1702 1702
          * @param array $cf The custom field array.
1703 1703
          * @since 1.6.6
1704 1704
          */
1705
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1705
+        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf);
1706 1706
     }
1707 1707
 
1708 1708
     // Check if there is a custom field key specific filter.
1709
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1709
+    if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) {
1710 1710
         /**
1711 1711
          * Filter the address html by field type key.
1712 1712
          *
@@ -1715,14 +1715,14 @@  discard block
 block discarded – undo
1715 1715
          * @param array $cf The custom field array.
1716 1716
          * @since 1.6.6
1717 1717
          */
1718
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1718
+        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf);
1719 1719
     }
1720 1720
 
1721 1721
     // If not html then we run the standard output.
1722
-    if(empty($html)){
1722
+    if (empty($html)) {
1723 1723
 
1724 1724
         global $preview;
1725
-        $html_var = $cf['htmlvar_name'] . '_address';
1725
+        $html_var = $cf['htmlvar_name'].'_address';
1726 1726
 
1727 1727
         if ($cf['extra_fields']) {
1728 1728
 
@@ -1785,10 +1785,10 @@  discard block
 block discarded – undo
1785 1785
 
1786 1786
         if ($post->{$html_var}) {
1787 1787
 
1788
-            $field_icon = geodir_field_icon_proccess( $cf );
1789
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1788
+            $field_icon = geodir_field_icon_proccess($cf);
1789
+            if (strpos($field_icon, 'http') !== false) {
1790 1790
                 $field_icon_af = '';
1791
-            } elseif ( $field_icon == '' ) {
1791
+            } elseif ($field_icon == '') {
1792 1792
                 $field_icon_af = '<i class="fa fa-home"></i>';
1793 1793
             } else {
1794 1794
                 $field_icon_af = $field_icon;
@@ -1797,25 +1797,25 @@  discard block
 block discarded – undo
1797 1797
             
1798 1798
 
1799 1799
 
1800
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1801
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1802
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1800
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1801
+            $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
1802
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
1803 1803
             $html .= '</span>';
1804 1804
 
1805
-            if ( isset($post->post_address) ) {
1806
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1805
+            if (isset($post->post_address)) {
1806
+                $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';
1807 1807
             }
1808
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1809
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1808
+            if ($show_city_in_address && isset($post->post_city) && $post->post_city) {
1809
+                $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';
1810 1810
             }
1811
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1812
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1811
+            if ($show_region_in_address && isset($post->post_region) && $post->post_region) {
1812
+                $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>';
1813 1813
             }
1814
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1815
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1814
+            if ($show_zip_in_address && isset($post->post_zip) && $post->post_zip) {
1815
+                $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>';
1816 1816
             }
1817
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1818
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1817
+            if ($show_country_in_address && isset($post->post_country) && $post->post_country) {
1818
+                $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>';
1819 1819
             }
1820 1820
             $html .= '</div>';
1821 1821
 
@@ -1826,4 +1826,4 @@  discard block
 block discarded – undo
1826 1826
 
1827 1827
     return $html;
1828 1828
 }
1829
-add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1830 1829
\ No newline at end of file
1830
+add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3);
1831 1831
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/taxonomy_functions.php 1 patch
Indentation   +1222 added lines, -1222 removed lines patch added patch discarded remove patch
@@ -33,265 +33,265 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_add_nav_menu_items()
35 35
 {
36
-    $items = '';
37
-    // apply filter to add more navigations // -Filter-Location-Manager
38
-
39
-    if (get_option('geodir_show_listing_nav')) {
40
-
41
-        $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
44
-
45
-
46
-        //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
-        $post_types = geodir_get_posttypes('object');
48
-        $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
-        if (!empty($post_types)) {
50
-            foreach ($post_types as $post_type => $args) {
51
-                if (!empty($show_post_type_main_nav)) {
52
-                    if (in_array($post_type, $show_post_type_main_nav)) {
53
-                        if (get_post_type_archive_link($post_type)) {
54
-                            $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
57
-                            /**
58
-                             * Filter the menu li class.
59
-                             *
60
-                             * @since 1.0.0
61
-                             * @param string $menu_class The menu HTML class.
62
-                             */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
-                            /**
65
-                             * Filter the menu a class.
66
-                             *
67
-                             * @since 1.0.0
68
-                             */
69
-                            $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
36
+	$items = '';
37
+	// apply filter to add more navigations // -Filter-Location-Manager
38
+
39
+	if (get_option('geodir_show_listing_nav')) {
40
+
41
+		$menu_class = '';
42
+		if (geodir_is_page('listing'))
43
+			$menu_class = 'current-menu-item';
44
+
45
+
46
+		//SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
+		$post_types = geodir_get_posttypes('object');
48
+		$show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
+		if (!empty($post_types)) {
50
+			foreach ($post_types as $post_type => $args) {
51
+				if (!empty($show_post_type_main_nav)) {
52
+					if (in_array($post_type, $show_post_type_main_nav)) {
53
+						if (get_post_type_archive_link($post_type)) {
54
+							$menu_class = '';
55
+							if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
+								$menu_class = 'current-menu-item';
57
+							/**
58
+							 * Filter the menu li class.
59
+							 *
60
+							 * @since 1.0.0
61
+							 * @param string $menu_class The menu HTML class.
62
+							 */
63
+							$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
+							/**
65
+							 * Filter the menu a class.
66
+							 *
67
+							 * @since 1.0.0
68
+							 */
69
+							$a_class = apply_filters('geodir_menu_a_class', '');
70
+							$items .= '<li class="' . $li_class . '">
71 71
 									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72 72
 										' . __(ucfirst($args->labels->name),'geodirectory') . '
73 73
 									</a>
74 74
 								</li>';
75
-                        }
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        //END LISTING OF POST TYPE IN MAIN NAVIGATION
81
-
82
-        $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
-        $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
-        if ($is_listing_sub_meny_exists) {
85
-            /**
86
-             * Filter the menu li class.
87
-             *
88
-             * @since 1.0.0
89
-             * @param string $menu_class The menu HTML class.
90
-             */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
-            /**
93
-             * Filter the sub menu li class.
94
-             *
95
-             * @since 1.0.0
96
-             * @param string $menu_class The menu HTML class.
97
-             */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
-            /**
100
-             * Filter the sub menu ul class.
101
-             *
102
-             * @since 1.0.0
103
-             */
104
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
-            /**
106
-             * Filter the menu a class.
107
-             *
108
-             * @since 1.0.0
109
-             */
110
-            $a_class = apply_filters('geodir_menu_a_class', '');
111
-            /**
112
-             * Filter the sub menu a class.
113
-             *
114
-             * @since 1.0.0
115
-             */
116
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
75
+						}
76
+					}
77
+				}
78
+			}
79
+		}
80
+		//END LISTING OF POST TYPE IN MAIN NAVIGATION
81
+
82
+		$view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
+		$is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
+		if ($is_listing_sub_meny_exists) {
85
+			/**
86
+			 * Filter the menu li class.
87
+			 *
88
+			 * @since 1.0.0
89
+			 * @param string $menu_class The menu HTML class.
90
+			 */
91
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
+			/**
93
+			 * Filter the sub menu li class.
94
+			 *
95
+			 * @since 1.0.0
96
+			 * @param string $menu_class The menu HTML class.
97
+			 */
98
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
+			/**
100
+			 * Filter the sub menu ul class.
101
+			 *
102
+			 * @since 1.0.0
103
+			 */
104
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
+			/**
106
+			 * Filter the menu a class.
107
+			 *
108
+			 * @since 1.0.0
109
+			 */
110
+			$a_class = apply_filters('geodir_menu_a_class', '');
111
+			/**
112
+			 * Filter the sub menu a class.
113
+			 *
114
+			 * @since 1.0.0
115
+			 */
116
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
+			$items .= '<li class="' . $li_class . '">
118 118
 					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119 119
 					<ul class="' . $sub_ul_class . '">';
120
-            $post_types = geodir_get_posttypes('object');
120
+			$post_types = geodir_get_posttypes('object');
121 121
 
122
-            $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
122
+			$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
123 123
 
124
-            if (!empty($post_types)) {
125
-                global $geodir_add_location_url;
126
-                $geodir_add_location_url = true;
127
-                foreach ($post_types as $post_type => $args) {
128
-                    if (!empty($show_listing_post_types)) {
129
-                        if (in_array($post_type, $show_listing_post_types)) {
130
-                            if (get_post_type_archive_link($post_type)) {
124
+			if (!empty($post_types)) {
125
+				global $geodir_add_location_url;
126
+				$geodir_add_location_url = true;
127
+				foreach ($post_types as $post_type => $args) {
128
+					if (!empty($show_listing_post_types)) {
129
+						if (in_array($post_type, $show_listing_post_types)) {
130
+							if (get_post_type_archive_link($post_type)) {
131 131
 
132
-                                $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
132
+								$menu_class = '';
133
+								if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
+									$menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
136
+								$items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138 138
 															' . __(ucfirst($args->labels->name),'geodirectory') . '
139 139
 														</a>
140 140
 													</li>';
141
-                            }
142
-                        }
143
-                    }
144
-                }
145
-                $geodir_add_location_url = NULL;
146
-            }
141
+							}
142
+						}
143
+					}
144
+				}
145
+				$geodir_add_location_url = NULL;
146
+			}
147 147
 
148
-            $items .= '	</ul> ';
149
-            /**
150
-             * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
-             *
152
-             * @since 1.5.9
153
-             */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
155
-            $items .= '</li>';
156
-        }
157
-    }
158
-
159
-    if (get_option('geodir_show_addlisting_nav')) {
160
-
161
-        $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
164
-
165
-        //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
-        $post_types = geodir_get_posttypes('object');
167
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
-
170
-        if (!empty($post_types)) {
171
-            foreach ($post_types as $post_type => $args) {
172
-                if (!empty($geodir_allow_posttype_frontend)) {
173
-                    if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
-                        if (!empty($show_add_listing_post_types_main_nav)) {
175
-                            if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
-                                if (geodir_get_addlisting_link($post_type)) {
177
-
178
-                                    $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
181
-                                    /**
182
-                                     * Filter the menu li class.
183
-                                     *
184
-                                     * @since 1.0.0
185
-                                     * @param string $menu_class The menu HTML class.
186
-                                     */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
-                                    /**
189
-                                     * Filter the menu a class.
190
-                                     *
191
-                                     * @since 1.0.0
192
-                                     */
193
-                                    $a_class = apply_filters('geodir_menu_a_class', '');
194
-                                    $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
148
+			$items .= '	</ul> ';
149
+			/**
150
+			 * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
+			 *
152
+			 * @since 1.5.9
153
+			 */
154
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
155
+			$items .= '</li>';
156
+		}
157
+	}
158
+
159
+	if (get_option('geodir_show_addlisting_nav')) {
160
+
161
+		$menu_class = '';
162
+		if (geodir_is_page('add-listing'))
163
+			$menu_class = 'current-menu-item';
164
+
165
+		//SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
+		$post_types = geodir_get_posttypes('object');
167
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
+
170
+		if (!empty($post_types)) {
171
+			foreach ($post_types as $post_type => $args) {
172
+				if (!empty($geodir_allow_posttype_frontend)) {
173
+					if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
+						if (!empty($show_add_listing_post_types_main_nav)) {
175
+							if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
+								if (geodir_get_addlisting_link($post_type)) {
177
+
178
+									$menu_class = '';
179
+									if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
+										$menu_class = 'current-menu-item';
181
+									/**
182
+									 * Filter the menu li class.
183
+									 *
184
+									 * @since 1.0.0
185
+									 * @param string $menu_class The menu HTML class.
186
+									 */
187
+									$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
+									/**
189
+									 * Filter the menu a class.
190
+									 *
191
+									 * @since 1.0.0
192
+									 */
193
+									$a_class = apply_filters('geodir_menu_a_class', '');
194
+									$cpt_name = __($args->labels->singular_name, 'geodirectory');
195
+									$items .= '<li class="' . $li_class . '">
196 196
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197 197
 												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
198 198
 											</a>
199 199
 										</li>';
200
-                                }
201
-                            }
202
-                        }
203
-                    }
204
-                }
205
-            }
206
-        }
207
-        //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
-    }
209
-
210
-    $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
-    $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
-    if ($is_add_listing_sub_meny_exists) {
213
-
214
-        if (get_option('geodir_show_addlisting_nav')) {
215
-            /**
216
-             * Filter the menu li class.
217
-             *
218
-             * @since 1.0.0
219
-             * @param string $menu_class The menu HTML class.
220
-             */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
-            /**
223
-             * Filter the sub menu li class.
224
-             *
225
-             * @since 1.0.0
226
-             * @param string $menu_class The menu HTML class.
227
-             */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
-            /**
230
-             * Filter the sub menu ul class.
231
-             *
232
-             * @since 1.0.0
233
-             */
234
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
-            /**
236
-             * Filter the menu a class.
237
-             *
238
-             * @since 1.0.0
239
-             */
240
-            $a_class = apply_filters('geodir_menu_a_class', '');
241
-            /**
242
-             * Filter the sub menu a class.
243
-             *
244
-             * @since 1.0.0
245
-             */
246
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
200
+								}
201
+							}
202
+						}
203
+					}
204
+				}
205
+			}
206
+		}
207
+		//END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
+	}
209
+
210
+	$view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
+	$is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
+	if ($is_add_listing_sub_meny_exists) {
213
+
214
+		if (get_option('geodir_show_addlisting_nav')) {
215
+			/**
216
+			 * Filter the menu li class.
217
+			 *
218
+			 * @since 1.0.0
219
+			 * @param string $menu_class The menu HTML class.
220
+			 */
221
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
+			/**
223
+			 * Filter the sub menu li class.
224
+			 *
225
+			 * @since 1.0.0
226
+			 * @param string $menu_class The menu HTML class.
227
+			 */
228
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
+			/**
230
+			 * Filter the sub menu ul class.
231
+			 *
232
+			 * @since 1.0.0
233
+			 */
234
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
+			/**
236
+			 * Filter the menu a class.
237
+			 *
238
+			 * @since 1.0.0
239
+			 */
240
+			$a_class = apply_filters('geodir_menu_a_class', '');
241
+			/**
242
+			 * Filter the sub menu a class.
243
+			 *
244
+			 * @since 1.0.0
245
+			 */
246
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
+			$items .= '<li  class="' . $li_class . '">
248 248
 					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249 249
 					<ul class="' . $sub_ul_class . '">';
250 250
 
251
-            $post_types = geodir_get_posttypes('object');
252
-
253
-            $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
-
255
-            if (!empty($post_types)) {
256
-                foreach ($post_types as $post_type => $args) {
257
-                    if (!empty($geodir_allow_posttype_frontend)) {
258
-                        if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
-                            if (!empty($show_add_listing_post_types)) {
260
-                                if (in_array($post_type, $show_add_listing_post_types)) {
261
-                                    if (geodir_get_addlisting_link($post_type)) {
262
-
263
-                                        $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
266
-                                        /**
267
-                                         * Filter the menu li class.
268
-                                         *
269
-                                         * @since 1.0.0
270
-                                         * @param string $menu_class The menu HTML class.
271
-                                         */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
-                                        $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $li_class . '">
251
+			$post_types = geodir_get_posttypes('object');
252
+
253
+			$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
+
255
+			if (!empty($post_types)) {
256
+				foreach ($post_types as $post_type => $args) {
257
+					if (!empty($geodir_allow_posttype_frontend)) {
258
+						if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
+							if (!empty($show_add_listing_post_types)) {
260
+								if (in_array($post_type, $show_add_listing_post_types)) {
261
+									if (geodir_get_addlisting_link($post_type)) {
262
+
263
+										$menu_class = '';
264
+										if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
+											$menu_class = 'current-menu-item';
266
+										/**
267
+										 * Filter the menu li class.
268
+										 *
269
+										 * @since 1.0.0
270
+										 * @param string $menu_class The menu HTML class.
271
+										 */
272
+										$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
+										$cpt_name = __($args->labels->singular_name, 'geodirectory');
274
+										$items .= '<li class="' . $li_class . '">
275 275
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276 276
 															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
277 277
 														</a>
278 278
 													</li>';
279
-                                    }
280
-                                }
281
-                            }
282
-                        }
283
-                    }
284
-                }
285
-            }
279
+									}
280
+								}
281
+							}
282
+						}
283
+					}
284
+				}
285
+			}
286 286
 
287
-            $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
289
-            $items .= '</li>';
287
+			$items .= '	</ul> ';
288
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
289
+			$items .= '</li>';
290 290
 
291
-        }
292
-    }
293
-    // apply filter to add more navigations // -Filter-Location-Manager
294
-    return $items;
291
+		}
292
+	}
293
+	// apply filter to add more navigations // -Filter-Location-Manager
294
+	return $items;
295 295
 }
296 296
 
297 297
 
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function geodir_pagemenu_items($menu, $args)
311 311
 {
312
-    $locations = get_nav_menu_locations();
313
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
314
-    $geodir_theme_location_nav = array();
315
-    if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
-        $geodir_theme_location_nav[] = $args['theme_location'];
318
-        update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
-    }
320
-    //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
312
+	$locations = get_nav_menu_locations();
313
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
314
+	$geodir_theme_location_nav = array();
315
+	if (empty($locations) && empty($geodir_theme_location)) {
316
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
+		$geodir_theme_location_nav[] = $args['theme_location'];
318
+		update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
+	}
320
+	//else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+	else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
324 324
 
325
-    return $menu;
325
+	return $menu;
326 326
 
327 327
 }
328 328
 
@@ -342,18 +342,18 @@  discard block
 block discarded – undo
342 342
 function geodir_menu_items($items, $args)
343 343
 {
344 344
 
345
-    $location = $args->theme_location;
345
+	$location = $args->theme_location;
346 346
 
347
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
347
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
348 348
 
349
-    if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
349
+	if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
352
-        return $items;
351
+		$items = $items . geodir_add_nav_menu_items();
352
+		return $items;
353 353
 
354
-    } else {
355
-        return $items;
356
-    }
354
+	} else {
355
+		return $items;
356
+	}
357 357
 }
358 358
 
359 359
 /**
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function geodir_get_category_all_array()
370 370
 {
371
-    global $wpdb;
372
-    $return_array = array();
373
-
374
-    $taxonomies = geodir_get_taxonomies();
375
-    $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
377
-
378
-    $pn_categories = $wpdb->get_results(
379
-        $wpdb->prepare(
380
-            "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
382
-        )
383
-    );
384
-
385
-    foreach ($pn_categories as $pn_categories_obj) {
386
-        $return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
-            "title" => $pn_categories_obj->name,);
388
-    }
389
-    return $return_array;
371
+	global $wpdb;
372
+	$return_array = array();
373
+
374
+	$taxonomies = geodir_get_taxonomies();
375
+	$taxonomies = implode("','", $taxonomies);
376
+	$taxonomies = "'" . $taxonomies . "'";
377
+
378
+	$pn_categories = $wpdb->get_results(
379
+		$wpdb->prepare(
380
+			"SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
+			array($wpdb->terms . term_id)
382
+		)
383
+	);
384
+
385
+	foreach ($pn_categories as $pn_categories_obj) {
386
+		$return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
+			"title" => $pn_categories_obj->name,);
388
+	}
389
+	return $return_array;
390 390
 }
391 391
 
392 392
 
@@ -401,41 +401,41 @@  discard block
 block discarded – undo
401 401
  */
402 402
 function geodir_get_current_posttype()
403 403
 {
404
-    global $wp_query, $geodir_post_type;
404
+	global $wp_query, $geodir_post_type;
405 405
 
406
-    $geodir_post_type = get_query_var('post_type');
406
+	$geodir_post_type = get_query_var('post_type');
407 407
 
408
-    if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
-        elseif (isset($_REQUEST['listing_type']))
412
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
-    }
408
+	if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
+			$geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
+		elseif (isset($_REQUEST['listing_type']))
412
+			$geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
+	}
414 414
 
415
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
415
+	if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
417 417
 
418
-    if (is_tax())
419
-        $geodir_post_type = geodir_get_taxonomy_posttype();
418
+	if (is_tax())
419
+		$geodir_post_type = geodir_get_taxonomy_posttype();
420 420
 
421 421
 
422
-    $all_postypes = geodir_get_posttypes();
423
-    $all_postypes = stripslashes_deep($all_postypes);
422
+	$all_postypes = geodir_get_posttypes();
423
+	$all_postypes = stripslashes_deep($all_postypes);
424 424
 
425
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
-        $geodir_post_type = '';
425
+	if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
+		$geodir_post_type = '';
427 427
 
428
-    if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
429
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
430
-    }
428
+	if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
429
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
430
+	}
431 431
 
432 432
 
433
-    /**
434
-     * Filter the default CPT return.
435
-     *
436
-     * @since 1.6.9
437
-     */
438
-    return apply_filters('geodir_get_current_posttype',$geodir_post_type);
433
+	/**
434
+	 * Filter the default CPT return.
435
+	 *
436
+	 * @since 1.6.9
437
+	 */
438
+	return apply_filters('geodir_get_current_posttype',$geodir_post_type);
439 439
 }
440 440
 
441 441
 /**
@@ -449,22 +449,22 @@  discard block
 block discarded – undo
449 449
  */
450 450
 function geodir_get_default_posttype()
451 451
 {
452
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
453
-
454
-    $stype = false;
455
-    foreach ( $post_types as $post_type => $info ) {
456
-        global $wpdb;
457
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
458
-        if ( $has_posts ) {
459
-            $stype = $post_type; break;
460
-        }
461
-    }
462
-
463
-    if(!$stype){
464
-        $stype = 'gd_place';
465
-    }
466
-
467
-    return $stype;
452
+	$post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
453
+
454
+	$stype = false;
455
+	foreach ( $post_types as $post_type => $info ) {
456
+		global $wpdb;
457
+		$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
458
+		if ( $has_posts ) {
459
+			$stype = $post_type; break;
460
+		}
461
+	}
462
+
463
+	if(!$stype){
464
+		$stype = 'gd_place';
465
+	}
466
+
467
+	return $stype;
468 468
 }
469 469
 
470 470
 /**
@@ -478,21 +478,21 @@  discard block
 block discarded – undo
478 478
  */
479 479
 function geodir_get_posttypes($output = 'names')
480 480
 {
481
-    $post_types = array();
482
-    $post_types = get_option('geodir_post_types');
483
-    $post_types = stripslashes_deep($post_types);
484
-    if (!empty($post_types)) {
485
-        switch ($output):
486
-            case 'object':
487
-            case 'Object':
488
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
489
-                break;
490
-            case 'array':
491
-            case 'Array':
492
-                $post_types = (array)$post_types;
493
-                break;
481
+	$post_types = array();
482
+	$post_types = get_option('geodir_post_types');
483
+	$post_types = stripslashes_deep($post_types);
484
+	if (!empty($post_types)) {
485
+		switch ($output):
486
+			case 'object':
487
+			case 'Object':
488
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
489
+				break;
490
+			case 'array':
491
+			case 'Array':
492
+				$post_types = (array)$post_types;
493
+				break;
494 494
 			case 'options':
495
-                $post_types = (array)$post_types;
495
+				$post_types = (array)$post_types;
496 496
 				
497 497
 				$options = array();
498 498
 				if (!empty($post_types)) {
@@ -501,17 +501,17 @@  discard block
 block discarded – undo
501 501
 					}
502 502
 				}
503 503
 				$post_types = $options;
504
-                break;
505
-            default:
506
-                $post_types = array_keys($post_types);
507
-                break;
508
-        endswitch;
509
-    }
510
-
511
-    if (!empty($post_types))
512
-        return $post_types;
513
-    else
514
-        return array();
504
+				break;
505
+			default:
506
+				$post_types = array_keys($post_types);
507
+				break;
508
+		endswitch;
509
+	}
510
+
511
+	if (!empty($post_types))
512
+		return $post_types;
513
+	else
514
+		return array();
515 515
 }
516 516
 
517 517
 /**
@@ -524,108 +524,108 @@  discard block
 block discarded – undo
524 524
  */
525 525
 function geodir_get_posttype_info($post_type = '')
526 526
 {
527
-    $post_types = array();
528
-    $post_types = get_option('geodir_post_types');
529
-    $post_types = stripslashes_deep($post_types);
530
-    if (!empty($post_types) && $post_type != '') {
531
-        return $post_types[$post_type];
532
-    } else
533
-        return false;
527
+	$post_types = array();
528
+	$post_types = get_option('geodir_post_types');
529
+	$post_types = stripslashes_deep($post_types);
530
+	if (!empty($post_types) && $post_type != '') {
531
+		return $post_types[$post_type];
532
+	} else
533
+		return false;
534 534
 }
535 535
 
536 536
 if (!function_exists('geodir_get_taxonomies')) {
537
-    /**
538
-     * Get all custom taxonomies.
539
-     *
540
-     * @since 1.0.0
541
-     * @package GeoDirectory
542
-     * @param string $post_type The post type.
543
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
544
-     * @return array|bool Taxonomies on success. false on failure.
545
-     */
546
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
547
-    {
537
+	/**
538
+	 * Get all custom taxonomies.
539
+	 *
540
+	 * @since 1.0.0
541
+	 * @package GeoDirectory
542
+	 * @param string $post_type The post type.
543
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
544
+	 * @return array|bool Taxonomies on success. false on failure.
545
+	 */
546
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
547
+	{
548 548
 
549
-        $taxonomies = array();
550
-        $gd_taxonomies = array();
549
+		$taxonomies = array();
550
+		$gd_taxonomies = array();
551 551
 
552
-        if ($taxonomies = get_option('geodir_taxonomies')) {
552
+		if ($taxonomies = get_option('geodir_taxonomies')) {
553 553
 
554 554
 
555
-            $gd_taxonomies = array_keys($taxonomies);
555
+			$gd_taxonomies = array_keys($taxonomies);
556 556
 
557 557
 
558
-            if ($post_type != '')
559
-                $gd_taxonomies = array();
558
+			if ($post_type != '')
559
+				$gd_taxonomies = array();
560 560
 
561
-            $i = 0;
562
-            foreach ($taxonomies as $taxonomy => $args) {
561
+			$i = 0;
562
+			foreach ($taxonomies as $taxonomy => $args) {
563 563
 
564
-                if ($post_type != '' && $args['object_type'] == $post_type)
565
-                    $gd_taxonomies[] = $taxonomy;
564
+				if ($post_type != '' && $args['object_type'] == $post_type)
565
+					$gd_taxonomies[] = $taxonomy;
566 566
 
567
-                if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
568
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
569
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
570
-                }
567
+				if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
568
+					if (array_search($taxonomy, $gd_taxonomies) !== false)
569
+						unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
570
+				}
571 571
 
572
-            }
572
+			}
573
+
574
+			$gd_taxonomies = array_values($gd_taxonomies);
575
+		}
573 576
 
574
-            $gd_taxonomies = array_values($gd_taxonomies);
575
-        }
576
-
577
-        /**
578
-         * Filter the taxonomies.
579
-         *
580
-         * @since 1.0.0
581
-         * @param array $gd_taxonomies The taxonomy array.
582
-         */
583
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
584
-
585
-        if (!empty($taxonomies)) {
586
-            return $taxonomies;
587
-        } else {
588
-            return false;
589
-        }
590
-    }
577
+		/**
578
+		 * Filter the taxonomies.
579
+		 *
580
+		 * @since 1.0.0
581
+		 * @param array $gd_taxonomies The taxonomy array.
582
+		 */
583
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
584
+
585
+		if (!empty($taxonomies)) {
586
+			return $taxonomies;
587
+		} else {
588
+			return false;
589
+		}
590
+	}
591 591
 }
592 592
 
593 593
 if (!function_exists(' geodir_get_categories_dl')) {
594
-    /**
595
-     * Get categories dropdown HTML.
596
-     *
597
-     * @since 1.0.0
598
-     * @package GeoDirectory
599
-     * @param string $post_type The post type.
600
-     * @param string $selected The selected value.
601
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
602
-     * @param bool $echo Prints the HTML when set to true. Default: true.
603
-     * @return void|string Dropdown HTML.
604
-     */
605
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
606
-    {
607
-
608
-        $html = '';
609
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
610
-
611
-        $categories = get_terms($taxonomies);
612
-
613
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
614
-
615
-        foreach ($categories as $category_obj) {
616
-            $select_opt = '';
617
-            if ($selected == $category_obj->term_id) {
618
-                $select_opt = 'selected="selected"';
619
-            }
620
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
621
-                . ucfirst($category_obj->name) . '</option>';
622
-        }
623
-
624
-        if ($echo)
625
-            echo $html;
626
-        else
627
-            return $html;
628
-    }
594
+	/**
595
+	 * Get categories dropdown HTML.
596
+	 *
597
+	 * @since 1.0.0
598
+	 * @package GeoDirectory
599
+	 * @param string $post_type The post type.
600
+	 * @param string $selected The selected value.
601
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
602
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
603
+	 * @return void|string Dropdown HTML.
604
+	 */
605
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
606
+	{
607
+
608
+		$html = '';
609
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
610
+
611
+		$categories = get_terms($taxonomies);
612
+
613
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
614
+
615
+		foreach ($categories as $category_obj) {
616
+			$select_opt = '';
617
+			if ($selected == $category_obj->term_id) {
618
+				$select_opt = 'selected="selected"';
619
+			}
620
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
621
+				. ucfirst($category_obj->name) . '</option>';
622
+		}
623
+
624
+		if ($echo)
625
+			echo $html;
626
+		else
627
+			return $html;
628
+	}
629 629
 }
630 630
 
631 631
 
@@ -640,28 +640,28 @@  discard block
 block discarded – undo
640 640
 function geodir_get_listing_slug($object_type = '')
641 641
 {
642 642
 
643
-    $listing_slug = '';
643
+	$listing_slug = '';
644 644
 
645
-    $post_types = get_option('geodir_post_types');
646
-    $taxonomies = get_option('geodir_taxonomies');
645
+	$post_types = get_option('geodir_post_types');
646
+	$taxonomies = get_option('geodir_taxonomies');
647 647
 
648 648
 
649
-    if ($object_type != '') {
650
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
649
+	if ($object_type != '') {
650
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
651 651
 
652
-            $object_info = $post_types[$object_type];
653
-            $listing_slug = $object_info['listing_slug'];
654
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
655
-            $object_info = $taxonomies[$object_type];
656
-            $listing_slug = $object_info['listing_slug'];
657
-        }
652
+			$object_info = $post_types[$object_type];
653
+			$listing_slug = $object_info['listing_slug'];
654
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
655
+			$object_info = $taxonomies[$object_type];
656
+			$listing_slug = $object_info['listing_slug'];
657
+		}
658 658
 
659
-    }
659
+	}
660 660
 
661
-    if (!empty($listing_slug))
662
-        return $listing_slug;
663
-    else
664
-        return false;
661
+	if (!empty($listing_slug))
662
+		return $listing_slug;
663
+	else
664
+		return false;
665 665
 }
666 666
 
667 667
 
@@ -676,212 +676,212 @@  discard block
 block discarded – undo
676 676
  */
677 677
 function geodir_get_taxonomy_posttype($taxonomy = '')
678 678
 {
679
-    global $wp_query;
680
-
681
-    $post_type = array();
682
-    $taxonomies = array();
683
-
684
-    if (!empty($taxonomy)) {
685
-        $taxonomies[] = $taxonomy;
686
-    } elseif (isset($wp_query->tax_query->queries)) {
687
-        $tax_arr = $wp_query->tax_query->queries;
688
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
689
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
690
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
691
-    }
692
-
693
-    if (!empty($taxonomies)) {
694
-        foreach (geodir_get_posttypes() as $pt) {
695
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
696
-            if (array_intersect($taxonomies, $object_taxonomies))
697
-                $post_type[] = $pt;
698
-        }
699
-    }
700
-
701
-    if (!empty($post_type))
702
-        return $post_type[0];
703
-    else
704
-        return false;
679
+	global $wp_query;
680
+
681
+	$post_type = array();
682
+	$taxonomies = array();
683
+
684
+	if (!empty($taxonomy)) {
685
+		$taxonomies[] = $taxonomy;
686
+	} elseif (isset($wp_query->tax_query->queries)) {
687
+		$tax_arr = $wp_query->tax_query->queries;
688
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
689
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
690
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
691
+	}
692
+
693
+	if (!empty($taxonomies)) {
694
+		foreach (geodir_get_posttypes() as $pt) {
695
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
696
+			if (array_intersect($taxonomies, $object_taxonomies))
697
+				$post_type[] = $pt;
698
+		}
699
+	}
700
+
701
+	if (!empty($post_type))
702
+		return $post_type[0];
703
+	else
704
+		return false;
705 705
 }
706 706
 
707 707
 if (!function_exists('geodir_custom_taxonomy_walker')) {
708
-    /**
709
-     * Custom taxonomy walker function.
710
-     *
711
-     * @since 1.0.0
712
-     * @package GeoDirectory
713
-     * @param string $cat_taxonomy The taxonomy name.
714
-     * @param int $cat_parent The parent term ID.
715
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
716
-     * @param int $pading CSS padding in pixels.
717
-     * @return string|void taxonomy HTML.
718
-     */
719
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
720
-    {
721
-        global $cat_display, $post_cat, $exclude_cats;
722
-
723
-        $search_terms = trim($post_cat, ",");
724
-
725
-        $search_terms = explode(",", $search_terms);
726
-
727
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
728
-
729
-        $display = '';
730
-        $onchange = '';
731
-        $term_check = '';
732
-        $main_list_class = '';
733
-        $out = '';
734
-        //If there are terms, start displaying
735
-        if (count($cat_terms) > 0) {
736
-            //Displaying as a list
737
-            $p = $pading * 20;
738
-            $pading++;
739
-
740
-
741
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
742
-                if ($cat_parent == 0) {
743
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
744
-                    $main_list_class = 'class="main_list_selecter"';
745
-                } else {
746
-                    //$display = 'display:none';
747
-                    $list_class = 'sub_list gd-sub-cats-list';
748
-                }
749
-            }
708
+	/**
709
+	 * Custom taxonomy walker function.
710
+	 *
711
+	 * @since 1.0.0
712
+	 * @package GeoDirectory
713
+	 * @param string $cat_taxonomy The taxonomy name.
714
+	 * @param int $cat_parent The parent term ID.
715
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
716
+	 * @param int $pading CSS padding in pixels.
717
+	 * @return string|void taxonomy HTML.
718
+	 */
719
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
720
+	{
721
+		global $cat_display, $post_cat, $exclude_cats;
722
+
723
+		$search_terms = trim($post_cat, ",");
724
+
725
+		$search_terms = explode(",", $search_terms);
726
+
727
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
728
+
729
+		$display = '';
730
+		$onchange = '';
731
+		$term_check = '';
732
+		$main_list_class = '';
733
+		$out = '';
734
+		//If there are terms, start displaying
735
+		if (count($cat_terms) > 0) {
736
+			//Displaying as a list
737
+			$p = $pading * 20;
738
+			$pading++;
739
+
740
+
741
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
742
+				if ($cat_parent == 0) {
743
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
744
+					$main_list_class = 'class="main_list_selecter"';
745
+				} else {
746
+					//$display = 'display:none';
747
+					$list_class = 'sub_list gd-sub-cats-list';
748
+				}
749
+			}
750 750
 
751
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
752
-                $p = 0;
753
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
754
-            }
751
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
752
+				$p = 0;
753
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
754
+			}
755 755
 
756
-            foreach ($cat_terms as $cat_term) {
756
+			foreach ($cat_terms as $cat_term) {
757 757
 
758
-                $checked = '';
758
+				$checked = '';
759 759
 
760
-                if (in_array($cat_term->term_id, $search_terms)) {
761
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
762
-                        $checked = 'selected="selected"';
763
-                    else
764
-                        $checked = 'checked="checked"';
765
-                }
760
+				if (in_array($cat_term->term_id, $search_terms)) {
761
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
762
+						$checked = 'selected="selected"';
763
+					else
764
+						$checked = 'checked="checked"';
765
+				}
766 766
 
767
-                if ($cat_display == 'radio')
768
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
769
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
770
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
767
+				if ($cat_display == 'radio')
768
+					$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
769
+				elseif ($cat_display == 'select' || $cat_display == 'multiselect')
770
+					$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
771 771
 
772
-                else {
773
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
774
-                }
772
+				else {
773
+					$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
774
+				}
775 775
 
776
-                // Call recurson to print sub cats
777
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
776
+				// Call recurson to print sub cats
777
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
778 778
 
779
-            }
779
+			}
780 780
 
781
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
782
-                $out .= '</div>';
781
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
782
+				$out .= '</div>';
783 783
 
784
-            return $out;
785
-        }
786
-        return;
787
-    }
784
+			return $out;
785
+		}
786
+		return;
787
+	}
788 788
 }
789 789
 
790 790
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
791
-    /**
792
-     * Custom taxonomy walker function.
793
-     *
794
-     * @since 1.0.0
795
-     * @package GeoDirectory
796
-     * @global object $post WordPress Post object.
797
-     * @global object $gd_session GeoDirectory Session object.
798
-     * @param string $cat_taxonomy The taxonomy name.
799
-     * @param string $cat_limit Number of categories to display.
800
-     */
801
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
802
-    {
803
-        $post_category = '';
804
-        $post_category_str = '';
805
-        global $exclude_cats, $gd_session;
806
-
807
-        $cat_exclude = '';
808
-        if (is_array($exclude_cats) && !empty($exclude_cats))
809
-            $cat_exclude = serialize($exclude_cats);
810
-
811
-        if (isset($_REQUEST['backandedit'])) {
812
-            $post = (object)$gd_session->get('listing');
813
-
814
-            if (!is_array($post->post_category[$cat_taxonomy]))
815
-                $post_category = $post->post_category[$cat_taxonomy];
816
-
817
-            $post_categories = $post->post_category_str;
818
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
819
-                $post_category_str = $post_categories[$cat_taxonomy];
820
-
821
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
822
-            global $post;
823
-
824
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
825
-            if (empty($post_category) && isset($post->{$cat_taxonomy})) {
826
-                $post_category = $post->{$cat_taxonomy};
827
-            }
791
+	/**
792
+	 * Custom taxonomy walker function.
793
+	 *
794
+	 * @since 1.0.0
795
+	 * @package GeoDirectory
796
+	 * @global object $post WordPress Post object.
797
+	 * @global object $gd_session GeoDirectory Session object.
798
+	 * @param string $cat_taxonomy The taxonomy name.
799
+	 * @param string $cat_limit Number of categories to display.
800
+	 */
801
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
802
+	{
803
+		$post_category = '';
804
+		$post_category_str = '';
805
+		global $exclude_cats, $gd_session;
806
+
807
+		$cat_exclude = '';
808
+		if (is_array($exclude_cats) && !empty($exclude_cats))
809
+			$cat_exclude = serialize($exclude_cats);
810
+
811
+		if (isset($_REQUEST['backandedit'])) {
812
+			$post = (object)$gd_session->get('listing');
813
+
814
+			if (!is_array($post->post_category[$cat_taxonomy]))
815
+				$post_category = $post->post_category[$cat_taxonomy];
816
+
817
+			$post_categories = $post->post_category_str;
818
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
819
+				$post_category_str = $post_categories[$cat_taxonomy];
820
+
821
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
822
+			global $post;
823
+
824
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
825
+			if (empty($post_category) && isset($post->{$cat_taxonomy})) {
826
+				$post_category = $post->{$cat_taxonomy};
827
+			}
828 828
 
829
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
829
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
830 830
 
831
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
832
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
833
-                    if (is_numeric($cat_part)) {
834
-                        $cat_part_arr[] = $cat_part;
835
-                    }
836
-                }
837
-                if (is_array($cat_part_arr)) {
838
-                    $post_category = implode(',', $cat_part_arr);
839
-                }
840
-            }
831
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
832
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
833
+					if (is_numeric($cat_part)) {
834
+						$cat_part_arr[] = $cat_part;
835
+					}
836
+				}
837
+				if (is_array($cat_part_arr)) {
838
+					$post_category = implode(',', $cat_part_arr);
839
+				}
840
+			}
841 841
 
842
-            if (!empty($post_category)) {
843
-                $cat1 = array_filter(explode(',', $post_category));
844
-                $post_category = ',' . implode(',', $cat1) . ',';
842
+			if (!empty($post_category)) {
843
+				$cat1 = array_filter(explode(',', $post_category));
844
+				$post_category = ',' . implode(',', $cat1) . ',';
845 845
 
846
-            }
846
+			}
847 847
 
848
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
848
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
849 849
 
850
-                $post_category_upd = explode(',', $post_category);
851
-                $post_category_change = '';
852
-                foreach ($post_category_upd as $cat) {
850
+				$post_category_upd = explode(',', $post_category);
851
+				$post_category_change = '';
852
+				foreach ($post_category_upd as $cat) {
853 853
 
854
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
855
-                        $post_category_change .= ',' . $cat;
856
-                    }
857
-                }
858
-                $post_category = $post_category_change;
859
-            }
854
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
855
+						$post_category_change .= ',' . $cat;
856
+					}
857
+				}
858
+				$post_category = $post_category_change;
859
+			}
860 860
 
861 861
 
862
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
863
-                $post_category_str = $post_categories[$cat_taxonomy];
864
-            }
865
-        }
862
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
863
+				$post_category_str = $post_categories[$cat_taxonomy];
864
+			}
865
+		}
866 866
 
867
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
867
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
868 868
 
869
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
869
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
870 870
 
871
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
871
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
872 872
 
873 873
 
874
-        ?>
874
+		?>
875 875
         <div class="cat_sublist">
876 876
             <?php
877 877
 
878
-            $post_id = isset($post->ID) ? $post->ID : '';
878
+			$post_id = isset($post->ID) ? $post->ID : '';
879 879
 
880
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
880
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
881 881
 
882
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
883
-            }
884
-            ?>
882
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
883
+			}
884
+			?>
885 885
         </div>
886 886
         <script type="text/javascript">
887 887
 
@@ -1004,22 +1004,22 @@  discard block
 block discarded – undo
1004 1004
 
1005 1005
         </script>
1006 1006
         <?php
1007
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1008
-            $post_cat_str = $post_categories[$cat_taxonomy];
1009
-            $post_cat_array = explode("#", $post_cat_str);
1010
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1011
-                $style = "display:none;";
1012
-        }
1013
-        ?>
1007
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1008
+			$post_cat_str = $post_categories[$cat_taxonomy];
1009
+			$post_cat_array = explode("#", $post_cat_str);
1010
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1011
+				$style = "display:none;";
1012
+		}
1013
+		?>
1014 1014
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1015
-            echo $style;
1016
-        }?> ">
1015
+			echo $style;
1016
+		}?> ">
1017 1017
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1018
-            ?>
1018
+			?>
1019 1019
         </div>
1020 1020
     <?php
1021 1021
 
1022
-    }
1022
+	}
1023 1023
 }
1024 1024
 
1025 1025
 /**
@@ -1036,23 +1036,23 @@  discard block
 block discarded – undo
1036 1036
  */
1037 1037
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
1038 1038
 {
1039
-    global $exclude_cats;
1039
+	global $exclude_cats;
1040 1040
 
1041
-    if ($exclude != '') {
1042
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
1041
+	if ($exclude != '') {
1042
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
1043 1043
 
1044
-        if(is_array( $exclude_cats)){
1045
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1046
-        }else{
1047
-            $exclude_cats = intval($exclude_cats);
1048
-        }
1044
+		if(is_array( $exclude_cats)){
1045
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1046
+		}else{
1047
+			$exclude_cats = intval($exclude_cats);
1048
+		}
1049 1049
 
1050
-    }
1050
+	}
1051 1051
 
1052
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1053
-        (!is_array($exclude_cats) || empty($exclude_cats))
1054
-    ) {
1055
-        ?>
1052
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1053
+		(!is_array($exclude_cats) || empty($exclude_cats))
1054
+	) {
1055
+		?>
1056 1056
 
1057 1057
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1058 1058
 
@@ -1081,8 +1081,8 @@  discard block
 block discarded – undo
1081 1081
 
1082 1082
             <br/>
1083 1083
             <?php
1084
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1085
-            if (!empty($cat_terms)) { ?>
1084
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1085
+			if (!empty($cat_terms)) { ?>
1086 1086
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1087 1087
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1088 1088
             <?php } ?>
@@ -1104,53 +1104,53 @@  discard block
 block discarded – undo
1104 1104
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1105 1105
 {
1106 1106
 
1107
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1108
-        $post_cat_str = $post_categories[$request_taxonomy];
1109
-        $post_cat_array = explode("#", $post_cat_str);
1110
-        if (is_array($post_cat_array)) {
1111
-            $post_cat_array = array_unique( $post_cat_array );
1107
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1108
+		$post_cat_str = $post_categories[$request_taxonomy];
1109
+		$post_cat_array = explode("#", $post_cat_str);
1110
+		if (is_array($post_cat_array)) {
1111
+			$post_cat_array = array_unique( $post_cat_array );
1112 1112
 
1113 1113
 			foreach ($post_cat_array as $post_cat_html) {
1114 1114
 
1115
-                $post_cat_info = explode(":", $post_cat_html);
1116
-                $post_maincat_str = $post_cat_info[0];
1115
+				$post_cat_info = explode(":", $post_cat_html);
1116
+				$post_maincat_str = $post_cat_info[0];
1117 1117
 
1118
-                if (!empty($post_maincat_str)) {
1119
-                    $post_maincat_info = explode(",", $post_maincat_str);
1120
-                    $post_maincat_id = $post_maincat_info[0];
1121
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1122
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1123
-                }
1124
-                $post_sub_catid = '';
1125
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1126
-                    $post_sub_catid = (int)$post_cat_info[1];
1127
-                }
1118
+				if (!empty($post_maincat_str)) {
1119
+					$post_maincat_info = explode(",", $post_maincat_str);
1120
+					$post_maincat_id = $post_maincat_info[0];
1121
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1122
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1123
+				}
1124
+				$post_sub_catid = '';
1125
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1126
+					$post_sub_catid = (int)$post_cat_info[1];
1127
+				}
1128 1128
 
1129
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1129
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1130 1130
 
1131
-            }
1132
-        } else {
1131
+			}
1132
+		} else {
1133 1133
 
1134
-            $post_cat_info = explode(":", $post_cat_str);
1135
-            $post_maincat_str = $post_cat_info[0];
1134
+			$post_cat_info = explode(":", $post_cat_str);
1135
+			$post_maincat_str = $post_cat_info[0];
1136 1136
 
1137
-            $post_sub_catid = '';
1137
+			$post_sub_catid = '';
1138 1138
 
1139
-            if (!empty($post_maincat_str)) {
1140
-                $post_maincat_info = explode(",", $post_maincat_str);
1141
-                $post_maincat_id = $post_maincat_info[0];
1142
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1143
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1144
-            }
1139
+			if (!empty($post_maincat_str)) {
1140
+				$post_maincat_info = explode(",", $post_maincat_str);
1141
+				$post_maincat_id = $post_maincat_info[0];
1142
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1143
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1144
+			}
1145 1145
 
1146
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1147
-                $post_sub_catid = (int)$post_cat_info[1];
1148
-            }
1146
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1147
+				$post_sub_catid = (int)$post_cat_info[1];
1148
+			}
1149 1149
 
1150
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1150
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1151 1151
 
1152
-        }
1153
-    }
1152
+		}
1153
+	}
1154 1154
 }
1155 1155
 
1156 1156
 /**
@@ -1164,35 +1164,35 @@  discard block
 block discarded – undo
1164 1164
  */
1165 1165
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1166 1166
 {
1167
-    global $exclude_cats;
1167
+	global $exclude_cats;
1168 1168
 
1169
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1169
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1170 1170
 
1171
-    if (!empty($cat_terms)) {
1172
-        $onchange = '';
1173
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1171
+	if (!empty($cat_terms)) {
1172
+		$onchange = '';
1173
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1174 1174
 
1175
-        $option_selected = '';
1176
-        if (!$selected)
1177
-            $option_slected = ' selected="selected" ';
1175
+		$option_selected = '';
1176
+		if (!$selected)
1177
+			$option_slected = ' selected="selected" ';
1178 1178
 
1179
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1179
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1180 1180
 
1181
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1181
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1182 1182
 
1183
-        foreach ($cat_terms as $cat_term) {
1184
-            $option_selected = '';
1185
-            if ($selected == $cat_term->term_id)
1186
-                $option_selected = ' selected="selected" ';
1183
+		foreach ($cat_terms as $cat_term) {
1184
+			$option_selected = '';
1185
+			if ($selected == $cat_term->term_id)
1186
+				$option_selected = ' selected="selected" ';
1187 1187
 
1188
-            // Count child terms
1189
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1190
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1188
+			// Count child terms
1189
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1190
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1191 1191
 
1192
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1193
-        }
1194
-        echo '</select>';
1195
-    }
1192
+			echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1193
+		}
1194
+		echo '</select>';
1195
+	}
1196 1196
 }
1197 1197
 
1198 1198
 /**
@@ -1208,28 +1208,28 @@  discard block
 block discarded – undo
1208 1208
  */
1209 1209
 function geodir_custom_update_messages($messages)
1210 1210
 {
1211
-    global $post, $post_ID;
1212
-
1213
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1214
-
1215
-    foreach ($post_types as $post_type => $post_object) {
1216
-
1217
-        $messages[$post_type] = array(
1218
-            0 => '', // Unused. Messages start at index 1.
1219
-            1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1220
-            2 => __('Custom field updated.', 'geodirectory'),
1221
-            3 => __('Custom field deleted.', 'geodirectory'),
1222
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1223
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1224
-            6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1225
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1226
-            8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1227
-            9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1228
-            10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1229
-        );
1230
-    }
1231
-
1232
-    return $messages;
1211
+	global $post, $post_ID;
1212
+
1213
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1214
+
1215
+	foreach ($post_types as $post_type => $post_object) {
1216
+
1217
+		$messages[$post_type] = array(
1218
+			0 => '', // Unused. Messages start at index 1.
1219
+			1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1220
+			2 => __('Custom field updated.', 'geodirectory'),
1221
+			3 => __('Custom field deleted.', 'geodirectory'),
1222
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1223
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1224
+			6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1225
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1226
+			8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1227
+			9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1228
+			10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1229
+		);
1230
+	}
1231
+
1232
+	return $messages;
1233 1233
 }
1234 1234
 
1235 1235
 
@@ -1244,183 +1244,183 @@  discard block
 block discarded – undo
1244 1244
 function geodir_register_defaults()
1245 1245
 {
1246 1246
 
1247
-    global $wpdb;
1248
-
1249
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1250
-
1251
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1252
-        $listing_slug = 'places';
1253
-
1254
-    /**
1255
-     * Taxonomies
1256
-     **/
1257
-    //if ( ! taxonomy_exists('gd_place_tags') )
1258
-    {
1259
-
1260
-        $gd_placetags = array();
1261
-        $gd_placetags['object_type'] = 'gd_place';
1262
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1263
-        $gd_placetags['args'] = array(
1264
-            'public' => true,
1265
-            'hierarchical' => false,
1266
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1267
-            'query_var' => true,
1268
-
1269
-            'labels' => array(
1270
-                'name' => __('Place Tags', 'geodirectory'),
1271
-                'singular_name' => __('Place Tag', 'geodirectory'),
1272
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1273
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1274
-                'all_items' => __('All Place Tags', 'geodirectory'),
1275
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1276
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1277
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1278
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1279
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1280
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1281
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1282
-            ),
1283
-        );
1284
-
1285
-
1286
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1287
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1288
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1289
-
1290
-
1291
-        // Update post types and delete tmp options
1292
-        flush_rewrite_rules();
1293
-
1294
-    }
1295
-
1296
-    //if ( ! taxonomy_exists('gd_placecategory') )
1297
-    {
1298
-
1299
-        $gd_placecategory = array();
1300
-        $gd_placecategory['object_type'] = 'gd_place';
1301
-        $gd_placecategory['listing_slug'] = $listing_slug;
1302
-        $gd_placecategory['args'] = array(
1303
-            'public' => true,
1304
-            'hierarchical' => true,
1305
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1306
-            'query_var' => true,
1307
-            'labels' => array(
1308
-                'name' => __('Place Categories', 'geodirectory'),
1309
-                'singular_name' => __('Place Category', 'geodirectory'),
1310
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1311
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1312
-                'all_items' => __('All Place Categories', 'geodirectory'),
1313
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1314
-                'update_item' => __('Update Place Category', 'geodirectory'),
1315
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1316
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1317
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1318
-            ),
1319
-        );
1320
-
1321
-
1322
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1323
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1324
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1325
-
1326
-
1327
-        flush_rewrite_rules();
1328
-    }
1329
-
1330
-    /**
1331
-     * Post Types
1332
-     **/
1333
-
1334
-    //if ( ! post_type_exists('gd_place') )
1335
-    {
1336
-
1337
-        $labels = array(
1338
-            'name' => __('Places', 'geodirectory'),
1339
-            'singular_name' => __('Place', 'geodirectory'),
1340
-            'add_new' => __('Add New', 'geodirectory'),
1341
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1342
-            'edit_item' => __('Edit Place', 'geodirectory'),
1343
-            'new_item' => __('New Place', 'geodirectory'),
1344
-            'view_item' => __('View Place', 'geodirectory'),
1345
-            'search_items' => __('Search Places', 'geodirectory'),
1346
-            'not_found' => __('No Place Found', 'geodirectory'),
1347
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1348
-
1349
-        $place_default = array(
1350
-            'labels' => $labels,
1351
-            'can_export' => true,
1352
-            'capability_type' => 'post',
1353
-            'description' => 'Place post type.',
1354
-            'has_archive' => $listing_slug,
1355
-            'hierarchical' => false,
1356
-            'map_meta_cap' => true,
1357
-            'menu_icon' => $menu_icon,
1358
-            'public' => true,
1359
-            'query_var' => true,
1360
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1361
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1362
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1363
-
1364
-        //Update custom post types
1365
-        $geodir_post_types = get_option('geodir_post_types');
1366
-        $geodir_post_types['gd_place'] = $place_default;
1367
-        update_option('geodir_post_types', $geodir_post_types);
1368
-
1369
-        // Update post types and delete tmp options
1370
-        flush_rewrite_rules();
1371
-    }
1372
-
1373
-
1374
-    geodir_register_taxonomies();
1375
-    geodir_register_post_types();
1376
-
1377
-    //die;
1247
+	global $wpdb;
1248
+
1249
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1250
+
1251
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1252
+		$listing_slug = 'places';
1253
+
1254
+	/**
1255
+	 * Taxonomies
1256
+	 **/
1257
+	//if ( ! taxonomy_exists('gd_place_tags') )
1258
+	{
1259
+
1260
+		$gd_placetags = array();
1261
+		$gd_placetags['object_type'] = 'gd_place';
1262
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1263
+		$gd_placetags['args'] = array(
1264
+			'public' => true,
1265
+			'hierarchical' => false,
1266
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1267
+			'query_var' => true,
1268
+
1269
+			'labels' => array(
1270
+				'name' => __('Place Tags', 'geodirectory'),
1271
+				'singular_name' => __('Place Tag', 'geodirectory'),
1272
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1273
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1274
+				'all_items' => __('All Place Tags', 'geodirectory'),
1275
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1276
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1277
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1278
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1279
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1280
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1281
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1282
+			),
1283
+		);
1284
+
1285
+
1286
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1287
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1288
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1289
+
1290
+
1291
+		// Update post types and delete tmp options
1292
+		flush_rewrite_rules();
1293
+
1294
+	}
1295
+
1296
+	//if ( ! taxonomy_exists('gd_placecategory') )
1297
+	{
1298
+
1299
+		$gd_placecategory = array();
1300
+		$gd_placecategory['object_type'] = 'gd_place';
1301
+		$gd_placecategory['listing_slug'] = $listing_slug;
1302
+		$gd_placecategory['args'] = array(
1303
+			'public' => true,
1304
+			'hierarchical' => true,
1305
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1306
+			'query_var' => true,
1307
+			'labels' => array(
1308
+				'name' => __('Place Categories', 'geodirectory'),
1309
+				'singular_name' => __('Place Category', 'geodirectory'),
1310
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1311
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1312
+				'all_items' => __('All Place Categories', 'geodirectory'),
1313
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1314
+				'update_item' => __('Update Place Category', 'geodirectory'),
1315
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1316
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1317
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1318
+			),
1319
+		);
1320
+
1321
+
1322
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1323
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1324
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1325
+
1326
+
1327
+		flush_rewrite_rules();
1328
+	}
1329
+
1330
+	/**
1331
+	 * Post Types
1332
+	 **/
1333
+
1334
+	//if ( ! post_type_exists('gd_place') )
1335
+	{
1336
+
1337
+		$labels = array(
1338
+			'name' => __('Places', 'geodirectory'),
1339
+			'singular_name' => __('Place', 'geodirectory'),
1340
+			'add_new' => __('Add New', 'geodirectory'),
1341
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1342
+			'edit_item' => __('Edit Place', 'geodirectory'),
1343
+			'new_item' => __('New Place', 'geodirectory'),
1344
+			'view_item' => __('View Place', 'geodirectory'),
1345
+			'search_items' => __('Search Places', 'geodirectory'),
1346
+			'not_found' => __('No Place Found', 'geodirectory'),
1347
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1348
+
1349
+		$place_default = array(
1350
+			'labels' => $labels,
1351
+			'can_export' => true,
1352
+			'capability_type' => 'post',
1353
+			'description' => 'Place post type.',
1354
+			'has_archive' => $listing_slug,
1355
+			'hierarchical' => false,
1356
+			'map_meta_cap' => true,
1357
+			'menu_icon' => $menu_icon,
1358
+			'public' => true,
1359
+			'query_var' => true,
1360
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1361
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1362
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1363
+
1364
+		//Update custom post types
1365
+		$geodir_post_types = get_option('geodir_post_types');
1366
+		$geodir_post_types['gd_place'] = $place_default;
1367
+		update_option('geodir_post_types', $geodir_post_types);
1368
+
1369
+		// Update post types and delete tmp options
1370
+		flush_rewrite_rules();
1371
+	}
1372
+
1373
+
1374
+	geodir_register_taxonomies();
1375
+	geodir_register_post_types();
1376
+
1377
+	//die;
1378 1378
 
1379 1379
 }
1380 1380
 
1381 1381
 $gd_wpml_get_languages = "";
1382 1382
 function gd_wpml_get_lang_from_url($url){
1383 1383
 
1384
-    global $gd_wpml_get_languages;
1385
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1384
+	global $gd_wpml_get_languages;
1385
+	if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1386 1386
 
1387 1387
 
1388
-    //
1389
-    $url = str_replace(array("http://","https://"),"",$url);
1388
+	//
1389
+	$url = str_replace(array("http://","https://"),"",$url);
1390 1390
 
1391
-    // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1392
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1391
+	// site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1392
+	$site_url = str_replace(array("http://","https://"),"",site_url());
1393 1393
 
1394
-    $url = str_replace($site_url,"",$url);
1394
+	$url = str_replace($site_url,"",$url);
1395 1395
 
1396 1396
 
1397
-    $segments = explode('/', trim($url, '/'));
1397
+	$segments = explode('/', trim($url, '/'));
1398 1398
 
1399
-    //print_r( $segments);
1400
-    if($gd_wpml_get_languages){
1401
-        $langs = $gd_wpml_get_languages;
1402
-    }else{
1403
-        global $sitepress;
1404
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1405
-    }
1399
+	//print_r( $segments);
1400
+	if($gd_wpml_get_languages){
1401
+		$langs = $gd_wpml_get_languages;
1402
+	}else{
1403
+		global $sitepress;
1404
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1405
+	}
1406 1406
 
1407
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1408
-        return $segments[0];
1409
-    }
1407
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1408
+		return $segments[0];
1409
+	}
1410 1410
 
1411
-    return false;
1411
+	return false;
1412 1412
 
1413 1413
 
1414 1414
 }
1415 1415
 
1416 1416
 function gd_wpml_slug_translation_turned_on($post_type) {
1417 1417
 
1418
-    global $sitepress;
1419
-    $settings = $sitepress->get_settings();
1420
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1421
-    && $settings['posts_slug_translation']['types'][$post_type]
1422
-    && isset($settings['posts_slug_translation']['on'])
1423
-    && $settings['posts_slug_translation']['on'];
1418
+	global $sitepress;
1419
+	$settings = $sitepress->get_settings();
1420
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1421
+	&& $settings['posts_slug_translation']['types'][$post_type]
1422
+	&& isset($settings['posts_slug_translation']['on'])
1423
+	&& $settings['posts_slug_translation']['on'];
1424 1424
 }
1425 1425
 
1426 1426
 
@@ -1445,150 +1445,150 @@  discard block
 block discarded – undo
1445 1445
  */
1446 1446
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1447 1447
 {
1448
-    //echo $post_link."<br />".$sample ;
1448
+	//echo $post_link."<br />".$sample ;
1449 1449
 
1450 1450
 
1451
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1452
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1453
-    } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1454
-        return $post_link;
1455
-    } else {
1456
-        $orig_post = $post;
1457
-        $post = $post_obj;
1458
-    }
1451
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1452
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1453
+	} elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1454
+		return $post_link;
1455
+	} else {
1456
+		$orig_post = $post;
1457
+		$post = $post_obj;
1458
+	}
1459 1459
 
1460
-    if (in_array($post->post_type, geodir_get_posttypes())) {
1460
+	if (in_array($post->post_type, geodir_get_posttypes())) {
1461 1461
 
1462 1462
 
1463
-        $post_types = get_option('geodir_post_types');
1464
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1463
+		$post_types = get_option('geodir_post_types');
1464
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1465 1465
 
1466
-        // Alter the CPT slug if WPML is set to do so
1467
-        if(function_exists('icl_object_id')){
1468
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1466
+		// Alter the CPT slug if WPML is set to do so
1467
+		if(function_exists('icl_object_id')){
1468
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1469 1469
 
1470
-                $org_slug = $slug;
1471
-                $slug = apply_filters( 'wpml_translate_single_string',
1472
-                    $slug,
1473
-                    'WordPress',
1474
-                    'URL slug: ' . $slug,
1475
-                    $language_code);
1470
+				$org_slug = $slug;
1471
+				$slug = apply_filters( 'wpml_translate_single_string',
1472
+					$slug,
1473
+					'WordPress',
1474
+					'URL slug: ' . $slug,
1475
+					$language_code);
1476 1476
 
1477
-                if(!$slug){$slug = $org_slug;}
1477
+				if(!$slug){$slug = $org_slug;}
1478 1478
 
1479
-            }
1480
-        }
1479
+			}
1480
+		}
1481 1481
 
1482
-        if (function_exists('geodir_location_geo_home_link')) {
1483
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1484
-        }
1482
+		if (function_exists('geodir_location_geo_home_link')) {
1483
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1484
+		}
1485 1485
         
1486
-        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1487
-        $site_url = trailingslashit(get_bloginfo('url'));
1486
+		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1487
+		$site_url = trailingslashit(get_bloginfo('url'));
1488 1488
         
1489
-        if (function_exists('geodir_location_geo_home_link')) {
1490
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1491
-        }
1492
-
1493
-        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1494
-        if ($fix_url) {
1495
-            $post_link = str_replace($site_url, '', $post_link);
1496
-        }
1497
-
1498
-        $post_link = trailingslashit(
1499
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1500
-        );
1501
-
1502
-        if ($fix_url) {
1503
-            $post_link = $site_url . $post_link;
1504
-        }
1505
-
1506
-        if (isset($comment_post_cache[$post->ID])) {
1507
-            $post = $comment_post_cache[$post->ID];
1508
-        }
1509
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1510
-            $post_id = $post->ID;
1511
-            if (isset($orig_post)) {
1512
-                $post = $orig_post;
1513
-            }
1514
-            return $gd_permalink_cache[$post_id];
1515
-        }
1489
+		if (function_exists('geodir_location_geo_home_link')) {
1490
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1491
+		}
1516 1492
 
1517
-        if (!isset($post->post_locations)) {
1518
-            $post_type = $post->post_type;
1519
-            $ID = $post->ID;
1520
-            $post2 = $wpdb->get_row(
1521
-                $wpdb->prepare(
1522
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1523
-                    array($post->ID)
1524
-                )
1525
-            );
1493
+		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1494
+		if ($fix_url) {
1495
+			$post_link = str_replace($site_url, '', $post_link);
1496
+		}
1526 1497
 
1527
-            $post = (object)array_merge((array)$post, (array)$post2);
1498
+		$post_link = trailingslashit(
1499
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1500
+		);
1528 1501
 
1529
-            $comment_post_cache[$post->ID] = $post;
1530
-        }
1502
+		if ($fix_url) {
1503
+			$post_link = $site_url . $post_link;
1504
+		}
1531 1505
 
1506
+		if (isset($comment_post_cache[$post->ID])) {
1507
+			$post = $comment_post_cache[$post->ID];
1508
+		}
1509
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1510
+			$post_id = $post->ID;
1511
+			if (isset($orig_post)) {
1512
+				$post = $orig_post;
1513
+			}
1514
+			return $gd_permalink_cache[$post_id];
1515
+		}
1532 1516
 
1517
+		if (!isset($post->post_locations)) {
1518
+			$post_type = $post->post_type;
1519
+			$ID = $post->ID;
1520
+			$post2 = $wpdb->get_row(
1521
+				$wpdb->prepare(
1522
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1523
+					array($post->ID)
1524
+				)
1525
+			);
1533 1526
 
1534
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1527
+			$post = (object)array_merge((array)$post, (array)$post2);
1535 1528
 
1536
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1537
-                $location_request = '';
1529
+			$comment_post_cache[$post->ID] = $post;
1530
+		}
1538 1531
 
1539 1532
 
1540
-                if (!empty($post->post_locations)) {
1541
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1542
-                    if (count($geodir_arr_locations) == 3) {
1543
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1544
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1545
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1546
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1547
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1548
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1549 1533
 
1550
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1551
-                            'region_slug' => $post->region_slug,
1552
-                            'city_slug' => $post->city_slug
1553
-                        );
1534
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1554 1535
 
1555
-                    } else
1556
-                        $post_location = geodir_get_location();
1536
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1537
+				$location_request = '';
1557 1538
 
1558 1539
 
1559
-                } else {
1540
+				if (!empty($post->post_locations)) {
1541
+					$geodir_arr_locations = explode(',', $post->post_locations);
1542
+					if (count($geodir_arr_locations) == 3) {
1543
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1544
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1545
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1546
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1547
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1548
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1560 1549
 
1561
-                    $post_location_sql = $wpdb->get_results(
1562
-                        $wpdb->prepare(
1563
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1564
-                            array($post->ID)
1565
-                        )
1566
-                    );
1567
-
1568
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1569
-
1570
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1571
-                        if (count($geodir_arr_locations) == 3) {
1572
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1573
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1574
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1575
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1576
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1577
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1578
-
1579
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1580
-                                'region_slug' => $post->region_slug,
1581
-                                'city_slug' => $post->city_slug
1582
-                            );
1550
+						$post_location = (object)array('country_slug' => $post->country_slug,
1551
+							'region_slug' => $post->region_slug,
1552
+							'city_slug' => $post->city_slug
1553
+						);
1583 1554
 
1584
-                        }
1585
-                    } else
1586
-                        $post_location = geodir_get_location();
1587
-                }
1555
+					} else
1556
+						$post_location = geodir_get_location();
1588 1557
 
1589 1558
 
1590
-                if (!empty($post_location)) {
1591
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1559
+				} else {
1560
+
1561
+					$post_location_sql = $wpdb->get_results(
1562
+						$wpdb->prepare(
1563
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1564
+							array($post->ID)
1565
+						)
1566
+					);
1567
+
1568
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1569
+
1570
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1571
+						if (count($geodir_arr_locations) == 3) {
1572
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1573
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1574
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1575
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1576
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1577
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1578
+
1579
+							$post_location = (object)array('country_slug' => $post->country_slug,
1580
+								'region_slug' => $post->region_slug,
1581
+								'city_slug' => $post->city_slug
1582
+							);
1583
+
1584
+						}
1585
+					} else
1586
+						$post_location = geodir_get_location();
1587
+				}
1588
+
1589
+
1590
+				if (!empty($post_location)) {
1591
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1592 1592
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1593 1593
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1594 1594
 					
@@ -1606,78 +1606,78 @@  discard block
 block discarded – undo
1606 1606
 					$location_slug[] = $city_slug;
1607 1607
 					
1608 1608
 					$location_request .= implode('/', $location_slug) . '/';
1609
-                }
1610
-            }
1609
+				}
1610
+			}
1611 1611
 
1612
-            if (get_option('geodir_add_categories_url')) {
1612
+			if (get_option('geodir_add_categories_url')) {
1613 1613
 
1614
-                $term_request = '';
1615
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1614
+				$term_request = '';
1615
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1616 1616
 
1617
-                $taxonomies = end($taxonomies);
1617
+				$taxonomies = end($taxonomies);
1618 1618
 
1619
-                if (!empty($post->default_category)) {
1620
-                    $post_terms = $post->default_category;
1621
-                } else {
1622
-                    $post_terms = '';
1619
+				if (!empty($post->default_category)) {
1620
+					$post_terms = $post->default_category;
1621
+				} else {
1622
+					$post_terms = '';
1623 1623
 
1624
-                    if (isset($post->{$taxonomies})) {
1625
-                        $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1626
-                        $post_terms = $post_terms[0];
1627
-                    }
1624
+					if (isset($post->{$taxonomies})) {
1625
+						$post_terms = explode(",", trim($post->{$taxonomies}, ","));
1626
+						$post_terms = $post_terms[0];
1627
+					}
1628 1628
 
1629
-                    if (!$post_terms)
1630
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1629
+					if (!$post_terms)
1630
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1631 1631
 
1632
-                    if (!$post_terms) {
1633
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1632
+					if (!$post_terms) {
1633
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1634 1634
 
1635
-                        if ($post_terms) {
1636
-                            $post_terms = explode(",", trim($post_terms, ","));
1637
-                            $post_terms = $post_terms[0];
1638
-                        }
1639
-                    }
1640
-                }
1635
+						if ($post_terms) {
1636
+							$post_terms = explode(",", trim($post_terms, ","));
1637
+							$post_terms = $post_terms[0];
1638
+						}
1639
+					}
1640
+				}
1641 1641
 
1642
-                $term = get_term_by('id', $post_terms, $taxonomies);
1642
+				$term = get_term_by('id', $post_terms, $taxonomies);
1643 1643
 
1644
-                if (!empty($term))
1645
-                    $term_request = $term->slug;
1646
-                //$term_request = $term->slug.'/';
1647
-            }
1644
+				if (!empty($term))
1645
+					$term_request = $term->slug;
1646
+				//$term_request = $term->slug.'/';
1647
+			}
1648 1648
 
1649
-            $request_term = '';
1650
-            $listingurl_separator = '';
1651
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1652
-            $detailurl_separator = '';
1653
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1654
-                $request_term = $location_request;
1655
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1656
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1657
-                $request_term .= $term_request;
1649
+			$request_term = '';
1650
+			$listingurl_separator = '';
1651
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1652
+			$detailurl_separator = '';
1653
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1654
+				$request_term = $location_request;
1655
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1656
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1657
+				$request_term .= $term_request;
1658 1658
 
1659
-            } else {
1660
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1659
+			} else {
1660
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1661 1661
 
1662
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1663
-            }
1664
-            $request_term = trim($request_term, '/');
1665
-            if (!empty($request_term))
1666
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1667
-            else
1668
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1669
-            //echo $post_link ;
1670
-        }
1671
-        // temp cache the permalink
1672
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1673
-            $gd_permalink_cache[$post->ID] = $post_link;
1674
-        }
1675
-    }
1676
-    if (isset($orig_post)) {
1677
-        $post = $orig_post;
1678
-    }
1679
-
1680
-    return $post_link;
1662
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1663
+			}
1664
+			$request_term = trim($request_term, '/');
1665
+			if (!empty($request_term))
1666
+				$post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1667
+			else
1668
+				$post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1669
+			//echo $post_link ;
1670
+		}
1671
+		// temp cache the permalink
1672
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1673
+			$gd_permalink_cache[$post->ID] = $post_link;
1674
+		}
1675
+	}
1676
+	if (isset($orig_post)) {
1677
+		$post = $orig_post;
1678
+	}
1679
+
1680
+	return $post_link;
1681 1681
 }
1682 1682
 
1683 1683
 /**
@@ -1693,99 +1693,99 @@  discard block
 block discarded – undo
1693 1693
  * @return string The term link.
1694 1694
  */
1695 1695
 function geodir_term_link($termlink, $term, $taxonomy) {
1696
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1696
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1697 1697
 
1698
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1699
-        global $geodir_add_location_url, $gd_session;
1700
-        $include_location = false;
1701
-        $request_term = array();
1702
-        $add_location_url = get_option('geodir_add_location_url');
1703
-        $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1698
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1699
+		global $geodir_add_location_url, $gd_session;
1700
+		$include_location = false;
1701
+		$request_term = array();
1702
+		$add_location_url = get_option('geodir_add_location_url');
1703
+		$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1704 1704
 
1705
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1705
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1706 1706
 
1707
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1708
-            if ($geodir_add_location_url && $add_location_url) {
1709
-                $include_location = true;
1710
-            }
1711
-        } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1712
-            $include_location = true;
1713
-        } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1714
-            $include_location = true;
1715
-        }
1716
-
1717
-        if ($include_location) {
1718
-            global $post;
1707
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1708
+			if ($geodir_add_location_url && $add_location_url) {
1709
+				$include_location = true;
1710
+			}
1711
+		} elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1712
+			$include_location = true;
1713
+		} elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1714
+			$include_location = true;
1715
+		}
1716
+
1717
+		if ($include_location) {
1718
+			global $post;
1719 1719
             
1720
-            $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1720
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1721 1721
             
1722
-            if (geodir_is_page('detail') && isset($post->country_slug)) {
1723
-                $location_terms = array(
1724
-                    'gd_country' => $post->country_slug,
1725
-                    'gd_region' => $post->region_slug,
1726
-                    'gd_city' => $post->city_slug
1727
-                );
1722
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1723
+				$location_terms = array(
1724
+					'gd_country' => $post->country_slug,
1725
+					'gd_region' => $post->region_slug,
1726
+					'gd_city' => $post->city_slug
1727
+				);
1728 1728
                 
1729
-                if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1730
-                    $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1731
-                }
1732
-            } else {
1733
-                $location_terms = geodir_get_current_location_terms('query_vars');
1734
-            }
1729
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1730
+					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1731
+				}
1732
+			} else {
1733
+				$location_terms = geodir_get_current_location_terms('query_vars');
1734
+			}
1735 1735
 
1736
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1737
-            $location_terms = geodir_remove_location_terms($location_terms);
1736
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1737
+			$location_terms = geodir_remove_location_terms($location_terms);
1738 1738
 
1739
-            if (!empty($location_terms)) {
1740
-                $url_separator = '';
1739
+			if (!empty($location_terms)) {
1740
+				$url_separator = '';
1741 1741
 
1742
-                if (get_option('permalink_structure') != '') {
1743
-                    $old_listing_slug = '/' . $listing_slug . '/';
1744
-                    $request_term = implode("/", $location_terms);
1745
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1742
+				if (get_option('permalink_structure') != '') {
1743
+					$old_listing_slug = '/' . $listing_slug . '/';
1744
+					$request_term = implode("/", $location_terms);
1745
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1746 1746
 
1747
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1748
-                } else {
1749
-                    $termlink = geodir_getlink($termlink, $request_term);
1750
-                }
1751
-            }
1752
-        }
1747
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1748
+				} else {
1749
+					$termlink = geodir_getlink($termlink, $request_term);
1750
+				}
1751
+			}
1752
+		}
1753 1753
 
1754
-        // Alter the CPT slug is WPML is set to do so
1755
-        /* we can replace this with the below function
1754
+		// Alter the CPT slug is WPML is set to do so
1755
+		/* we can replace this with the below function
1756 1756
         if(function_exists('icl_object_id')){
1757 1757
             global $sitepress;
1758 1758
             $post_type = str_replace("category","",$taxonomy);
1759 1759
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1760 1760
         }*/
1761 1761
 
1762
-        // Alter the CPT slug if WPML is set to do so
1763
-        if (function_exists('icl_object_id')) {
1764
-            $post_types = get_option('geodir_post_types');
1765
-            $post_type = str_replace("category","",$taxonomy);
1766
-            $post_type = str_replace("_tags","",$post_type);
1767
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1768
-            if (gd_wpml_slug_translation_turned_on($post_type)) {
1769
-                global $sitepress;
1770
-                $default_lang = $sitepress->get_default_language();
1771
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1772
-                if (!$language_code ) {
1773
-                    $language_code  = $default_lang;
1774
-                }
1762
+		// Alter the CPT slug if WPML is set to do so
1763
+		if (function_exists('icl_object_id')) {
1764
+			$post_types = get_option('geodir_post_types');
1765
+			$post_type = str_replace("category","",$taxonomy);
1766
+			$post_type = str_replace("_tags","",$post_type);
1767
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1768
+			if (gd_wpml_slug_translation_turned_on($post_type)) {
1769
+				global $sitepress;
1770
+				$default_lang = $sitepress->get_default_language();
1771
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1772
+				if (!$language_code ) {
1773
+					$language_code  = $default_lang;
1774
+				}
1775 1775
 
1776
-                $org_slug = $slug;
1777
-                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1776
+				$org_slug = $slug;
1777
+				$slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1778 1778
 
1779
-                if (!$slug) {
1780
-                    $slug = $org_slug;
1781
-                }
1779
+				if (!$slug) {
1780
+					$slug = $org_slug;
1781
+				}
1782 1782
 
1783
-                $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1784
-            }
1785
-        }
1786
-    }
1783
+				$termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1784
+			}
1785
+		}
1786
+	}
1787 1787
     
1788
-    return $termlink;
1788
+	return $termlink;
1789 1789
 }
1790 1790
 
1791 1791
 /**
@@ -1811,14 +1811,14 @@  discard block
 block discarded – undo
1811 1811
 	if (in_array($post_type, geodir_get_posttypes())) {
1812 1812
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1813 1813
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1814
-                $location_terms = array(
1815
-                    'gd_country' => $post->country_slug,
1816
-                    'gd_region' => $post->region_slug,
1817
-                    'gd_city' => $post->city_slug
1818
-                );
1819
-            } else {
1820
-                $location_terms = geodir_get_current_location_terms('query_vars');
1821
-            }
1814
+				$location_terms = array(
1815
+					'gd_country' => $post->country_slug,
1816
+					'gd_region' => $post->region_slug,
1817
+					'gd_city' => $post->city_slug
1818
+				);
1819
+			} else {
1820
+				$location_terms = geodir_get_current_location_terms('query_vars');
1821
+			}
1822 1822
 			
1823 1823
 			$location_terms = geodir_remove_location_terms($location_terms);
1824 1824
 			
@@ -1849,14 +1849,14 @@  discard block
 block discarded – undo
1849 1849
  */
1850 1850
 function get_post_type_singular_label($post_type, $echo = false)
1851 1851
 {
1852
-    $obj_post_type = get_post_type_object($post_type);
1853
-    if (!is_object($obj_post_type)) {
1854
-        return;
1855
-    }
1856
-    if ($echo)
1857
-        echo $obj_post_type->labels->singular_name;
1858
-    else
1859
-        return $obj_post_type->labels->singular_name;
1852
+	$obj_post_type = get_post_type_object($post_type);
1853
+	if (!is_object($obj_post_type)) {
1854
+		return;
1855
+	}
1856
+	if ($echo)
1857
+		echo $obj_post_type->labels->singular_name;
1858
+	else
1859
+		return $obj_post_type->labels->singular_name;
1860 1860
 
1861 1861
 }
1862 1862
 
@@ -1871,16 +1871,16 @@  discard block
 block discarded – undo
1871 1871
  */
1872 1872
 function get_post_type_plural_label($post_type, $echo = false)
1873 1873
 {
1874
-    $all_postypes = geodir_get_posttypes();
1874
+	$all_postypes = geodir_get_posttypes();
1875 1875
 
1876
-    if (!in_array($post_type, $all_postypes))
1877
-        return false;
1876
+	if (!in_array($post_type, $all_postypes))
1877
+		return false;
1878 1878
 
1879
-    $obj_post_type = get_post_type_object($post_type);
1880
-    if ($echo)
1881
-        echo $obj_post_type->labels->name;
1882
-    else
1883
-        return $obj_post_type->labels->name;
1879
+	$obj_post_type = get_post_type_object($post_type);
1880
+	if ($echo)
1881
+		echo $obj_post_type->labels->name;
1882
+	else
1883
+		return $obj_post_type->labels->name;
1884 1884
 
1885 1885
 }
1886 1886
 
@@ -1899,51 +1899,51 @@  discard block
 block discarded – undo
1899 1899
  */
1900 1900
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1901 1901
 {
1902
-    global $wpdb;
1903
-
1904
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1905
-    $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1906
-
1907
-    if (is_int($term)) {
1908
-        if (0 == $term)
1909
-            return 0;
1910
-        $where = 't.term_id = %d';
1911
-        if (!empty($taxonomy))
1912
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1913
-        else
1914
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1915
-    }
1902
+	global $wpdb;
1903
+
1904
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1905
+	$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1906
+
1907
+	if (is_int($term)) {
1908
+		if (0 == $term)
1909
+			return 0;
1910
+		$where = 't.term_id = %d';
1911
+		if (!empty($taxonomy))
1912
+			return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1913
+		else
1914
+			return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1915
+	}
1916 1916
 
1917
-    $term = trim(wp_unslash($term));
1917
+	$term = trim(wp_unslash($term));
1918 1918
 
1919
-    if ('' === $slug = sanitize_title($term))
1920
-        return 0;
1919
+	if ('' === $slug = sanitize_title($term))
1920
+		return 0;
1921 1921
 
1922
-    $where = 't.slug = %s';
1922
+	$where = 't.slug = %s';
1923 1923
 
1924
-    $where_fields = array($slug);
1925
-    if (!empty($taxonomy)) {
1926
-        $parent = (int)$parent;
1927
-        if ($parent > 0) {
1928
-            $where_fields[] = $parent;
1929
-            $else_where_fields[] = $parent;
1930
-            $where .= ' AND tt.parent = %d';
1924
+	$where_fields = array($slug);
1925
+	if (!empty($taxonomy)) {
1926
+		$parent = (int)$parent;
1927
+		if ($parent > 0) {
1928
+			$where_fields[] = $parent;
1929
+			$else_where_fields[] = $parent;
1930
+			$where .= ' AND tt.parent = %d';
1931 1931
 
1932
-        }
1932
+		}
1933 1933
 
1934
-        $where_fields[] = $taxonomy;
1934
+		$where_fields[] = $taxonomy;
1935 1935
 
1936 1936
 
1937
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1938
-            return $result;
1937
+		if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1938
+			return $result;
1939 1939
 
1940
-        return false;
1941
-    }
1940
+		return false;
1941
+	}
1942 1942
 
1943
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1944
-        return $result;
1943
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1944
+		return $result;
1945 1945
 
1946
-    return false;
1946
+	return false;
1947 1947
 }
1948 1948
 
1949 1949
 /**
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 function geodir_get_term_icon_rebuild()
1956 1956
 {
1957 1957
 
1958
-    update_option('gd_term_icons', '');
1958
+	update_option('gd_term_icons', '');
1959 1959
 
1960 1960
 }
1961 1961
 
@@ -1973,60 +1973,60 @@  discard block
 block discarded – undo
1973 1973
  */
1974 1974
 function geodir_get_term_icon($term_id = false, $rebuild = false)
1975 1975
 {
1976
-    global $wpdb;
1977
-    if (!$rebuild) {
1978
-        $terms_icons = get_option('gd_term_icons');
1979
-    } else {
1980
-        $terms_icons = '';
1981
-    }
1982
-
1983
-    if (empty($terms_icons)) {
1984
-        $default_icon_url = get_option('geodir_default_marker_icon');
1985
-        $taxonomy = geodir_get_taxonomies();
1986
-        $post_types = geodir_get_posttypes();
1987
-        $tax_arr = array();
1988
-        foreach ($post_types as $post_type) {
1989
-            $tax_arr[] = "'" . $post_type . "category'";
1990
-        }
1991
-        $tax_c = implode(',', $tax_arr);
1992
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1993
-        //$terms = get_terms( $taxonomy );
1994
-
1995
-        if($terms) {
1996
-            foreach ($terms as $term) {
1997
-                $post_type = str_replace("category", "", $term->taxonomy);
1998
-                $a_terms[$post_type][] = $term;
1976
+	global $wpdb;
1977
+	if (!$rebuild) {
1978
+		$terms_icons = get_option('gd_term_icons');
1979
+	} else {
1980
+		$terms_icons = '';
1981
+	}
1999 1982
 
2000
-            }
2001
-        }
1983
+	if (empty($terms_icons)) {
1984
+		$default_icon_url = get_option('geodir_default_marker_icon');
1985
+		$taxonomy = geodir_get_taxonomies();
1986
+		$post_types = geodir_get_posttypes();
1987
+		$tax_arr = array();
1988
+		foreach ($post_types as $post_type) {
1989
+			$tax_arr[] = "'" . $post_type . "category'";
1990
+		}
1991
+		$tax_c = implode(',', $tax_arr);
1992
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1993
+		//$terms = get_terms( $taxonomy );
2002 1994
 
2003
-        if($a_terms) {
2004
-            foreach ($a_terms as $pt => $t2) {
1995
+		if($terms) {
1996
+			foreach ($terms as $term) {
1997
+				$post_type = str_replace("category", "", $term->taxonomy);
1998
+				$a_terms[$post_type][] = $term;
2005 1999
 
2006
-                foreach ($t2 as $term) {
2007
-                    $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2008
-                    if ($term_icon) {
2009
-                        $term_icon_url = $term_icon["src"];
2010
-                    } else {
2011
-                        $term_icon_url = $default_icon_url;
2012
-                    }
2013
-                    $terms_icons[$term->term_id] = $term_icon_url;
2014
-                }
2015
-            }
2016
-        }
2000
+			}
2001
+		}
2002
+
2003
+		if($a_terms) {
2004
+			foreach ($a_terms as $pt => $t2) {
2005
+
2006
+				foreach ($t2 as $term) {
2007
+					$term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2008
+					if ($term_icon) {
2009
+						$term_icon_url = $term_icon["src"];
2010
+					} else {
2011
+						$term_icon_url = $default_icon_url;
2012
+					}
2013
+					$terms_icons[$term->term_id] = $term_icon_url;
2014
+				}
2015
+			}
2016
+		}
2017 2017
 
2018
-        update_option('gd_term_icons', $terms_icons);
2019
-    }
2018
+		update_option('gd_term_icons', $terms_icons);
2019
+	}
2020 2020
 
2021
-    if ($term_id && isset($terms_icons[$term_id])) {
2022
-        return $terms_icons[$term_id];
2023
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
2024
-        return get_option('geodir_default_marker_icon');
2025
-    }
2021
+	if ($term_id && isset($terms_icons[$term_id])) {
2022
+		return $terms_icons[$term_id];
2023
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
2024
+		return get_option('geodir_default_marker_icon');
2025
+	}
2026 2026
 
2027
-    if (is_ssl()) {
2028
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2029
-    }
2027
+	if (is_ssl()) {
2028
+		$terms_icons = str_replace("http:","https:",$terms_icons );
2029
+	}
2030 2030
 
2031
-    return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2031
+	return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2032 2032
 }
2033 2033
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_functions.php 1 patch
Indentation   +2258 added lines, -2258 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@  discard block
 block discarded – undo
10 10
 global $wpdb, $table_prefix;
11 11
 
12 12
 if (!function_exists('geodir_column_exist')) {
13
-    /**
14
-     * Check table column exist or not.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     * @global object $wpdb WordPress Database object.
19
-     * @param string $db The table name.
20
-     * @param string $column The column name.
21
-     * @return bool If column exists returns true. Otherwise false.
22
-     */
23
-    function geodir_column_exist($db, $column)
24
-    {
25
-        global $wpdb;
26
-        $exists = false;
27
-        $columns = $wpdb->get_col("show columns from $db");
28
-        foreach ($columns as $c) {
29
-            if ($c == $column) {
30
-                $exists = true;
31
-                break;
32
-            }
33
-        }
34
-        return $exists;
35
-    }
13
+	/**
14
+	 * Check table column exist or not.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 * @global object $wpdb WordPress Database object.
19
+	 * @param string $db The table name.
20
+	 * @param string $column The column name.
21
+	 * @return bool If column exists returns true. Otherwise false.
22
+	 */
23
+	function geodir_column_exist($db, $column)
24
+	{
25
+		global $wpdb;
26
+		$exists = false;
27
+		$columns = $wpdb->get_col("show columns from $db");
28
+		foreach ($columns as $c) {
29
+			if ($c == $column) {
30
+				$exists = true;
31
+				break;
32
+			}
33
+		}
34
+		return $exists;
35
+	}
36 36
 }
37 37
 
38 38
 if (!function_exists('geodir_add_column_if_not_exist')) {
39
-    /**
40
-     * Add column if table column not exist.
41
-     *
42
-     * @since 1.0.0
43
-     * @package GeoDirectory
44
-     * @global object $wpdb WordPress Database object.
45
-     * @param string $db The table name.
46
-     * @param string $column The column name.
47
-     * @param string $column_attr The column attributes.
48
-     */
49
-    function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
-    {
51
-        global $wpdb;
52
-        $result = 0;// no rows affected
53
-        if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
-        }
57
-        return $result;
58
-    }
39
+	/**
40
+	 * Add column if table column not exist.
41
+	 *
42
+	 * @since 1.0.0
43
+	 * @package GeoDirectory
44
+	 * @global object $wpdb WordPress Database object.
45
+	 * @param string $db The table name.
46
+	 * @param string $column The column name.
47
+	 * @param string $column_attr The column attributes.
48
+	 */
49
+	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
+	{
51
+		global $wpdb;
52
+		$result = 0;// no rows affected
53
+		if (!geodir_column_exist($db, $column)) {
54
+			if (!empty($db) && !empty($column))
55
+				$result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+		}
57
+		return $result;
58
+	}
59 59
 }
60 60
 
61 61
 /**
@@ -72,706 +72,706 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none')
74 74
 {
75
-    global $wpdb, $geodir_post_custom_fields_cache;
76
-
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
-
79
-    if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
-        return $geodir_post_custom_fields_cache[$cache_stored];
81
-    }
82
-
83
-    $default_query = '';
84
-
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
89
-
90
-    if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
93
-        $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
-    }
95
-
96
-    $post_meta_info = $wpdb->get_results(
97
-        $wpdb->prepare(
98
-            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
-            array($post_type)
100
-        )
101
-    );
102
-
103
-
104
-    $return_arr = array();
105
-    if ($post_meta_info) {
106
-
107
-        foreach ($post_meta_info as $post_meta_info_obj) {
108
-
109
-            $custom_fields = array(
110
-                "name" => $post_meta_info_obj->htmlvar_name,
111
-                "label" => $post_meta_info_obj->clabels,
112
-                "default" => $post_meta_info_obj->default_value,
113
-                "type" => $post_meta_info_obj->field_type,
114
-                "desc" => $post_meta_info_obj->admin_desc);
115
-
116
-            if ($post_meta_info_obj->field_type) {
117
-                $options = explode(',', $post_meta_info_obj->option_values);
118
-                $custom_fields["options"] = $options;
119
-            }
120
-
121
-            foreach ($post_meta_info_obj as $key => $val) {
122
-                $custom_fields[$key] = $val;
123
-            }
124
-
125
-            $pricearr = array();
126
-            $pricearr = explode(',', $post_meta_info_obj->packages);
127
-
128
-            if ($package_id != '' && in_array($package_id, $pricearr)) {
129
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
-            } elseif ($package_id == '') {
131
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
-            }
133
-        }
134
-    }
135
-    $geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
-
137
-    if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
-        /**
139
-         * Filter the post custom fields array.
140
-         *
141
-         * @since 1.0.0
142
-         *
143
-         * @param array $return_arr Post custom fields array.
144
-         * @param int|string $package_id The package ID.
145
-         * @param string $post_type Optional. The wordpress post type.
146
-         * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
-         */
148
-        $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
-    }
150
-
151
-    return $return_arr;
75
+	global $wpdb, $geodir_post_custom_fields_cache;
76
+
77
+	$cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
+
79
+	if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
+		return $geodir_post_custom_fields_cache[$cache_stored];
81
+	}
82
+
83
+	$default_query = '';
84
+
85
+	if ($default == 'default')
86
+		$default_query .= " and is_admin IN ('1') ";
87
+	elseif ($default == 'custom')
88
+		$default_query .= " and is_admin = '0' ";
89
+
90
+	if ($fields_location == 'none') {
91
+	} else{
92
+		$fields_location = esc_sql( $fields_location );
93
+		$default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
+	}
95
+
96
+	$post_meta_info = $wpdb->get_results(
97
+		$wpdb->prepare(
98
+			"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
+			array($post_type)
100
+		)
101
+	);
102
+
103
+
104
+	$return_arr = array();
105
+	if ($post_meta_info) {
106
+
107
+		foreach ($post_meta_info as $post_meta_info_obj) {
108
+
109
+			$custom_fields = array(
110
+				"name" => $post_meta_info_obj->htmlvar_name,
111
+				"label" => $post_meta_info_obj->clabels,
112
+				"default" => $post_meta_info_obj->default_value,
113
+				"type" => $post_meta_info_obj->field_type,
114
+				"desc" => $post_meta_info_obj->admin_desc);
115
+
116
+			if ($post_meta_info_obj->field_type) {
117
+				$options = explode(',', $post_meta_info_obj->option_values);
118
+				$custom_fields["options"] = $options;
119
+			}
120
+
121
+			foreach ($post_meta_info_obj as $key => $val) {
122
+				$custom_fields[$key] = $val;
123
+			}
124
+
125
+			$pricearr = array();
126
+			$pricearr = explode(',', $post_meta_info_obj->packages);
127
+
128
+			if ($package_id != '' && in_array($package_id, $pricearr)) {
129
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
+			} elseif ($package_id == '') {
131
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
+			}
133
+		}
134
+	}
135
+	$geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
+
137
+	if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
+		/**
139
+		 * Filter the post custom fields array.
140
+		 *
141
+		 * @since 1.0.0
142
+		 *
143
+		 * @param array $return_arr Post custom fields array.
144
+		 * @param int|string $package_id The package ID.
145
+		 * @param string $post_type Optional. The wordpress post type.
146
+		 * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
+		 */
148
+		$return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
+	}
150
+
151
+	return $return_arr;
152 152
 }
153 153
 
154
-    /**
155
-     * Adds admin html for custom fields.
156
-     *
157
-     * @since 1.0.0
158
-     * @package GeoDirectory
159
-     * @global object $wpdb WordPress Database object.
160
-     * @param string $field_type The form field type.
161
-     * @param object|int $result_str The custom field results object or row id.
162
-     * @param string $field_ins_upd When set to "submit" displays form.
163
-     * @param string $field_type_key The key of the custom field.
164
-     */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
-    {
167
-        global $wpdb;
168
-        $cf = $result_str;
169
-        if (!is_object($cf)) {
170
-
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
-
173
-        } else {
174
-            $field_info = $cf;
175
-            $result_str = $cf->id;
176
-        }
177
-        /**
178
-         * Contains custom field html.
179
-         *
180
-         * @since 1.0.0
181
-         */
182
-        include('custom_field_html.php');
183
-
184
-    }
154
+	/**
155
+	 * Adds admin html for custom fields.
156
+	 *
157
+	 * @since 1.0.0
158
+	 * @package GeoDirectory
159
+	 * @global object $wpdb WordPress Database object.
160
+	 * @param string $field_type The form field type.
161
+	 * @param object|int $result_str The custom field results object or row id.
162
+	 * @param string $field_ins_upd When set to "submit" displays form.
163
+	 * @param string $field_type_key The key of the custom field.
164
+	 */
165
+	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
+	{
167
+		global $wpdb;
168
+		$cf = $result_str;
169
+		if (!is_object($cf)) {
170
+
171
+			$field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
+
173
+		} else {
174
+			$field_info = $cf;
175
+			$result_str = $cf->id;
176
+		}
177
+		/**
178
+		 * Contains custom field html.
179
+		 *
180
+		 * @since 1.0.0
181
+		 */
182
+		include('custom_field_html.php');
183
+
184
+	}
185 185
 
186 186
 
187 187
 if (!function_exists('geodir_custom_field_delete')) {
188
-    /**
189
-     * Delete custom field using field id.
190
-     *
191
-     * @since 1.0.0
192
-     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
-     * @package GeoDirectory
194
-     * @global object $wpdb WordPress Database object.
195
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
196
-     * @param string $field_id The custom field ID.
197
-     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
-     */
199
-    function geodir_custom_field_delete($field_id = '') {
200
-        global $wpdb, $plugin_prefix;
201
-
202
-        if ($field_id != '') {
203
-            $cf = trim($field_id, '_');
204
-
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
-
208
-                $post_type = $field->post_type;
209
-                $htmlvar_name = $field->htmlvar_name;
210
-
211
-                if ($post_type != '' && $htmlvar_name != '') {
212
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
-                }
214
-
215
-                /**
216
-                 * Called after a custom field is deleted.
217
-                 *
218
-                 * @since 1.0.0
219
-                 * @param string $cf The fields ID.
220
-                 * @param string $field->htmlvar_name The html variable name for the field.
221
-                 * @param string $post_type The post type the field belongs to.
222
-                 */
223
-                do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
-
225
-                if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
-                } else {
236
-                    if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
-                    }
239
-                }
240
-
241
-                return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
246
-    }
188
+	/**
189
+	 * Delete custom field using field id.
190
+	 *
191
+	 * @since 1.0.0
192
+	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
+	 * @package GeoDirectory
194
+	 * @global object $wpdb WordPress Database object.
195
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
196
+	 * @param string $field_id The custom field ID.
197
+	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
+	 */
199
+	function geodir_custom_field_delete($field_id = '') {
200
+		global $wpdb, $plugin_prefix;
201
+
202
+		if ($field_id != '') {
203
+			$cf = trim($field_id, '_');
204
+
205
+			if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
+				$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
+
208
+				$post_type = $field->post_type;
209
+				$htmlvar_name = $field->htmlvar_name;
210
+
211
+				if ($post_type != '' && $htmlvar_name != '') {
212
+					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
+				}
214
+
215
+				/**
216
+				 * Called after a custom field is deleted.
217
+				 *
218
+				 * @since 1.0.0
219
+				 * @param string $cf The fields ID.
220
+				 * @param string $field->htmlvar_name The html variable name for the field.
221
+				 * @param string $post_type The post type the field belongs to.
222
+				 */
223
+				do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
+
225
+				if ($field->field_type == 'address') {
226
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
+				} else {
236
+					if ($field->field_type != 'fieldset') {
237
+						$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
+					}
239
+				}
240
+
241
+				return $field_id;
242
+			} else
243
+				return 0;
244
+		} else
245
+			return 0;
246
+	}
247 247
 }
248 248
 
249 249
 if (!function_exists('geodir_custom_field_save')) {
250
-    /**
251
-     * Save or Update custom fields into the database.
252
-     *
253
-     * @since 1.0.0
254
-     * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
-     * @package GeoDirectory
256
-     * @global object $wpdb WordPress Database object.
257
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
258
-     * @param array $request_field {
259
-     *    Attributes of the request field array.
260
-     *
261
-     *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
-     *    @type string $manage_field_type Field type Default "custom_fields".
263
-     *    @type string $create_field Create field Default "true".
264
-     *    @type string $field_ins_upd Field ins upd Default "submit".
265
-     *    @type string $_wpnonce WP nonce value.
266
-     *    @type string $listing_type Listing type Example "gd_place".
267
-     *    @type string $field_type Field type Example "radio".
268
-     *    @type string $field_id Field id Example "12".
269
-     *    @type string $data_type Data type Example "VARCHAR".
270
-     *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
-     *    @type array $show_on_pkg Package list to display this field.
272
-     *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
-     *    @type string $site_title Section title which you wish to display in frontend.
274
-     *    @type string $admin_desc Section description which will appear in frontend.
275
-     *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
-     *    @type string $clabels Section Title which will appear in backend.
277
-     *    @type string $default_value The default value (for "link" this will be used as the link text).
278
-     *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
-     *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
-     *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
-     *    @type string $is_required Use "1" to set field as required.
282
-     *    @type string $required_msg Enter text for error message if field required and have not full fill requirement.
283
-     *    @type string $show_on_listing Want to show this on listing page?.
284
-     *    @type string $show_in What locations to show the custom field in.
285
-     *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
-     *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
-     *    @type string $option_values Option Values should be separated by comma.
288
-     *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
-     *    @type string $css_class Enter custom css class for field custom style.
290
-     *    @type array $extra_fields An array of extra fields to store.
291
-     *
292
-     * }
293
-     * @param bool $default Not yet implemented.
294
-     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
295
-     */
296
-    function geodir_custom_field_save($request_field = array(), $default = false)
297
-    {
298
-
299
-        global $wpdb, $plugin_prefix;
300
-
301
-        $old_html_variable = '';
302
-
303
-        $data_type = trim($request_field['data_type']);
304
-
305
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
306
-
307
-        // some servers fail if a POST value is VARCHAR so we change it.
308
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
309
-            $request_field['data_type'] = 'VARCHAR';
310
-        }
311
-
312
-        $cf = trim($result_str, '_');
313
-
314
-
315
-        /*-------- check duplicate validation --------*/
316
-
317
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
318
-        $post_type = $request_field['listing_type'];
319
-
320
-        if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
321
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
322
-        }
323
-
324
-        $check_html_variable = $wpdb->get_var(
325
-            $wpdb->prepare(
326
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
327
-                array($cf, $cehhtmlvar_name, $post_type)
328
-            )
329
-        );
330
-
331
-
332
-        if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
333
-
334
-            if ($cf != '') {
335
-
336
-                $post_meta_info = $wpdb->get_row(
337
-                    $wpdb->prepare(
338
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
339
-                        array($cf)
340
-                    )
341
-                );
342
-
343
-            }
344
-
345
-            if (!empty($post_meta_info)) {
346
-                $post_val = $post_meta_info;
347
-                $old_html_variable = $post_val->htmlvar_name;
348
-
349
-            }
350
-
351
-
352
-
353
-            if ($post_type == '') $post_type = 'gd_place';
354
-
355
-
356
-            $detail_table = $plugin_prefix . $post_type . '_detail';
357
-
358
-            $admin_title = $request_field['admin_title'];
359
-            $site_title = $request_field['site_title'];
360
-            $data_type = $request_field['data_type'];
361
-            $field_type = $request_field['field_type'];
362
-            $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
363
-            $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
364
-            $admin_desc = $request_field['admin_desc'];
365
-            $clabels = isset($request_field['clabels']) ? $request_field['clabels'] : '';
366
-            $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
367
-            $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
368
-            $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
369
-            $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
370
-            $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
371
-            $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
372
-            $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
373
-            $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
374
-            $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
375
-            $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
376
-            $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
377
-            $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
378
-            $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
379
-            $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
380
-            $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
381
-            $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
250
+	/**
251
+	 * Save or Update custom fields into the database.
252
+	 *
253
+	 * @since 1.0.0
254
+	 * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
+	 * @package GeoDirectory
256
+	 * @global object $wpdb WordPress Database object.
257
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
258
+	 * @param array $request_field {
259
+	 *    Attributes of the request field array.
260
+	 *
261
+	 *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
+	 *    @type string $manage_field_type Field type Default "custom_fields".
263
+	 *    @type string $create_field Create field Default "true".
264
+	 *    @type string $field_ins_upd Field ins upd Default "submit".
265
+	 *    @type string $_wpnonce WP nonce value.
266
+	 *    @type string $listing_type Listing type Example "gd_place".
267
+	 *    @type string $field_type Field type Example "radio".
268
+	 *    @type string $field_id Field id Example "12".
269
+	 *    @type string $data_type Data type Example "VARCHAR".
270
+	 *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
+	 *    @type array $show_on_pkg Package list to display this field.
272
+	 *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
+	 *    @type string $site_title Section title which you wish to display in frontend.
274
+	 *    @type string $admin_desc Section description which will appear in frontend.
275
+	 *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
+	 *    @type string $clabels Section Title which will appear in backend.
277
+	 *    @type string $default_value The default value (for "link" this will be used as the link text).
278
+	 *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
+	 *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
+	 *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
+	 *    @type string $is_required Use "1" to set field as required.
282
+	 *    @type string $required_msg Enter text for error message if field required and have not full fill requirement.
283
+	 *    @type string $show_on_listing Want to show this on listing page?.
284
+	 *    @type string $show_in What locations to show the custom field in.
285
+	 *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
+	 *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
+	 *    @type string $option_values Option Values should be separated by comma.
288
+	 *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
+	 *    @type string $css_class Enter custom css class for field custom style.
290
+	 *    @type array $extra_fields An array of extra fields to store.
291
+	 *
292
+	 * }
293
+	 * @param bool $default Not yet implemented.
294
+	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
295
+	 */
296
+	function geodir_custom_field_save($request_field = array(), $default = false)
297
+	{
298
+
299
+		global $wpdb, $plugin_prefix;
300
+
301
+		$old_html_variable = '';
302
+
303
+		$data_type = trim($request_field['data_type']);
304
+
305
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
306
+
307
+		// some servers fail if a POST value is VARCHAR so we change it.
308
+		if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
309
+			$request_field['data_type'] = 'VARCHAR';
310
+		}
311
+
312
+		$cf = trim($result_str, '_');
313
+
314
+
315
+		/*-------- check duplicate validation --------*/
316
+
317
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
318
+		$post_type = $request_field['listing_type'];
319
+
320
+		if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
321
+			$cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
322
+		}
323
+
324
+		$check_html_variable = $wpdb->get_var(
325
+			$wpdb->prepare(
326
+				"select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
327
+				array($cf, $cehhtmlvar_name, $post_type)
328
+			)
329
+		);
330
+
331
+
332
+		if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
333
+
334
+			if ($cf != '') {
335
+
336
+				$post_meta_info = $wpdb->get_row(
337
+					$wpdb->prepare(
338
+						"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
339
+						array($cf)
340
+					)
341
+				);
342
+
343
+			}
344
+
345
+			if (!empty($post_meta_info)) {
346
+				$post_val = $post_meta_info;
347
+				$old_html_variable = $post_val->htmlvar_name;
348
+
349
+			}
350
+
351
+
352
+
353
+			if ($post_type == '') $post_type = 'gd_place';
354
+
355
+
356
+			$detail_table = $plugin_prefix . $post_type . '_detail';
357
+
358
+			$admin_title = $request_field['admin_title'];
359
+			$site_title = $request_field['site_title'];
360
+			$data_type = $request_field['data_type'];
361
+			$field_type = $request_field['field_type'];
362
+			$field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
363
+			$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
364
+			$admin_desc = $request_field['admin_desc'];
365
+			$clabels = isset($request_field['clabels']) ? $request_field['clabels'] : '';
366
+			$default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
367
+			$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
368
+			$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
369
+			$is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
370
+			$required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
371
+			$css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
372
+			$field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
373
+			$show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
374
+			$show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
375
+			$show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
376
+			$show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
377
+			$decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
378
+			$decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
379
+			$validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
380
+			$validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
381
+			$for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
382 382
 
383 383
             
384
-            if(is_array($show_in)){
385
-                $show_in = implode(",", $request_field['show_in']);
386
-            }
384
+			if(is_array($show_in)){
385
+				$show_in = implode(",", $request_field['show_in']);
386
+			}
387 387
             
388
-            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
389
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
390
-            }
388
+			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
389
+				$htmlvar_name = 'geodir_' . $htmlvar_name;
390
+			}
391 391
 
392
-            $option_values = '';
393
-            if (isset($request_field['option_values']))
394
-                $option_values = $request_field['option_values'];
392
+			$option_values = '';
393
+			if (isset($request_field['option_values']))
394
+				$option_values = $request_field['option_values'];
395 395
 
396
-            $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396
+			$cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
397 397
 
398
-            $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398
+			$cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
399 399
 
400
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
401
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
402
-            else {
403
-                $package_info = array();
400
+			if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
401
+				$price_pkg = implode(",", $request_field['show_on_pkg']);
402
+			else {
403
+				$package_info = array();
404 404
 
405
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
406
-                $price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
407
-            }
405
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
406
+				$price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
407
+			}
408 408
 
409 409
 
410
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
411
-                $extra_fields = $request_field['extra'];
410
+			if (isset($request_field['extra']) && !empty($request_field['extra']))
411
+				$extra_fields = $request_field['extra'];
412 412
 
413
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
414
-                $is_default = $request_field['is_default'];
415
-            else
416
-                $is_default = '0';
413
+			if (isset($request_field['is_default']) && $request_field['is_default'] != '')
414
+				$is_default = $request_field['is_default'];
415
+			else
416
+				$is_default = '0';
417 417
 
418
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
419
-                $is_admin = $request_field['is_admin'];
420
-            else
421
-                $is_admin = '0';
418
+			if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
419
+				$is_admin = $request_field['is_admin'];
420
+			else
421
+				$is_admin = '0';
422 422
 
423 423
 
424
-            if ($is_active == '') $is_active = 1;
425
-            if ($is_required == '') $is_required = 0;
424
+			if ($is_active == '') $is_active = 1;
425
+			if ($is_required == '') $is_required = 0;
426 426
 
427 427
 
428
-            if ($sort_order == '') {
428
+			if ($sort_order == '') {
429 429
 
430
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
430
+				$last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
431 431
 
432
-                $sort_order = (int)$last_order + 1;
433
-            }
432
+				$sort_order = (int)$last_order + 1;
433
+			}
434 434
 
435
-            $default_value_add = '';
435
+			$default_value_add = '';
436 436
 
437 437
 
438
-            if (!empty($post_meta_info)) {
439
-                switch ($field_type):
438
+			if (!empty($post_meta_info)) {
439
+				switch ($field_type):
440 440
 
441
-                    case 'address':
441
+					case 'address':
442 442
 
443
-                        if ($htmlvar_name != '') {
444
-                            $prefix = $htmlvar_name . '_';
445
-                        }
446
-                        $old_prefix = $old_html_variable . '_';
443
+						if ($htmlvar_name != '') {
444
+							$prefix = $htmlvar_name . '_';
445
+						}
446
+						$old_prefix = $old_html_variable . '_';
447 447
 
448 448
 
449
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
449
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
450 450
 
451
-                        if ($default_value != '') {
452
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
453
-                        }
451
+						if ($default_value != '') {
452
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
453
+						}
454 454
 
455
-                        $wpdb->query($meta_field_add);
455
+						$wpdb->query($meta_field_add);
456 456
 
457
-                        if ($extra_fields != '') {
457
+						if ($extra_fields != '') {
458 458
 
459
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
460 460
 
461
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
462
-                                if ($is_column) {
463
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
461
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
462
+								if ($is_column) {
463
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
464 464
 
465
-                                    if ($default_value != '') {
466
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
467
-                                    }
465
+									if ($default_value != '') {
466
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
467
+									}
468 468
 
469
-                                    $wpdb->query($meta_field_add);
470
-                                } else {
469
+									$wpdb->query($meta_field_add);
470
+								} else {
471 471
 
472
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
473
-                                    if ($default_value != '') {
474
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
475
-                                    }
476
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
472
+									$meta_field_add = "VARCHAR( 50 ) NULL";
473
+									if ($default_value != '') {
474
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
475
+									}
476
+									geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
477 477
 
478
-                                }
478
+								}
479 479
 
480 480
 
481
-                            }
481
+							}
482 482
 
483 483
 
484
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
485 485
 
486
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
486
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
487 487
 
488
-                                if ($is_column) {
489
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
488
+								if ($is_column) {
489
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
490 490
 
491
-                                    if ($default_value != '') {
492
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
493
-                                    }
491
+									if ($default_value != '') {
492
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
493
+									}
494 494
 
495
-                                    $wpdb->query($meta_field_add);
496
-                                } else {
497
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
498
-                                    if ($default_value != '') {
499
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
500
-                                    }
495
+									$wpdb->query($meta_field_add);
496
+								} else {
497
+									$meta_field_add = "VARCHAR( 50 ) NULL";
498
+									if ($default_value != '') {
499
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
500
+									}
501 501
 
502
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
503
-                                }
502
+									geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
503
+								}
504 504
 
505
-                            }
506
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
505
+							}
506
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
507 507
 
508
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
508
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
509 509
 
510
-                                if ($is_column) {
510
+								if ($is_column) {
511 511
 
512
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
512
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
513 513
 
514
-                                    if ($default_value != '') {
515
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
516
-                                    }
514
+									if ($default_value != '') {
515
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
516
+									}
517 517
 
518
-                                    $wpdb->query($meta_field_add);
519
-                                } else {
518
+									$wpdb->query($meta_field_add);
519
+								} else {
520 520
 
521
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
522
-                                    if ($default_value != '') {
523
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
524
-                                    }
521
+									$meta_field_add = "VARCHAR( 50 ) NULL";
522
+									if ($default_value != '') {
523
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
524
+									}
525 525
 
526
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
526
+									geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
527 527
 
528
-                                }
528
+								}
529 529
 
530
-                            }
531
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
530
+							}
531
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
532 532
 
533
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
533
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
534 534
 
535
-                                if ($is_column) {
535
+								if ($is_column) {
536 536
 
537
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
537
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
538 538
 
539
-                                    if ($default_value != '') {
540
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
541
-                                    }
539
+									if ($default_value != '') {
540
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
541
+									}
542 542
 
543
-                                    $wpdb->query($meta_field_add);
544
-                                } else {
543
+									$wpdb->query($meta_field_add);
544
+								} else {
545 545
 
546
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
547
-                                    if ($default_value != '') {
548
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
549
-                                    }
546
+									$meta_field_add = "VARCHAR( 50 ) NULL";
547
+									if ($default_value != '') {
548
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
549
+									}
550 550
 
551
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
551
+									geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
552 552
 
553
-                                }
553
+								}
554 554
 
555
-                            }
556
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
555
+							}
556
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
557 557
 
558
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
559
-                                if ($is_column) {
558
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
559
+								if ($is_column) {
560 560
 
561
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
561
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
562 562
 
563
-                                    if ($default_value != '') {
564
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
565
-                                    }
563
+									if ($default_value != '') {
564
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
565
+									}
566 566
 
567
-                                    $wpdb->query($meta_field_add);
568
-                                } else {
567
+									$wpdb->query($meta_field_add);
568
+								} else {
569 569
 
570
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
571
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
572
-                                    if ($default_value != '') {
573
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
574
-                                    }
570
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
571
+									$meta_field_add = "VARCHAR( 20 ) NULL";
572
+									if ($default_value != '') {
573
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
574
+									}
575 575
 
576
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
576
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
577 577
 
578
-                                }
578
+								}
579 579
 
580 580
 
581
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
581
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
582 582
 
583
-                                if ($is_column) {
584
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
583
+								if ($is_column) {
584
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
585 585
 
586
-                                    if ($default_value != '') {
587
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
588
-                                    }
586
+									if ($default_value != '') {
587
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
588
+									}
589 589
 
590
-                                    $wpdb->query($meta_field_add);
591
-                                } else {
590
+									$wpdb->query($meta_field_add);
591
+								} else {
592 592
 
593
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
594
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
595
-                                    if ($default_value != '') {
596
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
597
-                                    }
593
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
594
+									$meta_field_add = "VARCHAR( 20 ) NULL";
595
+									if ($default_value != '') {
596
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
597
+									}
598 598
 
599
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
600
-                                }
599
+									geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
600
+								}
601 601
 
602
-                            }
603
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
602
+							}
603
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
604 604
 
605
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
605
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
606 606
 
607
-                                if ($is_column) {
608
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
607
+								if ($is_column) {
608
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
609 609
 
610
-                                    if ($default_value != '') {
611
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
612
-                                    }
610
+									if ($default_value != '') {
611
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
612
+									}
613 613
 
614
-                                    $wpdb->query($meta_field_add);
615
-                                } else {
614
+									$wpdb->query($meta_field_add);
615
+								} else {
616 616
 
617
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
617
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
618 618
 
619
-                                    $meta_field_add = "VARCHAR( 15 ) NULL";
620
-                                    if ($default_value != '') {
621
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
622
-                                    }
619
+									$meta_field_add = "VARCHAR( 15 ) NULL";
620
+									if ($default_value != '') {
621
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
622
+									}
623 623
 
624
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
625
-                                }
624
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
625
+								}
626 626
 
627 627
 
628
-                            }
629
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
628
+							}
629
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
630 630
 
631
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
632
-                                if ($is_column) {
633
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
631
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
632
+								if ($is_column) {
633
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
634 634
 
635
-                                    if ($default_value != '') {
636
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
637
-                                    }
635
+									if ($default_value != '') {
636
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
637
+									}
638 638
 
639
-                                    $wpdb->query($meta_field_add);
639
+									$wpdb->query($meta_field_add);
640 640
 
641
-                                } else {
641
+								} else {
642 642
 
643
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
643
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
644 644
 
645
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
646
-                                    if ($default_value != '') {
647
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
648
-                                    }
645
+									$meta_field_add = "VARCHAR( 3 ) NULL";
646
+									if ($default_value != '') {
647
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
648
+									}
649 649
 
650
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
651
-                                }
650
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
651
+								}
652 652
 
653
-                            }
654
-                            // show lat lng
655
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
656
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
653
+							}
654
+							// show lat lng
655
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
656
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
657 657
 
658
-                                if ($is_column) {
659
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
660
-                                    $meta_field_add .= " DEFAULT '1'";
658
+								if ($is_column) {
659
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
660
+									$meta_field_add .= " DEFAULT '1'";
661 661
 
662
-                                    $wpdb->query($meta_field_add);
663
-                                } else {
664
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
662
+									$wpdb->query($meta_field_add);
663
+								} else {
664
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
665 665
 
666
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
667
-                                    $meta_field_add .= " DEFAULT '1'";
666
+									$meta_field_add = "VARCHAR( 3 ) NULL";
667
+									$meta_field_add .= " DEFAULT '1'";
668 668
 
669
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
670
-                                }
669
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
670
+								}
671 671
 
672
-                            }
673
-                        }// end extra
672
+							}
673
+						}// end extra
674 674
 
675
-                        break;
675
+						break;
676 676
 
677
-                    case 'checkbox':
678
-                    case 'multiselect':
679
-                    case 'select':
680
-                    case 'taxonomy':
677
+					case 'checkbox':
678
+					case 'multiselect':
679
+					case 'select':
680
+					case 'taxonomy':
681 681
 
682
-                        $op_size = '500';
682
+						$op_size = '500';
683 683
 
684
-                        // only make the field as big as it needs to be.
685
-                        if(isset($option_values) && $option_values && $field_type=='select'){
686
-                            $option_values_arr = explode(',',$option_values);
687
-                            if(is_array($option_values_arr)){
688
-                                $op_max = 0;
689
-                                foreach($option_values_arr as $op_val){
690
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
691
-                                }
692
-                                if($op_max){$op_size =$op_max; }
693
-                            }
694
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
695
-                            if(strlen($option_values)){
696
-                                $op_size =  strlen($option_values);
697
-                            }
698
-                        }
684
+						// only make the field as big as it needs to be.
685
+						if(isset($option_values) && $option_values && $field_type=='select'){
686
+							$option_values_arr = explode(',',$option_values);
687
+							if(is_array($option_values_arr)){
688
+								$op_max = 0;
689
+								foreach($option_values_arr as $op_val){
690
+									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
691
+								}
692
+								if($op_max){$op_size =$op_max; }
693
+							}
694
+						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
695
+							if(strlen($option_values)){
696
+								$op_size =  strlen($option_values);
697
+							}
698
+						}
699 699
 
700
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
700
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
701 701
 
702
-                        if ($default_value != '') {
703
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
704
-                        }
702
+						if ($default_value != '') {
703
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
704
+						}
705 705
 
706
-                        $alter_result = $wpdb->query($meta_field_add);
707
-                        if($alter_result===false){
708
-                            return __('Column change failed, you may have too many columns.','geodirectory');
709
-                        }
706
+						$alter_result = $wpdb->query($meta_field_add);
707
+						if($alter_result===false){
708
+							return __('Column change failed, you may have too many columns.','geodirectory');
709
+						}
710 710
 
711
-                        if (isset($request_field['cat_display_type']))
712
-                            $extra_fields = $request_field['cat_display_type'];
711
+						if (isset($request_field['cat_display_type']))
712
+							$extra_fields = $request_field['cat_display_type'];
713 713
 
714
-                        if (isset($request_field['multi_display_type']))
715
-                            $extra_fields = $request_field['multi_display_type'];
714
+						if (isset($request_field['multi_display_type']))
715
+							$extra_fields = $request_field['multi_display_type'];
716 716
 
717 717
 
718
-                        break;
718
+						break;
719 719
 
720
-                    case 'textarea':
721
-                    case 'html':
722
-                    case 'url':
723
-                    case 'file':
720
+					case 'textarea':
721
+					case 'html':
722
+					case 'url':
723
+					case 'file':
724 724
 
725
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
726
-                        if($alter_result===false){
727
-                            return __('Column change failed, you may have too many columns.','geodirectory');
728
-                        }
729
-                        if (isset($request_field['advanced_editor']))
730
-                            $extra_fields = $request_field['advanced_editor'];
731
-
732
-                        break;
725
+						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
726
+						if($alter_result===false){
727
+							return __('Column change failed, you may have too many columns.','geodirectory');
728
+						}
729
+						if (isset($request_field['advanced_editor']))
730
+							$extra_fields = $request_field['advanced_editor'];
731
+
732
+						break;
733 733
 
734
-                    case 'fieldset':
735
-                        // Nothing happened for fieldset
736
-                        break;
734
+					case 'fieldset':
735
+						// Nothing happened for fieldset
736
+						break;
737 737
 
738
-                    default:
739
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
740
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
741
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
742
-                            } else {
743
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
744
-                            }
745
-
746
-                            if (is_numeric($default_value) && $default_value != '') {
747
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
748
-                            }
749
-                        } else {
750
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
751
-                            if ($default_value != '') {
752
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
753
-                            }
754
-                        }
755
-
756
-                        $alter_result = $wpdb->query($default_value_add);
757
-                        if($alter_result===false){
758
-                            return __('Column change failed, you may have too many columns.','geodirectory');
759
-                        }
760
-                        break;
761
-                endswitch;
762
-
763
-                $extra_field_query = '';
764
-                if (!empty($extra_fields)) {
765
-                    $extra_field_query = serialize($extra_fields);
766
-                }
767
-
768
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
769
-
770
-                $wpdb->query(
771
-
772
-                    $wpdb->prepare(
773
-
774
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
738
+					default:
739
+						if ($data_type != 'VARCHAR' && $data_type != '') {
740
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
741
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
742
+							} else {
743
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
744
+							}
745
+
746
+							if (is_numeric($default_value) && $default_value != '') {
747
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
748
+							}
749
+						} else {
750
+							$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
751
+							if ($default_value != '') {
752
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
753
+							}
754
+						}
755
+
756
+						$alter_result = $wpdb->query($default_value_add);
757
+						if($alter_result===false){
758
+							return __('Column change failed, you may have too many columns.','geodirectory');
759
+						}
760
+						break;
761
+				endswitch;
762
+
763
+				$extra_field_query = '';
764
+				if (!empty($extra_fields)) {
765
+					$extra_field_query = serialize($extra_fields);
766
+				}
767
+
768
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
769
+
770
+				$wpdb->query(
771
+
772
+					$wpdb->prepare(
773
+
774
+						"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
775 775
 					post_type = %s,
776 776
 					admin_title = %s,
777 777
 					site_title = %s,
@@ -805,308 +805,308 @@  discard block
 block discarded – undo
805 805
 					for_admin_use = %s
806 806
 					where id = %d",
807 807
 
808
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
809
-                    )
808
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
809
+					)
810 810
 
811
-                );
811
+				);
812 812
 
813
-                $lastid = trim($cf);
813
+				$lastid = trim($cf);
814 814
 
815 815
 
816
-                $wpdb->query(
817
-                    $wpdb->prepare(
818
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
816
+				$wpdb->query(
817
+					$wpdb->prepare(
818
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
819 819
 					 	site_title=%s
820 820
 					where post_type = %s and htmlvar_name = %s",
821
-                        array($site_title, $post_type, $htmlvar_name)
822
-                    )
823
-                );
824
-
825
-
826
-                if ($cat_sort == '')
827
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
828
-
829
-
830
-                /**
831
-                 * Called after all custom fields are saved for a post.
832
-                 *
833
-                 * @since 1.0.0
834
-                 * @param int $lastid The post ID.
835
-                 */
836
-                do_action('geodir_after_custom_fields_updated', $lastid);
837
-
838
-            } else {
839
-
840
-                switch ($field_type):
841
-
842
-                    case 'address':
843
-
844
-                        $data_type = '';
845
-
846
-                        if ($htmlvar_name != '') {
847
-                            $prefix = $htmlvar_name . '_';
848
-                        }
849
-                        $old_prefix = $old_html_variable;
850
-
851
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
852
-
853
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
854
-                        if ($default_value != '') {
855
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
856
-                        }
857
-
858
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
859
-                        //$wpdb->query($meta_field_add);
860
-
861
-
862
-                        if (!empty($extra_fields)) {
821
+						array($site_title, $post_type, $htmlvar_name)
822
+					)
823
+				);
824
+
825
+
826
+				if ($cat_sort == '')
827
+					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
828
+
829
+
830
+				/**
831
+				 * Called after all custom fields are saved for a post.
832
+				 *
833
+				 * @since 1.0.0
834
+				 * @param int $lastid The post ID.
835
+				 */
836
+				do_action('geodir_after_custom_fields_updated', $lastid);
837
+
838
+			} else {
839
+
840
+				switch ($field_type):
841
+
842
+					case 'address':
843
+
844
+						$data_type = '';
845
+
846
+						if ($htmlvar_name != '') {
847
+							$prefix = $htmlvar_name . '_';
848
+						}
849
+						$old_prefix = $old_html_variable;
850
+
851
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
852
+
853
+						$meta_field_add = "VARCHAR( 254 ) NULL";
854
+						if ($default_value != '') {
855
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
856
+						}
857
+
858
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
859
+						//$wpdb->query($meta_field_add);
860
+
861
+
862
+						if (!empty($extra_fields)) {
863 863
 
864
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
865
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
866
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
867
-                                if ($default_value != '') {
868
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
869
-                                }
870
-
871
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
872
-                                //$wpdb->query($meta_field_add);
873
-                            }
874
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
875
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
876
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
877
-                                if ($default_value != '') {
878
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
879
-                                }
880
-
881
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
882
-                                //$wpdb->query($meta_field_add);
883
-                            }
884
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
885
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
886
-
887
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
888
-                                if ($default_value != '') {
889
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
890
-                                }
891
-
892
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
893
-                                //$wpdb->query($meta_field_add);
894
-                            }
895
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
896
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
897
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
898
-                                if ($default_value != '') {
899
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
900
-                                }
901
-
902
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
903
-                                //$wpdb->query($meta_field_add);
904
-                            }
905
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
906
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
907
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
908
-                                if ($default_value != '') {
909
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
910
-                                }
911
-
912
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
913
-                                //$wpdb->query($meta_field_add);
914
-
915
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
916
-
917
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
918
-                                if ($default_value != '') {
919
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
920
-                                }
921
-
922
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
923
-
924
-                                //$wpdb->query($meta_field_add);
925
-                            }
926
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
927
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
928
-
929
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
930
-                                if ($default_value != '') {
931
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
932
-                                }
933
-
934
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
935
-
936
-                                //$wpdb->query($meta_field_add);
937
-                            }
938
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
939
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
940
-
941
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
942
-                                if ($default_value != '') {
943
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
944
-                                }
945
-
946
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
947
-
948
-                                //$wpdb->query($meta_field_add);
949
-                            }
950
-                            // show lat lng
951
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
952
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
953
-
954
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
955
-                                $meta_field_add .= " DEFAULT '1'";
956
-
957
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
958
-                                //$wpdb->query($meta_field_add);
959
-                            }
960
-                        }
961
-
962
-                        break;
963
-
964
-                    case 'checkbox':
965
-                        $data_type = 'TINYINT';
966
-
967
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
968
-                        if ((int)$default_value === 1) {
969
-                            $meta_field_add .= " DEFAULT '1'";
970
-                        }
971
-
972
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
973
-                        if ($add_result === false) {
974
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
975
-                        }
976
-                        break;
977
-                    case 'multiselect':
978
-                    case 'select':
979
-                        $data_type = 'VARCHAR';
980
-                        $op_size = '500';
981
-
982
-                        // only make the field as big as it needs to be.
983
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
984
-                            $option_values_arr = explode(',', $option_values);
985
-
986
-                            if (is_array($option_values_arr)) {
987
-                                $op_max = 0;
988
-
989
-                                foreach ($option_values_arr as $op_val) {
990
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
991
-                                        $op_max = strlen($op_val);
992
-                                    }
993
-                                }
994
-
995
-                                if ($op_max) {
996
-                                    $op_size = $op_max;
997
-                                }
998
-                            }
999
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
1000
-                            if (strlen($option_values)) {
1001
-                                $op_size =  strlen($option_values);
1002
-                            }
1003
-
1004
-                            if (isset($request_field['multi_display_type'])) {
1005
-                                $extra_fields = $request_field['multi_display_type'];
1006
-                            }
1007
-                        }
1008
-
1009
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1010
-                        if ($default_value != '') {
1011
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1012
-                        }
1013
-
1014
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1015
-                        if ($add_result === false) {
1016
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1017
-                        }
1018
-                        break;
1019
-                    case 'textarea':
1020
-                    case 'html':
1021
-                    case 'url':
1022
-                    case 'file':
1023
-
1024
-                        $data_type = 'TEXT';
1025
-
1026
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1027
-
1028
-                        $meta_field_add = $data_type . " NULL ";
1029
-                        /*if($default_value != '')
864
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
865
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
866
+								$meta_field_add = "VARCHAR( 30 ) NULL";
867
+								if ($default_value != '') {
868
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
869
+								}
870
+
871
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
872
+								//$wpdb->query($meta_field_add);
873
+							}
874
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
875
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
876
+								$meta_field_add = "VARCHAR( 30 ) NULL";
877
+								if ($default_value != '') {
878
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
879
+								}
880
+
881
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
882
+								//$wpdb->query($meta_field_add);
883
+							}
884
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
885
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
886
+
887
+								$meta_field_add = "VARCHAR( 30 ) NULL";
888
+								if ($default_value != '') {
889
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
890
+								}
891
+
892
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
893
+								//$wpdb->query($meta_field_add);
894
+							}
895
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
896
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
897
+								$meta_field_add = "VARCHAR( 15 ) NULL";
898
+								if ($default_value != '') {
899
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
900
+								}
901
+
902
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
903
+								//$wpdb->query($meta_field_add);
904
+							}
905
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
906
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
907
+								$meta_field_add = "VARCHAR( 20 ) NULL";
908
+								if ($default_value != '') {
909
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
910
+								}
911
+
912
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
913
+								//$wpdb->query($meta_field_add);
914
+
915
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
916
+
917
+								$meta_field_add = "VARCHAR( 20 ) NULL";
918
+								if ($default_value != '') {
919
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
920
+								}
921
+
922
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
923
+
924
+								//$wpdb->query($meta_field_add);
925
+							}
926
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
927
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
928
+
929
+								$meta_field_add = "VARCHAR( 15 ) NULL";
930
+								if ($default_value != '') {
931
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
932
+								}
933
+
934
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
935
+
936
+								//$wpdb->query($meta_field_add);
937
+							}
938
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
939
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
940
+
941
+								$meta_field_add = "VARCHAR( 3 ) NULL";
942
+								if ($default_value != '') {
943
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
944
+								}
945
+
946
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
947
+
948
+								//$wpdb->query($meta_field_add);
949
+							}
950
+							// show lat lng
951
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
952
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
953
+
954
+								$meta_field_add = "VARCHAR( 3 ) NULL";
955
+								$meta_field_add .= " DEFAULT '1'";
956
+
957
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
958
+								//$wpdb->query($meta_field_add);
959
+							}
960
+						}
961
+
962
+						break;
963
+
964
+					case 'checkbox':
965
+						$data_type = 'TINYINT';
966
+
967
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
968
+						if ((int)$default_value === 1) {
969
+							$meta_field_add .= " DEFAULT '1'";
970
+						}
971
+
972
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
973
+						if ($add_result === false) {
974
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
975
+						}
976
+						break;
977
+					case 'multiselect':
978
+					case 'select':
979
+						$data_type = 'VARCHAR';
980
+						$op_size = '500';
981
+
982
+						// only make the field as big as it needs to be.
983
+						if (isset($option_values) && $option_values && $field_type == 'select') {
984
+							$option_values_arr = explode(',', $option_values);
985
+
986
+							if (is_array($option_values_arr)) {
987
+								$op_max = 0;
988
+
989
+								foreach ($option_values_arr as $op_val) {
990
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
991
+										$op_max = strlen($op_val);
992
+									}
993
+								}
994
+
995
+								if ($op_max) {
996
+									$op_size = $op_max;
997
+								}
998
+							}
999
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
1000
+							if (strlen($option_values)) {
1001
+								$op_size =  strlen($option_values);
1002
+							}
1003
+
1004
+							if (isset($request_field['multi_display_type'])) {
1005
+								$extra_fields = $request_field['multi_display_type'];
1006
+							}
1007
+						}
1008
+
1009
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1010
+						if ($default_value != '') {
1011
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1012
+						}
1013
+
1014
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1015
+						if ($add_result === false) {
1016
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1017
+						}
1018
+						break;
1019
+					case 'textarea':
1020
+					case 'html':
1021
+					case 'url':
1022
+					case 'file':
1023
+
1024
+						$data_type = 'TEXT';
1025
+
1026
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1027
+
1028
+						$meta_field_add = $data_type . " NULL ";
1029
+						/*if($default_value != '')
1030 1030
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1031 1031
 
1032
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1033
-                        if ($add_result === false) {
1034
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1035
-                        }
1032
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1033
+						if ($add_result === false) {
1034
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1035
+						}
1036 1036
 
1037
-                        break;
1037
+						break;
1038 1038
 
1039
-                    case 'datepicker':
1039
+					case 'datepicker':
1040 1040
 
1041
-                        $data_type = 'DATE';
1041
+						$data_type = 'DATE';
1042 1042
 
1043
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1043
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1044 1044
 
1045
-                        $meta_field_add = $data_type . " NULL ";
1045
+						$meta_field_add = $data_type . " NULL ";
1046 1046
 
1047
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1048
-                        if ($add_result === false) {
1049
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1050
-                        }
1047
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1048
+						if ($add_result === false) {
1049
+							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1050
+						}
1051 1051
 
1052
-                        break;
1052
+						break;
1053 1053
 
1054
-                    case 'time':
1054
+					case 'time':
1055 1055
 
1056
-                        $data_type = 'TIME';
1056
+						$data_type = 'TIME';
1057 1057
 
1058
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1058
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1059 1059
 
1060
-                        $meta_field_add = $data_type . " NULL ";
1060
+						$meta_field_add = $data_type . " NULL ";
1061 1061
 
1062
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1063
-                        if ($add_result === false) {
1064
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1065
-                        }
1062
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1063
+						if ($add_result === false) {
1064
+							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1065
+						}
1066 1066
 
1067
-                        break;
1067
+						break;
1068 1068
 
1069
-                    default:
1069
+					default:
1070 1070
 
1071
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1072
-                            $meta_field_add = $data_type . " NULL ";
1071
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1072
+							$meta_field_add = $data_type . " NULL ";
1073 1073
 
1074
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1075
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1076
-                            }
1074
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1075
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1076
+							}
1077 1077
 
1078
-                            if (is_numeric($default_value) && $default_value != '') {
1079
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1080
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1081
-                            }
1082
-                        } else {
1083
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1078
+							if (is_numeric($default_value) && $default_value != '') {
1079
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1080
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1081
+							}
1082
+						} else {
1083
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1084 1084
 
1085
-                            if ($default_value != '') {
1086
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1087
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1088
-                            }
1089
-                        }
1085
+							if ($default_value != '') {
1086
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1087
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1088
+							}
1089
+						}
1090 1090
 
1091
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1092
-                        if ($add_result === false) {
1093
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1094
-                        }
1095
-                        break;
1096
-                endswitch;
1091
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1092
+						if ($add_result === false) {
1093
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1094
+						}
1095
+						break;
1096
+				endswitch;
1097 1097
 
1098
-                $extra_field_query = '';
1099
-                if (!empty($extra_fields)) {
1100
-                    $extra_field_query = serialize($extra_fields);
1101
-                }
1098
+				$extra_field_query = '';
1099
+				if (!empty($extra_fields)) {
1100
+					$extra_field_query = serialize($extra_fields);
1101
+				}
1102 1102
 
1103
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1103
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1104 1104
 
1105
-                $wpdb->query(
1105
+				$wpdb->query(
1106 1106
 
1107
-                    $wpdb->prepare(
1107
+					$wpdb->prepare(
1108 1108
 
1109
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1109
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1110 1110
 					post_type = %s,
1111 1111
 					admin_title = %s,
1112 1112
 					site_title = %s,
@@ -1139,26 +1139,26 @@  discard block
 block discarded – undo
1139 1139
 					validation_msg = %s,
1140 1140
 					for_admin_use = %s ",
1141 1141
 
1142
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1142
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1143 1143
 
1144
-                    )
1144
+					)
1145 1145
 
1146
-                );
1146
+				);
1147 1147
 
1148
-                $lastid = $wpdb->insert_id;
1148
+				$lastid = $wpdb->insert_id;
1149 1149
 
1150
-                $lastid = trim($lastid);
1150
+				$lastid = trim($lastid);
1151 1151
 
1152
-            }
1152
+			}
1153 1153
 
1154
-            return (int)$lastid;
1154
+			return (int)$lastid;
1155 1155
 
1156 1156
 
1157
-        } else {
1158
-            return 'HTML Variable Name should be a unique name';
1159
-        }
1157
+		} else {
1158
+			return 'HTML Variable Name should be a unique name';
1159
+		}
1160 1160
 
1161
-    }
1161
+	}
1162 1162
 }
1163 1163
 
1164 1164
 /**
@@ -1173,54 +1173,54 @@  discard block
 block discarded – undo
1173 1173
 function godir_set_field_order($field_ids = array())
1174 1174
 {
1175 1175
 
1176
-    global $wpdb;
1176
+	global $wpdb;
1177 1177
 
1178
-    $count = 0;
1179
-    if (!empty($field_ids)):
1180
-        $post_meta_info = false;
1181
-        foreach ($field_ids as $id) {
1178
+	$count = 0;
1179
+	if (!empty($field_ids)):
1180
+		$post_meta_info = false;
1181
+		foreach ($field_ids as $id) {
1182 1182
 
1183
-            $cf = trim($id, '_');
1183
+			$cf = trim($id, '_');
1184 1184
 
1185
-            $post_meta_info = $wpdb->query(
1186
-                $wpdb->prepare(
1187
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1185
+			$post_meta_info = $wpdb->query(
1186
+				$wpdb->prepare(
1187
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1188 1188
 															sort_order=%d 
1189 1189
 															where id= %d",
1190
-                    array($count, $cf)
1191
-                )
1192
-            );
1193
-            $count++;
1194
-        }
1195
-
1196
-        return $post_meta_info;
1197
-    else:
1198
-        return false;
1199
-    endif;
1190
+					array($count, $cf)
1191
+				)
1192
+			);
1193
+			$count++;
1194
+		}
1195
+
1196
+		return $post_meta_info;
1197
+	else:
1198
+		return false;
1199
+	endif;
1200 1200
 }
1201 1201
 
1202 1202
 
1203 1203
 function geodir_get_cf_value($cf){
1204
-    global $gd_session;
1205
-    $value = '';
1206
-    if (is_admin()) {
1207
-        global $post,$gd_session;
1208
-
1209
-        if (isset($_REQUEST['post']))
1210
-            $_REQUEST['pid'] = $_REQUEST['post'];
1211
-    }
1212
-
1213
-    if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1214
-        $post = $gd_ses_listing;
1215
-        $value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1216
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1217
-        $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1218
-    } else {
1219
-        if ($value == '') {
1220
-            $value = $cf['default'];
1221
-        }
1222
-    }
1223
-    return $value;
1204
+	global $gd_session;
1205
+	$value = '';
1206
+	if (is_admin()) {
1207
+		global $post,$gd_session;
1208
+
1209
+		if (isset($_REQUEST['post']))
1210
+			$_REQUEST['pid'] = $_REQUEST['post'];
1211
+	}
1212
+
1213
+	if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1214
+		$post = $gd_ses_listing;
1215
+		$value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1216
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1217
+		$value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1218
+	} else {
1219
+		if ($value == '') {
1220
+			$value = $cf['default'];
1221
+		}
1222
+	}
1223
+	return $value;
1224 1224
 }
1225 1225
 
1226 1226
 /**
@@ -1239,422 +1239,422 @@  discard block
 block discarded – undo
1239 1239
  * @param string $post_type Optional. The wordpress post type.
1240 1240
  */
1241 1241
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1242
-    global $is_default, $mapzoom, $gd_session;
1242
+	global $is_default, $mapzoom, $gd_session;
1243 1243
 
1244
-    $listing_type = $post_type;
1244
+	$listing_type = $post_type;
1245 1245
 
1246
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1246
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1247 1247
 
1248
-    foreach ($custom_fields as $key => $val) {
1249
-        if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
1250
-        $val = stripslashes_deep($val); // strip slashes from labels
1251
-        if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
1248
+	foreach ($custom_fields as $key => $val) {
1249
+		if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
1250
+		$val = stripslashes_deep($val); // strip slashes from labels
1251
+		if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
1252 1252
 
1253
-        $name = $val['name'];
1254
-        $type = $val['type'];
1255
-        $is_default = $val['is_default'];
1253
+		$name = $val['name'];
1254
+		$type = $val['type'];
1255
+		$is_default = $val['is_default'];
1256 1256
 
1257
-        /* field available to site admin only for edit */
1258
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1259
-        if ($for_admin_use && !is_super_admin()) {
1260
-            continue;
1261
-        }
1257
+		/* field available to site admin only for edit */
1258
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1259
+		if ($for_admin_use && !is_super_admin()) {
1260
+			continue;
1261
+		}
1262 1262
 
1263
-        if (is_admin()) {
1264
-            global $post;
1263
+		if (is_admin()) {
1264
+			global $post;
1265 1265
 
1266
-            if (isset($_REQUEST['post']))
1267
-                $_REQUEST['pid'] = $_REQUEST['post'];
1268
-        }
1266
+			if (isset($_REQUEST['post']))
1267
+				$_REQUEST['pid'] = $_REQUEST['post'];
1268
+		}
1269 1269
 
1270 1270
         
1271 1271
 
1272
-        /**
1273
-         * Called before the custom fields info is output for submitting a post.
1274
-         *
1275
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1276
-         *
1277
-         * @since 1.0.0
1278
-         * @param string $listing_type The post post type.
1279
-         * @param int $package_id The price package ID for the post.
1280
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1281
-         * @see 'geodir_after_custom_form_field_$name'
1282
-         */
1283
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1284
-
1285
-
1286
-        $custom_field = $val;
1287
-        $html ='';
1288
-        /**
1289
-         * Filter the output for custom fields.
1290
-         *
1291
-         * Here we can remove or add new functions depending on the field type.
1292
-         *
1293
-         * @param string $html The html to be filtered (blank).
1294
-         * @param array $custom_field The custom field array values.
1295
-         */
1296
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1297
-
1298
-
1299
-
1300
-        /**
1301
-         * Called after the custom fields info is output for submitting a post.
1302
-         *
1303
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
1304
-         *
1305
-         * @since 1.0.0
1306
-         * @param string $listing_type The post post type.
1307
-         * @param int $package_id The price package ID for the post.
1308
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1309
-         * @see 'geodir_before_custom_form_field_$name'
1310
-         */
1311
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1312
-
1313
-    }
1272
+		/**
1273
+		 * Called before the custom fields info is output for submitting a post.
1274
+		 *
1275
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1276
+		 *
1277
+		 * @since 1.0.0
1278
+		 * @param string $listing_type The post post type.
1279
+		 * @param int $package_id The price package ID for the post.
1280
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1281
+		 * @see 'geodir_after_custom_form_field_$name'
1282
+		 */
1283
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1284
+
1285
+
1286
+		$custom_field = $val;
1287
+		$html ='';
1288
+		/**
1289
+		 * Filter the output for custom fields.
1290
+		 *
1291
+		 * Here we can remove or add new functions depending on the field type.
1292
+		 *
1293
+		 * @param string $html The html to be filtered (blank).
1294
+		 * @param array $custom_field The custom field array values.
1295
+		 */
1296
+		echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1297
+
1298
+
1299
+
1300
+		/**
1301
+		 * Called after the custom fields info is output for submitting a post.
1302
+		 *
1303
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
1304
+		 *
1305
+		 * @since 1.0.0
1306
+		 * @param string $listing_type The post post type.
1307
+		 * @param int $package_id The price package ID for the post.
1308
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1309
+		 * @see 'geodir_before_custom_form_field_$name'
1310
+		 */
1311
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1312
+
1313
+	}
1314 1314
 
1315 1315
 }
1316 1316
 
1317 1317
 
1318 1318
 if (!function_exists('geodir_get_field_infoby')) {
1319
-    /**
1320
-     * Get custom field using key and value.
1321
-     *
1322
-     * @since 1.0.0
1323
-     * @package GeoDirectory
1324
-     * @global object $wpdb WordPress Database object.
1325
-     * @param string $key The key you want to look for.
1326
-     * @param string $value The value of the key you want to look for.
1327
-     * @param string $geodir_post_type The post type.
1328
-     * @return bool|mixed Returns field info when available. otherwise returns false.
1329
-     */
1330
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1331
-    {
1332
-
1333
-        global $wpdb;
1334
-
1335
-        $filter = $wpdb->get_row(
1336
-            $wpdb->prepare(
1337
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1338
-                array($geodir_post_type)
1339
-            )
1340
-        );
1341
-
1342
-        if ($filter) {
1343
-            return $filter;
1344
-        } else {
1345
-            return false;
1346
-        }
1347
-
1348
-    }
1319
+	/**
1320
+	 * Get custom field using key and value.
1321
+	 *
1322
+	 * @since 1.0.0
1323
+	 * @package GeoDirectory
1324
+	 * @global object $wpdb WordPress Database object.
1325
+	 * @param string $key The key you want to look for.
1326
+	 * @param string $value The value of the key you want to look for.
1327
+	 * @param string $geodir_post_type The post type.
1328
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
1329
+	 */
1330
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1331
+	{
1332
+
1333
+		global $wpdb;
1334
+
1335
+		$filter = $wpdb->get_row(
1336
+			$wpdb->prepare(
1337
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1338
+				array($geodir_post_type)
1339
+			)
1340
+		);
1341
+
1342
+		if ($filter) {
1343
+			return $filter;
1344
+		} else {
1345
+			return false;
1346
+		}
1347
+
1348
+	}
1349 1349
 }
1350 1350
 
1351 1351
 
1352 1352
 function geodir_field_icon_proccess($cf){
1353 1353
 
1354 1354
 
1355
-    if (strpos($cf['field_icon'], 'http') !== false) {
1356
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1357
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1358
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1359
-    }else{
1360
-        $field_icon = $cf['field_icon'];
1361
-    }
1355
+	if (strpos($cf['field_icon'], 'http') !== false) {
1356
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1357
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1358
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1359
+	}else{
1360
+		$field_icon = $cf['field_icon'];
1361
+	}
1362 1362
 
1363
-    return $field_icon;
1363
+	return $field_icon;
1364 1364
 }
1365 1365
 
1366 1366
 if (!function_exists('geodir_show_listing_info')) {
1367
-    /**
1368
-     * Show listing info depending on field location.
1369
-     *
1370
-     * @since 1.0.0
1371
-     * @since 1.5.7 Custom fields option values added to db translation.
1372
-     *              Changes to display url fields title.
1373
-     * @package GeoDirectory
1374
-     * @global object $wpdb WordPress Database object.
1375
-     * @global object $post The current post object.
1376
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1377
-     *
1378
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1379
-     * @return string Returns listing info html.
1380
-     */
1381
-    function geodir_show_listing_info($fields_location = '') {
1382
-        global $post, $preview, $wpdb, $send_to_friend;
1383
-
1384
-        $package_info = array();
1385
-
1386
-        $package_info = geodir_post_package_info($package_info, $post);
1387
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1388
-        $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1389
-        $send_to_friend = false;
1390
-
1391
-        ob_start();
1392
-        $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1393
-
1394
-        if (!empty($fields_info)) {
1395
-            $post = stripslashes_deep($post); // strip slashes
1367
+	/**
1368
+	 * Show listing info depending on field location.
1369
+	 *
1370
+	 * @since 1.0.0
1371
+	 * @since 1.5.7 Custom fields option values added to db translation.
1372
+	 *              Changes to display url fields title.
1373
+	 * @package GeoDirectory
1374
+	 * @global object $wpdb WordPress Database object.
1375
+	 * @global object $post The current post object.
1376
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1377
+	 *
1378
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1379
+	 * @return string Returns listing info html.
1380
+	 */
1381
+	function geodir_show_listing_info($fields_location = '') {
1382
+		global $post, $preview, $wpdb, $send_to_friend;
1383
+
1384
+		$package_info = array();
1385
+
1386
+		$package_info = geodir_post_package_info($package_info, $post);
1387
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1388
+		$p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1389
+		$send_to_friend = false;
1390
+
1391
+		ob_start();
1392
+		$fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1393
+
1394
+		if (!empty($fields_info)) {
1395
+			$post = stripslashes_deep($post); // strip slashes
1396 1396
             
1397
-            //echo '<div class="geodir-company_info field-group">';
1398
-            global $field_set_start;
1399
-            $field_set_start = 0;
1400
-
1401
-
1402
-
1403
-            foreach ($fields_info as $type) {
1404
-                if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
1405
-                $type = stripslashes_deep($type); // strip slashes
1406
-                if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
1407
-                $html = '';
1408
-                $field_icon = geodir_field_icon_proccess($type);
1409
-                $filed_type = $type['type'];
1410
-                $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1411
-                if($html_var=='post'){$html_var='post_address';}
1412
-
1413
-                /**
1414
-                 * Filter the output for custom fields.
1415
-                 *
1416
-                 * Here we can remove or add new functions depending on the field type.
1417
-                 *
1418
-                 * @param string $html The html to be filtered (blank).
1419
-                 * @param string $fields_location The location the field is to be show.
1420
-                 * @param array $type The array of field values.
1421
-                 */
1422
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1423
-
1424
-                $variables_array = array();
1425
-
1426
-
1427
-                if ($type['type'] != 'fieldset'):
1428
-                    $variables_array['post_id'] = $post->ID;
1429
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
1430
-                    $variables_array['value'] = '';
1431
-                    if (isset($post->{$type['htmlvar_name']}))
1432
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1433
-                endif;
1434
-
1435
-
1436
-                if ($html):
1437
-
1438
-                    /**
1439
-                     * Called before a custom fields is output on the frontend.
1440
-                     *
1441
-                     * @since 1.0.0
1442
-                     * @param string $html_var The HTML variable name for the field.
1443
-                     */
1444
-                    do_action("geodir_before_show_{$html_var}");
1445
-                    /**
1446
-                     * Filter custom field output.
1447
-                     *
1448
-                     * @since 1.0.0
1449
-                     *
1450
-                     * @param string $html_var The HTML variable name for the field.
1451
-                     * @param string $html Custom field unfiltered HTML.
1452
-                     * @param array $variables_array Custom field variables array.
1453
-                     */
1454
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1455
-
1456
-                    /**
1457
-                     * Called after a custom fields is output on the frontend.
1458
-                     *
1459
-                     * @since 1.0.0
1460
-                     * @param string $html_var The HTML variable name for the field.
1461
-                     */
1462
-                    do_action("geodir_after_show_{$html_var}");
1463
-
1464
-                endif;
1465
-
1466
-            }
1467
-
1468
-            //echo '</div>';
1469
-
1470
-        }
1471
-
1472
-
1473
-        $html = ob_get_clean();
1474
-
1475
-        /**
1476
-         * Filter the custom fields over all output.
1477
-         *
1478
-         * @param string $html The html of the custom fields.
1479
-         * @param string $fields_location The location the fields are being output.
1480
-         * @since 1.6.9
1481
-         */
1482
-        return apply_filters('geodir_show_listing_info',$html,$fields_location);
1483
-
1484
-    }
1397
+			//echo '<div class="geodir-company_info field-group">';
1398
+			global $field_set_start;
1399
+			$field_set_start = 0;
1400
+
1401
+
1402
+
1403
+			foreach ($fields_info as $type) {
1404
+				if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
1405
+				$type = stripslashes_deep($type); // strip slashes
1406
+				if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
1407
+				$html = '';
1408
+				$field_icon = geodir_field_icon_proccess($type);
1409
+				$filed_type = $type['type'];
1410
+				$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1411
+				if($html_var=='post'){$html_var='post_address';}
1412
+
1413
+				/**
1414
+				 * Filter the output for custom fields.
1415
+				 *
1416
+				 * Here we can remove or add new functions depending on the field type.
1417
+				 *
1418
+				 * @param string $html The html to be filtered (blank).
1419
+				 * @param string $fields_location The location the field is to be show.
1420
+				 * @param array $type The array of field values.
1421
+				 */
1422
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1423
+
1424
+				$variables_array = array();
1425
+
1426
+
1427
+				if ($type['type'] != 'fieldset'):
1428
+					$variables_array['post_id'] = $post->ID;
1429
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
1430
+					$variables_array['value'] = '';
1431
+					if (isset($post->{$type['htmlvar_name']}))
1432
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
1433
+				endif;
1434
+
1435
+
1436
+				if ($html):
1437
+
1438
+					/**
1439
+					 * Called before a custom fields is output on the frontend.
1440
+					 *
1441
+					 * @since 1.0.0
1442
+					 * @param string $html_var The HTML variable name for the field.
1443
+					 */
1444
+					do_action("geodir_before_show_{$html_var}");
1445
+					/**
1446
+					 * Filter custom field output.
1447
+					 *
1448
+					 * @since 1.0.0
1449
+					 *
1450
+					 * @param string $html_var The HTML variable name for the field.
1451
+					 * @param string $html Custom field unfiltered HTML.
1452
+					 * @param array $variables_array Custom field variables array.
1453
+					 */
1454
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1455
+
1456
+					/**
1457
+					 * Called after a custom fields is output on the frontend.
1458
+					 *
1459
+					 * @since 1.0.0
1460
+					 * @param string $html_var The HTML variable name for the field.
1461
+					 */
1462
+					do_action("geodir_after_show_{$html_var}");
1463
+
1464
+				endif;
1465
+
1466
+			}
1467
+
1468
+			//echo '</div>';
1469
+
1470
+		}
1471
+
1472
+
1473
+		$html = ob_get_clean();
1474
+
1475
+		/**
1476
+		 * Filter the custom fields over all output.
1477
+		 *
1478
+		 * @param string $html The html of the custom fields.
1479
+		 * @param string $fields_location The location the fields are being output.
1480
+		 * @since 1.6.9
1481
+		 */
1482
+		return apply_filters('geodir_show_listing_info',$html,$fields_location);
1483
+
1484
+	}
1485 1485
 }
1486 1486
 
1487 1487
 if (!function_exists('geodir_default_date_format')) {
1488
-    /**
1489
-     * Returns default date format.
1490
-     *
1491
-     * @since 1.0.0
1492
-     * @package GeoDirectory
1493
-     * @return mixed|string|void Returns default date format.
1494
-     */
1495
-    function geodir_default_date_format()
1496
-    {
1497
-        if ($format = get_option('date_format'))
1498
-            return $format;
1499
-        else
1500
-            return 'dd-mm-yy';
1501
-    }
1488
+	/**
1489
+	 * Returns default date format.
1490
+	 *
1491
+	 * @since 1.0.0
1492
+	 * @package GeoDirectory
1493
+	 * @return mixed|string|void Returns default date format.
1494
+	 */
1495
+	function geodir_default_date_format()
1496
+	{
1497
+		if ($format = get_option('date_format'))
1498
+			return $format;
1499
+		else
1500
+			return 'dd-mm-yy';
1501
+	}
1502 1502
 }
1503 1503
 
1504 1504
 if (!function_exists('geodir_get_formated_date')) {
1505
-    /**
1506
-     * Returns formatted date.
1507
-     *
1508
-     * @since 1.0.0
1509
-     * @package GeoDirectory
1510
-     * @param string $date Date string to convert.
1511
-     * @return bool|int|string Returns formatted date.
1512
-     */
1513
-    function geodir_get_formated_date($date)
1514
-    {
1515
-        return mysql2date(get_option('date_format'), $date);
1516
-    }
1505
+	/**
1506
+	 * Returns formatted date.
1507
+	 *
1508
+	 * @since 1.0.0
1509
+	 * @package GeoDirectory
1510
+	 * @param string $date Date string to convert.
1511
+	 * @return bool|int|string Returns formatted date.
1512
+	 */
1513
+	function geodir_get_formated_date($date)
1514
+	{
1515
+		return mysql2date(get_option('date_format'), $date);
1516
+	}
1517 1517
 }
1518 1518
 
1519 1519
 if (!function_exists('geodir_get_formated_time')) {
1520
-    /**
1521
-     * Returns formatted time.
1522
-     *
1523
-     * @since 1.0.0
1524
-     * @package GeoDirectory
1525
-     * @param string $time Time string to convert.
1526
-     * @return bool|int|string Returns formatted time.
1527
-     */
1528
-    function geodir_get_formated_time($time)
1529
-    {
1530
-        return mysql2date(get_option('time_format'), $time, $translate = true);
1531
-    }
1520
+	/**
1521
+	 * Returns formatted time.
1522
+	 *
1523
+	 * @since 1.0.0
1524
+	 * @package GeoDirectory
1525
+	 * @param string $time Time string to convert.
1526
+	 * @return bool|int|string Returns formatted time.
1527
+	 */
1528
+	function geodir_get_formated_time($time)
1529
+	{
1530
+		return mysql2date(get_option('time_format'), $time, $translate = true);
1531
+	}
1532 1532
 }
1533 1533
 
1534 1534
 
1535 1535
 if (!function_exists('geodir_save_post_file_fields')) {
1536
-    /**
1537
-     * Save post file fields
1538
-     *
1539
-     * @since 1.0.0
1540
-     * @since 1.4.7 Added `$extra_fields` parameter.
1541
-     * @package GeoDirectory
1542
-     * @global object $wpdb WordPress Database object.
1543
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1544
-     * @global object $current_user Current user object.
1545
-     * @param int $post_id
1546
-     * @param string $field_id
1547
-     * @param array $post_image
1548
-     * @param array $extra_fields Array of extra fields.
1549
-     */
1550
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1551
-    {
1536
+	/**
1537
+	 * Save post file fields
1538
+	 *
1539
+	 * @since 1.0.0
1540
+	 * @since 1.4.7 Added `$extra_fields` parameter.
1541
+	 * @package GeoDirectory
1542
+	 * @global object $wpdb WordPress Database object.
1543
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1544
+	 * @global object $current_user Current user object.
1545
+	 * @param int $post_id
1546
+	 * @param string $field_id
1547
+	 * @param array $post_image
1548
+	 * @param array $extra_fields Array of extra fields.
1549
+	 */
1550
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1551
+	{
1552 1552
 
1553
-        global $wpdb, $plugin_prefix, $current_user;
1553
+		global $wpdb, $plugin_prefix, $current_user;
1554 1554
 
1555
-        $post_type = get_post_type($post_id);
1556
-        //echo $field_id; exit;
1557
-        $table = $plugin_prefix . $post_type . '_detail';
1555
+		$post_type = get_post_type($post_id);
1556
+		//echo $field_id; exit;
1557
+		$table = $plugin_prefix . $post_type . '_detail';
1558 1558
 
1559
-        $postcurr_images = array();
1560
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1561
-        $file_urls = '';
1559
+		$postcurr_images = array();
1560
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1561
+		$file_urls = '';
1562 1562
 
1563
-        if (!empty($post_image)) {
1563
+		if (!empty($post_image)) {
1564 1564
 
1565
-            $invalid_files = array();
1565
+			$invalid_files = array();
1566 1566
 
1567
-            //Get and remove all old images of post from database to set by new order
1568
-            $geodir_uploaddir = '';
1569
-            $uploads = wp_upload_dir();
1570
-            $uploads_dir = $uploads['path'];
1567
+			//Get and remove all old images of post from database to set by new order
1568
+			$geodir_uploaddir = '';
1569
+			$uploads = wp_upload_dir();
1570
+			$uploads_dir = $uploads['path'];
1571 1571
 
1572
-            $geodir_uploadpath = $uploads['path'];
1573
-            $geodir_uploadurl = $uploads['url'];
1574
-            $sub_dir = $uploads['subdir'];
1572
+			$geodir_uploadpath = $uploads['path'];
1573
+			$geodir_uploadurl = $uploads['url'];
1574
+			$sub_dir = $uploads['subdir'];
1575 1575
 
1576
-            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1576
+			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1577 1577
 
1578
-            for ($m = 0; $m < count($post_image); $m++) {
1578
+			for ($m = 0; $m < count($post_image); $m++) {
1579 1579
 
1580
-                /* --------- start ------- */
1580
+				/* --------- start ------- */
1581 1581
 
1582
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1582
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1583 1583
 
1584 1584
 
1585
-                    $curr_img_url = $post_image[$m];
1586
-                    $image_name_arr = explode('/', $curr_img_url);
1587
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1588
-                    $filename = end($image_name_arr);
1589
-                    $img_name_arr = explode('.', $filename);
1585
+					$curr_img_url = $post_image[$m];
1586
+					$image_name_arr = explode('/', $curr_img_url);
1587
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1588
+					$filename = end($image_name_arr);
1589
+					$img_name_arr = explode('.', $filename);
1590 1590
 
1591
-                    $arr_file_type = wp_check_filetype($filename);
1591
+					$arr_file_type = wp_check_filetype($filename);
1592 1592
 
1593
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1594
-                        continue;
1595
-                    }
1593
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1594
+						continue;
1595
+					}
1596 1596
 
1597
-                    $uploaded_file_type = $arr_file_type['type'];
1598
-                    $uploaded_file_ext = $arr_file_type['ext'];
1597
+					$uploaded_file_type = $arr_file_type['type'];
1598
+					$uploaded_file_ext = $arr_file_type['ext'];
1599 1599
 
1600
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1601
-                        continue; // Invalid file type.
1602
-                    }
1600
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1601
+						continue; // Invalid file type.
1602
+					}
1603 1603
 
1604
-                    // Set an array containing a list of acceptable formats
1605
-                    //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1604
+					// Set an array containing a list of acceptable formats
1605
+					//$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1606 1606
 
1607
-                    if (!function_exists('wp_handle_upload'))
1608
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1607
+					if (!function_exists('wp_handle_upload'))
1608
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
1609 1609
 
1610
-                    if (!is_dir($geodir_uploadpath))
1611
-                        mkdir($geodir_uploadpath);
1610
+					if (!is_dir($geodir_uploadpath))
1611
+						mkdir($geodir_uploadpath);
1612 1612
 
1613
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1614
-                    $explode_sub_dir = explode("/", $sub_dir);
1615
-                    if ($curr_img_dir == end($explode_sub_dir)) {
1616
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1617
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1618
-                    } else {
1619
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1620
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1621
-                    }
1613
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1614
+					$explode_sub_dir = explode("/", $sub_dir);
1615
+					if ($curr_img_dir == end($explode_sub_dir)) {
1616
+						$img_path = $geodir_uploadpath . '/' . $filename;
1617
+						$img_url = $geodir_uploadurl . '/' . $filename;
1618
+					} else {
1619
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1620
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1621
+					}
1622 1622
 
1623
-                    $uploaded_file = '';
1624
-                    if (file_exists($img_path))
1625
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1623
+					$uploaded_file = '';
1624
+					if (file_exists($img_path))
1625
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1626 1626
 
1627
-                    if ($curr_img_dir != $geodir_uploaddir) {
1628
-                        if (file_exists($img_path))
1629
-                            unlink($img_path);
1630
-                    }
1627
+					if ($curr_img_dir != $geodir_uploaddir) {
1628
+						if (file_exists($img_path))
1629
+							unlink($img_path);
1630
+					}
1631 1631
 
1632
-                    if (!empty($uploaded_file))
1633
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1632
+					if (!empty($uploaded_file))
1633
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
1634 1634
 
1635
-                } else {
1636
-                    $file_urls = $post_image[$m];
1637
-                }
1638
-            }
1635
+				} else {
1636
+					$file_urls = $post_image[$m];
1637
+				}
1638
+			}
1639 1639
 
1640 1640
 
1641
-        }
1641
+		}
1642 1642
 
1643
-        //Remove all old attachments and temp images
1644
-        if (!empty($postcurr_images)) {
1643
+		//Remove all old attachments and temp images
1644
+		if (!empty($postcurr_images)) {
1645 1645
 
1646
-            if ($file_urls != $postcurr_images) {
1647
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1648
-                $invalid_files = (object)$invalid_files;
1649
-            }
1650
-        }
1646
+			if ($file_urls != $postcurr_images) {
1647
+				$invalid_files[] = (object)array('src' => $postcurr_images);
1648
+				$invalid_files = (object)$invalid_files;
1649
+			}
1650
+		}
1651 1651
 
1652
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
1652
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
1653 1653
 
1654
-        if (!empty($invalid_files))
1655
-            geodir_remove_attachments($invalid_files);
1654
+		if (!empty($invalid_files))
1655
+			geodir_remove_attachments($invalid_files);
1656 1656
 
1657
-    }
1657
+	}
1658 1658
 }
1659 1659
 
1660 1660
 
@@ -1669,76 +1669,76 @@  discard block
 block discarded – undo
1669 1669
  */
1670 1670
 function geodir_custom_upload_mimes($existing_mimes = array())
1671 1671
 {
1672
-    $existing_mimes['wif'] = 'text/plain';
1673
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
1674
-    $existing_mimes['gif'] = 'image/gif';
1675
-    $existing_mimes['png'] = 'image/png';
1676
-    $existing_mimes['pdf'] = 'application/pdf';
1677
-    $existing_mimes['txt'] = 'text/text';
1678
-    $existing_mimes['csv'] = 'application/octet-stream';
1679
-    $existing_mimes['doc'] = 'application/msword';
1680
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1681
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1682
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1683
-    return $existing_mimes;
1672
+	$existing_mimes['wif'] = 'text/plain';
1673
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
1674
+	$existing_mimes['gif'] = 'image/gif';
1675
+	$existing_mimes['png'] = 'image/png';
1676
+	$existing_mimes['pdf'] = 'application/pdf';
1677
+	$existing_mimes['txt'] = 'text/text';
1678
+	$existing_mimes['csv'] = 'application/octet-stream';
1679
+	$existing_mimes['doc'] = 'application/msword';
1680
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1681
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1682
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1683
+	return $existing_mimes;
1684 1684
 }
1685 1685
 
1686 1686
 if (!function_exists('geodir_plupload_action')) {
1687 1687
 
1688
-    /**
1689
-     * Get upload directory path details
1690
-     *
1691
-     * @since 1.0.0
1692
-     * @package GeoDirectory
1693
-     * @global object $current_user Current user object.
1694
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1695
-     * @return mixed Returns upload directory details as an array.
1696
-     */
1697
-    function geodir_upload_dir($upload)
1698
-    {
1699
-        global $current_user;
1700
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1701
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1702
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1703
-        return $upload;
1704
-    }
1705
-
1706
-    /**
1707
-     * Handles place file and image upload.
1708
-     *
1709
-     * @since 1.0.0
1710
-     * @package GeoDirectory
1711
-     */
1712
-    function geodir_plupload_action()
1713
-    {
1714
-        // check ajax nonce
1715
-        $imgid = $_POST["imgid"];
1716
-
1717
-        check_ajax_referer($imgid . 'pluploadan');
1718
-
1719
-        // handle custom file uploaddir
1720
-        add_filter('upload_dir', 'geodir_upload_dir');
1721
-
1722
-        // change file orientation if needed
1723
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1724
-
1725
-        // handle file upload
1726
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1727
-        // remove handle custom file uploaddir
1728
-        remove_filter('upload_dir', 'geodir_upload_dir');
1729
-
1730
-        if(!isset($status['url']) && isset($status['error'])){
1731
-            print_r($status);
1732
-        }
1733
-
1734
-        // send the uploaded file url in response
1735
-        if (isset($status['url'])) {
1736
-            echo $status['url'];
1737
-        } else {
1738
-            echo 'x';
1739
-        }
1740
-        exit;
1741
-    }
1688
+	/**
1689
+	 * Get upload directory path details
1690
+	 *
1691
+	 * @since 1.0.0
1692
+	 * @package GeoDirectory
1693
+	 * @global object $current_user Current user object.
1694
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1695
+	 * @return mixed Returns upload directory details as an array.
1696
+	 */
1697
+	function geodir_upload_dir($upload)
1698
+	{
1699
+		global $current_user;
1700
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1701
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
1702
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
1703
+		return $upload;
1704
+	}
1705
+
1706
+	/**
1707
+	 * Handles place file and image upload.
1708
+	 *
1709
+	 * @since 1.0.0
1710
+	 * @package GeoDirectory
1711
+	 */
1712
+	function geodir_plupload_action()
1713
+	{
1714
+		// check ajax nonce
1715
+		$imgid = $_POST["imgid"];
1716
+
1717
+		check_ajax_referer($imgid . 'pluploadan');
1718
+
1719
+		// handle custom file uploaddir
1720
+		add_filter('upload_dir', 'geodir_upload_dir');
1721
+
1722
+		// change file orientation if needed
1723
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1724
+
1725
+		// handle file upload
1726
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1727
+		// remove handle custom file uploaddir
1728
+		remove_filter('upload_dir', 'geodir_upload_dir');
1729
+
1730
+		if(!isset($status['url']) && isset($status['error'])){
1731
+			print_r($status);
1732
+		}
1733
+
1734
+		// send the uploaded file url in response
1735
+		if (isset($status['url'])) {
1736
+			echo $status['url'];
1737
+		} else {
1738
+			echo 'x';
1739
+		}
1740
+		exit;
1741
+	}
1742 1742
 }
1743 1743
 
1744 1744
 /**
@@ -1753,17 +1753,17 @@  discard block
 block discarded – undo
1753 1753
  */
1754 1754
 function geodir_get_video($post_id)
1755 1755
 {
1756
-    global $wpdb, $plugin_prefix;
1756
+	global $wpdb, $plugin_prefix;
1757 1757
 
1758
-    $post_type = get_post_type($post_id);
1758
+	$post_type = get_post_type($post_id);
1759 1759
 
1760
-    $table = $plugin_prefix . $post_type . '_detail';
1760
+	$table = $plugin_prefix . $post_type . '_detail';
1761 1761
 
1762
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1762
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1763 1763
 
1764
-    if ($results) {
1765
-        return $results[0]->geodir_video;
1766
-    }
1764
+	if ($results) {
1765
+		return $results[0]->geodir_video;
1766
+	}
1767 1767
 
1768 1768
 }
1769 1769
 
@@ -1779,40 +1779,40 @@  discard block
 block discarded – undo
1779 1779
  */
1780 1780
 function geodir_get_special_offers($post_id)
1781 1781
 {
1782
-    global $wpdb, $plugin_prefix;
1782
+	global $wpdb, $plugin_prefix;
1783 1783
 
1784
-    $post_type = get_post_type($post_id);
1784
+	$post_type = get_post_type($post_id);
1785 1785
 
1786
-    $table = $plugin_prefix . $post_type . '_detail';
1786
+	$table = $plugin_prefix . $post_type . '_detail';
1787 1787
 
1788
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1788
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1789 1789
 
1790
-    if ($results) {
1791
-        return $results[0]->geodir_special_offers;
1792
-    }
1790
+	if ($results) {
1791
+		return $results[0]->geodir_special_offers;
1792
+	}
1793 1793
 
1794 1794
 }
1795 1795
 
1796 1796
 if (!function_exists('geodir_max_upload_size')) {
1797
-    /**
1798
-     * Get max upload file size
1799
-     *
1800
-     * @since 1.0.0
1801
-     * @package GeoDirectory
1802
-     * @return mixed|void Returns max upload file size.
1803
-     */
1804
-    function geodir_max_upload_size()
1805
-    {
1806
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1807
-
1808
-        if ($max_filesize > 0 && $max_filesize < 1) {
1809
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1810
-        } else {
1811
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1812
-        }
1813
-        /** Filter documented in geodirectory-functions/general_functions.php **/
1814
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1815
-    }
1797
+	/**
1798
+	 * Get max upload file size
1799
+	 *
1800
+	 * @since 1.0.0
1801
+	 * @package GeoDirectory
1802
+	 * @return mixed|void Returns max upload file size.
1803
+	 */
1804
+	function geodir_max_upload_size()
1805
+	{
1806
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1807
+
1808
+		if ($max_filesize > 0 && $max_filesize < 1) {
1809
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
1810
+		} else {
1811
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1812
+		}
1813
+		/** Filter documented in geodirectory-functions/general_functions.php **/
1814
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1815
+	}
1816 1816
 }
1817 1817
 
1818 1818
 
@@ -1830,33 +1830,33 @@  discard block
 block discarded – undo
1830 1830
  */
1831 1831
 function geodir_add_custom_sort_options($fields, $post_type)
1832 1832
 {
1833
-    global $wpdb;
1833
+	global $wpdb;
1834 1834
 
1835
-    if ($post_type != '') {
1835
+	if ($post_type != '') {
1836 1836
 
1837
-        $all_postypes = geodir_get_posttypes();
1837
+		$all_postypes = geodir_get_posttypes();
1838 1838
 
1839
-        if (in_array($post_type, $all_postypes)) {
1839
+		if (in_array($post_type, $all_postypes)) {
1840 1840
 
1841
-            $custom_fields = $wpdb->get_results(
1842
-                $wpdb->prepare(
1843
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1844
-                    array($post_type)
1845
-                ), 'ARRAY_A'
1846
-            );
1841
+			$custom_fields = $wpdb->get_results(
1842
+				$wpdb->prepare(
1843
+					"select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1844
+					array($post_type)
1845
+				), 'ARRAY_A'
1846
+			);
1847 1847
 
1848
-            if (!empty($custom_fields)) {
1848
+			if (!empty($custom_fields)) {
1849 1849
 
1850
-                foreach ($custom_fields as $val) {
1851
-                    $fields[] = $val;
1852
-                }
1853
-            }
1850
+				foreach ($custom_fields as $val) {
1851
+					$fields[] = $val;
1852
+				}
1853
+			}
1854 1854
 
1855
-        }
1855
+		}
1856 1856
 
1857
-    }
1857
+	}
1858 1858
 
1859
-    return $fields;
1859
+	return $fields;
1860 1860
 }
1861 1861
 
1862 1862
 
@@ -1872,76 +1872,76 @@  discard block
 block discarded – undo
1872 1872
 function geodir_get_custom_sort_options($post_type = '')
1873 1873
 {
1874 1874
 
1875
-    global $wpdb;
1876
-
1877
-    if ($post_type != '') {
1878
-
1879
-        $all_postypes = geodir_get_posttypes();
1880
-
1881
-        if (!in_array($post_type, $all_postypes))
1882
-            return false;
1883
-
1884
-        $fields = array();
1885
-
1886
-        $fields[] = array(
1887
-            'post_type' => $post_type,
1888
-            'data_type' => '',
1889
-            'field_type' => 'random',
1890
-            'site_title' => 'Random',
1891
-            'htmlvar_name' => 'post_title',
1892
-            'field_icon' =>  'fa fa-random',
1893
-            'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1894
-        );
1895
-
1896
-        $fields[] = array(
1897
-            'post_type' => $post_type,
1898
-            'data_type' => '',
1899
-            'field_type' => 'datetime',
1900
-            'site_title' => __('Add date', 'geodirectory'),
1901
-            'htmlvar_name' => 'post_date',
1902
-            'field_icon' =>  'fa fa-calendar',
1903
-            'description' =>  __('Sort by date added', 'geodirectory')
1904
-        );
1905
-        $fields[] = array(
1906
-            'post_type' => $post_type,
1907
-            'data_type' => '',
1908
-            'field_type' => 'bigint',
1909
-            'site_title' => __('Review', 'geodirectory'),
1910
-            'htmlvar_name' => 'comment_count',
1911
-            'field_icon' =>  'fa fa-commenting-o',
1912
-            'description' =>  __('Sort by the number of reviews', 'geodirectory')
1913
-        );
1914
-        $fields[] = array(
1915
-            'post_type' => $post_type,
1916
-            'data_type' => '',
1917
-            'field_type' => 'float',
1918
-            'site_title' => __('Rating', 'geodirectory'),
1919
-            'htmlvar_name' => 'overall_rating',
1920
-            'field_icon' =>  'fa fa-star-o',
1921
-            'description' =>  __('Sort by the overall rating value', 'geodirectory')
1922
-        );
1923
-        $fields[] = array(
1924
-            'post_type' => $post_type,
1925
-            'data_type' => '',
1926
-            'field_type' => 'text',
1927
-            'site_title' => __('Title', 'geodirectory'),
1928
-            'htmlvar_name' => 'post_title',
1929
-            'field_icon' =>  'fa fa-sort-alpha-desc',
1930
-            'description' =>  __('Sort alphabetically by title', 'geodirectory')
1931
-        );
1932
-
1933
-        /**
1934
-         * Hook to add custom sort options.
1935
-         *
1936
-         * @since 1.0.0
1937
-         * @param array $fields Unmodified sort options array.
1938
-         * @param string $post_type Post type.
1939
-         */
1940
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1941
-
1942
-    }
1943
-
1944
-    return false;
1875
+	global $wpdb;
1876
+
1877
+	if ($post_type != '') {
1878
+
1879
+		$all_postypes = geodir_get_posttypes();
1880
+
1881
+		if (!in_array($post_type, $all_postypes))
1882
+			return false;
1883
+
1884
+		$fields = array();
1885
+
1886
+		$fields[] = array(
1887
+			'post_type' => $post_type,
1888
+			'data_type' => '',
1889
+			'field_type' => 'random',
1890
+			'site_title' => 'Random',
1891
+			'htmlvar_name' => 'post_title',
1892
+			'field_icon' =>  'fa fa-random',
1893
+			'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1894
+		);
1895
+
1896
+		$fields[] = array(
1897
+			'post_type' => $post_type,
1898
+			'data_type' => '',
1899
+			'field_type' => 'datetime',
1900
+			'site_title' => __('Add date', 'geodirectory'),
1901
+			'htmlvar_name' => 'post_date',
1902
+			'field_icon' =>  'fa fa-calendar',
1903
+			'description' =>  __('Sort by date added', 'geodirectory')
1904
+		);
1905
+		$fields[] = array(
1906
+			'post_type' => $post_type,
1907
+			'data_type' => '',
1908
+			'field_type' => 'bigint',
1909
+			'site_title' => __('Review', 'geodirectory'),
1910
+			'htmlvar_name' => 'comment_count',
1911
+			'field_icon' =>  'fa fa-commenting-o',
1912
+			'description' =>  __('Sort by the number of reviews', 'geodirectory')
1913
+		);
1914
+		$fields[] = array(
1915
+			'post_type' => $post_type,
1916
+			'data_type' => '',
1917
+			'field_type' => 'float',
1918
+			'site_title' => __('Rating', 'geodirectory'),
1919
+			'htmlvar_name' => 'overall_rating',
1920
+			'field_icon' =>  'fa fa-star-o',
1921
+			'description' =>  __('Sort by the overall rating value', 'geodirectory')
1922
+		);
1923
+		$fields[] = array(
1924
+			'post_type' => $post_type,
1925
+			'data_type' => '',
1926
+			'field_type' => 'text',
1927
+			'site_title' => __('Title', 'geodirectory'),
1928
+			'htmlvar_name' => 'post_title',
1929
+			'field_icon' =>  'fa fa-sort-alpha-desc',
1930
+			'description' =>  __('Sort alphabetically by title', 'geodirectory')
1931
+		);
1932
+
1933
+		/**
1934
+		 * Hook to add custom sort options.
1935
+		 *
1936
+		 * @since 1.0.0
1937
+		 * @param array $fields Unmodified sort options array.
1938
+		 * @param string $post_type Post type.
1939
+		 */
1940
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1941
+
1942
+	}
1943
+
1944
+	return false;
1945 1945
 }
1946 1946
 
1947 1947
 
@@ -1957,117 +1957,117 @@  discard block
 block discarded – undo
1957 1957
 function godir_set_sort_field_order($field_ids = array())
1958 1958
 {
1959 1959
 
1960
-    global $wpdb;
1960
+	global $wpdb;
1961 1961
 
1962
-    $count = 0;
1963
-    if (!empty($field_ids)):
1964
-        foreach ($field_ids as $id) {
1962
+	$count = 0;
1963
+	if (!empty($field_ids)):
1964
+		foreach ($field_ids as $id) {
1965 1965
 
1966
-            $cf = trim($id, '_');
1966
+			$cf = trim($id, '_');
1967 1967
 
1968
-            $post_meta_info = $wpdb->query(
1969
-                $wpdb->prepare(
1970
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1968
+			$post_meta_info = $wpdb->query(
1969
+				$wpdb->prepare(
1970
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1971 1971
 															sort_order=%d 
1972 1972
 															where id= %d",
1973
-                    array($count, $cf)
1974
-                )
1975
-            );
1976
-            $count++;
1977
-        }
1978
-
1979
-        return $field_ids;
1980
-    else:
1981
-        return false;
1982
-    endif;
1973
+					array($count, $cf)
1974
+				)
1975
+			);
1976
+			$count++;
1977
+		}
1978
+
1979
+		return $field_ids;
1980
+	else:
1981
+		return false;
1982
+	endif;
1983 1983
 }
1984 1984
 
1985 1985
 
1986 1986
 if (!function_exists('geodir_custom_sort_field_save')) {
1987
-    /**
1988
-     * Save or Update custom sort fields into the database.
1989
-     *
1990
-     * @since 1.0.0
1991
-     * @package GeoDirectory
1992
-     * @global object $wpdb WordPress Database object.
1993
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1994
-     * @param array $request_field {
1995
-     *    Attributes of the Request field.
1996
-     *
1997
-     *    @type string $action Ajax action name.
1998
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
1999
-     *    @type string $create_field Do you want to create this field?.
2000
-     *    @type string $field_ins_upd Field created or updated?.
2001
-     *    @type string $_wpnonce Nonce value.
2002
-     *    @type string $listing_type The Post type.
2003
-     *    @type string $field_type Field Type.
2004
-     *    @type string $field_id Field ID.
2005
-     *    @type string $data_type Data Type.
2006
-     *    @type string $htmlvar_name HTML variable name.
2007
-     *    @type string $site_title Section title which you wish to display in frontend.
2008
-     *    @type string $is_default Is this default sorting?.
2009
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
2010
-     *    @type string $sort_order Sort Order.
2011
-     *
2012
-     * }
2013
-     * @param bool $default Not yet implemented.
2014
-     * @return int Returns the last affected db table row id.
2015
-     */
2016
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
2017
-    {
2018
-
2019
-        global $wpdb, $plugin_prefix;
2020
-
2021
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2022
-
2023
-        $cf = trim($result_str, '_');
2024
-
2025
-        /*-------- check duplicate validation --------*/
2026
-
2027
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2028
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2029
-
2030
-        $post_type = $request_field['listing_type'];
2031
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2032
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2033
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2034
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2035
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2036
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2037
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2038
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2039
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2040
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2041
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2042
-
2043
-        $default_order = '';
2044
-        if ($is_default != '') {
2045
-            $default_order = $is_default;
2046
-            $is_default = '1';
2047
-        }
2048
-
2049
-
2050
-        $check_html_variable = $wpdb->get_var(
2051
-            $wpdb->prepare(
2052
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2053
-                array($cehhtmlvar_name, $post_type, $field_type)
2054
-            )
2055
-        );
2056
-
2057
-        if ($is_default == 1) {
2058
-
2059
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2060
-
2061
-        }
2062
-
2063
-
2064
-        if (!$check_html_variable) {
2065
-
2066
-            $wpdb->query(
2067
-
2068
-                $wpdb->prepare(
2069
-
2070
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1987
+	/**
1988
+	 * Save or Update custom sort fields into the database.
1989
+	 *
1990
+	 * @since 1.0.0
1991
+	 * @package GeoDirectory
1992
+	 * @global object $wpdb WordPress Database object.
1993
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1994
+	 * @param array $request_field {
1995
+	 *    Attributes of the Request field.
1996
+	 *
1997
+	 *    @type string $action Ajax action name.
1998
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
1999
+	 *    @type string $create_field Do you want to create this field?.
2000
+	 *    @type string $field_ins_upd Field created or updated?.
2001
+	 *    @type string $_wpnonce Nonce value.
2002
+	 *    @type string $listing_type The Post type.
2003
+	 *    @type string $field_type Field Type.
2004
+	 *    @type string $field_id Field ID.
2005
+	 *    @type string $data_type Data Type.
2006
+	 *    @type string $htmlvar_name HTML variable name.
2007
+	 *    @type string $site_title Section title which you wish to display in frontend.
2008
+	 *    @type string $is_default Is this default sorting?.
2009
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
2010
+	 *    @type string $sort_order Sort Order.
2011
+	 *
2012
+	 * }
2013
+	 * @param bool $default Not yet implemented.
2014
+	 * @return int Returns the last affected db table row id.
2015
+	 */
2016
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
2017
+	{
2018
+
2019
+		global $wpdb, $plugin_prefix;
2020
+
2021
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2022
+
2023
+		$cf = trim($result_str, '_');
2024
+
2025
+		/*-------- check duplicate validation --------*/
2026
+
2027
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2028
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2029
+
2030
+		$post_type = $request_field['listing_type'];
2031
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2032
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2033
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2034
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2035
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2036
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2037
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2038
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2039
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2040
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2041
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2042
+
2043
+		$default_order = '';
2044
+		if ($is_default != '') {
2045
+			$default_order = $is_default;
2046
+			$is_default = '1';
2047
+		}
2048
+
2049
+
2050
+		$check_html_variable = $wpdb->get_var(
2051
+			$wpdb->prepare(
2052
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2053
+				array($cehhtmlvar_name, $post_type, $field_type)
2054
+			)
2055
+		);
2056
+
2057
+		if ($is_default == 1) {
2058
+
2059
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2060
+
2061
+		}
2062
+
2063
+
2064
+		if (!$check_html_variable) {
2065
+
2066
+			$wpdb->query(
2067
+
2068
+				$wpdb->prepare(
2069
+
2070
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2071 2071
 				post_type = %s,
2072 2072
 				data_type = %s,
2073 2073
 				field_type = %s,
@@ -2082,23 +2082,23 @@  discard block
 block discarded – undo
2082 2082
 				asc_title = %s,
2083 2083
 				desc_title = %s",
2084 2084
 
2085
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2086
-                )
2085
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2086
+				)
2087 2087
 
2088
-            );
2088
+			);
2089 2089
 
2090 2090
 
2091
-            $lastid = $wpdb->insert_id;
2091
+			$lastid = $wpdb->insert_id;
2092 2092
 
2093
-            $lastid = trim($lastid);
2093
+			$lastid = trim($lastid);
2094 2094
 
2095
-        } else {
2095
+		} else {
2096 2096
 
2097
-            $wpdb->query(
2097
+			$wpdb->query(
2098 2098
 
2099
-                $wpdb->prepare(
2099
+				$wpdb->prepare(
2100 2100
 
2101
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2101
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2102 2102
 				post_type = %s,
2103 2103
 				data_type = %s,
2104 2104
 				field_type = %s,
@@ -2114,123 +2114,123 @@  discard block
 block discarded – undo
2114 2114
 				desc_title = %s
2115 2115
 				where id = %d",
2116 2116
 
2117
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2118
-                )
2117
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2118
+				)
2119 2119
 
2120
-            );
2120
+			);
2121 2121
 
2122
-            $lastid = trim($cf);
2122
+			$lastid = trim($cf);
2123 2123
 
2124
-        }
2124
+		}
2125 2125
 
2126 2126
 
2127
-        return (int)$lastid;
2127
+		return (int)$lastid;
2128 2128
 
2129
-    }
2129
+	}
2130 2130
 }
2131 2131
 
2132 2132
 
2133 2133
 if (!function_exists('geodir_custom_sort_field_delete')) {
2134
-    /**
2135
-     * Delete a custom sort field using field id.
2136
-     * @since 1.0.0
2137
-     * @package GeoDirectory
2138
-     * @global object $wpdb WordPress Database object.
2139
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2140
-     * @param string $field_id The field ID.
2141
-     * @return int|string Returns field id when successful deletion, else returns 0.
2142
-     */
2143
-    function geodir_custom_sort_field_delete($field_id = '')
2144
-    {
2145
-
2146
-        global $wpdb, $plugin_prefix;
2147
-        if ($field_id != '') {
2148
-            $cf = trim($field_id, '_');
2149
-
2150
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2151
-
2152
-            return $field_id;
2153
-
2154
-        } else
2155
-            return 0;
2156
-
2157
-    }
2134
+	/**
2135
+	 * Delete a custom sort field using field id.
2136
+	 * @since 1.0.0
2137
+	 * @package GeoDirectory
2138
+	 * @global object $wpdb WordPress Database object.
2139
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2140
+	 * @param string $field_id The field ID.
2141
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2142
+	 */
2143
+	function geodir_custom_sort_field_delete($field_id = '')
2144
+	{
2145
+
2146
+		global $wpdb, $plugin_prefix;
2147
+		if ($field_id != '') {
2148
+			$cf = trim($field_id, '_');
2149
+
2150
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2151
+
2152
+			return $field_id;
2153
+
2154
+		} else
2155
+			return 0;
2156
+
2157
+	}
2158 2158
 }
2159 2159
 
2160 2160
 
2161 2161
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2162
-    /**
2163
-     * Custom sort field admin html.
2164
-     *
2165
-     * @since 1.0.0
2166
-     * @package GeoDirectory
2167
-     * @global object $wpdb WordPress Database object.
2168
-     * @param string $field_type The form field type.
2169
-     * @param object|int $result_str The custom field results object or row id.
2170
-     * @param string $field_ins_upd When set to "submit" displays form.
2171
-     * @param bool $default when set to true field will be for admin use only.
2172
-     */
2173
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2174
-    {
2175
-        global $wpdb;
2176
-        $cf = $result_str;
2177
-        if (!is_object($cf)) {
2178
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2179
-        } else {
2180
-            $field_info = $cf;
2181
-            $result_str = $cf->id;
2182
-        }
2183
-
2184
-        $field_info = stripslashes_deep($field_info); // strip slashes
2185
-
2186
-        if (!isset($field_info->post_type)) {
2187
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2188
-        } else {
2189
-            $post_type = $field_info->post_type;
2190
-        }
2191
-
2192
-
2193
-        $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2194
-
2195
-        $site_title = '';
2196
-        if ($site_title == '')
2197
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2198
-
2199
-        if ($site_title == '') {
2200
-            $fields = geodir_get_custom_sort_options($post_type);
2201
-
2202
-            foreach ($fields as $val) {
2203
-                $val = stripslashes_deep($val); // strip slashes
2204
-
2205
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2206
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
2207
-                }
2208
-            }
2209
-        }
2210
-
2211
-        if ($htmlvar_name == '')
2212
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2213
-
2214
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2215
-
2216
-        $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2217
-        $cso_arr = geodir_get_custom_sort_options($post_type);
2218
-
2219
-        $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2220
-        foreach($cso_arr as $cso){
2221
-            if($cur_field_type==$cso['field_type']){
2222
-
2223
-                if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2224
-                    $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2225
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2226
-                    $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2227
-                }
2228
-
2229
-            }
2230
-        }
2231
-
2232
-        $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2233
-        ?>
2162
+	/**
2163
+	 * Custom sort field admin html.
2164
+	 *
2165
+	 * @since 1.0.0
2166
+	 * @package GeoDirectory
2167
+	 * @global object $wpdb WordPress Database object.
2168
+	 * @param string $field_type The form field type.
2169
+	 * @param object|int $result_str The custom field results object or row id.
2170
+	 * @param string $field_ins_upd When set to "submit" displays form.
2171
+	 * @param bool $default when set to true field will be for admin use only.
2172
+	 */
2173
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2174
+	{
2175
+		global $wpdb;
2176
+		$cf = $result_str;
2177
+		if (!is_object($cf)) {
2178
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2179
+		} else {
2180
+			$field_info = $cf;
2181
+			$result_str = $cf->id;
2182
+		}
2183
+
2184
+		$field_info = stripslashes_deep($field_info); // strip slashes
2185
+
2186
+		if (!isset($field_info->post_type)) {
2187
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2188
+		} else {
2189
+			$post_type = $field_info->post_type;
2190
+		}
2191
+
2192
+
2193
+		$htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2194
+
2195
+		$site_title = '';
2196
+		if ($site_title == '')
2197
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2198
+
2199
+		if ($site_title == '') {
2200
+			$fields = geodir_get_custom_sort_options($post_type);
2201
+
2202
+			foreach ($fields as $val) {
2203
+				$val = stripslashes_deep($val); // strip slashes
2204
+
2205
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2206
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
2207
+				}
2208
+			}
2209
+		}
2210
+
2211
+		if ($htmlvar_name == '')
2212
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2213
+
2214
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
2215
+
2216
+		$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2217
+		$cso_arr = geodir_get_custom_sort_options($post_type);
2218
+
2219
+		$cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2220
+		foreach($cso_arr as $cso){
2221
+			if($cur_field_type==$cso['field_type']){
2222
+
2223
+				if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2224
+					$field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2225
+				}elseif(isset($cso['field_icon']) && $cso['field_icon']){
2226
+					$field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2227
+				}
2228
+
2229
+			}
2230
+		}
2231
+
2232
+		$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2233
+		?>
2234 2234
 
2235 2235
         <li class="text" id="licontainer_<?php echo $result_str;?>">
2236 2236
             <form><!-- we need to wrap in a form so we can use radio buttons with same name -->
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2240 2240
                 <?php
2241 2241
 
2242
-                ?>
2242
+				?>
2243 2243
 
2244 2244
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2245 2245
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -2254,17 +2254,17 @@  discard block
 block discarded – undo
2254 2254
 
2255 2255
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2256 2256
                  style="display:<?php if ($field_ins_upd == 'submit') {
2257
-                     echo 'block;';
2258
-                 } else {
2259
-                     echo 'none;';
2260
-                 } ?>">
2257
+					 echo 'block;';
2258
+				 } else {
2259
+					 echo 'none;';
2260
+				 } ?>">
2261 2261
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2262 2262
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2263 2263
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2264 2264
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2265 2265
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2266
-                    echo $field_info->data_type;
2267
-                }?>"/>
2266
+					echo $field_info->data_type;
2267
+				}?>"/>
2268 2268
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2269 2269
 
2270 2270
 
@@ -2287,14 +2287,14 @@  discard block
 block discarded – undo
2287 2287
 
2288 2288
                                 <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2289 2289
                                     <?php if ($value == '1') {
2290
-                                        echo 'checked';
2291
-                                    } ?>/>
2290
+										echo 'checked';
2291
+									} ?>/>
2292 2292
                                 <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2293 2293
 
2294 2294
                                 <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2295 2295
                                     <?php if ($value == '0' || !$value) {
2296
-                                        echo 'checked';
2297
-                                    } ?>/>
2296
+										echo 'checked';
2297
+									} ?>/>
2298 2298
                                 <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2299 2299
 
2300 2300
                             </div>
@@ -2331,8 +2331,8 @@  discard block
 block discarded – undo
2331 2331
 
2332 2332
                                 <input type="radio" name="is_default"
2333 2333
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2334
-                                    echo 'checked="checked"';
2335
-                                } ?>/>
2334
+									echo 'checked="checked"';
2335
+								} ?>/>
2336 2336
                             </div>
2337 2337
 
2338 2338
                         </li>
@@ -2352,14 +2352,14 @@  discard block
 block discarded – undo
2352 2352
 
2353 2353
                                 <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2354 2354
                                     <?php if ($value == '1') {
2355
-                                        echo 'checked';
2356
-                                    } ?>/>
2355
+										echo 'checked';
2356
+									} ?>/>
2357 2357
                                 <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2358 2358
 
2359 2359
                                 <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2360 2360
                                     <?php if ($value == '0' || !$value) {
2361
-                                        echo 'checked';
2362
-                                    } ?>/>
2361
+										echo 'checked';
2362
+									} ?>/>
2363 2363
                                 <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2364 2364
 
2365 2365
                             </div>
@@ -2395,8 +2395,8 @@  discard block
 block discarded – undo
2395 2395
 
2396 2396
                                 <input type="radio" name="is_default"
2397 2397
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2398
-                                    echo 'checked="checked"';
2399
-                                } ?>/>
2398
+									echo 'checked="checked"';
2399
+								} ?>/>
2400 2400
                             </div>
2401 2401
 
2402 2402
                         </li>
@@ -2438,8 +2438,8 @@  discard block
 block discarded – undo
2438 2438
 
2439 2439
                                 <input type="checkbox" name="is_default"
2440 2440
                                        value="<?php echo $field_type; ?>"  <?php if (isset($value) && $value == '1') {
2441
-                                    echo 'checked="checked"';
2442
-                                } ?>/>
2441
+									echo 'checked="checked"';
2442
+								} ?>/>
2443 2443
                             </div>
2444 2444
 
2445 2445
 
@@ -2462,14 +2462,14 @@  discard block
 block discarded – undo
2462 2462
 
2463 2463
                             <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2464 2464
                                 <?php if ($value == '1') {
2465
-                                    echo 'checked';
2466
-                                } ?>/>
2465
+									echo 'checked';
2466
+								} ?>/>
2467 2467
                             <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2468 2468
 
2469 2469
                             <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2470 2470
                                 <?php if ($value == '0' || !$value) {
2471
-                                    echo 'checked';
2472
-                                } ?>/>
2471
+									echo 'checked';
2472
+								} ?>/>
2473 2473
                             <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2474 2474
 
2475 2475
                         </div>
@@ -2479,8 +2479,8 @@  discard block
 block discarded – undo
2479 2479
 
2480 2480
                     <input type="hidden" readonly="readonly" name="sort_order" id="sort_order"
2481 2481
                                                 value="<?php if (isset($field_info->sort_order)) {
2482
-                                                    echo esc_attr($field_info->sort_order);
2483
-                                                }?>" size="50"/>
2482
+													echo esc_attr($field_info->sort_order);
2483
+												}?>" size="50"/>
2484 2484
 
2485 2485
 
2486 2486
 
@@ -2504,38 +2504,38 @@  discard block
 block discarded – undo
2504 2504
             </form>
2505 2505
         </li> <?php
2506 2506
 
2507
-    }
2507
+	}
2508 2508
 }
2509 2509
 
2510 2510
 if (!function_exists('check_field_visibility')) {
2511
-    /**
2512
-     * Check field visibility as per price package.
2513
-     *
2514
-     * @since 1.0.0
2515
-     * @package GeoDirectory
2516
-     * @global object $wpdb WordPress Database object.
2517
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
2518
-     * @param int|string $package_id The package ID.
2519
-     * @param string $field_name The field name.
2520
-     * @param string $post_type Optional. The wordpress post type.
2521
-     * @return bool Returns true when field visible, otherwise false.
2522
-     */
2523
-    function check_field_visibility($package_id, $field_name, $post_type)
2524
-    {
2525
-        global $wpdb, $geodir_addon_list;
2526
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2527
-            return true;
2528
-        }
2529
-        if (!$package_id || !$field_name || !$post_type) {
2530
-            return true;
2531
-        }
2532
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2533
-
2534
-        if ($wpdb->get_var($sql)) {
2535
-            return true;
2536
-        }
2537
-        return false;
2538
-    }
2511
+	/**
2512
+	 * Check field visibility as per price package.
2513
+	 *
2514
+	 * @since 1.0.0
2515
+	 * @package GeoDirectory
2516
+	 * @global object $wpdb WordPress Database object.
2517
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
2518
+	 * @param int|string $package_id The package ID.
2519
+	 * @param string $field_name The field name.
2520
+	 * @param string $post_type Optional. The wordpress post type.
2521
+	 * @return bool Returns true when field visible, otherwise false.
2522
+	 */
2523
+	function check_field_visibility($package_id, $field_name, $post_type)
2524
+	{
2525
+		global $wpdb, $geodir_addon_list;
2526
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2527
+			return true;
2528
+		}
2529
+		if (!$package_id || !$field_name || !$post_type) {
2530
+			return true;
2531
+		}
2532
+		$sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2533
+
2534
+		if ($wpdb->get_var($sql)) {
2535
+			return true;
2536
+		}
2537
+		return false;
2538
+	}
2539 2539
 }
2540 2540
 
2541 2541
 /**
@@ -2551,43 +2551,43 @@  discard block
 block discarded – undo
2551 2551
  */
2552 2552
 function geodir_string_to_options($input = '', $translated = false)
2553 2553
 {
2554
-    $return = array();
2555
-    if ($input != '') {
2556
-        $input = trim($input);
2557
-        $input = rtrim($input, ",");
2558
-        $input = ltrim($input, ",");
2559
-        $input = trim($input);
2560
-    }
2561
-
2562
-    $input_arr = explode(',', $input);
2563
-
2564
-    if (!empty($input_arr)) {
2565
-        foreach ($input_arr as $input_str) {
2566
-            $input_str = trim($input_str);
2567
-
2568
-            if (strpos($input_str, "/") !== false) {
2569
-                $input_str = explode("/", $input_str, 2);
2570
-                $label = trim($input_str[0]);
2571
-                if ($translated && $label != '') {
2572
-                    $label = __($label, 'geodirectory');
2573
-                }
2574
-                $label = ucfirst($label);
2575
-                $value = trim($input_str[1]);
2576
-            } else {
2577
-                $value = $input_str;
2578
-                if ($translated && $input_str != '') {
2579
-                    $input_str = __($input_str, 'geodirectory');
2580
-                }
2581
-                $label = ucfirst($input_str);
2582
-            }
2583
-
2584
-            if ($label != '') {
2585
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2586
-            }
2587
-        }
2588
-    }
2589
-
2590
-    return $return;
2554
+	$return = array();
2555
+	if ($input != '') {
2556
+		$input = trim($input);
2557
+		$input = rtrim($input, ",");
2558
+		$input = ltrim($input, ",");
2559
+		$input = trim($input);
2560
+	}
2561
+
2562
+	$input_arr = explode(',', $input);
2563
+
2564
+	if (!empty($input_arr)) {
2565
+		foreach ($input_arr as $input_str) {
2566
+			$input_str = trim($input_str);
2567
+
2568
+			if (strpos($input_str, "/") !== false) {
2569
+				$input_str = explode("/", $input_str, 2);
2570
+				$label = trim($input_str[0]);
2571
+				if ($translated && $label != '') {
2572
+					$label = __($label, 'geodirectory');
2573
+				}
2574
+				$label = ucfirst($label);
2575
+				$value = trim($input_str[1]);
2576
+			} else {
2577
+				$value = $input_str;
2578
+				if ($translated && $input_str != '') {
2579
+					$input_str = __($input_str, 'geodirectory');
2580
+				}
2581
+				$label = ucfirst($input_str);
2582
+			}
2583
+
2584
+			if ($label != '') {
2585
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2586
+			}
2587
+		}
2588
+	}
2589
+
2590
+	return $return;
2591 2591
 }
2592 2592
 
2593 2593
 /**
@@ -2602,66 +2602,66 @@  discard block
 block discarded – undo
2602 2602
  */
2603 2603
 function geodir_string_values_to_options($option_values = '', $translated = false)
2604 2604
 {
2605
-    $options = array();
2606
-    if ($option_values == '') {
2607
-        return NULL;
2608
-    }
2609
-
2610
-    if (strpos($option_values, "{/optgroup}") !== false) {
2611
-        $option_values_arr = explode("{/optgroup}", $option_values);
2612
-
2613
-        foreach ($option_values_arr as $optgroup) {
2614
-            if (strpos($optgroup, "{optgroup}") !== false) {
2615
-                $optgroup_arr = explode("{optgroup}", $optgroup);
2616
-
2617
-                $count = 0;
2618
-                foreach ($optgroup_arr as $optgroup_str) {
2619
-                    $count++;
2620
-                    $optgroup_str = trim($optgroup_str);
2621
-
2622
-                    $optgroup_label = '';
2623
-                    if (strpos($optgroup_str, "|") !== false) {
2624
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
2625
-                        $optgroup_label = trim($optgroup_str_arr[0]);
2626
-                        if ($translated && $optgroup_label != '') {
2627
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
2628
-                        }
2629
-                        $optgroup_label = ucfirst($optgroup_label);
2630
-                        $optgroup_str = $optgroup_str_arr[1];
2631
-                    }
2632
-
2633
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2634
-
2635
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2636
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2637
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2638
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2639
-                    }
2640
-                    $options = array_merge($options, $optgroup3);
2641
-                }
2642
-            } else {
2643
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
2644
-                $options = array_merge($options, $optgroup1);
2645
-            }
2646
-        }
2647
-    } else {
2648
-        $options = geodir_string_to_options($option_values, $translated);
2649
-    }
2650
-
2651
-    return $options;
2605
+	$options = array();
2606
+	if ($option_values == '') {
2607
+		return NULL;
2608
+	}
2609
+
2610
+	if (strpos($option_values, "{/optgroup}") !== false) {
2611
+		$option_values_arr = explode("{/optgroup}", $option_values);
2612
+
2613
+		foreach ($option_values_arr as $optgroup) {
2614
+			if (strpos($optgroup, "{optgroup}") !== false) {
2615
+				$optgroup_arr = explode("{optgroup}", $optgroup);
2616
+
2617
+				$count = 0;
2618
+				foreach ($optgroup_arr as $optgroup_str) {
2619
+					$count++;
2620
+					$optgroup_str = trim($optgroup_str);
2621
+
2622
+					$optgroup_label = '';
2623
+					if (strpos($optgroup_str, "|") !== false) {
2624
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
2625
+						$optgroup_label = trim($optgroup_str_arr[0]);
2626
+						if ($translated && $optgroup_label != '') {
2627
+							$optgroup_label = __($optgroup_label, 'geodirectory');
2628
+						}
2629
+						$optgroup_label = ucfirst($optgroup_label);
2630
+						$optgroup_str = $optgroup_str_arr[1];
2631
+					}
2632
+
2633
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2634
+
2635
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2636
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2637
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2638
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2639
+					}
2640
+					$options = array_merge($options, $optgroup3);
2641
+				}
2642
+			} else {
2643
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
2644
+				$options = array_merge($options, $optgroup1);
2645
+			}
2646
+		}
2647
+	} else {
2648
+		$options = geodir_string_to_options($option_values, $translated);
2649
+	}
2650
+
2651
+	return $options;
2652 2652
 }
2653 2653
 
2654 2654
 
2655 2655
 function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2656
-    ob_start();
2657
-
2658
-    $dt_value = '';
2659
-    if (isset($field_info->data_type)) {
2660
-        $dt_value  = esc_attr($field_info->data_type);
2661
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2662
-        $dt_value  = $cf['defaults']['data_type'];
2663
-    }
2664
-    ?>
2656
+	ob_start();
2657
+
2658
+	$dt_value = '';
2659
+	if (isset($field_info->data_type)) {
2660
+		$dt_value  = esc_attr($field_info->data_type);
2661
+	}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2662
+		$dt_value  = $cf['defaults']['data_type'];
2663
+	}
2664
+	?>
2665 2665
     <li>
2666 2666
         <label for="data_type"><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
2667 2667
         <div class="gd-cf-input-wrap">
@@ -2670,16 +2670,16 @@  discard block
 block discarded – undo
2670 2670
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2671 2671
                 <option
2672 2672
                     value="XVARCHAR" <?php if ($dt_value  == 'VARCHAR') {
2673
-                    echo 'selected="selected"';
2674
-                } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2673
+					echo 'selected="selected"';
2674
+				} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2675 2675
                 <option
2676 2676
                     value="INT" <?php if ($dt_value   == 'INT') {
2677
-                    echo 'selected="selected"';
2678
-                } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2677
+					echo 'selected="selected"';
2678
+				} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2679 2679
                 <option
2680 2680
                     value="FLOAT" <?php if ($dt_value   == 'FLOAT') {
2681
-                    echo 'selected="selected"';
2682
-                } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2681
+					echo 'selected="selected"';
2682
+				} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2683 2683
             </select>
2684 2684
             <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
2685 2685
 
@@ -2687,13 +2687,13 @@  discard block
 block discarded – undo
2687 2687
     </li>
2688 2688
 
2689 2689
     <?php
2690
-    $value = '';
2691
-    if (isset($field_info->decimal_point)) {
2692
-        $value = esc_attr($field_info->decimal_point);
2693
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2694
-        $value = $cf['defaults']['decimal_point'];
2695
-    }
2696
-    ?>
2690
+	$value = '';
2691
+	if (isset($field_info->decimal_point)) {
2692
+		$value = esc_attr($field_info->decimal_point);
2693
+	}elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2694
+		$value = $cf['defaults']['decimal_point'];
2695
+	}
2696
+	?>
2697 2697
 
2698 2698
     <li class="decimal-point-wrapper"
2699 2699
         style="<?php echo ($dt_value  == 'FLOAT') ? '' : 'display:none' ?>">
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
             <select name="decimal_point" id="decimal_point">
2703 2703
                 <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
2704 2704
                 <?php for ($i = 1; $i <= 10; $i++) {
2705
-                    $selected = $i == $value ? 'selected="selected"' : ''; ?>
2705
+					$selected = $i == $value ? 'selected="selected"' : ''; ?>
2706 2706
                     <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
2707 2707
                 <?php } ?>
2708 2708
             </select>
@@ -2711,8 +2711,8 @@  discard block
 block discarded – undo
2711 2711
     </li>
2712 2712
 <?php
2713 2713
 
2714
-    $output = ob_get_clean();
2715
-    return $output;
2714
+	$output = ob_get_clean();
2715
+	return $output;
2716 2716
 }
2717 2717
 add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2718 2718
 
@@ -2750,9 +2750,9 @@  discard block
 block discarded – undo
2750 2750
 
2751 2751
 
2752 2752
 function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2753
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2754
-    ob_start();
2755
-    ?>
2753
+	if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2754
+	ob_start();
2755
+	?>
2756 2756
     <li>
2757 2757
         <label for="advanced_editor" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show advanced editor :', 'geodirectory'); ?>
2758 2758
             <div class="gdcf-tooltip">
@@ -2763,13 +2763,13 @@  discard block
 block discarded – undo
2763 2763
         <div class="gd-cf-input-wrap">
2764 2764
 
2765 2765
             <?php
2766
-            $selected = '';
2767
-            if (isset($field_info->extra_fields))
2768
-                $advanced_editor = unserialize($field_info->extra_fields);
2766
+			$selected = '';
2767
+			if (isset($field_info->extra_fields))
2768
+				$advanced_editor = unserialize($field_info->extra_fields);
2769 2769
 
2770
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2771
-                $selected = 'checked="checked"';
2772
-            ?>
2770
+			if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2771
+				$selected = 'checked="checked"';
2772
+			?>
2773 2773
 
2774 2774
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
2775 2775
                    value="1" <?php echo $selected; ?>/>
@@ -2778,22 +2778,22 @@  discard block
 block discarded – undo
2778 2778
     </li>
2779 2779
     <?php
2780 2780
 
2781
-    $output = ob_get_clean();
2782
-    return $output;
2781
+	$output = ob_get_clean();
2782
+	return $output;
2783 2783
 }
2784 2784
 add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2785 2785
 
2786 2786
 
2787 2787
 function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2788
-    ob_start();
2789
-
2790
-    $value = '';
2791
-    if (isset($field_info->validation_pattern)) {
2792
-        $value = esc_attr($field_info->validation_pattern);
2793
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2794
-        $value = esc_attr($cf['defaults']['validation_pattern']);
2795
-    }
2796
-    ?>
2788
+	ob_start();
2789
+
2790
+	$value = '';
2791
+	if (isset($field_info->validation_pattern)) {
2792
+		$value = esc_attr($field_info->validation_pattern);
2793
+	}elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2794
+		$value = esc_attr($cf['defaults']['validation_pattern']);
2795
+	}
2796
+	?>
2797 2797
     <li>
2798 2798
         <label for="validation_pattern" class="gd-cf-tooltip-wrap">
2799 2799
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -2807,13 +2807,13 @@  discard block
 block discarded – undo
2807 2807
         </div>
2808 2808
     </li>
2809 2809
     <?php
2810
-    $value = '';
2811
-    if (isset($field_info->validation_msg)) {
2812
-        $value = esc_attr($field_info->validation_msg);
2813
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2814
-        $value = esc_attr($cf['defaults']['validation_msg']);
2815
-    }
2816
-    ?>
2810
+	$value = '';
2811
+	if (isset($field_info->validation_msg)) {
2812
+		$value = esc_attr($field_info->validation_msg);
2813
+	}elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2814
+		$value = esc_attr($cf['defaults']['validation_msg']);
2815
+	}
2816
+	?>
2817 2817
     <li>
2818 2818
         <label for="validation_msg" class="gd-cf-tooltip-wrap">
2819 2819
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
@@ -2828,21 +2828,21 @@  discard block
 block discarded – undo
2828 2828
     </li>
2829 2829
     <?php
2830 2830
 
2831
-    $output = ob_get_clean();
2832
-    return $output;
2831
+	$output = ob_get_clean();
2832
+	return $output;
2833 2833
 }
2834 2834
 add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2835 2835
 
2836 2836
 
2837 2837
 function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2838
-    ob_start();
2839
-    global $post_type;
2840
-
2841
-    if (!isset($field_info->post_type)) {
2842
-        $post_type = sanitize_text_field($_REQUEST['listing_type']);
2843
-    } else
2844
-        $post_type = $field_info->post_type;
2845
-    ?>
2838
+	ob_start();
2839
+	global $post_type;
2840
+
2841
+	if (!isset($field_info->post_type)) {
2842
+		$post_type = sanitize_text_field($_REQUEST['listing_type']);
2843
+	} else
2844
+		$post_type = $field_info->post_type;
2845
+	?>
2846 2846
     <li style="display: none;">
2847 2847
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
2848 2848
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -2853,15 +2853,15 @@  discard block
 block discarded – undo
2853 2853
         <div class="gd-cf-input-wrap">
2854 2854
             <select name="htmlvar_name" id="htmlvar_name">
2855 2855
                 <?php
2856
-                $gd_taxonomy = geodir_get_taxonomies($post_type);
2856
+				$gd_taxonomy = geodir_get_taxonomies($post_type);
2857 2857
 
2858
-                foreach ($gd_taxonomy as $gd_tax) {
2859
-                    ?>
2858
+				foreach ($gd_taxonomy as $gd_tax) {
2859
+					?>
2860 2860
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2861
-                        echo 'selected="selected"';
2862
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2863
-                }
2864
-                ?>
2861
+						echo 'selected="selected"';
2862
+					}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2863
+				}
2864
+				?>
2865 2865
             </select>
2866 2866
         </div>
2867 2867
     </li>
@@ -2877,49 +2877,49 @@  discard block
 block discarded – undo
2877 2877
 
2878 2878
             <select name="cat_display_type" id="cat_display_type">
2879 2879
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2880
-                    echo 'selected="selected"';
2881
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2880
+					echo 'selected="selected"';
2881
+				}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2882 2882
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2883
-                    echo 'selected="selected"';
2884
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2883
+					echo 'selected="selected"';
2884
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2885 2885
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2886
-                    echo 'selected="selected"';
2887
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2886
+					echo 'selected="selected"';
2887
+				}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2888 2888
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2889
-                    echo 'selected="selected"';
2890
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2889
+					echo 'selected="selected"';
2890
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2891 2891
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2892
-                    echo 'selected="selected"';
2893
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2892
+					echo 'selected="selected"';
2893
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2894 2894
             </select>
2895 2895
         </div>
2896 2896
     </li>
2897 2897
     <?php
2898 2898
 
2899
-    $output = ob_get_clean();
2900
-    return $output;
2899
+	$output = ob_get_clean();
2900
+	return $output;
2901 2901
 }
2902 2902
 add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2903 2903
 
2904 2904
 
2905 2905
 function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2906 2906
 
2907
-    ob_start();
2908
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2909
-        $address = stripslashes_deep(unserialize($field_info->extra_fields));
2910
-    }
2907
+	ob_start();
2908
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2909
+		$address = stripslashes_deep(unserialize($field_info->extra_fields));
2910
+	}
2911 2911
 
2912
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2913
-    ?>
2912
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2913
+	?>
2914 2914
     <?php
2915
-    /**
2916
-     * Called on the add custom fields settings page before the address field is output.
2917
-     *
2918
-     * @since 1.0.0
2919
-     * @param array $address The address settings array.
2920
-     * @param object $field_info Extra fields info.
2921
-     */
2922
-    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2915
+	/**
2916
+	 * Called on the add custom fields settings page before the address field is output.
2917
+	 *
2918
+	 * @since 1.0.0
2919
+	 * @param array $address The address settings array.
2920
+	 * @param object $field_info Extra fields info.
2921
+	 */
2922
+	do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2923 2923
 
2924 2924
     <li>
2925 2925
         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -2932,14 +2932,14 @@  discard block
 block discarded – undo
2932 2932
 
2933 2933
             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2934 2934
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2935
-                    echo 'checked';
2936
-                } ?>/>
2935
+					echo 'checked';
2936
+				} ?>/>
2937 2937
             <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2938 2938
 
2939 2939
             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2940 2940
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2941
-                    echo 'checked';
2942
-                } ?>/>
2941
+					echo 'checked';
2942
+				} ?>/>
2943 2943
             <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2944 2944
 
2945 2945
 
@@ -2956,8 +2956,8 @@  discard block
 block discarded – undo
2956 2956
         <div class="gd-cf-input-wrap">
2957 2957
             <input type="text" name="extra[zip_lable]" id="zip_lable"
2958 2958
                    value="<?php if (isset($address['zip_lable'])) {
2959
-                       echo esc_attr($address['zip_lable']);
2960
-                   }?>"/>
2959
+					   echo esc_attr($address['zip_lable']);
2960
+				   }?>"/>
2961 2961
         </div>
2962 2962
     </li>
2963 2963
 
@@ -2974,8 +2974,8 @@  discard block
 block discarded – undo
2974 2974
         <div class="gd-cf-input-wrap">
2975 2975
             <input type="text" name="extra[map_lable]" id="map_lable"
2976 2976
                    value="<?php if (isset($address['map_lable'])) {
2977
-                       echo esc_attr($address['map_lable']);
2978
-                   }?>"/>
2977
+					   echo esc_attr($address['map_lable']);
2978
+				   }?>"/>
2979 2979
         </div>
2980 2980
     </li>
2981 2981
 
@@ -2990,14 +2990,14 @@  discard block
 block discarded – undo
2990 2990
 
2991 2991
             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2992 2992
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2993
-                    echo 'checked';
2994
-                } ?>/>
2993
+					echo 'checked';
2994
+				} ?>/>
2995 2995
             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2996 2996
 
2997 2997
             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2998 2998
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2999
-                    echo 'checked';
3000
-                } ?>/>
2999
+					echo 'checked';
3000
+				} ?>/>
3001 3001
             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3002 3002
 
3003 3003
         </div>
@@ -3014,14 +3014,14 @@  discard block
 block discarded – undo
3014 3014
 
3015 3015
             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
3016 3016
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
3017
-                    echo 'checked';
3018
-                } ?>/>
3017
+					echo 'checked';
3018
+				} ?>/>
3019 3019
             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3020 3020
 
3021 3021
             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
3022 3022
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
3023
-                    echo 'checked';
3024
-                } ?>/>
3023
+					echo 'checked';
3024
+				} ?>/>
3025 3025
             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3026 3026
 
3027 3027
         </div>
@@ -3038,8 +3038,8 @@  discard block
 block discarded – undo
3038 3038
         <div class="gd-cf-input-wrap">
3039 3039
             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
3040 3040
                    value="<?php if (isset($address['mapview_lable'])) {
3041
-                       echo esc_attr($address['mapview_lable']);
3042
-                   }?>"/>
3041
+					   echo esc_attr($address['mapview_lable']);
3042
+				   }?>"/>
3043 3043
         </div>
3044 3044
     </li>
3045 3045
     <li>
@@ -3053,29 +3053,29 @@  discard block
 block discarded – undo
3053 3053
 
3054 3054
             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3055 3055
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3056
-                    echo 'checked';
3057
-                } ?>/>
3056
+					echo 'checked';
3057
+				} ?>/>
3058 3058
             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3059 3059
 
3060 3060
             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3061 3061
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3062
-                    echo 'checked';
3063
-                } ?>/>
3062
+					echo 'checked';
3063
+				} ?>/>
3064 3064
             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3065 3065
 
3066 3066
         </div>
3067 3067
     </li>
3068 3068
     <?php
3069 3069
 
3070
-    $html = ob_get_clean();
3071
-    return $output.$html;
3070
+	$html = ob_get_clean();
3071
+	return $output.$html;
3072 3072
 }
3073 3073
 add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3074 3074
 
3075 3075
 
3076 3076
 function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3077
-    ob_start();
3078
-    ?>
3077
+	ob_start();
3078
+	?>
3079 3079
     <li>
3080 3080
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3081 3081
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -3087,14 +3087,14 @@  discard block
 block discarded – undo
3087 3087
 
3088 3088
             <select name="multi_display_type" id="multi_display_type">
3089 3089
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3090
-                    echo 'selected="selected"';
3091
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3090
+					echo 'selected="selected"';
3091
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
3092 3092
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3093
-                    echo 'selected="selected"';
3094
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3093
+					echo 'selected="selected"';
3094
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3095 3095
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3096
-                    echo 'selected="selected"';
3097
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3096
+					echo 'selected="selected"';
3097
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3098 3098
             </select>
3099 3099
 
3100 3100
             <br/>
@@ -3102,25 +3102,25 @@  discard block
 block discarded – undo
3102 3102
     </li>
3103 3103
     <?php
3104 3104
 
3105
-    $html = ob_get_clean();
3106
-    return $output.$html;
3105
+	$html = ob_get_clean();
3106
+	return $output.$html;
3107 3107
 }
3108 3108
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3109 3109
 
3110 3110
 
3111 3111
 function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3112 3112
 
3113
-    ob_start();
3113
+	ob_start();
3114 3114
 
3115
-    $value = '';
3116
-    if (isset($field_info->option_values)) {
3117
-        $value = esc_attr($field_info->option_values);
3118
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3119
-        $value = esc_attr($cf['defaults']['option_values']);
3120
-    }
3115
+	$value = '';
3116
+	if (isset($field_info->option_values)) {
3117
+		$value = esc_attr($field_info->option_values);
3118
+	}elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3119
+		$value = esc_attr($cf['defaults']['option_values']);
3120
+	}
3121 3121
 
3122
-    $field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3123
-    ?>
3122
+	$field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3123
+	?>
3124 3124
     <li>
3125 3125
         <label for="option_values" class="gd-cf-tooltip-wrap">
3126 3126
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -3147,8 +3147,8 @@  discard block
 block discarded – undo
3147 3147
     </li>
3148 3148
     <?php
3149 3149
 
3150
-    $html = ob_get_clean();
3151
-    return $output.$html;
3150
+	$html = ob_get_clean();
3151
+	return $output.$html;
3152 3152
 }
3153 3153
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3154 3154
 add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
@@ -3156,12 +3156,12 @@  discard block
 block discarded – undo
3156 3156
 
3157 3157
 
3158 3158
 function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3159
-    ob_start();
3160
-    $extra = array();
3161
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3162
-        $extra = unserialize($field_info->extra_fields);
3163
-    }
3164
-    ?>
3159
+	ob_start();
3160
+	$extra = array();
3161
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3162
+		$extra = unserialize($field_info->extra_fields);
3163
+	}
3164
+	?>
3165 3165
     <li>
3166 3166
         <label for="date_format" class="gd-cf-tooltip-wrap">
3167 3167
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -3171,52 +3171,52 @@  discard block
 block discarded – undo
3171 3171
         </label>
3172 3172
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
3173 3173
             <?php
3174
-            $date_formats = array(
3175
-                'm/d/Y',
3176
-                'd/m/Y',
3177
-                'Y/m/d',
3178
-                'm-d-Y',
3179
-                'd-m-Y',
3180
-                'Y-m-d',
3181
-                'F j, Y',
3182
-            );
3183
-            /**
3184
-             * Filter the custom field date format options.
3185
-             *
3186
-             * @since 1.6.5
3187
-             * @param array $date_formats The PHP date format array.
3188
-             */
3189
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3190
-            ?>
3174
+			$date_formats = array(
3175
+				'm/d/Y',
3176
+				'd/m/Y',
3177
+				'Y/m/d',
3178
+				'm-d-Y',
3179
+				'd-m-Y',
3180
+				'Y-m-d',
3181
+				'F j, Y',
3182
+			);
3183
+			/**
3184
+			 * Filter the custom field date format options.
3185
+			 *
3186
+			 * @since 1.6.5
3187
+			 * @param array $date_formats The PHP date format array.
3188
+			 */
3189
+			$date_formats = apply_filters('geodir_date_formats',$date_formats);
3190
+			?>
3191 3191
             <select name="extra[date_format]" id="date_format">
3192 3192
                 <?php
3193
-                foreach($date_formats as $format){
3194
-                    $selected = '';
3195
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3196
-                        $selected = "selected='selected'";
3197
-                    }
3198
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3199
-                }
3200
-                ?>
3193
+				foreach($date_formats as $format){
3194
+					$selected = '';
3195
+					if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3196
+						$selected = "selected='selected'";
3197
+					}
3198
+					echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3199
+				}
3200
+				?>
3201 3201
             </select>
3202 3202
 
3203 3203
         </div>
3204 3204
     </li>
3205 3205
     <?php
3206 3206
 
3207
-    $html = ob_get_clean();
3208
-    return $output.$html;
3207
+	$html = ob_get_clean();
3208
+	return $output.$html;
3209 3209
 }
3210 3210
 add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3211 3211
 
3212 3212
 
3213 3213
 function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3214
-    ob_start();
3215
-    $allowed_file_types = geodir_allowed_mime_types();
3214
+	ob_start();
3215
+	$allowed_file_types = geodir_allowed_mime_types();
3216 3216
 
3217
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3218
-    $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3219
-    ?>
3217
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3218
+	$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3219
+	?>
3220 3220
     <li>
3221 3221
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3222 3222
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
@@ -3239,33 +3239,33 @@  discard block
 block discarded – undo
3239 3239
     </li>
3240 3240
     <?php
3241 3241
 
3242
-    $html = ob_get_clean();
3243
-    return $output.$html;
3242
+	$html = ob_get_clean();
3243
+	return $output.$html;
3244 3244
 }
3245 3245
 add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3246 3246
 
3247 3247
 function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
3248
-    ob_start();
3248
+	ob_start();
3249 3249
 
3250
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3250
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3251 3251
    // print_r($cf);echo '###';
3252 3252
 
3253 3253
 
3254 3254
 
3255
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
3255
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
3256 3256
 
3257 3257
 
3258
-    $value = '';
3259
-    if ($extra_fields && isset($extra_fields['is_price'])) {
3260
-    $value = esc_attr($extra_fields['is_price']);
3261
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3262
-    $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3263
-    }
3258
+	$value = '';
3259
+	if ($extra_fields && isset($extra_fields['is_price'])) {
3260
+	$value = esc_attr($extra_fields['is_price']);
3261
+	}elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3262
+	$value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3263
+	}
3264 3264
 
3265
-    $show_price_extra = ($value==1) ? 1 : 0;
3265
+	$show_price_extra = ($value==1) ? 1 : 0;
3266 3266
 
3267
-    $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0;
3268
-    ?>
3267
+	$show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0;
3268
+	?>
3269 3269
     <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
3270 3270
         <label for="is_price" class="gd-cf-tooltip-wrap">
3271 3271
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
@@ -3277,14 +3277,14 @@  discard block
 block discarded – undo
3277 3277
 
3278 3278
             <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled"  value="1"
3279 3279
                 <?php if ($value == '1') {
3280
-                    echo 'checked';
3281
-                } ?>/>
3280
+					echo 'checked';
3281
+				} ?>/>
3282 3282
             <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3283 3283
 
3284 3284
             <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0"
3285 3285
                 <?php if ($value == '0' || !$value) {
3286
-                    echo 'checked';
3287
-                } ?>/>
3286
+					echo 'checked';
3287
+				} ?>/>
3288 3288
             <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3289 3289
 
3290 3290
         </div>
@@ -3292,13 +3292,13 @@  discard block
 block discarded – undo
3292 3292
 
3293 3293
     <?php
3294 3294
 
3295
-    $value = '';
3296
-    if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3297
-        $value = esc_attr($extra_fields['thousand_separator']);
3298
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3299
-        $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3300
-    }
3301
-    ?>
3295
+	$value = '';
3296
+	if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3297
+		$value = esc_attr($extra_fields['thousand_separator']);
3298
+	}elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3299
+		$value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3300
+	}
3301
+	?>
3302 3302
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3303 3303
         <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
3304 3304
             <div class="gdcf-tooltip">
@@ -3319,13 +3319,13 @@  discard block
 block discarded – undo
3319 3319
 
3320 3320
     <?php
3321 3321
 
3322
-    $value = '';
3323
-    if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3324
-        $value = esc_attr($extra_fields['decimal_separator']);
3325
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3326
-        $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3327
-    }
3328
-    ?>
3322
+	$value = '';
3323
+	if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3324
+		$value = esc_attr($extra_fields['decimal_separator']);
3325
+	}elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3326
+		$value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3327
+	}
3328
+	?>
3329 3329
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3330 3330
         <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
3331 3331
             <div class="gdcf-tooltip">
@@ -3342,13 +3342,13 @@  discard block
 block discarded – undo
3342 3342
 
3343 3343
     <?php
3344 3344
 
3345
-    $value = '';
3346
-    if ($extra_fields && isset($extra_fields['decimal_display'])) {
3347
-        $value = esc_attr($extra_fields['decimal_display']);
3348
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3349
-        $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3350
-    }
3351
-    ?>
3345
+	$value = '';
3346
+	if ($extra_fields && isset($extra_fields['decimal_display'])) {
3347
+		$value = esc_attr($extra_fields['decimal_display']);
3348
+	}elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3349
+		$value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3350
+	}
3351
+	?>
3352 3352
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3353 3353
         <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
3354 3354
             <div class="gdcf-tooltip">
@@ -3365,13 +3365,13 @@  discard block
 block discarded – undo
3365 3365
 
3366 3366
     <?php
3367 3367
 
3368
-    $value = '';
3369
-    if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3370
-        $value = esc_attr($extra_fields['currency_symbol']);
3371
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3372
-        $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3373
-    }
3374
-    ?>
3368
+	$value = '';
3369
+	if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3370
+		$value = esc_attr($extra_fields['currency_symbol']);
3371
+	}elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3372
+		$value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3373
+	}
3374
+	?>
3375 3375
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3376 3376
         <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
3377 3377
             <div class="gdcf-tooltip">
@@ -3386,13 +3386,13 @@  discard block
 block discarded – undo
3386 3386
 
3387 3387
     <?php
3388 3388
 
3389
-    $value = '';
3390
-    if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3391
-        $value = esc_attr($extra_fields['currency_symbol_placement']);
3392
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3393
-        $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3394
-    }
3395
-    ?>
3389
+	$value = '';
3390
+	if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3391
+		$value = esc_attr($extra_fields['currency_symbol_placement']);
3392
+	}elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3393
+		$value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3394
+	}
3395
+	?>
3396 3396
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3397 3397
         <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
3398 3398
             <div class="gdcf-tooltip">
@@ -3410,225 +3410,225 @@  discard block
 block discarded – undo
3410 3410
 
3411 3411
     <?php
3412 3412
 
3413
-    $html = ob_get_clean();
3414
-    return $output.$html;
3413
+	$html = ob_get_clean();
3414
+	return $output.$html;
3415 3415
 }
3416 3416
 add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
3417 3417
 
3418 3418
 function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3419
-    $fields = array();
3420
-    $package = ($package_id=='') ? '' : array($package_id);
3421
-
3422
-    $fields[] = array('listing_type' => $post_type,
3423
-                      'data_type' => 'VARCHAR',
3424
-                      'field_type' => 'taxonomy',
3425
-                      'admin_title' => __('Category', 'geodirectory'),
3426
-                      'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3427
-                      'site_title' => __('Category', 'geodirectory'),
3428
-                      'htmlvar_name' => $post_type.'category',
3429
-                      'default_value' => '',
3430
-                      'is_default' => '1',
3431
-                      'is_admin' => '1',
3432
-                      'is_required' => '1',
3433
-                      'show_in'   =>  '[detail]',
3434
-                      'show_on_pkg' => $package,
3435
-                      'clabels' => __('Category', 'geodirectory'));
3436
-
3437
-    $fields[] = array('listing_type' => $post_type,
3438
-                      'data_type' => 'VARCHAR',
3439
-                      'field_type' => 'address',
3440
-                      'admin_title' => __('Address', 'geodirectory'),
3441
-                      'admin_desc' => ADDRESS_MSG,
3442
-                      'site_title' => __('Address', 'geodirectory'),
3443
-                      'htmlvar_name' => 'post',
3444
-                      'default_value' => '',
3445
-                      'option_values' => '',
3446
-                      'is_default' => '1',
3447
-                      'is_admin' => '1',
3448
-                      'is_required' => '1',
3449
-                      'show_in'   =>  '[detail],[mapbubble]',
3450
-                      'show_on_pkg' => $package,
3451
-                      'required_msg' => __('Address fields are required', 'geodirectory'),
3452
-                      'clabels' => __('Address', 'geodirectory'),
3453
-                      'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3454
-                                       'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3455
-                                       'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3456
-                                       'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3457
-                                       'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3458
-                                       'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3459
-                                       'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3460
-                                       'show_latlng' => 1));
3461
-
3462
-    $fields[] = array('listing_type' => $post_type,
3463
-                      'data_type' => 'VARCHAR',
3464
-                      'field_type' => 'text',
3465
-                      'admin_title' => __('Time', 'geodirectory'),
3466
-                      'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3467
-                      'site_title' => __('Time', 'geodirectory'),
3468
-                      'htmlvar_name' => 'timing',
3469
-                      'default_value' => '',
3470
-                      'option_values' => '',
3471
-                      'is_default' => '1',
3472
-                      'is_admin' => '1',
3473
-                      'show_in' =>  '[detail],[mapbubble]',
3474
-                      'show_on_pkg' => $package,
3475
-                      'clabels' => __('Time', 'geodirectory'));
3476
-
3477
-    $fields[] = array('listing_type' => $post_type,
3478
-                      'data_type' => 'VARCHAR',
3479
-                      'field_type' => 'phone',
3480
-                      'admin_title' => __('Phone', 'geodirectory'),
3481
-                      'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3482
-                      'site_title' => __('Phone', 'geodirectory'),
3483
-                      'htmlvar_name' => 'contact',
3484
-                      'default_value' => '',
3485
-                      'option_values' => '',
3486
-                      'is_default' => '1',
3487
-                      'is_admin' => '1',
3488
-                      'show_in' =>  '[detail],[mapbubble]',
3489
-                      'show_on_pkg' => $package,
3490
-                      'clabels' => __('Phone', 'geodirectory'));
3491
-
3492
-    $fields[] = array('listing_type' => $post_type,
3493
-                      'data_type' => 'VARCHAR',
3494
-                      'field_type' => 'email',
3495
-                      'admin_title' => __('Email', 'geodirectory'),
3496
-                      'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3497
-                      'site_title' => __('Email', 'geodirectory'),
3498
-                      'htmlvar_name' => 'email',
3499
-                      'default_value' => '',
3500
-                      'option_values' => '',
3501
-                      'is_default' => '1',
3502
-                      'is_admin' => '1',
3503
-                      'show_in' => '[detail]',
3504
-                      'show_on_pkg' => $package,
3505
-                      'clabels' => __('Email', 'geodirectory'));
3506
-
3507
-    $fields[] = array('listing_type' => $post_type,
3508
-                      'data_type' => 'VARCHAR',
3509
-                      'field_type' => 'url',
3510
-                      'admin_title' => __('Website', 'geodirectory'),
3511
-                      'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3512
-                      'site_title' => __('Website', 'geodirectory'),
3513
-                      'htmlvar_name' => 'website',
3514
-                      'default_value' => '',
3515
-                      'option_values' => '',
3516
-                      'is_default' => '1',
3517
-                      'is_admin' => '1',
3518
-                      'show_in' => '[detail]',
3519
-                      'show_on_pkg' => $package,
3520
-                      'clabels' => __('Website', 'geodirectory'));
3521
-
3522
-    $fields[] = array('listing_type' => $post_type,
3523
-                      'data_type' => 'VARCHAR',
3524
-                      'field_type' => 'url',
3525
-                      'admin_title' => __('Twitter', 'geodirectory'),
3526
-                      'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3527
-                      'site_title' => __('Twitter', 'geodirectory'),
3528
-                      'htmlvar_name' => 'twitter',
3529
-                      'default_value' => '',
3530
-                      'option_values' => '',
3531
-                      'is_default' => '1',
3532
-                      'is_admin' => '1',
3533
-                      'show_in' => '[detail]',
3534
-                      'show_on_pkg' => $package,
3535
-                      'clabels' => __('Twitter', 'geodirectory'));
3536
-
3537
-    $fields[] = array('listing_type' => $post_type,
3538
-                      'data_type' => 'VARCHAR',
3539
-                      'field_type' => 'url',
3540
-                      'admin_title' => __('Facebook', 'geodirectory'),
3541
-                      'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3542
-                      'site_title' => __('Facebook', 'geodirectory'),
3543
-                      'htmlvar_name' => 'facebook',
3544
-                      'default_value' => '',
3545
-                      'option_values' => '',
3546
-                      'is_default' => '1',
3547
-                      'is_admin' => '1',
3548
-                      'show_in' => '[detail]',
3549
-                      'show_on_pkg' => $package,
3550
-                      'clabels' => __('Facebook', 'geodirectory'));
3551
-
3552
-    $fields[] = array('listing_type' => $post_type,
3553
-                      'data_type' => 'TEXT',
3554
-                      'field_type' => 'textarea',
3555
-                      'admin_title' => __('Video', 'geodirectory'),
3556
-                      'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3557
-                      'site_title' => __('Video', 'geodirectory'),
3558
-                      'htmlvar_name' => 'video',
3559
-                      'default_value' => '',
3560
-                      'option_values' => '',
3561
-                      'is_default' => '0',
3562
-                      'is_admin' => '1',
3563
-                      'show_in' => '[owntab]',
3564
-                      'show_on_pkg' => $package,
3565
-                      'clabels' => __('Video', 'geodirectory'));
3566
-
3567
-    $fields[] = array('listing_type' => $post_type,
3568
-                      'data_type' => 'TEXT',
3569
-                      'field_type' => 'textarea',
3570
-                      'admin_title' => __('Special Offers', 'geodirectory'),
3571
-                      'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3572
-                      'site_title' => __('Special Offers', 'geodirectory'),
3573
-                      'htmlvar_name' => 'special_offers',
3574
-                      'default_value' => '',
3575
-                      'option_values' => '',
3576
-                      'is_default' => '0',
3577
-                      'is_admin' => '1',
3578
-                      'show_in' => '[owntab]',
3579
-                      'show_on_pkg' => $package,
3580
-                      'clabels' => __('Special Offers', 'geodirectory'));
3581
-
3582
-    /**
3583
-     * Filter the array of default custom fields DB table data.
3584
-     *
3585
-     * @since 1.6.6
3586
-     * @param string $fields The default custom fields as an array.
3587
-     */
3588
-    $fields = apply_filters('geodir_default_custom_fields', $fields);
3589
-
3590
-    return  $fields;
3419
+	$fields = array();
3420
+	$package = ($package_id=='') ? '' : array($package_id);
3421
+
3422
+	$fields[] = array('listing_type' => $post_type,
3423
+					  'data_type' => 'VARCHAR',
3424
+					  'field_type' => 'taxonomy',
3425
+					  'admin_title' => __('Category', 'geodirectory'),
3426
+					  'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3427
+					  'site_title' => __('Category', 'geodirectory'),
3428
+					  'htmlvar_name' => $post_type.'category',
3429
+					  'default_value' => '',
3430
+					  'is_default' => '1',
3431
+					  'is_admin' => '1',
3432
+					  'is_required' => '1',
3433
+					  'show_in'   =>  '[detail]',
3434
+					  'show_on_pkg' => $package,
3435
+					  'clabels' => __('Category', 'geodirectory'));
3436
+
3437
+	$fields[] = array('listing_type' => $post_type,
3438
+					  'data_type' => 'VARCHAR',
3439
+					  'field_type' => 'address',
3440
+					  'admin_title' => __('Address', 'geodirectory'),
3441
+					  'admin_desc' => ADDRESS_MSG,
3442
+					  'site_title' => __('Address', 'geodirectory'),
3443
+					  'htmlvar_name' => 'post',
3444
+					  'default_value' => '',
3445
+					  'option_values' => '',
3446
+					  'is_default' => '1',
3447
+					  'is_admin' => '1',
3448
+					  'is_required' => '1',
3449
+					  'show_in'   =>  '[detail],[mapbubble]',
3450
+					  'show_on_pkg' => $package,
3451
+					  'required_msg' => __('Address fields are required', 'geodirectory'),
3452
+					  'clabels' => __('Address', 'geodirectory'),
3453
+					  'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3454
+									   'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3455
+									   'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3456
+									   'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3457
+									   'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3458
+									   'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3459
+									   'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3460
+									   'show_latlng' => 1));
3461
+
3462
+	$fields[] = array('listing_type' => $post_type,
3463
+					  'data_type' => 'VARCHAR',
3464
+					  'field_type' => 'text',
3465
+					  'admin_title' => __('Time', 'geodirectory'),
3466
+					  'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3467
+					  'site_title' => __('Time', 'geodirectory'),
3468
+					  'htmlvar_name' => 'timing',
3469
+					  'default_value' => '',
3470
+					  'option_values' => '',
3471
+					  'is_default' => '1',
3472
+					  'is_admin' => '1',
3473
+					  'show_in' =>  '[detail],[mapbubble]',
3474
+					  'show_on_pkg' => $package,
3475
+					  'clabels' => __('Time', 'geodirectory'));
3476
+
3477
+	$fields[] = array('listing_type' => $post_type,
3478
+					  'data_type' => 'VARCHAR',
3479
+					  'field_type' => 'phone',
3480
+					  'admin_title' => __('Phone', 'geodirectory'),
3481
+					  'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3482
+					  'site_title' => __('Phone', 'geodirectory'),
3483
+					  'htmlvar_name' => 'contact',
3484
+					  'default_value' => '',
3485
+					  'option_values' => '',
3486
+					  'is_default' => '1',
3487
+					  'is_admin' => '1',
3488
+					  'show_in' =>  '[detail],[mapbubble]',
3489
+					  'show_on_pkg' => $package,
3490
+					  'clabels' => __('Phone', 'geodirectory'));
3491
+
3492
+	$fields[] = array('listing_type' => $post_type,
3493
+					  'data_type' => 'VARCHAR',
3494
+					  'field_type' => 'email',
3495
+					  'admin_title' => __('Email', 'geodirectory'),
3496
+					  'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3497
+					  'site_title' => __('Email', 'geodirectory'),
3498
+					  'htmlvar_name' => 'email',
3499
+					  'default_value' => '',
3500
+					  'option_values' => '',
3501
+					  'is_default' => '1',
3502
+					  'is_admin' => '1',
3503
+					  'show_in' => '[detail]',
3504
+					  'show_on_pkg' => $package,
3505
+					  'clabels' => __('Email', 'geodirectory'));
3506
+
3507
+	$fields[] = array('listing_type' => $post_type,
3508
+					  'data_type' => 'VARCHAR',
3509
+					  'field_type' => 'url',
3510
+					  'admin_title' => __('Website', 'geodirectory'),
3511
+					  'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3512
+					  'site_title' => __('Website', 'geodirectory'),
3513
+					  'htmlvar_name' => 'website',
3514
+					  'default_value' => '',
3515
+					  'option_values' => '',
3516
+					  'is_default' => '1',
3517
+					  'is_admin' => '1',
3518
+					  'show_in' => '[detail]',
3519
+					  'show_on_pkg' => $package,
3520
+					  'clabels' => __('Website', 'geodirectory'));
3521
+
3522
+	$fields[] = array('listing_type' => $post_type,
3523
+					  'data_type' => 'VARCHAR',
3524
+					  'field_type' => 'url',
3525
+					  'admin_title' => __('Twitter', 'geodirectory'),
3526
+					  'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3527
+					  'site_title' => __('Twitter', 'geodirectory'),
3528
+					  'htmlvar_name' => 'twitter',
3529
+					  'default_value' => '',
3530
+					  'option_values' => '',
3531
+					  'is_default' => '1',
3532
+					  'is_admin' => '1',
3533
+					  'show_in' => '[detail]',
3534
+					  'show_on_pkg' => $package,
3535
+					  'clabels' => __('Twitter', 'geodirectory'));
3536
+
3537
+	$fields[] = array('listing_type' => $post_type,
3538
+					  'data_type' => 'VARCHAR',
3539
+					  'field_type' => 'url',
3540
+					  'admin_title' => __('Facebook', 'geodirectory'),
3541
+					  'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3542
+					  'site_title' => __('Facebook', 'geodirectory'),
3543
+					  'htmlvar_name' => 'facebook',
3544
+					  'default_value' => '',
3545
+					  'option_values' => '',
3546
+					  'is_default' => '1',
3547
+					  'is_admin' => '1',
3548
+					  'show_in' => '[detail]',
3549
+					  'show_on_pkg' => $package,
3550
+					  'clabels' => __('Facebook', 'geodirectory'));
3551
+
3552
+	$fields[] = array('listing_type' => $post_type,
3553
+					  'data_type' => 'TEXT',
3554
+					  'field_type' => 'textarea',
3555
+					  'admin_title' => __('Video', 'geodirectory'),
3556
+					  'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3557
+					  'site_title' => __('Video', 'geodirectory'),
3558
+					  'htmlvar_name' => 'video',
3559
+					  'default_value' => '',
3560
+					  'option_values' => '',
3561
+					  'is_default' => '0',
3562
+					  'is_admin' => '1',
3563
+					  'show_in' => '[owntab]',
3564
+					  'show_on_pkg' => $package,
3565
+					  'clabels' => __('Video', 'geodirectory'));
3566
+
3567
+	$fields[] = array('listing_type' => $post_type,
3568
+					  'data_type' => 'TEXT',
3569
+					  'field_type' => 'textarea',
3570
+					  'admin_title' => __('Special Offers', 'geodirectory'),
3571
+					  'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3572
+					  'site_title' => __('Special Offers', 'geodirectory'),
3573
+					  'htmlvar_name' => 'special_offers',
3574
+					  'default_value' => '',
3575
+					  'option_values' => '',
3576
+					  'is_default' => '0',
3577
+					  'is_admin' => '1',
3578
+					  'show_in' => '[owntab]',
3579
+					  'show_on_pkg' => $package,
3580
+					  'clabels' => __('Special Offers', 'geodirectory'));
3581
+
3582
+	/**
3583
+	 * Filter the array of default custom fields DB table data.
3584
+	 *
3585
+	 * @since 1.6.6
3586
+	 * @param string $fields The default custom fields as an array.
3587
+	 */
3588
+	$fields = apply_filters('geodir_default_custom_fields', $fields);
3589
+
3590
+	return  $fields;
3591 3591
 }
3592 3592
 
3593 3593
 function geodir_currency_format_number($number='',$cf=''){
3594 3594
 
3595
-    $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3595
+	$cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3596 3596
 
3597
-    $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$';
3598
-    $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2;
3599
-    $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if';
3600
-    $decimalpoint = '.';
3597
+	$symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$';
3598
+	$decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2;
3599
+	$decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if';
3600
+	$decimalpoint = '.';
3601 3601
 
3602
-    if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3603
-        $decimalpoint = ',';
3604
-    }
3602
+	if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3603
+		$decimalpoint = ',';
3604
+	}
3605 3605
 
3606
-    $separator = ',';
3606
+	$separator = ',';
3607 3607
 
3608
-    if(isset($cs['thousand_separator'])){
3609
-        if($cs['thousand_separator']=='comma'){$separator = ',';}
3610
-        if($cs['thousand_separator']=='slash'){$separator = '\\';}
3611
-        if($cs['thousand_separator']=='period'){$separator = '.';}
3612
-        if($cs['thousand_separator']=='space'){$separator = ' ';}
3613
-        if($cs['thousand_separator']=='none'){$separator = '';}
3614
-    }
3608
+	if(isset($cs['thousand_separator'])){
3609
+		if($cs['thousand_separator']=='comma'){$separator = ',';}
3610
+		if($cs['thousand_separator']=='slash'){$separator = '\\';}
3611
+		if($cs['thousand_separator']=='period'){$separator = '.';}
3612
+		if($cs['thousand_separator']=='space'){$separator = ' ';}
3613
+		if($cs['thousand_separator']=='none'){$separator = '';}
3614
+	}
3615 3615
 
3616
-    $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3616
+	$currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3617 3617
 
3618
-    if($decimals>0 && $decimal_display=='if'){
3619
-        if(is_int($number) || floor( $number ) == $number)
3620
-            $decimals = 0;
3621
-    }
3618
+	if($decimals>0 && $decimal_display=='if'){
3619
+		if(is_int($number) || floor( $number ) == $number)
3620
+			$decimals = 0;
3621
+	}
3622 3622
 
3623
-    $number = number_format($number,$decimals,$decimalpoint,$separator);
3623
+	$number = number_format($number,$decimals,$decimalpoint,$separator);
3624 3624
 
3625 3625
 
3626 3626
 
3627
-    if($currency_symbol_placement=='left'){
3628
-        $number = $symbol . $number;
3629
-    }else{
3630
-        $number = $number . $symbol;
3631
-    }
3627
+	if($currency_symbol_placement=='left'){
3628
+		$number = $symbol . $number;
3629
+	}else{
3630
+		$number = $number . $symbol;
3631
+	}
3632 3632
 
3633 3633
 
3634 3634
    return $number;
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 1 patch
Spacing   +631 added lines, -631 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 ( mb_strlen( $excerpt ) > $charlength ) {
107
-		if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( mb_strlen( $excerpt_more ) );
109
-			$subex = mb_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && mb_strlen( $subex ) > $charlength ) {
111
-				$subex = mb_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (mb_strlen($excerpt) > $charlength) {
107
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (mb_strlen($excerpt_more));
109
+			$subex = mb_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && mb_strlen($subex) > $charlength) {
111
+				$subex = mb_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = mb_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= mb_substr( $subex, 0, $excut );
115
+			$subex   = mb_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (mb_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= mb_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 ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( mb_strlen( $excerpt_more ) );
136
-			$out .= mb_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (mb_strlen($excerpt_more));
136
+			$out .= mb_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      = $request['inq_name'];
230 230
 	$youremail     = $request['inq_email'];
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
 	$author_id  = '';
236 236
 	$post_title = '';
237 237
 
238
-	if ( $request['pid'] ) {
238
+	if ($request['pid']) {
239 239
 
240 240
 		$productinfosql = $wpdb->prepare(
241 241
 			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
242
-			array( $request['pid'] )
242
+			array($request['pid'])
243 243
 		);
244
-		$productinfo    = $wpdb->get_row( $productinfosql );
244
+		$productinfo = $wpdb->get_row($productinfosql);
245 245
 
246 246
 		$author_id  = $productinfo->post_author;
247 247
 		$post_title = $productinfo->post_title;
248 248
 	}
249 249
 
250
-	$post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>';
250
+	$post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>';
251 251
 
252
-	$user_info = get_userdata( $author_id );
253
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
254
-	$to_name   = geodir_get_client_name( $author_id );
252
+	$user_info = get_userdata($author_id);
253
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
254
+	$to_name   = geodir_get_client_name($author_id);
255 255
 
256
-	if ( $to_email == '' ) {
257
-		$to_email = get_option( 'admin_email' );
256
+	if ($to_email == '') {
257
+		$to_email = get_option('admin_email');
258 258
 	}
259 259
 
260 260
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 * }
276 276
 	 * @param string $type     The form type, default: `Enquiry`.
277 277
 	 */
278
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
278
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
279 279
 
280 280
 	$client_message = $frnd_comments;
281
-	$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>.';
281
+	$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>.';
282 282
 	/**
283 283
 	 * Filter client message text.
284 284
 	 *
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @param string $client_message Client message text.
288 288
 	 */
289
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
289
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
290 290
 
291 291
 	/**
292 292
 	 * Called before the send enquiry email is sent.
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * }
307 307
 	 */
308
-	do_action( 'geodir_before_send_enquiry_email', $request );
309
-	if ( $to_email ) {
308
+	do_action('geodir_before_send_enquiry_email', $request);
309
+	if ($to_email) {
310 310
 		// strip slashes message
311
-		$client_message = stripslashes_deep( $client_message );
311
+		$client_message = stripslashes_deep($client_message);
312 312
 
313
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
313
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
314 314
 	}
315 315
 
316 316
 	/**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * }
332 332
 	 */
333
-	do_action( 'geodir_after_send_enquiry_email', $request );
334
-	$url = get_permalink( $pid );
335
-	if ( strstr( $url, '?' ) ) {
336
-		$url = $url . "&send_inquiry=success";
333
+	do_action('geodir_after_send_enquiry_email', $request);
334
+	$url = get_permalink($pid);
335
+	if (strstr($url, '?')) {
336
+		$url = $url."&send_inquiry=success";
337 337
 	} else {
338
-		$url = $url . "?send_inquiry=success";
338
+		$url = $url."?send_inquiry=success";
339 339
 	}
340 340
 	/**
341 341
 	 * Filter redirect url after the send enquiry email is sent.
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $url Redirect url.
346 346
 	 */
347
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
348
-	wp_redirect( $url );
347
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
348
+	wp_redirect($url);
349 349
 	gd_die();
350 350
 
351 351
 }
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
  * }
375 375
  * @global object $wpdb        WordPress Database object.
376 376
  */
377
-function geodir_send_friend( $request ) {
377
+function geodir_send_friend($request) {
378 378
 	global $wpdb;
379 379
 
380 380
 	// strip slashes from text
381
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
381
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
382 382
 
383 383
 	$yourname      = $request['yourname'];
384 384
 	$youremail     = $request['youremail'];
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	$pid           = $request['pid'];
388 388
 	$to_email      = $request['to_email'];
389 389
 	$to_name       = $request['to_name'];
390
-	if ( $request['pid'] ) {
390
+	if ($request['pid']) {
391 391
 		$productinfosql = $wpdb->prepare(
392 392
 			"select ID,post_title from $wpdb->posts where ID =%d",
393
-			array( $request['pid'] )
393
+			array($request['pid'])
394 394
 		);
395
-		$productinfo    = $wpdb->get_results( $productinfosql );
396
-		foreach ( $productinfo as $productinfoObj ) {
395
+		$productinfo = $wpdb->get_results($productinfosql);
396
+		foreach ($productinfo as $productinfoObj) {
397 397
 			$post_title = $productinfoObj->post_title;
398 398
 		}
399 399
 	}
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * }
419 419
 	 */
420
-	do_action( 'geodir_before_send_to_friend_email', $request );
421
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
420
+	do_action('geodir_before_send_to_friend_email', $request);
421
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
422 422
 
423 423
 	/**
424 424
 	 * Called after the send to friend email is sent.
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * }
441 441
 	 */
442
-	do_action( 'geodir_after_send_to_friend_email', $request );
442
+	do_action('geodir_after_send_to_friend_email', $request);
443 443
 
444
-	$url = get_permalink( $pid );
445
-	if ( strstr( $url, '?' ) ) {
446
-		$url = $url . "&sendtofrnd=success";
444
+	$url = get_permalink($pid);
445
+	if (strstr($url, '?')) {
446
+		$url = $url."&sendtofrnd=success";
447 447
 	} else {
448
-		$url = $url . "?sendtofrnd=success";
448
+		$url = $url."?sendtofrnd=success";
449 449
 	}
450 450
 	/**
451 451
 	 * Filter redirect url after the send to friend email is sent.
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param string $url Redirect url.
456 456
 	 */
457
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
458
-	wp_redirect( $url );
457
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
458
+	wp_redirect($url);
459 459
 	gd_die();
460 460
 }
461 461
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
  *
470 470
  * @param string $hash_key
471 471
  */
472
-function geodir_before_tab_content( $hash_key ) {
473
-	switch ( $hash_key ) {
472
+function geodir_before_tab_content($hash_key) {
473
+	switch ($hash_key) {
474 474
 		case 'post_info' :
475 475
 			echo '<div class="geodir-company_info field-group">';
476 476
 			break;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			 *
481 481
 			 * @since 1.0.0
482 482
 			 */
483
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
483
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
484 484
 			break;
485 485
 		case 'reviews' :
486 486
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @param string $hash_key
506 506
  */
507
-function geodir_after_tab_content( $hash_key ) {
508
-	switch ( $hash_key ) {
507
+function geodir_after_tab_content($hash_key) {
508
+	switch ($hash_key) {
509 509
 		case 'post_info' :
510 510
 			echo '</div>';
511 511
 			break;
@@ -536,25 +536,25 @@  discard block
 block discarded – undo
536 536
  * @global object $wpdb     WordPress Database object.
537 537
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
538 538
  */
539
-function geodir_get_posts_default_sort( $post_type ) {
539
+function geodir_get_posts_default_sort($post_type) {
540 540
 
541 541
 	global $wpdb;
542 542
 
543
-	if ( $post_type != '' ) {
543
+	if ($post_type != '') {
544 544
 
545 545
 		$all_postypes = geodir_get_posttypes();
546 546
 
547
-		if ( ! in_array( $post_type, $all_postypes ) ) {
547
+		if (!in_array($post_type, $all_postypes)) {
548 548
 			return false;
549 549
 		}
550 550
 
551
-		$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(
551
+		$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(
552 552
 			$post_type,
553 553
 			1,
554 554
 			1
555
-		) ) );
555
+		)));
556 556
 
557
-		if ( ! empty( $sort_field_info ) ) {
557
+		if (!empty($sort_field_info)) {
558 558
 			return $sort_field_info;
559 559
 		}
560 560
 
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
  * @global object $wpdb     WordPress Database object.
575 575
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
576 576
  */
577
-function geodir_get_sort_options( $post_type ) {
577
+function geodir_get_sort_options($post_type) {
578 578
 	global $wpdb;
579 579
 
580
-	if ( $post_type != '' ) {
580
+	if ($post_type != '') {
581 581
 		$all_postypes = geodir_get_posttypes();
582 582
 
583
-		if ( ! in_array( $post_type, $all_postypes ) ) {
583
+		if (!in_array($post_type, $all_postypes)) {
584 584
 			return false;
585 585
 		}
586 586
 
587
-		$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(
587
+		$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(
588 588
 			$post_type,
589 589
 			1
590
-		) ) );
590
+		)));
591 591
 
592 592
 		/**
593 593
 		 * Filter post sort options.
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		 * @param array $sort_field_info Unfiltered sort field array.
598 598
 		 * @param string $post_type      Post type.
599 599
 		 */
600
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
600
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
601 601
 	}
602 602
 
603 603
 }
@@ -618,63 +618,63 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.4.4
620 620
 	 */
621
-	if ( is_search() ) {
621
+	if (is_search()) {
622 622
 		return;
623 623
 	}
624 624
 
625 625
 	$sort_by = '';
626 626
 
627
-	if ( isset( $_REQUEST['sort_by'] ) ) {
627
+	if (isset($_REQUEST['sort_by'])) {
628 628
 		$sort_by = $_REQUEST['sort_by'];
629 629
 	}
630 630
 
631 631
 	$gd_post_type = geodir_get_current_posttype();
632 632
 
633
-	$sort_options = geodir_get_sort_options( $gd_post_type );
633
+	$sort_options = geodir_get_sort_options($gd_post_type);
634 634
 
635 635
 
636 636
 	$sort_field_options = '';
637 637
 
638
-	if ( ! empty( $sort_options ) ) {
639
-		foreach ( $sort_options as $sort ) {
640
-			$sort = stripslashes_deep( $sort ); // strip slashes
638
+	if (!empty($sort_options)) {
639
+		foreach ($sort_options as $sort) {
640
+			$sort = stripslashes_deep($sort); // strip slashes
641 641
 
642
-			$label = __( $sort->site_title, 'geodirectory' );
642
+			$label = __($sort->site_title, 'geodirectory');
643 643
 
644
-			if ( $sort->field_type == 'random' ) {
644
+			if ($sort->field_type == 'random') {
645 645
 				$key = $sort->field_type;
646
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
647
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
646
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
647
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
648 648
 			}
649 649
 
650
-			if ( $sort->htmlvar_name == 'comment_count' ) {
650
+			if ($sort->htmlvar_name == 'comment_count') {
651 651
 				$sort->htmlvar_name = 'rating_count';
652 652
 			}
653 653
 
654
-			if ( $sort->sort_asc ) {
655
-				$key   = $sort->htmlvar_name . '_asc';
654
+			if ($sort->sort_asc) {
655
+				$key   = $sort->htmlvar_name.'_asc';
656 656
 				$label = $sort->site_title;
657
-				if ( $sort->asc_title ) {
657
+				if ($sort->asc_title) {
658 658
 					$label = $sort->asc_title;
659 659
 				}
660
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
661
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
660
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
661
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
662 662
 			}
663 663
 
664
-			if ( $sort->sort_desc ) {
665
-				$key   = $sort->htmlvar_name . '_desc';
664
+			if ($sort->sort_desc) {
665
+				$key   = $sort->htmlvar_name.'_desc';
666 666
 				$label = $sort->site_title;
667
-				if ( $sort->desc_title ) {
667
+				if ($sort->desc_title) {
668 668
 					$label = $sort->desc_title;
669 669
 				}
670
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
671
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
670
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
671
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
672 672
 			}
673 673
 
674 674
 		}
675 675
 	}
676 676
 
677
-	if ( $sort_field_options != '' ) {
677
+	if ($sort_field_options != '') {
678 678
 
679 679
 		?>
680 680
 
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
684 684
 
685 685
 				<option
686
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
686
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
687 687
 					echo 'selected="selected"';
688
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
688
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
689 689
 
690 690
 				echo $sort_field_options; ?>
691 691
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @return string Returns the section title.
715 715
  */
716
-function geodir_advance_customfields_heading( $title, $field_type ) {
716
+function geodir_advance_customfields_heading($title, $field_type) {
717 717
 
718
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
718
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
719 719
 		$title = '';
720 720
 	}
721 721
 
@@ -737,19 +737,19 @@  discard block
 block discarded – undo
737 737
  * @global object $gd_session       GeoDirectory Session object.
738 738
  * @return string Returns related posts html.
739 739
  */
740
-function geodir_related_posts_display( $request ) {
741
-	if ( ! empty( $request ) ) {
742
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
743
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
744
-
745
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
746
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
747
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
748
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
749
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
750
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
751
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
752
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
740
+function geodir_related_posts_display($request) {
741
+	if (!empty($request)) {
742
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
743
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
744
+
745
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
746
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
747
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
748
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
749
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
750
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
751
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
752
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
753 753
 
754 754
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
755 755
 		$related_parent_lat   = $post->post_latitude;
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
758 758
 
759 759
 		$related_listing_array = array();
760
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
761
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
760
+		if (get_option('geodir_add_related_listing_posttypes')) {
761
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
762 762
 		}
763
-		if ( in_array( $post->post_type, $related_listing_array ) ) {
763
+		if (in_array($post->post_type, $related_listing_array)) {
764 764
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
765 765
 		}
766 766
 
@@ -772,90 +772,90 @@  discard block
 block discarded – undo
772 772
 		$tax_field         = 'id';
773 773
 		$category          = array();
774 774
 
775
-		if ( isset( $_REQUEST['backandedit'] ) ) {
776
-			$post      = (object) $gd_session->get( 'listing' );
775
+		if (isset($_REQUEST['backandedit'])) {
776
+			$post      = (object) $gd_session->get('listing');
777 777
 			$post_type = $post->listing_type;
778
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
778
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
779 779
 				$post_id = $_REQUEST['pid'];
780 780
 			}
781
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
782
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
781
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
782
+			$post      = geodir_get_post_info($_REQUEST['pid']);
783 783
 			$post_type = $post->post_type;
784 784
 			$post_id   = $_REQUEST['pid'];
785
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
785
+		} elseif (isset($post->post_type) && $post->post_type != '') {
786 786
 			$post_type = $post->post_type;
787 787
 			$post_id   = $post->ID;
788 788
 		}
789 789
 
790
-		if ( $relate_to == 'category' ) {
790
+		if ($relate_to == 'category') {
791 791
 
792
-			$category_taxonomy = $post_type . $relate_to;
793
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
794
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
792
+			$category_taxonomy = $post_type.$relate_to;
793
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
794
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
795 795
 			}
796 796
 
797
-		} elseif ( $relate_to == 'tags' ) {
797
+		} elseif ($relate_to == 'tags') {
798 798
 
799
-			$category_taxonomy = $post_type . '_' . $relate_to;
800
-			if ( $post->post_tags != '' ) {
801
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
799
+			$category_taxonomy = $post_type.'_'.$relate_to;
800
+			if ($post->post_tags != '') {
801
+				$category = explode(',', trim($post->post_tags, ','));
802 802
 			}
803 803
 			$tax_field = 'name';
804 804
 		}
805 805
 
806 806
 		/* --- return false in invalid request --- */
807
-		if ( empty( $category ) ) {
807
+		if (empty($category)) {
808 808
 			return false;
809 809
 		}
810 810
 
811 811
 		$all_postypes = geodir_get_posttypes();
812 812
 
813
-		if ( ! in_array( $post_type, $all_postypes ) ) {
813
+		if (!in_array($post_type, $all_postypes)) {
814 814
 			return false;
815 815
 		}
816 816
 
817 817
 		/* --- return false in invalid request --- */
818 818
 
819 819
 		$location_url = '';
820
-		if ( $add_location_filter != '0' ) {
820
+		if ($add_location_filter != '0') {
821 821
 			$location_url             = array();
822
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
822
+			$geodir_show_location_url = get_option('geodir_show_location_url');
823 823
 
824
-			$gd_city = get_query_var( 'gd_city' );
824
+			$gd_city = get_query_var('gd_city');
825 825
 
826
-			if ( $gd_city ) {
827
-				$gd_country = get_query_var( 'gd_country' );
828
-				$gd_region  = get_query_var( 'gd_region' );
826
+			if ($gd_city) {
827
+				$gd_country = get_query_var('gd_country');
828
+				$gd_region  = get_query_var('gd_region');
829 829
 			} else {
830 830
 				$location = geodir_get_default_location();
831 831
 
832
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
833
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
834
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
832
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
833
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
834
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
835 835
 			}
836 836
 
837
-			if ( $geodir_show_location_url == 'all' ) {
837
+			if ($geodir_show_location_url == 'all') {
838 838
 				$location_url[] = $gd_country;
839 839
 				$location_url[] = $gd_region;
840
-			} else if ( $geodir_show_location_url == 'country_city' ) {
840
+			} else if ($geodir_show_location_url == 'country_city') {
841 841
 				$location_url[] = $gd_country;
842
-			} else if ( $geodir_show_location_url == 'region_city' ) {
842
+			} else if ($geodir_show_location_url == 'region_city') {
843 843
 				$location_url[] = $gd_region;
844 844
 			}
845 845
 
846 846
 			$location_url[] = $gd_city;
847 847
 
848
-			$location_url = implode( '/', $location_url );
848
+			$location_url = implode('/', $location_url);
849 849
 		}
850 850
 
851 851
 
852
-		if ( ! empty( $category ) ) {
852
+		if (!empty($category)) {
853 853
 			global $geodir_add_location_url;
854 854
 			$geodir_add_location_url = '0';
855
-			if ( $add_location_filter != '0' ) {
855
+			if ($add_location_filter != '0') {
856 856
 				$geodir_add_location_url = '1';
857 857
 			}
858
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
858
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
859 859
 			$geodir_add_location_url = null;
860 860
 		}
861 861
 		ob_start();
@@ -865,24 +865,24 @@  discard block
 block discarded – undo
865 865
 		<div class="geodir_locations geodir_location_listing">
866 866
 
867 867
 			<?php
868
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
868
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
869 869
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
870
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
870
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
871 871
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
872
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
872
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
873 873
 				?>
874 874
 				<div class="location_list_heading clearfix">
875
-					<?php echo $before_title . $title . $after_title; ?>
875
+					<?php echo $before_title.$title.$after_title; ?>
876 876
 				</div>
877 877
 				<?php
878 878
 			}
879 879
 			$query_args = array(
880 880
 				'posts_per_page'   => $post_number,
881 881
 				'is_geodir_loop'   => true,
882
-				'gd_location'      => ( $add_location_filter ) ? true : false,
882
+				'gd_location'      => ($add_location_filter) ? true : false,
883 883
 				'post_type'        => $post_type,
884 884
 				'order_by'         => $list_sort,
885
-				'post__not_in'     => array( $post_id ),
885
+				'post__not_in'     => array($post_id),
886 886
 				'excerpt_length'   => $character_count,
887 887
 				'related_listings' => $is_display
888 888
 			);
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 				'terms'    => $category
894 894
 			);
895 895
 
896
-			$query_args['tax_query'] = array( $tax_query );
896
+			$query_args['tax_query'] = array($tax_query);
897 897
 
898 898
 			global $gridview_columns, $post;
899 899
 
@@ -905,21 +905,21 @@  discard block
 block discarded – undo
905 905
 			 * @param array $query_args The query array.
906 906
 			 * @param array $request Related posts request array.
907 907
 			 */
908
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
908
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
909 909
 
910
-			query_posts( $query_args );
910
+			query_posts($query_args);
911 911
 
912
-			if ( strstr( $layout, 'gridview' ) ) {
913
-				$listing_view_exp = explode( '_', $layout );
912
+			if (strstr($layout, 'gridview')) {
913
+				$listing_view_exp = explode('_', $layout);
914 914
 				$gridview_columns = $layout;
915 915
 				$layout           = $listing_view_exp[0];
916
-			} else if ( $layout == 'list' ) {
916
+			} else if ($layout == 'list') {
917 917
 				$gridview_columns = '';
918 918
 			}
919 919
 			$related_posts = true;
920 920
 
921 921
 			$related_nearest = false;
922
-			if ( $list_sort == 'nearest' ) {
922
+			if ($list_sort == 'nearest') {
923 923
 				$related_nearest = true;
924 924
 			}
925 925
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 			 *
930 930
 			 * @since 1.0.0
931 931
 			 */
932
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) );
932
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
933 933
 
934 934
 			/**
935 935
 			 * Includes related listing listview template.
936 936
 			 *
937 937
 			 * @since 1.0.0
938 938
 			 */
939
-			include( $template );
939
+			include($template);
940 940
 
941 941
 			wp_reset_query();
942 942
 			$post            = $origi_post;
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 function geodir_category_count_script() {
965 965
 	global $geodir_post_category_str;
966 966
 
967
-	if ( ! empty( $geodir_post_category_str ) ) {
968
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
967
+	if (!empty($geodir_post_category_str)) {
968
+		$geodir_post_category_str = serialize($geodir_post_category_str);
969 969
 	}
970 970
 
971
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
972
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
971
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
972
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
973 973
 	echo '<script>';
974 974
 	echo $script;
975 975
 	echo '</script>';
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
  * @return string Returns the default language.
985 985
  */
986 986
 function geodir_get_map_default_language() {
987
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
988
-	if ( empty( $geodir_default_map_language ) ) {
987
+	$geodir_default_map_language = get_option('geodir_default_map_language');
988
+	if (empty($geodir_default_map_language)) {
989 989
 		$geodir_default_map_language = 'en';
990 990
 	}
991 991
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @param string $geodir_default_map_language Default map language.
998 998
 	 */
999
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
999
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
1000 1000
 }
1001 1001
 
1002 1002
 /**
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
  * @return string Returns the api key.
1008 1008
  */
1009 1009
 function geodir_get_map_api_key() {
1010
-	$key = get_option( 'geodir_google_api_key' );
1010
+	$key = get_option('geodir_google_api_key');
1011 1011
 
1012 1012
 	/**
1013 1013
 	 * Filter Google maps api key.
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	 *
1017 1017
 	 * @param string $key Google maps api key.
1018 1018
 	 */
1019
-	return apply_filters( 'geodir_google_api_key', $key );
1019
+	return apply_filters('geodir_google_api_key', $key);
1020 1020
 }
1021 1021
 
1022 1022
 
@@ -1035,20 +1035,20 @@  discard block
 block discarded – undo
1035 1035
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1036 1036
 
1037 1037
 	$is_geodir_page = geodir_is_geodir_page();
1038
-	if ( ! $is_geodir_page ) {
1038
+	if (!$is_geodir_page) {
1039 1039
 		return;
1040 1040
 	}// if non GD page, bail
1041 1041
 
1042 1042
 	$use_gd_meta = true;
1043
-	if ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) {
1043
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1044 1044
 		$use_gd_meta = false;
1045 1045
 
1046
-		if ( geodir_is_page( 'search' ) ) {
1046
+		if (geodir_is_page('search')) {
1047 1047
 			$use_gd_meta = true;
1048 1048
 		}
1049 1049
 	}
1050 1050
 
1051
-	if ( ! $use_gd_meta ) {
1051
+	if (!$use_gd_meta) {
1052 1052
 		return;
1053 1053
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1054 1054
 
@@ -1056,170 +1056,170 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 	$all_postypes = geodir_get_posttypes();
1058 1058
 
1059
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1059
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1060 1060
 
1061 1061
 	$meta_desc = '';
1062 1062
 	$meta_key  = '';
1063
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1063
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1064 1064
 		/**
1065 1065
 		 * Filter SEO meta location description.
1066 1066
 		 *
1067 1067
 		 * @since 1.0.0
1068 1068
 		 */
1069
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1069
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1070 1070
 		$meta_desc .= '';
1071 1071
 	}
1072
-	if ( have_posts() && is_single() OR is_page() ) {
1073
-		while ( have_posts() ) {
1072
+	if (have_posts() && is_single() OR is_page()) {
1073
+		while (have_posts()) {
1074 1074
 			the_post();
1075 1075
 
1076
-			if ( has_excerpt() ) {
1077
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1078
-				if ( empty( $out_excerpt ) ) {
1079
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1076
+			if (has_excerpt()) {
1077
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1078
+				if (empty($out_excerpt)) {
1079
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1080 1080
 				}
1081
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1081
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1082 1082
 			} else {
1083
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1084
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1085
-				if ( empty( $out_excerpt ) ) {
1086
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1083
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1084
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1085
+				if (empty($out_excerpt)) {
1086
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1087 1087
 				}
1088
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1088
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1089 1089
 			}
1090 1090
 
1091 1091
 			$meta_desc .= $out_excerpt;
1092 1092
 		}
1093
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1094
-		if ( is_category() ) {
1095
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) );
1096
-		} elseif ( is_tag() ) {
1097
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) );
1093
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1094
+		if (is_category()) {
1095
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false));
1096
+		} elseif (is_tag()) {
1097
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false));
1098 1098
 		}
1099
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1100
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1099
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1100
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1101 1101
 	}
1102 1102
 
1103 1103
 
1104 1104
 	$geodir_post_type       = geodir_get_current_posttype();
1105
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1106
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1107
-
1108
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1109
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1110
-
1111
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1112
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1113
-
1114
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1115
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1116
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1117
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1118
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1119
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1120
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1121
-	$replace_location        = __( 'Everywhere', 'geodirectory' );
1105
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1106
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1107
+
1108
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1109
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1110
+
1111
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1112
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1113
+
1114
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1115
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1116
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1117
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1118
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1119
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1120
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1121
+	$replace_location        = __('Everywhere', 'geodirectory');
1122 1122
 	$location_id             = null;
1123
-	if ( $geodir_location_manager ) {
1124
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1125
-		$location_id   = (int) $wpdb->get_var( $sql );
1123
+	if ($geodir_location_manager) {
1124
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1125
+		$location_id   = (int) $wpdb->get_var($sql);
1126 1126
 		$location_type = geodir_what_is_current_location();
1127
-		if ( $location_type == 'city' ) {
1128
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1129
-		} elseif ( $location_type == 'region' ) {
1130
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1131
-		} elseif ( $location_type == 'country' ) {
1132
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1133
-			$replace_location = __( $replace_location, 'geodirectory' );
1127
+		if ($location_type == 'city') {
1128
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1129
+		} elseif ($location_type == 'region') {
1130
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1131
+		} elseif ($location_type == 'country') {
1132
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1133
+			$replace_location = __($replace_location, 'geodirectory');
1134 1134
 		}
1135
-		$country          = get_query_var( 'gd_country' );
1136
-		$region           = get_query_var( 'gd_region' );
1137
-		$city             = get_query_var( 'gd_city' );
1135
+		$country          = get_query_var('gd_country');
1136
+		$region           = get_query_var('gd_region');
1137
+		$city             = get_query_var('gd_city');
1138 1138
 		$current_location = '';
1139
-		if ( $country != '' ) {
1140
-			$current_location = get_actual_location_name( 'country', $country, true );
1139
+		if ($country != '') {
1140
+			$current_location = get_actual_location_name('country', $country, true);
1141 1141
 		}
1142
-		if ( $region != '' ) {
1143
-			$current_location = get_actual_location_name( 'region', $region );
1142
+		if ($region != '') {
1143
+			$current_location = get_actual_location_name('region', $region);
1144 1144
 		}
1145
-		if ( $city != '' ) {
1146
-			$current_location = get_actual_location_name( 'city', $city );
1145
+		if ($city != '') {
1146
+			$current_location = get_actual_location_name('city', $city);
1147 1147
 		}
1148 1148
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1149 1149
 	}
1150 1150
 
1151 1151
 	$geodir_meta_keys = '';
1152 1152
 	$geodir_meta_desc = '';
1153
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1154
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1155
-			$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;
1153
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1154
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1155
+			$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;
1156 1156
 
1157
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1158
-			$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;
1157
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1158
+			$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;
1159 1159
 
1160
-			if ( $geodir_is_category ) {
1161
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1162
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1160
+			if ($geodir_is_category) {
1161
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1162
+				if (isset($category->term_id) && !empty($category->term_id)) {
1163 1163
 					$category_id   = $category->term_id;
1164
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1165
-					if ( $location_id ) {
1166
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1167
-						$cat_loc_option = get_option( $option_name );
1168
-
1169
-						$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;
1170
-						if ( ! $gd_cat_loc_default ) {
1171
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1172
-							$option        = get_option( $option_name );
1173
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1164
+					$category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1165
+					if ($location_id) {
1166
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1167
+						$cat_loc_option = get_option($option_name);
1168
+
1169
+						$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;
1170
+						if (!$gd_cat_loc_default) {
1171
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1172
+							$option        = get_option($option_name);
1173
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1174 1174
 						}
1175 1175
 					}
1176
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1176
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false)).'. '.$category_desc;
1177 1177
 				}
1178
-			} else if ( $geodir_is_tag ) {
1179
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1178
+			} else if ($geodir_is_tag) {
1179
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1180 1180
 			}
1181 1181
 		}
1182 1182
 	}
1183 1183
 
1184 1184
 
1185 1185
 	$gd_page = '';
1186
-	if ( geodir_is_page( 'home' ) ) {
1186
+	if (geodir_is_page('home')) {
1187 1187
 		$gd_page   = 'home';
1188
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1189
-	} elseif ( geodir_is_page( 'detail' ) ) {
1188
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1189
+	} elseif (geodir_is_page('detail')) {
1190 1190
 		$gd_page   = 'detail';
1191
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1192
-	} elseif ( geodir_is_page( 'pt' ) ) {
1191
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1192
+	} elseif (geodir_is_page('pt')) {
1193 1193
 		$gd_page   = 'pt';
1194
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1195
-	} elseif ( geodir_is_page( 'listing' ) ) {
1194
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1195
+	} elseif (geodir_is_page('listing')) {
1196 1196
 		$gd_page   = 'listing';
1197
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1198
-	} elseif ( geodir_is_page( 'location' ) ) {
1197
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1198
+	} elseif (geodir_is_page('location')) {
1199 1199
 		$gd_page   = 'location';
1200
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1201
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1200
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1201
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1202 1202
 
1203
-	} elseif ( geodir_is_page( 'search' ) ) {
1203
+	} elseif (geodir_is_page('search')) {
1204 1204
 		$gd_page   = 'search';
1205
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1206
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1205
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1206
+	} elseif (geodir_is_page('add-listing')) {
1207 1207
 		$gd_page   = 'add-listing';
1208
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1209
-	} elseif ( geodir_is_page( 'author' ) ) {
1208
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1209
+	} elseif (geodir_is_page('author')) {
1210 1210
 		$gd_page   = 'author';
1211
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1212
-	} elseif ( geodir_is_page( 'login' ) ) {
1211
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1212
+	} elseif (geodir_is_page('login')) {
1213 1213
 		$gd_page   = 'login';
1214
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1215
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1214
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1215
+	} elseif (geodir_is_page('listing-success')) {
1216 1216
 		$gd_page   = 'listing-success';
1217
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1217
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1218 1218
 	}
1219 1219
 
1220 1220
 
1221
-	if ( $meta_desc ) {
1222
-		$meta_desc = stripslashes_deep( $meta_desc );
1221
+	if ($meta_desc) {
1222
+		$meta_desc = stripslashes_deep($meta_desc);
1223 1223
 		/**
1224 1224
 		 * Filter page description to replace variables.
1225 1225
 		 *
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 		 * @param string $title   The page description including variables.
1229 1229
 		 * @param string $gd_page The GeoDirectory page type if any.
1230 1230
 		 */
1231
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1231
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1232 1232
 
1233 1233
 		/**
1234 1234
 		 * Filter SEO meta description.
@@ -1237,49 +1237,49 @@  discard block
 block discarded – undo
1237 1237
 		 *
1238 1238
 		 * @param string $meta_desc Meta description content.
1239 1239
 		 */
1240
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1240
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1241 1241
 	}
1242 1242
 
1243 1243
 	// meta keywords
1244
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1245
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1246
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1244
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1245
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1246
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1247 1247
 
1248
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1248
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1249 1249
 	} else {
1250 1250
 		$posttags = get_the_tags();
1251
-		if ( $posttags ) {
1252
-			foreach ( $posttags as $tag ) {
1253
-				$meta_key .= $tag->name . ' ';
1251
+		if ($posttags) {
1252
+			foreach ($posttags as $tag) {
1253
+				$meta_key .= $tag->name.' ';
1254 1254
 			}
1255 1255
 		} else {
1256
-			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
1256
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1257 1257
 			$xt   = 1;
1258 1258
 
1259
-			foreach ( $tags as $tag ) {
1260
-				if ( $xt <= 20 ) {
1261
-					$meta_key .= $tag->name . ", ";
1259
+			foreach ($tags as $tag) {
1260
+				if ($xt <= 20) {
1261
+					$meta_key .= $tag->name.", ";
1262 1262
 				}
1263 1263
 
1264
-				$xt ++;
1264
+				$xt++;
1265 1265
 			}
1266 1266
 		}
1267 1267
 	}
1268 1268
 
1269
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1270
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1271
-	if ( $geodir_meta_keys != '' ) {
1272
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1273
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1274
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1275
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1276
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1269
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1270
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1271
+	if ($geodir_meta_keys != '') {
1272
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1273
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1274
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1275
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1276
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1277 1277
 
1278
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1278
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1279 1279
 	}
1280 1280
 
1281
-	if ( $meta_key ) {
1282
-		$meta_key = stripslashes_deep( $meta_key );
1281
+	if ($meta_key) {
1282
+		$meta_key = stripslashes_deep($meta_key);
1283 1283
 		/**
1284 1284
 		 * Filter SEO meta keywords.
1285 1285
 		 *
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 		 *
1288 1288
 		 * @param string $meta_desc Meta keywords.
1289 1289
 		 */
1290
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1290
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1291 1291
 	}
1292 1292
 
1293 1293
 }
@@ -1307,8 +1307,8 @@  discard block
 block discarded – undo
1307 1307
 
1308 1308
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1309 1309
 
1310
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1311
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1310
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1311
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1312 1312
 	}
1313 1313
 
1314 1314
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1330,57 +1330,57 @@  discard block
 block discarded – undo
1330 1330
 	 * @since 1.0.0
1331 1331
 	 */
1332 1332
 	$arr_tabs['post_profile'] = array(
1333
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1333
+		'heading_text'  => __('Profile', 'geodirectory'),
1334 1334
 		'is_active_tab' => true,
1335
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1335
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1336 1336
 		'tab_content'   => ''
1337 1337
 	);
1338
-	$arr_tabs['post_info']    = array(
1339
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1338
+	$arr_tabs['post_info'] = array(
1339
+		'heading_text'  => __('More Info', 'geodirectory'),
1340 1340
 		'is_active_tab' => false,
1341
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1341
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1342 1342
 		'tab_content'   => ''
1343 1343
 	);
1344 1344
 
1345 1345
 	$arr_tabs['post_images'] = array(
1346
-		'heading_text'  => __( 'Photo', 'geodirectory' ),
1346
+		'heading_text'  => __('Photo', 'geodirectory'),
1347 1347
 		'is_active_tab' => false,
1348
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1348
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1349 1349
 		'tab_content'   => ''
1350 1350
 	);
1351 1351
 
1352 1352
 	$arr_tabs['post_video'] = array(
1353
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1353
+		'heading_text'  => __('Video', 'geodirectory'),
1354 1354
 		'is_active_tab' => false,
1355
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1355
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1356 1356
 		'tab_content'   => ''
1357 1357
 	);
1358 1358
 
1359 1359
 	$arr_tabs['special_offers'] = array(
1360
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1360
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1361 1361
 		'is_active_tab' => false,
1362
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1362
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1363 1363
 		'tab_content'   => ''
1364 1364
 	);
1365 1365
 
1366 1366
 	$arr_tabs['post_map'] = array(
1367
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1367
+		'heading_text'  => __('Map', 'geodirectory'),
1368 1368
 		'is_active_tab' => false,
1369
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1369
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1370 1370
 		'tab_content'   => ''
1371 1371
 	);
1372 1372
 
1373 1373
 	$arr_tabs['reviews'] = array(
1374
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1374
+		'heading_text'  => __('Reviews', 'geodirectory'),
1375 1375
 		'is_active_tab' => false,
1376
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1376
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1377 1377
 		'tab_content'   => 'review display'
1378 1378
 	);
1379 1379
 
1380 1380
 	$arr_tabs['related_listing'] = array(
1381
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1381
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1382 1382
 		'is_active_tab' => false,
1383
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1383
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1384 1384
 		'tab_content'   => ''
1385 1385
 	);
1386 1386
 
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 	 *
1390 1390
 	 * @since 1.0.0
1391 1391
 	 */
1392
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1392
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1393 1393
 
1394 1394
 
1395 1395
 }
@@ -1403,13 +1403,13 @@  discard block
 block discarded – undo
1403 1403
  * @return mixed|array Tabs array.
1404 1404
  */
1405 1405
 function geodir_detail_page_tabs_list() {
1406
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1406
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1407 1407
 	$tabs_array    = geodir_detail_page_tabs_array();
1408 1408
 
1409
-	if ( ! empty( $tabs_excluded ) ) {
1410
-		foreach ( $tabs_excluded as $tab ) {
1411
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1412
-				unset( $tabs_array[ $tab ] );
1409
+	if (!empty($tabs_excluded)) {
1410
+		foreach ($tabs_excluded as $tab) {
1411
+			if (array_key_exists($tab, $tabs_array)) {
1412
+				unset($tabs_array[$tab]);
1413 1413
 			}
1414 1414
 		}
1415 1415
 	}
@@ -1433,58 +1433,58 @@  discard block
 block discarded – undo
1433 1433
 function geodir_show_detail_page_tabs() {
1434 1434
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1435 1435
 
1436
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1437
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1438
-	$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
1436
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1437
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1438
+	$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
1439 1439
 
1440
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1441
-		$post = geodir_get_post_info( $request_post_id );
1442
-		setup_postdata( $post );
1440
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1441
+		$post = geodir_get_post_info($request_post_id);
1442
+		setup_postdata($post);
1443 1443
 	}
1444 1444
 
1445
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1445
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1446 1446
 
1447 1447
 
1448
-	if ( geodir_is_page( 'detail' ) ) {
1449
-		$video                 = geodir_get_video( $post->ID );
1450
-		$special_offers        = geodir_get_special_offers( $post->ID );
1448
+	if (geodir_is_page('detail')) {
1449
+		$video                 = geodir_get_video($post->ID);
1450
+		$special_offers        = geodir_get_special_offers($post->ID);
1451 1451
 		$related_listing_array = array();
1452
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1453
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1452
+		if (get_option('geodir_add_related_listing_posttypes')) {
1453
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1454 1454
 		}
1455 1455
 
1456 1456
 
1457
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1458
-		if ( ! $excluded_tabs ) {
1457
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1458
+		if (!$excluded_tabs) {
1459 1459
 			$excluded_tabs = array();
1460 1460
 		}
1461 1461
 
1462 1462
 		$related_listing = '';
1463
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1463
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1464 1464
 			$request = array(
1465
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1466
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1467
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1468
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1469
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1470
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1465
+				'post_number'         => get_option('geodir_related_post_count'),
1466
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1467
+				'layout'              => get_option('geodir_related_post_listing_view'),
1468
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1469
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1470
+				'character_count'     => get_option('geodir_related_post_excerpt')
1471 1471
 			);
1472 1472
 
1473
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1474
-				$related_listing = geodir_get_detail_page_related_events( $request );
1473
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1474
+				$related_listing = geodir_get_detail_page_related_events($request);
1475 1475
 			} else {
1476
-				$related_listing = geodir_related_posts_display( $request );
1476
+				$related_listing = geodir_related_posts_display($request);
1477 1477
 			}
1478 1478
 
1479 1479
 		}
1480 1480
 
1481
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1481
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1482 1482
 		$thumb_image = '';
1483
-		if ( ! empty( $post_images ) ) {
1484
-			foreach ( $post_images as $image ) {
1485
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1486
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1487
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1483
+		if (!empty($post_images)) {
1484
+			foreach ($post_images as $image) {
1485
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1486
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1487
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1488 1488
 				$thumb_image .= '</a>';
1489 1489
 			}
1490 1490
 		}
@@ -1493,11 +1493,11 @@  discard block
 block discarded – undo
1493 1493
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1494 1494
 		$map_args['width']           = '600';
1495 1495
 		$map_args['height']          = '300';
1496
-		if ( $post->post_mapzoom ) {
1497
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1496
+		if ($post->post_mapzoom) {
1497
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1498 1498
 		}
1499 1499
 		$map_args['autozoom']                 = false;
1500
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1500
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1501 1501
 		$map_args['child_collapse']           = '0';
1502 1502
 		$map_args['enable_cat_filters']       = false;
1503 1503
 		$map_args['enable_text_search']       = false;
@@ -1506,43 +1506,43 @@  discard block
 block discarded – undo
1506 1506
 		$map_args['enable_jason_on_load']     = true;
1507 1507
 		$map_args['enable_map_direction']     = true;
1508 1508
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1509
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1510
-	} else if ( geodir_is_page( 'preview' ) ) {
1511
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1512
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1509
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1510
+	} else if (geodir_is_page('preview')) {
1511
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1512
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1513 1513
 
1514
-		if ( isset( $post->post_images ) ) {
1515
-			$post->post_images = trim( $post->post_images, "," );
1514
+		if (isset($post->post_images)) {
1515
+			$post->post_images = trim($post->post_images, ",");
1516 1516
 		}
1517 1517
 
1518
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1519
-			$post_images = explode( ",", $post->post_images );
1518
+		if (isset($post->post_images) && !empty($post->post_images)) {
1519
+			$post_images = explode(",", $post->post_images);
1520 1520
 		}
1521 1521
 
1522 1522
 		$thumb_image = '';
1523
-		if ( ! empty( $post_images ) ) {
1524
-			foreach ( $post_images as $image ) {
1525
-				if ( $image != '' ) {
1526
-					$thumb_image .= '<a href="' . $image . '">';
1527
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1523
+		if (!empty($post_images)) {
1524
+			foreach ($post_images as $image) {
1525
+				if ($image != '') {
1526
+					$thumb_image .= '<a href="'.$image.'">';
1527
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1528 1528
 					$thumb_image .= '</a>';
1529 1529
 				}
1530 1530
 			}
1531 1531
 		}
1532 1532
 
1533 1533
 		global $map_jason;
1534
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1535
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1536
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1534
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1535
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1536
+		$icon_size        = geodir_get_marker_size($marker_icon);
1537 1537
 		$marker_json['w'] = $icon_size['w'];
1538 1538
 		$marker_json['h'] = $icon_size['h'];
1539
-		$map_jason[]      = json_encode( $marker_json );
1539
+		$map_jason[]      = json_encode($marker_json);
1540 1540
 
1541
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1542
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1543
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1544
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1545
-		if ( ! $mapzoom ) {
1541
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1542
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1543
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1544
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1545
+		if (!$mapzoom) {
1546 1546
 			$mapzoom = 12;
1547 1547
 		}
1548 1548
 
@@ -1565,37 +1565,37 @@  discard block
 block discarded – undo
1565 1565
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1566 1566
 	}
1567 1567
 
1568
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1568
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1569 1569
 
1570 1570
 	$active_tab       = '';
1571 1571
 	$active_tab_name  = '';
1572 1572
 	$default_tab      = '';
1573 1573
 	$default_tab_name = '';
1574
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1575
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1574
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1575
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1576 1576
 			$active_tab      = $tab_index;
1577
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1577
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1578 1578
 		}
1579 1579
 
1580
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1580
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1581 1581
 			$default_tab      = $tab_index;
1582
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1582
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1583 1583
 		}
1584 1584
 	}
1585 1585
 
1586
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab acs a active tab if not any tab is active.
1587
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1588
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1586
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
1587
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1588
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1589 1589
 		}
1590 1590
 
1591
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1591
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1592 1592
 		$active_tab                                            = $default_tab;
1593 1593
 		$active_tab_name                                       = $default_tab_name;
1594 1594
 	}
1595
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1595
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1596 1596
 	?>
1597 1597
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1598
-		<?php if ( ! $tab_list ){ ?>
1598
+		<?php if (!$tab_list) { ?>
1599 1599
 		<div id="geodir-tab-mobile-menu">
1600 1600
 			<i class="fa fa-bars"></i>
1601 1601
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1610,26 +1610,26 @@  discard block
 block discarded – undo
1610 1610
 			 * @since 1.0.0
1611 1611
 			 * @see   'geodir_after_tab_list'
1612 1612
 			 */
1613
-			do_action( 'geodir_before_tab_list' ); ?>
1613
+			do_action('geodir_before_tab_list'); ?>
1614 1614
 			<?php
1615 1615
 
1616
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1617
-				if ( $detail_page_tab['is_display'] ) {
1616
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1617
+				if ($detail_page_tab['is_display']) {
1618 1618
 
1619
-					if ( ! $tab_list ) {
1619
+					if (!$tab_list) {
1620 1620
 						?>
1621 1621
 						<dt></dt> <!-- added to comply with validation -->
1622
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1622
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1623 1623
 								data-tab="#<?php echo $tab_index; ?>"
1624
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1624
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1625 1625
 						</dd>
1626 1626
 						<?php
1627 1627
 					}
1628 1628
 					ob_start() // start tab content buffering
1629 1629
 					?>
1630 1630
 					<li id="<?php echo $tab_index; ?>Tab">
1631
-						<?php if ( $tab_list ) {
1632
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1631
+						<?php if ($tab_list) {
1632
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1633 1633
 							/**
1634 1634
 							 * Filter the tab list title html.
1635 1635
 							 *
@@ -1639,7 +1639,7 @@  discard block
 block discarded – undo
1639 1639
 							 * @param string $tab_index      The tab index type.
1640 1640
 							 * @param array $detail_page_tab The array of values including title text.
1641 1641
 							 */
1642
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1642
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1643 1643
 						} ?>
1644 1644
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1645 1645
 						<?php
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
 						 *
1651 1651
 						 * @param string $tab_index The tab name ID.
1652 1652
 						 */
1653
-						do_action( 'geodir_before_tab_content', $tab_index );
1653
+						do_action('geodir_before_tab_content', $tab_index);
1654 1654
 
1655 1655
 						/**
1656 1656
 						 * Called before the details tab content is output per tab.
@@ -1660,21 +1660,21 @@  discard block
 block discarded – undo
1660 1660
 						 * @since 1.0.0
1661 1661
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1662 1662
 						 */
1663
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1663
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1664 1664
 						/// write a code to generate content of each tab
1665
-						switch ( $tab_index ) {
1665
+						switch ($tab_index) {
1666 1666
 							case 'post_profile':
1667 1667
 								/**
1668 1668
 								 * Called before the listing description content on the details page tab.
1669 1669
 								 *
1670 1670
 								 * @since 1.0.0
1671 1671
 								 */
1672
-								do_action( 'geodir_before_description_on_listing_detail' );
1673
-								if ( geodir_is_page( 'detail' ) ) {
1672
+								do_action('geodir_before_description_on_listing_detail');
1673
+								if (geodir_is_page('detail')) {
1674 1674
 									the_content();
1675 1675
 								} else {
1676 1676
 									/** This action is documented in geodirectory_template_actions.php */
1677
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1677
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1678 1678
 								}
1679 1679
 
1680 1680
 								/**
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 								 *
1683 1683
 								 * @since 1.0.0
1684 1684
 								 */
1685
-								do_action( 'geodir_after_description_on_listing_detail' );
1685
+								do_action('geodir_after_description_on_listing_detail');
1686 1686
 								break;
1687 1687
 							case 'post_info':
1688 1688
 								echo $geodir_post_detail_fields;
@@ -1692,32 +1692,32 @@  discard block
 block discarded – undo
1692 1692
 								break;
1693 1693
 							case 'post_video':
1694 1694
 								// some browsers hide $_POST data if used for embeds so we repalce with a placeholder
1695
-								if ( $preview ) {
1696
-									if ( $video ) {
1697
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1695
+								if ($preview) {
1696
+									if ($video) {
1697
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1698 1698
 									}
1699 1699
 								} else {
1700 1700
 
1701 1701
 									// stop payment manager filtering content length
1702
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
-									if ( false !== $filter_priority ) {
1704
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1702
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1703
+									if (false !== $filter_priority) {
1704
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1705 1705
 									}
1706 1706
 
1707 1707
 									/** This action is documented in geodirectory_template_actions.php */
1708
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1708
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1709 1709
 
1710
-									if ( false !== $filter_priority ) {
1711
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1710
+									if (false !== $filter_priority) {
1711
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1712 1712
 									}
1713 1713
 								}
1714 1714
 								break;
1715 1715
 							case 'special_offers':
1716
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1716
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1717 1717
 
1718 1718
 								break;
1719 1719
 							case 'post_map':
1720
-								geodir_draw_map( $map_args );
1720
+								geodir_draw_map($map_args);
1721 1721
 								break;
1722 1722
 							case 'reviews':
1723 1723
 								comments_template();
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
 								echo $related_listing;
1727 1727
 								break;
1728 1728
 							default: {
1729
-								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'] ) ) {
1729
+								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'])) {
1730 1730
 									echo $detail_page_tab['tab_content'];
1731 1731
 								}
1732 1732
 							}
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
 						 *
1739 1739
 						 * @since 1.0.0
1740 1740
 						 */
1741
-						do_action( 'geodir_after_tab_content', $tab_index );
1741
+						do_action('geodir_after_tab_content', $tab_index);
1742 1742
 
1743 1743
 						/**
1744 1744
 						 * Called after the details tab content is output per tab.
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 						 * @since 1.0.0
1749 1749
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1750 1750
 						 */
1751
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1751
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1752 1752
 						?> </li>
1753 1753
 					<?php
1754 1754
 					/**
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
 					 *
1757 1757
 					 * @since 1.0.0
1758 1758
 					 */
1759
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1759
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1760 1760
 				} // end of if for is_display
1761 1761
 			}// end of foreach
1762 1762
 
@@ -1766,14 +1766,14 @@  discard block
 block discarded – undo
1766 1766
 			 * @since 1.0.0
1767 1767
 			 * @see   'geodir_before_tab_list'
1768 1768
 			 */
1769
-			do_action( 'geodir_after_tab_list' );
1769
+			do_action('geodir_after_tab_list');
1770 1770
 			?>
1771
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1772
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1771
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1772
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1773 1773
 		    style="position:relative;">
1774 1774
 			<?php
1775
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1776
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1775
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1776
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1777 1777
 					echo $detail_page_tab['tab_content'];
1778 1778
 				}// end of if
1779 1779
 			}// end of foreach
@@ -1783,11 +1783,11 @@  discard block
 block discarded – undo
1783 1783
 			 *
1784 1784
 			 * @since 1.0.0
1785 1785
 			 */
1786
-			do_action( 'geodir_add_tab_content' ); ?>
1786
+			do_action('geodir_add_tab_content'); ?>
1787 1787
 		</ul>
1788 1788
 		<!--gd-tabs-content ul end-->
1789 1789
 	</div>
1790
-	<?php if ( ! $tab_list ) { ?>
1790
+	<?php if (!$tab_list) { ?>
1791 1791
 		<script>
1792 1792
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1793 1793
 				hashVal = window.location.hash;
@@ -1819,31 +1819,31 @@  discard block
 block discarded – undo
1819 1819
  *
1820 1820
  * @return mixed Image file.
1821 1821
  */
1822
-function geodir_exif( $file ) {
1823
-	if ( empty( $file ) || ! is_array( $file ) ) {
1822
+function geodir_exif($file) {
1823
+	if (empty($file) || !is_array($file)) {
1824 1824
 		return $file;
1825 1825
 	}
1826 1826
 
1827
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1828
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1827
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1828
+	if (!($file_path && file_exists($file_path))) {
1829 1829
 		return $file;
1830 1830
 	}
1831 1831
 	$file['file'] = $file_path;
1832 1832
 
1833
-	if ( ! file_is_valid_image( $file_path ) ) {
1833
+	if (!file_is_valid_image($file_path)) {
1834 1834
 		return $file; // Bail if file is not an image.
1835 1835
 	}
1836 1836
 
1837
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1837
+	if (!function_exists('wp_get_image_editor')) {
1838 1838
 		return $file;
1839 1839
 	}
1840 1840
 
1841 1841
 	$mime_type = $file['type'];
1842 1842
 	$exif      = array();
1843
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1843
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1844 1844
 		try {
1845
-			$exif = exif_read_data( $file_path );
1846
-		} catch ( Exception $e ) {
1845
+			$exif = exif_read_data($file_path);
1846
+		} catch (Exception $e) {
1847 1847
 			$exif = array();
1848 1848
 		}
1849 1849
 	}
@@ -1852,13 +1852,13 @@  discard block
 block discarded – undo
1852 1852
 	$flip        = false;
1853 1853
 	$modify      = false;
1854 1854
 	$orientation = 0;
1855
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1856
-		switch ( (int) $exif['Orientation'] ) {
1855
+	if (!empty($exif) && isset($exif['Orientation'])) {
1856
+		switch ((int) $exif['Orientation']) {
1857 1857
 			case 1:
1858 1858
 				// do nothing
1859 1859
 				break;
1860 1860
 			case 2:
1861
-				$flip   = array( false, true );
1861
+				$flip   = array(false, true);
1862 1862
 				$modify = true;
1863 1863
 				break;
1864 1864
 			case 3:
@@ -1867,13 +1867,13 @@  discard block
 block discarded – undo
1867 1867
 				$modify      = true;
1868 1868
 				break;
1869 1869
 			case 4:
1870
-				$flip   = array( true, false );
1870
+				$flip   = array(true, false);
1871 1871
 				$modify = true;
1872 1872
 				break;
1873 1873
 			case 5:
1874 1874
 				$orientation = - 90;
1875 1875
 				$rotate      = true;
1876
-				$flip        = array( false, true );
1876
+				$flip        = array(false, true);
1877 1877
 				$modify      = true;
1878 1878
 				break;
1879 1879
 			case 6:
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 			case 7:
1885 1885
 				$orientation = - 270;
1886 1886
 				$rotate      = true;
1887
-				$flip        = array( false, true );
1887
+				$flip        = array(false, true);
1888 1888
 				$modify      = true;
1889 1889
 				break;
1890 1890
 			case 8:
@@ -1910,31 +1910,31 @@  discard block
 block discarded – undo
1910 1910
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1911 1911
 	 * @param string $quality   Image mime type.
1912 1912
 	 */
1913
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1914
-	if ( $quality !== null ) {
1913
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1914
+	if ($quality !== null) {
1915 1915
 		$modify = true;
1916 1916
 	}
1917 1917
 
1918
-	if ( ! $modify ) {
1918
+	if (!$modify) {
1919 1919
 		return $file; // no change
1920 1920
 	}
1921 1921
 
1922
-	$image = wp_get_image_editor( $file_path );
1923
-	if ( ! is_wp_error( $image ) ) {
1924
-		if ( $rotate ) {
1925
-			$image->rotate( $orientation );
1922
+	$image = wp_get_image_editor($file_path);
1923
+	if (!is_wp_error($image)) {
1924
+		if ($rotate) {
1925
+			$image->rotate($orientation);
1926 1926
 		}
1927 1927
 
1928
-		if ( ! empty( $flip ) ) {
1929
-			$image->flip( $flip[0], $flip[1] );
1928
+		if (!empty($flip)) {
1929
+			$image->flip($flip[0], $flip[1]);
1930 1930
 		}
1931 1931
 
1932
-		if ( $quality !== null ) {
1933
-			$image->set_quality( (int) $quality );
1932
+		if ($quality !== null) {
1933
+			$image->set_quality((int) $quality);
1934 1934
 		}
1935 1935
 
1936
-		$result = $image->save( $file_path );
1937
-		if ( ! is_wp_error( $result ) ) {
1936
+		$result = $image->save($file_path);
1937
+		if (!is_wp_error($result)) {
1938 1938
 			$file['file']     = $result['path'];
1939 1939
 			$file['tmp_name'] = $result['path'];
1940 1940
 		}
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
  *
1962 1962
  * @return string Returns the recent reviews html.
1963 1963
  */
1964
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
1964
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1965 1965
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1966 1966
 	$tablecomments = $wpdb->comments;
1967 1967
 	$tableposts    = $wpdb->posts;
@@ -1971,28 +1971,28 @@  discard block
 block discarded – undo
1971 1971
 	$region_filter  = '';
1972 1972
 	$country_filter = '';
1973 1973
 
1974
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
1975
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
1976
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1974
+	if ($gd_session->get('gd_multi_location')) {
1975
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1976
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1977 1977
 		}
1978 1978
 
1979
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
1980
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
1979
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1980
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1981 1981
 		}
1982 1982
 
1983
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
1984
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
1983
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1984
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1985 1985
 		}
1986 1986
 	}
1987 1987
 
1988 1988
 	$review_table = GEODIR_REVIEW_TABLE;
1989 1989
 	$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 $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1990 1990
 
1991
-	$comments = $wpdb->get_results( $request );
1991
+	$comments = $wpdb->get_results($request);
1992 1992
 
1993
-	foreach ( $comments as $comment ) {
1993
+	foreach ($comments as $comment) {
1994 1994
 		// Set the extra comment info needed.
1995
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
1995
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1996 1996
 		//echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1997 1997
 		$comment->comment_content      = $comment_extra->comment_content;
1998 1998
 		$comment->comment_author       = $comment_extra->comment_author;
@@ -2000,75 +2000,75 @@  discard block
 block discarded – undo
2000 2000
 
2001 2001
 		$comment_id      = '';
2002 2002
 		$comment_id      = $comment->comment_ID;
2003
-		$comment_content = strip_tags( $comment->comment_content );
2003
+		$comment_content = strip_tags($comment->comment_content);
2004 2004
 
2005
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2005
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2006 2006
 
2007
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2007
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2008 2008
 		$comment_author_email = $comment->comment_author_email;
2009 2009
 		$comment_post_ID      = $comment->post_id;
2010 2010
 
2011 2011
 		$na = true;
2012
-		if ( function_exists( 'icl_object_id' ) && icl_object_id( $comment_post_ID, $comment->post_type, true ) ) {
2013
-			$comment_post_ID2 = icl_object_id( $comment_post_ID, $comment->post_type, false );
2014
-			if ( $comment_post_ID == $comment_post_ID2 ) {
2012
+		if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
2013
+			$comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
2014
+			if ($comment_post_ID == $comment_post_ID2) {
2015 2015
 			} else {
2016 2016
 				$na = false;
2017 2017
 			}
2018 2018
 		}
2019 2019
 
2020
-		$post_title        = get_the_title( $comment_post_ID );
2021
-		$permalink         = get_permalink( $comment_post_ID );
2022
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2023
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2020
+		$post_title        = get_the_title($comment_post_ID);
2021
+		$permalink         = get_permalink($comment_post_ID);
2022
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2023
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2024 2024
 
2025
-		$comment_content_length = strlen( $comment_content );
2026
-		if ( $comment_content_length > $comment_lenth ) {
2027
-			$comment_excerpt = mb_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2025
+		$comment_content_length = strlen($comment_content);
2026
+		if ($comment_content_length > $comment_lenth) {
2027
+			$comment_excerpt = mb_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2028 2028
 		} else {
2029 2029
 			$comment_excerpt = $comment_content;
2030 2030
 		}
2031 2031
 
2032
-		if ( $comment->user_id ) {
2033
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2032
+		if ($comment->user_id) {
2033
+			$user_profile_url = get_author_posts_url($comment->user_id);
2034 2034
 		} else {
2035 2035
 			$user_profile_url = '';
2036 2036
 		}
2037 2037
 
2038
-		if ( $comment_id && $na ) {
2038
+		if ($comment_id && $na) {
2039 2039
 			$comments_echo .= '<li class="clearfix">';
2040
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2041
-			if ( function_exists( 'get_avatar' ) ) {
2042
-				if ( ! isset( $comment->comment_type ) ) {
2043
-					if ( $user_profile_url ) {
2044
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2040
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2041
+			if (function_exists('get_avatar')) {
2042
+				if (!isset($comment->comment_type)) {
2043
+					if ($user_profile_url) {
2044
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2045 2045
 					}
2046
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2047
-					if ( $user_profile_url ) {
2046
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2047
+					if ($user_profile_url) {
2048 2048
 						$comments_echo .= '</a>';
2049 2049
 					}
2050
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2051
-					if ( $user_profile_url ) {
2052
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2050
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2051
+					if ($user_profile_url) {
2052
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2053 2053
 					}
2054
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2054
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2055 2055
 				}
2056
-			} elseif ( function_exists( 'gravatar' ) ) {
2057
-				if ( $user_profile_url ) {
2058
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2056
+			} elseif (function_exists('gravatar')) {
2057
+				if ($user_profile_url) {
2058
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2059 2059
 				}
2060 2060
 				$comments_echo .= "<img src=\"";
2061
-				if ( '' == $comment->comment_type ) {
2062
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2063
-					if ( $user_profile_url ) {
2061
+				if ('' == $comment->comment_type) {
2062
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2063
+					if ($user_profile_url) {
2064 2064
 						$comments_echo .= '</a>';
2065 2065
 					}
2066
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2067
-					if ( $user_profile_url ) {
2068
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2066
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2067
+					if ($user_profile_url) {
2068
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2069 2069
 					}
2070
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2071
-					if ( $user_profile_url ) {
2070
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2071
+					if ($user_profile_url) {
2072 2072
 						$comments_echo .= '</a>';
2073 2073
 					}
2074 2074
 				}
@@ -2078,17 +2078,17 @@  discard block
 block discarded – undo
2078 2078
 			$comments_echo .= "</span>\n";
2079 2079
 
2080 2080
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2081
-			if ( $comment->user_id ) {
2082
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2081
+			if ($comment->user_id) {
2082
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2083 2083
 			}
2084
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2085
-			if ( $comment->user_id ) {
2084
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2085
+			if ($comment->user_id) {
2086 2086
 				$comments_echo .= '</a>';
2087 2087
 			}
2088
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2089
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2090
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2091
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2088
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2089
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2090
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2091
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2092 2092
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2093 2093
 			$comments_echo .= '</p>';
2094 2094
 
@@ -2108,25 +2108,25 @@  discard block
 block discarded – undo
2108 2108
  * @return array Returns post categories as an array.
2109 2109
  */
2110 2110
 function geodir_home_map_cats_key_value_array() {
2111
-	$post_types = geodir_get_posttypes( 'object' );
2111
+	$post_types = geodir_get_posttypes('object');
2112 2112
 
2113 2113
 	$return = array();
2114
-	if ( ! empty( $post_types ) ) {
2115
-		foreach ( $post_types as $key => $post_type ) {
2116
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2117
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2118
-			$taxonomies     = geodir_get_taxonomies( $key );
2119
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2120
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2121
-
2122
-			if ( ! empty( $cat_terms ) ) {
2123
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2124
-
2125
-				foreach ( $cat_terms as $cat_term ) {
2126
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2114
+	if (!empty($post_types)) {
2115
+		foreach ($post_types as $key => $post_type) {
2116
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2117
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2118
+			$taxonomies     = geodir_get_taxonomies($key);
2119
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2120
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2121
+
2122
+			if (!empty($cat_terms)) {
2123
+				$return['optgroup_start-'.$key] = $post_type_name;
2124
+
2125
+				foreach ($cat_terms as $cat_term) {
2126
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2127 2127
 				}
2128 2128
 
2129
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2129
+				$return['optgroup_end-'.$key] = $post_type_name;
2130 2130
 			}
2131 2131
 		}
2132 2132
 	}
@@ -2142,14 +2142,14 @@  discard block
 block discarded – undo
2142 2142
  * @package GeoDirectory
2143 2143
  */
2144 2144
 function geodir_twitter_tweet_button() {
2145
-	if ( isset( $_GET['gde'] ) ) {
2146
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2145
+	if (isset($_GET['gde'])) {
2146
+		$link = '?url='.urlencode(geodir_curPageURL());
2147 2147
 	} else {
2148 2148
 		$link = '';
2149 2149
 	}
2150 2150
 	?>
2151 2151
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2152
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2152
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2153 2153
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2154 2154
 	<?php
2155 2155
 }
@@ -2166,10 +2166,10 @@  discard block
 block discarded – undo
2166 2166
 function geodir_fb_like_button() {
2167 2167
 	global $post;
2168 2168
 	?>
2169
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2169
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2170 2170
 		echo 'allowtransparency="true"';
2171 2171
 	} ?> class="facebook"
2172
-	     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"
2172
+	     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"
2173 2173
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2174 2174
 	<?php
2175 2175
 }
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
 
2201 2201
 
2202 2202
 function geodir_listing_bounce_map_pin_on_hover() {
2203
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2203
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2204 2204
 		?>
2205 2205
 		<script>
2206 2206
 			jQuery(function ($) {
@@ -2223,44 +2223,44 @@  discard block
 block discarded – undo
2223 2223
 	}
2224 2224
 }
2225 2225
 
2226
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2226
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2227 2227
 
2228
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2229
-function geodir_output_favourite_html_listings( $post_id ) {
2230
-	geodir_favourite_html( '', $post_id );
2228
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2229
+function geodir_output_favourite_html_listings($post_id) {
2230
+	geodir_favourite_html('', $post_id);
2231 2231
 }
2232 2232
 
2233
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2234
-function geodir_output_pinpoint_html_listings( $post_id, $post ) {
2233
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2234
+function geodir_output_pinpoint_html_listings($post_id, $post) {
2235 2235
 	global $wp_query;
2236 2236
 
2237 2237
 	$show_pin_point = $wp_query->is_main_query();
2238 2238
 
2239
-	if ( ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2240
-		$term_icon_url = get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2241
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2239
+	if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2240
+		$term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2241
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2242 2242
 		?>
2243 2243
 		<span class="geodir-pinpoint"
2244
-		      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>
2244
+		      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>
2245 2245
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2246 2246
 		   onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
2247 2247
 		   onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
2248
-		   onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2248
+		   onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2249 2249
 		<?php
2250 2250
 	}
2251 2251
 }
2252 2252
 
2253 2253
 function geodir_search_form_submit_button() {
2254 2254
 
2255
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2255
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2256 2256
 
2257
-	if ( $new_style ) {
2257
+	if ($new_style) {
2258 2258
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2259
-	}else{
2259
+	} else {
2260 2260
 		$default_search_button_label = 'Search';
2261 2261
 	}
2262
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2263
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2262
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2263
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2264 2264
 	}
2265 2265
 
2266 2266
 	/**
@@ -2272,78 +2272,78 @@  discard block
 block discarded – undo
2272 2272
 	 *
2273 2273
 	 * @param string $default_search_button_label The current search button text.
2274 2274
 	 */
2275
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2275
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2276 2276
 
2277 2277
 	$fa_class = '';
2278
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2278
+	if (strpos($default_search_button_label, '&#') !== false) {
2279 2279
 		$fa_class = 'fa';
2280 2280
 	}
2281 2281
 
2282 2282
 
2283
-	if ( $new_style ) {
2283
+	if ($new_style) {
2284 2284
 	?>
2285
-		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2286
-<?php }else{?>
2287
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2285
+		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2286
+<?php } else {?>
2287
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2288 2288
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2289 2289
 	<?php }
2290 2290
 }
2291 2291
 
2292
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2292
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2293 2293
 
2294 2294
 function geodir_search_form_post_type_input() {
2295 2295
 	global $geodir_search_post_type;
2296
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2296
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2297 2297
 	$curr_post_type = $geodir_search_post_type;
2298 2298
 
2299
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2299
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2300 2300
 
2301
-		foreach ( $post_types as $post_type => $info ){
2301
+		foreach ($post_types as $post_type => $info) {
2302 2302
 			global $wpdb;
2303
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2304
-			if ( ! $has_posts ) {
2303
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2304
+			if (!$has_posts) {
2305 2305
 				unset($post_types->{$post_type});
2306 2306
 			}
2307 2307
 		}
2308 2308
 
2309
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2309
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2310 2310
 
2311
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2312
-			if ( $new_style ) {
2311
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2312
+			if ($new_style) {
2313 2313
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2314 2314
 			}
2315 2315
 			?>
2316 2316
 			<select name="stype" class="search_by_post">
2317
-				<?php foreach ( $post_types as $post_type => $info ):
2317
+				<?php foreach ($post_types as $post_type => $info):
2318 2318
 					global $wpdb;
2319 2319
 					?>
2320 2320
 
2321
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2322
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2323
-						if ( $post_type == $_REQUEST['stype'] ) {
2321
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2322
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2323
+						if ($post_type == $_REQUEST['stype']) {
2324 2324
 							echo 'selected="selected"';
2325 2325
 						}
2326
-					} elseif ( $curr_post_type == $post_type ) {
2326
+					} elseif ($curr_post_type == $post_type) {
2327 2327
 						echo 'selected="selected"';
2328
-					} ?>><?php _e( ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2328
+					} ?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option>
2329 2329
 
2330 2330
 				<?php endforeach; ?>
2331 2331
 			</select>
2332 2332
 			<?php
2333
-			if ( $new_style ) {
2333
+			if ($new_style) {
2334 2334
 				echo "</div>";
2335 2335
 			}
2336
-		}else{
2337
-			if(! empty( $post_types )){
2338
-				$pt_arr = (array)$post_types;
2339
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2340
-			}else{
2336
+		} else {
2337
+			if (!empty($post_types)) {
2338
+				$pt_arr = (array) $post_types;
2339
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2340
+			} else {
2341 2341
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2342 2342
 			}
2343 2343
 
2344 2344
 		}
2345 2345
 
2346
-	}elseif ( ! empty( $post_types ) ) {
2346
+	}elseif (!empty($post_types)) {
2347 2347
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2348 2348
 	}
2349 2349
 }
@@ -2351,26 +2351,26 @@  discard block
 block discarded – undo
2351 2351
 function geodir_search_form_search_input() {
2352 2352
 
2353 2353
 	$default_search_for_text = SEARCH_FOR_TEXT;
2354
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2355
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2354
+	if (get_option('geodir_search_field_default_text')) {
2355
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2356 2356
 	}
2357 2357
 
2358 2358
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2359
-	if($new_style){
2359
+	if ($new_style) {
2360 2360
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2361 2361
 	}
2362 2362
 	?>
2363 2363
 	<input class="search_text" name="s"
2364
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2365
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2364
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2365
+		       echo esc_attr(stripslashes_deep($_REQUEST['s']));
2366 2366
 	       } else {
2367 2367
 		       echo $default_search_for_text;
2368 2368
 	       } ?>" type="text"
2369
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2370
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2369
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2370
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2371 2371
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2372 2372
 	<?php
2373
-	if($new_style){
2373
+	if ($new_style) {
2374 2374
 		echo "</div>";
2375 2375
 	}
2376 2376
 }
@@ -2378,12 +2378,12 @@  discard block
 block discarded – undo
2378 2378
 function geodir_search_form_near_input() {
2379 2379
 
2380 2380
 	$default_near_text = NEAR_TEXT;
2381
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2382
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2381
+	if (get_option('geodir_near_field_default_text')) {
2382
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2383 2383
 	}
2384 2384
 
2385
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2386
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2385
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2386
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2387 2387
 	} else {
2388 2388
 		$near = $default_near_text;
2389 2389
 	}
@@ -2397,7 +2397,7 @@  discard block
 block discarded – undo
2397 2397
 	 * @since 1.6.9
2398 2398
 	 * @param string $curr_post_type The current post type.
2399 2399
 	 */
2400
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2400
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2401 2401
 
2402 2402
 
2403 2403
 	/**
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
 	 * @param string $near              The current near value.
2411 2411
 	 * @param string $default_near_text The default near value.
2412 2412
 	 */
2413
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2413
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2414 2414
 	/**
2415 2415
 	 * Filter the default "Near" text value for the search form.
2416 2416
 	 *
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
 	 * @param string $near              The current near value.
2422 2422
 	 * @param string $default_near_text The default near value.
2423 2423
 	 */
2424
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2424
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2425 2425
 	/**
2426 2426
 	 * Filter the class for the near search input.
2427 2427
 	 *
@@ -2429,10 +2429,10 @@  discard block
 block discarded – undo
2429 2429
 	 *
2430 2430
 	 * @param string $class The class for the HTML near input, default is blank.
2431 2431
 	 */
2432
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2432
+	$near_class = apply_filters('geodir_search_near_class', '');
2433 2433
 
2434 2434
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2435
-	if($new_style){
2435
+	if ($new_style) {
2436 2436
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2437 2437
 		
2438 2438
 		do_action('geodir_before_near_input');
@@ -2440,30 +2440,30 @@  discard block
 block discarded – undo
2440 2440
 
2441 2441
 	?>
2442 2442
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2443
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2444
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2445
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2443
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2444
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2445
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2446 2446
 	<?php
2447
-	if($new_style){
2447
+	if ($new_style) {
2448 2448
 		do_action('geodir_after_near_input');
2449 2449
 
2450 2450
 		echo "</div>";
2451 2451
 	}
2452 2452
 }
2453 2453
 
2454
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2455
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2456
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2454
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2455
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2456
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2457 2457
 
2458
-function geodir_get_search_post_type($pt=''){
2458
+function geodir_get_search_post_type($pt = '') {
2459 2459
 	global $geodir_search_post_type;
2460 2460
 
2461
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2462
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2461
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2462
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2463 2463
 
2464 2464
 	$geodir_search_post_type = geodir_get_current_posttype();
2465 2465
 
2466
-	if(!$geodir_search_post_type) {
2466
+	if (!$geodir_search_post_type) {
2467 2467
 		$geodir_search_post_type = geodir_get_default_posttype();
2468 2468
 	}
2469 2469
 
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 	return $geodir_search_post_type;
2472 2472
 }
2473 2473
 
2474
-function geodir_search_form(){
2474
+function geodir_search_form() {
2475 2475
 
2476 2476
 	geodir_get_search_post_type();
2477 2477
 
@@ -2481,5 +2481,5 @@  discard block
 block discarded – undo
2481 2481
 	die();
2482 2482
 }
2483 2483
 
2484
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2485
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2486 2484
\ No newline at end of file
2485
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2486
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2487 2487
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/ajax_handler_functions.php 3 patches
Indentation   +306 added lines, -306 removed lines patch added patch discarded remove patch
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_on_wp_loaded()
18 18
 {
19
-    /**
20
-     * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
-     *
22
-     * @since 1.0.0
23
-     */
24
-    do_action('giodir_handle_request_plugins_loaded');
25
-    global $wpdb;
19
+	/**
20
+	 * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
+	 *
22
+	 * @since 1.0.0
23
+	 */
24
+	do_action('giodir_handle_request_plugins_loaded');
25
+	global $wpdb;
26 26
 
27 27
 
28
-    if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
-        geodir_send_inquiry($_REQUEST); // function in custom_functions.php
28
+	if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
+		geodir_send_inquiry($_REQUEST); // function in custom_functions.php
30 30
 
31
-    } elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
-        geodir_send_friend($_REQUEST); // function in custom_functions.php
31
+	} elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
+		geodir_send_friend($_REQUEST); // function in custom_functions.php
33 33
 
34
-    }
34
+	}
35 35
 
36 36
 }
37 37
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
48
-        geodir_user_signup();
49
-    }
47
+	if(geodir_is_page('login')) {
48
+		geodir_user_signup();
49
+	}
50 50
 
51 51
 }
52 52
 
@@ -59,32 +59,32 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function geodir_on_init()
61 61
 {
62
-    /**
63
-     * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
-     *
65
-     * @since 1.0.0
66
-     */
67
-    do_action('giodir_handle_request');
68
-    global $wpdb;
62
+	/**
63
+	 * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
+	 *
65
+	 * @since 1.0.0
66
+	 */
67
+	do_action('giodir_handle_request');
68
+	global $wpdb;
69 69
 
70 70
 
71 71
 
72 72
 
73
-    if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) {
74
-        show_admin_bar(false);
75
-    }
73
+	if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) {
74
+		show_admin_bar(false);
75
+	}
76 76
 
77 77
 
78
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
-        /**
80
-         * Contains map marker functions.
81
-         *
82
-         * @since 1.0.0
83
-         * @package GeoDirectory
84
-         */
85
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
-        die;
87
-    }
78
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
+		/**
80
+		 * Contains map marker functions.
81
+		 *
82
+		 * @since 1.0.0
83
+		 * @package GeoDirectory
84
+		 */
85
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
+		die;
87
+	}
88 88
 
89 89
 
90 90
 
@@ -104,290 +104,290 @@  discard block
 block discarded – undo
104 104
  * @todo check if nonce is required here and if so add one.
105 105
  */
106 106
 function geodir_ajax_handler() {
107
-    global $wpdb, $gd_session,$post;
107
+	global $wpdb, $gd_session,$post;
108 108
 
109
-    if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
109
+	if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
110 110
 		$gd_session->set('gd_listing_view', $_REQUEST['gd_listing_view']);
111
-        echo '1';
112
-    }
113
-
114
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
115
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
116
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
117
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
118
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
119
-    }
120
-
121
-    if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
122
-        if (current_user_can('manage_options')) {
123
-            /**
124
-             * Contains admin ajax handling functions.
125
-             *
126
-             * @since 1.0.0
127
-             * @package GeoDirectory
128
-             */
129
-            include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
130
-        } else {
131
-            wp_redirect(geodir_login_url());
132
-            gd_die();
133
-        }
134
-    }
135
-
136
-    if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
137
-        if (current_user_can('manage_options')) {
138
-            switch ($_REQUEST['geodir_autofill']):
139
-                case "geodir_dummy_delete" :
140
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
141
-                        return;
142
-
143
-                    $datatype = isset($_REQUEST['datatype']) ? sanitize_key($_REQUEST['datatype']) : '';
144
-                    if (isset($_REQUEST['posttype']))
145
-                        /**
146
-                         * Used to delete the dummy post data per post type.
147
-                         *
148
-                         * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
149
-                         *
150
-                         * @since 1.6.11
151
-                         * @param string $posttype The post type to insert.
152
-                         * @param string $datatype The type of dummy data to insert.
153
-                         */
154
-                        do_action('geodir_delete_dummy_posts' ,sanitize_key($_REQUEST['posttype']),$datatype);
155
-                    break;
156
-                case "geodir_dummy_insert" :
157
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
158
-                        return;
159
-
160
-                    global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
161
-                    $city_bound_lat1 = $_REQUEST['city_bound_lat1'];
162
-                    $city_bound_lng1 = $_REQUEST['city_bound_lng1'];
163
-                    $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
164
-                    $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
165
-
166
-                    if (isset($_REQUEST['posttype'])){
167
-                        /**
168
-                         * Used to insert the dummy post data per post type.
169
-                         *
170
-                         * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
171
-                         *
172
-                         * @since 1.6.11
173
-                         * @param string $posttype The post type to insert.
174
-                         * @param string $datatype The type of dummy data to insert.
175
-                         * @param int $post_index The item number to insert.
176
-                         */
177
-                        do_action('geodir_insert_dummy_posts',sanitize_key($_REQUEST['posttype']),sanitize_key($_REQUEST['datatype']),absint($_REQUEST['insert_dummy_post_index']));
178
-                    }
179
-
180
-
181
-                    break;
182
-            endswitch;
183
-        } else {
184
-            wp_redirect(geodir_login_url());
185
-            exit();
186
-        }
187
-    }
188
-
189
-    if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
190
-
191
-        if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
192
-            $template = locate_template(array("geodirectory/popup-forms.php"));
193
-            if (!$template) {
194
-                $template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
195
-            }
196
-            require_once($template);
197
-        }
198
-
199
-        gd_die();
200
-    }
201
-
202
-    /*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
111
+		echo '1';
112
+	}
113
+
114
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
115
+		if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
116
+			geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
117
+		else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
118
+			geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
119
+	}
120
+
121
+	if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
122
+		if (current_user_can('manage_options')) {
123
+			/**
124
+			 * Contains admin ajax handling functions.
125
+			 *
126
+			 * @since 1.0.0
127
+			 * @package GeoDirectory
128
+			 */
129
+			include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
130
+		} else {
131
+			wp_redirect(geodir_login_url());
132
+			gd_die();
133
+		}
134
+	}
135
+
136
+	if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
137
+		if (current_user_can('manage_options')) {
138
+			switch ($_REQUEST['geodir_autofill']):
139
+				case "geodir_dummy_delete" :
140
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
141
+						return;
142
+
143
+					$datatype = isset($_REQUEST['datatype']) ? sanitize_key($_REQUEST['datatype']) : '';
144
+					if (isset($_REQUEST['posttype']))
145
+						/**
146
+						 * Used to delete the dummy post data per post type.
147
+						 *
148
+						 * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
149
+						 *
150
+						 * @since 1.6.11
151
+						 * @param string $posttype The post type to insert.
152
+						 * @param string $datatype The type of dummy data to insert.
153
+						 */
154
+						do_action('geodir_delete_dummy_posts' ,sanitize_key($_REQUEST['posttype']),$datatype);
155
+					break;
156
+				case "geodir_dummy_insert" :
157
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
158
+						return;
159
+
160
+					global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
161
+					$city_bound_lat1 = $_REQUEST['city_bound_lat1'];
162
+					$city_bound_lng1 = $_REQUEST['city_bound_lng1'];
163
+					$city_bound_lat2 = $_REQUEST['city_bound_lat2'];
164
+					$city_bound_lng2 = $_REQUEST['city_bound_lng2'];
165
+
166
+					if (isset($_REQUEST['posttype'])){
167
+						/**
168
+						 * Used to insert the dummy post data per post type.
169
+						 *
170
+						 * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
171
+						 *
172
+						 * @since 1.6.11
173
+						 * @param string $posttype The post type to insert.
174
+						 * @param string $datatype The type of dummy data to insert.
175
+						 * @param int $post_index The item number to insert.
176
+						 */
177
+						do_action('geodir_insert_dummy_posts',sanitize_key($_REQUEST['posttype']),sanitize_key($_REQUEST['datatype']),absint($_REQUEST['insert_dummy_post_index']));
178
+					}
179
+
180
+
181
+					break;
182
+			endswitch;
183
+		} else {
184
+			wp_redirect(geodir_login_url());
185
+			exit();
186
+		}
187
+	}
188
+
189
+	if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
190
+
191
+		if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
192
+			$template = locate_template(array("geodirectory/popup-forms.php"));
193
+			if (!$template) {
194
+				$template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
195
+			}
196
+			require_once($template);
197
+		}
198
+
199
+		gd_die();
200
+	}
201
+
202
+	/*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
203 203
         include_once ( geodir_plugin_path() . '/geodirectory-templates/advance-search-form.php');
204 204
     }*/
205 205
 
206
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
207
-        /**
208
-         * Contains map marker functions.
209
-         *
210
-         * @since 1.0.0
211
-         * @package GeoDirectory
212
-         */
213
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
214
-    }
215
-
216
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
217
-        if (is_user_logged_in()) {
218
-            switch ($_REQUEST['ajax_action']):
219
-                case "add" :
220
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
221
-                    break;
222
-                case "remove" :
223
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
224
-                    break;
225
-            endswitch;
226
-        } else {
227
-            wp_redirect(geodir_login_url());
228
-            exit();
229
-        }
230
-    }
231
-
232
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
233
-
234
-        $is_current_user_owner = true;
235
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
236
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
237
-        }
238
-
239
-        $request = $gd_session->get('listing');
240
-
241
-        if (is_user_logged_in() && $is_current_user_owner) {
242
-
243
-            switch ($_REQUEST['ajax_action']):
244
-                case "add":
245
-                case "update":
246
-
247
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
248
-                        $last_id = geodir_save_listing();
249
-
250
-                        if ($last_id) {
251
-                            //$redirect_to = get_permalink( $last_id );
252
-                            $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
253
-
254
-                        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
255
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
256
-                            $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
257
-                        } else
258
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
259
-
260
-                        wp_redirect($redirect_to);
261
-                    } else {
262
-                        $gd_session->un_set('listing');
263
-                        wp_redirect(home_url());
264
-                    }
265
-
266
-                    break;
267
-                case "cancel" :
268
-
269
-                    $gd_session->un_set('listing');
270
-
271
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
272
-                        wp_redirect(get_permalink($_REQUEST['pid']));
273
-                    else {
274
-                        geodir_remove_temp_images();
275
-                        wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
276
-                    }
277
-
278
-                    break;
279
-
280
-                case "publish" :
281
-
282
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
283
-
284
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
285
-                            $new_post = array();
286
-                            $new_post['ID'] = $_REQUEST['pid'];
287
-
288
-                            $lastid = wp_update_post($new_post);
289
-
290
-                            $gd_session->un_set('listing');
291
-                            wp_redirect(get_permalink($lastid));
292
-                        } else {
293
-                            $last_id = geodir_save_listing();
294
-
295
-                            if ($last_id) {
296
-                                //$redirect_to = get_permalink( $last_id );
297
-                                $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
298
-                            } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
299
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
300
-                                $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
301
-                            } else
302
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
303
-
304
-                            $gd_session->un_set('listing');
305
-                            wp_redirect($redirect_to);
306
-                        }
307
-                    } else {
308
-                        $gd_session->un_set('listing');
309
-                        wp_redirect(home_url());
310
-                    }
311
-
312
-                    break;
313
-                case "delete" :
314
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
315
-                        global $current_user;
316
-
317
-                        if (get_option('geodir_disable_perm_delete')) {
318
-                            $lastid = wp_trash_post($_REQUEST['pid']);
319
-                        } else {
320
-                            $lastid = wp_delete_post($_REQUEST['pid']);
321
-                        }
322
-
323
-                        if ($lastid && !is_wp_error($lastid))
324
-                            wp_redirect($_SERVER['HTTP_REFERER']);
325
-
326
-                        //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
327
-                    }
328
-                    break;
329
-            endswitch;
330
-
331
-            $gd_session->un_set('listing');
332
-        } else {
333
-            $gd_session->un_set('listing');
334
-            wp_redirect(geodir_login_url());
335
-            exit();
336
-        }
337
-    }
338
-
339
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
340
-        /**
341
-         * Contains registration and login functions.
342
-         * @todo Fix the file path.
343
-         *
344
-         * @since 1.0.0
345
-         * @package GeoDirectory
346
-         */
347
-        include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
348
-    }
349
-
350
-    if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
351
-        $args = array('taxonomy' => sanitize_text_field($_REQUEST['term']));
352
-        if (!empty($_REQUEST['parent_only'])) {
353
-            $args['parent'] = 0;
354
-        }
355
-        $terms_o = get_terms($args);
206
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
207
+		/**
208
+		 * Contains map marker functions.
209
+		 *
210
+		 * @since 1.0.0
211
+		 * @package GeoDirectory
212
+		 */
213
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
214
+	}
215
+
216
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
217
+		if (is_user_logged_in()) {
218
+			switch ($_REQUEST['ajax_action']):
219
+				case "add" :
220
+					geodir_add_to_favorite((int)$_REQUEST['pid']);
221
+					break;
222
+				case "remove" :
223
+					geodir_remove_from_favorite((int)$_REQUEST['pid']);
224
+					break;
225
+			endswitch;
226
+		} else {
227
+			wp_redirect(geodir_login_url());
228
+			exit();
229
+		}
230
+	}
231
+
232
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
233
+
234
+		$is_current_user_owner = true;
235
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
236
+			$is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
237
+		}
238
+
239
+		$request = $gd_session->get('listing');
240
+
241
+		if (is_user_logged_in() && $is_current_user_owner) {
242
+
243
+			switch ($_REQUEST['ajax_action']):
244
+				case "add":
245
+				case "update":
246
+
247
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
248
+						$last_id = geodir_save_listing();
249
+
250
+						if ($last_id) {
251
+							//$redirect_to = get_permalink( $last_id );
252
+							$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
253
+
254
+						} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
255
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
256
+							$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
257
+						} else
258
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
259
+
260
+						wp_redirect($redirect_to);
261
+					} else {
262
+						$gd_session->un_set('listing');
263
+						wp_redirect(home_url());
264
+					}
265
+
266
+					break;
267
+				case "cancel" :
268
+
269
+					$gd_session->un_set('listing');
270
+
271
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
272
+						wp_redirect(get_permalink($_REQUEST['pid']));
273
+					else {
274
+						geodir_remove_temp_images();
275
+						wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
276
+					}
277
+
278
+					break;
279
+
280
+				case "publish" :
281
+
282
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
283
+
284
+						if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
285
+							$new_post = array();
286
+							$new_post['ID'] = $_REQUEST['pid'];
287
+
288
+							$lastid = wp_update_post($new_post);
289
+
290
+							$gd_session->un_set('listing');
291
+							wp_redirect(get_permalink($lastid));
292
+						} else {
293
+							$last_id = geodir_save_listing();
294
+
295
+							if ($last_id) {
296
+								//$redirect_to = get_permalink( $last_id );
297
+								$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
298
+							} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
299
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
300
+								$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
301
+							} else
302
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
303
+
304
+							$gd_session->un_set('listing');
305
+							wp_redirect($redirect_to);
306
+						}
307
+					} else {
308
+						$gd_session->un_set('listing');
309
+						wp_redirect(home_url());
310
+					}
311
+
312
+					break;
313
+				case "delete" :
314
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
315
+						global $current_user;
316
+
317
+						if (get_option('geodir_disable_perm_delete')) {
318
+							$lastid = wp_trash_post($_REQUEST['pid']);
319
+						} else {
320
+							$lastid = wp_delete_post($_REQUEST['pid']);
321
+						}
322
+
323
+						if ($lastid && !is_wp_error($lastid))
324
+							wp_redirect($_SERVER['HTTP_REFERER']);
325
+
326
+						//wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
327
+					}
328
+					break;
329
+			endswitch;
330
+
331
+			$gd_session->un_set('listing');
332
+		} else {
333
+			$gd_session->un_set('listing');
334
+			wp_redirect(geodir_login_url());
335
+			exit();
336
+		}
337
+	}
338
+
339
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
340
+		/**
341
+		 * Contains registration and login functions.
342
+		 * @todo Fix the file path.
343
+		 *
344
+		 * @since 1.0.0
345
+		 * @package GeoDirectory
346
+		 */
347
+		include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
348
+	}
349
+
350
+	if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
351
+		$args = array('taxonomy' => sanitize_text_field($_REQUEST['term']));
352
+		if (!empty($_REQUEST['parent_only'])) {
353
+			$args['parent'] = 0;
354
+		}
355
+		$terms_o = get_terms($args);
356 356
         
357
-        // Skip terms which has no listing
358
-        if (!empty($terms_o)) {
359
-            $filter_terms = array();
357
+		// Skip terms which has no listing
358
+		if (!empty($terms_o)) {
359
+			$filter_terms = array();
360 360
             
361
-            foreach ($terms_o as $term) {
362
-                if (isset($term->count) && $term->count > 0) {
363
-                    $filter_terms[] = $term;
364
-                }
365
-            }
366
-            $terms_o = $filter_terms;
367
-        }
361
+			foreach ($terms_o as $term) {
362
+				if (isset($term->count) && $term->count > 0) {
363
+					$filter_terms[] = $term;
364
+				}
365
+			}
366
+			$terms_o = $filter_terms;
367
+		}
368 368
         
369
-        $terms = geodir_sort_terms($terms_o, 'count');
370
-        geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
371
-        exit();
372
-    }
369
+		$terms = geodir_sort_terms($terms_o, 'count');
370
+		geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
371
+		exit();
372
+	}
373 373
 
374
-    gd_die();
374
+	gd_die();
375 375
 }
376 376
 
377 377
 
378 378
 function geodir_show_ga_stats(){
379
-    if (isset($_REQUEST['ga_start'])) {
380
-        $ga_start = $_REQUEST['ga_start'];
381
-    } else {
382
-        $ga_start = '';
383
-    }
384
-    if (isset($_REQUEST['ga_end'])) {
385
-        $ga_end = $_REQUEST['ga_end'];
386
-    } else {
387
-        $ga_end = '';
388
-    }
389
-    geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
390
-    die;
379
+	if (isset($_REQUEST['ga_start'])) {
380
+		$ga_start = $_REQUEST['ga_start'];
381
+	} else {
382
+		$ga_start = '';
383
+	}
384
+	if (isset($_REQUEST['ga_end'])) {
385
+		$ga_end = $_REQUEST['ga_end'];
386
+	} else {
387
+		$ga_end = '';
388
+	}
389
+	geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
390
+	die;
391 391
 }
392 392
 add_action( 'wp_ajax_gdga', 'geodir_show_ga_stats' );
393 393
 add_action( 'wp_ajax_nopriv_gdga', 'geodir_show_ga_stats' );
394 394
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
47
+    if (geodir_is_page('login')) {
48 48
         geodir_user_signup();
49 49
     }
50 50
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
          * @since 1.0.0
83 83
          * @package GeoDirectory
84 84
          */
85
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
85
+        include_once(geodir_plugin_path().'/geodirectory-functions/map-functions/get_markers.php');
86 86
         die;
87 87
     }
88 88
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
  * @todo check if nonce is required here and if so add one.
105 105
  */
106 106
 function geodir_ajax_handler() {
107
-    global $wpdb, $gd_session,$post;
107
+    global $wpdb, $gd_session, $post;
108 108
 
109 109
     if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
110 110
 		$gd_session->set('gd_listing_view', $_REQUEST['gd_listing_view']);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
              * @since 1.0.0
127 127
              * @package GeoDirectory
128 128
              */
129
-            include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
129
+            include_once(geodir_plugin_path().'/geodirectory-admin/geodir_admin_ajax.php');
130 130
         } else {
131 131
             wp_redirect(geodir_login_url());
132 132
             gd_die();
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                          * @param string $posttype The post type to insert.
152 152
                          * @param string $datatype The type of dummy data to insert.
153 153
                          */
154
-                        do_action('geodir_delete_dummy_posts' ,sanitize_key($_REQUEST['posttype']),$datatype);
154
+                        do_action('geodir_delete_dummy_posts', sanitize_key($_REQUEST['posttype']), $datatype);
155 155
                     break;
156 156
                 case "geodir_dummy_insert" :
157 157
                     if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                     $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
164 164
                     $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
165 165
 
166
-                    if (isset($_REQUEST['posttype'])){
166
+                    if (isset($_REQUEST['posttype'])) {
167 167
                         /**
168 168
                          * Used to insert the dummy post data per post type.
169 169
                          *
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                          * @param string $datatype The type of dummy data to insert.
175 175
                          * @param int $post_index The item number to insert.
176 176
                          */
177
-                        do_action('geodir_insert_dummy_posts',sanitize_key($_REQUEST['posttype']),sanitize_key($_REQUEST['datatype']),absint($_REQUEST['insert_dummy_post_index']));
177
+                        do_action('geodir_insert_dummy_posts', sanitize_key($_REQUEST['posttype']), sanitize_key($_REQUEST['datatype']), absint($_REQUEST['insert_dummy_post_index']));
178 178
                     }
179 179
 
180 180
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
192 192
             $template = locate_template(array("geodirectory/popup-forms.php"));
193 193
             if (!$template) {
194
-                $template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
194
+                $template = geodir_plugin_path().'/geodirectory-templates/popup-forms.php';
195 195
             }
196 196
             require_once($template);
197 197
         }
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
          * @since 1.0.0
211 211
          * @package GeoDirectory
212 212
          */
213
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
213
+        include_once(geodir_plugin_path().'/geodirectory-functions/map-functions/get_markers.php');
214 214
     }
215 215
 
216 216
     if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
217 217
         if (is_user_logged_in()) {
218 218
             switch ($_REQUEST['ajax_action']):
219 219
                 case "add" :
220
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
220
+                    geodir_add_to_favorite((int) $_REQUEST['pid']);
221 221
                     break;
222 222
                 case "remove" :
223
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
223
+                    geodir_remove_from_favorite((int) $_REQUEST['pid']);
224 224
                     break;
225 225
             endswitch;
226 226
         } else {
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
         $is_current_user_owner = true;
235 235
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
236
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
236
+            $is_current_user_owner = geodir_listing_belong_to_current_user((int) $_REQUEST['pid']);
237 237
         }
238 238
 
239 239
         $request = $gd_session->get('listing');
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
          * @since 1.0.0
345 345
          * @package GeoDirectory
346 346
          */
347
-        include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
347
+        include_once(geodir_plugin_path().'/geodirectory-functions/geodirectory_reg.php');
348 348
     }
349 349
 
350 350
     if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 }
376 376
 
377 377
 
378
-function geodir_show_ga_stats(){
378
+function geodir_show_ga_stats() {
379 379
     if (isset($_REQUEST['ga_start'])) {
380 380
         $ga_start = $_REQUEST['ga_start'];
381 381
     } else {
@@ -389,5 +389,5 @@  discard block
 block discarded – undo
389 389
     geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
390 390
     die;
391 391
 }
392
-add_action( 'wp_ajax_gdga', 'geodir_show_ga_stats' );
393
-add_action( 'wp_ajax_nopriv_gdga', 'geodir_show_ga_stats' );
394 392
\ No newline at end of file
393
+add_action('wp_ajax_gdga', 'geodir_show_ga_stats');
394
+add_action('wp_ajax_nopriv_gdga', 'geodir_show_ga_stats');
395 395
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +27 added lines, -20 removed lines patch added patch discarded remove patch
@@ -112,10 +112,11 @@  discard block
 block discarded – undo
112 112
     }
113 113
 
114 114
     if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
115
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
116
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
117
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
118
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
115
+        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) {
116
+                    geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
117
+        } else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) {
118
+                    geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
119
+        }
119 120
     }
120 121
 
121 122
     if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
@@ -137,12 +138,13 @@  discard block
 block discarded – undo
137 138
         if (current_user_can('manage_options')) {
138 139
             switch ($_REQUEST['geodir_autofill']):
139 140
                 case "geodir_dummy_delete" :
140
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
141
-                        return;
141
+                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) {
142
+                                            return;
143
+                    }
142 144
 
143 145
                     $datatype = isset($_REQUEST['datatype']) ? sanitize_key($_REQUEST['datatype']) : '';
144
-                    if (isset($_REQUEST['posttype']))
145
-                        /**
146
+                    if (isset($_REQUEST['posttype'])) {
147
+                                            /**
146 148
                          * Used to delete the dummy post data per post type.
147 149
                          *
148 150
                          * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
@@ -151,11 +153,13 @@  discard block
 block discarded – undo
151 153
                          * @param string $posttype The post type to insert.
152 154
                          * @param string $datatype The type of dummy data to insert.
153 155
                          */
154
-                        do_action('geodir_delete_dummy_posts' ,sanitize_key($_REQUEST['posttype']),$datatype);
156
+                        do_action('geodir_delete_dummy_posts' ,sanitize_key($_REQUEST['posttype']),$datatype);
157
+                    }
155 158
                     break;
156 159
                 case "geodir_dummy_insert" :
157
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
158
-                        return;
160
+                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) {
161
+                                            return;
162
+                    }
159 163
 
160 164
                     global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
161 165
                     $city_bound_lat1 = $_REQUEST['city_bound_lat1'];
@@ -254,8 +258,9 @@  discard block
 block discarded – undo
254 258
                         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
255 259
                             $redirect_to = get_permalink(geodir_add_listing_page_id());
256 260
                             $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
257
-                        } else
258
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
261
+                        } else {
262
+                                                    $redirect_to = get_permalink(geodir_add_listing_page_id());
263
+                        }
259 264
 
260 265
                         wp_redirect($redirect_to);
261 266
                     } else {
@@ -268,9 +273,9 @@  discard block
 block discarded – undo
268 273
 
269 274
                     $gd_session->un_set('listing');
270 275
 
271
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
272
-                        wp_redirect(get_permalink($_REQUEST['pid']));
273
-                    else {
276
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) {
277
+                                            wp_redirect(get_permalink($_REQUEST['pid']));
278
+                    } else {
274 279
                         geodir_remove_temp_images();
275 280
                         wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
276 281
                     }
@@ -298,8 +303,9 @@  discard block
 block discarded – undo
298 303
                             } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
299 304
                                 $redirect_to = get_permalink(geodir_add_listing_page_id());
300 305
                                 $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
301
-                            } else
302
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
306
+                            } else {
307
+                                                            $redirect_to = get_permalink(geodir_add_listing_page_id());
308
+                            }
303 309
 
304 310
                             $gd_session->un_set('listing');
305 311
                             wp_redirect($redirect_to);
@@ -320,8 +326,9 @@  discard block
 block discarded – undo
320 326
                             $lastid = wp_delete_post($_REQUEST['pid']);
321 327
                         }
322 328
 
323
-                        if ($lastid && !is_wp_error($lastid))
324
-                            wp_redirect($_SERVER['HTTP_REFERER']);
329
+                        if ($lastid && !is_wp_error($lastid)) {
330
+                                                    wp_redirect($_SERVER['HTTP_REFERER']);
331
+                        }
325 332
 
326 333
                         //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
327 334
                     }
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/design_settings_array.php 1 patch
Indentation   +939 added lines, -939 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_post_type_setting_fun()
19 19
 {
20
-    $post_type_arr = array();
20
+	$post_type_arr = array();
21 21
 
22
-    $post_types = geodir_get_posttypes('object');
22
+	$post_types = geodir_get_posttypes('object');
23 23
 
24
-    foreach ($post_types as $key => $post_types_obj) {
25
-        $post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
-    }
27
-    return $post_type_arr;
24
+	foreach ($post_types as $key => $post_types_obj) {
25
+		$post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
+	}
27
+	return $post_type_arr;
28 28
 }
29 29
 
30 30
 /**
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_theme_location_setting_fun()
37 37
 {
38
-    $post_type_arr = array();
39
-    $geodir_all_nav_locations = get_registered_nav_menus();
40
-    $geodir_active_nav_locations = get_nav_menu_locations();
41
-    if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
-        foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
-            if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
-                $post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
-        }
46
-    }
47
-
48
-    return $post_type_arr;
38
+	$post_type_arr = array();
39
+	$geodir_all_nav_locations = get_registered_nav_menus();
40
+	$geodir_active_nav_locations = get_nav_menu_locations();
41
+	if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
+		foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
+			if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
+				$post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
+		}
46
+	}
47
+
48
+	return $post_type_arr;
49 49
 }
50 50
 
51 51
 /**
@@ -56,536 +56,536 @@  discard block
 block discarded – undo
56 56
  */
57 57
 $geodir_settings['design_settings'] = apply_filters('geodir_design_settings', array(
58 58
 
59
-    /* Home Layout Settings start */
60
-    array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
59
+	/* Home Layout Settings start */
60
+	array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
61 61
 
62 62
 
63
-    array('name' => __('Home Top Section Settings', 'geodirectory'),
64
-        'type' => 'sectionstart',
65
-        'desc' => '',
66
-        'id' => 'geodir_home_top_section'),
63
+	array('name' => __('Home Top Section Settings', 'geodirectory'),
64
+		'type' => 'sectionstart',
65
+		'desc' => '',
66
+		'id' => 'geodir_home_top_section'),
67 67
 
68
-    array(
69
-        'name' => __('Home top section', 'geodirectory'),
70
-        'desc' => __('Show the top section of home page', 'geodirectory'),
71
-        'id' => 'geodir_show_home_top_section',
72
-        'type' => 'checkbox',
73
-        'std' => '1' // Default value to show home top section
74
-    ),
68
+	array(
69
+		'name' => __('Home top section', 'geodirectory'),
70
+		'desc' => __('Show the top section of home page', 'geodirectory'),
71
+		'id' => 'geodir_show_home_top_section',
72
+		'type' => 'checkbox',
73
+		'std' => '1' // Default value to show home top section
74
+	),
75 75
 
76 76
 
77
-    array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
77
+	array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
78 78
 
79 79
 
80
-    array('name' => __('Home Page Layout Settings', 'geodirectory'),
81
-        'type' => 'sectionstart',
82
-        'desc' => '',
83
-        'id' => 'geodir_home_layout'),
80
+	array('name' => __('Home Page Layout Settings', 'geodirectory'),
81
+		'type' => 'sectionstart',
82
+		'desc' => '',
83
+		'id' => 'geodir_home_layout'),
84 84
 
85
-    array(
86
-        'name' => __('Home right section', 'geodirectory'),
87
-        'desc' => __('Show the right section of home page', 'geodirectory'),
88
-        'id' => 'geodir_show_home_right_section',
89
-        'type' => 'checkbox',
90
-        'std' => '1' // Default value to show home top section
91
-    ),
85
+	array(
86
+		'name' => __('Home right section', 'geodirectory'),
87
+		'desc' => __('Show the right section of home page', 'geodirectory'),
88
+		'id' => 'geodir_show_home_right_section',
89
+		'type' => 'checkbox',
90
+		'std' => '1' // Default value to show home top section
91
+	),
92 92
 
93
-    array(
94
-        'name' => __('Width of home right section', 'geodirectory'),
95
-        'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
96
-        'id' => 'geodir_width_home_right_section',
97
-        'type' => 'text',
98
-        'css' => 'min-width:300px;',
99
-        'std' => '30' // Default value to show home top section
100
-    ),
93
+	array(
94
+		'name' => __('Width of home right section', 'geodirectory'),
95
+		'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
96
+		'id' => 'geodir_width_home_right_section',
97
+		'type' => 'text',
98
+		'css' => 'min-width:300px;',
99
+		'std' => '30' // Default value to show home top section
100
+	),
101 101
 
102
-    array(
103
-        'name' => __('Home content section', 'geodirectory'),
104
-        'desc' => __('Show the content section of home page', 'geodirectory'),
105
-        'id' => 'geodir_show_home_contant_section',
106
-        'type' => 'checkbox',
107
-        'std' => '1' // Default value to show home top section
108
-    ),
102
+	array(
103
+		'name' => __('Home content section', 'geodirectory'),
104
+		'desc' => __('Show the content section of home page', 'geodirectory'),
105
+		'id' => 'geodir_show_home_contant_section',
106
+		'type' => 'checkbox',
107
+		'std' => '1' // Default value to show home top section
108
+	),
109 109
 
110
-    array(
111
-        'name' => __('Width of home content section', 'geodirectory'),
112
-        'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
113
-        'id' => 'geodir_width_home_contant_section',
114
-        'type' => 'text',
115
-        'css' => 'min-width:300px;',
116
-        'std' => '63' // Default value to show home top section
117
-    ),
110
+	array(
111
+		'name' => __('Width of home content section', 'geodirectory'),
112
+		'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
113
+		'id' => 'geodir_width_home_contant_section',
114
+		'type' => 'text',
115
+		'css' => 'min-width:300px;',
116
+		'std' => '63' // Default value to show home top section
117
+	),
118 118
 
119
-    array(
120
-        'name' => __('Home left section', 'geodirectory'),
121
-        'desc' => __('Show the left section of home page', 'geodirectory'),
122
-        'id' => 'geodir_show_home_left_section',
123
-        'type' => 'checkbox',
124
-        'std' => '0' // Default value to show home top section
125
-    ),
119
+	array(
120
+		'name' => __('Home left section', 'geodirectory'),
121
+		'desc' => __('Show the left section of home page', 'geodirectory'),
122
+		'id' => 'geodir_show_home_left_section',
123
+		'type' => 'checkbox',
124
+		'std' => '0' // Default value to show home top section
125
+	),
126 126
 
127
-    array(
128
-        'name' => __('Width of home left section', 'geodirectory'),
129
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
130
-        'id' => 'geodir_width_home_left_section',
131
-        'type' => 'text',
132
-        'css' => 'min-width:300px;',
133
-        'std' => '30' // Default value to show home top section
134
-    ),
127
+	array(
128
+		'name' => __('Width of home left section', 'geodirectory'),
129
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
130
+		'id' => 'geodir_width_home_left_section',
131
+		'type' => 'text',
132
+		'css' => 'min-width:300px;',
133
+		'std' => '30' // Default value to show home top section
134
+	),
135 135
 
136
-    array(
137
-        'name' => __('Home bottom section', 'geodirectory'),
138
-        'desc' => __('Show the bottom section of home page', 'geodirectory'),
139
-        'id' => 'geodir_show_home_bottom_section',
140
-        'type' => 'checkbox',
141
-        'std' => '0' // Default value to show home top section
142
-    ),
143
-    array(
144
-        'name' => __('Resize image large size', 'geodirectory'),
145
-        'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
146
-        'id' => 'geodir_use_wp_media_large_size',
147
-        'type' => 'checkbox',
148
-        'std' => '0'
149
-    ),
136
+	array(
137
+		'name' => __('Home bottom section', 'geodirectory'),
138
+		'desc' => __('Show the bottom section of home page', 'geodirectory'),
139
+		'id' => 'geodir_show_home_bottom_section',
140
+		'type' => 'checkbox',
141
+		'std' => '0' // Default value to show home top section
142
+	),
143
+	array(
144
+		'name' => __('Resize image large size', 'geodirectory'),
145
+		'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
146
+		'id' => 'geodir_use_wp_media_large_size',
147
+		'type' => 'checkbox',
148
+		'std' => '0'
149
+	),
150 150
 
151
-    array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
151
+	array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
152 152
 
153 153
 
154
-    /* Home Layout Settings end */
154
+	/* Home Layout Settings end */
155 155
 
156 156
 
157
-    /* Listing Layout Settings end */
157
+	/* Listing Layout Settings end */
158 158
 
159
-    array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
159
+	array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
160 160
 
161 161
 
162
-    array('name' => __('Listing Page Layout Settings', 'geodirectory'),
163
-        'type' => 'sectionstart',
164
-        'desc' => '',
165
-        'id' => 'geodir_listing_layout'),
162
+	array('name' => __('Listing Page Layout Settings', 'geodirectory'),
163
+		'type' => 'sectionstart',
164
+		'desc' => '',
165
+		'id' => 'geodir_listing_layout'),
166 166
 
167
-    array(
168
-        'name' => __('Listing top section', 'geodirectory'),
169
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
170
-        'id' => 'geodir_show_listing_top_section',
171
-        'type' => 'checkbox',
172
-        'std' => '1' // Default value to show home top section
173
-    ),
167
+	array(
168
+		'name' => __('Listing top section', 'geodirectory'),
169
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
170
+		'id' => 'geodir_show_listing_top_section',
171
+		'type' => 'checkbox',
172
+		'std' => '1' // Default value to show home top section
173
+	),
174 174
 
175
-    array(
176
-        'name' => __('Listing right section', 'geodirectory'),
177
-        'desc' => __('Show the right section of listing page', 'geodirectory'),
178
-        'id' => 'geodir_show_listing_right_section',
179
-        'type' => 'checkbox',
180
-        'std' => '1' // Default value to show home top section
181
-    ),
175
+	array(
176
+		'name' => __('Listing right section', 'geodirectory'),
177
+		'desc' => __('Show the right section of listing page', 'geodirectory'),
178
+		'id' => 'geodir_show_listing_right_section',
179
+		'type' => 'checkbox',
180
+		'std' => '1' // Default value to show home top section
181
+	),
182 182
 
183
-    array(
184
-        'name' => __('Width of listing right section', 'geodirectory'),
185
-        'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
186
-        'id' => 'geodir_width_listing_right_section',
187
-        'type' => 'text',
188
-        'css' => 'min-width:300px;',
189
-        'std' => '30' // Default value to show home top section
190
-    ),
183
+	array(
184
+		'name' => __('Width of listing right section', 'geodirectory'),
185
+		'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
186
+		'id' => 'geodir_width_listing_right_section',
187
+		'type' => 'text',
188
+		'css' => 'min-width:300px;',
189
+		'std' => '30' // Default value to show home top section
190
+	),
191 191
 
192 192
 
193
-    array(
194
-        'name' => __('Listing content section view', 'geodirectory'),
195
-        'desc' => __('Set the listing view of listing page', 'geodirectory'),
196
-        'id' => 'geodir_listing_view',
197
-        'css' => 'min-width:300px;',
198
-        'std' => 'gridview_onehalf',
199
-        'type' => 'select',
200
-        'class' => 'chosen_select',
201
-        'options' => array_unique(array(
202
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
203
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
204
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
205
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
206
-            'listview' => __('List view', 'geodirectory'),
207
-        ))
208
-    ),
193
+	array(
194
+		'name' => __('Listing content section view', 'geodirectory'),
195
+		'desc' => __('Set the listing view of listing page', 'geodirectory'),
196
+		'id' => 'geodir_listing_view',
197
+		'css' => 'min-width:300px;',
198
+		'std' => 'gridview_onehalf',
199
+		'type' => 'select',
200
+		'class' => 'chosen_select',
201
+		'options' => array_unique(array(
202
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
203
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
204
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
205
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
206
+			'listview' => __('List view', 'geodirectory'),
207
+		))
208
+	),
209 209
 
210
-    array(
211
-        'name' => __('Width of listing content section', 'geodirectory'),
212
-        'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
213
-        'id' => 'geodir_width_listing_contant_section',
214
-        'type' => 'text',
215
-        'css' => 'min-width:300px;',
216
-        'std' => '63' // Default value to show home top section
217
-    ),
210
+	array(
211
+		'name' => __('Width of listing content section', 'geodirectory'),
212
+		'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
213
+		'id' => 'geodir_width_listing_contant_section',
214
+		'type' => 'text',
215
+		'css' => 'min-width:300px;',
216
+		'std' => '63' // Default value to show home top section
217
+	),
218 218
 
219
-    array(
220
-        'name' => __('Listing left section', 'geodirectory'),
221
-        'desc' => __('Show the left section of listing page', 'geodirectory'),
222
-        'id' => 'geodir_show_listing_left_section',
223
-        'type' => 'checkbox',
224
-        'std' => '0' // Default value to show home top section
225
-    ),
219
+	array(
220
+		'name' => __('Listing left section', 'geodirectory'),
221
+		'desc' => __('Show the left section of listing page', 'geodirectory'),
222
+		'id' => 'geodir_show_listing_left_section',
223
+		'type' => 'checkbox',
224
+		'std' => '0' // Default value to show home top section
225
+	),
226 226
 
227
-    array(
228
-        'name' => __('Width of listing left section', 'geodirectory'),
229
-        'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
230
-        'id' => 'geodir_width_listing_left_section',
231
-        'type' => 'text',
232
-        'css' => 'min-width:300px;',
233
-        'std' => '30' // Default value to show home top section
234
-    ),
227
+	array(
228
+		'name' => __('Width of listing left section', 'geodirectory'),
229
+		'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
230
+		'id' => 'geodir_width_listing_left_section',
231
+		'type' => 'text',
232
+		'css' => 'min-width:300px;',
233
+		'std' => '30' // Default value to show home top section
234
+	),
235 235
 
236
-    array(
237
-        'name' => __('Listing bottom section', 'geodirectory'),
238
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
239
-        'id' => 'geodir_show_listing_bottom_section',
240
-        'type' => 'checkbox',
241
-        'std' => '0' // Default value to show home top section
242
-    ),
236
+	array(
237
+		'name' => __('Listing bottom section', 'geodirectory'),
238
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
239
+		'id' => 'geodir_show_listing_bottom_section',
240
+		'type' => 'checkbox',
241
+		'std' => '0' // Default value to show home top section
242
+	),
243 243
 
244
-    array(
245
-        'name' => __('Upload listing no image', 'geodirectory'),
246
-        'desc' => '',
247
-        'id' => 'geodir_listing_no_img',
248
-        'type' => 'file',
249
-        'std' => '0' // Default value to show home top section
250
-    ),
244
+	array(
245
+		'name' => __('Upload listing no image', 'geodirectory'),
246
+		'desc' => '',
247
+		'id' => 'geodir_listing_no_img',
248
+		'type' => 'file',
249
+		'std' => '0' // Default value to show home top section
250
+	),
251 251
 
252
-    array(
253
-        'name' => __('Description word limit', 'geodirectory'),
254
-        'desc' => '',
255
-        'id' => 'geodir_desc_word_limit',
256
-        'type' => 'text',
257
-        'css' => 'min-width:300px;',
258
-        'std' => '50' // Default value to show home top section
259
-    ),
252
+	array(
253
+		'name' => __('Description word limit', 'geodirectory'),
254
+		'desc' => '',
255
+		'id' => 'geodir_desc_word_limit',
256
+		'type' => 'text',
257
+		'css' => 'min-width:300px;',
258
+		'std' => '50' // Default value to show home top section
259
+	),
260 260
 
261
-    array(
262
-        'name' => __('Hover listing map animation', 'geodirectory'),
263
-        'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
264
-        'id' => 'geodir_listing_hover_bounce_map_pin',
265
-        'type' => 'checkbox',
266
-        'std' => '1' // Default value to show home top section
267
-    ),
261
+	array(
262
+		'name' => __('Hover listing map animation', 'geodirectory'),
263
+		'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
264
+		'id' => 'geodir_listing_hover_bounce_map_pin',
265
+		'type' => 'checkbox',
266
+		'std' => '1' // Default value to show home top section
267
+	),
268 268
 
269
-    array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
269
+	array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
270 270
 
271 271
 
272
-    array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
272
+	array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
273 273
 
274
-    array(
275
-        'name' => __('New listing default status', 'geodirectory'),
276
-        'desc' => __('Select new listing default status.', 'geodirectory'),
277
-        'tip' => '',
278
-        'id' => 'geodir_new_post_default_status',
279
-        'css' => 'min-width:300px;',
280
-        'std' => 'publish',
281
-        'type' => 'select',
282
-        'class' => 'chosen_select',
283
-        'options' => array_unique(array(
284
-            'publish' => __('publish', 'geodirectory'),
285
-            'draft' => __('draft', 'geodirectory'),
286
-        ))
287
-    ),
274
+	array(
275
+		'name' => __('New listing default status', 'geodirectory'),
276
+		'desc' => __('Select new listing default status.', 'geodirectory'),
277
+		'tip' => '',
278
+		'id' => 'geodir_new_post_default_status',
279
+		'css' => 'min-width:300px;',
280
+		'std' => 'publish',
281
+		'type' => 'select',
282
+		'class' => 'chosen_select',
283
+		'options' => array_unique(array(
284
+			'publish' => __('publish', 'geodirectory'),
285
+			'draft' => __('draft', 'geodirectory'),
286
+		))
287
+	),
288 288
 
289
-    array(
290
-        'name' => __('New listings settings', 'geodirectory'),
291
-        'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
292
-        'id' => 'geodir_listing_new_days',
293
-        'type' => 'text',
294
-        'css' => 'min-width:300px;',
295
-        'std' => '30' // Default value for the page title - changed in settings
296
-    ),
289
+	array(
290
+		'name' => __('New listings settings', 'geodirectory'),
291
+		'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
292
+		'id' => 'geodir_listing_new_days',
293
+		'type' => 'text',
294
+		'css' => 'min-width:300px;',
295
+		'std' => '30' // Default value for the page title - changed in settings
296
+	),
297 297
 
298
-    array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
298
+	array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
299 299
 
300 300
 
301
-    array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
301
+	array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
302 302
 
303
-    array(
304
-        'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
305
-        'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
306
-        'id' => 'geodir_accept_term_condition',
307
-        'type' => 'checkbox',
308
-        'std' => '1' // Default value to show home top section
309
-    ),
303
+	array(
304
+		'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
305
+		'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
306
+		'id' => 'geodir_accept_term_condition',
307
+		'type' => 'checkbox',
308
+		'std' => '1' // Default value to show home top section
309
+	),
310 310
 
311 311
 
312
-    array(
313
-        'name' => __('Show description field as editor', 'geodirectory'),
314
-        'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
315
-        'tip' => '',
316
-        'id' => 'geodir_tiny_editor_on_add_listing',
317
-        'css' => 'min-width:300px;',
318
-        'std' => array(),
319
-        'type' => 'multiselect',
320
-        'placeholder_text' => __('Select post types', 'geodirectory'),
321
-        'class' => 'chosen_select',
322
-        'options' => array_unique(geodir_post_type_setting_fun())
323
-    ),
312
+	array(
313
+		'name' => __('Show description field as editor', 'geodirectory'),
314
+		'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
315
+		'tip' => '',
316
+		'id' => 'geodir_tiny_editor_on_add_listing',
317
+		'css' => 'min-width:300px;',
318
+		'std' => array(),
319
+		'type' => 'multiselect',
320
+		'placeholder_text' => __('Select post types', 'geodirectory'),
321
+		'class' => 'chosen_select',
322
+		'options' => array_unique(geodir_post_type_setting_fun())
323
+	),
324 324
 
325
-    array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
326
-    /* Listing Layout Settings end */
325
+	array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
326
+	/* Listing Layout Settings end */
327 327
 
328 328
 
329
-    /* Search Layout Settings end */
329
+	/* Search Layout Settings end */
330 330
 
331
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
331
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
332 332
 
333 333
 
334
-    array('name' => __('Search Page Layout Settings', 'geodirectory'),
335
-        'type' => 'sectionstart',
336
-        'desc' => '',
337
-        'id' => 'geodir_search_layout'),
334
+	array('name' => __('Search Page Layout Settings', 'geodirectory'),
335
+		'type' => 'sectionstart',
336
+		'desc' => '',
337
+		'id' => 'geodir_search_layout'),
338 338
 
339
-    array(
340
-        'name' => __('Search top section', 'geodirectory'),
341
-        'desc' => __('Show the top section of search page', 'geodirectory'),
342
-        'id' => 'geodir_show_search_top_section',
343
-        'type' => 'checkbox',
344
-        'std' => '1' // Default value to show home top section
345
-    ),
339
+	array(
340
+		'name' => __('Search top section', 'geodirectory'),
341
+		'desc' => __('Show the top section of search page', 'geodirectory'),
342
+		'id' => 'geodir_show_search_top_section',
343
+		'type' => 'checkbox',
344
+		'std' => '1' // Default value to show home top section
345
+	),
346 346
 
347
-    array(
348
-        'name' => __('Search right section', 'geodirectory'),
349
-        'desc' => __('Show the right section of search page', 'geodirectory'),
350
-        'id' => 'geodir_show_search_right_section',
351
-        'type' => 'checkbox',
352
-        'std' => '1' // Default value to show home top section
353
-    ),
347
+	array(
348
+		'name' => __('Search right section', 'geodirectory'),
349
+		'desc' => __('Show the right section of search page', 'geodirectory'),
350
+		'id' => 'geodir_show_search_right_section',
351
+		'type' => 'checkbox',
352
+		'std' => '1' // Default value to show home top section
353
+	),
354 354
 
355
-    array(
356
-        'name' => __('Width of search right section', 'geodirectory'),
357
-        'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
358
-        'id' => 'geodir_width_search_right_section',
359
-        'type' => 'text',
360
-        'css' => 'min-width:300px;',
361
-        'std' => '30' // Default value to show home top section
362
-    ),
355
+	array(
356
+		'name' => __('Width of search right section', 'geodirectory'),
357
+		'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
358
+		'id' => 'geodir_width_search_right_section',
359
+		'type' => 'text',
360
+		'css' => 'min-width:300px;',
361
+		'std' => '30' // Default value to show home top section
362
+	),
363 363
 
364 364
 
365
-    array(
366
-        'name' => __('Search content section view', 'geodirectory'),
367
-        'desc' => __('Set the listing view of search page', 'geodirectory'),
368
-        'id' => 'geodir_search_view',
369
-        'css' => 'min-width:300px;',
370
-        'std' => 'gridview_onehalf',
371
-        'type' => 'select',
372
-        'class' => 'chosen_select',
373
-        'options' => array_unique(array(
374
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
375
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
376
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
377
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
378
-            'listview' => __('List view', 'geodirectory'),
379
-        ))
380
-    ),
365
+	array(
366
+		'name' => __('Search content section view', 'geodirectory'),
367
+		'desc' => __('Set the listing view of search page', 'geodirectory'),
368
+		'id' => 'geodir_search_view',
369
+		'css' => 'min-width:300px;',
370
+		'std' => 'gridview_onehalf',
371
+		'type' => 'select',
372
+		'class' => 'chosen_select',
373
+		'options' => array_unique(array(
374
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
375
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
376
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
377
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
378
+			'listview' => __('List view', 'geodirectory'),
379
+		))
380
+	),
381 381
 
382
-    array(
383
-        'name' => __('Width of search content section', 'geodirectory'),
384
-        'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
385
-        'id' => 'geodir_width_search_contant_section',
386
-        'type' => 'text',
387
-        'css' => 'min-width:300px;',
388
-        'std' => '63' // Default value to show home top section
389
-    ),
382
+	array(
383
+		'name' => __('Width of search content section', 'geodirectory'),
384
+		'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
385
+		'id' => 'geodir_width_search_contant_section',
386
+		'type' => 'text',
387
+		'css' => 'min-width:300px;',
388
+		'std' => '63' // Default value to show home top section
389
+	),
390 390
 
391
-    array(
392
-        'name' => __('Search left section', 'geodirectory'),
393
-        'desc' => __('Show the left section of search page', 'geodirectory'),
394
-        'id' => 'geodir_show_search_left_section',
395
-        'type' => 'checkbox',
396
-        'std' => '0' // Default value to show home top section
397
-    ),
391
+	array(
392
+		'name' => __('Search left section', 'geodirectory'),
393
+		'desc' => __('Show the left section of search page', 'geodirectory'),
394
+		'id' => 'geodir_show_search_left_section',
395
+		'type' => 'checkbox',
396
+		'std' => '0' // Default value to show home top section
397
+	),
398 398
 
399
-    array(
400
-        'name' => __('Width of search left section', 'geodirectory'),
401
-        'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
402
-        'id' => 'geodir_width_search_left_section',
403
-        'type' => 'text',
404
-        'css' => 'min-width:300px;',
405
-        'std' => '30' // Default value to show home top section
406
-    ),
399
+	array(
400
+		'name' => __('Width of search left section', 'geodirectory'),
401
+		'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
402
+		'id' => 'geodir_width_search_left_section',
403
+		'type' => 'text',
404
+		'css' => 'min-width:300px;',
405
+		'std' => '30' // Default value to show home top section
406
+	),
407 407
 
408
-    array(
409
-        'name' => __('Search bottom section', 'geodirectory'),
410
-        'desc' => __('Show the bottom section of search page', 'geodirectory'),
411
-        'id' => 'geodir_show_search_bottom_section',
412
-        'type' => 'checkbox',
413
-        'std' => '0' // Default value to show home top section
414
-    ),
408
+	array(
409
+		'name' => __('Search bottom section', 'geodirectory'),
410
+		'desc' => __('Show the bottom section of search page', 'geodirectory'),
411
+		'id' => 'geodir_show_search_bottom_section',
412
+		'type' => 'checkbox',
413
+		'std' => '0' // Default value to show home top section
414
+	),
415 415
 	
416 416
 	array(
417
-        'name' => __('Show advanced pagination details', 'geodirectory'),
418
-        'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
419
-        'id' => 'geodir_pagination_advance_info',
420
-        'css' => 'min-width:300px;',
421
-        'std' => '',
422
-        'type' => 'select',
423
-        'class' => 'chosen_select',
424
-        'options' => array(
417
+		'name' => __('Show advanced pagination details', 'geodirectory'),
418
+		'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
419
+		'id' => 'geodir_pagination_advance_info',
420
+		'css' => 'min-width:300px;',
421
+		'std' => '',
422
+		'type' => 'select',
423
+		'class' => 'chosen_select',
424
+		'options' => array(
425 425
 						'' => __('Never Display', 'geodirectory'),
426 426
 						'after' => __('After Pagination', 'geodirectory'),
427 427
 						'before' => __('Before Pagination', 'geodirectory')
428 428
 					)
429
-    ),
429
+	),
430 430
 
431
-    array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
431
+	array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
432 432
 
433 433
 
434
-    array('name' => __('Search form settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
434
+	array('name' => __('Search form settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
435 435
 
436
-    array(
437
-        'name' => __('Use old non-styled form', 'geodirectory'),
438
-        'desc' => __('Will show the old type form (not recommended unless you had added your own styles)', 'geodirectory'),
439
-        'id' => 'geodir_show_search_old_search_from',
440
-        'type' => 'checkbox',
441
-        'std' => '0' // Default value to show
442
-    ),
436
+	array(
437
+		'name' => __('Use old non-styled form', 'geodirectory'),
438
+		'desc' => __('Will show the old type form (not recommended unless you had added your own styles)', 'geodirectory'),
439
+		'id' => 'geodir_show_search_old_search_from',
440
+		'type' => 'checkbox',
441
+		'std' => '0' // Default value to show
442
+	),
443 443
 
444
-    array(
445
-        'name' => __('Search field default value', 'geodirectory'),
446
-        'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
447
-        'id' => 'geodir_search_field_default_text',
448
-        'type' => 'text',
449
-        'css' => 'min-width:300px;',
450
-        'std' => 'Search for' // show on the listing page.
451
-    ),
444
+	array(
445
+		'name' => __('Search field default value', 'geodirectory'),
446
+		'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
447
+		'id' => 'geodir_search_field_default_text',
448
+		'type' => 'text',
449
+		'css' => 'min-width:300px;',
450
+		'std' => 'Search for' // show on the listing page.
451
+	),
452 452
 
453
-    array(
454
-        'name' => __('Near field default value', 'geodirectory'),
455
-        'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
456
-        'id' => 'geodir_near_field_default_text',
457
-        'type' => 'text',
458
-        'css' => 'min-width:300px;',
459
-        'std' => 'Near' // show on the listing page.
460
-    ),
453
+	array(
454
+		'name' => __('Near field default value', 'geodirectory'),
455
+		'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
456
+		'id' => 'geodir_near_field_default_text',
457
+		'type' => 'text',
458
+		'css' => 'min-width:300px;',
459
+		'std' => 'Near' // show on the listing page.
460
+	),
461 461
 
462
-    array(
463
-        'name' => __('Search button label', 'geodirectory'),
464
-        'desc' => __('Show the search button label on search form.', 'geodirectory'),
465
-        'id' => 'geodir_search_button_label',
466
-        'type' => 'text',
467
-        'css' => 'min-width:300px;',
468
-        'std' => 'Search' // show on the listing page.
469
-    ),
462
+	array(
463
+		'name' => __('Search button label', 'geodirectory'),
464
+		'desc' => __('Show the search button label on search form.', 'geodirectory'),
465
+		'id' => 'geodir_search_button_label',
466
+		'type' => 'text',
467
+		'css' => 'min-width:300px;',
468
+		'std' => 'Search' // show on the listing page.
469
+	),
470 470
 
471
-    array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
471
+	array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
472 472
 
473
-    /* Listing Layout Settings end */
473
+	/* Listing Layout Settings end */
474 474
 
475 475
 
476
-    /* Detail Layout Settings end */
476
+	/* Detail Layout Settings end */
477 477
 
478
-    array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
478
+	array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
479 479
 
480
-    array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
480
+	array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
481 481
 
482
-    array(
483
-        'name' => __('Detail top section', 'geodirectory'),
484
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
485
-        'id' => 'geodir_show_detail_top_section',
486
-        'type' => 'checkbox',
487
-        'std' => '1' // Default value to show home top section
488
-    ),
482
+	array(
483
+		'name' => __('Detail top section', 'geodirectory'),
484
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
485
+		'id' => 'geodir_show_detail_top_section',
486
+		'type' => 'checkbox',
487
+		'std' => '1' // Default value to show home top section
488
+	),
489 489
 
490
-    array(
491
-        'name' => __('Detail bottom section', 'geodirectory'),
492
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
493
-        'id' => 'geodir_show_detail_bottom_section',
494
-        'type' => 'checkbox',
495
-        'std' => '1' // Default value to show home top section
496
-    ),
497
-    array(
498
-        'name' => __('Detail sidebar section on left side', 'geodirectory'),
499
-        'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
500
-        'id' => 'geodir_detail_sidebar_left_section',
501
-        'type' => 'checkbox',
502
-        'std' => '0'
503
-    ),
504
-    array(
505
-        'name' => __('Disable GD modal', 'geodirectory'),
506
-        'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
507
-        'id' => 'geodir_disable_gb_modal',
508
-        'type' => 'checkbox',
509
-        'std' => '0'
510
-    ),
511
-    array(
512
-        'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
513
-        'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
514
-        'id' => 'geodir_disable_tfg_buttons_section',
515
-        'type' => 'checkbox',
516
-        'std' => '0'
517
-    ),
518
-    array(
519
-        'name' => __('Disable Google Analytics section', 'geodirectory'),
520
-        'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
521
-        'id' => 'geodir_disable_google_analytics_section',
522
-        'type' => 'checkbox',
523
-        'std' => '0'
524
-    ),
525
-    array(
526
-        'name' => __('Disable User Links section', 'geodirectory'),
527
-        'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
528
-        'id' => 'geodir_disable_user_links_section',
529
-        'type' => 'checkbox',
530
-        'std' => '0'
531
-    ),
532
-    array(
533
-        'name' => __('Disable Rating Info section', 'geodirectory'),
534
-        'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
535
-        'id' => 'geodir_disable_rating_info_section',
536
-        'type' => 'checkbox',
537
-        'std' => '0'
538
-    ),
539
-    array(
540
-        'name' => __('Disable Listing Info section', 'geodirectory'),
541
-        'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
542
-        'id' => 'geodir_disable_listing_info_section',
543
-        'type' => 'checkbox',
544
-        'std' => '0'
545
-    ),
490
+	array(
491
+		'name' => __('Detail bottom section', 'geodirectory'),
492
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
493
+		'id' => 'geodir_show_detail_bottom_section',
494
+		'type' => 'checkbox',
495
+		'std' => '1' // Default value to show home top section
496
+	),
497
+	array(
498
+		'name' => __('Detail sidebar section on left side', 'geodirectory'),
499
+		'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
500
+		'id' => 'geodir_detail_sidebar_left_section',
501
+		'type' => 'checkbox',
502
+		'std' => '0'
503
+	),
504
+	array(
505
+		'name' => __('Disable GD modal', 'geodirectory'),
506
+		'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
507
+		'id' => 'geodir_disable_gb_modal',
508
+		'type' => 'checkbox',
509
+		'std' => '0'
510
+	),
511
+	array(
512
+		'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
513
+		'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
514
+		'id' => 'geodir_disable_tfg_buttons_section',
515
+		'type' => 'checkbox',
516
+		'std' => '0'
517
+	),
518
+	array(
519
+		'name' => __('Disable Google Analytics section', 'geodirectory'),
520
+		'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
521
+		'id' => 'geodir_disable_google_analytics_section',
522
+		'type' => 'checkbox',
523
+		'std' => '0'
524
+	),
525
+	array(
526
+		'name' => __('Disable User Links section', 'geodirectory'),
527
+		'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
528
+		'id' => 'geodir_disable_user_links_section',
529
+		'type' => 'checkbox',
530
+		'std' => '0'
531
+	),
532
+	array(
533
+		'name' => __('Disable Rating Info section', 'geodirectory'),
534
+		'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
535
+		'id' => 'geodir_disable_rating_info_section',
536
+		'type' => 'checkbox',
537
+		'std' => '0'
538
+	),
539
+	array(
540
+		'name' => __('Disable Listing Info section', 'geodirectory'),
541
+		'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
542
+		'id' => 'geodir_disable_listing_info_section',
543
+		'type' => 'checkbox',
544
+		'std' => '0'
545
+	),
546 546
 
547
-    array('type' => 'sectionend', 'id' => 'detail_page_settings'),
547
+	array('type' => 'sectionend', 'id' => 'detail_page_settings'),
548 548
 
549 549
 
550
-    /* ---------- DETAIL PAGE TAB SETTING START*/
550
+	/* ---------- DETAIL PAGE TAB SETTING START*/
551 551
 
552
-    array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
552
+	array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
553 553
 
554
-    array(
555
-        'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
556
-        'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
557
-        'tip' => '',
558
-        'id' => 'geodir_detail_page_tabs_excluded',
559
-        'css' => 'min-width:300px;',
560
-        'std' => geodir_get_posttypes(),
561
-        'type' => 'multiselect',
562
-        'placeholder_text' => __('Select tabs', 'geodirectory'),
563
-        'class' => 'chosen_select',
564
-        'options' => array_unique(geodir_detail_page_tabs_key_value_array())
565
-    ),
554
+	array(
555
+		'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
556
+		'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
557
+		'tip' => '',
558
+		'id' => 'geodir_detail_page_tabs_excluded',
559
+		'css' => 'min-width:300px;',
560
+		'std' => geodir_get_posttypes(),
561
+		'type' => 'multiselect',
562
+		'placeholder_text' => __('Select tabs', 'geodirectory'),
563
+		'class' => 'chosen_select',
564
+		'options' => array_unique(geodir_detail_page_tabs_key_value_array())
565
+	),
566 566
     
567
-    array(
568
-        'name' => __('Show as list', 'geodirectory'),
569
-        'desc' => __('Show as list instead of tabs', 'geodirectory'),
570
-        'id' => 'geodir_disable_tabs',
571
-        'type' => 'checkbox',
572
-        'std' => '0'
573
-    ),
567
+	array(
568
+		'name' => __('Show as list', 'geodirectory'),
569
+		'desc' => __('Show as list instead of tabs', 'geodirectory'),
570
+		'id' => 'geodir_disable_tabs',
571
+		'type' => 'checkbox',
572
+		'std' => '0'
573
+	),
574 574
 
575
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
576
-    /* ---------- DETAIL PAGE TAB SETTING END*/
575
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
576
+	/* ---------- DETAIL PAGE TAB SETTING END*/
577 577
 
578
-    /* START DEFAULT STAR IMAGE*/
579
-    array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
578
+	/* START DEFAULT STAR IMAGE*/
579
+	array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
580 580
 
581
-    array(
582
-        'name' => __('Upload default rating star icon', 'geodirectory'),
583
-        'desc' => '',
584
-        'id' => 'geodir_default_rating_star_icon',
585
-        'type' => 'file',
586
-        'std' => '0',
587
-        'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
588
-    ),
581
+	array(
582
+		'name' => __('Upload default rating star icon', 'geodirectory'),
583
+		'desc' => '',
584
+		'id' => 'geodir_default_rating_star_icon',
585
+		'type' => 'file',
586
+		'std' => '0',
587
+		'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
588
+	),
589 589
 	array(
590 590
 		'name' => __('Enable Font Awesome', 'geodirectory'),
591 591
 		'desc' => __('When enabled all rating images will be using font awesome rating icons as images.', 'geodirectory' ),
@@ -601,369 +601,369 @@  discard block
 block discarded – undo
601 601
 		'std' => '#757575'
602 602
 	),
603 603
 
604
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
604
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
605 605
 
606
-    /* END DEFAULT STAR IMAGE*/
606
+	/* END DEFAULT STAR IMAGE*/
607 607
 
608
-    /* Detail related post settings start */
608
+	/* Detail related post settings start */
609 609
 
610
-    array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
610
+	array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
611 611
 
612
-    array(
613
-        'name' => __('Show related post listing on', 'geodirectory'),
614
-        'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
615
-        'tip' => '',
616
-        'id' => 'geodir_add_related_listing_posttypes',
617
-        'css' => 'min-width:300px;',
618
-        'std' => geodir_get_posttypes(),
619
-        'type' => 'multiselect',
620
-        'placeholder_text' => __('Select post types', 'geodirectory'),
621
-        'class' => 'chosen_select',
622
-        'options' => array_unique(geodir_post_type_setting_fun())
623
-    ),
612
+	array(
613
+		'name' => __('Show related post listing on', 'geodirectory'),
614
+		'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
615
+		'tip' => '',
616
+		'id' => 'geodir_add_related_listing_posttypes',
617
+		'css' => 'min-width:300px;',
618
+		'std' => geodir_get_posttypes(),
619
+		'type' => 'multiselect',
620
+		'placeholder_text' => __('Select post types', 'geodirectory'),
621
+		'class' => 'chosen_select',
622
+		'options' => array_unique(geodir_post_type_setting_fun())
623
+	),
624 624
 
625
-    array(
626
-        'name' => __('Relate to', 'geodirectory'),
627
-        'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
628
-        'id' => 'geodir_related_post_relate_to',
629
-        'css' => 'min-width:300px;',
630
-        'std' => 'category',
631
-        'type' => 'select',
632
-        'class' => 'chosen_select',
633
-        'options' => array_unique(array(
634
-            'category' => __('Categories', 'geodirectory'),
635
-            'tags' => __('Tags', 'geodirectory'),
636
-        ))
637
-    ),
625
+	array(
626
+		'name' => __('Relate to', 'geodirectory'),
627
+		'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
628
+		'id' => 'geodir_related_post_relate_to',
629
+		'css' => 'min-width:300px;',
630
+		'std' => 'category',
631
+		'type' => 'select',
632
+		'class' => 'chosen_select',
633
+		'options' => array_unique(array(
634
+			'category' => __('Categories', 'geodirectory'),
635
+			'tags' => __('Tags', 'geodirectory'),
636
+		))
637
+	),
638 638
 
639
-    array(
640
-        'name' => __('Layout', 'geodirectory'),
641
-        'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
642
-        'id' => 'geodir_related_post_listing_view',
643
-        'css' => 'min-width:300px;',
644
-        'std' => 'gridview_onehalf',
645
-        'type' => 'select',
646
-        'class' => 'chosen_select',
647
-        'options' => array_unique(array(
648
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
649
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
650
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
651
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
652
-            'listview' => __('List view', 'geodirectory'),
653
-        ))
654
-    ),
639
+	array(
640
+		'name' => __('Layout', 'geodirectory'),
641
+		'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
642
+		'id' => 'geodir_related_post_listing_view',
643
+		'css' => 'min-width:300px;',
644
+		'std' => 'gridview_onehalf',
645
+		'type' => 'select',
646
+		'class' => 'chosen_select',
647
+		'options' => array_unique(array(
648
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
649
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
650
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
651
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
652
+			'listview' => __('List view', 'geodirectory'),
653
+		))
654
+	),
655 655
 
656
-    array(
657
-        'name' => __('Sort by', 'geodirectory'),
658
-        'desc' => __('Set the related post listing sort by view', 'geodirectory'),
659
-        'id' => 'geodir_related_post_sortby',
660
-        'css' => 'min-width:300px;',
661
-        'std' => 'latest',
662
-        'type' => 'select',
663
-        'class' => 'chosen_select',
664
-        'options' => array_unique(array(
665
-            'latest' => __('Latest', 'geodirectory'),
666
-            'featured' => __('Featured', 'geodirectory'),
667
-            'high_review' => __('Review', 'geodirectory'),
668
-            'high_rating' => __('Rating', 'geodirectory'),
669
-            'random' => __('Random', 'geodirectory'),
670
-            'nearest' => __('Nearest', 'geodirectory'),
671
-        ))
672
-    ),
656
+	array(
657
+		'name' => __('Sort by', 'geodirectory'),
658
+		'desc' => __('Set the related post listing sort by view', 'geodirectory'),
659
+		'id' => 'geodir_related_post_sortby',
660
+		'css' => 'min-width:300px;',
661
+		'std' => 'latest',
662
+		'type' => 'select',
663
+		'class' => 'chosen_select',
664
+		'options' => array_unique(array(
665
+			'latest' => __('Latest', 'geodirectory'),
666
+			'featured' => __('Featured', 'geodirectory'),
667
+			'high_review' => __('Review', 'geodirectory'),
668
+			'high_rating' => __('Rating', 'geodirectory'),
669
+			'random' => __('Random', 'geodirectory'),
670
+			'nearest' => __('Nearest', 'geodirectory'),
671
+		))
672
+	),
673 673
 
674
-    array(
675
-        'name' => __('Number of posts:', 'geodirectory'),
676
-        'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
677
-        'id' => 'geodir_related_post_count',
678
-        'type' => 'text',
679
-        'css' => 'min-width:300px;',
680
-        'std' => '5' // Default value to show home top section
681
-    ),
674
+	array(
675
+		'name' => __('Number of posts:', 'geodirectory'),
676
+		'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
677
+		'id' => 'geodir_related_post_count',
678
+		'type' => 'text',
679
+		'css' => 'min-width:300px;',
680
+		'std' => '5' // Default value to show home top section
681
+	),
682 682
 
683
-    array(
684
-        'name' => __('Post excerpt', 'geodirectory'),
685
-        'desc' => __('Post content excerpt character count', 'geodirectory'),
686
-        'id' => 'geodir_related_post_excerpt',
687
-        'type' => 'text',
688
-        'css' => 'min-width:300px;',
689
-        'std' => '20' // Default value to show home top section
690
-    ),
683
+	array(
684
+		'name' => __('Post excerpt', 'geodirectory'),
685
+		'desc' => __('Post content excerpt character count', 'geodirectory'),
686
+		'id' => 'geodir_related_post_excerpt',
687
+		'type' => 'text',
688
+		'css' => 'min-width:300px;',
689
+		'std' => '20' // Default value to show home top section
690
+	),
691 691
 
692 692
 
693
-    array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
694
-    /* Detail Layout Settings end */
693
+	array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
694
+	/* Detail Layout Settings end */
695 695
 
696
-    /* Author Layout Settings Start */
696
+	/* Author Layout Settings Start */
697 697
 
698
-    array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
698
+	array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
699 699
 
700 700
 
701
-    array('name' => __('Author Page Layout Settings', 'geodirectory'),
702
-        'type' => 'sectionstart',
703
-        'desc' => '',
704
-        'id' => 'geodir_author_layout'),
701
+	array('name' => __('Author Page Layout Settings', 'geodirectory'),
702
+		'type' => 'sectionstart',
703
+		'desc' => '',
704
+		'id' => 'geodir_author_layout'),
705 705
 
706
-    array(
707
-        'name' => __('Author top section', 'geodirectory'),
708
-        'desc' => __('Show the top section of author page', 'geodirectory'),
709
-        'id' => 'geodir_show_author_top_section',
710
-        'type' => 'checkbox',
711
-        'std' => '1' // Default value to show home top section
712
-    ),
706
+	array(
707
+		'name' => __('Author top section', 'geodirectory'),
708
+		'desc' => __('Show the top section of author page', 'geodirectory'),
709
+		'id' => 'geodir_show_author_top_section',
710
+		'type' => 'checkbox',
711
+		'std' => '1' // Default value to show home top section
712
+	),
713 713
 
714
-    array(
715
-        'name' => __('Author right section', 'geodirectory'),
716
-        'desc' => __('Show the right section of author page', 'geodirectory'),
717
-        'id' => 'geodir_show_author_right_section',
718
-        'type' => 'checkbox',
719
-        'std' => '1' // Default value to show home top section
720
-    ),
714
+	array(
715
+		'name' => __('Author right section', 'geodirectory'),
716
+		'desc' => __('Show the right section of author page', 'geodirectory'),
717
+		'id' => 'geodir_show_author_right_section',
718
+		'type' => 'checkbox',
719
+		'std' => '1' // Default value to show home top section
720
+	),
721 721
 
722
-    array(
723
-        'name' => __('Width of author right section', 'geodirectory'),
724
-        'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
725
-        'id' => 'geodir_width_author_right_section',
726
-        'type' => 'text',
727
-        'css' => 'min-width:300px;',
728
-        'std' => '30' // Default value to show home top section
729
-    ),
722
+	array(
723
+		'name' => __('Width of author right section', 'geodirectory'),
724
+		'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
725
+		'id' => 'geodir_width_author_right_section',
726
+		'type' => 'text',
727
+		'css' => 'min-width:300px;',
728
+		'std' => '30' // Default value to show home top section
729
+	),
730 730
 
731
-    array(
732
-        'name' => __('Author content section view', 'geodirectory'),
733
-        'desc' => __('Set the listing view of author page', 'geodirectory'),
734
-        'id' => 'geodir_author_view',
735
-        'css' => 'min-width:300px;',
736
-        'std' => 'gridview_onehalf',
737
-        'type' => 'select',
738
-        'class' => 'chosen_select',
739
-        'options' => array_unique(array(
740
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
741
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
742
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
743
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
744
-            'listview' => __('List view', 'geodirectory'),
745
-        ))
746
-    ),
731
+	array(
732
+		'name' => __('Author content section view', 'geodirectory'),
733
+		'desc' => __('Set the listing view of author page', 'geodirectory'),
734
+		'id' => 'geodir_author_view',
735
+		'css' => 'min-width:300px;',
736
+		'std' => 'gridview_onehalf',
737
+		'type' => 'select',
738
+		'class' => 'chosen_select',
739
+		'options' => array_unique(array(
740
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
741
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
742
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
743
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
744
+			'listview' => __('List view', 'geodirectory'),
745
+		))
746
+	),
747 747
 
748
-    array(
749
-        'name' => __('Width of author content section', 'geodirectory'),
750
-        'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
751
-        'id' => 'geodir_width_author_contant_section',
752
-        'type' => 'text',
753
-        'css' => 'min-width:300px;',
754
-        'std' => '63' // Default value to show home top section
755
-    ),
748
+	array(
749
+		'name' => __('Width of author content section', 'geodirectory'),
750
+		'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
751
+		'id' => 'geodir_width_author_contant_section',
752
+		'type' => 'text',
753
+		'css' => 'min-width:300px;',
754
+		'std' => '63' // Default value to show home top section
755
+	),
756 756
 
757
-    array(
758
-        'name' => __('Author left section', 'geodirectory'),
759
-        'desc' => __('Show the left section of author page', 'geodirectory'),
760
-        'id' => 'geodir_show_author_left_section',
761
-        'type' => 'checkbox',
762
-        'std' => '0' // Default value to show home top section
763
-    ),
757
+	array(
758
+		'name' => __('Author left section', 'geodirectory'),
759
+		'desc' => __('Show the left section of author page', 'geodirectory'),
760
+		'id' => 'geodir_show_author_left_section',
761
+		'type' => 'checkbox',
762
+		'std' => '0' // Default value to show home top section
763
+	),
764 764
 
765
-    array(
766
-        'name' => __('Width of author left section', 'geodirectory'),
767
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
768
-        'id' => 'geodir_width_author_left_section',
769
-        'type' => 'text',
770
-        'css' => 'min-width:300px;',
771
-        'std' => '30' // Default value to show home top section
772
-    ),
765
+	array(
766
+		'name' => __('Width of author left section', 'geodirectory'),
767
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
768
+		'id' => 'geodir_width_author_left_section',
769
+		'type' => 'text',
770
+		'css' => 'min-width:300px;',
771
+		'std' => '30' // Default value to show home top section
772
+	),
773 773
 
774
-    array(
775
-        'name' => __('Author bottom section', 'geodirectory'),
776
-        'desc' => __('Show the bottom section of author page', 'geodirectory'),
777
-        'id' => 'geodir_show_author_bottom_section',
778
-        'type' => 'checkbox',
779
-        'std' => '0' // Default value to show home top section
780
-    ),
774
+	array(
775
+		'name' => __('Author bottom section', 'geodirectory'),
776
+		'desc' => __('Show the bottom section of author page', 'geodirectory'),
777
+		'id' => 'geodir_show_author_bottom_section',
778
+		'type' => 'checkbox',
779
+		'std' => '0' // Default value to show home top section
780
+	),
781 781
 
782 782
 
783
-    array(
784
-        'name' => __('Description word limit', 'geodirectory'),
785
-        'desc' => '',
786
-        'id' => 'geodir_author_desc_word_limit',
787
-        'type' => 'text',
788
-        'css' => 'min-width:300px;',
789
-        'std' => '50' // Default value to show home top section
790
-    ),
783
+	array(
784
+		'name' => __('Description word limit', 'geodirectory'),
785
+		'desc' => '',
786
+		'id' => 'geodir_author_desc_word_limit',
787
+		'type' => 'text',
788
+		'css' => 'min-width:300px;',
789
+		'std' => '50' // Default value to show home top section
790
+	),
791 791
 
792
-    array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
793
-    /* Author Layout Settings end */
792
+	array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
793
+	/* Author Layout Settings end */
794 794
 
795 795
 
796
-    /* Post Type Navigation Settings Start */
797
-    array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
796
+	/* Post Type Navigation Settings Start */
797
+	array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
798 798
 
799 799
 
800
-    /* Post Type Navigation Settings Start */
800
+	/* Post Type Navigation Settings Start */
801 801
 
802
-    array('name' => __('Navigation Locations', 'geodirectory'),
803
-        'type' => 'sectionstart',
804
-        'desc' => '',
805
-        'id' => 'geodir_navigation_locations'),
802
+	array('name' => __('Navigation Locations', 'geodirectory'),
803
+		'type' => 'sectionstart',
804
+		'desc' => '',
805
+		'id' => 'geodir_navigation_locations'),
806 806
 
807
-    array(
808
-        'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
809
-        'desc' => '',
810
-        'tip' => '',
811
-        'id' => 'geodir_theme_location_nav',
812
-        'css' => 'min-width:300px;',
813
-        'std' => array(),
814
-        'type' => 'multiselect',
815
-        'placeholder_text' => __('Select menu locations', 'geodirectory'),
816
-        'class' => 'chosen_select',
817
-        'options' => array_unique(geodir_theme_location_setting_fun())
818
-    ),
819
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
820
-
821
-
822
-    array('name' => __('Navigation Settings', 'geodirectory'),
823
-        'type' => 'sectionstart',
824
-        'desc' => '',
825
-        'id' => 'geodir_navigation_options'),
807
+	array(
808
+		'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
809
+		'desc' => '',
810
+		'tip' => '',
811
+		'id' => 'geodir_theme_location_nav',
812
+		'css' => 'min-width:300px;',
813
+		'std' => array(),
814
+		'type' => 'multiselect',
815
+		'placeholder_text' => __('Select menu locations', 'geodirectory'),
816
+		'class' => 'chosen_select',
817
+		'options' => array_unique(geodir_theme_location_setting_fun())
818
+	),
819
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
826 820
 
827 821
 
828
-    array(
829
-        'name' => __('Show add listing navigation in menu', 'geodirectory'),
830
-        'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
831
-        'id' => 'geodir_show_addlisting_nav',
832
-        'std' => '1',
833
-        'type' => 'checkbox'
834
-    ),
822
+	array('name' => __('Navigation Settings', 'geodirectory'),
823
+		'type' => 'sectionstart',
824
+		'desc' => '',
825
+		'id' => 'geodir_navigation_options'),
835 826
 
836
-    array(
837
-        'name' => __('Show listings navigation in menu', 'geodirectory'),
838
-        'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
839
-        'id' => 'geodir_show_listing_nav',
840
-        'std' => '1',
841
-        'type' => 'checkbox'
842
-    ),
843 827
 
844
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
828
+	array(
829
+		'name' => __('Show add listing navigation in menu', 'geodirectory'),
830
+		'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
831
+		'id' => 'geodir_show_addlisting_nav',
832
+		'std' => '1',
833
+		'type' => 'checkbox'
834
+	),
845 835
 
836
+	array(
837
+		'name' => __('Show listings navigation in menu', 'geodirectory'),
838
+		'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
839
+		'id' => 'geodir_show_listing_nav',
840
+		'std' => '1',
841
+		'type' => 'checkbox'
842
+	),
846 843
 
847
-    array('name' => __('Post Type Navigation Settings', 'geodirectory'),
848
-        'type' => 'sectionstart',
849
-        'desc' => '',
850
-        'id' => 'geodir_post_type_navigation_layout'),
851
-    array(
852
-        'name' => __('Show listing link in main navigation', 'geodirectory'),
853
-        'desc' => '',
854
-        'tip' => '',
855
-        'id' => 'geodir_add_posttype_in_main_nav',
856
-        'css' => 'min-width:300px;',
857
-        'std' => array(),
858
-        'type' => 'multiselect',
859
-        'placeholder_text' => __('Select post types', 'geodirectory'),
860
-        'class' => 'chosen_select',
861
-        'options' => array_unique(geodir_post_type_setting_fun())
862
-    ),
844
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
863 845
 
864
-    array(
865
-        'name' => __('Show listing link in listing navigation', 'geodirectory'),
866
-        'desc' => '',
867
-        'tip' => '',
868
-        'id' => 'geodir_add_posttype_in_listing_nav',
869
-        'css' => 'min-width:300px;',
870
-        'std' => geodir_get_posttypes(),
871
-        'type' => 'multiselect',
872
-        'placeholder_text' => __('Select post types', 'geodirectory'),
873
-        'class' => 'chosen_select',
874
-        'options' => array_unique(geodir_post_type_setting_fun())
875
-    ),
876 846
 
877
-    array(
878
-        'name' => __('Allow post type to add from frontend', 'geodirectory'),
879
-        'desc' => '',
880
-        'tip' => '',
881
-        'id' => 'geodir_allow_posttype_frontend',
882
-        'css' => 'min-width:300px;',
883
-        'std' => geodir_get_posttypes(),
884
-        'type' => 'multiselect',
885
-        'placeholder_text' => __('Select post types', 'geodirectory'),
886
-        'class' => 'chosen_select',
887
-        'options' => array_unique(geodir_post_type_setting_fun())
888
-    ),
847
+	array('name' => __('Post Type Navigation Settings', 'geodirectory'),
848
+		'type' => 'sectionstart',
849
+		'desc' => '',
850
+		'id' => 'geodir_post_type_navigation_layout'),
851
+	array(
852
+		'name' => __('Show listing link in main navigation', 'geodirectory'),
853
+		'desc' => '',
854
+		'tip' => '',
855
+		'id' => 'geodir_add_posttype_in_main_nav',
856
+		'css' => 'min-width:300px;',
857
+		'std' => array(),
858
+		'type' => 'multiselect',
859
+		'placeholder_text' => __('Select post types', 'geodirectory'),
860
+		'class' => 'chosen_select',
861
+		'options' => array_unique(geodir_post_type_setting_fun())
862
+	),
889 863
 
890
-    array(
891
-        'name' => __('Show add listing link in main navigation', 'geodirectory'),
892
-        'desc' => '',
893
-        'tip' => '',
894
-        'id' => 'geodir_add_listing_link_main_nav',
895
-        'css' => 'min-width:300px;',
896
-        'std' => array(),
897
-        'type' => 'multiselect',
898
-        'placeholder_text' => __('Select post types', 'geodirectory'),
899
-        'class' => 'chosen_select',
900
-        'options' => array_unique(geodir_post_type_setting_fun())
901
-    ),
864
+	array(
865
+		'name' => __('Show listing link in listing navigation', 'geodirectory'),
866
+		'desc' => '',
867
+		'tip' => '',
868
+		'id' => 'geodir_add_posttype_in_listing_nav',
869
+		'css' => 'min-width:300px;',
870
+		'std' => geodir_get_posttypes(),
871
+		'type' => 'multiselect',
872
+		'placeholder_text' => __('Select post types', 'geodirectory'),
873
+		'class' => 'chosen_select',
874
+		'options' => array_unique(geodir_post_type_setting_fun())
875
+	),
902 876
 
903
-    array(
904
-        'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
905
-        'desc' => '',
906
-        'tip' => '',
907
-        'id' => 'geodir_add_listing_link_add_listing_nav',
908
-        'css' => 'min-width:300px;',
909
-        'std' => geodir_get_posttypes(),
910
-        'type' => 'multiselect',
911
-        'class' => 'chosen_select',
912
-        'options' => array_unique(geodir_post_type_setting_fun())
913
-    ),
877
+	array(
878
+		'name' => __('Allow post type to add from frontend', 'geodirectory'),
879
+		'desc' => '',
880
+		'tip' => '',
881
+		'id' => 'geodir_allow_posttype_frontend',
882
+		'css' => 'min-width:300px;',
883
+		'std' => geodir_get_posttypes(),
884
+		'type' => 'multiselect',
885
+		'placeholder_text' => __('Select post types', 'geodirectory'),
886
+		'class' => 'chosen_select',
887
+		'options' => array_unique(geodir_post_type_setting_fun())
888
+	),
914 889
 
915
-    array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
890
+	array(
891
+		'name' => __('Show add listing link in main navigation', 'geodirectory'),
892
+		'desc' => '',
893
+		'tip' => '',
894
+		'id' => 'geodir_add_listing_link_main_nav',
895
+		'css' => 'min-width:300px;',
896
+		'std' => array(),
897
+		'type' => 'multiselect',
898
+		'placeholder_text' => __('Select post types', 'geodirectory'),
899
+		'class' => 'chosen_select',
900
+		'options' => array_unique(geodir_post_type_setting_fun())
901
+	),
916 902
 
903
+	array(
904
+		'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
905
+		'desc' => '',
906
+		'tip' => '',
907
+		'id' => 'geodir_add_listing_link_add_listing_nav',
908
+		'css' => 'min-width:300px;',
909
+		'std' => geodir_get_posttypes(),
910
+		'type' => 'multiselect',
911
+		'class' => 'chosen_select',
912
+		'options' => array_unique(geodir_post_type_setting_fun())
913
+	),
917 914
 
918
-    array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
915
+	array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
919 916
 
920 917
 
921
-    array(
922
-        'name' => __('Show add listing link in user dashboard', 'geodirectory'),
923
-        'desc' => '',
924
-        'tip' => '',
925
-        'id' => 'geodir_add_listing_link_user_dashboard',
926
-        'css' => 'min-width:300px;',
927
-        'std' => geodir_get_posttypes(),
928
-        'type' => 'multiselect',
929
-        'placeholder_text' => __('Select post types', 'geodirectory'),
930
-        'class' => 'chosen_select',
931
-        'options' => array_unique(geodir_post_type_setting_fun())
932
-    ),
918
+	array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
933 919
 
934
-    array(
935
-        'name' => __('Show favorite link in user dashboard', 'geodirectory'),
936
-        'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
937
-        'tip' => '',
938
-        'id' => 'geodir_favorite_link_user_dashboard',
939
-        'css' => 'min-width:300px;',
940
-        'std' => geodir_get_posttypes(),
941
-        'type' => 'multiselect',
942
-        'placeholder_text' => __('Select post types', 'geodirectory'),
943
-        'class' => 'chosen_select',
944
-        'options' => array_unique(geodir_post_type_setting_fun())
945
-    ),
946 920
 
947
-    array(
948
-        'name' => __('Show listing link in user dashboard', 'geodirectory'),
949
-        'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
950
-        'tip' => '',
951
-        'id' => 'geodir_listing_link_user_dashboard',
952
-        'css' => 'min-width:300px;',
953
-        'std' => geodir_get_posttypes(),
954
-        'type' => 'multiselect',
955
-        'placeholder_text' => __('Select post types', 'geodirectory'),
956
-        'class' => 'chosen_select',
957
-        'options' => array_unique(geodir_post_type_setting_fun())
958
-    ),
959
-
960
-    array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
961
-    /* Post Type Navigation Settings End */
962
-
963
-    /* Script Settings Start */
964
-    array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
965
-
966
-    /*
921
+	array(
922
+		'name' => __('Show add listing link in user dashboard', 'geodirectory'),
923
+		'desc' => '',
924
+		'tip' => '',
925
+		'id' => 'geodir_add_listing_link_user_dashboard',
926
+		'css' => 'min-width:300px;',
927
+		'std' => geodir_get_posttypes(),
928
+		'type' => 'multiselect',
929
+		'placeholder_text' => __('Select post types', 'geodirectory'),
930
+		'class' => 'chosen_select',
931
+		'options' => array_unique(geodir_post_type_setting_fun())
932
+	),
933
+
934
+	array(
935
+		'name' => __('Show favorite link in user dashboard', 'geodirectory'),
936
+		'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
937
+		'tip' => '',
938
+		'id' => 'geodir_favorite_link_user_dashboard',
939
+		'css' => 'min-width:300px;',
940
+		'std' => geodir_get_posttypes(),
941
+		'type' => 'multiselect',
942
+		'placeholder_text' => __('Select post types', 'geodirectory'),
943
+		'class' => 'chosen_select',
944
+		'options' => array_unique(geodir_post_type_setting_fun())
945
+	),
946
+
947
+	array(
948
+		'name' => __('Show listing link in user dashboard', 'geodirectory'),
949
+		'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
950
+		'tip' => '',
951
+		'id' => 'geodir_listing_link_user_dashboard',
952
+		'css' => 'min-width:300px;',
953
+		'std' => geodir_get_posttypes(),
954
+		'type' => 'multiselect',
955
+		'placeholder_text' => __('Select post types', 'geodirectory'),
956
+		'class' => 'chosen_select',
957
+		'options' => array_unique(geodir_post_type_setting_fun())
958
+	),
959
+
960
+	array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
961
+	/* Post Type Navigation Settings End */
962
+
963
+	/* Script Settings Start */
964
+	array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
965
+
966
+	/*
967 967
     array( 	'name' => __( 'Add/Remove Scripts', 'geodirectory' ),
968 968
                 'type' => 'sectionstart',
969 969
                 'desc' => '',
@@ -989,190 +989,190 @@  discard block
 block discarded – undo
989 989
 
990 990
     */
991 991
 
992
-    array('name' => __('GD Lazy Load Images', 'geodirectory'),
993
-        'type' => 'sectionstart',
994
-        'desc' => '',
995
-        'id' => 'geodir_gdll_settings'),
992
+	array('name' => __('GD Lazy Load Images', 'geodirectory'),
993
+		'type' => 'sectionstart',
994
+		'desc' => '',
995
+		'id' => 'geodir_gdll_settings'),
996 996
 
997
-    array(
998
-        'name' => __('Enable lazy load images?', 'geodirectory'),
999
-        'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
1000
-        'id' => 'geodir_lazy_load',
1001
-        'type' => 'checkbox',
1002
-        'std' => '1' // Default value to show home top section
1003
-    ),
1004
-    array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
997
+	array(
998
+		'name' => __('Enable lazy load images?', 'geodirectory'),
999
+		'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
1000
+		'id' => 'geodir_lazy_load',
1001
+		'type' => 'checkbox',
1002
+		'std' => '1' // Default value to show home top section
1003
+	),
1004
+	array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
1005 1005
     
1006 1006
 
1007
-    array('name' => __('Script Settings', 'geodirectory'),
1008
-        'type' => 'sectionstart',
1009
-        'desc' => '',
1010
-        'id' => 'geodir_script_settings'),
1007
+	array('name' => __('Script Settings', 'geodirectory'),
1008
+		'type' => 'sectionstart',
1009
+		'desc' => '',
1010
+		'id' => 'geodir_script_settings'),
1011 1011
 
1012
-    array(
1013
-        'name' => __('Custom style css code', 'geodirectory'),
1014
-        'desc' => '',
1015
-        'id' => 'geodir_coustem_css',
1016
-        'type' => 'textarea',
1017
-        'css' => 'min-width:300px;',
1018
-        'std' => '' // Default value for the page title - changed in settings
1019
-    ),
1012
+	array(
1013
+		'name' => __('Custom style css code', 'geodirectory'),
1014
+		'desc' => '',
1015
+		'id' => 'geodir_coustem_css',
1016
+		'type' => 'textarea',
1017
+		'css' => 'min-width:300px;',
1018
+		'std' => '' // Default value for the page title - changed in settings
1019
+	),
1020 1020
 
1021
-    array(
1022
-        'name' => __('Header script code', 'geodirectory'),
1023
-        'desc' => '',
1024
-        'id' => 'geodir_header_scripts',
1025
-        'type' => 'textarea',
1026
-        'css' => 'min-width:300px;',
1027
-        'std' => '' // Default value for the page title - changed in settings
1028
-    ),
1021
+	array(
1022
+		'name' => __('Header script code', 'geodirectory'),
1023
+		'desc' => '',
1024
+		'id' => 'geodir_header_scripts',
1025
+		'type' => 'textarea',
1026
+		'css' => 'min-width:300px;',
1027
+		'std' => '' // Default value for the page title - changed in settings
1028
+	),
1029 1029
 
1030
-    array(
1031
-        'name' => __('Footer script code', 'geodirectory'),
1032
-        'desc' => '',
1033
-        'id' => 'geodir_footer_scripts',
1034
-        'type' => 'textarea',
1035
-        'css' => 'min-width:300px;',
1036
-        'std' => '' // Default value for the page title - changed in settings
1037
-    ),
1030
+	array(
1031
+		'name' => __('Footer script code', 'geodirectory'),
1032
+		'desc' => '',
1033
+		'id' => 'geodir_footer_scripts',
1034
+		'type' => 'textarea',
1035
+		'css' => 'min-width:300px;',
1036
+		'std' => '' // Default value for the page title - changed in settings
1037
+	),
1038 1038
 
1039
-    array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1040
-    /* Script Settings End */
1039
+	array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1040
+	/* Script Settings End */
1041 1041
 
1042
-    /* Map Settings Start */
1043
-    array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1042
+	/* Map Settings Start */
1043
+	array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1044 1044
 
1045 1045
 
1046
-    // Google API key
1047
-    array(
1048
-        'name' => __('Google Maps API KEY', 'geodirectory'),
1049
-        'type' => 'sectionstart',
1050
-        'desc' => '',
1051
-        'id' => 'geodir_google_api_key'
1052
-    ),
1053
-    array(
1054
-        'name' => __('Google Maps API KEY', 'geodirectory'),
1055
-        'desc' => sprintf(
1056
-            __('This is a requirement to use Google Maps, you can get a key from <a href="%s" target="_blank">here</a> OR you can set GD to use Open Street Maps below under Select Maps API setting.   (<a href="%s" target="_blank">How to add a Google API KEY?</a>)', 'geodirectory'),
1057
-            'https://console.developers.google.com/flows/enableapi?apiid=places_backend,maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true','https://wpgeodirectory.com/docs/add-google-api-key/' ),
1058
-        'tip' => '',
1059
-        'id' => 'geodir_google_api_key',
1060
-        'css' => 'min-width:300px;',
1061
-        'std' => '',
1062
-        'type' => 'map-key',
1063
-    ),
1064
-    array(
1065
-        'type' => 'sectionend',
1066
-        'id' => 'geodir_google_api_key'
1067
-    ),
1046
+	// Google API key
1047
+	array(
1048
+		'name' => __('Google Maps API KEY', 'geodirectory'),
1049
+		'type' => 'sectionstart',
1050
+		'desc' => '',
1051
+		'id' => 'geodir_google_api_key'
1052
+	),
1053
+	array(
1054
+		'name' => __('Google Maps API KEY', 'geodirectory'),
1055
+		'desc' => sprintf(
1056
+			__('This is a requirement to use Google Maps, you can get a key from <a href="%s" target="_blank">here</a> OR you can set GD to use Open Street Maps below under Select Maps API setting.   (<a href="%s" target="_blank">How to add a Google API KEY?</a>)', 'geodirectory'),
1057
+			'https://console.developers.google.com/flows/enableapi?apiid=places_backend,maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true','https://wpgeodirectory.com/docs/add-google-api-key/' ),
1058
+		'tip' => '',
1059
+		'id' => 'geodir_google_api_key',
1060
+		'css' => 'min-width:300px;',
1061
+		'std' => '',
1062
+		'type' => 'map-key',
1063
+	),
1064
+	array(
1065
+		'type' => 'sectionend',
1066
+		'id' => 'geodir_google_api_key'
1067
+	),
1068 1068
 
1069
-    /* Untick the category by default on home map */
1070
-    array(
1071
-        'name' => __('Home Map Settings', 'geodirectory'),
1072
-        'type' => 'sectionstart',
1073
-        'desc' => '',
1074
-        'id' => 'geodir_home_map_section'
1075
-    ),
1076
-    array(
1077
-        'name' => __('Select category to untick by default on map', 'geodirectory'),
1078
-        'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1079
-        'tip' => '',
1080
-        'id' => 'geodir_home_map_untick',
1081
-        'css' => 'min-width:300px;',
1082
-        'std' => '',
1083
-        'type' => 'multiselect',
1084
-        'placeholder_text' => __('Select category', 'geodirectory'),
1085
-        'class' => 'chosen_select',
1086
-        'options' => geodir_home_map_cats_key_value_array()
1087
-    ),
1088
-    array(
1089
-        'type' => 'sectionend',
1090
-        'id' => 'geodir_home_map_section'
1091
-    ),
1069
+	/* Untick the category by default on home map */
1070
+	array(
1071
+		'name' => __('Home Map Settings', 'geodirectory'),
1072
+		'type' => 'sectionstart',
1073
+		'desc' => '',
1074
+		'id' => 'geodir_home_map_section'
1075
+	),
1076
+	array(
1077
+		'name' => __('Select category to untick by default on map', 'geodirectory'),
1078
+		'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1079
+		'tip' => '',
1080
+		'id' => 'geodir_home_map_untick',
1081
+		'css' => 'min-width:300px;',
1082
+		'std' => '',
1083
+		'type' => 'multiselect',
1084
+		'placeholder_text' => __('Select category', 'geodirectory'),
1085
+		'class' => 'chosen_select',
1086
+		'options' => geodir_home_map_cats_key_value_array()
1087
+	),
1088
+	array(
1089
+		'type' => 'sectionend',
1090
+		'id' => 'geodir_home_map_section'
1091
+	),
1092 1092
 
1093
-    array(
1094
-        'name' => __('Add Listing Map Settings', 'geodirectory'),
1095
-        'type' => 'sectionstart',
1096
-        'desc' => '',
1097
-        'id' => 'geodir_add_listing_map_section'
1098
-    ),
1099
-    array(
1100
-        'name' => __('Disable mouse scroll on details page map tab', 'geodirectory'),
1101
-        'desc' => __('Stops the mouse scroll zooming the map (home and listings settings set from widget)', 'geodirectory'),
1102
-        'id' => 'geodir_add_listing_mouse_scroll',
1103
-        'type' => 'checkbox',
1104
-        'std' => '0' // Default value to show home top section
1105
-    ),
1106
-    array(
1107
-        'type' => 'sectionend',
1108
-        'id' => 'geodir_add_listing_map_section'
1109
-    ),
1093
+	array(
1094
+		'name' => __('Add Listing Map Settings', 'geodirectory'),
1095
+		'type' => 'sectionstart',
1096
+		'desc' => '',
1097
+		'id' => 'geodir_add_listing_map_section'
1098
+	),
1099
+	array(
1100
+		'name' => __('Disable mouse scroll on details page map tab', 'geodirectory'),
1101
+		'desc' => __('Stops the mouse scroll zooming the map (home and listings settings set from widget)', 'geodirectory'),
1102
+		'id' => 'geodir_add_listing_mouse_scroll',
1103
+		'type' => 'checkbox',
1104
+		'std' => '0' // Default value to show home top section
1105
+	),
1106
+	array(
1107
+		'type' => 'sectionend',
1108
+		'id' => 'geodir_add_listing_map_section'
1109
+	),
1110 1110
 
1111 1111
 
1112
-    array('name' => __('Default map settings', 'geodirectory'),
1113
-        'type' => 'sectionstart',
1114
-        'desc' => '',
1115
-        'id' => 'geodir_map_default_settings'),
1112
+	array('name' => __('Default map settings', 'geodirectory'),
1113
+		'type' => 'sectionstart',
1114
+		'desc' => '',
1115
+		'id' => 'geodir_map_default_settings'),
1116 1116
 
1117
-    array(
1118
-        'name' => '',
1119
-        'desc' => '',
1120
-        'id' => 'map_default_settings',
1121
-        'type' => 'map_default_settings',
1122
-        'css' => 'min-width:300px;',
1123
-        'std' => '' // Default value for the page title - changed in settings
1124
-    ),
1117
+	array(
1118
+		'name' => '',
1119
+		'desc' => '',
1120
+		'id' => 'map_default_settings',
1121
+		'type' => 'map_default_settings',
1122
+		'css' => 'min-width:300px;',
1123
+		'std' => '' // Default value for the page title - changed in settings
1124
+	),
1125 1125
 
1126
-    array(
1127
-        'name' => __('Upload map default marker icon', 'geodirectory'),
1128
-        'desc' => '',
1129
-        'id' => 'geodir_default_marker_icon',
1130
-        'type' => 'file',
1131
-        'std' => '0',
1132
-        'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1133
-    ),
1134
-    // add option that allows enable/disable map dragging to phone devices
1135
-    array(
1136
-        'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1137
-        'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1138
-        'id' => 'geodir_map_onoff_dragging',
1139
-        'type' => 'checkbox',
1140
-        'std' => '0' // Default value to show home top section
1141
-    ),
1142
-    array(
1143
-        'name' => __('Select Maps API', 'geodirectory'),
1144
-        'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
1145
-        'tip' => '',
1146
-        'id' => 'geodir_load_map',
1147
-        'css' => 'min-width:300px;',
1148
-        'std' => 'auto',
1149
-        'type' => 'select',
1150
-        'placeholder_text' => __('Select Map', 'geodirectory'),
1151
-        'options' => array(
1152
-                        'auto' => __('Load Automatic', 'geodirectory'),
1153
-                        'google' => __('Load Google Maps API', 'geodirectory'),
1154
-                        'osm' => __('Load OpenStreetMap API', 'geodirectory'),
1155
-                        'none' => __('Disable Maps', 'geodirectory')
1156
-                    )
1157
-    ),
1158
-
1159
-    array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1160
-
1161
-    array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1162
-        'type' => 'sectionstart',
1163
-        'desc' => '',
1164
-        'id' => 'geodir_map_settings'),
1126
+	array(
1127
+		'name' => __('Upload map default marker icon', 'geodirectory'),
1128
+		'desc' => '',
1129
+		'id' => 'geodir_default_marker_icon',
1130
+		'type' => 'file',
1131
+		'std' => '0',
1132
+		'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1133
+	),
1134
+	// add option that allows enable/disable map dragging to phone devices
1135
+	array(
1136
+		'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1137
+		'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1138
+		'id' => 'geodir_map_onoff_dragging',
1139
+		'type' => 'checkbox',
1140
+		'std' => '0' // Default value to show home top section
1141
+	),
1142
+	array(
1143
+		'name' => __('Select Maps API', 'geodirectory'),
1144
+		'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
1145
+		'tip' => '',
1146
+		'id' => 'geodir_load_map',
1147
+		'css' => 'min-width:300px;',
1148
+		'std' => 'auto',
1149
+		'type' => 'select',
1150
+		'placeholder_text' => __('Select Map', 'geodirectory'),
1151
+		'options' => array(
1152
+						'auto' => __('Load Automatic', 'geodirectory'),
1153
+						'google' => __('Load Google Maps API', 'geodirectory'),
1154
+						'osm' => __('Load OpenStreetMap API', 'geodirectory'),
1155
+						'none' => __('Disable Maps', 'geodirectory')
1156
+					)
1157
+	),
1165 1158
 
1166
-    array(
1167
-        'name' => __('Select Map Category', 'geodirectory'),
1168
-        'desc' => '',
1169
-        'id' => 'geodir_map_settings',
1170
-        'type' => 'map',
1171
-        'css' => 'min-width:300px;',
1172
-        'std' => '' // Default value for the page title - changed in settings
1173
-    ),
1174
-
1175
-    array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1176
-    /* Map Settings End */
1159
+	array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1160
+
1161
+	array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1162
+		'type' => 'sectionstart',
1163
+		'desc' => '',
1164
+		'id' => 'geodir_map_settings'),
1165
+
1166
+	array(
1167
+		'name' => __('Select Map Category', 'geodirectory'),
1168
+		'desc' => '',
1169
+		'id' => 'geodir_map_settings',
1170
+		'type' => 'map',
1171
+		'css' => 'min-width:300px;',
1172
+		'std' => '' // Default value for the page title - changed in settings
1173
+	),
1174
+
1175
+	array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1176
+	/* Map Settings End */
1177 1177
 
1178 1178
 )); // End Design settings
Please login to merge, or discard this patch.
geodirectory-admin/admin_dummy_data_functions.php 2 patches
Indentation   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -19,151 +19,151 @@  discard block
 block discarded – undo
19 19
  * @global string $dummy_image_path The dummy image path.
20 20
  */
21 21
 function geodir_dummy_data_taxonomies($post_type,$category_array) {
22
-    global $wpdb, $dummy_image_path;
22
+	global $wpdb, $dummy_image_path;
23 23
 
24 24
 
25 25
 
26
-    $last_catid = '';
26
+	$last_catid = '';
27 27
 
28
-    $uploads = wp_upload_dir(); // Array of key => value pairs
28
+	$uploads = wp_upload_dir(); // Array of key => value pairs
29 29
 
30
-    for ($i = 0; $i < count($category_array); $i++) {
31
-        $parent_catid = 0;
32
-        if (is_array($category_array[$i])) {
33
-            $cat_name_arr = $category_array[$i];
34
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
35
-                $catname = $cat_name_arr[$j];
30
+	for ($i = 0; $i < count($category_array); $i++) {
31
+		$parent_catid = 0;
32
+		if (is_array($category_array[$i])) {
33
+			$cat_name_arr = $category_array[$i];
34
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
35
+				$catname = $cat_name_arr[$j];
36 36
 
37
-                if (!term_exists($catname, $post_type.'category')) {
38
-                    $last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid));
37
+				if (!term_exists($catname, $post_type.'category')) {
38
+					$last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid));
39 39
 
40
-                    if ($j == 0) {
41
-                        $parent_catid = $last_catid;
42
-                    }
40
+					if ($j == 0) {
41
+						$parent_catid = $last_catid;
42
+					}
43 43
 
44 44
 
45
-                    if (geodir_dummy_folder_exists())
46
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
-                    else
48
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
45
+					if (geodir_dummy_folder_exists())
46
+						$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
+					else
48
+						$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
49 49
 
50
-                    $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
50
+					$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
51 51
 
52
-                    $catname = str_replace(' ', '_', $catname);
53
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
52
+					$catname = str_replace(' ', '_', $catname);
53
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
54 54
 
55
-                    if (empty($uploaded['error'])) {
56
-                        $new_path = $uploaded['file'];
57
-                        $new_url = $uploaded['url'];
58
-                    }
55
+					if (empty($uploaded['error'])) {
56
+						$new_path = $uploaded['file'];
57
+						$new_url = $uploaded['url'];
58
+					}
59 59
 
60
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
61
-
62
-                    $attachment = array(
63
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
64
-                        'post_mime_type' => $wp_filetype['type'],
65
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66
-                        'post_content' => '',
67
-                        'post_status' => 'inherit'
68
-                    );
69
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
70
-
71
-                    // you must first include the image.php file
72
-                    // for the function wp_generate_attachment_metadata() to work
73
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
74
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75
-                    wp_update_attachment_metadata($attach_id, $attach_data);
76
-
77
-                    if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
-                        update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type);
79
-                    }
80
-                }
81
-            }
60
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
82 61
 
83
-        } else {
84
-            $catname = $category_array[$i];
62
+					$attachment = array(
63
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
64
+						'post_mime_type' => $wp_filetype['type'],
65
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66
+						'post_content' => '',
67
+						'post_status' => 'inherit'
68
+					);
69
+					$attach_id = wp_insert_attachment($attachment, $new_path);
85 70
 
86
-            if (!term_exists($catname, $post_type.'category')) {
87
-                $last_catid = wp_insert_term($catname, $post_type.'category');
71
+					// you must first include the image.php file
72
+					// for the function wp_generate_attachment_metadata() to work
73
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
74
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75
+					wp_update_attachment_metadata($attach_id, $attach_data);
88 76
 
89
-                if (geodir_dummy_folder_exists())
90
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
-                else
92
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
77
+					if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
+						update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type);
79
+					}
80
+				}
81
+			}
93 82
 
94
-                $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
83
+		} else {
84
+			$catname = $category_array[$i];
95 85
 
96
-                $catname = str_replace(' ', '_', $catname);
97
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
86
+			if (!term_exists($catname, $post_type.'category')) {
87
+				$last_catid = wp_insert_term($catname, $post_type.'category');
98 88
 
99
-                if (empty($uploaded['error'])) {
100
-                    $new_path = $uploaded['file'];
101
-                    $new_url = $uploaded['url'];
102
-                }
89
+				if (geodir_dummy_folder_exists())
90
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
+				else
92
+					$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
103 93
 
104
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
94
+				$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
105 95
 
106
-                $attachment = array(
107
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
108
-                    'post_mime_type' => $wp_filetype['type'],
109
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110
-                    'post_content' => '',
111
-                    'post_status' => 'inherit'
112
-                );
96
+				$catname = str_replace(' ', '_', $catname);
97
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
113 98
 
114
-                $attach_id = wp_insert_attachment($attachment, $new_path);
99
+				if (empty($uploaded['error'])) {
100
+					$new_path = $uploaded['file'];
101
+					$new_url = $uploaded['url'];
102
+				}
115 103
 
104
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
116 105
 
117
-                // you must first include the image.php file
118
-                // for the function wp_generate_attachment_metadata() to work
119
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
120
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121
-                wp_update_attachment_metadata($attach_id, $attach_data);
106
+				$attachment = array(
107
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
108
+					'post_mime_type' => $wp_filetype['type'],
109
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110
+					'post_content' => '',
111
+					'post_status' => 'inherit'
112
+				);
113
+
114
+				$attach_id = wp_insert_attachment($attachment, $new_path);
122 115
 
123
-                if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
-                    update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type);
125
-                }
126
-            }
127
-        }
128 116
 
129
-    }
117
+				// you must first include the image.php file
118
+				// for the function wp_generate_attachment_metadata() to work
119
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
120
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121
+				wp_update_attachment_metadata($attach_id, $attach_data);
122
+
123
+				if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
+					update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type);
125
+				}
126
+			}
127
+		}
128
+
129
+	}
130 130
 }
131 131
 
132 132
 
133 133
 function geodir_dummy_data_types(){
134
-    $data =  array(
135
-        'standard_places' => array(
136
-            'name'=>__('Default','geodirectory'),
137
-            'count'=> 30
138
-        ),
139
-        'property_sale' => array(
140
-            'name'=>__('Property for sale','geodirectory'),
141
-            'count'=> 10
142
-        ),
143
-        'property_rent' => array(
144
-            'name'=>__('Property for rent','geodirectory'),
145
-            'count'=> 10
146
-        )
147
-    );
148
-
149
-    return apply_filters('geodir_dummy_data_types',$data );
134
+	$data =  array(
135
+		'standard_places' => array(
136
+			'name'=>__('Default','geodirectory'),
137
+			'count'=> 30
138
+		),
139
+		'property_sale' => array(
140
+			'name'=>__('Property for sale','geodirectory'),
141
+			'count'=> 10
142
+		),
143
+		'property_rent' => array(
144
+			'name'=>__('Property for rent','geodirectory'),
145
+			'count'=> 10
146
+		)
147
+	);
148
+
149
+	return apply_filters('geodir_dummy_data_types',$data );
150 150
 }
151 151
 
152 152
 
153 153
 function geodir_create_dummy_fields($fields)
154 154
 {
155 155
     
156
-    /**
157
-     * Filter the array of default custom fields DB table data.
158
-     *
159
-     * @since 1.0.0
160
-     * @param string $fields The default custom fields as an array.
161
-     */
162
-    $fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
163
-    foreach ($fields as $field_index => $field) {
164
-        geodir_custom_field_save($field);
165
-
166
-    }
156
+	/**
157
+	 * Filter the array of default custom fields DB table data.
158
+	 *
159
+	 * @since 1.0.0
160
+	 * @param string $fields The default custom fields as an array.
161
+	 */
162
+	$fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
163
+	foreach ($fields as $field_index => $field) {
164
+		geodir_custom_field_save($field);
165
+
166
+	}
167 167
 }
168 168
 
169 169
 /**
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function geodir_delete_dummy_posts($post_type,$data_type)
178 178
 {
179
-    global $wpdb, $plugin_prefix;
179
+	global $wpdb, $plugin_prefix;
180 180
 
181 181
 
182
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
182
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
183 183
 
184 184
 
185
-    foreach ($post_ids as $post_ids_obj) {
186
-        wp_delete_post($post_ids_obj->post_id);
187
-    }
185
+	foreach ($post_ids as $post_ids_obj) {
186
+		wp_delete_post($post_ids_obj->post_id);
187
+	}
188 188
 
189
-    //double check posts are deleted
190
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
189
+	//double check posts are deleted
190
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
191 191
 
192
-    update_option($post_type.'_dummy_data_type','');
192
+	update_option($post_type.'_dummy_data_type','');
193 193
 }
194 194
 
195 195
 /**
@@ -203,78 +203,78 @@  discard block
 block discarded – undo
203 203
 function geodir_insert_dummy_posts($post_type,$data_type,$item_index)
204 204
 {
205 205
 
206
-    ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
207
-    $data_types = geodir_dummy_data_types();
208
-
209
-    $total_count = 0;
210
-    global $dummy_post_index;
211
-    $dummy_post_index = $item_index;
212
-    foreach( $data_types as $key=>$val){
213
-        if($key==$data_type){
214
-            $total_count = $val['count'];
215
-            if($key=='standard_places'){
216
-                /**
217
-                 * Contains dummy post content.
218
-                 *
219
-                 * @since 1.0.0
220
-                 * @package GeoDirectory
221
-                 */
222
-                include_once( 'dummy-data/standard_places.php' );
223
-            }elseif($key=='property_sale'){
224
-                /**
225
-                 * Contains dummy property for sale post content.
226
-                 *
227
-                 * @since 1.6.11
228
-                 * @package GeoDirectory
229
-                 */
230
-                include_once( 'dummy-data/property_sale.php' );
231
-            }elseif($key=='property_rent'){
232
-                /**
233
-                 * Contains dummy property for sale post content.
234
-                 *
235
-                 * @since 1.6.11
236
-                 * @package GeoDirectory
237
-                 */
238
-                include_once( 'dummy-data/property_rent.php' );
239
-            }
240
-
241
-        }
242
-
243
-        do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
244
-    }
245
-
246
-
247
-
248
-    // delete image cache on last entry
249
-    if($total_count == $item_index){
250
-        delete_transient( 'cached_dummy_images' );
251
-        flush_rewrite_rules();
252
-    }
206
+	ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
207
+	$data_types = geodir_dummy_data_types();
208
+
209
+	$total_count = 0;
210
+	global $dummy_post_index;
211
+	$dummy_post_index = $item_index;
212
+	foreach( $data_types as $key=>$val){
213
+		if($key==$data_type){
214
+			$total_count = $val['count'];
215
+			if($key=='standard_places'){
216
+				/**
217
+				 * Contains dummy post content.
218
+				 *
219
+				 * @since 1.0.0
220
+				 * @package GeoDirectory
221
+				 */
222
+				include_once( 'dummy-data/standard_places.php' );
223
+			}elseif($key=='property_sale'){
224
+				/**
225
+				 * Contains dummy property for sale post content.
226
+				 *
227
+				 * @since 1.6.11
228
+				 * @package GeoDirectory
229
+				 */
230
+				include_once( 'dummy-data/property_sale.php' );
231
+			}elseif($key=='property_rent'){
232
+				/**
233
+				 * Contains dummy property for sale post content.
234
+				 *
235
+				 * @since 1.6.11
236
+				 * @package GeoDirectory
237
+				 */
238
+				include_once( 'dummy-data/property_rent.php' );
239
+			}
240
+
241
+		}
242
+
243
+		do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
244
+	}
245
+
246
+
247
+
248
+	// delete image cache on last entry
249
+	if($total_count == $item_index){
250
+		delete_transient( 'cached_dummy_images' );
251
+		flush_rewrite_rules();
252
+	}
253 253
 
254 254
 
255 255
 }
256 256
 
257 257
 
258 258
 if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
259
-    /**
260
-     * GeoDirectory dummy data installation.
261
-     *
262
-     * @since 1.0.0
263
-     * @package GeoDirectory
264
-     * @global object $wpdb WordPress Database object.
265
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
266
-     * @param string $post_type The post type.
267
-     */
268
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
269
-    {
270
-
271
-        global $wpdb, $plugin_prefix;
272
-
273
-        if (!geodir_is_default_location_set()) {
274
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
275
-        } else {
276
-
277
-            ?>
259
+	/**
260
+	 * GeoDirectory dummy data installation.
261
+	 *
262
+	 * @since 1.0.0
263
+	 * @package GeoDirectory
264
+	 * @global object $wpdb WordPress Database object.
265
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
266
+	 * @param string $post_type The post type.
267
+	 */
268
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
269
+	{
270
+
271
+		global $wpdb, $plugin_prefix;
272
+
273
+		if (!geodir_is_default_location_set()) {
274
+			echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
275
+		} else {
276
+
277
+			?>
278 278
             <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.','geodirectory');?></small></span>
279 279
             <table class="form-table gd-dummy-table">
280 280
                 <tbody>
@@ -286,78 +286,78 @@  discard block
 block discarded – undo
286 286
 
287 287
                 <?php
288 288
 
289
-                $cpts = geodir_get_posttypes('array');
289
+				$cpts = geodir_get_posttypes('array');
290 290
 
291
-                $data_types = geodir_dummy_data_types();
291
+				$data_types = geodir_dummy_data_types();
292 292
 
293
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
293
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
294 294
 
295
-                foreach($cpts as $post_type=>$cpt){
295
+				foreach($cpts as $post_type=>$cpt){
296 296
 
297
-                    $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
297
+					$data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
298 298
 
299 299
 
300
-                    $set_dt = get_option($post_type.'_dummy_data_type');
300
+					$set_dt = get_option($post_type.'_dummy_data_type');
301 301
 
302
-                    $count = 30;
302
+					$count = 30;
303 303
 
304
-                    geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
304
+					geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
305 305
 
306
-                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
306
+					$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
307 307
 
308
-                    echo "<tr>";
309
-                    echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
308
+					echo "<tr>";
309
+					echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
310 310
 
311 311
 
312
-                    $select_disabled = $post_counts > 0 ? 'disabled' : '';
313
-                    echo "<td>";
314
-                    echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
312
+					$select_disabled = $post_counts > 0 ? 'disabled' : '';
313
+					echo "<td>";
314
+					echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
315 315
 
316
-                    foreach($data_types_for as $key=>$val){
317
-                        $selected = ($key==$set_dt) ? "selected='selected'" : '';
318
-                        if($selected || count($data_types_for)==1){$count = $val['count'];}
319
-                        echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320
-                    }
321
-                    echo "</select>";
322
-
323
-                    $select_display = $post_counts > 0 ? 'display:none;' : '';
324
-                    echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325
-                    $x = 1;
326
-                    while($x <= $count){
327
-                        $selected = ($x==$count) ? "selected='selected'" : '';
328
-                        echo "<option $selected value='$x'>".$x."</option>";
329
-                        $x++;
330
-                    }
331
-                    echo "</select>";
332
-                    echo "</td>";
316
+					foreach($data_types_for as $key=>$val){
317
+						$selected = ($key==$set_dt) ? "selected='selected'" : '';
318
+						if($selected || count($data_types_for)==1){$count = $val['count'];}
319
+						echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320
+					}
321
+					echo "</select>";
333 322
 
323
+					$select_display = $post_counts > 0 ? 'display:none;' : '';
324
+					echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325
+					$x = 1;
326
+					while($x <= $count){
327
+						$selected = ($x==$count) ? "selected='selected'" : '';
328
+						echo "<option $selected value='$x'>".$x."</option>";
329
+						$x++;
330
+					}
331
+					echo "</select>";
332
+					echo "</td>";
334 333
 
335 334
 
336 335
 
337 336
 
338
-                    if($post_counts > 0){
339
-                        echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
340
-                    }else{
341
-                        echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342
-                    }
343 337
 
344
-                    echo "</tr>";
345
-                    //print_r($cpt);
346
-                }
338
+					if($post_counts > 0){
339
+						echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
340
+					}else{
341
+						echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342
+					}
343
+
344
+					echo "</tr>";
345
+					//print_r($cpt);
346
+				}
347 347
 
348
-                ?>
348
+				?>
349 349
                 </tbody>
350 350
             </table>
351 351
             <?php
352 352
 
353 353
 
354
-            $default_location = geodir_get_default_location();
355
-            $city = isset($default_location->city) ? $default_location->city : '';
356
-            $region = isset($default_location->region) ? $default_location->region : '';
357
-            $country = isset($default_location->country) ? $default_location->country : '';
358
-            $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
359
-            $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
360
-            ?>
354
+			$default_location = geodir_get_default_location();
355
+			$city = isset($default_location->city) ? $default_location->city : '';
356
+			$region = isset($default_location->region) ? $default_location->region : '';
357
+			$country = isset($default_location->country) ? $default_location->country : '';
358
+			$city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
359
+			$city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
360
+			?>
361 361
             <script type="text/javascript">
362 362
 
363 363
                 function geodir_dummy_set_count(data,cpt){
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                 }
534 534
             </script>
535 535
             <?php
536
-        }
537
-    }
536
+		}
537
+	}
538 538
 }
539 539
 
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * @global object $wpdb WordPress Database object.
19 19
  * @global string $dummy_image_path The dummy image path.
20 20
  */
21
-function geodir_dummy_data_taxonomies($post_type,$category_array) {
21
+function geodir_dummy_data_taxonomies($post_type, $category_array) {
22 22
     global $wpdb, $dummy_image_path;
23 23
 
24 24
 
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 
44 44
 
45 45
                     if (geodir_dummy_folder_exists())
46
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
46
+                        $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
47 47
                     else
48 48
                         $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
49 49
 
50 50
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
51 51
 
52 52
                     $catname = str_replace(' ', '_', $catname);
53
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
53
+                    $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
54 54
 
55 55
                     if (empty($uploaded['error'])) {
56 56
                         $new_path = $uploaded['file'];
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                     $wp_filetype = wp_check_filetype(basename($new_path), null);
61 61
 
62 62
                     $attachment = array(
63
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
63
+                        'guid' => $uploads['baseurl'].'/'.basename($new_path),
64 64
                         'post_mime_type' => $wp_filetype['type'],
65 65
                         'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66 66
                         'post_content' => '',
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
                     // you must first include the image.php file
72 72
                     // for the function wp_generate_attachment_metadata() to work
73
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
73
+                    require_once(ABSPATH.'wp-admin/includes/image.php');
74 74
                     $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75 75
                     wp_update_attachment_metadata($attach_id, $attach_data);
76 76
 
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
                 $last_catid = wp_insert_term($catname, $post_type.'category');
88 88
 
89 89
                 if (geodir_dummy_folder_exists())
90
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
90
+                    $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
91 91
                 else
92 92
                     $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
93 93
 
94 94
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
95 95
 
96 96
                 $catname = str_replace(' ', '_', $catname);
97
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
97
+                $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
98 98
 
99 99
                 if (empty($uploaded['error'])) {
100 100
                     $new_path = $uploaded['file'];
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 $wp_filetype = wp_check_filetype(basename($new_path), null);
105 105
 
106 106
                 $attachment = array(
107
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
107
+                    'guid' => $uploads['baseurl'].'/'.basename($new_path),
108 108
                     'post_mime_type' => $wp_filetype['type'],
109 109
                     'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110 110
                     'post_content' => '',
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
                 // you must first include the image.php file
118 118
                 // for the function wp_generate_attachment_metadata() to work
119
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
119
+                require_once(ABSPATH.'wp-admin/includes/image.php');
120 120
                 $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121 121
                 wp_update_attachment_metadata($attach_id, $attach_data);
122 122
 
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 }
131 131
 
132 132
 
133
-function geodir_dummy_data_types(){
134
-    $data =  array(
133
+function geodir_dummy_data_types() {
134
+    $data = array(
135 135
         'standard_places' => array(
136
-            'name'=>__('Default','geodirectory'),
136
+            'name'=>__('Default', 'geodirectory'),
137 137
             'count'=> 30
138 138
         ),
139 139
         'property_sale' => array(
140
-            'name'=>__('Property for sale','geodirectory'),
140
+            'name'=>__('Property for sale', 'geodirectory'),
141 141
             'count'=> 10
142 142
         ),
143 143
         'property_rent' => array(
144
-            'name'=>__('Property for rent','geodirectory'),
144
+            'name'=>__('Property for rent', 'geodirectory'),
145 145
             'count'=> 10
146 146
         )
147 147
     );
148 148
 
149
-    return apply_filters('geodir_dummy_data_types',$data );
149
+    return apply_filters('geodir_dummy_data_types', $data);
150 150
 }
151 151
 
152 152
 
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
  * @global object $wpdb WordPress Database object.
175 175
  * @global string $plugin_prefix Geodirectory plugin table prefix.
176 176
  */
177
-function geodir_delete_dummy_posts($post_type,$data_type)
177
+function geodir_delete_dummy_posts($post_type, $data_type)
178 178
 {
179 179
     global $wpdb, $plugin_prefix;
180 180
 
181 181
 
182
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
182
+    $post_ids = $wpdb->get_results("SELECT post_id FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
183 183
 
184 184
 
185 185
     foreach ($post_ids as $post_ids_obj) {
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
     }
188 188
 
189 189
     //double check posts are deleted
190
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
190
+    $wpdb->get_results("DELETE FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
191 191
 
192
-    update_option($post_type.'_dummy_data_type','');
192
+    update_option($post_type.'_dummy_data_type', '');
193 193
 }
194 194
 
195 195
 /**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
  * @global object $wpdb WordPress Database object.
201 201
  * @global object $current_user Current user object.
202 202
  */
203
-function geodir_insert_dummy_posts($post_type,$data_type,$item_index)
203
+function geodir_insert_dummy_posts($post_type, $data_type, $item_index)
204 204
 {
205 205
 
206 206
     ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
@@ -209,45 +209,45 @@  discard block
 block discarded – undo
209 209
     $total_count = 0;
210 210
     global $dummy_post_index;
211 211
     $dummy_post_index = $item_index;
212
-    foreach( $data_types as $key=>$val){
213
-        if($key==$data_type){
212
+    foreach ($data_types as $key=>$val) {
213
+        if ($key == $data_type) {
214 214
             $total_count = $val['count'];
215
-            if($key=='standard_places'){
215
+            if ($key == 'standard_places') {
216 216
                 /**
217 217
                  * Contains dummy post content.
218 218
                  *
219 219
                  * @since 1.0.0
220 220
                  * @package GeoDirectory
221 221
                  */
222
-                include_once( 'dummy-data/standard_places.php' );
223
-            }elseif($key=='property_sale'){
222
+                include_once('dummy-data/standard_places.php');
223
+            }elseif ($key == 'property_sale') {
224 224
                 /**
225 225
                  * Contains dummy property for sale post content.
226 226
                  *
227 227
                  * @since 1.6.11
228 228
                  * @package GeoDirectory
229 229
                  */
230
-                include_once( 'dummy-data/property_sale.php' );
231
-            }elseif($key=='property_rent'){
230
+                include_once('dummy-data/property_sale.php');
231
+            }elseif ($key == 'property_rent') {
232 232
                 /**
233 233
                  * Contains dummy property for sale post content.
234 234
                  *
235 235
                  * @since 1.6.11
236 236
                  * @package GeoDirectory
237 237
                  */
238
-                include_once( 'dummy-data/property_rent.php' );
238
+                include_once('dummy-data/property_rent.php');
239 239
             }
240 240
 
241 241
         }
242 242
 
243
-        do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
243
+        do_action('geodir_insert_dummy_data_loop', $post_type, $data_type, $item_index);
244 244
     }
245 245
 
246 246
 
247 247
 
248 248
     // delete image cache on last entry
249
-    if($total_count == $item_index){
250
-        delete_transient( 'cached_dummy_images' );
249
+    if ($total_count == $item_index) {
250
+        delete_transient('cached_dummy_images');
251 251
         flush_rewrite_rules();
252 252
     }
253 253
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 }
256 256
 
257 257
 
258
-if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
258
+if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined('GD_TESTING_MODE'))) {
259 259
     /**
260 260
      * GeoDirectory dummy data installation.
261 261
      *
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
         global $wpdb, $plugin_prefix;
272 272
 
273 273
         if (!geodir_is_default_location_set()) {
274
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
274
+            echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>';
275 275
         } else {
276 276
 
277 277
             ?>
278
-            <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.','geodirectory');?></small></span>
278
+            <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.', 'geodirectory'); ?></small></span>
279 279
             <table class="form-table gd-dummy-table">
280 280
                 <tbody>
281 281
                 <tr>
282
-                    <td><strong><?php _e('CPT','geodirectory');?></strong></td>
283
-                    <td><strong><?php _e('Data Type','geodirectory');?></strong></td>
284
-                    <td><strong><?php _e('Action','geodirectory');?></strong></td>
282
+                    <td><strong><?php _e('CPT', 'geodirectory'); ?></strong></td>
283
+                    <td><strong><?php _e('Data Type', 'geodirectory'); ?></strong></td>
284
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
285 285
                 </tr>
286 286
 
287 287
                 <?php
@@ -292,18 +292,18 @@  discard block
 block discarded – undo
292 292
 
293 293
                 $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
294 294
 
295
-                foreach($cpts as $post_type=>$cpt){
295
+                foreach ($cpts as $post_type=>$cpt) {
296 296
 
297
-                    $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
297
+                    $data_types_for = apply_filters('geodir_dummy_date_types_for', $data_types, $post_type);
298 298
 
299 299
 
300 300
                     $set_dt = get_option($post_type.'_dummy_data_type');
301 301
 
302 302
                     $count = 30;
303 303
 
304
-                    geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
304
+                    geodir_add_column_if_not_exist($plugin_prefix.$post_type."_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
305 305
 
306
-                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
306
+                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
307 307
 
308 308
                     echo "<tr>";
309 309
                     echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
                     echo "<td>";
314 314
                     echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
315 315
 
316
-                    foreach($data_types_for as $key=>$val){
317
-                        $selected = ($key==$set_dt) ? "selected='selected'" : '';
318
-                        if($selected || count($data_types_for)==1){$count = $val['count'];}
316
+                    foreach ($data_types_for as $key=>$val) {
317
+                        $selected = ($key == $set_dt) ? "selected='selected'" : '';
318
+                        if ($selected || count($data_types_for) == 1) {$count = $val['count']; }
319 319
                         echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320 320
                     }
321 321
                     echo "</select>";
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
                     $select_display = $post_counts > 0 ? 'display:none;' : '';
324 324
                     echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325 325
                     $x = 1;
326
-                    while($x <= $count){
327
-                        $selected = ($x==$count) ? "selected='selected'" : '';
326
+                    while ($x <= $count) {
327
+                        $selected = ($x == $count) ? "selected='selected'" : '';
328 328
                         echo "<option $selected value='$x'>".$x."</option>";
329 329
                         $x++;
330 330
                     }
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 
336 336
 
337 337
 
338
-                    if($post_counts > 0){
339
-                        echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
340
-                    }else{
341
-                        echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
338
+                    if ($post_counts > 0) {
339
+                        echo '<td><input type="button" value="'.__('Remove data', 'geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>';
340
+                    } else {
341
+                        echo '<td><input type="button" value="'.__('Insert data', 'geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>';
342 342
                     }
343 343
 
344 344
                     echo "</tr>";
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
                 }
376 376
 
377
-                var CITY_ADDRESS = '<?php echo addslashes( $city . ',' . $region . ',' . $country );?>';
377
+                var CITY_ADDRESS = '<?php echo addslashes($city.','.$region.','.$country); ?>';
378 378
                 var bound_lat_lng;
379 379
                 var latlng = ['<?php echo $city_latitude; ?>', <?php echo $city_longitude; ?>];
380 380
                 var lat = <?php echo $city_latitude; ?>;
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
                                         return x.replace(" ", '');
408 408
                                     }); // remove spaces from lat/lon
409 409
                                 } else {
410
-                                    alert("<?php _e( 'Geocode was not successful for the following reason:', 'geodirectory' );?> " + status);
410
+                                    alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
411 411
                                 }
412 412
                             });
413 413
                     } else if (window.gdMaps == 'osm') {
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
                 var dummy_post_index = 1;
432 432
 
433 433
                 function gdRemoveDummyData(obj, nonce, posttype){
434
-                    if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
434
+                    if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
435 435
                         jQuery(obj).prop('disabled', true);
436 436
                         jQuery('.gd-dummy-data-results-' + posttype).remove();
437 437
                         jQuery('<tr class="gd-dummy-data-results gd-dummy-data-results-' + posttype + '" >'+
@@ -446,14 +446,14 @@  discard block
 block discarded – undo
446 446
 
447 447
                         jQuery('.gd_progressbar_'+posttype).progressbar({value: 0});
448 448
 
449
-                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation'));?>');
449
+                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation')); ?>');
450 450
 
451 451
 
452 452
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=geodir_dummy_delete&posttype=' + posttype + '&_wpnonce=' + nonce,
453 453
                             function (data) {
454
-                                gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>');
454
+                                gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>');
455 455
                                 jQuery(obj).removeClass('gd-remove-data');
456
-                                jQuery(obj).val('<?php _e('Insert data','geodirectory');?>');
456
+                                jQuery(obj).val('<?php _e('Insert data', 'geodirectory'); ?>');
457 457
                                 jQuery(obj).prop('disabled', false);
458 458
                                 jQuery('#'+posttype+'_data_type_count').show();
459 459
                                 jQuery('#'+posttype+'_data_type').prop('disabled', false);
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
                         jQuery('.gd_progressbar_'+posttype).progressbar({value: 0});
498 498
 
499
-                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation'));?>');
499
+                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation')); ?>');
500 500
                     }
501 501
 
502 502
                     if (!(typeof bound_lat_lng == 'object' && bound_lat_lng.length == 4)) {
@@ -516,15 +516,15 @@  discard block
 block discarded – undo
516 516
                             percentage = percentage > 100 ? 100 : percentage;
517 517
 
518 518
 
519
-                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation'));?>');
519
+                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation')); ?>');
520 520
 
521 521
                             gdInstallDummyData(obj, nonce, posttype,insertedCount);
522 522
                         }
523 523
                         else {
524 524
                             percentage = 100;
525
-                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>');
525
+                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>');
526 526
                             jQuery(obj).addClass('gd-remove-data');
527
-                            jQuery(obj).val('<?php _e('Remove data','geodirectory');?>');
527
+                            jQuery(obj).val('<?php _e('Remove data', 'geodirectory'); ?>');
528 528
                             jQuery(obj).prop('disabled', false);
529 529
 
530 530
                         }
Please login to merge, or discard this patch.
geodirectory-admin/admin_template_tags.php 1 patch
Indentation   +530 added lines, -530 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if (!function_exists('geodir_admin_panel')) {
10
-    /**
11
-     * GeoDirectory Backend Admin Panel.
12
-     *
13
-     * Handles the display of the main GeoDirectory admin panel.
14
-     *
15
-     * @since 1.0.0
16
-     * @package GeoDirectory
17
-     * @global string $current_tab Current tab in geodirectory settings.
18
-     * @global object $geodirectory GeoDirectory plugin object.
19
-     */
20
-    function geodir_admin_panel()
21
-    {
22
-        global $geodirectory;
23
-        global $current_tab;
24
-
25
-
26
-        ?>
10
+	/**
11
+	 * GeoDirectory Backend Admin Panel.
12
+	 *
13
+	 * Handles the display of the main GeoDirectory admin panel.
14
+	 *
15
+	 * @since 1.0.0
16
+	 * @package GeoDirectory
17
+	 * @global string $current_tab Current tab in geodirectory settings.
18
+	 * @global object $geodirectory GeoDirectory plugin object.
19
+	 */
20
+	function geodir_admin_panel()
21
+	{
22
+		global $geodirectory;
23
+		global $current_tab;
24
+
25
+
26
+		?>
27 27
 
28 28
         <div id="gd-wrapper-main" class="wrap geodirectory">
29 29
             <?php
30
-            /**
31
-             * Called just after the opening wrapper div for the GD settings page in the admin area.
32
-             *
33
-             * @since 1.0.0
34
-             */
35
-            do_action('geodir_before_admin_panel');
36
-            ?>
30
+			/**
31
+			 * Called just after the opening wrapper div for the GD settings page in the admin area.
32
+			 *
33
+			 * @since 1.0.0
34
+			 */
35
+			do_action('geodir_before_admin_panel');
36
+			?>
37 37
 
38 38
             <div class="gd-wrapper gd-wrapper-vr clearfix">
39 39
 
@@ -44,75 +44,75 @@  discard block
 block discarded – undo
44 44
                          alt="geo-logo" class="geo-logoalter"/>
45 45
                     <ul>
46 46
                         <?php
47
-                        $tabs = array();
48
-                        /**
49
-                         * Filter the GD admin settings tabs on the left of the admin menu.
50
-                         *
51
-                         * @since 1.0.0
52
-                         * @param array $tabs The array of tabs to display.
53
-                         */
54
-                        $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
-
57
-                        foreach ($tabs as $name => $args) :
58
-                            $label = $args['label'];
59
-
60
-
61
-                            $query_string = '';
62
-                            if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
-
64
-                                $subtabs = $args['subtabs'];
65
-
66
-                                $query_string = '&subtab=' . $subtabs[0]['subtab'];
67
-
68
-                            endif;
69
-
70
-
71
-                            $tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
-
73
-                            if (isset($args['url']) && $args['url'] != '') {
74
-                                $tab_link = $args['url'];
75
-                            }
76
-
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
79
-
80
-                            if (isset($args['target']) && $args['target'] != '') {
81
-                                $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
84
-
85
-                            $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
-                            /**
89
-                             * Called before the individual settings tabs are output.
90
-                             *
91
-                             * @since 1.0.0
92
-                             * @param string $name The name of the settings tab.
93
-                             * @see 'geodir_after_settings_tabs'
94
-                             */
95
-                            do_action('geodir_before_settings_tabs', $name);
96
-                            echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
97
-                            /**
98
-                             * Called after the individual settings tabs are output.
99
-                             *
100
-                             * @since 1.0.0
101
-                             * @param string $name The name of the settings tab.
102
-                             * @see 'geodir_before_settings_tabs'
103
-                             */
104
-                            do_action('geodir_after_settings_tabs', $name);
105
-                        endforeach;
106
-
107
-                        /**
108
-                         * Called after the GD settings tabs have been output.
109
-                         *
110
-                         * Called before the closing `ul` so can be used to add new settings tab links.
111
-                         *
112
-                         * @since 1.0.0
113
-                         */
114
-                        do_action('geodir_settings_tabs');
115
-                        ?>
47
+						$tabs = array();
48
+						/**
49
+						 * Filter the GD admin settings tabs on the left of the admin menu.
50
+						 *
51
+						 * @since 1.0.0
52
+						 * @param array $tabs The array of tabs to display.
53
+						 */
54
+						$tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
+						update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
+
57
+						foreach ($tabs as $name => $args) :
58
+							$label = $args['label'];
59
+
60
+
61
+							$query_string = '';
62
+							if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
+
64
+								$subtabs = $args['subtabs'];
65
+
66
+								$query_string = '&subtab=' . $subtabs[0]['subtab'];
67
+
68
+							endif;
69
+
70
+
71
+							$tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
+
73
+							if (isset($args['url']) && $args['url'] != '') {
74
+								$tab_link = $args['url'];
75
+							}
76
+
77
+							if (!empty($args['request']))
78
+								$tab_link = geodir_getlink($tab_link, $args['request']);
79
+
80
+							if (isset($args['target']) && $args['target'] != '') {
81
+								$tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
+							} else
83
+								$tab_target = '';
84
+
85
+							$tab_active = '';
86
+							if ($current_tab == $name)
87
+								$tab_active = ' class="tab-active" ';
88
+							/**
89
+							 * Called before the individual settings tabs are output.
90
+							 *
91
+							 * @since 1.0.0
92
+							 * @param string $name The name of the settings tab.
93
+							 * @see 'geodir_after_settings_tabs'
94
+							 */
95
+							do_action('geodir_before_settings_tabs', $name);
96
+							echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
97
+							/**
98
+							 * Called after the individual settings tabs are output.
99
+							 *
100
+							 * @since 1.0.0
101
+							 * @param string $name The name of the settings tab.
102
+							 * @see 'geodir_before_settings_tabs'
103
+							 */
104
+							do_action('geodir_after_settings_tabs', $name);
105
+						endforeach;
106
+
107
+						/**
108
+						 * Called after the GD settings tabs have been output.
109
+						 *
110
+						 * Called before the closing `ul` so can be used to add new settings tab links.
111
+						 *
112
+						 * @since 1.0.0
113
+						 */
114
+						do_action('geodir_settings_tabs');
115
+						?>
116 116
                     </ul>
117 117
                 </div>
118 118
                 <!--gd-left-nav ends here-->
@@ -121,52 +121,52 @@  discard block
 block discarded – undo
121 121
                     <div class="gd-tabs-main">
122 122
 
123 123
                         <?php
124
-                        unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
127
-                        $form_action = '';
124
+						unset($subtabs);
125
+						if (isset($tabs[$current_tab]['subtabs']))
126
+							$subtabs = $tabs[$current_tab]['subtabs'];
127
+						$form_action = '';
128 128
 
129
-                        if (!empty($subtabs)):
130
-                        ?>
129
+						if (!empty($subtabs)):
130
+						?>
131 131
                             <dl class="gd-tab-head">
132 132
                                 <?php
133
-                                foreach ($subtabs as $sub) {
134
-                                    $subtab_active = '';
135
-                                    if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
-                                        $subtab_active = 'class="gd-tab-active"';
137
-                                        $form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
-                                    }
139
-
140
-                                    $sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
-                                    if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
-                                        $sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
-                                    }
144
-                                    echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
-                                }
146
-                                ?>
133
+								foreach ($subtabs as $sub) {
134
+									$subtab_active = '';
135
+									if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
+										$subtab_active = 'class="gd-tab-active"';
137
+										$form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
+									}
139
+
140
+									$sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
+									if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
+										$sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
+									}
144
+									echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
+								}
146
+								?>
147 147
                             </dl>
148 148
 
149 149
                         <?php endif; ?>
150 150
                         <div class="gd-tab-content <?php if (empty($subtabs)) {
151
-                            echo "inner_contet_tabs";
152
-                        } ?>">
151
+							echo "inner_contet_tabs";
152
+						} ?>">
153 153
                             <form method="post" id="mainform"
154 154
                                   class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) {
155
-                                      echo sanitize_text_field($sub['subtab']);
156
-                                  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
155
+									  echo sanitize_text_field($sub['subtab']);
156
+								  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
157 157
                                 <input type="hidden" class="active_tab" name="active_tab"
158 158
                                        value="<?php if (isset($_REQUEST['active_tab'])) {
159
-                                           echo sanitize_text_field($_REQUEST['active_tab']);
160
-                                       } ?>"/>
159
+										   echo sanitize_text_field($_REQUEST['active_tab']);
160
+									   } ?>"/>
161 161
                                 <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?>
162 162
                                 <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?>
163 163
                                 <?php
164
-                                /**
165
-                                 * Used to call the content of each GD settings tab page.
166
-                                 *
167
-                                 * @since 1.0.0
168
-                                 */
169
-                                do_action('geodir_admin_option_form', $current_tab); ?>
164
+								/**
165
+								 * Used to call the content of each GD settings tab page.
166
+								 *
167
+								 * @since 1.0.0
168
+								 */
169
+								do_action('geodir_admin_option_form', $current_tab); ?>
170 170
                             </form>
171 171
                         </div>
172 172
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         </script>
268 268
     <?php
269 269
 
270
-    }
270
+	}
271 271
 }
272 272
 
273 273
 
@@ -283,48 +283,48 @@  discard block
 block discarded – undo
283 283
 function geodir_admin_option_form($tab_name)
284 284
 {
285 285
 
286
-    //echo $tab_name.'_array.php' ;
287
-    global $geodir_settings, $is_default, $mapzoom;
288
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
-        /**
290
-         * Contains settings array for given tab.
291
-         *
292
-         * @since 1.0.0
293
-         * @package GeoDirectory
294
-         */
295
-        include_once('option-pages/' . $tab_name . '_array.php');
296
-    }
297
-
298
-    $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
-
300
-    switch ($tab_name) {
301
-
302
-        case 'general_settings':
303
-
304
-            geodir_admin_fields($geodir_settings['general_settings']);
305
-            /**
306
-             *
307
-             * Update Taxonomy Options *
308
-             *
309
-             **/
310
-            /*add_action('updated_option_place_prefix','update_listing_prefix');
286
+	//echo $tab_name.'_array.php' ;
287
+	global $geodir_settings, $is_default, $mapzoom;
288
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
+		/**
290
+		 * Contains settings array for given tab.
291
+		 *
292
+		 * @since 1.0.0
293
+		 * @package GeoDirectory
294
+		 */
295
+		include_once('option-pages/' . $tab_name . '_array.php');
296
+	}
297
+
298
+	$listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
+
300
+	switch ($tab_name) {
301
+
302
+		case 'general_settings':
303
+
304
+			geodir_admin_fields($geodir_settings['general_settings']);
305
+			/**
306
+			 *
307
+			 * Update Taxonomy Options *
308
+			 *
309
+			 **/
310
+			/*add_action('updated_option_place_prefix','update_listing_prefix');
311 311
             function update_listing_prefix(){
312 312
                 geodir_register_defaults();
313 313
             }*/
314 314
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
315
+			if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
+				$hide_save_button = "style='display:none;'";
317
+			else
318
+				$hide_save_button = '';
319 319
 
320
-            /**
321
-             * Filter weather the default save button in the GD admin settings pages should be shown.
322
-             *
323
-             * @since 1.0.0
324
-             * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
-             */
326
-            $hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
-            ?>
320
+			/**
321
+			 * Filter weather the default save button in the GD admin settings pages should be shown.
322
+			 *
323
+			 * @since 1.0.0
324
+			 * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
+			 */
326
+			$hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
+			?>
328 328
 
329 329
             <p class="submit">
330 330
             <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
@@ -334,38 +334,38 @@  discard block
 block discarded – undo
334 334
             </div>
335 335
             
336 336
 		<?php break;
337
-        case 'design_settings' :
337
+		case 'design_settings' :
338 338
 
339
-            add_thickbox();
340
-            geodir_admin_fields($geodir_settings['design_settings']);
339
+			add_thickbox();
340
+			geodir_admin_fields($geodir_settings['design_settings']);
341 341
 
342 342
 
343 343
 
344
-            ?>
344
+			?>
345 345
 			<p class="submit">
346 346
 			<input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
347 347
 			<input type="hidden" name="subtab" id="last_tab" />
348 348
 			</p>
349 349
 			</div>
350 350
         <?php break;
351
-        case 'permalink_settings' :
352
-            geodir_admin_fields($geodir_settings['permalink_settings']); ?>
351
+		case 'permalink_settings' :
352
+			geodir_admin_fields($geodir_settings['permalink_settings']); ?>
353 353
             <p class="submit">
354 354
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
355 355
             <input type="hidden" name="subtab" id="last_tab" />
356 356
             </p>
357 357
             </div>	
358 358
 		<?php break;
359
-        case 'title_meta_settings' :
360
-            geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
359
+		case 'title_meta_settings' :
360
+			geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
361 361
             <p class="submit">
362 362
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
363 363
             <input type="hidden" name="subtab" id="last_tab" />
364 364
             </p>
365 365
             </div>
366 366
 		<?php break;
367
-        case 'notifications_settings' :
368
-            geodir_admin_fields($geodir_settings['notifications_settings']); ?>
367
+		case 'notifications_settings' :
368
+			geodir_admin_fields($geodir_settings['notifications_settings']); ?>
369 369
 			
370 370
 			<p class="submit">
371 371
 				
@@ -375,36 +375,36 @@  discard block
 block discarded – undo
375 375
 			</div>
376 376
 			
377 377
 		<?php break;
378
-        case 'default_location_settings' :
379
-            ?>
378
+		case 'default_location_settings' :
379
+			?>
380 380
             <div class="inner_content_tab_main">
381 381
                 <div class="gd-content-heading">
382 382
                     <?php global $wpdb;
383 383
 
384 384
 
385
-                    $location_result = geodir_get_default_location();
385
+					$location_result = geodir_get_default_location();
386 386
 
387
-                    $prefix = '';
387
+					$prefix = '';
388 388
 
389 389
 
390
-                    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
391
-                    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
392
-                    $city = isset($location_result->city) ? $location_result->city : '';
393
-                    $region = isset($location_result->region) ? $location_result->region : '';
394
-                    $country = isset($location_result->country) ? $location_result->country : '';
390
+					$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
391
+					$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
392
+					$city = isset($location_result->city) ? $location_result->city : '';
393
+					$region = isset($location_result->region) ? $location_result->region : '';
394
+					$country = isset($location_result->country) ? $location_result->country : '';
395 395
 
396 396
 
397
-                    $map_title = __("Set Address On Map", 'geodirectory');
397
+					$map_title = __("Set Address On Map", 'geodirectory');
398 398
 
399
-                    ?>
399
+					?>
400 400
 
401 401
                     <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
402 402
 
403 403
                     <input type="hidden" name="add_location" value="location">
404 404
 
405 405
                     <input type="hidden" name="update_city" value="<?php if (isset($location_result->location_id)) {
406
-                        echo $location_result->location_id;
407
-                    } ?>">
406
+						echo $location_result->location_id;
407
+					} ?>">
408 408
 
409 409
                     <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
410 410
 
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
                                     <input class="require" type="text" size="80" style="width:440px"
418 418
                                            id="<?php echo $prefix;?>city" name="city"
419 419
                                            value="<?php if (isset($location_result->city)) {
420
-                                               echo $location_result->city;
421
-                                           } ?>"/>
420
+											   echo $location_result->city;
421
+										   } ?>"/>
422 422
 
423 423
                                     <div
424 424
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
                                     <input class="require" type="text" size="80" style="width:440px"
434 434
                                            id="<?php echo $prefix;?>region" name="region"
435 435
                                            value="<?php if (isset($location_result->region)) {
436
-                                               echo $location_result->region;
437
-                                           } ?>"/>
436
+											   echo $location_result->region;
437
+										   } ?>"/>
438 438
 
439 439
                                     <div
440 440
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
449 449
                                     <?php
450 450
 
451
-                                    $country_result = isset($location_result->country) ? $location_result->country : '';
452
-                                    ?>
451
+									$country_result = isset($location_result->country) ? $location_result->country : '';
452
+									?>
453 453
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
454 454
                                             data-location_type="country" name="<?php echo $prefix ?>country"
455 455
                                             data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
@@ -472,12 +472,12 @@  discard block
 block discarded – undo
472 472
                                 scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
473 473
                             <td class="forminp">
474 474
                                 <?php
475
-                                /**
476
-                                 * Contains add listing page map functions.
477
-                                 *
478
-                                 * @since 1.0.0
479
-                                 */
480
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
475
+								/**
476
+								 * Contains add listing page map functions.
477
+								 *
478
+								 * @since 1.0.0
479
+								 */
480
+								include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
481 481
                             </td>
482 482
                         </tr>
483 483
                         <tr valign="top" class="single_select_page">
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
                                     <input type="text" class="require" size="80" style="width:440px"
488 488
                                            id="<?php echo $prefix;?>latitude" name="latitude"
489 489
                                            value="<?php if (isset($location_result->city_latitude)) {
490
-                                               echo $location_result->city_latitude;
491
-                                           } ?>"/>
490
+											   echo $location_result->city_latitude;
491
+										   } ?>"/>
492 492
 
493 493
                                     <div
494 494
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
                                     <input type="text" class="require" size="80" style="width:440px"
505 505
                                            id="<?php echo $prefix;?>longitude" name="longitude"
506 506
                                            value="<?php if (isset($location_result->city_longitude)) {
507
-                                               echo $location_result->city_longitude;
508
-                                           } ?>"/>
507
+											   echo $location_result->city_longitude;
508
+										   } ?>"/>
509 509
 
510 510
                                     <div
511 511
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -537,22 +537,22 @@  discard block
 block discarded – undo
537 537
                 </div>
538 538
             </div>
539 539
             <?php break;
540
-        case $listing_type . '_fields_settings' :
540
+		case $listing_type . '_fields_settings' :
541 541
 
542
-            geodir_custom_post_type_form();
542
+			geodir_custom_post_type_form();
543 543
 
544
-            break;
545
-        case 'tools_settings' :
546
-            geodir_diagnostic_tools_setting_page();
547
-            break;
548
-        case 'compatibility_settings' :
549
-            geodir_theme_compatibility_setting_page();
550
-            break;		
544
+			break;
545
+		case 'tools_settings' :
546
+			geodir_diagnostic_tools_setting_page();
547
+			break;
548
+		case 'compatibility_settings' :
549
+			geodir_theme_compatibility_setting_page();
550
+			break;		
551 551
 		case 'import_export' :
552
-            geodir_import_export_page();
553
-            break;
552
+			geodir_import_export_page();
553
+			break;
554 554
 
555
-    }// end of switch
555
+	}// end of switch
556 556
 }
557 557
 
558 558
 
@@ -592,170 +592,170 @@  discard block
 block discarded – undo
592 592
 function geodir_update_options_compatibility_settings()
593 593
 {
594 594
 
595
-    global $wpdb;
595
+	global $wpdb;
596 596
 
597 597
 
598
-    $theme_settings = array();
598
+	$theme_settings = array();
599 599
 
600
-    $theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
601
-    $theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
602
-    $theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
600
+	$theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
601
+	$theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
602
+	$theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
603 603
 
604
-    $theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
604
+	$theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
605 605
 
606
-    $theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
607
-    $theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
608
-    $theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
606
+	$theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
607
+	$theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
608
+	$theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
609 609
 
610
-    $theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
610
+	$theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
611 611
 
612
-    $theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
613
-    $theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
614
-    $theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
612
+	$theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
613
+	$theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
614
+	$theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
615 615
 
616
-    $theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
616
+	$theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
617 617
 
618
-    $theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
619
-    $theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
620
-    $theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
618
+	$theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
619
+	$theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
620
+	$theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
621 621
 
622
-    $theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
622
+	$theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
623 623
 
624
-    $theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
625
-    $theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
626
-    $theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
624
+	$theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
625
+	$theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
626
+	$theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
627 627
 
628
-    $theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
628
+	$theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
629 629
 
630
-    $theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
631
-    $theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
632
-    $theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
630
+	$theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
631
+	$theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
632
+	$theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
633 633
 
634
-    $theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
634
+	$theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
635 635
 
636 636
 // Other Actions
637
-    $theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
638
-    $theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
637
+	$theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
638
+	$theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
639 639
 
640 640
 // Filters
641
-    $theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
642
-    $theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
643
-    $theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
644
-    $theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
645
-    $theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
646
-    $theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
647
-    $theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
648
-    $theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
649
-    $theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
650
-    $theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
641
+	$theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
642
+	$theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
643
+	$theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
644
+	$theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
645
+	$theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
646
+	$theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
647
+	$theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
648
+	$theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
649
+	$theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
650
+	$theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
651 651
 //location manager filters
652
-    $theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
653
-    $theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
654
-    $theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
655
-    $theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
652
+	$theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
653
+	$theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
654
+	$theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
655
+	$theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
656 656
 
657 657
 
658 658
 // theme required css
659
-    $theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
659
+	$theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
660 660
 
661 661
 // theme required js
662
-    $theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
662
+	$theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
663 663
 
664 664
 // theme compat name
665
-    $theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
666
-    if ($theme_settings['gd_theme_compat'] == '') {
667
-        update_option('gd_theme_compat', '');
668
-        update_option('theme_compatibility_setting', '');
669
-        return;
670
-    }
665
+	$theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
666
+	if ($theme_settings['gd_theme_compat'] == '') {
667
+		update_option('gd_theme_compat', '');
668
+		update_option('theme_compatibility_setting', '');
669
+		return;
670
+	}
671 671
 
672 672
 // theme default options
673
-    $theme_settings['geodir_theme_compat_default_options'] = '';
673
+	$theme_settings['geodir_theme_compat_default_options'] = '';
674 674
 
675 675
 
676 676
 //supported theme code
677
-    $theme_settings['geodir_theme_compat_code'] = false;
678
-
679
-    $theme = wp_get_theme();
680
-
681
-    if ($theme->parent()) {
682
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
683
-    } else {
684
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
685
-    }
686
-
687
-    if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
688
-        $theme_settings['geodir_theme_compat_code'] = $theme_name;
689
-    }
690
-
691
-
692
-    $theme_name = $theme_name . "_custom";
693
-    $theme_arr = get_option('gd_theme_compats');
694
-    update_option('gd_theme_compat', $theme_name);
695
-    /**
696
-     * Called before the theme compatibility settings are saved to the DB.
697
-     *
698
-     * @since 1.4.0
699
-     * @param array $theme_settings {
700
-     *    Attributes of the theme compatibility settings array.
701
-     *
702
-     *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
703
-     *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
704
-     *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
705
-     *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
706
-     *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
707
-     *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
708
-     *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
709
-     *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
710
-     *    @type string $geodir_article_open_id Geodir article open html id.
711
-     *    @type string $geodir_article_open_class Geodir article open html class.
712
-     *    @type string $geodir_article_open_replace Geodir article open content replace.
713
-     *    @type string $geodir_article_close_replace Geodir article close content replace.
714
-     *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
715
-     *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
716
-     *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
717
-     *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
718
-     *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
719
-     *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
720
-     *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
721
-     *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
722
-     *    @type string $geodir_main_content_open_id Geodir main content open html id.
723
-     *    @type string $geodir_main_content_open_class Geodir main content open html class.
724
-     *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
725
-     *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
726
-     *    @type string $geodir_top_content_add Geodir top content add.
727
-     *    @type string $geodir_before_main_content_add Geodir before main content add.
728
-     *    @type string $geodir_full_page_class_filter Geodir full page class filter.
729
-     *    @type string $geodir_before_widget_filter Geodir before widget filter.
730
-     *    @type string $geodir_after_widget_filter Geodir after widget filter.
731
-     *    @type string $geodir_before_title_filter Geodir before title filter.
732
-     *    @type string $geodir_after_title_filter Geodir after title filter.
733
-     *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
734
-     *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
735
-     *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
736
-     *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
737
-     *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
738
-     *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
739
-     *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
740
-     *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
741
-     *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
742
-     *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
743
-     *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
744
-     *    @type string $gd_theme_compat Gd theme compatibility.
745
-     *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
746
-     *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
747
-     *
748
-     * }
749
-     */
750
-    do_action('gd_compat_save_settings', $theme_settings);
677
+	$theme_settings['geodir_theme_compat_code'] = false;
678
+
679
+	$theme = wp_get_theme();
680
+
681
+	if ($theme->parent()) {
682
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
683
+	} else {
684
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
685
+	}
686
+
687
+	if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
688
+		$theme_settings['geodir_theme_compat_code'] = $theme_name;
689
+	}
690
+
691
+
692
+	$theme_name = $theme_name . "_custom";
693
+	$theme_arr = get_option('gd_theme_compats');
694
+	update_option('gd_theme_compat', $theme_name);
695
+	/**
696
+	 * Called before the theme compatibility settings are saved to the DB.
697
+	 *
698
+	 * @since 1.4.0
699
+	 * @param array $theme_settings {
700
+	 *    Attributes of the theme compatibility settings array.
701
+	 *
702
+	 *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
703
+	 *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
704
+	 *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
705
+	 *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
706
+	 *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
707
+	 *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
708
+	 *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
709
+	 *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
710
+	 *    @type string $geodir_article_open_id Geodir article open html id.
711
+	 *    @type string $geodir_article_open_class Geodir article open html class.
712
+	 *    @type string $geodir_article_open_replace Geodir article open content replace.
713
+	 *    @type string $geodir_article_close_replace Geodir article close content replace.
714
+	 *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
715
+	 *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
716
+	 *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
717
+	 *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
718
+	 *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
719
+	 *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
720
+	 *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
721
+	 *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
722
+	 *    @type string $geodir_main_content_open_id Geodir main content open html id.
723
+	 *    @type string $geodir_main_content_open_class Geodir main content open html class.
724
+	 *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
725
+	 *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
726
+	 *    @type string $geodir_top_content_add Geodir top content add.
727
+	 *    @type string $geodir_before_main_content_add Geodir before main content add.
728
+	 *    @type string $geodir_full_page_class_filter Geodir full page class filter.
729
+	 *    @type string $geodir_before_widget_filter Geodir before widget filter.
730
+	 *    @type string $geodir_after_widget_filter Geodir after widget filter.
731
+	 *    @type string $geodir_before_title_filter Geodir before title filter.
732
+	 *    @type string $geodir_after_title_filter Geodir after title filter.
733
+	 *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
734
+	 *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
735
+	 *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
736
+	 *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
737
+	 *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
738
+	 *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
739
+	 *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
740
+	 *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
741
+	 *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
742
+	 *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
743
+	 *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
744
+	 *    @type string $gd_theme_compat Gd theme compatibility.
745
+	 *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
746
+	 *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
747
+	 *
748
+	 * }
749
+	 */
750
+	do_action('gd_compat_save_settings', $theme_settings);
751 751
 
752 752
 //if($_POST['gd_theme_compat'])==
753
-    $theme_arr[$theme_name] = $theme_settings;
754
-    update_option('gd_theme_compats', $theme_arr);
753
+	$theme_arr[$theme_name] = $theme_settings;
754
+	update_option('gd_theme_compats', $theme_arr);
755 755
 
756 756
 
757 757
 //print_r($theme_settings);exit;
758
-    update_option('theme_compatibility_setting', $theme_settings);
758
+	update_option('theme_compatibility_setting', $theme_settings);
759 759
 
760 760
 }
761 761
 
@@ -768,12 +768,12 @@  discard block
 block discarded – undo
768 768
  */
769 769
 function geodir_theme_compatibility_setting_page()
770 770
 {
771
-    global $wpdb;
772
-    $tc = get_option('theme_compatibility_setting');
773
-    //print_r($tc);
774
-    //print_r(wp_get_theme());
771
+	global $wpdb;
772
+	$tc = get_option('theme_compatibility_setting');
773
+	//print_r($tc);
774
+	//print_r(wp_get_theme());
775 775
 
776
-    ?>
776
+	?>
777 777
     <div class="inner_content_tab_main">
778 778
         <div class="gd-content-heading">
779 779
 
@@ -815,21 +815,21 @@  discard block
 block discarded – undo
815 815
                 <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
816 816
                 <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
817 817
                 <?php
818
-                $theme_arr = get_option('gd_theme_compats');
819
-                $theme_active = get_option('gd_theme_compat');
820
-                if (is_array($theme_arr)) {
821
-                    foreach ($theme_arr as $key => $theme) {
822
-                        $sel = '';
823
-                        if ($theme_active == $key) {
824
-                            $sel = "selected";
825
-                        }
826
-                        echo "<option $sel>$key</option>";
827
-                    }
818
+				$theme_arr = get_option('gd_theme_compats');
819
+				$theme_active = get_option('gd_theme_compat');
820
+				if (is_array($theme_arr)) {
821
+					foreach ($theme_arr as $key => $theme) {
822
+						$sel = '';
823
+						if ($theme_active == $key) {
824
+							$sel = "selected";
825
+						}
826
+						echo "<option $sel>$key</option>";
827
+					}
828 828
 
829 829
 
830
-                }
830
+				}
831 831
 
832
-                ?>
832
+				?>
833 833
             </select>
834 834
             <button onclick="gd_comp_export();" type="button"
835 835
                     class="button-primary"><?php _e('Export', 'geodirectory');?></button>
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
                         <small>geodir_wrapper_open</small>
939 939
                     </td>
940 940
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_id'])) {
941
-                            echo $tc['geodir_wrapper_open_id'];
942
-                        }?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
941
+							echo $tc['geodir_wrapper_open_id'];
942
+						}?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
943 943
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_class'])) {
944
-                            echo $tc['geodir_wrapper_open_class'];
945
-                        }?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
944
+							echo $tc['geodir_wrapper_open_class'];
945
+						}?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
946 946
                 </tr>
947 947
 
948 948
                 <tr class="gd-theme-comp-out">
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
                         <span><?php _e('Output:', 'geodirectory');?></span>
951 951
                         <textarea name="geodir_wrapper_open_replace"
952 952
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
953
-                                echo $tc['geodir_wrapper_open_replace'];
954
-                            }?></textarea>
953
+								echo $tc['geodir_wrapper_open_replace'];
954
+							}?></textarea>
955 955
                     </td>
956 956
                 </tr>
957 957
 
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
                         <span><?php _e('Output:', 'geodirectory');?></span>
972 972
                         <textarea name="geodir_wrapper_close_replace"
973 973
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
974
-                                echo $tc['geodir_wrapper_close_replace'];
975
-                            }?></textarea>
974
+								echo $tc['geodir_wrapper_close_replace'];
975
+							}?></textarea>
976 976
                     </td>
977 977
                 </tr>
978 978
 
@@ -982,12 +982,12 @@  discard block
 block discarded – undo
982 982
                         <small>geodir_wrapper_content_open</small>
983 983
                     </td>
984 984
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_id'])) {
985
-                            echo $tc['geodir_wrapper_content_open_id'];
986
-                        }?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
985
+							echo $tc['geodir_wrapper_content_open_id'];
986
+						}?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
987 987
                     </td>
988 988
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_class'])) {
989
-                            echo $tc['geodir_wrapper_content_open_class'];
990
-                        }?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
989
+							echo $tc['geodir_wrapper_content_open_class'];
990
+						}?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
991 991
                 </tr>
992 992
 
993 993
                 <tr class="gd-theme-comp-out">
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
                         <span><?php _e('Output:', 'geodirectory');?></span>
996 996
                         <textarea name="geodir_wrapper_content_open_replace"
997 997
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
998
-                                echo $tc['geodir_wrapper_content_open_replace'];
999
-                            }?></textarea>
998
+								echo $tc['geodir_wrapper_content_open_replace'];
999
+							}?></textarea>
1000 1000
                     </td>
1001 1001
                 </tr>
1002 1002
 
@@ -1016,8 +1016,8 @@  discard block
 block discarded – undo
1016 1016
                         <span><?php _e('Output:', 'geodirectory');?></span>
1017 1017
                         <textarea name="geodir_wrapper_content_close_replace"
1018 1018
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1019
-                                echo $tc['geodir_wrapper_content_close_replace'];
1020
-                            }?></textarea>
1019
+								echo $tc['geodir_wrapper_content_close_replace'];
1020
+							}?></textarea>
1021 1021
                     </td>
1022 1022
                 </tr>
1023 1023
 
@@ -1026,11 +1026,11 @@  discard block
 block discarded – undo
1026 1026
                         <small>geodir_article_open</small>
1027 1027
                     </td>
1028 1028
                     <td><input value="<?php if (isset($tc['geodir_article_open_id'])) {
1029
-                            echo $tc['geodir_article_open_id'];
1030
-                        }?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1029
+							echo $tc['geodir_article_open_id'];
1030
+						}?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1031 1031
                     <td><input value="<?php if (isset($tc['geodir_article_open_class'])) {
1032
-                            echo $tc['geodir_article_open_class'];
1033
-                        }?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1032
+							echo $tc['geodir_article_open_class'];
1033
+						}?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1034 1034
                 </tr>
1035 1035
 
1036 1036
                 <tr class="gd-theme-comp-out">
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
                         <span><?php _e('Output:', 'geodirectory');?></span>
1039 1039
                         <textarea name="geodir_article_open_replace"
1040 1040
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1041
-                                echo $tc['geodir_article_open_replace'];
1042
-                            }?></textarea>
1041
+								echo $tc['geodir_article_open_replace'];
1042
+							}?></textarea>
1043 1043
                     </td>
1044 1044
                 </tr>
1045 1045
 
@@ -1058,8 +1058,8 @@  discard block
 block discarded – undo
1058 1058
                         <span><?php _e('Output:', 'geodirectory');?></span>
1059 1059
                         <textarea name="geodir_article_close_replace"
1060 1060
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1061
-                                echo $tc['geodir_article_close_replace'];
1062
-                            }?></textarea>
1061
+								echo $tc['geodir_article_close_replace'];
1062
+							}?></textarea>
1063 1063
                     </td>
1064 1064
                 </tr>
1065 1065
 
@@ -1068,11 +1068,11 @@  discard block
 block discarded – undo
1068 1068
                         <small>geodir_sidebar_right_open</small>
1069 1069
                     </td>
1070 1070
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_id'])) {
1071
-                            echo $tc['geodir_sidebar_right_open_id'];
1072
-                        }?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1071
+							echo $tc['geodir_sidebar_right_open_id'];
1072
+						}?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1073 1073
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_class'])) {
1074
-                            echo $tc['geodir_sidebar_right_open_class'];
1075
-                        }?>" type="text" name="geodir_sidebar_right_open_class"
1074
+							echo $tc['geodir_sidebar_right_open_class'];
1075
+						}?>" type="text" name="geodir_sidebar_right_open_class"
1076 1076
                                placeholder="geodir-sidebar-right geodir-listings-sidebar-right"/></td>
1077 1077
                 </tr>
1078 1078
 
@@ -1081,8 +1081,8 @@  discard block
 block discarded – undo
1081 1081
                         <span><?php _e('Output:', 'geodirectory');?></span>
1082 1082
                         <textarea name="geodir_sidebar_right_open_replace"
1083 1083
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1084
-                                echo $tc['geodir_sidebar_right_open_replace'];
1085
-                            }?></textarea>
1084
+								echo $tc['geodir_sidebar_right_open_replace'];
1085
+							}?></textarea>
1086 1086
                     </td>
1087 1087
                 </tr>
1088 1088
 
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
                         <span><?php _e('Output:', 'geodirectory');?></span>
1102 1102
                         <textarea name="geodir_sidebar_right_close_replace"
1103 1103
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1104
-                                echo $tc['geodir_sidebar_right_close_replace'];
1105
-                            }?></textarea>
1104
+								echo $tc['geodir_sidebar_right_close_replace'];
1105
+							}?></textarea>
1106 1106
                     </td>
1107 1107
                 </tr>
1108 1108
 
@@ -1112,11 +1112,11 @@  discard block
 block discarded – undo
1112 1112
                         <small>geodir_sidebar_left_open</small>
1113 1113
                     </td>
1114 1114
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_id'])) {
1115
-                            echo $tc['geodir_sidebar_left_open_id'];
1116
-                        }?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1115
+							echo $tc['geodir_sidebar_left_open_id'];
1116
+						}?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1117 1117
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_class'])) {
1118
-                            echo $tc['geodir_sidebar_left_open_class'];
1119
-                        }?>" type="text" name="geodir_sidebar_left_open_class"
1118
+							echo $tc['geodir_sidebar_left_open_class'];
1119
+						}?>" type="text" name="geodir_sidebar_left_open_class"
1120 1120
                                placeholder="geodir-sidebar-left geodir-listings-sidebar-left"/></td>
1121 1121
                 </tr>
1122 1122
 
@@ -1125,8 +1125,8 @@  discard block
 block discarded – undo
1125 1125
                         <span><?php _e('Output:', 'geodirectory');?></span>
1126 1126
                         <textarea name="geodir_sidebar_left_open_replace"
1127 1127
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1128
-                                echo $tc['geodir_sidebar_left_open_replace'];
1129
-                            }?></textarea>
1128
+								echo $tc['geodir_sidebar_left_open_replace'];
1129
+							}?></textarea>
1130 1130
                     </td>
1131 1131
                 </tr>
1132 1132
 
@@ -1145,8 +1145,8 @@  discard block
 block discarded – undo
1145 1145
                         <span><?php _e('Output:', 'geodirectory');?></span>
1146 1146
                         <textarea name="geodir_sidebar_left_close_replace"
1147 1147
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1148
-                                echo $tc['geodir_sidebar_left_close_replace'];
1149
-                            }?></textarea>
1148
+								echo $tc['geodir_sidebar_left_close_replace'];
1149
+							}?></textarea>
1150 1150
                     </td>
1151 1151
                 </tr>
1152 1152
 
@@ -1155,11 +1155,11 @@  discard block
 block discarded – undo
1155 1155
                         <small>geodir_main_content_open</small>
1156 1156
                     </td>
1157 1157
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_id'])) {
1158
-                            echo $tc['geodir_main_content_open_id'];
1159
-                        }?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1158
+							echo $tc['geodir_main_content_open_id'];
1159
+						}?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1160 1160
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_class'])) {
1161
-                            echo $tc['geodir_main_content_open_class'];
1162
-                        }?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1161
+							echo $tc['geodir_main_content_open_class'];
1162
+						}?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1163 1163
                 </tr>
1164 1164
 
1165 1165
                 <tr class="gd-theme-comp-out">
@@ -1167,8 +1167,8 @@  discard block
 block discarded – undo
1167 1167
                         <span><?php _e('Output:', 'geodirectory');?></span>
1168 1168
                         <textarea name="geodir_main_content_open_replace"
1169 1169
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1170
-                                echo $tc['geodir_main_content_open_replace'];
1171
-                            }?></textarea>
1170
+								echo $tc['geodir_main_content_open_replace'];
1171
+							}?></textarea>
1172 1172
                     </td>
1173 1173
                 </tr>
1174 1174
 
@@ -1187,8 +1187,8 @@  discard block
 block discarded – undo
1187 1187
                         <span><?php _e('Output:', 'geodirectory');?></span>
1188 1188
                         <textarea name="geodir_main_content_close_replace"
1189 1189
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1190
-                                echo $tc['geodir_main_content_close_replace'];
1191
-                            }?></textarea>
1190
+								echo $tc['geodir_main_content_close_replace'];
1191
+							}?></textarea>
1192 1192
                     </td>
1193 1193
                 </tr>
1194 1194
 
@@ -1212,8 +1212,8 @@  discard block
 block discarded – undo
1212 1212
                     </td>
1213 1213
                     <td><textarea name="geodir_top_content_add"
1214 1214
                                   placeholder=''><?php if (isset($tc['geodir_top_content_add'])) {
1215
-                                echo $tc['geodir_top_content_add'];
1216
-                            }?></textarea></td>
1215
+								echo $tc['geodir_top_content_add'];
1216
+							}?></textarea></td>
1217 1217
                 </tr>
1218 1218
 
1219 1219
                 <tr>
@@ -1222,8 +1222,8 @@  discard block
 block discarded – undo
1222 1222
                     </td>
1223 1223
                     <td><textarea name="geodir_before_main_content_add"
1224 1224
                                   placeholder=''><?php if (isset($tc['geodir_before_main_content_add'])) {
1225
-                                echo $tc['geodir_before_main_content_add'];
1226
-                            }?></textarea></td>
1225
+								echo $tc['geodir_before_main_content_add'];
1226
+							}?></textarea></td>
1227 1227
                 </tr>
1228 1228
 
1229 1229
 
@@ -1246,8 +1246,8 @@  discard block
 block discarded – undo
1246 1246
                     </td>
1247 1247
                     <td><textarea name="geodir_full_page_class_filter"
1248 1248
                                   placeholder='geodir_full_page clearfix'><?php if (isset($tc['geodir_full_page_class_filter'])) {
1249
-                                echo $tc['geodir_full_page_class_filter'];
1250
-                            }?></textarea></td>
1249
+								echo $tc['geodir_full_page_class_filter'];
1250
+							}?></textarea></td>
1251 1251
                 </tr>
1252 1252
 
1253 1253
                 <tr>
@@ -1256,8 +1256,8 @@  discard block
 block discarded – undo
1256 1256
                     </td>
1257 1257
                     <td><textarea name="geodir_before_widget_filter"
1258 1258
                                   placeholder='<section id="%1$s" class="widget geodir-widget %2$s">'><?php if (isset($tc['geodir_before_widget_filter'])) {
1259
-                                echo $tc['geodir_before_widget_filter'];
1260
-                            }?></textarea></td>
1259
+								echo $tc['geodir_before_widget_filter'];
1260
+							}?></textarea></td>
1261 1261
                 </tr>
1262 1262
 
1263 1263
                 <tr>
@@ -1266,8 +1266,8 @@  discard block
 block discarded – undo
1266 1266
                     </td>
1267 1267
                     <td><textarea name="geodir_after_widget_filter"
1268 1268
                                   placeholder='</section>'><?php if (isset($tc['geodir_after_widget_filter'])) {
1269
-                                echo $tc['geodir_after_widget_filter'];
1270
-                            }?></textarea></td>
1269
+								echo $tc['geodir_after_widget_filter'];
1270
+							}?></textarea></td>
1271 1271
                 </tr>
1272 1272
 
1273 1273
                 <tr>
@@ -1276,8 +1276,8 @@  discard block
 block discarded – undo
1276 1276
                     </td>
1277 1277
                     <td><textarea name="geodir_before_title_filter"
1278 1278
                                   placeholder='<h3 class="widget-title">'><?php if (isset($tc['geodir_before_title_filter'])) {
1279
-                                echo $tc['geodir_before_title_filter'];
1280
-                            }?></textarea></td>
1279
+								echo $tc['geodir_before_title_filter'];
1280
+							}?></textarea></td>
1281 1281
                 </tr>
1282 1282
 
1283 1283
                 <tr>
@@ -1286,8 +1286,8 @@  discard block
 block discarded – undo
1286 1286
                     </td>
1287 1287
                     <td><textarea name="geodir_after_title_filter"
1288 1288
                                   placeholder='</h3>'><?php if (isset($tc['geodir_after_title_filter'])) {
1289
-                                echo $tc['geodir_after_title_filter'];
1290
-                            }?></textarea></td>
1289
+								echo $tc['geodir_after_title_filter'];
1290
+							}?></textarea></td>
1291 1291
                 </tr>
1292 1292
 
1293 1293
                 <tr>
@@ -1296,8 +1296,8 @@  discard block
 block discarded – undo
1296 1296
                     </td>
1297 1297
                     <td><textarea name="geodir_menu_li_class_filter"
1298 1298
                                   placeholder='menu-item'><?php if (isset($tc['geodir_menu_li_class_filter'])) {
1299
-                                echo $tc['geodir_menu_li_class_filter'];
1300
-                            }?></textarea></td>
1299
+								echo $tc['geodir_menu_li_class_filter'];
1300
+							}?></textarea></td>
1301 1301
                 </tr>
1302 1302
 
1303 1303
                 <tr>
@@ -1306,8 +1306,8 @@  discard block
 block discarded – undo
1306 1306
                     </td>
1307 1307
                     <td><textarea name="geodir_sub_menu_ul_class_filter"
1308 1308
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_sub_menu_ul_class_filter'])) {
1309
-                                echo $tc['geodir_sub_menu_ul_class_filter'];
1310
-                            }?></textarea></td>
1309
+								echo $tc['geodir_sub_menu_ul_class_filter'];
1310
+							}?></textarea></td>
1311 1311
                 </tr>
1312 1312
 
1313 1313
                 <tr>
@@ -1316,8 +1316,8 @@  discard block
 block discarded – undo
1316 1316
                     </td>
1317 1317
                     <td><textarea name="geodir_sub_menu_li_class_filter"
1318 1318
                                   placeholder='menu-item'><?php if (isset($tc['geodir_sub_menu_li_class_filter'])) {
1319
-                                echo $tc['geodir_sub_menu_li_class_filter'];
1320
-                            }?></textarea></td>
1319
+								echo $tc['geodir_sub_menu_li_class_filter'];
1320
+							}?></textarea></td>
1321 1321
                 </tr>
1322 1322
 
1323 1323
                 <tr>
@@ -1326,8 +1326,8 @@  discard block
 block discarded – undo
1326 1326
                     </td>
1327 1327
                     <td><textarea name="geodir_menu_a_class_filter"
1328 1328
                                   placeholder=''><?php if (isset($tc['geodir_menu_a_class_filter'])) {
1329
-                                echo $tc['geodir_menu_a_class_filter'];
1330
-                            }?></textarea></td>
1329
+								echo $tc['geodir_menu_a_class_filter'];
1330
+							}?></textarea></td>
1331 1331
                 </tr>
1332 1332
 
1333 1333
                 <tr>
@@ -1336,8 +1336,8 @@  discard block
 block discarded – undo
1336 1336
                     </td>
1337 1337
                     <td><textarea name="geodir_sub_menu_a_class_filter"
1338 1338
                                   placeholder=''><?php if (isset($tc['geodir_sub_menu_a_class_filter'])) {
1339
-                                echo $tc['geodir_sub_menu_a_class_filter'];
1340
-                            }?></textarea></td>
1339
+								echo $tc['geodir_sub_menu_a_class_filter'];
1340
+							}?></textarea></td>
1341 1341
                 </tr>
1342 1342
 
1343 1343
 
@@ -1347,8 +1347,8 @@  discard block
 block discarded – undo
1347 1347
                     </td>
1348 1348
                     <td><textarea name="geodir_location_switcher_menu_li_class_filter"
1349 1349
                                   placeholder='menu-item menu-item-type-social menu-item-type-social gd-location-switcher'><?php if (isset($tc['geodir_location_switcher_menu_li_class_filter'])) {
1350
-                                echo $tc['geodir_location_switcher_menu_li_class_filter'];
1351
-                            }?></textarea></td>
1350
+								echo $tc['geodir_location_switcher_menu_li_class_filter'];
1351
+							}?></textarea></td>
1352 1352
                 </tr>
1353 1353
 
1354 1354
                 <tr>
@@ -1357,8 +1357,8 @@  discard block
 block discarded – undo
1357 1357
                     </td>
1358 1358
                     <td><textarea name="geodir_location_switcher_menu_a_class_filter"
1359 1359
                                   placeholder=''><?php if (isset($tc['geodir_location_switcher_menu_a_class_filter'])) {
1360
-                                echo $tc['geodir_location_switcher_menu_a_class_filter'];
1361
-                            }?></textarea></td>
1360
+								echo $tc['geodir_location_switcher_menu_a_class_filter'];
1361
+							}?></textarea></td>
1362 1362
                 </tr>
1363 1363
 
1364 1364
                 <tr>
@@ -1367,8 +1367,8 @@  discard block
 block discarded – undo
1367 1367
                     </td>
1368 1368
                     <td><textarea name="geodir_location_switcher_menu_sub_ul_class_filter"
1369 1369
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
1370
-                                echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1371
-                            }?></textarea></td>
1370
+								echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1371
+							}?></textarea></td>
1372 1372
                 </tr>
1373 1373
 
1374 1374
                 <tr>
@@ -1377,21 +1377,21 @@  discard block
 block discarded – undo
1377 1377
                     </td>
1378 1378
                     <td><textarea name="geodir_location_switcher_menu_sub_li_class_filter"
1379 1379
                                   placeholder='menu-item gd-location-switcher-menu-item'><?php if (isset($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
1380
-                                echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1381
-                            }?></textarea></td>
1380
+								echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1381
+							}?></textarea></td>
1382 1382
                 </tr>
1383 1383
 
1384 1384
 
1385 1385
 
1386 1386
                 <?php
1387
-                /**
1388
-                 * Allows more filter setting to be added to theme compatibility settings page.
1389
-                 *
1390
-                 * Called after the last setting in "Other filters" section of theme compatibility settings.
1391
-                 *
1392
-                 * @since 1.4.0
1393
-                 */
1394
-                do_action('gd_compat_other_filters');?>
1387
+				/**
1388
+				 * Allows more filter setting to be added to theme compatibility settings page.
1389
+				 *
1390
+				 * Called after the last setting in "Other filters" section of theme compatibility settings.
1391
+				 *
1392
+				 * @since 1.4.0
1393
+				 */
1394
+				do_action('gd_compat_other_filters');?>
1395 1395
 
1396 1396
                 </tbody>
1397 1397
             </table>
@@ -1404,8 +1404,8 @@  discard block
 block discarded – undo
1404 1404
                 <tr>
1405 1405
                     <td><textarea name="geodir_theme_compat_css"
1406 1406
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_css'])) {
1407
-                                echo $tc['geodir_theme_compat_css'];
1408
-                            }?></textarea></td>
1407
+								echo $tc['geodir_theme_compat_css'];
1408
+							}?></textarea></td>
1409 1409
                 </tr>
1410 1410
 
1411 1411
 
@@ -1419,8 +1419,8 @@  discard block
 block discarded – undo
1419 1419
                 <tr>
1420 1420
                     <td><textarea name="geodir_theme_compat_js"
1421 1421
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_js'])) {
1422
-                                echo $tc['geodir_theme_compat_js'];
1423
-                            }?></textarea></td>
1422
+								echo $tc['geodir_theme_compat_js'];
1423
+							}?></textarea></td>
1424 1424
                 </tr>
1425 1425
 
1426 1426
 
@@ -1447,23 +1447,23 @@  discard block
 block discarded – undo
1447 1447
  */
1448 1448
 function geodir_custom_post_type_form()
1449 1449
 {
1450
-    $listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1450
+	$listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1451 1451
 
1452
-    $sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1452
+	$sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1453 1453
 
1454 1454
 
1455
-    ?>
1455
+	?>
1456 1456
 
1457 1457
     <div class="gd-content-heading">
1458 1458
         <?php
1459
-        /**
1460
-         * Filter custom fields panel heading.
1461
-         *
1462
-         * @since 1.0.0
1463
-         * @param string $sub_tab Sub tab name.
1464
-         * @param string $listing_type Post type.
1465
-         */
1466
-        ?>
1459
+		/**
1460
+		 * Filter custom fields panel heading.
1461
+		 *
1462
+		 * @since 1.0.0
1463
+		 * @param string $sub_tab Sub tab name.
1464
+		 * @param string $listing_type Post type.
1465
+		 */
1466
+		?>
1467 1467
         <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1468 1468
     </div>
1469 1469
     <div id="container_general" class="clearfix">
@@ -1471,25 +1471,25 @@  discard block
 block discarded – undo
1471 1471
 
1472 1472
             <div class="side-sortables" id="geodir-available-fields">
1473 1473
                 <?php
1474
-                /**
1475
-                 * Filter custom field available fields heading.
1476
-                 *
1477
-                 * @since 1.0.0
1478
-                 * @param string $sub_tab Sub tab name.
1479
-                 * @param string $listing_type Post type.
1480
-                 */
1481
-                ?>
1474
+				/**
1475
+				 * Filter custom field available fields heading.
1476
+				 *
1477
+				 * @since 1.0.0
1478
+				 * @param string $sub_tab Sub tab name.
1479
+				 * @param string $listing_type Post type.
1480
+				 */
1481
+				?>
1482 1482
                 <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1483 1483
 							</span></h3>
1484 1484
                 <?php
1485
-                /**
1486
-                 * Filter custom field available fields note text.
1487
-                 *
1488
-                 * @since 1.0.0
1489
-                 * @param string $sub_tab Sub tab name.
1490
-                 * @param string $listing_type Post type.
1491
-                 */
1492
-                ?>
1485
+				/**
1486
+				 * Filter custom field available fields note text.
1487
+				 *
1488
+				 * @since 1.0.0
1489
+				 * @param string $sub_tab Sub tab name.
1490
+				 * @param string $listing_type Post type.
1491
+				 */
1492
+				?>
1493 1493
                 <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1494 1494
 
1495 1495
                 <h3><?php _e('Setup New Field','geodirectory');?></h3>
@@ -1498,13 +1498,13 @@  discard block
 block discarded – undo
1498 1498
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1499 1499
 
1500 1500
                         <?php
1501
-                        /**
1502
-                         * Adds the available fields to the custom fields settings page per post type.
1503
-                         *
1504
-                         * @since 1.0.0
1505
-                         * @param string $sub_tab The current settings tab name.
1506
-                         */
1507
-                        do_action('geodir_manage_available_fields', $sub_tab); ?>
1501
+						/**
1502
+						 * Adds the available fields to the custom fields settings page per post type.
1503
+						 *
1504
+						 * @since 1.0.0
1505
+						 * @param string $sub_tab The current settings tab name.
1506
+						 */
1507
+						do_action('geodir_manage_available_fields', $sub_tab); ?>
1508 1508
 
1509 1509
                         <div style="clear:both"></div>
1510 1510
                     </div>
@@ -1519,13 +1519,13 @@  discard block
 block discarded – undo
1519 1519
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1520 1520
 
1521 1521
                         <?php
1522
-                        /**
1523
-                         * Adds the available fields to the custom fields predefined settings page per post type.
1524
-                         *
1525
-                         * @since 1.6.9
1526
-                         * @param string $sub_tab The current settings tab name.
1527
-                         */
1528
-                        do_action('geodir_manage_available_fields_predefined', $sub_tab); ?>
1522
+						/**
1523
+						 * Adds the available fields to the custom fields predefined settings page per post type.
1524
+						 *
1525
+						 * @since 1.6.9
1526
+						 * @param string $sub_tab The current settings tab name.
1527
+						 */
1528
+						do_action('geodir_manage_available_fields_predefined', $sub_tab); ?>
1529 1529
 
1530 1530
                         <div style="clear:both"></div>
1531 1531
                     </div>
@@ -1538,13 +1538,13 @@  discard block
 block discarded – undo
1538 1538
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1539 1539
 
1540 1540
                         <?php
1541
-                        /**
1542
-                         * Adds the available fields to the custom fields custom added settings page per post type.
1543
-                         *
1544
-                         * @since 1.6.9
1545
-                         * @param string $sub_tab The current settings tab name.
1546
-                         */
1547
-                        do_action('geodir_manage_available_fields_custom', $sub_tab); ?>
1541
+						/**
1542
+						 * Adds the available fields to the custom fields custom added settings page per post type.
1543
+						 *
1544
+						 * @since 1.6.9
1545
+						 * @param string $sub_tab The current settings tab name.
1546
+						 */
1547
+						do_action('geodir_manage_available_fields_custom', $sub_tab); ?>
1548 1548
 
1549 1549
                         <div style="clear:both"></div>
1550 1550
                     </div>
@@ -1561,25 +1561,25 @@  discard block
 block discarded – undo
1561 1561
             <div class="side-sortables" id="geodir-selected-fields">
1562 1562
                 <h3 class="hndle">
1563 1563
                     <?php
1564
-                    /**
1565
-                     * Filter custom field selected fields heading.
1566
-                     *
1567
-                     * @since 1.0.0
1568
-                     * @param string $sub_tab Sub tab name.
1569
-                     * @param string $listing_type Post type.
1570
-                     */
1571
-                    ?>
1564
+					/**
1565
+					 * Filter custom field selected fields heading.
1566
+					 *
1567
+					 * @since 1.0.0
1568
+					 * @param string $sub_tab Sub tab name.
1569
+					 * @param string $listing_type Post type.
1570
+					 */
1571
+					?>
1572 1572
                     <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1573 1573
                 </h3>
1574 1574
                 <?php
1575
-                /**
1576
-                 * Filter custom field selected fields note text.
1577
-                 *
1578
-                 * @since 1.0.0
1579
-                 * @param string $sub_tab Sub tab name.
1580
-                 * @param string $listing_type Post type.
1581
-                 */
1582
-                ?>
1575
+				/**
1576
+				 * Filter custom field selected fields note text.
1577
+				 *
1578
+				 * @since 1.0.0
1579
+				 * @param string $sub_tab Sub tab name.
1580
+				 * @param string $listing_type Post type.
1581
+				 */
1582
+				?>
1583 1583
                 <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1584 1584
 
1585 1585
                 <div class="inside">
@@ -1587,13 +1587,13 @@  discard block
 block discarded – undo
1587 1587
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1588 1588
                         <div class="field_row_main">
1589 1589
                             <?php
1590
-                            /**
1591
-                             * Adds the selected fields and setting to the custom fields settings page per post type.
1592
-                             *
1593
-                             * @since 1.0.0
1594
-                             * @param string $sub_tab The current settings tab name.
1595
-                             */
1596
-                            do_action('geodir_manage_selected_fields', $sub_tab); ?>
1590
+							/**
1591
+							 * Adds the selected fields and setting to the custom fields settings page per post type.
1592
+							 *
1593
+							 * @since 1.0.0
1594
+							 * @param string $sub_tab The current settings tab name.
1595
+							 */
1596
+							do_action('geodir_manage_selected_fields', $sub_tab); ?>
1597 1597
                         </div>
1598 1598
                         <div style="clear:both"></div>
1599 1599
                     </div>
@@ -1616,7 +1616,7 @@  discard block
 block discarded – undo
1616 1616
  */
1617 1617
 function geodir_diagnostic_tools_setting_page()
1618 1618
 {
1619
-    ?>
1619
+	?>
1620 1620
     <div class="inner_content_tab_main">
1621 1621
         <div class="gd-content-heading">
1622 1622
 
@@ -1718,13 +1718,13 @@  discard block
 block discarded – undo
1718 1718
 					</td>
1719 1719
 				</tr>
1720 1720
                 <?php
1721
-                /**
1722
-                 * Allows you to add more setting to the GD>Tools settings page.
1723
-                 *
1724
-                 * Called after the last setting on the GD>Tools page.
1725
-                 * @since 1.0.0
1726
-                 */
1727
-                do_action('geodir_diagnostic_tool');?>
1721
+				/**
1722
+				 * Allows you to add more setting to the GD>Tools settings page.
1723
+				 *
1724
+				 * Called after the last setting on the GD>Tools page.
1725
+				 * @since 1.0.0
1726
+				 */
1727
+				do_action('geodir_diagnostic_tool');?>
1728 1728
 
1729 1729
                 </tbody>
1730 1730
             </table>
Please login to merge, or discard this patch.
geodirectory-admin/dummy-data/property_rent.php 2 patches
Indentation   +872 added lines, -872 removed lines patch added patch discarded remove patch
@@ -7,452 +7,452 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 function geodir_property_rent_custom_fields($post_type='gd_place',$package_id=''){
10
-    $fields = array();
11
-    $package = ($package_id=='') ? '' : array($package_id);
12
-
13
-    // price
14
-    $fields[] = array('listing_type' => $post_type,
15
-                      'field_type'          =>  'text',
16
-                      'data_type'           =>  'FLOAT',
17
-                      'decimal_point'       =>  '2',
18
-                      'admin_title'         =>  __('Price', 'geodirectory'),
19
-                      'site_title'          =>  __('Price', 'geodirectory'),
20
-                      'admin_desc'          =>  __('Enter the price per calendar month (PCM)in $ (no currency symbol)', 'geodirectory'),
21
-                      'htmlvar_name'        =>  'price',
22
-                      'is_active'           =>  true,
23
-                      'for_admin_use'       =>  false,
24
-                      'default_value'       =>  '',
25
-                      'show_in' 	        =>  '[detail],[listing]',
26
-                      'is_required'         =>  false,
27
-                      'validation_pattern'  =>  addslashes_gpc('\d+(\.\d{2})?'), // add slashes required
28
-                      'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
29
-                      'required_msg'        =>  '',
30
-                      'field_icon'          =>  'fa fa-usd',
31
-                      'css_class'           =>  '',
32
-                      'cat_sort'            =>  true,
33
-                      'cat_filter'	        =>  true,
34
-                      'extra'        =>  array(
35
-                          'is_price'                  =>  1,
36
-                          'thousand_separator'        =>  'comma',
37
-                          'decimal_separator'         =>  'period',
38
-                          'decimal_display'           =>  'if',
39
-                          'currency_symbol'           =>  '$',
40
-                          'currency_symbol_placement' =>  'left'
41
-                      )
42
-    );
43
-
44
-    // property status
45
-    $fields[] = array('listing_type' => $post_type,
46
-                      'data_type' => 'VARCHAR',
47
-                      'field_type' => 'select',
48
-                      'field_type_key' => 'property_status',
49
-                      'is_active' => 1,
50
-                      'for_admin_use' => 0,
51
-                      'is_default' => 0,
52
-                      'admin_title' => __('Property Status', 'geodirectory'),
53
-                      'admin_desc' => __('Enter the status of the property.', 'geodirectory'),
54
-                      'site_title' => __('Property Status', 'geodirectory'),
55
-                      'htmlvar_name' => 'property_status',
56
-                      'default_value' => '',
57
-                      'is_required' => '1',
58
-                      'required_msg' => '',
59
-                      'show_in'   =>  '[detail],[listing]',
60
-                      'show_on_pkg' => $package,
61
-                      'option_values' => 'Select Status/,For Rent,Let,Under Offer',
62
-                      'field_icon' => 'fa fa-home',
63
-                      'css_class' => '',
64
-                      'cat_sort' => 1,
65
-                      'cat_filter' => 1,
66
-    );
67
-
68
-    // property furnishing
69
-    $fields[] = array('listing_type' => $post_type,
70
-                      'field_type'          =>  'select',
71
-                      'data_type'           =>  'VARCHAR',
72
-                      'admin_title'         =>  __('Furnishing', 'geodirectory'),
73
-                      'site_title'          =>  __('Furnishing', 'geodirectory'),
74
-                      'admin_desc'          =>  __('Enter the furnishing status of the property.', 'geodirectory'),
75
-                      'htmlvar_name'        =>  'property_furnishing',
76
-                      'is_active'           =>  true,
77
-                      'for_admin_use'       =>  false,
78
-                      'default_value'       =>  '',
79
-                      'show_in' 	        =>  '[detail],[listing]',
80
-                      'is_required'         =>  true,
81
-                      'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
82
-                      'validation_pattern'  =>  '',
83
-                      'validation_msg'      =>  '',
84
-                      'required_msg'        =>  '',
85
-                      'field_icon'          =>  'fa fa-th-large',
86
-                      'css_class'           =>  '',
87
-                      'cat_sort'            =>  true,
88
-                      'cat_filter'	        =>  true
89
-    );
90
-
91
-    // property type
92
-    $fields[] = array('listing_type' => $post_type,
93
-                      'field_type'          =>  'select',
94
-                      'data_type'           =>  'VARCHAR',
95
-                      'admin_title'         =>  __('Property Type', 'geodirectory'),
96
-                      'site_title'          =>  __('Property Type', 'geodirectory'),
97
-                      'admin_desc'          =>  __('Select the property type.', 'geodirectory'),
98
-                      'htmlvar_name'        =>  'property_type',
99
-                      'is_active'           =>  true,
100
-                      'for_admin_use'       =>  false,
101
-                      'default_value'       =>  '',
102
-                      'show_in' 	        =>  '[detail],[listing]',
103
-                      'is_required'         =>  true,
104
-                      'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage,Hotel,Land','geodirectory'),
105
-                      'validation_pattern'  =>  '',
106
-                      'validation_msg'      =>  '',
107
-                      'required_msg'        =>  '',
108
-                      'field_icon'          =>  'fa fa-home',
109
-                      'css_class'           =>  '',
110
-                      'cat_sort'            =>  true,
111
-                      'cat_filter'	        =>  true
112
-    );
113
-
114
-    // property bedrooms
115
-    $fields[] = array('listing_type' => $post_type,
116
-                      'field_type'          =>  'select',
117
-                      'data_type'           =>  'VARCHAR',
118
-                      'admin_title'         =>  __('Property Bedrooms', 'geodirectory'),
119
-                      'site_title'          =>  __('Bedrooms', 'geodirectory'),
120
-                      'admin_desc'          =>  __('Select the number of bedrooms', 'geodirectory'),
121
-                      'htmlvar_name'        =>  'property_bedrooms',
122
-                      'is_active'           =>  true,
123
-                      'for_admin_use'       =>  false,
124
-                      'default_value'       =>  '',
125
-                      'show_in' 	        =>  '[detail],[listing]',
126
-                      'is_required'         =>  true,
127
-                      'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
128
-                      'validation_pattern'  =>  '',
129
-                      'validation_msg'      =>  '',
130
-                      'required_msg'        =>  '',
131
-                      'field_icon'          =>  'fa fa-bed',
132
-                      'css_class'           =>  '',
133
-                      'cat_sort'            =>  true,
134
-                      'cat_filter'	        =>  true
135
-    );
136
-
137
-    // property bathrooms
138
-    $fields[] = array('listing_type' => $post_type,
139
-                      'field_type'          =>  'select',
140
-                      'data_type'           =>  'VARCHAR',
141
-                      'admin_title'         =>  __('Property Bathrooms', 'geodirectory'),
142
-                      'site_title'          =>  __('Bathrooms', 'geodirectory'),
143
-                      'admin_desc'          =>  __('Select the number of bathrooms', 'geodirectory'),
144
-                      'htmlvar_name'        =>  'property_bathrooms',
145
-                      'is_active'           =>  true,
146
-                      'for_admin_use'       =>  false,
147
-                      'default_value'       =>  '',
148
-                      'show_in' 	        =>  '[detail],[listing]',
149
-                      'is_required'         =>  true,
150
-                      'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
151
-                      'validation_pattern'  =>  '',
152
-                      'validation_msg'      =>  '',
153
-                      'required_msg'        =>  '',
154
-                      'field_icon'          =>  'fa fa-bold',
155
-                      'css_class'           =>  '',
156
-                      'cat_sort'            =>  true,
157
-                      'cat_filter'	        =>  true
158
-    );
159
-
160
-    // property area
161
-    $fields[] = array('listing_type' => $post_type,
162
-                      'field_type'          =>  'text',
163
-                      'data_type'           =>  'INT',
164
-                      'admin_title'         =>  __('Property Area', 'geodirectory'),
165
-                      'site_title'          =>  __('Area (Sq Ft)', 'geodirectory'),
166
-                      'admin_desc'          =>  __('Enter the Sq Ft value for the property', 'geodirectory'),
167
-                      'htmlvar_name'        =>  'property_area',
168
-                      'is_active'           =>  true,
169
-                      'for_admin_use'       =>  false,
170
-                      'default_value'       =>  '',
171
-                      'show_in' 	        =>  '[detail],[listing]',
172
-                      'is_required'         =>  false,
173
-                      'validation_pattern'  =>  addslashes_gpc('\d+(\.\d{2})?'), // add slashes required
174
-                      'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
175
-                      'required_msg'        =>  '',
176
-                      'field_icon'          =>  'fa fa-area-chart',
177
-                      'css_class'           =>  '',
178
-                      'cat_sort'            =>  true,
179
-                      'cat_filter'	        =>  true
180
-    );
181
-
182
-    // property features
183
-    $fields[] = array('listing_type' => $post_type,
184
-                      'field_type'          =>  'multiselect',
185
-                      'data_type'           =>  'VARCHAR',
186
-                      'admin_title'         =>  __('Property Features', 'geodirectory'),
187
-                      'site_title'          =>  __('Features', 'geodirectory'),
188
-                      'admin_desc'          =>  __('Select the property features.', 'geodirectory'),
189
-                      'htmlvar_name'        =>  'property_features',
190
-                      'is_active'           =>  true,
191
-                      'for_admin_use'       =>  false,
192
-                      'default_value'       =>  '',
193
-                      'show_in' 	        =>  '[detail],[listing]',
194
-                      'is_required'         =>  false,
195
-                      'option_values'       =>  __('Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
196
-                      'validation_pattern'  =>  '',
197
-                      'validation_msg'      =>  '',
198
-                      'required_msg'        =>  '',
199
-                      'field_icon'          =>  'fa fa-plus-square',
200
-                      'css_class'           =>  'gd-comma-list',
201
-                      'cat_sort'            =>  true,
202
-                      'cat_filter'	        =>  true
203
-    );
204
-
205
-
206
-
207
-    /**
208
-     * Filter the array of default custom fields DB table data.
209
-     *
210
-     * @since 1.6.6
211
-     * @param string $fields The default custom fields as an array.
212
-     */
213
-    $fields = apply_filters('geodir_property_rent_custom_fields', $fields);
214
-
215
-    return  $fields;
10
+	$fields = array();
11
+	$package = ($package_id=='') ? '' : array($package_id);
12
+
13
+	// price
14
+	$fields[] = array('listing_type' => $post_type,
15
+					  'field_type'          =>  'text',
16
+					  'data_type'           =>  'FLOAT',
17
+					  'decimal_point'       =>  '2',
18
+					  'admin_title'         =>  __('Price', 'geodirectory'),
19
+					  'site_title'          =>  __('Price', 'geodirectory'),
20
+					  'admin_desc'          =>  __('Enter the price per calendar month (PCM)in $ (no currency symbol)', 'geodirectory'),
21
+					  'htmlvar_name'        =>  'price',
22
+					  'is_active'           =>  true,
23
+					  'for_admin_use'       =>  false,
24
+					  'default_value'       =>  '',
25
+					  'show_in' 	        =>  '[detail],[listing]',
26
+					  'is_required'         =>  false,
27
+					  'validation_pattern'  =>  addslashes_gpc('\d+(\.\d{2})?'), // add slashes required
28
+					  'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
29
+					  'required_msg'        =>  '',
30
+					  'field_icon'          =>  'fa fa-usd',
31
+					  'css_class'           =>  '',
32
+					  'cat_sort'            =>  true,
33
+					  'cat_filter'	        =>  true,
34
+					  'extra'        =>  array(
35
+						  'is_price'                  =>  1,
36
+						  'thousand_separator'        =>  'comma',
37
+						  'decimal_separator'         =>  'period',
38
+						  'decimal_display'           =>  'if',
39
+						  'currency_symbol'           =>  '$',
40
+						  'currency_symbol_placement' =>  'left'
41
+					  )
42
+	);
43
+
44
+	// property status
45
+	$fields[] = array('listing_type' => $post_type,
46
+					  'data_type' => 'VARCHAR',
47
+					  'field_type' => 'select',
48
+					  'field_type_key' => 'property_status',
49
+					  'is_active' => 1,
50
+					  'for_admin_use' => 0,
51
+					  'is_default' => 0,
52
+					  'admin_title' => __('Property Status', 'geodirectory'),
53
+					  'admin_desc' => __('Enter the status of the property.', 'geodirectory'),
54
+					  'site_title' => __('Property Status', 'geodirectory'),
55
+					  'htmlvar_name' => 'property_status',
56
+					  'default_value' => '',
57
+					  'is_required' => '1',
58
+					  'required_msg' => '',
59
+					  'show_in'   =>  '[detail],[listing]',
60
+					  'show_on_pkg' => $package,
61
+					  'option_values' => 'Select Status/,For Rent,Let,Under Offer',
62
+					  'field_icon' => 'fa fa-home',
63
+					  'css_class' => '',
64
+					  'cat_sort' => 1,
65
+					  'cat_filter' => 1,
66
+	);
67
+
68
+	// property furnishing
69
+	$fields[] = array('listing_type' => $post_type,
70
+					  'field_type'          =>  'select',
71
+					  'data_type'           =>  'VARCHAR',
72
+					  'admin_title'         =>  __('Furnishing', 'geodirectory'),
73
+					  'site_title'          =>  __('Furnishing', 'geodirectory'),
74
+					  'admin_desc'          =>  __('Enter the furnishing status of the property.', 'geodirectory'),
75
+					  'htmlvar_name'        =>  'property_furnishing',
76
+					  'is_active'           =>  true,
77
+					  'for_admin_use'       =>  false,
78
+					  'default_value'       =>  '',
79
+					  'show_in' 	        =>  '[detail],[listing]',
80
+					  'is_required'         =>  true,
81
+					  'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
82
+					  'validation_pattern'  =>  '',
83
+					  'validation_msg'      =>  '',
84
+					  'required_msg'        =>  '',
85
+					  'field_icon'          =>  'fa fa-th-large',
86
+					  'css_class'           =>  '',
87
+					  'cat_sort'            =>  true,
88
+					  'cat_filter'	        =>  true
89
+	);
90
+
91
+	// property type
92
+	$fields[] = array('listing_type' => $post_type,
93
+					  'field_type'          =>  'select',
94
+					  'data_type'           =>  'VARCHAR',
95
+					  'admin_title'         =>  __('Property Type', 'geodirectory'),
96
+					  'site_title'          =>  __('Property Type', 'geodirectory'),
97
+					  'admin_desc'          =>  __('Select the property type.', 'geodirectory'),
98
+					  'htmlvar_name'        =>  'property_type',
99
+					  'is_active'           =>  true,
100
+					  'for_admin_use'       =>  false,
101
+					  'default_value'       =>  '',
102
+					  'show_in' 	        =>  '[detail],[listing]',
103
+					  'is_required'         =>  true,
104
+					  'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage,Hotel,Land','geodirectory'),
105
+					  'validation_pattern'  =>  '',
106
+					  'validation_msg'      =>  '',
107
+					  'required_msg'        =>  '',
108
+					  'field_icon'          =>  'fa fa-home',
109
+					  'css_class'           =>  '',
110
+					  'cat_sort'            =>  true,
111
+					  'cat_filter'	        =>  true
112
+	);
113
+
114
+	// property bedrooms
115
+	$fields[] = array('listing_type' => $post_type,
116
+					  'field_type'          =>  'select',
117
+					  'data_type'           =>  'VARCHAR',
118
+					  'admin_title'         =>  __('Property Bedrooms', 'geodirectory'),
119
+					  'site_title'          =>  __('Bedrooms', 'geodirectory'),
120
+					  'admin_desc'          =>  __('Select the number of bedrooms', 'geodirectory'),
121
+					  'htmlvar_name'        =>  'property_bedrooms',
122
+					  'is_active'           =>  true,
123
+					  'for_admin_use'       =>  false,
124
+					  'default_value'       =>  '',
125
+					  'show_in' 	        =>  '[detail],[listing]',
126
+					  'is_required'         =>  true,
127
+					  'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
128
+					  'validation_pattern'  =>  '',
129
+					  'validation_msg'      =>  '',
130
+					  'required_msg'        =>  '',
131
+					  'field_icon'          =>  'fa fa-bed',
132
+					  'css_class'           =>  '',
133
+					  'cat_sort'            =>  true,
134
+					  'cat_filter'	        =>  true
135
+	);
136
+
137
+	// property bathrooms
138
+	$fields[] = array('listing_type' => $post_type,
139
+					  'field_type'          =>  'select',
140
+					  'data_type'           =>  'VARCHAR',
141
+					  'admin_title'         =>  __('Property Bathrooms', 'geodirectory'),
142
+					  'site_title'          =>  __('Bathrooms', 'geodirectory'),
143
+					  'admin_desc'          =>  __('Select the number of bathrooms', 'geodirectory'),
144
+					  'htmlvar_name'        =>  'property_bathrooms',
145
+					  'is_active'           =>  true,
146
+					  'for_admin_use'       =>  false,
147
+					  'default_value'       =>  '',
148
+					  'show_in' 	        =>  '[detail],[listing]',
149
+					  'is_required'         =>  true,
150
+					  'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
151
+					  'validation_pattern'  =>  '',
152
+					  'validation_msg'      =>  '',
153
+					  'required_msg'        =>  '',
154
+					  'field_icon'          =>  'fa fa-bold',
155
+					  'css_class'           =>  '',
156
+					  'cat_sort'            =>  true,
157
+					  'cat_filter'	        =>  true
158
+	);
159
+
160
+	// property area
161
+	$fields[] = array('listing_type' => $post_type,
162
+					  'field_type'          =>  'text',
163
+					  'data_type'           =>  'INT',
164
+					  'admin_title'         =>  __('Property Area', 'geodirectory'),
165
+					  'site_title'          =>  __('Area (Sq Ft)', 'geodirectory'),
166
+					  'admin_desc'          =>  __('Enter the Sq Ft value for the property', 'geodirectory'),
167
+					  'htmlvar_name'        =>  'property_area',
168
+					  'is_active'           =>  true,
169
+					  'for_admin_use'       =>  false,
170
+					  'default_value'       =>  '',
171
+					  'show_in' 	        =>  '[detail],[listing]',
172
+					  'is_required'         =>  false,
173
+					  'validation_pattern'  =>  addslashes_gpc('\d+(\.\d{2})?'), // add slashes required
174
+					  'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
175
+					  'required_msg'        =>  '',
176
+					  'field_icon'          =>  'fa fa-area-chart',
177
+					  'css_class'           =>  '',
178
+					  'cat_sort'            =>  true,
179
+					  'cat_filter'	        =>  true
180
+	);
181
+
182
+	// property features
183
+	$fields[] = array('listing_type' => $post_type,
184
+					  'field_type'          =>  'multiselect',
185
+					  'data_type'           =>  'VARCHAR',
186
+					  'admin_title'         =>  __('Property Features', 'geodirectory'),
187
+					  'site_title'          =>  __('Features', 'geodirectory'),
188
+					  'admin_desc'          =>  __('Select the property features.', 'geodirectory'),
189
+					  'htmlvar_name'        =>  'property_features',
190
+					  'is_active'           =>  true,
191
+					  'for_admin_use'       =>  false,
192
+					  'default_value'       =>  '',
193
+					  'show_in' 	        =>  '[detail],[listing]',
194
+					  'is_required'         =>  false,
195
+					  'option_values'       =>  __('Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
196
+					  'validation_pattern'  =>  '',
197
+					  'validation_msg'      =>  '',
198
+					  'required_msg'        =>  '',
199
+					  'field_icon'          =>  'fa fa-plus-square',
200
+					  'css_class'           =>  'gd-comma-list',
201
+					  'cat_sort'            =>  true,
202
+					  'cat_filter'	        =>  true
203
+	);
204
+
205
+
206
+
207
+	/**
208
+	 * Filter the array of default custom fields DB table data.
209
+	 *
210
+	 * @since 1.6.6
211
+	 * @param string $fields The default custom fields as an array.
212
+	 */
213
+	$fields = apply_filters('geodir_property_rent_custom_fields', $fields);
214
+
215
+	return  $fields;
216 216
 }
217 217
 
218 218
 function geodir_property_rent_custom_fields_sort($post_type='gd_place') {
219 219
 
220 220
 
221
-    $fields = array();
222
-
223
-    // price sort
224
-    $fields[] = array(
225
-        'create_field'            => true,
226
-        'listing_type'            => $post_type,
227
-        'field_type'              => 'text',
228
-        'data_type'               => '',
229
-        'htmlvar_name'            => 'geodir_price',
230
-        'site_title'              => __('Price','geodirectory'),
231
-        'asc'                     => 1,
232
-        'asc_title'               => __('Price (lowest first)','geodirectory'),
233
-        'desc'                    => 1,
234
-        'desc_title'              => __('Price (highest first)','geodirectory'),
235
-        'is_active'               => 1
236
-    );
237
-
238
-    // area sort
239
-    $fields[] = array(
240
-        'create_field'            => true,
241
-        'listing_type'            => $post_type,
242
-        'field_type'              => 'text',
243
-        'data_type'               => '',
244
-        'htmlvar_name'            => 'geodir_property_area',
245
-        'site_title'              => __('Area (Sq Ft)','geodirectory'),
246
-        'asc'                     => 1,
247
-        'asc_title'               => __('Area (smallest first)','geodirectory'),
248
-        'desc'                    => 1,
249
-        'desc_title'              => __('Area (largest first)','geodirectory'),
250
-        'is_active'               => 1
251
-    );
252
-
253
-    // bedrooms sort
254
-    $fields[] = array(
255
-        'create_field'            => true,
256
-        'listing_type'            => $post_type,
257
-        'field_type'              => 'select',
258
-        'data_type'               => '',
259
-        'htmlvar_name'            => 'geodir_property_bedrooms',
260
-        'site_title'              => __('Area (Sq Ft)','geodirectory'),
261
-        'asc'                     => 1,
262
-        'asc_title'               => __('Bedrooms (least)','geodirectory'),
263
-        'desc'                    => 1,
264
-        'desc_title'              => __('Bedrooms (most)','geodirectory'),
265
-        'is_active'               => 1
266
-    );
267
-
268
-    /**
269
-     * Filter the array of advanced search fields DB table data.
270
-     *
271
-     * @since 1.6.6
272
-     * @param string $fields The default custom fields as an array.
273
-     */
274
-    $fields = apply_filters('geodir_property_sale_custom_fields_sort', $fields);
275
-
276
-    return $fields;
221
+	$fields = array();
222
+
223
+	// price sort
224
+	$fields[] = array(
225
+		'create_field'            => true,
226
+		'listing_type'            => $post_type,
227
+		'field_type'              => 'text',
228
+		'data_type'               => '',
229
+		'htmlvar_name'            => 'geodir_price',
230
+		'site_title'              => __('Price','geodirectory'),
231
+		'asc'                     => 1,
232
+		'asc_title'               => __('Price (lowest first)','geodirectory'),
233
+		'desc'                    => 1,
234
+		'desc_title'              => __('Price (highest first)','geodirectory'),
235
+		'is_active'               => 1
236
+	);
237
+
238
+	// area sort
239
+	$fields[] = array(
240
+		'create_field'            => true,
241
+		'listing_type'            => $post_type,
242
+		'field_type'              => 'text',
243
+		'data_type'               => '',
244
+		'htmlvar_name'            => 'geodir_property_area',
245
+		'site_title'              => __('Area (Sq Ft)','geodirectory'),
246
+		'asc'                     => 1,
247
+		'asc_title'               => __('Area (smallest first)','geodirectory'),
248
+		'desc'                    => 1,
249
+		'desc_title'              => __('Area (largest first)','geodirectory'),
250
+		'is_active'               => 1
251
+	);
252
+
253
+	// bedrooms sort
254
+	$fields[] = array(
255
+		'create_field'            => true,
256
+		'listing_type'            => $post_type,
257
+		'field_type'              => 'select',
258
+		'data_type'               => '',
259
+		'htmlvar_name'            => 'geodir_property_bedrooms',
260
+		'site_title'              => __('Area (Sq Ft)','geodirectory'),
261
+		'asc'                     => 1,
262
+		'asc_title'               => __('Bedrooms (least)','geodirectory'),
263
+		'desc'                    => 1,
264
+		'desc_title'              => __('Bedrooms (most)','geodirectory'),
265
+		'is_active'               => 1
266
+	);
267
+
268
+	/**
269
+	 * Filter the array of advanced search fields DB table data.
270
+	 *
271
+	 * @since 1.6.6
272
+	 * @param string $fields The default custom fields as an array.
273
+	 */
274
+	$fields = apply_filters('geodir_property_sale_custom_fields_sort', $fields);
275
+
276
+	return $fields;
277 277
 
278 278
 }
279 279
 
280 280
 function geodir_property_rent_custom_fields_advanced_search($post_type='gd_place') {
281 281
 
282 282
 
283
-    $fields = array();
284
-
285
-    // Price range
286
-    $fields[] = array(
287
-        'create_field'            => true,
288
-        'listing_type'            => $post_type,
289
-        'field_type'              => 'text',
290
-        'data_type'               => 'RANGE',
291
-        'is_active'               => 1,
292
-        'site_field_title'        => 'Price',
293
-        'field_data_type'         => 'FLOAT',
294
-        'main_search'             => 1,
295
-        'main_search_priority'    => 15,
296
-        'data_type_change'        => 'SELECT',
297
-        'search_condition_select' => 'SINGLE',
298
-        'search_min_value'        => '1000',
299
-        'search_max_value'        => '10000',
300
-        'search_diff_value'       => '1000',
301
-        'first_search_value'      => '0',
302
-        'first_search_text'       => '',
303
-        'last_search_text'        => '',
304
-        'search_condition'        => 'SELECT',
305
-        'site_htmlvar_name'       => 'geodir_price',
306
-        'htmlvar_name'            => 'geodir_price',
307
-        'field_title'             => 'geodir_price',
308
-        'expand_custom_value'     => '',
309
-        'front_search_title'      => 'Price Range pm',
310
-        'field_desc'              => ''
311
-    );
312
-
313
-    // bedrooms
314
-    $fields[] = array(
315
-        'create_field'            => true,
316
-        'listing_type'            => $post_type,
317
-        'field_type'              => 'select',
318
-        'data_type'               => 'CHECK',
319
-        'is_active'               => 1,
320
-        'site_field_title'        => 'Bedrooms',
321
-        'field_data_type'         => 'VARCHAR',
322
-        'main_search'             => 1,
323
-        'main_search_priority'    => 16,
324
-        'search_condition'        => 'SINGLE',
325
-        'site_htmlvar_name'       => 'geodir_property_bedrooms',
326
-        'htmlvar_name'            => 'geodir_property_bedrooms',
327
-        'field_title'             => 'geodir_property_bedrooms',
328
-        'front_search_title'      => 'Bedrooms',
329
-        'field_desc'              => '',
330
-        'expand_custom_value'     => 5,
331
-        'expand_search'           => 1,
332
-        'search_operator'         => 'OR'
333
-    );
334
-
335
-    // Property type
336
-    $fields[] = array(
337
-        'create_field'            => true,
338
-        'listing_type'            => $post_type,
339
-        'field_type'              => 'select',
340
-        'data_type'               => 'CHECK',
341
-        'is_active'               => 1,
342
-        'site_field_title'        => 'Property Type',
343
-        'field_data_type'         => 'VARCHAR',
344
-        'main_search'             => 0,
345
-        //'main_search_priority'    => 16,
346
-        'search_condition'        => 'SINGLE',
347
-        'site_htmlvar_name'       => 'geodir_property_type',
348
-        'htmlvar_name'            => 'geodir_property_type',
349
-        'field_title'             => 'geodir_property_type',
350
-        'front_search_title'      => 'Property Type',
351
-        'field_desc'              => '',
352
-        'expand_custom_value'     => 5,
353
-        'expand_search'           => 1,
354
-        'search_operator'         => 'OR'
355
-    );
356
-
357
-    // Property Features
358
-    $fields[] = array(
359
-        'create_field'            => true,
360
-        'listing_type'            => $post_type,
361
-        'field_type'              => 'multiselect',
362
-        'data_type'               => 'CHECK',
363
-        'is_active'               => 1,
364
-        'site_field_title'        => 'Features',
365
-        'field_data_type'         => 'VARCHAR',
366
-        'main_search'             => 0,
367
-        //'main_search_priority'    => 16,
368
-        'search_condition'        => 'SINGLE',
369
-        'site_htmlvar_name'       => 'geodir_property_features',
370
-        'htmlvar_name'            => 'geodir_property_features',
371
-        'field_title'             => 'geodir_property_features',
372
-        'front_search_title'      => 'Property Features',
373
-        'field_desc'              => '',
374
-        'expand_custom_value'     => 5,
375
-        'expand_search'           => 1,
376
-        'search_operator'         => 'AND'
377
-    );
378
-
379
-    // Property Bathrooms
380
-    $fields[] = array(
381
-        'create_field'            => true,
382
-        'listing_type'            => $post_type,
383
-        'field_type'              => 'select',
384
-        'data_type'               => 'CHECK',
385
-        'is_active'               => 1,
386
-        'site_field_title'        => 'Bathrooms',
387
-        'field_data_type'         => 'VARCHAR',
388
-        'main_search'             => 0,
389
-        //'main_search_priority'    => 16,
390
-        'search_condition'        => 'SINGLE',
391
-        'site_htmlvar_name'       => 'geodir_property_bathrooms',
392
-        'htmlvar_name'            => 'geodir_property_bathrooms',
393
-        'field_title'             => 'geodir_property_bathrooms',
394
-        'front_search_title'      => 'Bathrooms',
395
-        'field_desc'              => '',
396
-        'expand_custom_value'     => 5,
397
-        'expand_search'           => 1,
398
-        'search_operator'         => 'OR'
399
-    );
400
-
401
-    // Property Furnishing
402
-    $fields[] = array(
403
-        'create_field'            => true,
404
-        'listing_type'            => $post_type,
405
-        'field_type'              => 'select',
406
-        'data_type'               => 'CHECK',
407
-        'is_active'               => 1,
408
-        'site_field_title'        => 'Furnishing',
409
-        'field_data_type'         => 'VARCHAR',
410
-        'main_search'             => 0,
411
-        //'main_search_priority'    => 16,
412
-        'search_condition'        => 'SINGLE',
413
-        'site_htmlvar_name'       => 'geodir_property_furnishing',
414
-        'htmlvar_name'            => 'geodir_property_furnishing',
415
-        'field_title'             => 'geodir_property_furnishing',
416
-        'front_search_title'      => 'Furnishing',
417
-        'field_desc'              => '',
418
-        'expand_custom_value'     => 5,
419
-        'expand_search'           => 1,
420
-        'search_operator'         => 'OR'
421
-    );
422
-
423
-    // Property Status
424
-    $fields[] = array(
425
-        'create_field'            => true,
426
-        'listing_type'            => $post_type,
427
-        'field_type'              => 'select',
428
-        'data_type'               => 'CHECK',
429
-        'is_active'               => 1,
430
-        'site_field_title'        => 'Property Status',
431
-        'field_data_type'         => 'VARCHAR',
432
-        'main_search'             => 0,
433
-        //'main_search_priority'    => 16,
434
-        'search_condition'        => 'SINGLE',
435
-        'site_htmlvar_name'       => 'geodir_property_status',
436
-        'htmlvar_name'            => 'geodir_property_status',
437
-        'field_title'             => 'geodir_property_status',
438
-        'front_search_title'      => 'Property Status',
439
-        'field_desc'              => '',
440
-        'expand_custom_value'     => 5,
441
-        'expand_search'           => 1,
442
-        'search_operator'         => 'OR'
443
-    );
444
-
445
-
446
-
447
-    /**
448
-     * Filter the array of advanced search fields DB table data.
449
-     *
450
-     * @since 1.6.6
451
-     * @param string $fields The default custom fields as an array.
452
-     */
453
-    $fields = apply_filters('geodir_property_rent_custom_fields_advanced_search', $fields);
454
-
455
-    return $fields;
283
+	$fields = array();
284
+
285
+	// Price range
286
+	$fields[] = array(
287
+		'create_field'            => true,
288
+		'listing_type'            => $post_type,
289
+		'field_type'              => 'text',
290
+		'data_type'               => 'RANGE',
291
+		'is_active'               => 1,
292
+		'site_field_title'        => 'Price',
293
+		'field_data_type'         => 'FLOAT',
294
+		'main_search'             => 1,
295
+		'main_search_priority'    => 15,
296
+		'data_type_change'        => 'SELECT',
297
+		'search_condition_select' => 'SINGLE',
298
+		'search_min_value'        => '1000',
299
+		'search_max_value'        => '10000',
300
+		'search_diff_value'       => '1000',
301
+		'first_search_value'      => '0',
302
+		'first_search_text'       => '',
303
+		'last_search_text'        => '',
304
+		'search_condition'        => 'SELECT',
305
+		'site_htmlvar_name'       => 'geodir_price',
306
+		'htmlvar_name'            => 'geodir_price',
307
+		'field_title'             => 'geodir_price',
308
+		'expand_custom_value'     => '',
309
+		'front_search_title'      => 'Price Range pm',
310
+		'field_desc'              => ''
311
+	);
312
+
313
+	// bedrooms
314
+	$fields[] = array(
315
+		'create_field'            => true,
316
+		'listing_type'            => $post_type,
317
+		'field_type'              => 'select',
318
+		'data_type'               => 'CHECK',
319
+		'is_active'               => 1,
320
+		'site_field_title'        => 'Bedrooms',
321
+		'field_data_type'         => 'VARCHAR',
322
+		'main_search'             => 1,
323
+		'main_search_priority'    => 16,
324
+		'search_condition'        => 'SINGLE',
325
+		'site_htmlvar_name'       => 'geodir_property_bedrooms',
326
+		'htmlvar_name'            => 'geodir_property_bedrooms',
327
+		'field_title'             => 'geodir_property_bedrooms',
328
+		'front_search_title'      => 'Bedrooms',
329
+		'field_desc'              => '',
330
+		'expand_custom_value'     => 5,
331
+		'expand_search'           => 1,
332
+		'search_operator'         => 'OR'
333
+	);
334
+
335
+	// Property type
336
+	$fields[] = array(
337
+		'create_field'            => true,
338
+		'listing_type'            => $post_type,
339
+		'field_type'              => 'select',
340
+		'data_type'               => 'CHECK',
341
+		'is_active'               => 1,
342
+		'site_field_title'        => 'Property Type',
343
+		'field_data_type'         => 'VARCHAR',
344
+		'main_search'             => 0,
345
+		//'main_search_priority'    => 16,
346
+		'search_condition'        => 'SINGLE',
347
+		'site_htmlvar_name'       => 'geodir_property_type',
348
+		'htmlvar_name'            => 'geodir_property_type',
349
+		'field_title'             => 'geodir_property_type',
350
+		'front_search_title'      => 'Property Type',
351
+		'field_desc'              => '',
352
+		'expand_custom_value'     => 5,
353
+		'expand_search'           => 1,
354
+		'search_operator'         => 'OR'
355
+	);
356
+
357
+	// Property Features
358
+	$fields[] = array(
359
+		'create_field'            => true,
360
+		'listing_type'            => $post_type,
361
+		'field_type'              => 'multiselect',
362
+		'data_type'               => 'CHECK',
363
+		'is_active'               => 1,
364
+		'site_field_title'        => 'Features',
365
+		'field_data_type'         => 'VARCHAR',
366
+		'main_search'             => 0,
367
+		//'main_search_priority'    => 16,
368
+		'search_condition'        => 'SINGLE',
369
+		'site_htmlvar_name'       => 'geodir_property_features',
370
+		'htmlvar_name'            => 'geodir_property_features',
371
+		'field_title'             => 'geodir_property_features',
372
+		'front_search_title'      => 'Property Features',
373
+		'field_desc'              => '',
374
+		'expand_custom_value'     => 5,
375
+		'expand_search'           => 1,
376
+		'search_operator'         => 'AND'
377
+	);
378
+
379
+	// Property Bathrooms
380
+	$fields[] = array(
381
+		'create_field'            => true,
382
+		'listing_type'            => $post_type,
383
+		'field_type'              => 'select',
384
+		'data_type'               => 'CHECK',
385
+		'is_active'               => 1,
386
+		'site_field_title'        => 'Bathrooms',
387
+		'field_data_type'         => 'VARCHAR',
388
+		'main_search'             => 0,
389
+		//'main_search_priority'    => 16,
390
+		'search_condition'        => 'SINGLE',
391
+		'site_htmlvar_name'       => 'geodir_property_bathrooms',
392
+		'htmlvar_name'            => 'geodir_property_bathrooms',
393
+		'field_title'             => 'geodir_property_bathrooms',
394
+		'front_search_title'      => 'Bathrooms',
395
+		'field_desc'              => '',
396
+		'expand_custom_value'     => 5,
397
+		'expand_search'           => 1,
398
+		'search_operator'         => 'OR'
399
+	);
400
+
401
+	// Property Furnishing
402
+	$fields[] = array(
403
+		'create_field'            => true,
404
+		'listing_type'            => $post_type,
405
+		'field_type'              => 'select',
406
+		'data_type'               => 'CHECK',
407
+		'is_active'               => 1,
408
+		'site_field_title'        => 'Furnishing',
409
+		'field_data_type'         => 'VARCHAR',
410
+		'main_search'             => 0,
411
+		//'main_search_priority'    => 16,
412
+		'search_condition'        => 'SINGLE',
413
+		'site_htmlvar_name'       => 'geodir_property_furnishing',
414
+		'htmlvar_name'            => 'geodir_property_furnishing',
415
+		'field_title'             => 'geodir_property_furnishing',
416
+		'front_search_title'      => 'Furnishing',
417
+		'field_desc'              => '',
418
+		'expand_custom_value'     => 5,
419
+		'expand_search'           => 1,
420
+		'search_operator'         => 'OR'
421
+	);
422
+
423
+	// Property Status
424
+	$fields[] = array(
425
+		'create_field'            => true,
426
+		'listing_type'            => $post_type,
427
+		'field_type'              => 'select',
428
+		'data_type'               => 'CHECK',
429
+		'is_active'               => 1,
430
+		'site_field_title'        => 'Property Status',
431
+		'field_data_type'         => 'VARCHAR',
432
+		'main_search'             => 0,
433
+		//'main_search_priority'    => 16,
434
+		'search_condition'        => 'SINGLE',
435
+		'site_htmlvar_name'       => 'geodir_property_status',
436
+		'htmlvar_name'            => 'geodir_property_status',
437
+		'field_title'             => 'geodir_property_status',
438
+		'front_search_title'      => 'Property Status',
439
+		'field_desc'              => '',
440
+		'expand_custom_value'     => 5,
441
+		'expand_search'           => 1,
442
+		'search_operator'         => 'OR'
443
+	);
444
+
445
+
446
+
447
+	/**
448
+	 * Filter the array of advanced search fields DB table data.
449
+	 *
450
+	 * @since 1.6.6
451
+	 * @param string $fields The default custom fields as an array.
452
+	 */
453
+	$fields = apply_filters('geodir_property_rent_custom_fields_advanced_search', $fields);
454
+
455
+	return $fields;
456 456
 }
457 457
 
458 458
 global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2,$wpdb, $current_user,$dummy_post_index;
@@ -462,52 +462,52 @@  discard block
 block discarded – undo
462 462
 $category_array = array('Apartments', 'Houses', 'Commercial', 'Land');
463 463
 
464 464
 if($dummy_post_index==1){
465
-    // add the dummy categories
466
-    geodir_dummy_data_taxonomies($post_type,$category_array );
467
-
468
-    // add the dummy custom fields
469
-    $fields = geodir_property_rent_custom_fields($post_type);
470
-    geodir_create_dummy_fields($fields);
471
-
472
-    // add sort order items
473
-    $sort_fields = geodir_property_rent_custom_fields_sort($post_type);
474
-    foreach($sort_fields as $sort){
475
-        geodir_custom_sort_field_save($sort);
476
-    }
477
-
478
-    // update the type currently installed
479
-    update_option($post_type.'_dummy_data_type','property_rent');
480
-
481
-    // add the advanced search fields
482
-    if (defined('GEODIRADVANCESEARCH_VERSION')){
483
-        $search_fields = geodir_property_rent_custom_fields_advanced_search($post_type);
484
-        foreach($search_fields as $sfield){
485
-            geodir_custom_advance_search_field_save( $sfield );
486
-        }
487
-    }
465
+	// add the dummy categories
466
+	geodir_dummy_data_taxonomies($post_type,$category_array );
467
+
468
+	// add the dummy custom fields
469
+	$fields = geodir_property_rent_custom_fields($post_type);
470
+	geodir_create_dummy_fields($fields);
471
+
472
+	// add sort order items
473
+	$sort_fields = geodir_property_rent_custom_fields_sort($post_type);
474
+	foreach($sort_fields as $sort){
475
+		geodir_custom_sort_field_save($sort);
476
+	}
477
+
478
+	// update the type currently installed
479
+	update_option($post_type.'_dummy_data_type','property_rent');
480
+
481
+	// add the advanced search fields
482
+	if (defined('GEODIRADVANCESEARCH_VERSION')){
483
+		$search_fields = geodir_property_rent_custom_fields_advanced_search($post_type);
484
+		foreach($search_fields as $sfield){
485
+			geodir_custom_advance_search_field_save( $sfield );
486
+		}
487
+	}
488 488
 }
489 489
 
490 490
 if (geodir_dummy_folder_exists())
491
-    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
491
+	$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
492 492
 else
493
-    $dummy_image_url = 'https://www.wpgeodirectory.com/dummy';
493
+	$dummy_image_url = 'https://www.wpgeodirectory.com/dummy';
494 494
 
495 495
 $dummy_image_url = apply_filters('place_dummy_image_url', $dummy_image_url);
496 496
 
497 497
 switch ($dummy_post_index) {
498 498
 
499
-    case(1):
500
-        $image_array[] = "$dummy_image_url/ps/psf1.jpg";
501
-        $image_array[] = "$dummy_image_url/ps/psl1.jpg";
502
-        $image_array[] = "$dummy_image_url/ps/psb1.jpg";
503
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
504
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
499
+	case(1):
500
+		$image_array[] = "$dummy_image_url/ps/psf1.jpg";
501
+		$image_array[] = "$dummy_image_url/ps/psl1.jpg";
502
+		$image_array[] = "$dummy_image_url/ps/psb1.jpg";
503
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
504
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
505 505
 
506 506
 
507
-        $post_info[] = array(
508
-            "listing_type" => $post_type,
509
-            "post_title" => 'Eastern Lodge',
510
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec non augue ultrices, vulputate nulla at, consectetur ante. Quisque neque mi, vulputate quis nulla a, sollicitudin fringilla leo. Nam dictum id neque eu imperdiet. Curabitur ligula turpis, malesuada at lobortis commodo, vulputate volutpat arcu. Duis bibendum blandit aliquam. In ipsum diam, tristique ut bibendum vel, lobortis non tellus. Nulla ultricies, ante vitae placerat auctor, nisi quam blandit enim, sit amet aliquam est diam id urna. Suspendisse eget nibh volutpat, malesuada enim sed, egestas massa.
507
+		$post_info[] = array(
508
+			"listing_type" => $post_type,
509
+			"post_title" => 'Eastern Lodge',
510
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec non augue ultrices, vulputate nulla at, consectetur ante. Quisque neque mi, vulputate quis nulla a, sollicitudin fringilla leo. Nam dictum id neque eu imperdiet. Curabitur ligula turpis, malesuada at lobortis commodo, vulputate volutpat arcu. Duis bibendum blandit aliquam. In ipsum diam, tristique ut bibendum vel, lobortis non tellus. Nulla ultricies, ante vitae placerat auctor, nisi quam blandit enim, sit amet aliquam est diam id urna. Suspendisse eget nibh volutpat, malesuada enim sed, egestas massa.
511 511
 
512 512
 Aliquam ut odio ullamcorper, posuere enim sed, venenatis tortor. Donec justo elit, aliquam sed cursus sed, semper eget libero. Mauris consequat lorem sed fringilla tincidunt. Phasellus suscipit velit et elit tristique, ac commodo metus scelerisque. Vivamus finibus ipsum placerat pulvinar aliquet. Maecenas augue orci, blandit at nibh pharetra, condimentum congue ligula. Duis non ante sagittis odio convallis lacinia in quis sapien.
513 513
 
@@ -516,42 +516,42 @@  discard block
 block discarded – undo
516 516
 Vestibulum tristique quam eget bibendum pulvinar. Mauris sit amet magna ut arcu rutrum pellentesque feugiat et ipsum. Proin porta quam sed risus accumsan pharetra. Nulla quis semper nisl. Nulla facilisi. Nulla facilisi. Pellentesque euismod sollicitudin lacus vel ultricies. Vestibulum ut sem ut nulla ultricies convallis in at mi. Nunc vitae nibh arcu. Maecenas nunc enim, tempus a rhoncus eget, pellentesque ut erat.
517 517
 
518 518
 Suspendisse interdum accumsan magna et tempor. Suspendisse scelerisque at lorem sit amet faucibus. Aenean quis consectetur enim. Duis aliquet tristique tempus. Suspendisse id ullamcorper mauris. Aliquam in libero eu justo porttitor pulvinar. Nulla semper placerat lectus. Nulla mollis suscipit lacus, a blandit purus cursus non. Maecenas id tellus mi. Pellentesque sollicitudin nibh eget magna scelerisque consequat. Aliquam convallis orci arcu, et euismod dui cursus et. Donec nec pellentesque nulla, ac pretium massa. In gravida bibendum ornare.',
519
-            "post_images" => $image_array,
520
-            "post_category" => array($post_type.'category' => array($category_array[1])),
521
-            "post_tags" => array('Tags', 'Sample Tags'),
522
-            "geodir_video" => '',
523
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
524
-            "geodir_contact" => '(111) 677-4444',
525
-            "geodir_email" => '[email protected]',
526
-            "geodir_website" => 'http://example.com/',
527
-            "geodir_twitter" => 'http://example.com/',
528
-            "geodir_facebook" => 'http://example.com/',
529
-            "geodir_price" => '1750',
530
-            "geodir_property_status" => 'For Rent',
531
-            'geodir_property_furnishing' => 'Furnished',
532
-            'geodir_property_type' => 'Detached house',
533
-            'geodir_property_bedrooms' => '3',
534
-            'geodir_property_bathrooms' => '2',
535
-            'geodir_property_area' => '1850',
536
-            'geodir_property_features' => 'Gas Central Heating,Triple Glazing,Front Garden,Private driveway,Fireplace',
537
-            "post_dummy" => '1'
538
-        );
539
-
540
-
541
-        break;
542
-    case 2:
543
-        $image_array = array();
544
-        $post_meta = array();
545
-        $image_array[] = "$dummy_image_url/ps/psf2.jpg";
546
-        $image_array[] = "$dummy_image_url/ps/psl2.jpg";
547
-        $image_array[] = "$dummy_image_url/ps/psb2.jpg";
548
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
549
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
550
-
551
-        $post_info[] = array(
552
-            "listing_type" => $post_type,
553
-            "post_title" => 'Daisy Street',
554
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
519
+			"post_images" => $image_array,
520
+			"post_category" => array($post_type.'category' => array($category_array[1])),
521
+			"post_tags" => array('Tags', 'Sample Tags'),
522
+			"geodir_video" => '',
523
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
524
+			"geodir_contact" => '(111) 677-4444',
525
+			"geodir_email" => '[email protected]',
526
+			"geodir_website" => 'http://example.com/',
527
+			"geodir_twitter" => 'http://example.com/',
528
+			"geodir_facebook" => 'http://example.com/',
529
+			"geodir_price" => '1750',
530
+			"geodir_property_status" => 'For Rent',
531
+			'geodir_property_furnishing' => 'Furnished',
532
+			'geodir_property_type' => 'Detached house',
533
+			'geodir_property_bedrooms' => '3',
534
+			'geodir_property_bathrooms' => '2',
535
+			'geodir_property_area' => '1850',
536
+			'geodir_property_features' => 'Gas Central Heating,Triple Glazing,Front Garden,Private driveway,Fireplace',
537
+			"post_dummy" => '1'
538
+		);
539
+
540
+
541
+		break;
542
+	case 2:
543
+		$image_array = array();
544
+		$post_meta = array();
545
+		$image_array[] = "$dummy_image_url/ps/psf2.jpg";
546
+		$image_array[] = "$dummy_image_url/ps/psl2.jpg";
547
+		$image_array[] = "$dummy_image_url/ps/psb2.jpg";
548
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
549
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
550
+
551
+		$post_info[] = array(
552
+			"listing_type" => $post_type,
553
+			"post_title" => 'Daisy Street',
554
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
555 555
 
556 556
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
557 557
 
@@ -561,42 +561,42 @@  discard block
 block discarded – undo
561 561
 
562 562
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
563 563
 
564
-            "post_images" => $image_array,
565
-            "post_category" => array($post_type.'category' => array($category_array[1])),
566
-            "post_tags" => array('Garage'),
567
-            "geodir_video" => '',
568
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
569
-            "geodir_contact" => '(222) 777-1111',
570
-            "geodir_email" => '[email protected]',
571
-            "geodir_website" => 'http://example.com/',
572
-            "geodir_twitter" => 'http://example.com/',
573
-            "geodir_facebook" => 'http://example.com/',
574
-            "geodir_price" => '1150',
575
-            "geodir_property_status" => 'Let',
576
-            'geodir_property_furnishing' => 'Unfurnished',
577
-            'geodir_property_type' => 'Detached house',
578
-            'geodir_property_bedrooms' => '5',
579
-            'geodir_property_bathrooms' => '3',
580
-            'geodir_property_area' => '2650',
581
-            'geodir_property_features' => 'Select Features/,Oil Central Heating,Front Garden,Garage,Private driveway,Fireplace',
582
-            "post_dummy" => '1'
583
-        );
584
-
585
-        break;
586
-
587
-    case 3:
588
-        $image_array = array();
589
-        $post_meta = array();
590
-        $image_array[] = "$dummy_image_url/ps/psf3.jpg";
591
-        $image_array[] = "$dummy_image_url/ps/psl3.jpg";
592
-        $image_array[] = "$dummy_image_url/ps/psb3.jpg";
593
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
594
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
595
-
596
-        $post_info[] = array(
597
-            "listing_type" => $post_type,
598
-            "post_title" => 'Northbay House',
599
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
564
+			"post_images" => $image_array,
565
+			"post_category" => array($post_type.'category' => array($category_array[1])),
566
+			"post_tags" => array('Garage'),
567
+			"geodir_video" => '',
568
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
569
+			"geodir_contact" => '(222) 777-1111',
570
+			"geodir_email" => '[email protected]',
571
+			"geodir_website" => 'http://example.com/',
572
+			"geodir_twitter" => 'http://example.com/',
573
+			"geodir_facebook" => 'http://example.com/',
574
+			"geodir_price" => '1150',
575
+			"geodir_property_status" => 'Let',
576
+			'geodir_property_furnishing' => 'Unfurnished',
577
+			'geodir_property_type' => 'Detached house',
578
+			'geodir_property_bedrooms' => '5',
579
+			'geodir_property_bathrooms' => '3',
580
+			'geodir_property_area' => '2650',
581
+			'geodir_property_features' => 'Select Features/,Oil Central Heating,Front Garden,Garage,Private driveway,Fireplace',
582
+			"post_dummy" => '1'
583
+		);
584
+
585
+		break;
586
+
587
+	case 3:
588
+		$image_array = array();
589
+		$post_meta = array();
590
+		$image_array[] = "$dummy_image_url/ps/psf3.jpg";
591
+		$image_array[] = "$dummy_image_url/ps/psl3.jpg";
592
+		$image_array[] = "$dummy_image_url/ps/psb3.jpg";
593
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
594
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
595
+
596
+		$post_info[] = array(
597
+			"listing_type" => $post_type,
598
+			"post_title" => 'Northbay House',
599
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
600 600
 
601 601
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
602 602
 
@@ -606,43 +606,43 @@  discard block
 block discarded – undo
606 606
 
607 607
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
608 608
 
609
-            "post_images" => $image_array,
610
-            "post_category" => array($post_type.'category' => array($category_array[1])),
611
-            "post_tags" => array('Tags', 'Sample Tags'),
612
-            "geodir_video" => '',
613
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
614
-            "geodir_contact" => '(222) 777-1111',
615
-            "geodir_email" => '[email protected]',
616
-            "geodir_website" => 'http://example.com/',
617
-            "geodir_twitter" => 'http://example.com/',
618
-            "geodir_facebook" => 'http://example.com/',
619
-            "geodir_price" => '1300',
620
-            "geodir_property_status" => 'Under Offer',
621
-            'geodir_property_furnishing' => 'Unfurnished',
622
-            'geodir_property_type' => 'Detached house',
623
-            'geodir_property_bedrooms' => '6',
624
-            'geodir_property_bathrooms' => '6',
625
-            'geodir_property_area' => '1650',
626
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Triple Glazing,Off Road Parking,Fireplace',
627
-            "post_dummy" => '1'
628
-        );
629
-
630
-        break;
631
-
632
-
633
-    case 4:
634
-        $image_array = array();
635
-        $post_meta = array();
636
-        $image_array[] = "$dummy_image_url/ps/psf4.jpg";
637
-        $image_array[] = "$dummy_image_url/ps/psl4.jpg";
638
-        $image_array[] = "$dummy_image_url/ps/psb4.jpg";
639
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
640
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
641
-
642
-        $post_info[] = array(
643
-            "listing_type" => $post_type,
644
-            "post_title" => 'Jesmond Mansion',
645
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
609
+			"post_images" => $image_array,
610
+			"post_category" => array($post_type.'category' => array($category_array[1])),
611
+			"post_tags" => array('Tags', 'Sample Tags'),
612
+			"geodir_video" => '',
613
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
614
+			"geodir_contact" => '(222) 777-1111',
615
+			"geodir_email" => '[email protected]',
616
+			"geodir_website" => 'http://example.com/',
617
+			"geodir_twitter" => 'http://example.com/',
618
+			"geodir_facebook" => 'http://example.com/',
619
+			"geodir_price" => '1300',
620
+			"geodir_property_status" => 'Under Offer',
621
+			'geodir_property_furnishing' => 'Unfurnished',
622
+			'geodir_property_type' => 'Detached house',
623
+			'geodir_property_bedrooms' => '6',
624
+			'geodir_property_bathrooms' => '6',
625
+			'geodir_property_area' => '1650',
626
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Triple Glazing,Off Road Parking,Fireplace',
627
+			"post_dummy" => '1'
628
+		);
629
+
630
+		break;
631
+
632
+
633
+	case 4:
634
+		$image_array = array();
635
+		$post_meta = array();
636
+		$image_array[] = "$dummy_image_url/ps/psf4.jpg";
637
+		$image_array[] = "$dummy_image_url/ps/psl4.jpg";
638
+		$image_array[] = "$dummy_image_url/ps/psb4.jpg";
639
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
640
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
641
+
642
+		$post_info[] = array(
643
+			"listing_type" => $post_type,
644
+			"post_title" => 'Jesmond Mansion',
645
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
646 646
 
647 647
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
648 648
 
@@ -652,42 +652,42 @@  discard block
 block discarded – undo
652 652
 
653 653
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
654 654
 
655
-            "post_images" => $image_array,
656
-            "post_category" => array($post_type.'category' => array($category_array[1])),
657
-            "post_tags" => array('Tags', 'Sample Tags'),
658
-            "geodir_video" => '',
659
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
660
-            "geodir_contact" => '(222) 777-1111',
661
-            "geodir_email" => '[email protected]',
662
-            "geodir_website" => 'http://example.com/',
663
-            "geodir_twitter" => 'http://example.com/',
664
-            "geodir_facebook" => 'http://example.com/',
665
-            "geodir_price" => '13000',
666
-            "geodir_property_status" => 'Under Offer',
667
-            'geodir_property_furnishing' => 'Partially furnished',
668
-            'geodir_property_type' => 'Detached house',
669
-            'geodir_property_bedrooms' => '10',
670
-            'geodir_property_bathrooms' => '7',
671
-            'geodir_property_area' => '6600',
672
-            'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden,Garage,Private driveway,Fireplace',
673
-            "post_dummy" => '1'
674
-        );
675
-
676
-        break;
677
-
678
-    case 5:
679
-        $image_array = array();
680
-        $post_meta = array();
681
-        $image_array[] = "$dummy_image_url/ps/psf5.jpg";
682
-        $image_array[] = "$dummy_image_url/ps/psl5.jpg";
683
-        $image_array[] = "$dummy_image_url/ps/psb5.jpg";
684
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
685
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
686
-
687
-        $post_info[] = array(
688
-            "listing_type" => $post_type,
689
-            "post_title" => 'Springfield Lodge',
690
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
655
+			"post_images" => $image_array,
656
+			"post_category" => array($post_type.'category' => array($category_array[1])),
657
+			"post_tags" => array('Tags', 'Sample Tags'),
658
+			"geodir_video" => '',
659
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
660
+			"geodir_contact" => '(222) 777-1111',
661
+			"geodir_email" => '[email protected]',
662
+			"geodir_website" => 'http://example.com/',
663
+			"geodir_twitter" => 'http://example.com/',
664
+			"geodir_facebook" => 'http://example.com/',
665
+			"geodir_price" => '13000',
666
+			"geodir_property_status" => 'Under Offer',
667
+			'geodir_property_furnishing' => 'Partially furnished',
668
+			'geodir_property_type' => 'Detached house',
669
+			'geodir_property_bedrooms' => '10',
670
+			'geodir_property_bathrooms' => '7',
671
+			'geodir_property_area' => '6600',
672
+			'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden,Garage,Private driveway,Fireplace',
673
+			"post_dummy" => '1'
674
+		);
675
+
676
+		break;
677
+
678
+	case 5:
679
+		$image_array = array();
680
+		$post_meta = array();
681
+		$image_array[] = "$dummy_image_url/ps/psf5.jpg";
682
+		$image_array[] = "$dummy_image_url/ps/psl5.jpg";
683
+		$image_array[] = "$dummy_image_url/ps/psb5.jpg";
684
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
685
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
686
+
687
+		$post_info[] = array(
688
+			"listing_type" => $post_type,
689
+			"post_title" => 'Springfield Lodge',
690
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
691 691
 
692 692
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
693 693
 
@@ -697,42 +697,42 @@  discard block
 block discarded – undo
697 697
 
698 698
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
699 699
 
700
-            "post_images" => $image_array,
701
-            "post_category" => array($post_type.'category' => array($category_array[1])),
702
-            "post_tags" => array('Tags', 'Sample Tags'),
703
-            "geodir_video" => '',
704
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
705
-            "geodir_contact" => '(222) 777-1111',
706
-            "geodir_email" => '[email protected]',
707
-            "geodir_website" => 'http://example.com/',
708
-            "geodir_twitter" => 'http://example.com/',
709
-            "geodir_facebook" => 'http://example.com/',
710
-            "geodir_price" => '1800',
711
-            "geodir_property_status" => 'For Rent',
712
-            'geodir_property_furnishing' => 'Optional',
713
-            'geodir_property_type' => 'Detached house',
714
-            'geodir_property_bedrooms' => '4',
715
-            'geodir_property_bathrooms' => '3',
716
-            'geodir_property_area' => '3700',
717
-            'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden',
718
-            "post_dummy" => '1'
719
-        );
720
-
721
-        break;
722
-
723
-    case 6:
724
-        $image_array = array();
725
-        $post_meta = array();
726
-        $image_array[] = "$dummy_image_url/ps/psf6.jpg";
727
-        $image_array[] = "$dummy_image_url/ps/psl6.jpg";
728
-        $image_array[] = "$dummy_image_url/ps/psb5.jpg";
729
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
730
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
731
-
732
-        $post_info[] = array(
733
-            "listing_type" => $post_type,
734
-            "post_title" => 'Forrest Park',
735
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
700
+			"post_images" => $image_array,
701
+			"post_category" => array($post_type.'category' => array($category_array[1])),
702
+			"post_tags" => array('Tags', 'Sample Tags'),
703
+			"geodir_video" => '',
704
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
705
+			"geodir_contact" => '(222) 777-1111',
706
+			"geodir_email" => '[email protected]',
707
+			"geodir_website" => 'http://example.com/',
708
+			"geodir_twitter" => 'http://example.com/',
709
+			"geodir_facebook" => 'http://example.com/',
710
+			"geodir_price" => '1800',
711
+			"geodir_property_status" => 'For Rent',
712
+			'geodir_property_furnishing' => 'Optional',
713
+			'geodir_property_type' => 'Detached house',
714
+			'geodir_property_bedrooms' => '4',
715
+			'geodir_property_bathrooms' => '3',
716
+			'geodir_property_area' => '3700',
717
+			'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden',
718
+			"post_dummy" => '1'
719
+		);
720
+
721
+		break;
722
+
723
+	case 6:
724
+		$image_array = array();
725
+		$post_meta = array();
726
+		$image_array[] = "$dummy_image_url/ps/psf6.jpg";
727
+		$image_array[] = "$dummy_image_url/ps/psl6.jpg";
728
+		$image_array[] = "$dummy_image_url/ps/psb5.jpg";
729
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
730
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
731
+
732
+		$post_info[] = array(
733
+			"listing_type" => $post_type,
734
+			"post_title" => 'Forrest Park',
735
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
736 736
 
737 737
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
738 738
 
@@ -742,42 +742,42 @@  discard block
 block discarded – undo
742 742
 
743 743
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
744 744
 
745
-            "post_images" => $image_array,
746
-            "post_category" => array($post_type.'category' => array($category_array[1])),
747
-            "post_tags" => array('Tags', 'Sample Tags'),
748
-            "geodir_video" => '',
749
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
750
-            "geodir_contact" => '(222) 777-1111',
751
-            "geodir_email" => '[email protected]',
752
-            "geodir_website" => 'http://example.com/',
753
-            "geodir_twitter" => 'http://example.com/',
754
-            "geodir_facebook" => 'http://example.com/',
755
-            "geodir_price" => '2700',
756
-            "geodir_property_status" => 'For Rent',
757
-            'geodir_property_furnishing' => 'Unfurnished',
758
-            'geodir_property_type' => 'Detached house',
759
-            'geodir_property_bedrooms' => '5',
760
-            'geodir_property_bathrooms' => '4',
761
-            'geodir_property_area' => '2250',
762
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Front Garden,Private driveway',
763
-            "post_dummy" => '1'
764
-        );
765
-
766
-        break;
767
-
768
-    case 7:
769
-        $image_array = array();
770
-        $post_meta = array();
771
-        $image_array[] = "$dummy_image_url/ps/psf7.jpg";
772
-        $image_array[] = "$dummy_image_url/ps/psl4.jpg";
773
-        $image_array[] = "$dummy_image_url/ps/psb4.jpg";
774
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
775
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
776
-
777
-        $post_info[] = array(
778
-            "listing_type" => $post_type,
779
-            "post_title" => 'Fraser Suites',
780
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
745
+			"post_images" => $image_array,
746
+			"post_category" => array($post_type.'category' => array($category_array[1])),
747
+			"post_tags" => array('Tags', 'Sample Tags'),
748
+			"geodir_video" => '',
749
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
750
+			"geodir_contact" => '(222) 777-1111',
751
+			"geodir_email" => '[email protected]',
752
+			"geodir_website" => 'http://example.com/',
753
+			"geodir_twitter" => 'http://example.com/',
754
+			"geodir_facebook" => 'http://example.com/',
755
+			"geodir_price" => '2700',
756
+			"geodir_property_status" => 'For Rent',
757
+			'geodir_property_furnishing' => 'Unfurnished',
758
+			'geodir_property_type' => 'Detached house',
759
+			'geodir_property_bedrooms' => '5',
760
+			'geodir_property_bathrooms' => '4',
761
+			'geodir_property_area' => '2250',
762
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Front Garden,Private driveway',
763
+			"post_dummy" => '1'
764
+		);
765
+
766
+		break;
767
+
768
+	case 7:
769
+		$image_array = array();
770
+		$post_meta = array();
771
+		$image_array[] = "$dummy_image_url/ps/psf7.jpg";
772
+		$image_array[] = "$dummy_image_url/ps/psl4.jpg";
773
+		$image_array[] = "$dummy_image_url/ps/psb4.jpg";
774
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
775
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
776
+
777
+		$post_info[] = array(
778
+			"listing_type" => $post_type,
779
+			"post_title" => 'Fraser Suites',
780
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
781 781
 
782 782
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
783 783
 
@@ -787,42 +787,42 @@  discard block
 block discarded – undo
787 787
 
788 788
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
789 789
 
790
-            "post_images" => $image_array,
791
-            "post_category" => array($post_type.'category' => array($category_array[0])),
792
-            "post_tags" => array('Tags', 'Sample Tags'),
793
-            "geodir_video" => '',
794
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
795
-            "geodir_contact" => '(222) 777-1111',
796
-            "geodir_email" => '[email protected]',
797
-            "geodir_website" => 'http://example.com/',
798
-            "geodir_twitter" => 'http://example.com/',
799
-            "geodir_facebook" => 'http://example.com/',
800
-            "geodir_price" => '1450',
801
-            "geodir_property_status" => 'For Rent',
802
-            'geodir_property_furnishing' => 'Unfurnished',
803
-            'geodir_property_type' => 'Apartment',
804
-            'geodir_property_bedrooms' => '3',
805
-            'geodir_property_bathrooms' => '2',
806
-            'geodir_property_area' => '1250',
807
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing',
808
-            "post_dummy" => '1'
809
-        );
810
-
811
-        break;
812
-
813
-    case 8:
814
-        $image_array = array();
815
-        $post_meta = array();
816
-        $image_array[] = "$dummy_image_url/ps/psf8.jpg";
817
-        $image_array[] = "$dummy_image_url/ps/psl2.jpg";
818
-        $image_array[] = "$dummy_image_url/ps/psb2.jpg";
819
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
820
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
821
-
822
-        $post_info[] = array(
823
-            "listing_type" => $post_type,
824
-            "post_title" => 'Richmore Apartments',
825
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
790
+			"post_images" => $image_array,
791
+			"post_category" => array($post_type.'category' => array($category_array[0])),
792
+			"post_tags" => array('Tags', 'Sample Tags'),
793
+			"geodir_video" => '',
794
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
795
+			"geodir_contact" => '(222) 777-1111',
796
+			"geodir_email" => '[email protected]',
797
+			"geodir_website" => 'http://example.com/',
798
+			"geodir_twitter" => 'http://example.com/',
799
+			"geodir_facebook" => 'http://example.com/',
800
+			"geodir_price" => '1450',
801
+			"geodir_property_status" => 'For Rent',
802
+			'geodir_property_furnishing' => 'Unfurnished',
803
+			'geodir_property_type' => 'Apartment',
804
+			'geodir_property_bedrooms' => '3',
805
+			'geodir_property_bathrooms' => '2',
806
+			'geodir_property_area' => '1250',
807
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing',
808
+			"post_dummy" => '1'
809
+		);
810
+
811
+		break;
812
+
813
+	case 8:
814
+		$image_array = array();
815
+		$post_meta = array();
816
+		$image_array[] = "$dummy_image_url/ps/psf8.jpg";
817
+		$image_array[] = "$dummy_image_url/ps/psl2.jpg";
818
+		$image_array[] = "$dummy_image_url/ps/psb2.jpg";
819
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
820
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
821
+
822
+		$post_info[] = array(
823
+			"listing_type" => $post_type,
824
+			"post_title" => 'Richmore Apartments',
825
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
826 826
 
827 827
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
828 828
 
@@ -832,43 +832,43 @@  discard block
 block discarded – undo
832 832
 
833 833
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
834 834
 
835
-            "post_images" => $image_array,
836
-            "post_category" => array($post_type.'category' => array($category_array[0])),
837
-            "post_tags" => array('Tags', 'Sample Tags'),
838
-            "geodir_video" => '',
839
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
840
-            "geodir_contact" => '(222) 777-1111',
841
-            "geodir_email" => '[email protected]',
842
-            "geodir_website" => 'http://example.com/',
843
-            "geodir_twitter" => 'http://example.com/',
844
-            "geodir_facebook" => 'http://example.com/',
845
-            "geodir_price" => '2000',
846
-            "geodir_property_status" => 'For Rent',
847
-            'geodir_property_furnishing' => 'Unfurnished',
848
-            'geodir_property_type' => 'Apartment',
849
-            'geodir_property_bedrooms' => '2',
850
-            'geodir_property_bathrooms' => '2',
851
-            'geodir_property_area' => '1750',
852
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
853
-            "post_dummy" => '1'
854
-        );
855
-
856
-        break;
857
-
858
-
859
-    case 9:
860
-        $image_array = array();
861
-        $post_meta = array();
862
-        $image_array[] = "$dummy_image_url/ps/psf9.jpg";
863
-        $image_array[] = "$dummy_image_url/ps/psc9.jpg";
864
-        $image_array[] = "$dummy_image_url/ps/psb2.jpg";
865
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
866
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
867
-
868
-        $post_info[] = array(
869
-            "listing_type" => $post_type,
870
-            "post_title" => 'Hotel Alpina',
871
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
835
+			"post_images" => $image_array,
836
+			"post_category" => array($post_type.'category' => array($category_array[0])),
837
+			"post_tags" => array('Tags', 'Sample Tags'),
838
+			"geodir_video" => '',
839
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
840
+			"geodir_contact" => '(222) 777-1111',
841
+			"geodir_email" => '[email protected]',
842
+			"geodir_website" => 'http://example.com/',
843
+			"geodir_twitter" => 'http://example.com/',
844
+			"geodir_facebook" => 'http://example.com/',
845
+			"geodir_price" => '2000',
846
+			"geodir_property_status" => 'For Rent',
847
+			'geodir_property_furnishing' => 'Unfurnished',
848
+			'geodir_property_type' => 'Apartment',
849
+			'geodir_property_bedrooms' => '2',
850
+			'geodir_property_bathrooms' => '2',
851
+			'geodir_property_area' => '1750',
852
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
853
+			"post_dummy" => '1'
854
+		);
855
+
856
+		break;
857
+
858
+
859
+	case 9:
860
+		$image_array = array();
861
+		$post_meta = array();
862
+		$image_array[] = "$dummy_image_url/ps/psf9.jpg";
863
+		$image_array[] = "$dummy_image_url/ps/psc9.jpg";
864
+		$image_array[] = "$dummy_image_url/ps/psb2.jpg";
865
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
866
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
867
+
868
+		$post_info[] = array(
869
+			"listing_type" => $post_type,
870
+			"post_title" => 'Hotel Alpina',
871
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
872 872
 
873 873
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
874 874
 
@@ -878,39 +878,39 @@  discard block
 block discarded – undo
878 878
 
879 879
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
880 880
 
881
-            "post_images" => $image_array,
882
-            "post_category" => array($post_type.'category' => array($category_array[2])),
883
-            "post_tags" => array('Tags', 'Sample Tags'),
884
-            "geodir_video" => '',
885
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
886
-            "geodir_contact" => '(222) 777-1111',
887
-            "geodir_email" => '[email protected]',
888
-            "geodir_website" => 'http://example.com/',
889
-            "geodir_twitter" => 'http://example.com/',
890
-            "geodir_facebook" => 'http://example.com/',
891
-            "geodir_price" => '60000',
892
-            "geodir_property_status" => 'For Rent',
893
-            'geodir_property_furnishing' => 'Furnished',
894
-            'geodir_property_type' => 'Hotel',
895
-            'geodir_property_bedrooms' => '120',
896
-            'geodir_property_bathrooms' => '133',
897
-            'geodir_property_area' => '35000',
898
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
899
-            "post_dummy" => '1'
900
-        );
901
-
902
-        break;
903
-
904
-    case 10:
905
-        $image_array = array();
906
-        $post_meta = array();
907
-        $image_array[] = "$dummy_image_url/ps/psf10.jpg";
908
-        $image_array[] = "$dummy_image_url/ps/psf102.jpg";
909
-
910
-        $post_info[] = array(
911
-            "listing_type" => $post_type,
912
-            "post_title" => 'Development Land',
913
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
881
+			"post_images" => $image_array,
882
+			"post_category" => array($post_type.'category' => array($category_array[2])),
883
+			"post_tags" => array('Tags', 'Sample Tags'),
884
+			"geodir_video" => '',
885
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
886
+			"geodir_contact" => '(222) 777-1111',
887
+			"geodir_email" => '[email protected]',
888
+			"geodir_website" => 'http://example.com/',
889
+			"geodir_twitter" => 'http://example.com/',
890
+			"geodir_facebook" => 'http://example.com/',
891
+			"geodir_price" => '60000',
892
+			"geodir_property_status" => 'For Rent',
893
+			'geodir_property_furnishing' => 'Furnished',
894
+			'geodir_property_type' => 'Hotel',
895
+			'geodir_property_bedrooms' => '120',
896
+			'geodir_property_bathrooms' => '133',
897
+			'geodir_property_area' => '35000',
898
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
899
+			"post_dummy" => '1'
900
+		);
901
+
902
+		break;
903
+
904
+	case 10:
905
+		$image_array = array();
906
+		$post_meta = array();
907
+		$image_array[] = "$dummy_image_url/ps/psf10.jpg";
908
+		$image_array[] = "$dummy_image_url/ps/psf102.jpg";
909
+
910
+		$post_info[] = array(
911
+			"listing_type" => $post_type,
912
+			"post_title" => 'Development Land',
913
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
914 914
 
915 915
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
916 916
 
@@ -920,93 +920,93 @@  discard block
 block discarded – undo
920 920
 
921 921
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
922 922
 
923
-            "post_images" => $image_array,
924
-            "post_category" => array($post_type.'category' => array($category_array[3])),
925
-            "post_tags" => array('Tags', 'Sample Tags'),
926
-            "geodir_video" => '',
927
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
928
-            "geodir_contact" => '(222) 777-1111',
929
-            "geodir_email" => '[email protected]',
930
-            "geodir_website" => 'http://example.com/',
931
-            "geodir_twitter" => 'http://example.com/',
932
-            "geodir_facebook" => 'http://example.com/',
933
-            "geodir_price" => '800',
934
-            "geodir_property_status" => 'For Rent',
935
-            'geodir_property_furnishing' => '',
936
-            'geodir_property_type' => 'Land',
937
-            'geodir_property_bedrooms' => '',
938
-            'geodir_property_bathrooms' => '',
939
-            'geodir_property_area' => '250000',
940
-            'geodir_property_features' => '',
941
-            "post_dummy" => '1'
942
-        );
943
-
944
-        break;
923
+			"post_images" => $image_array,
924
+			"post_category" => array($post_type.'category' => array($category_array[3])),
925
+			"post_tags" => array('Tags', 'Sample Tags'),
926
+			"geodir_video" => '',
927
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
928
+			"geodir_contact" => '(222) 777-1111',
929
+			"geodir_email" => '[email protected]',
930
+			"geodir_website" => 'http://example.com/',
931
+			"geodir_twitter" => 'http://example.com/',
932
+			"geodir_facebook" => 'http://example.com/',
933
+			"geodir_price" => '800',
934
+			"geodir_property_status" => 'For Rent',
935
+			'geodir_property_furnishing' => '',
936
+			'geodir_property_type' => 'Land',
937
+			'geodir_property_bedrooms' => '',
938
+			'geodir_property_bathrooms' => '',
939
+			'geodir_property_area' => '250000',
940
+			'geodir_property_features' => '',
941
+			"post_dummy" => '1'
942
+		);
943
+
944
+		break;
945 945
 
946 946
 } // end of switch
947 947
 
948 948
 foreach ($post_info as $post_info) {
949
-    $default_location = geodir_get_default_location();
950
-    if ($city_bound_lat1 > $city_bound_lat2)
951
-        $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1));
952
-    else
953
-        $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2));
949
+	$default_location = geodir_get_default_location();
950
+	if ($city_bound_lat1 > $city_bound_lat2)
951
+		$dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1));
952
+	else
953
+		$dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2));
954 954
 
955 955
 
956
-    if ($city_bound_lng1 > $city_bound_lng2)
957
-        $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1));
958
-    else
959
-        $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2));
956
+	if ($city_bound_lng1 > $city_bound_lng2)
957
+		$dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1));
958
+	else
959
+		$dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2));
960 960
 
961
-    $load_map = get_option('geodir_load_map');
961
+	$load_map = get_option('geodir_load_map');
962 962
     
963
-    if ($load_map == 'osm') {
964
-        $post_address = geodir_get_osm_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
965
-    } else {
966
-        $post_address = geodir_get_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
967
-    }
968
-
969
-    $postal_code = '';
970
-    if (!empty($post_address)) {
971
-        if ($load_map == 'osm') {
972
-            $address = !empty($post_address->formatted_address) ? $post_address->formatted_address : '';
973
-            $postal_code = !empty($post_address->address->postcode) ? $post_address->address->postcode : '';
974
-        } else {
975
-            $addresses = array();
976
-            $addresses_default = array();
963
+	if ($load_map == 'osm') {
964
+		$post_address = geodir_get_osm_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
965
+	} else {
966
+		$post_address = geodir_get_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
967
+	}
968
+
969
+	$postal_code = '';
970
+	if (!empty($post_address)) {
971
+		if ($load_map == 'osm') {
972
+			$address = !empty($post_address->formatted_address) ? $post_address->formatted_address : '';
973
+			$postal_code = !empty($post_address->address->postcode) ? $post_address->address->postcode : '';
974
+		} else {
975
+			$addresses = array();
976
+			$addresses_default = array();
977 977
             
978
-            foreach ($post_address as $add_key => $add_value) {
979
-                if ($add_key < 2 && !empty($add_value->long_name)) {
980
-                    $addresses_default[] = $add_value->long_name;
981
-                }
982
-                if ($add_value->types[0] == 'postal_code') {
983
-                    $postal_code = $add_value->long_name;
984
-                }
985
-                if ($add_value->types[0] == 'street_number') {
986
-                    $addresses[] = $add_value->long_name;
987
-                }
988
-                if ($add_value->types[0] == 'route') {
989
-                    $addresses[] = $add_value->long_name;
990
-                }
991
-                if ($add_value->types[0] == 'neighborhood') {
992
-                    $addresses[] = $add_value->long_name;
993
-                }
994
-                if ($add_value->types[0] == 'sublocality') {
995
-                    $addresses[] = $add_value->long_name;
996
-                }
997
-            }
998
-            $address = !empty($addresses) ? implode(', ', $addresses) : (!empty($addresses_default) ? implode(', ', $addresses_default) : '');
999
-        }
1000
-
1001
-        $post_info['post_address'] = !empty($address) ? $address : $default_location->city;
1002
-        $post_info['post_city'] = $default_location->city;
1003
-        $post_info['post_region'] = $default_location->region;
1004
-        $post_info['post_country'] = $default_location->country;
1005
-        $post_info['post_zip'] = $postal_code;
1006
-        $post_info['post_latitude'] = $dummy_post_latitude;
1007
-        $post_info['post_longitude'] = $dummy_post_longitude;
1008
-    }
978
+			foreach ($post_address as $add_key => $add_value) {
979
+				if ($add_key < 2 && !empty($add_value->long_name)) {
980
+					$addresses_default[] = $add_value->long_name;
981
+				}
982
+				if ($add_value->types[0] == 'postal_code') {
983
+					$postal_code = $add_value->long_name;
984
+				}
985
+				if ($add_value->types[0] == 'street_number') {
986
+					$addresses[] = $add_value->long_name;
987
+				}
988
+				if ($add_value->types[0] == 'route') {
989
+					$addresses[] = $add_value->long_name;
990
+				}
991
+				if ($add_value->types[0] == 'neighborhood') {
992
+					$addresses[] = $add_value->long_name;
993
+				}
994
+				if ($add_value->types[0] == 'sublocality') {
995
+					$addresses[] = $add_value->long_name;
996
+				}
997
+			}
998
+			$address = !empty($addresses) ? implode(', ', $addresses) : (!empty($addresses_default) ? implode(', ', $addresses_default) : '');
999
+		}
1000
+
1001
+		$post_info['post_address'] = !empty($address) ? $address : $default_location->city;
1002
+		$post_info['post_city'] = $default_location->city;
1003
+		$post_info['post_region'] = $default_location->region;
1004
+		$post_info['post_country'] = $default_location->country;
1005
+		$post_info['post_zip'] = $postal_code;
1006
+		$post_info['post_latitude'] = $dummy_post_latitude;
1007
+		$post_info['post_longitude'] = $dummy_post_longitude;
1008
+	}
1009 1009
     
1010
-    geodir_save_listing($post_info, true);
1011
-    echo 1;
1010
+	geodir_save_listing($post_info, true);
1011
+	echo 1;
1012 1012
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-function geodir_property_rent_custom_fields($post_type='gd_place',$package_id=''){
9
+function geodir_property_rent_custom_fields($post_type = 'gd_place', $package_id = '') {
10 10
     $fields = array();
11
-    $package = ($package_id=='') ? '' : array($package_id);
11
+    $package = ($package_id == '') ? '' : array($package_id);
12 12
 
13 13
     // price
14 14
     $fields[] = array('listing_type' => $post_type,
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                       'default_value'       =>  '',
79 79
                       'show_in' 	        =>  '[detail],[listing]',
80 80
                       'is_required'         =>  true,
81
-                      'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
81
+                      'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional', 'geodirectory'),
82 82
                       'validation_pattern'  =>  '',
83 83
                       'validation_msg'      =>  '',
84 84
                       'required_msg'        =>  '',
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                       'default_value'       =>  '',
102 102
                       'show_in' 	        =>  '[detail],[listing]',
103 103
                       'is_required'         =>  true,
104
-                      'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage,Hotel,Land','geodirectory'),
104
+                      'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage,Hotel,Land', 'geodirectory'),
105 105
                       'validation_pattern'  =>  '',
106 106
                       'validation_msg'      =>  '',
107 107
                       'required_msg'        =>  '',
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                       'default_value'       =>  '',
125 125
                       'show_in' 	        =>  '[detail],[listing]',
126 126
                       'is_required'         =>  true,
127
-                      'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
127
+                      'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
128 128
                       'validation_pattern'  =>  '',
129 129
                       'validation_msg'      =>  '',
130 130
                       'required_msg'        =>  '',
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                       'default_value'       =>  '',
148 148
                       'show_in' 	        =>  '[detail],[listing]',
149 149
                       'is_required'         =>  true,
150
-                      'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
150
+                      'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
151 151
                       'validation_pattern'  =>  '',
152 152
                       'validation_msg'      =>  '',
153 153
                       'required_msg'        =>  '',
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                       'default_value'       =>  '',
193 193
                       'show_in' 	        =>  '[detail],[listing]',
194 194
                       'is_required'         =>  false,
195
-                      'option_values'       =>  __('Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
195
+                      'option_values'       =>  __('Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace', 'geodirectory'),
196 196
                       'validation_pattern'  =>  '',
197 197
                       'validation_msg'      =>  '',
198 198
                       'required_msg'        =>  '',
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     return  $fields;
216 216
 }
217 217
 
218
-function geodir_property_rent_custom_fields_sort($post_type='gd_place') {
218
+function geodir_property_rent_custom_fields_sort($post_type = 'gd_place') {
219 219
 
220 220
 
221 221
     $fields = array();
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
         'field_type'              => 'text',
228 228
         'data_type'               => '',
229 229
         'htmlvar_name'            => 'geodir_price',
230
-        'site_title'              => __('Price','geodirectory'),
230
+        'site_title'              => __('Price', 'geodirectory'),
231 231
         'asc'                     => 1,
232
-        'asc_title'               => __('Price (lowest first)','geodirectory'),
232
+        'asc_title'               => __('Price (lowest first)', 'geodirectory'),
233 233
         'desc'                    => 1,
234
-        'desc_title'              => __('Price (highest first)','geodirectory'),
234
+        'desc_title'              => __('Price (highest first)', 'geodirectory'),
235 235
         'is_active'               => 1
236 236
     );
237 237
 
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
         'field_type'              => 'text',
243 243
         'data_type'               => '',
244 244
         'htmlvar_name'            => 'geodir_property_area',
245
-        'site_title'              => __('Area (Sq Ft)','geodirectory'),
245
+        'site_title'              => __('Area (Sq Ft)', 'geodirectory'),
246 246
         'asc'                     => 1,
247
-        'asc_title'               => __('Area (smallest first)','geodirectory'),
247
+        'asc_title'               => __('Area (smallest first)', 'geodirectory'),
248 248
         'desc'                    => 1,
249
-        'desc_title'              => __('Area (largest first)','geodirectory'),
249
+        'desc_title'              => __('Area (largest first)', 'geodirectory'),
250 250
         'is_active'               => 1
251 251
     );
252 252
 
@@ -257,11 +257,11 @@  discard block
 block discarded – undo
257 257
         'field_type'              => 'select',
258 258
         'data_type'               => '',
259 259
         'htmlvar_name'            => 'geodir_property_bedrooms',
260
-        'site_title'              => __('Area (Sq Ft)','geodirectory'),
260
+        'site_title'              => __('Area (Sq Ft)', 'geodirectory'),
261 261
         'asc'                     => 1,
262
-        'asc_title'               => __('Bedrooms (least)','geodirectory'),
262
+        'asc_title'               => __('Bedrooms (least)', 'geodirectory'),
263 263
         'desc'                    => 1,
264
-        'desc_title'              => __('Bedrooms (most)','geodirectory'),
264
+        'desc_title'              => __('Bedrooms (most)', 'geodirectory'),
265 265
         'is_active'               => 1
266 266
     );
267 267
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 }
279 279
 
280
-function geodir_property_rent_custom_fields_advanced_search($post_type='gd_place') {
280
+function geodir_property_rent_custom_fields_advanced_search($post_type = 'gd_place') {
281 281
 
282 282
 
283 283
     $fields = array();
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
     return $fields;
456 456
 }
457 457
 
458
-global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2,$wpdb, $current_user,$dummy_post_index;
458
+global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2, $wpdb, $current_user, $dummy_post_index;
459 459
 $post_info = array();
460 460
 $image_array = array();
461 461
 $post_meta = array();
462 462
 $category_array = array('Apartments', 'Houses', 'Commercial', 'Land');
463 463
 
464
-if($dummy_post_index==1){
464
+if ($dummy_post_index == 1) {
465 465
     // add the dummy categories
466
-    geodir_dummy_data_taxonomies($post_type,$category_array );
466
+    geodir_dummy_data_taxonomies($post_type, $category_array);
467 467
 
468 468
     // add the dummy custom fields
469 469
     $fields = geodir_property_rent_custom_fields($post_type);
@@ -471,24 +471,24 @@  discard block
 block discarded – undo
471 471
 
472 472
     // add sort order items
473 473
     $sort_fields = geodir_property_rent_custom_fields_sort($post_type);
474
-    foreach($sort_fields as $sort){
474
+    foreach ($sort_fields as $sort) {
475 475
         geodir_custom_sort_field_save($sort);
476 476
     }
477 477
 
478 478
     // update the type currently installed
479
-    update_option($post_type.'_dummy_data_type','property_rent');
479
+    update_option($post_type.'_dummy_data_type', 'property_rent');
480 480
 
481 481
     // add the advanced search fields
482
-    if (defined('GEODIRADVANCESEARCH_VERSION')){
482
+    if (defined('GEODIRADVANCESEARCH_VERSION')) {
483 483
         $search_fields = geodir_property_rent_custom_fields_advanced_search($post_type);
484
-        foreach($search_fields as $sfield){
485
-            geodir_custom_advance_search_field_save( $sfield );
484
+        foreach ($search_fields as $sfield) {
485
+            geodir_custom_advance_search_field_save($sfield);
486 486
         }
487 487
     }
488 488
 }
489 489
 
490 490
 if (geodir_dummy_folder_exists())
491
-    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
491
+    $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy";
492 492
 else
493 493
     $dummy_image_url = 'https://www.wpgeodirectory.com/dummy';
494 494
 
Please login to merge, or discard this patch.