Test Failed
Push — master ( 079e86...dc5270 )
by Stiofan
27:43 queued 11:39
created
geodirectory-functions/custom_fields_output_functions.php 1 patch
Indentation   +1558 added lines, -1558 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
 
@@ -833,92 +833,92 @@  discard block
 block discarded – undo
833 833
  */
834 834
 function geodir_cf_select($html,$location,$cf,$p=''){
835 835
 
836
-    // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
839
-
840
-    if(!is_array($cf) && $cf!=''){
841
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
-        if(!$cf){return NULL;}
843
-    }
844
-
845
-    $html_var = $cf['htmlvar_name'];
846
-
847
-    // Check if there is a location specific filter.
848
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
-        /**
850
-         * Filter the select html by location.
851
-         *
852
-         * @param string $html The html to filter.
853
-         * @param array $cf The custom field array.
854
-         * @since 1.6.6
855
-         */
856
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
-    }
858
-
859
-    // Check if there is a custom field specific filter.
860
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
-        /**
862
-         * Filter the select html by individual custom field.
863
-         *
864
-         * @param string $html The html to filter.
865
-         * @param string $location The location to output the html.
866
-         * @param array $cf The custom field array.
867
-         * @since 1.6.6
868
-         */
869
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
-    }
871
-
872
-    // Check if there is a custom field key specific filter.
873
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
-        /**
875
-         * Filter the select html by field type key.
876
-         *
877
-         * @param string $html The html to filter.
878
-         * @param string $location The location to output the html.
879
-         * @param array $cf The custom field array.
880
-         * @since 1.6.6
881
-         */
882
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
-    }
884
-
885
-    // If not html then we run the standard output.
886
-    if(empty($html)){
887
-
888
-        if ($post->{$cf['htmlvar_name']}):
889
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
-
891
-            if (!empty($cf['option_values'])) {
892
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
-
894
-                if (!empty($cf_option_values)) {
895
-                    foreach ($cf_option_values as $cf_option_value) {
896
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
-                            $field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
-                        }
899
-                    }
900
-                }
901
-            }
902
-
903
-            $field_icon = geodir_field_icon_proccess($cf);
904
-            if (strpos($field_icon, 'http') !== false) {
905
-                $field_icon_af = '';
906
-            } elseif ($field_icon == '') {
907
-                $field_icon_af = '';
908
-            } else {
909
-                $field_icon_af = $field_icon;
910
-                $field_icon = '';
911
-            }
912
-
913
-
914
-            $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;
915
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
-            $html .= '</span>' . $field_value . '</div>';
917
-        endif;
918
-
919
-    }
920
-
921
-    return $html;
836
+	// check we have the post value
837
+	if(is_int($p)){$post = geodir_get_post_info($p);}
838
+	else{ global $post;}
839
+
840
+	if(!is_array($cf) && $cf!=''){
841
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
+		if(!$cf){return NULL;}
843
+	}
844
+
845
+	$html_var = $cf['htmlvar_name'];
846
+
847
+	// Check if there is a location specific filter.
848
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
+		/**
850
+		 * Filter the select html by location.
851
+		 *
852
+		 * @param string $html The html to filter.
853
+		 * @param array $cf The custom field array.
854
+		 * @since 1.6.6
855
+		 */
856
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
+	}
858
+
859
+	// Check if there is a custom field specific filter.
860
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
+		/**
862
+		 * Filter the select html by individual custom field.
863
+		 *
864
+		 * @param string $html The html to filter.
865
+		 * @param string $location The location to output the html.
866
+		 * @param array $cf The custom field array.
867
+		 * @since 1.6.6
868
+		 */
869
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
+	}
871
+
872
+	// Check if there is a custom field key specific filter.
873
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
+		/**
875
+		 * Filter the select html by field type key.
876
+		 *
877
+		 * @param string $html The html to filter.
878
+		 * @param string $location The location to output the html.
879
+		 * @param array $cf The custom field array.
880
+		 * @since 1.6.6
881
+		 */
882
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
+	}
884
+
885
+	// If not html then we run the standard output.
886
+	if(empty($html)){
887
+
888
+		if ($post->{$cf['htmlvar_name']}):
889
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
+
891
+			if (!empty($cf['option_values'])) {
892
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
+
894
+				if (!empty($cf_option_values)) {
895
+					foreach ($cf_option_values as $cf_option_value) {
896
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
+							$field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
+						}
899
+					}
900
+				}
901
+			}
902
+
903
+			$field_icon = geodir_field_icon_proccess($cf);
904
+			if (strpos($field_icon, 'http') !== false) {
905
+				$field_icon_af = '';
906
+			} elseif ($field_icon == '') {
907
+				$field_icon_af = '';
908
+			} else {
909
+				$field_icon_af = $field_icon;
910
+				$field_icon = '';
911
+			}
912
+
913
+
914
+			$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;
915
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
+			$html .= '</span>' . $field_value . '</div>';
917
+		endif;
918
+
919
+	}
920
+
921
+	return $html;
922 922
 }
923 923
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
924 924
 
@@ -935,117 +935,117 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
937 937
 
938
-    // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
941
-
942
-    if(!is_array($cf) && $cf!=''){
943
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
-        if(!$cf){return NULL;}
945
-    }
946
-
947
-    $html_var = $cf['htmlvar_name'];
948
-
949
-    // Check if there is a location specific filter.
950
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
-        /**
952
-         * Filter the multiselect html by location.
953
-         *
954
-         * @param string $html The html to filter.
955
-         * @param array $cf The custom field array.
956
-         * @since 1.6.6
957
-         */
958
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
-    }
960
-
961
-    // Check if there is a custom field specific filter.
962
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
-        /**
964
-         * Filter the multiselect html by individual custom field.
965
-         *
966
-         * @param string $html The html to filter.
967
-         * @param string $location The location to output the html.
968
-         * @param array $cf The custom field array.
969
-         * @since 1.6.6
970
-         */
971
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
-    }
973
-
974
-    // Check if there is a custom field key specific filter.
975
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
-        /**
977
-         * Filter the multiselect html by field type key.
978
-         *
979
-         * @param string $html The html to filter.
980
-         * @param string $location The location to output the html.
981
-         * @param array $cf The custom field array.
982
-         * @since 1.6.6
983
-         */
984
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
-    }
986
-
987
-    // If not html then we run the standard output.
988
-    if(empty($html)){
989
-
990
-
991
-        if (!empty($post->{$cf['htmlvar_name']})):
992
-
993
-            if (is_array($post->{$cf['htmlvar_name']})) {
994
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
-            }
996
-
997
-            $field_icon = geodir_field_icon_proccess($cf);
998
-            if (strpos($field_icon, 'http') !== false) {
999
-                $field_icon_af = '';
1000
-            } elseif ($field_icon == '') {
1001
-                $field_icon_af = '';
1002
-            } else {
1003
-                $field_icon_af = $field_icon;
1004
-                $field_icon = '';
1005
-            }
1006
-
1007
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
-
1009
-            if(is_array($field_values)){
1010
-                $field_values = array_map('trim', $field_values);
1011
-            }
1012
-
1013
-            $option_values = array();
1014
-            if (!empty($cf['option_values'])) {
1015
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
-
1017
-                if (!empty($cf_option_values)) {
1018
-                    foreach ($cf_option_values as $cf_option_value) {
1019
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
-                            $option_values[] = $cf_option_value['label'];
1021
-                        }
1022
-                    }
1023
-                }
1024
-            }
1025
-
1026
-
1027
-            $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;
1028
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
-            $html .= '</span>';
1030
-
1031
-            if (count($option_values) > 1) {
1032
-                $html .= '<ul>';
1033
-
1034
-                foreach ($option_values as $val) {
1035
-                    $html .= '<li>' . $val . '</li>';
1036
-                }
1037
-
1038
-                $html .= '</ul>';
1039
-            } else {
1040
-                $html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
-            }
1042
-
1043
-            $html .= '</div>';
1044
-        endif;
1045
-
1046
-    }
1047
-
1048
-    return $html;
938
+	// check we have the post value
939
+	if(is_int($p)){$post = geodir_get_post_info($p);}
940
+	else{ global $post;}
941
+
942
+	if(!is_array($cf) && $cf!=''){
943
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
+		if(!$cf){return NULL;}
945
+	}
946
+
947
+	$html_var = $cf['htmlvar_name'];
948
+
949
+	// Check if there is a location specific filter.
950
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
+		/**
952
+		 * Filter the multiselect html by location.
953
+		 *
954
+		 * @param string $html The html to filter.
955
+		 * @param array $cf The custom field array.
956
+		 * @since 1.6.6
957
+		 */
958
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
+	}
960
+
961
+	// Check if there is a custom field specific filter.
962
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
+		/**
964
+		 * Filter the multiselect html by individual custom field.
965
+		 *
966
+		 * @param string $html The html to filter.
967
+		 * @param string $location The location to output the html.
968
+		 * @param array $cf The custom field array.
969
+		 * @since 1.6.6
970
+		 */
971
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
+	}
973
+
974
+	// Check if there is a custom field key specific filter.
975
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
+		/**
977
+		 * Filter the multiselect html by field type key.
978
+		 *
979
+		 * @param string $html The html to filter.
980
+		 * @param string $location The location to output the html.
981
+		 * @param array $cf The custom field array.
982
+		 * @since 1.6.6
983
+		 */
984
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
+	}
986
+
987
+	// If not html then we run the standard output.
988
+	if(empty($html)){
989
+
990
+
991
+		if (!empty($post->{$cf['htmlvar_name']})):
992
+
993
+			if (is_array($post->{$cf['htmlvar_name']})) {
994
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
+			}
996
+
997
+			$field_icon = geodir_field_icon_proccess($cf);
998
+			if (strpos($field_icon, 'http') !== false) {
999
+				$field_icon_af = '';
1000
+			} elseif ($field_icon == '') {
1001
+				$field_icon_af = '';
1002
+			} else {
1003
+				$field_icon_af = $field_icon;
1004
+				$field_icon = '';
1005
+			}
1006
+
1007
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
+
1009
+			if(is_array($field_values)){
1010
+				$field_values = array_map('trim', $field_values);
1011
+			}
1012
+
1013
+			$option_values = array();
1014
+			if (!empty($cf['option_values'])) {
1015
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
+
1017
+				if (!empty($cf_option_values)) {
1018
+					foreach ($cf_option_values as $cf_option_value) {
1019
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
+							$option_values[] = $cf_option_value['label'];
1021
+						}
1022
+					}
1023
+				}
1024
+			}
1025
+
1026
+
1027
+			$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;
1028
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
+			$html .= '</span>';
1030
+
1031
+			if (count($option_values) > 1) {
1032
+				$html .= '<ul>';
1033
+
1034
+				foreach ($option_values as $val) {
1035
+					$html .= '<li>' . $val . '</li>';
1036
+				}
1037
+
1038
+				$html .= '</ul>';
1039
+			} else {
1040
+				$html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
+			}
1042
+
1043
+			$html .= '</div>';
1044
+		endif;
1045
+
1046
+	}
1047
+
1048
+	return $html;
1049 1049
 }
1050 1050
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1051 1051
 
@@ -1062,148 +1062,148 @@  discard block
 block discarded – undo
1062 1062
  */
1063 1063
 function geodir_cf_email($html,$location,$cf,$p=''){
1064 1064
 
1065
-    // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1068
-
1069
-    if(!is_array($cf) && $cf!=''){
1070
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
-        if(!$cf){return NULL;}
1072
-    }
1073
-
1074
-    $html_var = $cf['htmlvar_name'];
1075
-
1076
-    // Check if there is a location specific filter.
1077
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
-        /**
1079
-         * Filter the email html by location.
1080
-         *
1081
-         * @param string $html The html to filter.
1082
-         * @param array $cf The custom field array.
1083
-         * @since 1.6.6
1084
-         */
1085
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
-    }
1087
-
1088
-    // Check if there is a custom field specific filter.
1089
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
-        /**
1091
-         * Filter the email html by individual custom field.
1092
-         *
1093
-         * @param string $html The html to filter.
1094
-         * @param string $location The location to output the html.
1095
-         * @param array $cf The custom field array.
1096
-         * @since 1.6.6
1097
-         */
1098
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
-    }
1100
-
1101
-    // Check if there is a custom field key specific filter.
1102
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
-        /**
1104
-         * Filter the email html by field type key.
1105
-         *
1106
-         * @param string $html The html to filter.
1107
-         * @param string $location The location to output the html.
1108
-         * @param array $cf The custom field array.
1109
-         * @since 1.6.6
1110
-         */
1111
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
-    }
1113
-
1114
-    // If not html then we run the standard output.
1115
-    if(empty($html)){
1116
-
1117
-        global $preview;
1118
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
-            return ''; // Remove Send Enquiry from listings page
1120
-        }
1121
-
1122
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
-
1124
-        if ($cf['htmlvar_name'] == 'geodir_email' && $post->{$cf['htmlvar_name']}) {
1125
-            $b_send_inquiry = '';
1126
-
1127
-            $html = '';
1128
-            if (!$preview) {
1129
-                $b_send_inquiry = 'b_send_inquiry';
1130
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1131
-            }
1132
-
1133
-            $field_icon = geodir_field_icon_proccess($cf);
1134
-            if (strpos($field_icon, 'http') !== false) {
1135
-                $field_icon_af = '';
1136
-            } elseif ($field_icon == '') {
1137
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1138
-            } else {
1139
-                $field_icon_af = $field_icon;
1140
-                $field_icon = '';
1141
-            }
1142
-
1143
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1144
-            $seperator = '';
1145
-            if ($post->{$cf['htmlvar_name']}) {
1146
-                $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1147
-                $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1148
-            }
1149
-
1150
-            $html .= '</span></div>';
1151
-
1152
-
1153
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1154
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1155
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1156
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1157
-            }
1158
-
1159
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1160
-
1161
-        } else {
1162
-
1163
-            if ($post->{$cf['htmlvar_name']}) {
1164
-
1165
-                $field_icon = geodir_field_icon_proccess($cf);
1166
-                if (strpos($field_icon, 'http') !== false) {
1167
-                    $field_icon_af = '';
1168
-                } elseif ($field_icon == '') {
1169
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1170
-                } else {
1171
-                    $field_icon_af = $field_icon;
1172
-                    $field_icon = '';
1173
-                }
1174
-
1175
-
1176
-                $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;
1177
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1178
-                $html .= '</span><span class="geodir-email-address-output">';
1179
-                $email = $post->{$cf['htmlvar_name']} ;
1180
-                if($e_split = explode('@',$email)){
1181
-                    /**
1182
-                     * Filter email custom field name output.
1183
-                     *
1184
-                     * @since 1.5.3
1185
-                     *
1186
-                     * @param string $email The email string being output.
1187
-                     * @param array $cf Custom field variables array.
1188
-                     */
1189
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1190
-                    if($location=='mapbubble'){
1191
-                        $html .=  "<a href=\"mailto:$email\">$email_name</a>";
1192
-                    }else{
1193
-                        $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1194
-                    }
1195
-
1196
-                }else{
1197
-                    $html .=  $email;
1198
-                }
1199
-                $html .= '</span></div>';
1200
-            }
1201
-
1202
-        }
1203
-
1204
-    }
1205
-
1206
-    return $html;
1065
+	// check we have the post value
1066
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1067
+	else{ global $post;}
1068
+
1069
+	if(!is_array($cf) && $cf!=''){
1070
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
+		if(!$cf){return NULL;}
1072
+	}
1073
+
1074
+	$html_var = $cf['htmlvar_name'];
1075
+
1076
+	// Check if there is a location specific filter.
1077
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
+		/**
1079
+		 * Filter the email html by location.
1080
+		 *
1081
+		 * @param string $html The html to filter.
1082
+		 * @param array $cf The custom field array.
1083
+		 * @since 1.6.6
1084
+		 */
1085
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
+	}
1087
+
1088
+	// Check if there is a custom field specific filter.
1089
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
+		/**
1091
+		 * Filter the email html by individual custom field.
1092
+		 *
1093
+		 * @param string $html The html to filter.
1094
+		 * @param string $location The location to output the html.
1095
+		 * @param array $cf The custom field array.
1096
+		 * @since 1.6.6
1097
+		 */
1098
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
+	}
1100
+
1101
+	// Check if there is a custom field key specific filter.
1102
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
+		/**
1104
+		 * Filter the email html by field type key.
1105
+		 *
1106
+		 * @param string $html The html to filter.
1107
+		 * @param string $location The location to output the html.
1108
+		 * @param array $cf The custom field array.
1109
+		 * @since 1.6.6
1110
+		 */
1111
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
+	}
1113
+
1114
+	// If not html then we run the standard output.
1115
+	if(empty($html)){
1116
+
1117
+		global $preview;
1118
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
+			return ''; // Remove Send Enquiry from listings page
1120
+		}
1121
+
1122
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
+
1124
+		if ($cf['htmlvar_name'] == 'geodir_email' && $post->{$cf['htmlvar_name']}) {
1125
+			$b_send_inquiry = '';
1126
+
1127
+			$html = '';
1128
+			if (!$preview) {
1129
+				$b_send_inquiry = 'b_send_inquiry';
1130
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1131
+			}
1132
+
1133
+			$field_icon = geodir_field_icon_proccess($cf);
1134
+			if (strpos($field_icon, 'http') !== false) {
1135
+				$field_icon_af = '';
1136
+			} elseif ($field_icon == '') {
1137
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1138
+			} else {
1139
+				$field_icon_af = $field_icon;
1140
+				$field_icon = '';
1141
+			}
1142
+
1143
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1144
+			$seperator = '';
1145
+			if ($post->{$cf['htmlvar_name']}) {
1146
+				$b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1147
+				$html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1148
+			}
1149
+
1150
+			$html .= '</span></div>';
1151
+
1152
+
1153
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1154
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1155
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1156
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1157
+			}
1158
+
1159
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1160
+
1161
+		} else {
1162
+
1163
+			if ($post->{$cf['htmlvar_name']}) {
1164
+
1165
+				$field_icon = geodir_field_icon_proccess($cf);
1166
+				if (strpos($field_icon, 'http') !== false) {
1167
+					$field_icon_af = '';
1168
+				} elseif ($field_icon == '') {
1169
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1170
+				} else {
1171
+					$field_icon_af = $field_icon;
1172
+					$field_icon = '';
1173
+				}
1174
+
1175
+
1176
+				$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;
1177
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1178
+				$html .= '</span><span class="geodir-email-address-output">';
1179
+				$email = $post->{$cf['htmlvar_name']} ;
1180
+				if($e_split = explode('@',$email)){
1181
+					/**
1182
+					 * Filter email custom field name output.
1183
+					 *
1184
+					 * @since 1.5.3
1185
+					 *
1186
+					 * @param string $email The email string being output.
1187
+					 * @param array $cf Custom field variables array.
1188
+					 */
1189
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1190
+					if($location=='mapbubble'){
1191
+						$html .=  "<a href=\"mailto:$email\">$email_name</a>";
1192
+					}else{
1193
+						$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1194
+					}
1195
+
1196
+				}else{
1197
+					$html .=  $email;
1198
+				}
1199
+				$html .= '</span></div>';
1200
+			}
1201
+
1202
+		}
1203
+
1204
+	}
1205
+
1206
+	return $html;
1207 1207
 }
1208 1208
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1209 1209
 
@@ -1220,136 +1220,136 @@  discard block
 block discarded – undo
1220 1220
  */
1221 1221
 function geodir_cf_file($html,$location,$cf,$p=''){
1222 1222
 
1223
-    // check we have the post value
1224
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1225
-    else{ global $post;}
1226
-
1227
-    if(!is_array($cf) && $cf!=''){
1228
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1229
-        if(!$cf){return NULL;}
1230
-    }
1231
-
1232
-    $html_var = $cf['htmlvar_name'];
1233
-
1234
-    // Check if there is a location specific filter.
1235
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1236
-        /**
1237
-         * Filter the file html by location.
1238
-         *
1239
-         * @param string $html The html to filter.
1240
-         * @param array $cf The custom field array.
1241
-         * @since 1.6.6
1242
-         */
1243
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1244
-    }
1245
-
1246
-    // Check if there is a custom field specific filter.
1247
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1248
-        /**
1249
-         * Filter the file html by individual custom field.
1250
-         *
1251
-         * @param string $html The html to filter.
1252
-         * @param string $location The location to output the html.
1253
-         * @param array $cf The custom field array.
1254
-         * @since 1.6.6
1255
-         */
1256
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1257
-    }
1258
-
1259
-    // Check if there is a custom field key specific filter.
1260
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1261
-        /**
1262
-         * Filter the file html by field type key.
1263
-         *
1264
-         * @param string $html The html to filter.
1265
-         * @param string $location The location to output the html.
1266
-         * @param array $cf The custom field array.
1267
-         * @since 1.6.6
1268
-         */
1269
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1270
-    }
1271
-
1272
-    // If not html then we run the standard output.
1273
-    if(empty($html)){
1274
-
1275
-        if (!empty($post->{$cf['htmlvar_name']})):
1276
-
1277
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1278
-            if (!empty($files)):
1279
-
1280
-                $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1281
-                $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'] : '';
1282
-
1283
-                $file_paths = '';
1284
-                foreach ($files as $file) {
1285
-                    if (!empty($file)) {
1286
-
1287
-                        // $filetype = wp_check_filetype($file);
1288
-
1289
-                        $image_name_arr = explode('/', $file);
1290
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1291
-                        $filename = end($image_name_arr);
1292
-                        $img_name_arr = explode('.', $filename);
1293
-
1294
-                        $arr_file_type = wp_check_filetype($filename);
1295
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1296
-                            continue;
1297
-                        }
1298
-
1299
-                        $uploaded_file_type = $arr_file_type['type'];
1300
-                        $uploaded_file_ext = $arr_file_type['ext'];
1301
-
1302
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1303
-                            continue; // Invalid file type.
1304
-                        }
1305
-
1306
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1307
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1308
-                        $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid');
1309
-
1310
-                        // If the uploaded file is image
1311
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1312
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1313
-                            $file_paths .= '<a href="'.$file.'">';
1314
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1315
-                            $file_paths .= '</a>';
1316
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1317
-                            $file_paths .= '</div>';
1318
-                        }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1319
-                            $ext_path = '_' . $html_var . '_';
1320
-                            $filename = explode($ext_path, $filename);
1321
-                            $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
1322
-                            $file_paths .= do_shortcode('[audio src="'.$file.'" ]');
1323
-                        } else {
1324
-                            $ext_path = '_' . $html_var . '_';
1325
-                            $filename = explode($ext_path, $filename);
1326
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1327
-                        }
1328
-                    }
1329
-                }
1330
-
1331
-                $field_icon = geodir_field_icon_proccess($cf);
1332
-                if (strpos($field_icon, 'http') !== false) {
1333
-                    $field_icon_af = '';
1334
-                } elseif ($field_icon == '') {
1335
-                    $field_icon_af = '';
1336
-                } else {
1337
-                    $field_icon_af = $field_icon;
1338
-                    $field_icon = '';
1339
-                }
1340
-
1341
-                $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;
1342
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1343
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1344
-                $html .= '</span>';
1345
-                $html .= $file_paths . '</div></div>';
1346
-
1347
-            endif;
1348
-        endif;
1349
-
1350
-    }
1351
-
1352
-    return $html;
1223
+	// check we have the post value
1224
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1225
+	else{ global $post;}
1226
+
1227
+	if(!is_array($cf) && $cf!=''){
1228
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1229
+		if(!$cf){return NULL;}
1230
+	}
1231
+
1232
+	$html_var = $cf['htmlvar_name'];
1233
+
1234
+	// Check if there is a location specific filter.
1235
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1236
+		/**
1237
+		 * Filter the file html by location.
1238
+		 *
1239
+		 * @param string $html The html to filter.
1240
+		 * @param array $cf The custom field array.
1241
+		 * @since 1.6.6
1242
+		 */
1243
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1244
+	}
1245
+
1246
+	// Check if there is a custom field specific filter.
1247
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1248
+		/**
1249
+		 * Filter the file html by individual custom field.
1250
+		 *
1251
+		 * @param string $html The html to filter.
1252
+		 * @param string $location The location to output the html.
1253
+		 * @param array $cf The custom field array.
1254
+		 * @since 1.6.6
1255
+		 */
1256
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1257
+	}
1258
+
1259
+	// Check if there is a custom field key specific filter.
1260
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1261
+		/**
1262
+		 * Filter the file html by field type key.
1263
+		 *
1264
+		 * @param string $html The html to filter.
1265
+		 * @param string $location The location to output the html.
1266
+		 * @param array $cf The custom field array.
1267
+		 * @since 1.6.6
1268
+		 */
1269
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1270
+	}
1271
+
1272
+	// If not html then we run the standard output.
1273
+	if(empty($html)){
1274
+
1275
+		if (!empty($post->{$cf['htmlvar_name']})):
1276
+
1277
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1278
+			if (!empty($files)):
1279
+
1280
+				$extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1281
+				$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'] : '';
1282
+
1283
+				$file_paths = '';
1284
+				foreach ($files as $file) {
1285
+					if (!empty($file)) {
1286
+
1287
+						// $filetype = wp_check_filetype($file);
1288
+
1289
+						$image_name_arr = explode('/', $file);
1290
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1291
+						$filename = end($image_name_arr);
1292
+						$img_name_arr = explode('.', $filename);
1293
+
1294
+						$arr_file_type = wp_check_filetype($filename);
1295
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1296
+							continue;
1297
+						}
1298
+
1299
+						$uploaded_file_type = $arr_file_type['type'];
1300
+						$uploaded_file_ext = $arr_file_type['ext'];
1301
+
1302
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1303
+							continue; // Invalid file type.
1304
+						}
1305
+
1306
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1307
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1308
+						$audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid');
1309
+
1310
+						// If the uploaded file is image
1311
+						if (in_array($uploaded_file_type, $image_file_types)) {
1312
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1313
+							$file_paths .= '<a href="'.$file.'">';
1314
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1315
+							$file_paths .= '</a>';
1316
+							//$file_paths .= '<img src="'.$file.'"  />';	
1317
+							$file_paths .= '</div>';
1318
+						}elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1319
+							$ext_path = '_' . $html_var . '_';
1320
+							$filename = explode($ext_path, $filename);
1321
+							$file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
1322
+							$file_paths .= do_shortcode('[audio src="'.$file.'" ]');
1323
+						} else {
1324
+							$ext_path = '_' . $html_var . '_';
1325
+							$filename = explode($ext_path, $filename);
1326
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1327
+						}
1328
+					}
1329
+				}
1330
+
1331
+				$field_icon = geodir_field_icon_proccess($cf);
1332
+				if (strpos($field_icon, 'http') !== false) {
1333
+					$field_icon_af = '';
1334
+				} elseif ($field_icon == '') {
1335
+					$field_icon_af = '';
1336
+				} else {
1337
+					$field_icon_af = $field_icon;
1338
+					$field_icon = '';
1339
+				}
1340
+
1341
+				$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;
1342
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1343
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1344
+				$html .= '</span>';
1345
+				$html .= $file_paths . '</div></div>';
1346
+
1347
+			endif;
1348
+		endif;
1349
+
1350
+	}
1351
+
1352
+	return $html;
1353 1353
 }
1354 1354
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1355 1355
 
@@ -1367,80 +1367,80 @@  discard block
 block discarded – undo
1367 1367
  */
1368 1368
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1369 1369
 
1370
-    // check we have the post value
1371
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1372
-    else{ global $post;}
1373
-
1374
-    if(!is_array($cf) && $cf!=''){
1375
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1376
-        if(!$cf){return NULL;}
1377
-    }
1378
-
1379
-    $html_var = $cf['htmlvar_name'];
1380
-
1381
-    // Check if there is a location specific filter.
1382
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1383
-        /**
1384
-         * Filter the textarea html by location.
1385
-         *
1386
-         * @param string $html The html to filter.
1387
-         * @param array $cf The custom field array.
1388
-         * @since 1.6.6
1389
-         */
1390
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1391
-    }
1392
-
1393
-    // Check if there is a custom field specific filter.
1394
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1395
-        /**
1396
-         * Filter the textarea html by individual custom field.
1397
-         *
1398
-         * @param string $html The html to filter.
1399
-         * @param string $location The location to output the html.
1400
-         * @param array $cf The custom field array.
1401
-         * @since 1.6.6
1402
-         */
1403
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1404
-    }
1405
-
1406
-    // Check if there is a custom field key specific filter.
1407
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1408
-        /**
1409
-         * Filter the textarea html by field type key.
1410
-         *
1411
-         * @param string $html The html to filter.
1412
-         * @param string $location The location to output the html.
1413
-         * @param array $cf The custom field array.
1414
-         * @since 1.6.6
1415
-         */
1416
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1417
-    }
1418
-
1419
-    // If not html then we run the standard output.
1420
-    if(empty($html)){
1421
-
1422
-        if (!empty($post->{$cf['htmlvar_name']})) {
1423
-
1424
-            $field_icon = geodir_field_icon_proccess($cf);
1425
-            if (strpos($field_icon, 'http') !== false) {
1426
-                $field_icon_af = '';
1427
-            } elseif ($field_icon == '') {
1428
-                $field_icon_af = '';
1429
-            } else {
1430
-                $field_icon_af = $field_icon;
1431
-                $field_icon = '';
1432
-            }
1433
-
1434
-
1435
-            $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;
1436
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1437
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1438
-
1439
-        }
1440
-
1441
-    }
1442
-
1443
-    return $html;
1370
+	// check we have the post value
1371
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1372
+	else{ global $post;}
1373
+
1374
+	if(!is_array($cf) && $cf!=''){
1375
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1376
+		if(!$cf){return NULL;}
1377
+	}
1378
+
1379
+	$html_var = $cf['htmlvar_name'];
1380
+
1381
+	// Check if there is a location specific filter.
1382
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1383
+		/**
1384
+		 * Filter the textarea html by location.
1385
+		 *
1386
+		 * @param string $html The html to filter.
1387
+		 * @param array $cf The custom field array.
1388
+		 * @since 1.6.6
1389
+		 */
1390
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1391
+	}
1392
+
1393
+	// Check if there is a custom field specific filter.
1394
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1395
+		/**
1396
+		 * Filter the textarea html by individual custom field.
1397
+		 *
1398
+		 * @param string $html The html to filter.
1399
+		 * @param string $location The location to output the html.
1400
+		 * @param array $cf The custom field array.
1401
+		 * @since 1.6.6
1402
+		 */
1403
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1404
+	}
1405
+
1406
+	// Check if there is a custom field key specific filter.
1407
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1408
+		/**
1409
+		 * Filter the textarea html by field type key.
1410
+		 *
1411
+		 * @param string $html The html to filter.
1412
+		 * @param string $location The location to output the html.
1413
+		 * @param array $cf The custom field array.
1414
+		 * @since 1.6.6
1415
+		 */
1416
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1417
+	}
1418
+
1419
+	// If not html then we run the standard output.
1420
+	if(empty($html)){
1421
+
1422
+		if (!empty($post->{$cf['htmlvar_name']})) {
1423
+
1424
+			$field_icon = geodir_field_icon_proccess($cf);
1425
+			if (strpos($field_icon, 'http') !== false) {
1426
+				$field_icon_af = '';
1427
+			} elseif ($field_icon == '') {
1428
+				$field_icon_af = '';
1429
+			} else {
1430
+				$field_icon_af = $field_icon;
1431
+				$field_icon = '';
1432
+			}
1433
+
1434
+
1435
+			$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;
1436
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1437
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1438
+
1439
+		}
1440
+
1441
+	}
1442
+
1443
+	return $html;
1444 1444
 }
1445 1445
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1446 1446
 
@@ -1458,79 +1458,79 @@  discard block
 block discarded – undo
1458 1458
  */
1459 1459
 function geodir_cf_html($html,$location,$cf,$p=''){
1460 1460
 
1461
-    // check we have the post value
1462
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1463
-    else{ global $post;}
1464
-
1465
-    if(!is_array($cf) && $cf!=''){
1466
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1467
-        if(!$cf){return NULL;}
1468
-    }
1469
-
1470
-    $html_var = $cf['htmlvar_name'];
1471
-
1472
-    // Check if there is a location specific filter.
1473
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1474
-        /**
1475
-         * Filter the html html by location.
1476
-         *
1477
-         * @param string $html The html to filter.
1478
-         * @param array $cf The custom field array.
1479
-         * @since 1.6.6
1480
-         */
1481
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1482
-    }
1483
-
1484
-    // Check if there is a custom field specific filter.
1485
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1486
-        /**
1487
-         * Filter the html html by individual custom field.
1488
-         *
1489
-         * @param string $html The html to filter.
1490
-         * @param string $location The location to output the html.
1491
-         * @param array $cf The custom field array.
1492
-         * @since 1.6.6
1493
-         */
1494
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1495
-    }
1496
-
1497
-    // Check if there is a custom field key specific filter.
1498
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1499
-        /**
1500
-         * Filter the html html by field type key.
1501
-         *
1502
-         * @param string $html The html to filter.
1503
-         * @param string $location The location to output the html.
1504
-         * @param array $cf The custom field array.
1505
-         * @since 1.6.6
1506
-         */
1507
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1508
-    }
1509
-
1510
-    // If not html then we run the standard output.
1511
-    if(empty($html)){
1512
-
1513
-        if (!empty($post->{$cf['htmlvar_name']})) {
1514
-
1515
-            $field_icon = geodir_field_icon_proccess($cf);
1516
-            if (strpos($field_icon, 'http') !== false) {
1517
-                $field_icon_af = '';
1518
-            } elseif ($field_icon == '') {
1519
-                $field_icon_af = '';
1520
-            } else {
1521
-                $field_icon_af = $field_icon;
1522
-                $field_icon = '';
1523
-            }
1524
-
1525
-            $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;
1526
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1527
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1528
-
1529
-        }
1530
-
1531
-    }
1532
-
1533
-    return $html;
1461
+	// check we have the post value
1462
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1463
+	else{ global $post;}
1464
+
1465
+	if(!is_array($cf) && $cf!=''){
1466
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1467
+		if(!$cf){return NULL;}
1468
+	}
1469
+
1470
+	$html_var = $cf['htmlvar_name'];
1471
+
1472
+	// Check if there is a location specific filter.
1473
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1474
+		/**
1475
+		 * Filter the html html by location.
1476
+		 *
1477
+		 * @param string $html The html to filter.
1478
+		 * @param array $cf The custom field array.
1479
+		 * @since 1.6.6
1480
+		 */
1481
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1482
+	}
1483
+
1484
+	// Check if there is a custom field specific filter.
1485
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1486
+		/**
1487
+		 * Filter the html html by individual custom field.
1488
+		 *
1489
+		 * @param string $html The html to filter.
1490
+		 * @param string $location The location to output the html.
1491
+		 * @param array $cf The custom field array.
1492
+		 * @since 1.6.6
1493
+		 */
1494
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1495
+	}
1496
+
1497
+	// Check if there is a custom field key specific filter.
1498
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1499
+		/**
1500
+		 * Filter the html html by field type key.
1501
+		 *
1502
+		 * @param string $html The html to filter.
1503
+		 * @param string $location The location to output the html.
1504
+		 * @param array $cf The custom field array.
1505
+		 * @since 1.6.6
1506
+		 */
1507
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1508
+	}
1509
+
1510
+	// If not html then we run the standard output.
1511
+	if(empty($html)){
1512
+
1513
+		if (!empty($post->{$cf['htmlvar_name']})) {
1514
+
1515
+			$field_icon = geodir_field_icon_proccess($cf);
1516
+			if (strpos($field_icon, 'http') !== false) {
1517
+				$field_icon_af = '';
1518
+			} elseif ($field_icon == '') {
1519
+				$field_icon_af = '';
1520
+			} else {
1521
+				$field_icon_af = $field_icon;
1522
+				$field_icon = '';
1523
+			}
1524
+
1525
+			$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;
1526
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1527
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1528
+
1529
+		}
1530
+
1531
+	}
1532
+
1533
+	return $html;
1534 1534
 }
1535 1535
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1536 1536
 
@@ -1548,113 +1548,113 @@  discard block
 block discarded – undo
1548 1548
  */
1549 1549
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1550 1550
 
1551
-    // check we have the post value
1552
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1553
-    else{ global $post;}
1554
-
1555
-    if(!is_array($cf) && $cf!=''){
1556
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1557
-        if(!$cf){return NULL;}
1558
-    }
1559
-
1560
-    $html_var = $cf['htmlvar_name'];
1561
-
1562
-    // Check if there is a location specific filter.
1563
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1564
-        /**
1565
-         * Filter the taxonomy html by location.
1566
-         *
1567
-         * @param string $html The html to filter.
1568
-         * @param array $cf The custom field array.
1569
-         * @since 1.6.6
1570
-         */
1571
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1572
-    }
1573
-
1574
-    // Check if there is a custom field specific filter.
1575
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1576
-        /**
1577
-         * Filter the taxonomy html by individual custom field.
1578
-         *
1579
-         * @param string $html The html to filter.
1580
-         * @param string $location The location to output the html.
1581
-         * @param array $cf The custom field array.
1582
-         * @since 1.6.6
1583
-         */
1584
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1585
-    }
1586
-
1587
-    // Check if there is a custom field key specific filter.
1588
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1589
-        /**
1590
-         * Filter the taxonomy html by field type key.
1591
-         *
1592
-         * @param string $html The html to filter.
1593
-         * @param string $location The location to output the html.
1594
-         * @param array $cf The custom field array.
1595
-         * @since 1.6.6
1596
-         */
1597
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1598
-    }
1599
-
1600
-    // If not html then we run the standard output.
1601
-    if(empty($html)){
1602
-
1603
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1604
-            $post_taxonomy = $post->post_type . 'category';
1605
-            $field_value = $post->{$html_var};
1606
-            $links = array();
1607
-            $terms = array();
1608
-            $termsOrdered = array();
1609
-            if (!is_array($field_value)) {
1610
-                $field_value = explode(",", trim($field_value, ","));
1611
-            }
1612
-
1613
-            $field_value = array_unique($field_value);
1614
-
1615
-            if (!empty($field_value)) {
1616
-                foreach ($field_value as $term) {
1617
-                    $term = trim($term);
1618
-
1619
-                    if ($term != '') {
1620
-                        $term = get_term_by('id', $term, $html_var);
1621
-                        if (is_object($term)) {
1622
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1623
-                            $terms[] = $term;
1624
-                        }
1625
-                    }
1626
-                }
1627
-                if (!empty($links)) {
1628
-                    // order alphabetically
1629
-                    asort($links);
1630
-                    foreach (array_keys($links) as $key) {
1631
-                        $termsOrdered[$key] = $terms[$key];
1632
-                    }
1633
-                    $terms = $termsOrdered;
1634
-                }
1635
-            }
1636
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1637
-
1638
-            if ($html_value != '') {
1639
-                $field_icon = geodir_field_icon_proccess($cf);
1640
-                if (strpos($field_icon, 'http') !== false) {
1641
-                    $field_icon_af = '';
1642
-                } else if ($field_icon == '') {
1643
-                    $field_icon_af = '';
1644
-                } else {
1645
-                    $field_icon_af = $field_icon;
1646
-                    $field_icon = '';
1647
-                }
1648
-
1649
-                $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;
1650
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1651
-                $html .= '</span> ' . $html_value . '</div>';
1652
-            }
1653
-        }
1654
-
1655
-    }
1656
-
1657
-    return $html;
1551
+	// check we have the post value
1552
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1553
+	else{ global $post;}
1554
+
1555
+	if(!is_array($cf) && $cf!=''){
1556
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1557
+		if(!$cf){return NULL;}
1558
+	}
1559
+
1560
+	$html_var = $cf['htmlvar_name'];
1561
+
1562
+	// Check if there is a location specific filter.
1563
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1564
+		/**
1565
+		 * Filter the taxonomy html by location.
1566
+		 *
1567
+		 * @param string $html The html to filter.
1568
+		 * @param array $cf The custom field array.
1569
+		 * @since 1.6.6
1570
+		 */
1571
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1572
+	}
1573
+
1574
+	// Check if there is a custom field specific filter.
1575
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1576
+		/**
1577
+		 * Filter the taxonomy html by individual custom field.
1578
+		 *
1579
+		 * @param string $html The html to filter.
1580
+		 * @param string $location The location to output the html.
1581
+		 * @param array $cf The custom field array.
1582
+		 * @since 1.6.6
1583
+		 */
1584
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1585
+	}
1586
+
1587
+	// Check if there is a custom field key specific filter.
1588
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1589
+		/**
1590
+		 * Filter the taxonomy html by field type key.
1591
+		 *
1592
+		 * @param string $html The html to filter.
1593
+		 * @param string $location The location to output the html.
1594
+		 * @param array $cf The custom field array.
1595
+		 * @since 1.6.6
1596
+		 */
1597
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1598
+	}
1599
+
1600
+	// If not html then we run the standard output.
1601
+	if(empty($html)){
1602
+
1603
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1604
+			$post_taxonomy = $post->post_type . 'category';
1605
+			$field_value = $post->{$html_var};
1606
+			$links = array();
1607
+			$terms = array();
1608
+			$termsOrdered = array();
1609
+			if (!is_array($field_value)) {
1610
+				$field_value = explode(",", trim($field_value, ","));
1611
+			}
1612
+
1613
+			$field_value = array_unique($field_value);
1614
+
1615
+			if (!empty($field_value)) {
1616
+				foreach ($field_value as $term) {
1617
+					$term = trim($term);
1618
+
1619
+					if ($term != '') {
1620
+						$term = get_term_by('id', $term, $html_var);
1621
+						if (is_object($term)) {
1622
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1623
+							$terms[] = $term;
1624
+						}
1625
+					}
1626
+				}
1627
+				if (!empty($links)) {
1628
+					// order alphabetically
1629
+					asort($links);
1630
+					foreach (array_keys($links) as $key) {
1631
+						$termsOrdered[$key] = $terms[$key];
1632
+					}
1633
+					$terms = $termsOrdered;
1634
+				}
1635
+			}
1636
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1637
+
1638
+			if ($html_value != '') {
1639
+				$field_icon = geodir_field_icon_proccess($cf);
1640
+				if (strpos($field_icon, 'http') !== false) {
1641
+					$field_icon_af = '';
1642
+				} else if ($field_icon == '') {
1643
+					$field_icon_af = '';
1644
+				} else {
1645
+					$field_icon_af = $field_icon;
1646
+					$field_icon = '';
1647
+				}
1648
+
1649
+				$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;
1650
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1651
+				$html .= '</span> ' . $html_value . '</div>';
1652
+			}
1653
+		}
1654
+
1655
+	}
1656
+
1657
+	return $html;
1658 1658
 }
1659 1659
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1660 1660
 
@@ -1672,176 +1672,176 @@  discard block
 block discarded – undo
1672 1672
  */
1673 1673
 function geodir_cf_address($html,$location,$cf,$p=''){
1674 1674
 
1675
-    // check we have the post value
1676
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1677
-    else{ global $post;}
1678
-
1679
-    if(!is_array($cf) && $cf!=''){
1680
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
-        if(!$cf){return NULL;}
1682
-    }
1683
-
1684
-    $html_var = $cf['htmlvar_name'];
1685
-
1686
-    // Check if there is a location specific filter.
1687
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1688
-        /**
1689
-         * Filter the address html by location.
1690
-         *
1691
-         * @param string $html The html to filter.
1692
-         * @param array $cf The custom field array.
1693
-         * @since 1.6.6
1694
-         */
1695
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1696
-    }
1697
-
1698
-    // Check if there is a custom field specific filter.
1699
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1700
-        /**
1701
-         * Filter the address html by individual custom field.
1702
-         *
1703
-         * @param string $html The html to filter.
1704
-         * @param string $location The location to output the html.
1705
-         * @param array $cf The custom field array.
1706
-         * @since 1.6.6
1707
-         */
1708
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1709
-    }
1710
-
1711
-    // Check if there is a custom field key specific filter.
1712
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1713
-        /**
1714
-         * Filter the address html by field type key.
1715
-         *
1716
-         * @param string $html The html to filter.
1717
-         * @param string $location The location to output the html.
1718
-         * @param array $cf The custom field array.
1719
-         * @since 1.6.6
1720
-         */
1721
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1722
-    }
1723
-
1724
-    // If not html then we run the standard output.
1725
-    if(empty($html)){
1726
-
1727
-        global $preview;
1728
-        $html_var = $cf['htmlvar_name'] . '_address';
1729
-
1730
-        if ($cf['extra_fields']) {
1731
-
1732
-            $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1733
-
1734
-            $addition_fields = '';
1735
-
1736
-            if (!empty($extra_fields)) {
1737
-
1738
-                $show_city_in_address = false;
1739
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1740
-                    $show_city_in_address = true;
1741
-                }
1742
-                /**
1743
-                 * Filter "show city in address" value.
1744
-                 *
1745
-                 * @since 1.0.0
1746
-                 */
1747
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1748
-
1749
-
1750
-                $show_region_in_address = false;
1751
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1752
-                    $show_region_in_address = true;
1753
-                }
1754
-                /**
1755
-                 * Filter "show region in address" value.
1756
-                 *
1757
-                 * @since 1.6.6
1758
-                 */
1759
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1760
-
1761
-                $show_country_in_address = false;
1762
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1763
-                    $show_country_in_address = true;
1764
-                }
1765
-                /**
1766
-                 * Filter "show country in address" value.
1767
-                 *
1768
-                 * @since 1.6.6
1769
-                 */
1770
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1771
-
1772
-                $show_zip_in_address = false;
1773
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1774
-                    $show_zip_in_address = true;
1775
-                }
1776
-                /**
1777
-                 * Filter "show zip in address" value.
1778
-                 *
1779
-                 * @since 1.6.6
1780
-                 */
1781
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1782
-
1783
-
1784
-            }
1785
-
1786
-        }
1787
-
1788
-
1789
-        if ($post->{$html_var}) {
1790
-
1791
-            $field_icon = geodir_field_icon_proccess( $cf );
1792
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1793
-                $field_icon_af = '';
1794
-            } elseif ( $field_icon == '' ) {
1795
-                $field_icon_af = '<i class="fa fa-home"></i>';
1796
-            } else {
1797
-                $field_icon_af = $field_icon;
1798
-                $field_icon    = '';
1799
-            }
1675
+	// check we have the post value
1676
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1677
+	else{ global $post;}
1678
+
1679
+	if(!is_array($cf) && $cf!=''){
1680
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
+		if(!$cf){return NULL;}
1682
+	}
1683
+
1684
+	$html_var = $cf['htmlvar_name'];
1685
+
1686
+	// Check if there is a location specific filter.
1687
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1688
+		/**
1689
+		 * Filter the address html by location.
1690
+		 *
1691
+		 * @param string $html The html to filter.
1692
+		 * @param array $cf The custom field array.
1693
+		 * @since 1.6.6
1694
+		 */
1695
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1696
+	}
1697
+
1698
+	// Check if there is a custom field specific filter.
1699
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1700
+		/**
1701
+		 * Filter the address html by individual custom field.
1702
+		 *
1703
+		 * @param string $html The html to filter.
1704
+		 * @param string $location The location to output the html.
1705
+		 * @param array $cf The custom field array.
1706
+		 * @since 1.6.6
1707
+		 */
1708
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1709
+	}
1710
+
1711
+	// Check if there is a custom field key specific filter.
1712
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1713
+		/**
1714
+		 * Filter the address html by field type key.
1715
+		 *
1716
+		 * @param string $html The html to filter.
1717
+		 * @param string $location The location to output the html.
1718
+		 * @param array $cf The custom field array.
1719
+		 * @since 1.6.6
1720
+		 */
1721
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1722
+	}
1723
+
1724
+	// If not html then we run the standard output.
1725
+	if(empty($html)){
1726
+
1727
+		global $preview;
1728
+		$html_var = $cf['htmlvar_name'] . '_address';
1729
+
1730
+		if ($cf['extra_fields']) {
1731
+
1732
+			$extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1733
+
1734
+			$addition_fields = '';
1735
+
1736
+			if (!empty($extra_fields)) {
1737
+
1738
+				$show_city_in_address = false;
1739
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1740
+					$show_city_in_address = true;
1741
+				}
1742
+				/**
1743
+				 * Filter "show city in address" value.
1744
+				 *
1745
+				 * @since 1.0.0
1746
+				 */
1747
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1748
+
1749
+
1750
+				$show_region_in_address = false;
1751
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1752
+					$show_region_in_address = true;
1753
+				}
1754
+				/**
1755
+				 * Filter "show region in address" value.
1756
+				 *
1757
+				 * @since 1.6.6
1758
+				 */
1759
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1760
+
1761
+				$show_country_in_address = false;
1762
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1763
+					$show_country_in_address = true;
1764
+				}
1765
+				/**
1766
+				 * Filter "show country in address" value.
1767
+				 *
1768
+				 * @since 1.6.6
1769
+				 */
1770
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1771
+
1772
+				$show_zip_in_address = false;
1773
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1774
+					$show_zip_in_address = true;
1775
+				}
1776
+				/**
1777
+				 * Filter "show zip in address" value.
1778
+				 *
1779
+				 * @since 1.6.6
1780
+				 */
1781
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1782
+
1783
+
1784
+			}
1785
+
1786
+		}
1787
+
1788
+
1789
+		if ($post->{$html_var}) {
1790
+
1791
+			$field_icon = geodir_field_icon_proccess( $cf );
1792
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1793
+				$field_icon_af = '';
1794
+			} elseif ( $field_icon == '' ) {
1795
+				$field_icon_af = '<i class="fa fa-home"></i>';
1796
+			} else {
1797
+				$field_icon_af = $field_icon;
1798
+				$field_icon    = '';
1799
+			}
1800 1800
             
1801
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1802
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1803
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1804
-            $html .= '</span>';
1801
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1802
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1803
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1804
+			$html .= '</span>';
1805 1805
             
1806
-            $address_fields = array();
1807
-
1808
-            if ( isset($post->post_address) ) {
1809
-                $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>';
1810
-            }
1811
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
-                $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>';
1813
-            }
1814
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
-                $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>';
1816
-            }
1817
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
-                $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>';
1819
-            }
1820
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
-                $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>';
1822
-            }
1806
+			$address_fields = array();
1807
+
1808
+			if ( isset($post->post_address) ) {
1809
+				$address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>';
1810
+			}
1811
+			if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
+				$address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>';
1813
+			}
1814
+			if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
+				$address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>';
1816
+			}
1817
+			if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
+				$address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>';
1819
+			}
1820
+			if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
+				$address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>';
1822
+			}
1823 1823
             
1824
-            /**
1825
-             * Filter the address fields array being displayed.
1826
-             *
1827
-             * @param array $address_fields The array of address fields.
1828
-             * @param object $post The current post object.
1829
-             * @param array $cf The custom field array details.
1830
-             * @param string $location The location to output the html.
1831
-             * 
1832
-             * @since 1.6.21
1833
-             */
1834
-            $address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location);
1824
+			/**
1825
+			 * Filter the address fields array being displayed.
1826
+			 *
1827
+			 * @param array $address_fields The array of address fields.
1828
+			 * @param object $post The current post object.
1829
+			 * @param array $cf The custom field array details.
1830
+			 * @param string $location The location to output the html.
1831
+			 * 
1832
+			 * @since 1.6.21
1833
+			 */
1834
+			$address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location);
1835 1835
             
1836
-            if (!empty($address_fields) && is_array($address_fields)) {
1837
-                $address_fields = array_values($address_fields);
1838
-                $html .= implode('<br>', $address_fields);
1839
-            }
1836
+			if (!empty($address_fields) && is_array($address_fields)) {
1837
+				$address_fields = array_values($address_fields);
1838
+				$html .= implode('<br>', $address_fields);
1839
+			}
1840 1840
             
1841
-            $html .= '</div>';
1842
-        }
1843
-    }
1841
+			$html .= '</div>';
1842
+		}
1843
+	}
1844 1844
 
1845
-    return $html;
1845
+	return $html;
1846 1846
 }
1847 1847
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1848 1848
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/ajax_handler_functions.php 1 patch
Indentation   +341 added lines, -341 removed lines patch added patch discarded remove patch
@@ -16,19 +16,19 @@  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 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 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
-    }
31
+	}
32 32
 
33 33
 }
34 34
 
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
  */
42 42
 function geodir_on_wp()
43 43
 {
44
-    if(geodir_is_page('login')) {
45
-        geodir_user_signup();
46
-    }
44
+	if(geodir_is_page('login')) {
45
+		geodir_user_signup();
46
+	}
47 47
 
48 48
 }
49 49
 
@@ -57,36 +57,36 @@  discard block
 block discarded – undo
57 57
  */
58 58
 function geodir_on_init()
59 59
 {
60
-    /**
61
-     * Called on the wp_init WP hook at the start of the geodir_on_init() function.
62
-     *
63
-     * @since 1.0.0
64
-     */
65
-    do_action('giodir_handle_request');
66
-    global $wpdb;
60
+	/**
61
+	 * Called on the wp_init WP hook at the start of the geodir_on_init() function.
62
+	 *
63
+	 * @since 1.0.0
64
+	 */
65
+	do_action('giodir_handle_request');
66
+	global $wpdb;
67 67
 
68 68
 
69 69
 
70 70
 
71
-    if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) {
72
-        show_admin_bar(false);
73
-    }
71
+	if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) {
72
+		show_admin_bar(false);
73
+	}
74 74
 
75 75
 
76
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
77
-        /**
78
-         * Contains map marker functions.
79
-         *
80
-         * @since 1.0.0
81
-         * @package GeoDirectory
82
-         */
83
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
84
-        die;
85
-    }
76
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
77
+		/**
78
+		 * Contains map marker functions.
79
+		 *
80
+		 * @since 1.0.0
81
+		 * @package GeoDirectory
82
+		 */
83
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
84
+		die;
85
+	}
86 86
     
87
-    if ( class_exists( 'WPSEO_Frontend' ) && !is_admin() ) {
88
-        add_action( 'template_redirect', 'geodir_remove_yoast_seo_metas' );
89
-    }
87
+	if ( class_exists( 'WPSEO_Frontend' ) && !is_admin() ) {
88
+		add_action( 'template_redirect', 'geodir_remove_yoast_seo_metas' );
89
+	}
90 90
 }
91 91
 
92 92
 
@@ -103,328 +103,328 @@  discard block
 block discarded – undo
103 103
  * @todo check if nonce is required here and if so add one.
104 104
  */
105 105
 function geodir_ajax_handler() {
106
-    global $wpdb, $gd_session,$post;
106
+	global $wpdb, $gd_session,$post;
107 107
 
108
-    if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
108
+	if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
109 109
 		$gd_session->set('gd_listing_view', $_REQUEST['gd_listing_view']);
110
-        echo '1';
111
-    }
112
-
113
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
114
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
115
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
116
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
117
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
118
-    }
119
-
120
-    if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
121
-        if (current_user_can('manage_options')) {
122
-            /**
123
-             * Contains admin ajax handling functions.
124
-             *
125
-             * @since 1.0.0
126
-             * @package GeoDirectory
127
-             */
128
-            include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
129
-        } else {
130
-            wp_redirect(geodir_login_url());
131
-            gd_die();
132
-        }
133
-    }
134
-
135
-    if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
136
-        if (current_user_can('manage_options')) {
137
-            switch ($_REQUEST['geodir_autofill']):
138
-                case "geodir_dummy_delete" :
139
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
140
-                        return;
141
-
142
-                    $datatype = isset($_REQUEST['datatype']) ? sanitize_key($_REQUEST['datatype']) : '';
143
-                    if (isset($_REQUEST['posttype']))
144
-                        /**
145
-                         * Used to delete the dummy post data per post type.
146
-                         *
147
-                         * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
148
-                         *
149
-                         * @since 1.6.11
150
-                         * @param string $posttype The post type to insert.
151
-                         * @param string $datatype The type of dummy data to insert.
152
-                         */
153
-                        do_action('geodir_delete_dummy_posts' ,sanitize_key($_REQUEST['posttype']),$datatype);
154
-                    break;
155
-                case "geodir_dummy_insert" :
156
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
157
-                        return;
158
-
159
-                    global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
160
-                    $city_bound_lat1 = $_REQUEST['city_bound_lat1'];
161
-                    $city_bound_lng1 = $_REQUEST['city_bound_lng1'];
162
-                    $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
163
-                    $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
164
-
165
-                    if (isset($_REQUEST['posttype'])){
166
-                        /**
167
-                         * Used to insert the dummy post data per post type.
168
-                         *
169
-                         * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
170
-                         *
171
-                         * @since 1.6.11
172
-                         * @param string $posttype The post type to insert.
173
-                         * @param string $datatype The type of dummy data to insert.
174
-                         * @param int $post_index The item number to insert.
175
-                         */
176
-                        do_action('geodir_insert_dummy_posts',sanitize_key($_REQUEST['posttype']),sanitize_key($_REQUEST['datatype']),absint($_REQUEST['insert_dummy_post_index']));
177
-                    }
178
-
179
-
180
-                    break;
181
-            endswitch;
182
-        } else {
183
-            wp_redirect(geodir_login_url());
184
-            exit();
185
-        }
186
-    }
187
-
188
-    if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
189
-
190
-        if ($_REQUEST['popuptype'] == 'b_send_inquiry') {
191
-            $template = locate_template(array("geodirectory/popup-forms.php"));
192
-            if (!$template) {
193
-                $template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
194
-            }
195
-            require_once($template);
196
-        }
197
-
198
-        gd_die();
199
-    }
200
-
201
-    /*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
110
+		echo '1';
111
+	}
112
+
113
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
114
+		if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
115
+			geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
116
+		else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
117
+			geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
118
+	}
119
+
120
+	if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
121
+		if (current_user_can('manage_options')) {
122
+			/**
123
+			 * Contains admin ajax handling functions.
124
+			 *
125
+			 * @since 1.0.0
126
+			 * @package GeoDirectory
127
+			 */
128
+			include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
129
+		} else {
130
+			wp_redirect(geodir_login_url());
131
+			gd_die();
132
+		}
133
+	}
134
+
135
+	if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
136
+		if (current_user_can('manage_options')) {
137
+			switch ($_REQUEST['geodir_autofill']):
138
+				case "geodir_dummy_delete" :
139
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
140
+						return;
141
+
142
+					$datatype = isset($_REQUEST['datatype']) ? sanitize_key($_REQUEST['datatype']) : '';
143
+					if (isset($_REQUEST['posttype']))
144
+						/**
145
+						 * Used to delete the dummy post data per post type.
146
+						 *
147
+						 * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
148
+						 *
149
+						 * @since 1.6.11
150
+						 * @param string $posttype The post type to insert.
151
+						 * @param string $datatype The type of dummy data to insert.
152
+						 */
153
+						do_action('geodir_delete_dummy_posts' ,sanitize_key($_REQUEST['posttype']),$datatype);
154
+					break;
155
+				case "geodir_dummy_insert" :
156
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
157
+						return;
158
+
159
+					global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
160
+					$city_bound_lat1 = $_REQUEST['city_bound_lat1'];
161
+					$city_bound_lng1 = $_REQUEST['city_bound_lng1'];
162
+					$city_bound_lat2 = $_REQUEST['city_bound_lat2'];
163
+					$city_bound_lng2 = $_REQUEST['city_bound_lng2'];
164
+
165
+					if (isset($_REQUEST['posttype'])){
166
+						/**
167
+						 * Used to insert the dummy post data per post type.
168
+						 *
169
+						 * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
170
+						 *
171
+						 * @since 1.6.11
172
+						 * @param string $posttype The post type to insert.
173
+						 * @param string $datatype The type of dummy data to insert.
174
+						 * @param int $post_index The item number to insert.
175
+						 */
176
+						do_action('geodir_insert_dummy_posts',sanitize_key($_REQUEST['posttype']),sanitize_key($_REQUEST['datatype']),absint($_REQUEST['insert_dummy_post_index']));
177
+					}
178
+
179
+
180
+					break;
181
+			endswitch;
182
+		} else {
183
+			wp_redirect(geodir_login_url());
184
+			exit();
185
+		}
186
+	}
187
+
188
+	if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
189
+
190
+		if ($_REQUEST['popuptype'] == 'b_send_inquiry') {
191
+			$template = locate_template(array("geodirectory/popup-forms.php"));
192
+			if (!$template) {
193
+				$template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
194
+			}
195
+			require_once($template);
196
+		}
197
+
198
+		gd_die();
199
+	}
200
+
201
+	/*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
202 202
         include_once ( geodir_plugin_path() . '/geodirectory-templates/advance-search-form.php');
203 203
     }*/
204 204
 
205
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
206
-        /**
207
-         * Contains map marker functions.
208
-         *
209
-         * @since 1.0.0
210
-         * @package GeoDirectory
211
-         */
212
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
213
-    }
214
-
215
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
216
-        if (is_user_logged_in()) {
217
-            switch ($_REQUEST['ajax_action']):
218
-                case "add" :
219
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
220
-                    break;
221
-                case "remove" :
222
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
223
-                    break;
224
-            endswitch;
225
-        } else {
226
-            wp_redirect(geodir_login_url());
227
-            exit();
228
-        }
229
-    }
230
-
231
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
232
-
233
-        $is_current_user_owner = true;
234
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
235
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
236
-        }
237
-
238
-        $request = $gd_session->get('listing');
239
-
240
-        if (is_user_logged_in() && $is_current_user_owner) {
241
-
242
-            switch ($_REQUEST['ajax_action']):
243
-                case "add":
244
-                case "update":
245
-
246
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
247
-                        $last_id = geodir_save_listing();
248
-
249
-                        if ($last_id) {
250
-                            //$redirect_to = get_permalink( $last_id );
251
-                            $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
252
-
253
-                        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
254
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
255
-                            $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
256
-                        } else
257
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
258
-
259
-                        wp_redirect($redirect_to);
260
-                    } else {
261
-                        $gd_session->un_set('listing');
262
-                        wp_redirect(home_url());
263
-                    }
264
-
265
-                    break;
266
-                case "cancel" :
267
-
268
-                    $gd_session->un_set('listing');
269
-
270
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
271
-                        wp_redirect(get_permalink($_REQUEST['pid']));
272
-                    else {
273
-                        geodir_remove_temp_images();
274
-                        wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
275
-                    }
276
-
277
-                    break;
278
-
279
-                case "publish" :
280
-
281
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
282
-
283
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
284
-                            $new_post = array();
285
-                            $new_post['ID'] = $_REQUEST['pid'];
286
-
287
-                            $lastid = wp_update_post($new_post);
288
-
289
-                            $gd_session->un_set('listing');
290
-                            wp_redirect(get_permalink($lastid));
291
-                        } else {
292
-                            $last_id = geodir_save_listing();
293
-
294
-                            if ($last_id) {
295
-                                //$redirect_to = get_permalink( $last_id );
296
-                                $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
297
-                            } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
298
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
299
-                                $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
300
-                            } else
301
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
302
-
303
-                            $gd_session->un_set('listing');
304
-                            wp_redirect($redirect_to);
305
-                        }
306
-                    } else {
307
-                        $gd_session->un_set('listing');
308
-                        wp_redirect(home_url());
309
-                    }
310
-
311
-                    break;
312
-                case "delete" :
313
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
314
-                        global $current_user;
315
-
316
-                        if (get_option('geodir_disable_perm_delete')) {
317
-                            $lastid = wp_trash_post($_REQUEST['pid']);
318
-                        } else {
319
-                            $lastid = wp_delete_post($_REQUEST['pid']);
320
-                        }
321
-
322
-                        if ($lastid && !is_wp_error($lastid))
323
-                            wp_redirect($_SERVER['HTTP_REFERER']);
324
-
325
-                        //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
326
-                    }
327
-                    break;
328
-            endswitch;
329
-
330
-            $gd_session->un_set('listing');
331
-        } else {
332
-            $gd_session->un_set('listing');
333
-            wp_redirect(geodir_login_url());
334
-            exit();
335
-        }
336
-    }
337
-
338
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
339
-        /**
340
-         * Contains registration and login functions.
341
-         * @todo Fix the file path.
342
-         *
343
-         * @since 1.0.0
344
-         * @package GeoDirectory
345
-         */
346
-        include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
347
-    }
348
-
349
-    if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
350
-        $args = array('taxonomy' => sanitize_text_field($_REQUEST['term']));
351
-        if (!empty($_REQUEST['parent_only'])) {
352
-            $args['parent'] = 0;
353
-        }
354
-        $terms_o = get_terms($args);
355
-
356
-        // Skip terms which has no listing
357
-        if (!empty($terms_o)) {
358
-            $filter_terms = array();
359
-
360
-            foreach ($terms_o as $term) {
361
-                if (isset($term->count) && $term->count > 0) {
362
-                    $filter_terms[] = $term;
363
-                }
364
-            }
365
-            $terms_o = $filter_terms;
366
-        }
367
-
368
-        $terms = geodir_sort_terms($terms_o, 'count');
369
-        geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
370
-        exit();
371
-    }
205
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
206
+		/**
207
+		 * Contains map marker functions.
208
+		 *
209
+		 * @since 1.0.0
210
+		 * @package GeoDirectory
211
+		 */
212
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
213
+	}
214
+
215
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
216
+		if (is_user_logged_in()) {
217
+			switch ($_REQUEST['ajax_action']):
218
+				case "add" :
219
+					geodir_add_to_favorite((int)$_REQUEST['pid']);
220
+					break;
221
+				case "remove" :
222
+					geodir_remove_from_favorite((int)$_REQUEST['pid']);
223
+					break;
224
+			endswitch;
225
+		} else {
226
+			wp_redirect(geodir_login_url());
227
+			exit();
228
+		}
229
+	}
230
+
231
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
232
+
233
+		$is_current_user_owner = true;
234
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
235
+			$is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
236
+		}
237
+
238
+		$request = $gd_session->get('listing');
239
+
240
+		if (is_user_logged_in() && $is_current_user_owner) {
241
+
242
+			switch ($_REQUEST['ajax_action']):
243
+				case "add":
244
+				case "update":
245
+
246
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
247
+						$last_id = geodir_save_listing();
248
+
249
+						if ($last_id) {
250
+							//$redirect_to = get_permalink( $last_id );
251
+							$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
252
+
253
+						} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
254
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
255
+							$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
256
+						} else
257
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
258
+
259
+						wp_redirect($redirect_to);
260
+					} else {
261
+						$gd_session->un_set('listing');
262
+						wp_redirect(home_url());
263
+					}
264
+
265
+					break;
266
+				case "cancel" :
267
+
268
+					$gd_session->un_set('listing');
269
+
270
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
271
+						wp_redirect(get_permalink($_REQUEST['pid']));
272
+					else {
273
+						geodir_remove_temp_images();
274
+						wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
275
+					}
276
+
277
+					break;
278
+
279
+				case "publish" :
280
+
281
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
282
+
283
+						if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
284
+							$new_post = array();
285
+							$new_post['ID'] = $_REQUEST['pid'];
286
+
287
+							$lastid = wp_update_post($new_post);
288
+
289
+							$gd_session->un_set('listing');
290
+							wp_redirect(get_permalink($lastid));
291
+						} else {
292
+							$last_id = geodir_save_listing();
293
+
294
+							if ($last_id) {
295
+								//$redirect_to = get_permalink( $last_id );
296
+								$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
297
+							} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
298
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
299
+								$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
300
+							} else
301
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
302
+
303
+							$gd_session->un_set('listing');
304
+							wp_redirect($redirect_to);
305
+						}
306
+					} else {
307
+						$gd_session->un_set('listing');
308
+						wp_redirect(home_url());
309
+					}
310
+
311
+					break;
312
+				case "delete" :
313
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
314
+						global $current_user;
315
+
316
+						if (get_option('geodir_disable_perm_delete')) {
317
+							$lastid = wp_trash_post($_REQUEST['pid']);
318
+						} else {
319
+							$lastid = wp_delete_post($_REQUEST['pid']);
320
+						}
321
+
322
+						if ($lastid && !is_wp_error($lastid))
323
+							wp_redirect($_SERVER['HTTP_REFERER']);
324
+
325
+						//wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
326
+					}
327
+					break;
328
+			endswitch;
329
+
330
+			$gd_session->un_set('listing');
331
+		} else {
332
+			$gd_session->un_set('listing');
333
+			wp_redirect(geodir_login_url());
334
+			exit();
335
+		}
336
+	}
337
+
338
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
339
+		/**
340
+		 * Contains registration and login functions.
341
+		 * @todo Fix the file path.
342
+		 *
343
+		 * @since 1.0.0
344
+		 * @package GeoDirectory
345
+		 */
346
+		include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
347
+	}
348
+
349
+	if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
350
+		$args = array('taxonomy' => sanitize_text_field($_REQUEST['term']));
351
+		if (!empty($_REQUEST['parent_only'])) {
352
+			$args['parent'] = 0;
353
+		}
354
+		$terms_o = get_terms($args);
355
+
356
+		// Skip terms which has no listing
357
+		if (!empty($terms_o)) {
358
+			$filter_terms = array();
359
+
360
+			foreach ($terms_o as $term) {
361
+				if (isset($term->count) && $term->count > 0) {
362
+					$filter_terms[] = $term;
363
+				}
364
+			}
365
+			$terms_o = $filter_terms;
366
+		}
367
+
368
+		$terms = geodir_sort_terms($terms_o, 'count');
369
+		geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
370
+		exit();
371
+	}
372 372
     
373
-    if ( !empty($_REQUEST['geodir_ajax'] ) && $_REQUEST['geodir_ajax'] == 'duplicate' && geodir_is_wpml() ) {
374
-        if ( !empty( $_REQUEST['_nonce'] ) && wp_verify_nonce( $_REQUEST['_nonce'], 'geodir_duplicate_nonce' ) ) {
375
-            $json = array();
376
-            $json['success'] = false;
373
+	if ( !empty($_REQUEST['geodir_ajax'] ) && $_REQUEST['geodir_ajax'] == 'duplicate' && geodir_is_wpml() ) {
374
+		if ( !empty( $_REQUEST['_nonce'] ) && wp_verify_nonce( $_REQUEST['_nonce'], 'geodir_duplicate_nonce' ) ) {
375
+			$json = array();
376
+			$json['success'] = false;
377 377
             
378
-            $post_id = !empty( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : 0;
379
-            $langs = !empty( $_REQUEST['dups'] ) ? explode( ',', sanitize_text_field( $_REQUEST['dups'] ) ) : array();
378
+			$post_id = !empty( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : 0;
379
+			$langs = !empty( $_REQUEST['dups'] ) ? explode( ',', sanitize_text_field( $_REQUEST['dups'] ) ) : array();
380 380
             
381
-            if ( !empty( $post_id ) && !empty( $langs ) ) {
382
-                if ( geodir_wpml_allowed_to_duplicate( $post_id ) ) {
383
-                    global $sitepress;
381
+			if ( !empty( $post_id ) && !empty( $langs ) ) {
382
+				if ( geodir_wpml_allowed_to_duplicate( $post_id ) ) {
383
+					global $sitepress;
384 384
                     
385
-                    $element_type = 'post_' . get_post_type( $post_id );
386
-                    $master_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
385
+					$element_type = 'post_' . get_post_type( $post_id );
386
+					$master_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
387 387
                     
388
-                    if ( $master_post_id == $post_id ) {
389
-                        $_REQUEST['icl_ajx_action'] = 'make_duplicates';
388
+					if ( $master_post_id == $post_id ) {
389
+						$_REQUEST['icl_ajx_action'] = 'make_duplicates';
390 390
                         
391
-                        foreach ( $langs as $lang ) {
392
-                            $return = $sitepress->make_duplicate( $master_post_id, $lang );
393
-                        }
394
-                        $json['success'] = true;
395
-                    } else {
396
-                        $json['error'] = __( 'Translation can be done from original listing only.', 'geodirectory' );
397
-                    }
398
-                } else {
399
-                    $json['error'] = __( 'You are not allowed to translate this listing.', 'geodirectory' );
400
-                }
401
-            }
391
+						foreach ( $langs as $lang ) {
392
+							$return = $sitepress->make_duplicate( $master_post_id, $lang );
393
+						}
394
+						$json['success'] = true;
395
+					} else {
396
+						$json['error'] = __( 'Translation can be done from original listing only.', 'geodirectory' );
397
+					}
398
+				} else {
399
+					$json['error'] = __( 'You are not allowed to translate this listing.', 'geodirectory' );
400
+				}
401
+			}
402 402
             
403
-            wp_send_json( $json );
404
-        }
405
-    }
403
+			wp_send_json( $json );
404
+		}
405
+	}
406 406
 
407
-    gd_die();
407
+	gd_die();
408 408
 }
409 409
 
410 410
 
411 411
 function geodir_show_ga_stats(){
412
-    if (isset($_REQUEST['ga_start'])) {
413
-        $ga_start = $_REQUEST['ga_start'];
414
-    } else {
415
-        $ga_start = '';
416
-    }
417
-    if (isset($_REQUEST['ga_end'])) {
418
-        $ga_end = $_REQUEST['ga_end'];
419
-    } else {
420
-        $ga_end = '';
421
-    }
422
-    try {
423
-        geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
424
-    } catch (Exception $e) {
425
-        geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
426
-    }
427
-    die;
412
+	if (isset($_REQUEST['ga_start'])) {
413
+		$ga_start = $_REQUEST['ga_start'];
414
+	} else {
415
+		$ga_start = '';
416
+	}
417
+	if (isset($_REQUEST['ga_end'])) {
418
+		$ga_end = $_REQUEST['ga_end'];
419
+	} else {
420
+		$ga_end = '';
421
+	}
422
+	try {
423
+		geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
424
+	} catch (Exception $e) {
425
+		geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
426
+	}
427
+	die;
428 428
 }
429 429
 add_action( 'wp_ajax_gdga', 'geodir_show_ga_stats' );
430 430
 add_action( 'wp_ajax_nopriv_gdga', 'geodir_show_ga_stats' );
431 431
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/template_functions.php 1 patch
Indentation   +409 added lines, -409 removed lines patch added patch discarded remove patch
@@ -19,134 +19,134 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_locate_template($template = '')
21 21
 {
22
-    global $post_type, $wp, $post;
23
-    $fields = array();
24
-
25
-    switch ($template):
26
-        case 'signup':
27
-            return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
-            break;
29
-        case 'add-listing':
30
-            $gd_post_types = geodir_get_posttypes();
22
+	global $post_type, $wp, $post;
23
+	$fields = array();
24
+
25
+	switch ($template):
26
+		case 'signup':
27
+			return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
+			break;
29
+		case 'add-listing':
30
+			$gd_post_types = geodir_get_posttypes();
31 31
             
32
-            if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
-                $post_type = '';
34
-            }
32
+			if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
+				$post_type = '';
34
+			}
35 35
             
36
-            $sc_post_type = '';
37
-            if (is_page() && !empty($post->post_content) && ($shortcode = geodir_parse_shortcodes($post->post_content, 'gd_add_listing'))) {
38
-                $listing_page_id = $post->ID;
39
-                if (!empty($shortcode['listing_type'])) {
40
-                    $sc_post_type = $shortcode['listing_type'];
41
-                }
42
-            } else {
43
-                $listing_page_id = geodir_add_listing_page_id();
44
-            }
36
+			$sc_post_type = '';
37
+			if (is_page() && !empty($post->post_content) && ($shortcode = geodir_parse_shortcodes($post->post_content, 'gd_add_listing'))) {
38
+				$listing_page_id = $post->ID;
39
+				if (!empty($shortcode['listing_type'])) {
40
+					$sc_post_type = $shortcode['listing_type'];
41
+				}
42
+			} else {
43
+				$listing_page_id = geodir_add_listing_page_id();
44
+			}
45 45
             
46
-            $is_wpml = geodir_is_wpml() ? true : false;
46
+			$is_wpml = geodir_is_wpml() ? true : false;
47 47
 
48
-            if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49
-                && in_array($_REQUEST['listing_type'], $gd_post_types)) {
50
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
51
-            }
48
+			if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49
+				&& in_array($_REQUEST['listing_type'], $gd_post_types)) {
50
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
51
+			}
52 52
             
53
-            if (empty($post_type) && !isset($_REQUEST['pid'])) {
54
-                $pagename = $wp->query_vars['pagename'];
53
+			if (empty($post_type) && !isset($_REQUEST['pid'])) {
54
+				$pagename = $wp->query_vars['pagename'];
55 55
                 
56
-                if (!empty($gd_post_types)) {
57
-                    $post_type = $gd_post_types[0];
58
-                }
56
+				if (!empty($gd_post_types)) {
57
+					$post_type = $gd_post_types[0];
58
+				}
59 59
                 
60
-                if ($sc_post_type != '') {
61
-                    $post_type = $sc_post_type;
62
-                }
60
+				if ($sc_post_type != '') {
61
+					$post_type = $sc_post_type;
62
+				}
63 63
                 
64
-                if (empty($post_type) && !empty($gd_post_types)) {
65
-                    $post_type = $gd_post_types[0];
66
-                }
64
+				if (empty($post_type) && !empty($gd_post_types)) {
65
+					$post_type = $gd_post_types[0];
66
+				}
67 67
                 
68
-                if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69
-                    wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70
-                } else {
71
-                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
72
-                }
73
-                gd_die();
74
-            }
75
-            return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
76
-            break;
77
-        case 'success':
78
-            $success_page_id = geodir_success_page_id();
79
-            if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
80
-                && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
81
-            )
82
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
83
-            return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
84
-            break;
85
-        case 'detail':
86
-        case 'preview':
87
-            if (in_array(get_post_type(), geodir_get_posttypes()))
88
-                $post_type = get_post_type();
89
-            return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
90
-            break;
91
-        case 'listing':
92
-            $templates = array();
93
-            if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
94
-                $post_type = get_post_type();
95
-                $templates[] = "geodirectory/archive-$post_type.php";
96
-            }
97
-
98
-
99
-            if (is_tax() && geodir_get_taxonomy_posttype()) {
100
-                $query_obj = get_queried_object();
101
-                $curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
102
-                $curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
103
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
104
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
105
-            }
106
-
107
-            $templates[] = "geodirectory/geodir-listing.php";
108
-
109
-            return $template = locate_template($templates);
110
-            break;
111
-        case 'information':
112
-            return $template = locate_template(array("geodirectory/geodir-information.php"));
113
-            break;
114
-        case 'author':
115
-            return $template = locate_template(array("geodirectory/geodir-author.php"));
116
-            break;
117
-        case 'search':
118
-            return $template = locate_template(array("geodirectory/geodir-search.php"));
119
-            break;
120
-        case 'location':
121
-            return $template = locate_template(array("geodirectory/geodir-location.php"));
122
-            break;
123
-        case 'geodir-home':
124
-            return $template = locate_template(array("geodirectory/geodir-home.php"));
125
-            break;
126
-        case 'listing-listview':
127
-            $template = locate_template(array("geodirectory/listing-listview.php"));
128
-            if (!$template) {
129
-                $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
130
-            }
131
-            return $template;
132
-            break;
133
-        case 'widget-listing-listview':
134
-            $template = locate_template(array("geodirectory/widget-listing-listview.php"));
135
-            if (!$template) {
136
-                $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
137
-            }
138
-            return $template;
139
-            break;
68
+				if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69
+					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70
+				} else {
71
+					wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
72
+				}
73
+				gd_die();
74
+			}
75
+			return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
76
+			break;
77
+		case 'success':
78
+			$success_page_id = geodir_success_page_id();
79
+			if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
80
+				&& in_array($_REQUEST['listing_type'], geodir_get_posttypes())
81
+			)
82
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
83
+			return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
84
+			break;
85
+		case 'detail':
86
+		case 'preview':
87
+			if (in_array(get_post_type(), geodir_get_posttypes()))
88
+				$post_type = get_post_type();
89
+			return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
90
+			break;
91
+		case 'listing':
92
+			$templates = array();
93
+			if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
94
+				$post_type = get_post_type();
95
+				$templates[] = "geodirectory/archive-$post_type.php";
96
+			}
97
+
98
+
99
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
100
+				$query_obj = get_queried_object();
101
+				$curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
102
+				$curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
103
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
104
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
105
+			}
106
+
107
+			$templates[] = "geodirectory/geodir-listing.php";
108
+
109
+			return $template = locate_template($templates);
110
+			break;
111
+		case 'information':
112
+			return $template = locate_template(array("geodirectory/geodir-information.php"));
113
+			break;
114
+		case 'author':
115
+			return $template = locate_template(array("geodirectory/geodir-author.php"));
116
+			break;
117
+		case 'search':
118
+			return $template = locate_template(array("geodirectory/geodir-search.php"));
119
+			break;
120
+		case 'location':
121
+			return $template = locate_template(array("geodirectory/geodir-location.php"));
122
+			break;
123
+		case 'geodir-home':
124
+			return $template = locate_template(array("geodirectory/geodir-home.php"));
125
+			break;
126
+		case 'listing-listview':
127
+			$template = locate_template(array("geodirectory/listing-listview.php"));
128
+			if (!$template) {
129
+				$template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
130
+			}
131
+			return $template;
132
+			break;
133
+		case 'widget-listing-listview':
134
+			$template = locate_template(array("geodirectory/widget-listing-listview.php"));
135
+			if (!$template) {
136
+				$template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
137
+			}
138
+			return $template;
139
+			break;
140 140
 		case 'email-message':
141
-            $template = locate_template(array("geodirectory/email-message.php"));
142
-            if (!$template) {
143
-                $template = geodir_plugin_path() . '/geodirectory-templates/email-message.php';
144
-            }
145
-            return $template;
146
-            break;
147
-    endswitch;
141
+			$template = locate_template(array("geodirectory/email-message.php"));
142
+			if (!$template) {
143
+				$template = geodir_plugin_path() . '/geodirectory-templates/email-message.php';
144
+			}
145
+			return $template;
146
+			break;
147
+	endswitch;
148 148
 
149
-    return false;
149
+	return false;
150 150
 
151 151
 }
152 152
 
@@ -165,255 +165,255 @@  discard block
 block discarded – undo
165 165
 function geodir_template_loader($template)
166 166
 {
167 167
 
168
-    global $wp_query;
169
-
170
-    /**
171
-     * Filter the custom page list.
172
-     *
173
-     * @since 1.0.0
174
-     */
175
-    $geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
176
-        'geodir_signup_page' =>
177
-            apply_filters('geodir_set_custom_signup_page', false),
178
-        'geodir_add_listing_page' =>
179
-            apply_filters('geodir_set_custom_add_listing_page', false),
180
-        'geodir_preview_page' =>
181
-            apply_filters('geodir_set_custom_preview_page', false),
182
-        'geodir_listing_success_page' =>
183
-            apply_filters('geodir_set_custom_listing_success_page', false),
184
-        'geodir_listing_detail_page' =>
185
-            apply_filters('geodir_set_custom_listing_detail_page', false),
186
-        'geodir_listing_page' =>
187
-            apply_filters('geodir_set_custom_listing_page', false),
188
-        'geodir_search_page' =>
189
-            apply_filters('geodir_set_custom_search_page', false),
190
-        'geodir_author_page' =>
191
-            apply_filters('geodir_set_custom_author_page', false),
192
-        'geodir_home_map_page' =>
193
-            apply_filters('geodir_set_custom_home_map_page', false)
194
-    ));
195
-
196
-
197
-    if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
198
-
199
-        $template = geodir_locate_template('signup');
200
-
201
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
202
-
203
-        /**
204
-         * Filter the signup template path.
205
-         *
206
-         * @since 1.0.0
207
-         * @param string $template The template path.
208
-         */
209
-        return $template = apply_filters('geodir_template_signup', $template);
210
-    }
211
-
212
-    if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
213
-        if (!geodir_is_default_location_set()) {
214
-            global $information;
215
-            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
216
-
217
-            $template = geodir_locate_template('information');
218
-
219
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
220
-            /**
221
-             * Filter the information template path.
222
-             *
223
-             * @since 1.0.0
224
-             * @param string $template The template path.
225
-             */
226
-            return $template = apply_filters('geodir_template_information', $template);
227
-        }
228
-        // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
229
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
230
-            /// WPML
231
-            if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
232
-                global $sitepress;
168
+	global $wp_query;
169
+
170
+	/**
171
+	 * Filter the custom page list.
172
+	 *
173
+	 * @since 1.0.0
174
+	 */
175
+	$geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
176
+		'geodir_signup_page' =>
177
+			apply_filters('geodir_set_custom_signup_page', false),
178
+		'geodir_add_listing_page' =>
179
+			apply_filters('geodir_set_custom_add_listing_page', false),
180
+		'geodir_preview_page' =>
181
+			apply_filters('geodir_set_custom_preview_page', false),
182
+		'geodir_listing_success_page' =>
183
+			apply_filters('geodir_set_custom_listing_success_page', false),
184
+		'geodir_listing_detail_page' =>
185
+			apply_filters('geodir_set_custom_listing_detail_page', false),
186
+		'geodir_listing_page' =>
187
+			apply_filters('geodir_set_custom_listing_page', false),
188
+		'geodir_search_page' =>
189
+			apply_filters('geodir_set_custom_search_page', false),
190
+		'geodir_author_page' =>
191
+			apply_filters('geodir_set_custom_author_page', false),
192
+		'geodir_home_map_page' =>
193
+			apply_filters('geodir_set_custom_home_map_page', false)
194
+	));
195
+
196
+
197
+	if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
198
+
199
+		$template = geodir_locate_template('signup');
200
+
201
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
202
+
203
+		/**
204
+		 * Filter the signup template path.
205
+		 *
206
+		 * @since 1.0.0
207
+		 * @param string $template The template path.
208
+		 */
209
+		return $template = apply_filters('geodir_template_signup', $template);
210
+	}
211
+
212
+	if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
213
+		if (!geodir_is_default_location_set()) {
214
+			global $information;
215
+			$information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
216
+
217
+			$template = geodir_locate_template('information');
218
+
219
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
220
+			/**
221
+			 * Filter the information template path.
222
+			 *
223
+			 * @since 1.0.0
224
+			 * @param string $template The template path.
225
+			 */
226
+			return $template = apply_filters('geodir_template_information', $template);
227
+		}
228
+		// check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
229
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
230
+			/// WPML
231
+			if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
232
+				global $sitepress;
233 233
                 
234
-                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
235
-                $sitepress->switch_lang($lang_of_duplicate, true);
234
+				$lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
235
+				$sitepress->switch_lang($lang_of_duplicate, true);
236 236
         
237
-                $redirect_to = get_permalink(geodir_add_listing_page_id());
238
-                $_GET['pid'] = $duplicate_of;
239
-                if (!empty($_GET)) {
240
-                    $redirect_to = add_query_arg($_GET, $redirect_to);
241
-                }
242
-                wp_redirect($redirect_to);
243
-                exit;
244
-            }
245
-            /// WPML
237
+				$redirect_to = get_permalink(geodir_add_listing_page_id());
238
+				$_GET['pid'] = $duplicate_of;
239
+				if (!empty($_GET)) {
240
+					$redirect_to = add_query_arg($_GET, $redirect_to);
241
+				}
242
+				wp_redirect($redirect_to);
243
+				exit;
244
+			}
245
+			/// WPML
246 246
             
247
-            global $information;
248
-            $information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
249
-            $is_current_user_owner = geodir_listing_belong_to_current_user();
250
-            if (!$is_current_user_owner) {
251
-                $template = geodir_locate_template('information');
252
-
253
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
254
-                /**
255
-                 * Filter the information template path.
256
-                 *
257
-                 * @since 1.0.0
258
-                 * @param string $template The template path.
259
-                 */
260
-                return $template = apply_filters('geodir_template_information', $template);
261
-            }
247
+			global $information;
248
+			$information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
249
+			$is_current_user_owner = geodir_listing_belong_to_current_user();
250
+			if (!$is_current_user_owner) {
251
+				$template = geodir_locate_template('information');
252
+
253
+				if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
254
+				/**
255
+				 * Filter the information template path.
256
+				 *
257
+				 * @since 1.0.0
258
+				 * @param string $template The template path.
259
+				 */
260
+				return $template = apply_filters('geodir_template_information', $template);
261
+			}
262 262
 
263 263
 
264
-        }
264
+		}
265 265
 
266
-        //geodir_is_login(true);
267
-        global $current_user;
268
-        if (!$current_user->ID) {
269
-            wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
270
-            exit;
271
-        }
266
+		//geodir_is_login(true);
267
+		global $current_user;
268
+		if (!$current_user->ID) {
269
+			wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
270
+			exit;
271
+		}
272 272
 
273
-        $template = geodir_locate_template('add-listing');
274
-
275
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
276
-        /**
277
-         * Filter the add listing template path.
278
-         *
279
-         * @since 1.0.0
280
-         * @param string $template The template path.
281
-         */
282
-        return $template = apply_filters('geodir_template_add_listing', $template);
283
-    }
273
+		$template = geodir_locate_template('add-listing');
284 274
 
275
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
276
+		/**
277
+		 * Filter the add listing template path.
278
+		 *
279
+		 * @since 1.0.0
280
+		 * @param string $template The template path.
281
+		 */
282
+		return $template = apply_filters('geodir_template_add_listing', $template);
283
+	}
285 284
 
286
-    if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
287
-        global $preview;
288
-        $preview = true;
289 285
 
290
-        $template = geodir_locate_template('preview');
286
+	if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
287
+		global $preview;
288
+		$preview = true;
291 289
 
292
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
293
-        /**
294
-         * Filter the preview template path.
295
-         *
296
-         * @since 1.0.0
297
-         * @param string $template The template path.
298
-         */
299
-        return $template = apply_filters('geodir_template_preview', $template);
290
+		$template = geodir_locate_template('preview');
300 291
 
301
-    }
292
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
293
+		/**
294
+		 * Filter the preview template path.
295
+		 *
296
+		 * @since 1.0.0
297
+		 * @param string $template The template path.
298
+		 */
299
+		return $template = apply_filters('geodir_template_preview', $template);
302 300
 
301
+	}
303 302
 
304
-    if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
305 303
 
306
-        $template = geodir_locate_template('success');
304
+	if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
307 305
 
308
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
309
-        /**
310
-         * Filter the success template path.
311
-         *
312
-         * @since 1.0.0
313
-         * @param string $template The template path.
314
-         */
315
-        return $template = apply_filters('geodir_template_success', $template);
306
+		$template = geodir_locate_template('success');
316 307
 
317
-    }
308
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
309
+		/**
310
+		 * Filter the success template path.
311
+		 *
312
+		 * @since 1.0.0
313
+		 * @param string $template The template path.
314
+		 */
315
+		return $template = apply_filters('geodir_template_success', $template);
318 316
 
319
-    if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
317
+	}
320 318
 
321
-        $template = geodir_locate_template('detail');
319
+	if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
322 320
 
323
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
324
-        /**
325
-         * Filter the detail template path.
326
-         *
327
-         * @since 1.0.0
328
-         * @param string $template The template path.
329
-         */
330
-        return $template = apply_filters('geodir_template_detail', $template);
321
+		$template = geodir_locate_template('detail');
331 322
 
332
-    }
323
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
324
+		/**
325
+		 * Filter the detail template path.
326
+		 *
327
+		 * @since 1.0.0
328
+		 * @param string $template The template path.
329
+		 */
330
+		return $template = apply_filters('geodir_template_detail', $template);
333 331
 
334
-    if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
332
+	}
335 333
 
336
-        $template = geodir_locate_template('listing');
334
+	if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
337 335
 
338
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
339
-        /**
340
-         * Filter the listing template path.
341
-         *
342
-         * @since 1.0.0
343
-         * @param string $template The template path.
344
-         */
345
-        return $template = apply_filters('geodir_template_listing', $template);
336
+		$template = geodir_locate_template('listing');
346 337
 
347
-    }
338
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
339
+		/**
340
+		 * Filter the listing template path.
341
+		 *
342
+		 * @since 1.0.0
343
+		 * @param string $template The template path.
344
+		 */
345
+		return $template = apply_filters('geodir_template_listing', $template);
348 346
 
349
-    if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
347
+	}
350 348
 
351
-        $template = geodir_locate_template('search');
349
+	if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
352 350
 
353
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
354
-        /**
355
-         * Filter the search template path.
356
-         *
357
-         * @since 1.0.0
358
-         * @param string $template The template path.
359
-         */
360
-        return $template = apply_filters('geodir_template_search', $template);
351
+		$template = geodir_locate_template('search');
361 352
 
362
-    }
353
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
354
+		/**
355
+		 * Filter the search template path.
356
+		 *
357
+		 * @since 1.0.0
358
+		 * @param string $template The template path.
359
+		 */
360
+		return $template = apply_filters('geodir_template_search', $template);
363 361
 
364
-    if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
362
+	}
365 363
 
366
-        $template = geodir_locate_template('author');
364
+	if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
367 365
 
368
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
369
-        /**
370
-         * Filter the author template path.
371
-         *
372
-         * @since 1.0.0
373
-         * @param string $template The template path.
374
-         */
375
-        return $template = apply_filters('geodir_template_author', $template);
366
+		$template = geodir_locate_template('author');
376 367
 
377
-    }
368
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
369
+		/**
370
+		 * Filter the author template path.
371
+		 *
372
+		 * @since 1.0.0
373
+		 * @param string $template The template path.
374
+		 */
375
+		return $template = apply_filters('geodir_template_author', $template);
378 376
 
379
-    if ( geodir_is_page('home') || geodir_is_page('location')) {
377
+	}
380 378
 
381
-        global $post, $wp_query;
379
+	if ( geodir_is_page('home') || geodir_is_page('location')) {
382 380
 
383
-        if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
384
-            || (is_home() && !$wp_query->is_posts_page)
385
-        ) {
381
+		global $post, $wp_query;
386 382
 
387
-            $template = geodir_locate_template('geodir-home');
383
+		if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
384
+			|| (is_home() && !$wp_query->is_posts_page)
385
+		) {
388 386
 
389
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
390
-            /**
391
-             * Filter the home page template path.
392
-             *
393
-             * @since 1.0.0
394
-             * @param string $template The template path.
395
-             */
396
-            return $template = apply_filters('geodir_template_homepage', $template);
387
+			$template = geodir_locate_template('geodir-home');
397 388
 
398
-        } elseif (geodir_is_page('location')) {
389
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
390
+			/**
391
+			 * Filter the home page template path.
392
+			 *
393
+			 * @since 1.0.0
394
+			 * @param string $template The template path.
395
+			 */
396
+			return $template = apply_filters('geodir_template_homepage', $template);
399 397
 
400
-            $template = geodir_locate_template('location');
398
+		} elseif (geodir_is_page('location')) {
401 399
 
402
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
403
-            /**
404
-             * Filter the location template path.
405
-             *
406
-             * @since 1.0.0
407
-             * @param string $template The template path.
408
-             */
409
-            return $template = apply_filters('geodir_template_location', $template);
400
+			$template = geodir_locate_template('location');
410 401
 
411
-        } else
412
-            return $template;
402
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
403
+			/**
404
+			 * Filter the location template path.
405
+			 *
406
+			 * @since 1.0.0
407
+			 * @param string $template The template path.
408
+			 */
409
+			return $template = apply_filters('geodir_template_location', $template);
413 410
 
414
-    }
411
+		} else
412
+			return $template;
415 413
 
416
-    return $template;
414
+	}
415
+
416
+	return $template;
417 417
 }
418 418
 
419 419
 /**
@@ -428,44 +428,44 @@  discard block
 block discarded – undo
428 428
  */
429 429
 function geodir_get_template_part($slug = '', $name = NULL)
430 430
 {
431
-    global $geodirectory, $post;
432
-    /**
433
-     * Called at the start for the geodir_get_template_part() function.
434
-     *
435
-     * Used dynamic hook name: geodir_get_template_part_{$slug}
436
-     *
437
-     * @since 1.0.0
438
-     * @package GeoDirectory
439
-     * @param string $slug The template slug.
440
-     * @param string $name The template name.
441
-     */
442
-    do_action("geodir_get_template_part_{$slug}", $slug, $name);
443
-    $templates = array();
444
-    $name = (string)$name;
445
-    if ('' !== $name) {
446
-        $template_name = "{$slug}-{$name}.php";
447
-
448
-    } else {
449
-        $template_name = "{$slug}.php";
450
-    }
451
-
452
-    if (!locate_template(array("geodirectory/" . $template_name))) :
453
-        /**
454
-         * Filter the template part with slug and name.
455
-         *
456
-         * @since 1.0.0
457
-         * @param string $template_name The template name.
458
-         */
459
-        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
460
-        /**
461
-         * Includes the template part with slug and name.
462
-         *
463
-         * @since 1.0.0
464
-         */
465
-        include($template);
466
-    else:
467
-        locate_template(array("geodirectory/" . $template_name), true, false);
468
-    endif;
431
+	global $geodirectory, $post;
432
+	/**
433
+	 * Called at the start for the geodir_get_template_part() function.
434
+	 *
435
+	 * Used dynamic hook name: geodir_get_template_part_{$slug}
436
+	 *
437
+	 * @since 1.0.0
438
+	 * @package GeoDirectory
439
+	 * @param string $slug The template slug.
440
+	 * @param string $name The template name.
441
+	 */
442
+	do_action("geodir_get_template_part_{$slug}", $slug, $name);
443
+	$templates = array();
444
+	$name = (string)$name;
445
+	if ('' !== $name) {
446
+		$template_name = "{$slug}-{$name}.php";
447
+
448
+	} else {
449
+		$template_name = "{$slug}.php";
450
+	}
451
+
452
+	if (!locate_template(array("geodirectory/" . $template_name))) :
453
+		/**
454
+		 * Filter the template part with slug and name.
455
+		 *
456
+		 * @since 1.0.0
457
+		 * @param string $template_name The template name.
458
+		 */
459
+		$template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
460
+		/**
461
+		 * Includes the template part with slug and name.
462
+		 *
463
+		 * @since 1.0.0
464
+		 */
465
+		include($template);
466
+	else:
467
+		locate_template(array("geodirectory/" . $template_name), true, false);
468
+	endif;
469 469
 
470 470
 }
471 471
 
@@ -481,23 +481,23 @@  discard block
 block discarded – undo
481 481
  */
482 482
 function geodir_core_post_view_extra_class($class, $all_postypes = '')
483 483
 {
484
-    global $post;
484
+	global $post;
485 485
 
486
-    if (!$all_postypes) {
487
-        $all_postypes = geodir_get_posttypes();
488
-    }
486
+	if (!$all_postypes) {
487
+		$all_postypes = geodir_get_posttypes();
488
+	}
489 489
 
490
-    $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
491
-    $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
492
-    $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
490
+	$gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
491
+	$gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
492
+	$gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
493 493
 
494
-    if ($gdp_post_id && $gdp_post_type) {
495
-        $append_class = 'gd-post-' . $gdp_post_type;
496
-        $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
497
-        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
498
-    }
494
+	if ($gdp_post_id && $gdp_post_type) {
495
+		$append_class = 'gd-post-' . $gdp_post_type;
496
+		$append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
497
+		$class = $class != '' ? $class . ' ' . $append_class : $append_class;
498
+	}
499 499
 
500
-    return $class;
500
+	return $class;
501 501
 }
502 502
 
503 503
 /**
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
  * @param bool $favorite Listing Optional. Are favorite listings results? Default: false.
512 512
  */
513 513
 function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) {
514
-    if ($favorite) {
514
+	if ($favorite) {
515 515
 		$message = __('No favorite listings found which match your selection.', 'geodirectory');
516 516
 	} else {
517 517
 		$message = __('No listings found which match your selection.', 'geodirectory');
@@ -681,42 +681,42 @@  discard block
 block discarded – undo
681 681
 }
682 682
 
683 683
 function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
684
-    if ( empty( $content ) || empty( $shortcode ) ) {
685
-        return array();
686
-    }
684
+	if ( empty( $content ) || empty( $shortcode ) ) {
685
+		return array();
686
+	}
687 687
     
688
-    if ( false === strpos( $content, '[' ) ) {
689
-        return array();
690
-    }
691
-
692
-    if ( ! has_shortcode( $content, $shortcode ) ) {
693
-        return array();
694
-    }
695
-
696
-    $shortcodes = array();
697
-    if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
698
-        foreach ( $matches as $match ) {
699
-            if ( $shortcode === $match[2] ) {
700
-                $shortcode_attrs = shortcode_parse_atts( $match[3] );
701
-                if ( ! is_array( $shortcode_attrs ) ) {
702
-                    $shortcode_attrs = array();
703
-                }
704
-                $shortcode_attrs['shortcode_tag'] = $shortcode;
705
-                if ( !empty( $match[5] ) ) {
706
-                    $shortcode_attrs['shortcode_content'] = $match[5];
707
-                }
708
-                $shortcodes[] = $shortcode_attrs;
709
-                if ( $first === true ) {
710
-                    break;
711
-                }
712
-            }
713
-        }
714
-        if ( $first === true && !empty( $shortcodes ) ) {
715
-            $shortcodes = $shortcodes[0];
716
-        }
717
-    }
718
-
719
-    return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
688
+	if ( false === strpos( $content, '[' ) ) {
689
+		return array();
690
+	}
691
+
692
+	if ( ! has_shortcode( $content, $shortcode ) ) {
693
+		return array();
694
+	}
695
+
696
+	$shortcodes = array();
697
+	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
698
+		foreach ( $matches as $match ) {
699
+			if ( $shortcode === $match[2] ) {
700
+				$shortcode_attrs = shortcode_parse_atts( $match[3] );
701
+				if ( ! is_array( $shortcode_attrs ) ) {
702
+					$shortcode_attrs = array();
703
+				}
704
+				$shortcode_attrs['shortcode_tag'] = $shortcode;
705
+				if ( !empty( $match[5] ) ) {
706
+					$shortcode_attrs['shortcode_content'] = $match[5];
707
+				}
708
+				$shortcodes[] = $shortcode_attrs;
709
+				if ( $first === true ) {
710
+					break;
711
+				}
712
+			}
713
+		}
714
+		if ( $first === true && !empty( $shortcodes ) ) {
715
+			$shortcodes = $shortcodes[0];
716
+		}
717
+	}
718
+
719
+	return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
720 720
 }
721 721
 
722 722
 /**
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_functions.php 1 patch
Indentation   +2284 added lines, -2284 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,716 +72,716 @@  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
-                        $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TINYINT(1) NOT NULL";
677
+					case 'checkbox':
678
+						$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TINYINT(1) NOT NULL";
679 679
 						if ($default_value != '') {
680 680
 							$default_value_add .= " DEFAULT '" . $default_value . "'";
681 681
 						}
682 682
 
683
-                        $alter_result = $wpdb->query($default_value_add);
684
-                        if ( $alter_result === false) {
685
-                            return __('Column change failed, you may have too many columns.', 'geodirectory');
686
-                        }
687
-                        break;
688
-                    case 'multiselect':
689
-                    case 'select':
690
-                    case 'taxonomy':
691
-
692
-                        $op_size = '500';
693
-
694
-                        // only make the field as big as it needs to be.
695
-                        if(isset($option_values) && $option_values && $field_type=='select'){
696
-                            $option_values_arr = explode(',',$option_values);
697
-                            if(is_array($option_values_arr)){
698
-                                $op_max = 0;
699
-                                foreach($option_values_arr as $op_val){
700
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
701
-                                }
702
-                                if($op_max){$op_size =$op_max; }
703
-                            }
704
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
705
-                            if(strlen($option_values)){
706
-                                $op_size =  strlen($option_values);
707
-                            }
708
-                        }
709
-
710
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
711
-
712
-                        if ($default_value != '') {
713
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
714
-                        }
715
-
716
-                        $alter_result = $wpdb->query($meta_field_add);
717
-                        if($alter_result===false){
718
-                            return __('Column change failed, you may have too many columns.','geodirectory');
719
-                        }
720
-
721
-                        if (isset($request_field['cat_display_type']))
722
-                            $extra_fields = $request_field['cat_display_type'];
723
-
724
-                        if (isset($request_field['multi_display_type']))
725
-                            $extra_fields = $request_field['multi_display_type'];
726
-
727
-
728
-                        break;
729
-
730
-                    case 'textarea':
731
-                    case 'html':
732
-                    case 'url':
733
-                    case 'file':
734
-
735
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
736
-                        if($alter_result===false){
737
-                            return __('Column change failed, you may have too many columns.','geodirectory');
738
-                        }
739
-                        if (isset($request_field['advanced_editor']))
740
-                            $extra_fields = $request_field['advanced_editor'];
741
-
742
-                        break;
743
-
744
-                    case 'fieldset':
745
-                        // Nothing happened for fieldset
746
-                        break;
747
-
748
-                    default:
749
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
750
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
751
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
752
-                            } else {
753
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
754
-                            }
755
-
756
-                            if (is_numeric($default_value) && $default_value != '') {
757
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
758
-                            }
759
-                        } else {
760
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
761
-                            if ($default_value != '') {
762
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
763
-                            }
764
-                        }
765
-
766
-                        $alter_result = $wpdb->query($default_value_add);
767
-                        if($alter_result===false){
768
-                            return __('Column change failed, you may have too many columns.','geodirectory');
769
-                        }
770
-                        break;
771
-                endswitch;
772
-
773
-                $extra_field_query = '';
774
-                if (!empty($extra_fields)) {
775
-                    $extra_field_query = serialize($extra_fields);
776
-                }
777
-
778
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
779
-
780
-                $wpdb->query(
781
-
782
-                    $wpdb->prepare(
783
-
784
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
683
+						$alter_result = $wpdb->query($default_value_add);
684
+						if ( $alter_result === false) {
685
+							return __('Column change failed, you may have too many columns.', 'geodirectory');
686
+						}
687
+						break;
688
+					case 'multiselect':
689
+					case 'select':
690
+					case 'taxonomy':
691
+
692
+						$op_size = '500';
693
+
694
+						// only make the field as big as it needs to be.
695
+						if(isset($option_values) && $option_values && $field_type=='select'){
696
+							$option_values_arr = explode(',',$option_values);
697
+							if(is_array($option_values_arr)){
698
+								$op_max = 0;
699
+								foreach($option_values_arr as $op_val){
700
+									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
701
+								}
702
+								if($op_max){$op_size =$op_max; }
703
+							}
704
+						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
705
+							if(strlen($option_values)){
706
+								$op_size =  strlen($option_values);
707
+							}
708
+						}
709
+
710
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
711
+
712
+						if ($default_value != '') {
713
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
714
+						}
715
+
716
+						$alter_result = $wpdb->query($meta_field_add);
717
+						if($alter_result===false){
718
+							return __('Column change failed, you may have too many columns.','geodirectory');
719
+						}
720
+
721
+						if (isset($request_field['cat_display_type']))
722
+							$extra_fields = $request_field['cat_display_type'];
723
+
724
+						if (isset($request_field['multi_display_type']))
725
+							$extra_fields = $request_field['multi_display_type'];
726
+
727
+
728
+						break;
729
+
730
+					case 'textarea':
731
+					case 'html':
732
+					case 'url':
733
+					case 'file':
734
+
735
+						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
736
+						if($alter_result===false){
737
+							return __('Column change failed, you may have too many columns.','geodirectory');
738
+						}
739
+						if (isset($request_field['advanced_editor']))
740
+							$extra_fields = $request_field['advanced_editor'];
741
+
742
+						break;
743
+
744
+					case 'fieldset':
745
+						// Nothing happened for fieldset
746
+						break;
747
+
748
+					default:
749
+						if ($data_type != 'VARCHAR' && $data_type != '') {
750
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
751
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
752
+							} else {
753
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
754
+							}
755
+
756
+							if (is_numeric($default_value) && $default_value != '') {
757
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
758
+							}
759
+						} else {
760
+							$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
761
+							if ($default_value != '') {
762
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
763
+							}
764
+						}
765
+
766
+						$alter_result = $wpdb->query($default_value_add);
767
+						if($alter_result===false){
768
+							return __('Column change failed, you may have too many columns.','geodirectory');
769
+						}
770
+						break;
771
+				endswitch;
772
+
773
+				$extra_field_query = '';
774
+				if (!empty($extra_fields)) {
775
+					$extra_field_query = serialize($extra_fields);
776
+				}
777
+
778
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
779
+
780
+				$wpdb->query(
781
+
782
+					$wpdb->prepare(
783
+
784
+						"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
785 785
 					post_type = %s,
786 786
 					admin_title = %s,
787 787
 					site_title = %s,
@@ -815,308 +815,308 @@  discard block
 block discarded – undo
815 815
 					for_admin_use = %s
816 816
 					where id = %d",
817 817
 
818
-                        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)
819
-                    )
818
+						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)
819
+					)
820 820
 
821
-                );
821
+				);
822 822
 
823
-                $lastid = trim($cf);
823
+				$lastid = trim($cf);
824 824
 
825 825
 
826
-                $wpdb->query(
827
-                    $wpdb->prepare(
828
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
826
+				$wpdb->query(
827
+					$wpdb->prepare(
828
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
829 829
 					 	site_title=%s
830 830
 					where post_type = %s and htmlvar_name = %s",
831
-                        array($site_title, $post_type, $htmlvar_name)
832
-                    )
833
-                );
834
-
835
-
836
-                if ($cat_sort == '')
837
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
838
-
839
-
840
-                /**
841
-                 * Called after all custom fields are saved for a post.
842
-                 *
843
-                 * @since 1.0.0
844
-                 * @param int $lastid The post ID.
845
-                 */
846
-                do_action('geodir_after_custom_fields_updated', $lastid);
847
-
848
-            } else {
849
-
850
-                switch ($field_type):
851
-
852
-                    case 'address':
853
-
854
-                        $data_type = '';
855
-
856
-                        if ($htmlvar_name != '') {
857
-                            $prefix = $htmlvar_name . '_';
858
-                        }
859
-                        $old_prefix = $old_html_variable;
860
-
861
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
862
-
863
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
864
-                        if ($default_value != '') {
865
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
866
-                        }
867
-
868
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
869
-                        //$wpdb->query($meta_field_add);
870
-
871
-
872
-                        if (!empty($extra_fields)) {
831
+						array($site_title, $post_type, $htmlvar_name)
832
+					)
833
+				);
834
+
835
+
836
+				if ($cat_sort == '')
837
+					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
838
+
839
+
840
+				/**
841
+				 * Called after all custom fields are saved for a post.
842
+				 *
843
+				 * @since 1.0.0
844
+				 * @param int $lastid The post ID.
845
+				 */
846
+				do_action('geodir_after_custom_fields_updated', $lastid);
847
+
848
+			} else {
873 849
 
874
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
875
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
876
-                                $meta_field_add = "VARCHAR( 50 ) NULL";
877
-                                if ($default_value != '') {
878
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
879
-                                }
880
-
881
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
882
-                                //$wpdb->query($meta_field_add);
883
-                            }
884
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
885
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
886
-                                $meta_field_add = "VARCHAR( 50 ) NULL";
887
-                                if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
889
-                                }
890
-
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
892
-                                //$wpdb->query($meta_field_add);
893
-                            }
894
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
896
-
897
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
898
-                                if ($default_value != '') {
899
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
900
-                                }
901
-
902
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
903
-                                //$wpdb->query($meta_field_add);
904
-                            }
905
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
906
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
907
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
908
-                                if ($default_value != '') {
909
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
910
-                                }
911
-
912
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
913
-                                //$wpdb->query($meta_field_add);
914
-                            }
915
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
916
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
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 . "latitude", $meta_field_add);
923
-                                //$wpdb->query($meta_field_add);
924
-
925
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
926
-
927
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
928
-                                if ($default_value != '') {
929
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
930
-                                }
931
-
932
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
933
-
934
-                                //$wpdb->query($meta_field_add);
935
-                            }
936
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
937
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
938
-
939
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
940
-                                if ($default_value != '') {
941
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
942
-                                }
943
-
944
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
945
-
946
-                                //$wpdb->query($meta_field_add);
947
-                            }
948
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
949
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
950
-
951
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
952
-                                if ($default_value != '') {
953
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
954
-                                }
955
-
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
957
-
958
-                                //$wpdb->query($meta_field_add);
959
-                            }
960
-                            // show lat lng
961
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
962
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
963
-
964
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
965
-                                $meta_field_add .= " DEFAULT '1'";
966
-
967
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
968
-                                //$wpdb->query($meta_field_add);
969
-                            }
970
-                        }
971
-
972
-                        break;
973
-
974
-                    case 'checkbox':
975
-                        $data_type = 'TINYINT';
976
-
977
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
978
-                        if ((int)$default_value === 1) {
979
-                            $meta_field_add .= " DEFAULT '1'";
980
-                        }
981
-
982
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
983
-                        if ($add_result === false) {
984
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
985
-                        }
986
-                        break;
987
-                    case 'multiselect':
988
-                    case 'select':
989
-                        $data_type = 'VARCHAR';
990
-                        $op_size = '500';
991
-
992
-                        // only make the field as big as it needs to be.
993
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
994
-                            $option_values_arr = explode(',', $option_values);
995
-
996
-                            if (is_array($option_values_arr)) {
997
-                                $op_max = 0;
998
-
999
-                                foreach ($option_values_arr as $op_val) {
1000
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
1001
-                                        $op_max = strlen($op_val);
1002
-                                    }
1003
-                                }
1004
-
1005
-                                if ($op_max) {
1006
-                                    $op_size = $op_max;
1007
-                                }
1008
-                            }
1009
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
1010
-                            if (strlen($option_values)) {
1011
-                                $op_size =  strlen($option_values);
1012
-                            }
1013
-
1014
-                            if (isset($request_field['multi_display_type'])) {
1015
-                                $extra_fields = $request_field['multi_display_type'];
1016
-                            }
1017
-                        }
1018
-
1019
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1020
-                        if ($default_value != '') {
1021
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1022
-                        }
1023
-
1024
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1025
-                        if ($add_result === false) {
1026
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1027
-                        }
1028
-                        break;
1029
-                    case 'textarea':
1030
-                    case 'html':
1031
-                    case 'url':
1032
-                    case 'file':
1033
-
1034
-                        $data_type = 'TEXT';
1035
-
1036
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1037
-
1038
-                        $meta_field_add = $data_type . " NULL ";
1039
-                        /*if($default_value != '')
850
+				switch ($field_type):
851
+
852
+					case 'address':
853
+
854
+						$data_type = '';
855
+
856
+						if ($htmlvar_name != '') {
857
+							$prefix = $htmlvar_name . '_';
858
+						}
859
+						$old_prefix = $old_html_variable;
860
+
861
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
862
+
863
+						$meta_field_add = "VARCHAR( 254 ) NULL";
864
+						if ($default_value != '') {
865
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
866
+						}
867
+
868
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
869
+						//$wpdb->query($meta_field_add);
870
+
871
+
872
+						if (!empty($extra_fields)) {
873
+
874
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
875
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
876
+								$meta_field_add = "VARCHAR( 50 ) NULL";
877
+								if ($default_value != '') {
878
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
879
+								}
880
+
881
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
882
+								//$wpdb->query($meta_field_add);
883
+							}
884
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
885
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
886
+								$meta_field_add = "VARCHAR( 50 ) NULL";
887
+								if ($default_value != '') {
888
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
889
+								}
890
+
891
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
892
+								//$wpdb->query($meta_field_add);
893
+							}
894
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
895
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
896
+
897
+								$meta_field_add = "VARCHAR( 30 ) NULL";
898
+								if ($default_value != '') {
899
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
900
+								}
901
+
902
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
903
+								//$wpdb->query($meta_field_add);
904
+							}
905
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
906
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
907
+								$meta_field_add = "VARCHAR( 15 ) NULL";
908
+								if ($default_value != '') {
909
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
910
+								}
911
+
912
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
913
+								//$wpdb->query($meta_field_add);
914
+							}
915
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
916
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
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 . "latitude", $meta_field_add);
923
+								//$wpdb->query($meta_field_add);
924
+
925
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
926
+
927
+								$meta_field_add = "VARCHAR( 20 ) NULL";
928
+								if ($default_value != '') {
929
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
930
+								}
931
+
932
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
933
+
934
+								//$wpdb->query($meta_field_add);
935
+							}
936
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
937
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
938
+
939
+								$meta_field_add = "VARCHAR( 15 ) NULL";
940
+								if ($default_value != '') {
941
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
942
+								}
943
+
944
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
945
+
946
+								//$wpdb->query($meta_field_add);
947
+							}
948
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
949
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
950
+
951
+								$meta_field_add = "VARCHAR( 3 ) NULL";
952
+								if ($default_value != '') {
953
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
954
+								}
955
+
956
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
957
+
958
+								//$wpdb->query($meta_field_add);
959
+							}
960
+							// show lat lng
961
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
962
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
963
+
964
+								$meta_field_add = "VARCHAR( 3 ) NULL";
965
+								$meta_field_add .= " DEFAULT '1'";
966
+
967
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
968
+								//$wpdb->query($meta_field_add);
969
+							}
970
+						}
971
+
972
+						break;
973
+
974
+					case 'checkbox':
975
+						$data_type = 'TINYINT';
976
+
977
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
978
+						if ((int)$default_value === 1) {
979
+							$meta_field_add .= " DEFAULT '1'";
980
+						}
981
+
982
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
983
+						if ($add_result === false) {
984
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
985
+						}
986
+						break;
987
+					case 'multiselect':
988
+					case 'select':
989
+						$data_type = 'VARCHAR';
990
+						$op_size = '500';
991
+
992
+						// only make the field as big as it needs to be.
993
+						if (isset($option_values) && $option_values && $field_type == 'select') {
994
+							$option_values_arr = explode(',', $option_values);
995
+
996
+							if (is_array($option_values_arr)) {
997
+								$op_max = 0;
998
+
999
+								foreach ($option_values_arr as $op_val) {
1000
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
1001
+										$op_max = strlen($op_val);
1002
+									}
1003
+								}
1004
+
1005
+								if ($op_max) {
1006
+									$op_size = $op_max;
1007
+								}
1008
+							}
1009
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
1010
+							if (strlen($option_values)) {
1011
+								$op_size =  strlen($option_values);
1012
+							}
1013
+
1014
+							if (isset($request_field['multi_display_type'])) {
1015
+								$extra_fields = $request_field['multi_display_type'];
1016
+							}
1017
+						}
1018
+
1019
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1020
+						if ($default_value != '') {
1021
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1022
+						}
1023
+
1024
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1025
+						if ($add_result === false) {
1026
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1027
+						}
1028
+						break;
1029
+					case 'textarea':
1030
+					case 'html':
1031
+					case 'url':
1032
+					case 'file':
1033
+
1034
+						$data_type = 'TEXT';
1035
+
1036
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1037
+
1038
+						$meta_field_add = $data_type . " NULL ";
1039
+						/*if($default_value != '')
1040 1040
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1041 1041
 
1042
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1043
-                        if ($add_result === false) {
1044
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1045
-                        }
1042
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1043
+						if ($add_result === false) {
1044
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1045
+						}
1046 1046
 
1047
-                        break;
1047
+						break;
1048 1048
 
1049
-                    case 'datepicker':
1049
+					case 'datepicker':
1050 1050
 
1051
-                        $data_type = 'DATE';
1051
+						$data_type = 'DATE';
1052 1052
 
1053
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1053
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1054 1054
 
1055
-                        $meta_field_add = $data_type . " NULL ";
1055
+						$meta_field_add = $data_type . " NULL ";
1056 1056
 
1057
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1058
-                        if ($add_result === false) {
1059
-                            return __('Column creation failed, you may have too many columns or the default value might have a invalid date format.', 'geodirectory');
1060
-                        }
1057
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1058
+						if ($add_result === false) {
1059
+							return __('Column creation failed, you may have too many columns or the default value might have a invalid date format.', 'geodirectory');
1060
+						}
1061 1061
 
1062
-                        break;
1062
+						break;
1063 1063
 
1064
-                    case 'time':
1064
+					case 'time':
1065 1065
 
1066
-                        $data_type = 'TIME';
1066
+						$data_type = 'TIME';
1067 1067
 
1068
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1068
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1069 1069
 
1070
-                        $meta_field_add = $data_type . " NULL ";
1070
+						$meta_field_add = $data_type . " NULL ";
1071 1071
 
1072
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1073
-                        if ($add_result === false) {
1074
-                            return __('Column creation failed, you may have too many columns or the default value might have a invalid time format.', 'geodirectory');
1075
-                        }
1072
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1073
+						if ($add_result === false) {
1074
+							return __('Column creation failed, you may have too many columns or the default value might have a invalid time format.', 'geodirectory');
1075
+						}
1076 1076
 
1077
-                        break;
1077
+						break;
1078 1078
 
1079
-                    default:
1079
+					default:
1080 1080
 
1081
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1082
-                            $meta_field_add = $data_type . " NULL ";
1081
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1082
+							$meta_field_add = $data_type . " NULL ";
1083 1083
 
1084
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1085
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1086
-                            }
1084
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1085
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1086
+							}
1087 1087
 
1088
-                            if (is_numeric($default_value) && $default_value != '') {
1089
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1090
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1091
-                            }
1092
-                        } else {
1093
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1088
+							if (is_numeric($default_value) && $default_value != '') {
1089
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1090
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1091
+							}
1092
+						} else {
1093
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1094 1094
 
1095
-                            if ($default_value != '') {
1096
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1097
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1098
-                            }
1099
-                        }
1095
+							if ($default_value != '') {
1096
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1097
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1098
+							}
1099
+						}
1100 1100
 
1101
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1102
-                        if ($add_result === false) {
1103
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1104
-                        }
1105
-                        break;
1106
-                endswitch;
1101
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1102
+						if ($add_result === false) {
1103
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1104
+						}
1105
+						break;
1106
+				endswitch;
1107 1107
 
1108
-                $extra_field_query = '';
1109
-                if (!empty($extra_fields)) {
1110
-                    $extra_field_query = serialize($extra_fields);
1111
-                }
1108
+				$extra_field_query = '';
1109
+				if (!empty($extra_fields)) {
1110
+					$extra_field_query = serialize($extra_fields);
1111
+				}
1112 1112
 
1113
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1113
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1114 1114
 
1115
-                $wpdb->query(
1115
+				$wpdb->query(
1116 1116
 
1117
-                    $wpdb->prepare(
1117
+					$wpdb->prepare(
1118 1118
 
1119
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1119
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1120 1120
 					post_type = %s,
1121 1121
 					admin_title = %s,
1122 1122
 					site_title = %s,
@@ -1149,26 +1149,26 @@  discard block
 block discarded – undo
1149 1149
 					validation_msg = %s,
1150 1150
 					for_admin_use = %s ",
1151 1151
 
1152
-                        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)
1152
+						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)
1153 1153
 
1154
-                    )
1154
+					)
1155 1155
 
1156
-                );
1156
+				);
1157 1157
 
1158
-                $lastid = $wpdb->insert_id;
1158
+				$lastid = $wpdb->insert_id;
1159 1159
 
1160
-                $lastid = trim($lastid);
1160
+				$lastid = trim($lastid);
1161 1161
 
1162
-            }
1162
+			}
1163 1163
 
1164
-            return (int)$lastid;
1164
+			return (int)$lastid;
1165 1165
 
1166 1166
 
1167
-        } else {
1168
-            return 'HTML Variable Name should be a unique name';
1169
-        }
1167
+		} else {
1168
+			return 'HTML Variable Name should be a unique name';
1169
+		}
1170 1170
 
1171
-    }
1171
+	}
1172 1172
 }
1173 1173
 
1174 1174
 /**
@@ -1183,63 +1183,63 @@  discard block
 block discarded – undo
1183 1183
 function godir_set_field_order($field_ids = array())
1184 1184
 {
1185 1185
 
1186
-    global $wpdb;
1186
+	global $wpdb;
1187 1187
 
1188
-    $count = 0;
1189
-    if (!empty($field_ids)):
1190
-        $post_meta_info = false;
1191
-        foreach ($field_ids as $id) {
1188
+	$count = 0;
1189
+	if (!empty($field_ids)):
1190
+		$post_meta_info = false;
1191
+		foreach ($field_ids as $id) {
1192 1192
 
1193
-            $cf = trim($id, '_');
1193
+			$cf = trim($id, '_');
1194 1194
 
1195
-            $post_meta_info = $wpdb->query(
1196
-                $wpdb->prepare(
1197
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1195
+			$post_meta_info = $wpdb->query(
1196
+				$wpdb->prepare(
1197
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1198 1198
 															sort_order=%d 
1199 1199
 															where id= %d",
1200
-                    array($count, $cf)
1201
-                )
1202
-            );
1203
-            $count++;
1204
-        }
1205
-
1206
-        return $post_meta_info;
1207
-    else:
1208
-        return false;
1209
-    endif;
1200
+					array($count, $cf)
1201
+				)
1202
+			);
1203
+			$count++;
1204
+		}
1205
+
1206
+		return $post_meta_info;
1207
+	else:
1208
+		return false;
1209
+	endif;
1210 1210
 }
1211 1211
 
1212 1212
 function geodir_get_cf_value($cf) {
1213
-    global $gd_session;
1214
-    $value = '';
1215
-    if (is_admin()) {
1216
-        global $post;
1217
-
1218
-        if (isset($_REQUEST['post'])) {
1219
-            $_REQUEST['pid'] = (int)$_REQUEST['post'];
1220
-        }
1221
-    }
1222
-
1223
-    if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1224
-        $post = $gd_ses_listing;
1225
-        $value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1226
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1227
-        $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1228
-    } else {
1229
-        if ($value == '') {
1230
-            $value = $cf['default'];
1231
-        }
1232
-    }
1213
+	global $gd_session;
1214
+	$value = '';
1215
+	if (is_admin()) {
1216
+		global $post;
1217
+
1218
+		if (isset($_REQUEST['post'])) {
1219
+			$_REQUEST['pid'] = (int)$_REQUEST['post'];
1220
+		}
1221
+	}
1222
+
1223
+	if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1224
+		$post = $gd_ses_listing;
1225
+		$value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1226
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1227
+		$value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1228
+	} else {
1229
+		if ($value == '') {
1230
+			$value = $cf['default'];
1231
+		}
1232
+	}
1233 1233
     
1234
-    /**
1235
-     * Filter the custom field value.
1236
-     *
1237
-     * @since 1.6.20
1238
-     * 
1239
-     * @param mixed $value Custom field value.
1240
-     * @param array $cf Custom field info.
1241
-     */
1242
-    return apply_filters( 'geodir_get_cf_value', $value, $cf );
1234
+	/**
1235
+	 * Filter the custom field value.
1236
+	 *
1237
+	 * @since 1.6.20
1238
+	 * 
1239
+	 * @param mixed $value Custom field value.
1240
+	 * @param array $cf Custom field info.
1241
+	 */
1242
+	return apply_filters( 'geodir_get_cf_value', $value, $cf );
1243 1243
 }
1244 1244
 
1245 1245
 /**
@@ -1258,420 +1258,420 @@  discard block
 block discarded – undo
1258 1258
  * @param string $post_type Optional. The wordpress post type.
1259 1259
  */
1260 1260
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1261
-    global $is_default, $mapzoom, $gd_session;
1261
+	global $is_default, $mapzoom, $gd_session;
1262 1262
 
1263
-    $listing_type = $post_type;
1263
+	$listing_type = $post_type;
1264 1264
 
1265
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1265
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1266 1266
 
1267
-    foreach ($custom_fields as $key => $val) {
1268
-        if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
1269
-        $val = stripslashes_deep($val); // strip slashes from labels
1270
-        if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
1267
+	foreach ($custom_fields as $key => $val) {
1268
+		if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
1269
+		$val = stripslashes_deep($val); // strip slashes from labels
1270
+		if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
1271 1271
 
1272
-        $name = $val['name'];
1273
-        $type = $val['type'];
1274
-        $is_default = $val['is_default'];
1272
+		$name = $val['name'];
1273
+		$type = $val['type'];
1274
+		$is_default = $val['is_default'];
1275 1275
 
1276
-        /* field available to site admin only for edit */
1277
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1278
-        if ($for_admin_use && !is_super_admin()) {
1279
-            continue;
1280
-        }
1276
+		/* field available to site admin only for edit */
1277
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1278
+		if ($for_admin_use && !is_super_admin()) {
1279
+			continue;
1280
+		}
1281 1281
 
1282
-        if (is_admin()) {
1283
-            global $post;
1282
+		if (is_admin()) {
1283
+			global $post;
1284 1284
 
1285
-            if (isset($_REQUEST['post']))
1286
-                $_REQUEST['pid'] = $_REQUEST['post'];
1287
-        }
1285
+			if (isset($_REQUEST['post']))
1286
+				$_REQUEST['pid'] = $_REQUEST['post'];
1287
+		}
1288 1288
 
1289 1289
         
1290 1290
 
1291
-        /**
1292
-         * Called before the custom fields info is output for submitting a post.
1293
-         *
1294
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1295
-         *
1296
-         * @since 1.0.0
1297
-         * @param string $listing_type The post post type.
1298
-         * @param int $package_id The price package ID for the post.
1299
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1300
-         * @see 'geodir_after_custom_form_field_$name'
1301
-         */
1302
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1303
-
1304
-
1305
-        $custom_field = $val;
1306
-        $html ='';
1307
-        /**
1308
-         * Filter the output for custom fields.
1309
-         *
1310
-         * Here we can remove or add new functions depending on the field type.
1311
-         *
1312
-         * @param string $html The html to be filtered (blank).
1313
-         * @param array $custom_field The custom field array values.
1314
-         */
1315
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1316
-
1317
-
1318
-
1319
-        /**
1320
-         * Called after the custom fields info is output for submitting a post.
1321
-         *
1322
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
1323
-         *
1324
-         * @since 1.0.0
1325
-         * @param string $listing_type The post post type.
1326
-         * @param int $package_id The price package ID for the post.
1327
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1328
-         * @see 'geodir_before_custom_form_field_$name'
1329
-         */
1330
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1331
-
1332
-    }
1291
+		/**
1292
+		 * Called before the custom fields info is output for submitting a post.
1293
+		 *
1294
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1295
+		 *
1296
+		 * @since 1.0.0
1297
+		 * @param string $listing_type The post post type.
1298
+		 * @param int $package_id The price package ID for the post.
1299
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1300
+		 * @see 'geodir_after_custom_form_field_$name'
1301
+		 */
1302
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1303
+
1304
+
1305
+		$custom_field = $val;
1306
+		$html ='';
1307
+		/**
1308
+		 * Filter the output for custom fields.
1309
+		 *
1310
+		 * Here we can remove or add new functions depending on the field type.
1311
+		 *
1312
+		 * @param string $html The html to be filtered (blank).
1313
+		 * @param array $custom_field The custom field array values.
1314
+		 */
1315
+		echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1316
+
1317
+
1318
+
1319
+		/**
1320
+		 * Called after the custom fields info is output for submitting a post.
1321
+		 *
1322
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
1323
+		 *
1324
+		 * @since 1.0.0
1325
+		 * @param string $listing_type The post post type.
1326
+		 * @param int $package_id The price package ID for the post.
1327
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1328
+		 * @see 'geodir_before_custom_form_field_$name'
1329
+		 */
1330
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1331
+
1332
+	}
1333 1333
 
1334 1334
 }
1335 1335
 
1336 1336
 
1337 1337
 if (!function_exists('geodir_get_field_infoby')) {
1338
-    /**
1339
-     * Get custom field using key and value.
1340
-     *
1341
-     * @since 1.0.0
1342
-     * @package GeoDirectory
1343
-     * @global object $wpdb WordPress Database object.
1344
-     * @param string $key The key you want to look for.
1345
-     * @param string $value The value of the key you want to look for.
1346
-     * @param string $geodir_post_type The post type.
1347
-     * @return bool|mixed Returns field info when available. otherwise returns false.
1348
-     */
1349
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1350
-    {
1351
-
1352
-        global $wpdb;
1353
-
1354
-        $filter = $wpdb->get_row(
1355
-            $wpdb->prepare(
1356
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1357
-                array($geodir_post_type)
1358
-            ),ARRAY_A
1359
-        );
1360
-
1361
-        if ($filter) {
1362
-            return $filter;
1363
-        } else {
1364
-            return false;
1365
-        }
1366
-
1367
-    }
1338
+	/**
1339
+	 * Get custom field using key and value.
1340
+	 *
1341
+	 * @since 1.0.0
1342
+	 * @package GeoDirectory
1343
+	 * @global object $wpdb WordPress Database object.
1344
+	 * @param string $key The key you want to look for.
1345
+	 * @param string $value The value of the key you want to look for.
1346
+	 * @param string $geodir_post_type The post type.
1347
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
1348
+	 */
1349
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1350
+	{
1351
+
1352
+		global $wpdb;
1353
+
1354
+		$filter = $wpdb->get_row(
1355
+			$wpdb->prepare(
1356
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1357
+				array($geodir_post_type)
1358
+			),ARRAY_A
1359
+		);
1360
+
1361
+		if ($filter) {
1362
+			return $filter;
1363
+		} else {
1364
+			return false;
1365
+		}
1366
+
1367
+	}
1368 1368
 }
1369 1369
 
1370 1370
 
1371 1371
 function geodir_field_icon_proccess($cf){
1372 1372
 
1373 1373
 
1374
-    if (strpos($cf['field_icon'], 'http') !== false) {
1375
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1376
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1377
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1378
-    }else{
1379
-        $field_icon = $cf['field_icon'];
1380
-    }
1374
+	if (strpos($cf['field_icon'], 'http') !== false) {
1375
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1376
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1377
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1378
+	}else{
1379
+		$field_icon = $cf['field_icon'];
1380
+	}
1381 1381
 
1382
-    return $field_icon;
1382
+	return $field_icon;
1383 1383
 }
1384 1384
 
1385 1385
 if (!function_exists('geodir_show_listing_info')) {
1386
-    /**
1387
-     * Show listing info depending on field location.
1388
-     *
1389
-     * @since 1.0.0
1390
-     * @since 1.5.7 Custom fields option values added to db translation.
1391
-     *              Changes to display url fields title.
1392
-     * @package GeoDirectory
1393
-     * @global object $wpdb WordPress Database object.
1394
-     * @global object $post The current post object.
1395
-     *
1396
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1397
-     * @return string Returns listing info html.
1398
-     */
1399
-    function geodir_show_listing_info($fields_location = '') {
1400
-        global $post, $preview, $wpdb;
1401
-
1402
-        $package_info = array();
1403
-
1404
-        $package_info = geodir_post_package_info($package_info, $post);
1405
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1406
-        $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1407
-
1408
-        ob_start();
1409
-        $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1410
-
1411
-        if (!empty($fields_info)) {
1412
-            $post = stripslashes_deep($post); // strip slashes
1386
+	/**
1387
+	 * Show listing info depending on field location.
1388
+	 *
1389
+	 * @since 1.0.0
1390
+	 * @since 1.5.7 Custom fields option values added to db translation.
1391
+	 *              Changes to display url fields title.
1392
+	 * @package GeoDirectory
1393
+	 * @global object $wpdb WordPress Database object.
1394
+	 * @global object $post The current post object.
1395
+	 *
1396
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1397
+	 * @return string Returns listing info html.
1398
+	 */
1399
+	function geodir_show_listing_info($fields_location = '') {
1400
+		global $post, $preview, $wpdb;
1401
+
1402
+		$package_info = array();
1403
+
1404
+		$package_info = geodir_post_package_info($package_info, $post);
1405
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1406
+		$p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1407
+
1408
+		ob_start();
1409
+		$fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1410
+
1411
+		if (!empty($fields_info)) {
1412
+			$post = stripslashes_deep($post); // strip slashes
1413 1413
             
1414
-            //echo '<div class="geodir-company_info field-group">';
1415
-            global $field_set_start;
1416
-            $field_set_start = 0;
1417
-
1418
-
1419
-
1420
-            foreach ($fields_info as $type) {
1421
-                if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
1422
-                $type = stripslashes_deep($type); // strip slashes
1423
-                if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
1424
-                $html = '';
1425
-                $field_icon = geodir_field_icon_proccess($type);
1426
-                $filed_type = $type['type'];
1427
-                $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1428
-                if($html_var=='post'){$html_var='post_address';}
1429
-
1430
-                /**
1431
-                 * Filter the output for custom fields.
1432
-                 *
1433
-                 * Here we can remove or add new functions depending on the field type.
1434
-                 *
1435
-                 * @param string $html The html to be filtered (blank).
1436
-                 * @param string $fields_location The location the field is to be show.
1437
-                 * @param array $type The array of field values.
1438
-                 */
1439
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1440
-
1441
-                $variables_array = array();
1442
-
1443
-
1444
-                if ($type['type'] != 'fieldset'):
1445
-                    $variables_array['post_id'] = !empty($post->ID) ? $post->ID : (!empty($post->pid) ? $post->pid : NULL);
1446
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
1447
-                    $variables_array['value'] = '';
1448
-                    if (isset($post->{$type['htmlvar_name']}))
1449
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1450
-                endif;
1451
-
1452
-
1453
-                if ($html):
1454
-
1455
-                    /**
1456
-                     * Called before a custom fields is output on the frontend.
1457
-                     *
1458
-                     * @since 1.0.0
1459
-                     * @param string $html_var The HTML variable name for the field.
1460
-                     */
1461
-                    do_action("geodir_before_show_{$html_var}");
1462
-                    /**
1463
-                     * Filter custom field output.
1464
-                     *
1465
-                     * @since 1.0.0
1466
-                     *
1467
-                     * @param string $html_var The HTML variable name for the field.
1468
-                     * @param string $html Custom field unfiltered HTML.
1469
-                     * @param array $variables_array Custom field variables array.
1470
-                     */
1471
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1472
-
1473
-                    /**
1474
-                     * Called after a custom fields is output on the frontend.
1475
-                     *
1476
-                     * @since 1.0.0
1477
-                     * @param string $html_var The HTML variable name for the field.
1478
-                     */
1479
-                    do_action("geodir_after_show_{$html_var}");
1480
-
1481
-                endif;
1482
-
1483
-            }
1484
-
1485
-            //echo '</div>';
1486
-
1487
-        }
1488
-
1489
-
1490
-        $html = ob_get_clean();
1491
-
1492
-        /**
1493
-         * Filter the custom fields over all output.
1494
-         *
1495
-         * @param string $html The html of the custom fields.
1496
-         * @param string $fields_location The location the fields are being output.
1497
-         * @since 1.6.9
1498
-         */
1499
-        return apply_filters('geodir_show_listing_info',$html,$fields_location);
1500
-
1501
-    }
1414
+			//echo '<div class="geodir-company_info field-group">';
1415
+			global $field_set_start;
1416
+			$field_set_start = 0;
1417
+
1418
+
1419
+
1420
+			foreach ($fields_info as $type) {
1421
+				if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
1422
+				$type = stripslashes_deep($type); // strip slashes
1423
+				if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
1424
+				$html = '';
1425
+				$field_icon = geodir_field_icon_proccess($type);
1426
+				$filed_type = $type['type'];
1427
+				$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1428
+				if($html_var=='post'){$html_var='post_address';}
1429
+
1430
+				/**
1431
+				 * Filter the output for custom fields.
1432
+				 *
1433
+				 * Here we can remove or add new functions depending on the field type.
1434
+				 *
1435
+				 * @param string $html The html to be filtered (blank).
1436
+				 * @param string $fields_location The location the field is to be show.
1437
+				 * @param array $type The array of field values.
1438
+				 */
1439
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1440
+
1441
+				$variables_array = array();
1442
+
1443
+
1444
+				if ($type['type'] != 'fieldset'):
1445
+					$variables_array['post_id'] = !empty($post->ID) ? $post->ID : (!empty($post->pid) ? $post->pid : NULL);
1446
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
1447
+					$variables_array['value'] = '';
1448
+					if (isset($post->{$type['htmlvar_name']}))
1449
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
1450
+				endif;
1451
+
1452
+
1453
+				if ($html):
1454
+
1455
+					/**
1456
+					 * Called before a custom fields is output on the frontend.
1457
+					 *
1458
+					 * @since 1.0.0
1459
+					 * @param string $html_var The HTML variable name for the field.
1460
+					 */
1461
+					do_action("geodir_before_show_{$html_var}");
1462
+					/**
1463
+					 * Filter custom field output.
1464
+					 *
1465
+					 * @since 1.0.0
1466
+					 *
1467
+					 * @param string $html_var The HTML variable name for the field.
1468
+					 * @param string $html Custom field unfiltered HTML.
1469
+					 * @param array $variables_array Custom field variables array.
1470
+					 */
1471
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1472
+
1473
+					/**
1474
+					 * Called after a custom fields is output on the frontend.
1475
+					 *
1476
+					 * @since 1.0.0
1477
+					 * @param string $html_var The HTML variable name for the field.
1478
+					 */
1479
+					do_action("geodir_after_show_{$html_var}");
1480
+
1481
+				endif;
1482
+
1483
+			}
1484
+
1485
+			//echo '</div>';
1486
+
1487
+		}
1488
+
1489
+
1490
+		$html = ob_get_clean();
1491
+
1492
+		/**
1493
+		 * Filter the custom fields over all output.
1494
+		 *
1495
+		 * @param string $html The html of the custom fields.
1496
+		 * @param string $fields_location The location the fields are being output.
1497
+		 * @since 1.6.9
1498
+		 */
1499
+		return apply_filters('geodir_show_listing_info',$html,$fields_location);
1500
+
1501
+	}
1502 1502
 }
1503 1503
 
1504 1504
 if (!function_exists('geodir_default_date_format')) {
1505
-    /**
1506
-     * Returns default date format.
1507
-     *
1508
-     * @since 1.0.0
1509
-     * @package GeoDirectory
1510
-     * @return mixed|string|void Returns default date format.
1511
-     */
1512
-    function geodir_default_date_format()
1513
-    {
1514
-        if ($format = get_option('date_format'))
1515
-            return $format;
1516
-        else
1517
-            return 'dd-mm-yy';
1518
-    }
1505
+	/**
1506
+	 * Returns default date format.
1507
+	 *
1508
+	 * @since 1.0.0
1509
+	 * @package GeoDirectory
1510
+	 * @return mixed|string|void Returns default date format.
1511
+	 */
1512
+	function geodir_default_date_format()
1513
+	{
1514
+		if ($format = get_option('date_format'))
1515
+			return $format;
1516
+		else
1517
+			return 'dd-mm-yy';
1518
+	}
1519 1519
 }
1520 1520
 
1521 1521
 if (!function_exists('geodir_get_formated_date')) {
1522
-    /**
1523
-     * Returns formatted date.
1524
-     *
1525
-     * @since 1.0.0
1526
-     * @package GeoDirectory
1527
-     * @param string $date Date string to convert.
1528
-     * @return bool|int|string Returns formatted date.
1529
-     */
1530
-    function geodir_get_formated_date($date)
1531
-    {
1532
-        return mysql2date(get_option('date_format'), $date);
1533
-    }
1522
+	/**
1523
+	 * Returns formatted date.
1524
+	 *
1525
+	 * @since 1.0.0
1526
+	 * @package GeoDirectory
1527
+	 * @param string $date Date string to convert.
1528
+	 * @return bool|int|string Returns formatted date.
1529
+	 */
1530
+	function geodir_get_formated_date($date)
1531
+	{
1532
+		return mysql2date(get_option('date_format'), $date);
1533
+	}
1534 1534
 }
1535 1535
 
1536 1536
 if (!function_exists('geodir_get_formated_time')) {
1537
-    /**
1538
-     * Returns formatted time.
1539
-     *
1540
-     * @since 1.0.0
1541
-     * @package GeoDirectory
1542
-     * @param string $time Time string to convert.
1543
-     * @return bool|int|string Returns formatted time.
1544
-     */
1545
-    function geodir_get_formated_time($time)
1546
-    {
1547
-        return mysql2date(get_option('time_format'), $time, $translate = true);
1548
-    }
1537
+	/**
1538
+	 * Returns formatted time.
1539
+	 *
1540
+	 * @since 1.0.0
1541
+	 * @package GeoDirectory
1542
+	 * @param string $time Time string to convert.
1543
+	 * @return bool|int|string Returns formatted time.
1544
+	 */
1545
+	function geodir_get_formated_time($time)
1546
+	{
1547
+		return mysql2date(get_option('time_format'), $time, $translate = true);
1548
+	}
1549 1549
 }
1550 1550
 
1551 1551
 
1552 1552
 if (!function_exists('geodir_save_post_file_fields')) {
1553
-    /**
1554
-     * Save post file fields
1555
-     *
1556
-     * @since 1.0.0
1557
-     * @since 1.4.7 Added `$extra_fields` parameter.
1558
-     * @package GeoDirectory
1559
-     * @global object $wpdb WordPress Database object.
1560
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1561
-     * @global object $current_user Current user object.
1562
-     * @param int $post_id
1563
-     * @param string $field_id
1564
-     * @param array $post_image
1565
-     * @param array $extra_fields Array of extra fields.
1566
-     */
1567
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1568
-    {
1553
+	/**
1554
+	 * Save post file fields
1555
+	 *
1556
+	 * @since 1.0.0
1557
+	 * @since 1.4.7 Added `$extra_fields` parameter.
1558
+	 * @package GeoDirectory
1559
+	 * @global object $wpdb WordPress Database object.
1560
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1561
+	 * @global object $current_user Current user object.
1562
+	 * @param int $post_id
1563
+	 * @param string $field_id
1564
+	 * @param array $post_image
1565
+	 * @param array $extra_fields Array of extra fields.
1566
+	 */
1567
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1568
+	{
1569 1569
 
1570
-        global $wpdb, $plugin_prefix, $current_user;
1570
+		global $wpdb, $plugin_prefix, $current_user;
1571 1571
 
1572
-        $post_type = get_post_type($post_id);
1573
-        //echo $field_id; exit;
1574
-        $table = $plugin_prefix . $post_type . '_detail';
1572
+		$post_type = get_post_type($post_id);
1573
+		//echo $field_id; exit;
1574
+		$table = $plugin_prefix . $post_type . '_detail';
1575 1575
 
1576
-        $postcurr_images = array();
1577
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1578
-        $file_urls = '';
1576
+		$postcurr_images = array();
1577
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1578
+		$file_urls = '';
1579 1579
 
1580
-        if (!empty($post_image)) {
1580
+		if (!empty($post_image)) {
1581 1581
 
1582
-            $invalid_files = array();
1582
+			$invalid_files = array();
1583 1583
 
1584
-            //Get and remove all old images of post from database to set by new order
1585
-            $geodir_uploaddir = '';
1586
-            $uploads = wp_upload_dir();
1587
-            $uploads_dir = $uploads['path'];
1584
+			//Get and remove all old images of post from database to set by new order
1585
+			$geodir_uploaddir = '';
1586
+			$uploads = wp_upload_dir();
1587
+			$uploads_dir = $uploads['path'];
1588 1588
 
1589
-            $geodir_uploadpath = $uploads['path'];
1590
-            $geodir_uploadurl = $uploads['url'];
1591
-            $sub_dir = $uploads['subdir'];
1589
+			$geodir_uploadpath = $uploads['path'];
1590
+			$geodir_uploadurl = $uploads['url'];
1591
+			$sub_dir = $uploads['subdir'];
1592 1592
 
1593
-            $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'] : '';
1593
+			$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'] : '';
1594 1594
 
1595
-            for ($m = 0; $m < count($post_image); $m++) {
1595
+			for ($m = 0; $m < count($post_image); $m++) {
1596 1596
 
1597
-                /* --------- start ------- */
1597
+				/* --------- start ------- */
1598 1598
 
1599
-                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)))) {
1599
+				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)))) {
1600 1600
 
1601 1601
 
1602
-                    $curr_img_url = $post_image[$m];
1603
-                    $image_name_arr = explode('/', $curr_img_url);
1604
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1605
-                    $filename = end($image_name_arr);
1606
-                    $img_name_arr = explode('.', $filename);
1602
+					$curr_img_url = $post_image[$m];
1603
+					$image_name_arr = explode('/', $curr_img_url);
1604
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1605
+					$filename = end($image_name_arr);
1606
+					$img_name_arr = explode('.', $filename);
1607 1607
 
1608
-                    $arr_file_type = wp_check_filetype($filename);
1608
+					$arr_file_type = wp_check_filetype($filename);
1609 1609
 
1610
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1611
-                        continue;
1612
-                    }
1610
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1611
+						continue;
1612
+					}
1613 1613
 
1614
-                    $uploaded_file_type = $arr_file_type['type'];
1615
-                    $uploaded_file_ext = $arr_file_type['ext'];
1614
+					$uploaded_file_type = $arr_file_type['type'];
1615
+					$uploaded_file_ext = $arr_file_type['ext'];
1616 1616
 
1617
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1618
-                        continue; // Invalid file type.
1619
-                    }
1617
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1618
+						continue; // Invalid file type.
1619
+					}
1620 1620
 
1621
-                    // Set an array containing a list of acceptable formats
1622
-                    //$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');
1621
+					// Set an array containing a list of acceptable formats
1622
+					//$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');
1623 1623
 
1624
-                    if (!function_exists('wp_handle_upload'))
1625
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1624
+					if (!function_exists('wp_handle_upload'))
1625
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
1626 1626
 
1627
-                    if (!is_dir($geodir_uploadpath))
1628
-                        mkdir($geodir_uploadpath);
1627
+					if (!is_dir($geodir_uploadpath))
1628
+						mkdir($geodir_uploadpath);
1629 1629
 
1630
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1631
-                    $explode_sub_dir = explode("/", $sub_dir);
1632
-                    if ($curr_img_dir == end($explode_sub_dir)) {
1633
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1634
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1635
-                    } else {
1636
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1637
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1638
-                    }
1630
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1631
+					$explode_sub_dir = explode("/", $sub_dir);
1632
+					if ($curr_img_dir == end($explode_sub_dir)) {
1633
+						$img_path = $geodir_uploadpath . '/' . $filename;
1634
+						$img_url = $geodir_uploadurl . '/' . $filename;
1635
+					} else {
1636
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1637
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1638
+					}
1639 1639
 
1640
-                    $uploaded_file = '';
1641
-                    if (file_exists($img_path))
1642
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1640
+					$uploaded_file = '';
1641
+					if (file_exists($img_path))
1642
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1643 1643
 
1644
-                    if ($curr_img_dir != $geodir_uploaddir) {
1645
-                        if (file_exists($img_path))
1646
-                            unlink($img_path);
1647
-                    }
1644
+					if ($curr_img_dir != $geodir_uploaddir) {
1645
+						if (file_exists($img_path))
1646
+							unlink($img_path);
1647
+					}
1648 1648
 
1649
-                    if (!empty($uploaded_file))
1650
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1649
+					if (!empty($uploaded_file))
1650
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
1651 1651
 
1652
-                } else {
1653
-                    $file_urls = $post_image[$m];
1654
-                }
1655
-            }
1652
+				} else {
1653
+					$file_urls = $post_image[$m];
1654
+				}
1655
+			}
1656 1656
 
1657 1657
 
1658
-        }
1658
+		}
1659 1659
 
1660
-        //Remove all old attachments and temp images
1661
-        if (!empty($postcurr_images)) {
1660
+		//Remove all old attachments and temp images
1661
+		if (!empty($postcurr_images)) {
1662 1662
 
1663
-            if ($file_urls != $postcurr_images) {
1664
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1665
-                $invalid_files = (object)$invalid_files;
1666
-            }
1667
-        }
1663
+			if ($file_urls != $postcurr_images) {
1664
+				$invalid_files[] = (object)array('src' => $postcurr_images);
1665
+				$invalid_files = (object)$invalid_files;
1666
+			}
1667
+		}
1668 1668
 
1669
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
1669
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
1670 1670
 
1671
-        if (!empty($invalid_files))
1672
-            geodir_remove_attachments($invalid_files);
1671
+		if (!empty($invalid_files))
1672
+			geodir_remove_attachments($invalid_files);
1673 1673
 
1674
-    }
1674
+	}
1675 1675
 }
1676 1676
 
1677 1677
 
@@ -1686,76 +1686,76 @@  discard block
 block discarded – undo
1686 1686
  */
1687 1687
 function geodir_custom_upload_mimes($existing_mimes = array())
1688 1688
 {
1689
-    $existing_mimes['wif'] = 'text/plain';
1690
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
1691
-    $existing_mimes['gif'] = 'image/gif';
1692
-    $existing_mimes['png'] = 'image/png';
1693
-    $existing_mimes['pdf'] = 'application/pdf';
1694
-    $existing_mimes['txt'] = 'text/text';
1695
-    $existing_mimes['csv'] = 'application/octet-stream';
1696
-    $existing_mimes['doc'] = 'application/msword';
1697
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1698
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1699
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1700
-    return $existing_mimes;
1689
+	$existing_mimes['wif'] = 'text/plain';
1690
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
1691
+	$existing_mimes['gif'] = 'image/gif';
1692
+	$existing_mimes['png'] = 'image/png';
1693
+	$existing_mimes['pdf'] = 'application/pdf';
1694
+	$existing_mimes['txt'] = 'text/text';
1695
+	$existing_mimes['csv'] = 'application/octet-stream';
1696
+	$existing_mimes['doc'] = 'application/msword';
1697
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1698
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1699
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1700
+	return $existing_mimes;
1701 1701
 }
1702 1702
 
1703 1703
 if (!function_exists('geodir_plupload_action')) {
1704 1704
 
1705
-    /**
1706
-     * Get upload directory path details
1707
-     *
1708
-     * @since 1.0.0
1709
-     * @package GeoDirectory
1710
-     * @global object $current_user Current user object.
1711
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1712
-     * @return mixed Returns upload directory details as an array.
1713
-     */
1714
-    function geodir_upload_dir($upload)
1715
-    {
1716
-        global $current_user;
1717
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1718
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1719
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1720
-        return $upload;
1721
-    }
1722
-
1723
-    /**
1724
-     * Handles place file and image upload.
1725
-     *
1726
-     * @since 1.0.0
1727
-     * @package GeoDirectory
1728
-     */
1729
-    function geodir_plupload_action()
1730
-    {
1731
-        // check ajax nonce
1732
-        $imgid = $_POST["imgid"];
1733
-
1734
-        check_ajax_referer($imgid . 'pluploadan');
1735
-
1736
-        // handle custom file uploaddir
1737
-        add_filter('upload_dir', 'geodir_upload_dir');
1738
-
1739
-        // change file orientation if needed
1740
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1741
-
1742
-        // handle file upload
1743
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1744
-        // remove handle custom file uploaddir
1745
-        remove_filter('upload_dir', 'geodir_upload_dir');
1746
-
1747
-        if(!isset($status['url']) && isset($status['error'])){
1748
-            print_r($status);
1749
-        }
1750
-
1751
-        // send the uploaded file url in response
1752
-        if (isset($status['url'])) {
1753
-            echo $status['url'];
1754
-        } else {
1755
-            echo 'x';
1756
-        }
1757
-        exit;
1758
-    }
1705
+	/**
1706
+	 * Get upload directory path details
1707
+	 *
1708
+	 * @since 1.0.0
1709
+	 * @package GeoDirectory
1710
+	 * @global object $current_user Current user object.
1711
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1712
+	 * @return mixed Returns upload directory details as an array.
1713
+	 */
1714
+	function geodir_upload_dir($upload)
1715
+	{
1716
+		global $current_user;
1717
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1718
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
1719
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
1720
+		return $upload;
1721
+	}
1722
+
1723
+	/**
1724
+	 * Handles place file and image upload.
1725
+	 *
1726
+	 * @since 1.0.0
1727
+	 * @package GeoDirectory
1728
+	 */
1729
+	function geodir_plupload_action()
1730
+	{
1731
+		// check ajax nonce
1732
+		$imgid = $_POST["imgid"];
1733
+
1734
+		check_ajax_referer($imgid . 'pluploadan');
1735
+
1736
+		// handle custom file uploaddir
1737
+		add_filter('upload_dir', 'geodir_upload_dir');
1738
+
1739
+		// change file orientation if needed
1740
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1741
+
1742
+		// handle file upload
1743
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1744
+		// remove handle custom file uploaddir
1745
+		remove_filter('upload_dir', 'geodir_upload_dir');
1746
+
1747
+		if(!isset($status['url']) && isset($status['error'])){
1748
+			print_r($status);
1749
+		}
1750
+
1751
+		// send the uploaded file url in response
1752
+		if (isset($status['url'])) {
1753
+			echo $status['url'];
1754
+		} else {
1755
+			echo 'x';
1756
+		}
1757
+		exit;
1758
+	}
1759 1759
 }
1760 1760
 
1761 1761
 /**
@@ -1770,17 +1770,17 @@  discard block
 block discarded – undo
1770 1770
  */
1771 1771
 function geodir_get_video($post_id)
1772 1772
 {
1773
-    global $wpdb, $plugin_prefix;
1773
+	global $wpdb, $plugin_prefix;
1774 1774
 
1775
-    $post_type = get_post_type($post_id);
1775
+	$post_type = get_post_type($post_id);
1776 1776
 
1777
-    $table = $plugin_prefix . $post_type . '_detail';
1777
+	$table = $plugin_prefix . $post_type . '_detail';
1778 1778
 
1779
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1779
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1780 1780
 
1781
-    if ($results) {
1782
-        return $results[0]->geodir_video;
1783
-    }
1781
+	if ($results) {
1782
+		return $results[0]->geodir_video;
1783
+	}
1784 1784
 
1785 1785
 }
1786 1786
 
@@ -1796,40 +1796,40 @@  discard block
 block discarded – undo
1796 1796
  */
1797 1797
 function geodir_get_special_offers($post_id)
1798 1798
 {
1799
-    global $wpdb, $plugin_prefix;
1799
+	global $wpdb, $plugin_prefix;
1800 1800
 
1801
-    $post_type = get_post_type($post_id);
1801
+	$post_type = get_post_type($post_id);
1802 1802
 
1803
-    $table = $plugin_prefix . $post_type . '_detail';
1803
+	$table = $plugin_prefix . $post_type . '_detail';
1804 1804
 
1805
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1805
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1806 1806
 
1807
-    if ($results) {
1808
-        return $results[0]->geodir_special_offers;
1809
-    }
1807
+	if ($results) {
1808
+		return $results[0]->geodir_special_offers;
1809
+	}
1810 1810
 
1811 1811
 }
1812 1812
 
1813 1813
 if (!function_exists('geodir_max_upload_size')) {
1814
-    /**
1815
-     * Get max upload file size
1816
-     *
1817
-     * @since 1.0.0
1818
-     * @package GeoDirectory
1819
-     * @return mixed|void Returns max upload file size.
1820
-     */
1821
-    function geodir_max_upload_size()
1822
-    {
1823
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1824
-
1825
-        if ($max_filesize > 0 && $max_filesize < 1) {
1826
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1827
-        } else {
1828
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1829
-        }
1830
-        /** Filter documented in geodirectory-functions/general_functions.php **/
1831
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1832
-    }
1814
+	/**
1815
+	 * Get max upload file size
1816
+	 *
1817
+	 * @since 1.0.0
1818
+	 * @package GeoDirectory
1819
+	 * @return mixed|void Returns max upload file size.
1820
+	 */
1821
+	function geodir_max_upload_size()
1822
+	{
1823
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1824
+
1825
+		if ($max_filesize > 0 && $max_filesize < 1) {
1826
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
1827
+		} else {
1828
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1829
+		}
1830
+		/** Filter documented in geodirectory-functions/general_functions.php **/
1831
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1832
+	}
1833 1833
 }
1834 1834
 
1835 1835
 
@@ -1847,33 +1847,33 @@  discard block
 block discarded – undo
1847 1847
  */
1848 1848
 function geodir_add_custom_sort_options($fields, $post_type)
1849 1849
 {
1850
-    global $wpdb;
1850
+	global $wpdb;
1851 1851
 
1852
-    if ($post_type != '') {
1852
+	if ($post_type != '') {
1853 1853
 
1854
-        $all_postypes = geodir_get_posttypes();
1854
+		$all_postypes = geodir_get_posttypes();
1855 1855
 
1856
-        if (in_array($post_type, $all_postypes)) {
1856
+		if (in_array($post_type, $all_postypes)) {
1857 1857
 
1858
-            $custom_fields = $wpdb->get_results(
1859
-                $wpdb->prepare(
1860
-                    "select post_type,data_type,field_type,site_title,admin_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",
1861
-                    array($post_type)
1862
-                ), 'ARRAY_A'
1863
-            );
1858
+			$custom_fields = $wpdb->get_results(
1859
+				$wpdb->prepare(
1860
+					"select post_type,data_type,field_type,site_title,admin_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",
1861
+					array($post_type)
1862
+				), 'ARRAY_A'
1863
+			);
1864 1864
 
1865
-            if (!empty($custom_fields)) {
1865
+			if (!empty($custom_fields)) {
1866 1866
 
1867
-                foreach ($custom_fields as $val) {
1868
-                    $fields[] = $val;
1869
-                }
1870
-            }
1867
+				foreach ($custom_fields as $val) {
1868
+					$fields[] = $val;
1869
+				}
1870
+			}
1871 1871
 
1872
-        }
1872
+		}
1873 1873
 
1874
-    }
1874
+	}
1875 1875
 
1876
-    return $fields;
1876
+	return $fields;
1877 1877
 }
1878 1878
 
1879 1879
 
@@ -1889,76 +1889,76 @@  discard block
 block discarded – undo
1889 1889
 function geodir_get_custom_sort_options($post_type = '')
1890 1890
 {
1891 1891
 
1892
-    global $wpdb;
1893
-
1894
-    if ($post_type != '') {
1895
-
1896
-        $all_postypes = geodir_get_posttypes();
1897
-
1898
-        if (!in_array($post_type, $all_postypes))
1899
-            return false;
1900
-
1901
-        $fields = array();
1902
-
1903
-        $fields[] = array(
1904
-            'post_type' => $post_type,
1905
-            'data_type' => '',
1906
-            'field_type' => 'random',
1907
-            'site_title' => 'Random',
1908
-            'htmlvar_name' => 'post_title',
1909
-            'field_icon' =>  'fa fa-random',
1910
-            'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1911
-        );
1912
-
1913
-        $fields[] = array(
1914
-            'post_type' => $post_type,
1915
-            'data_type' => '',
1916
-            'field_type' => 'datetime',
1917
-            'site_title' => __('Add date', 'geodirectory'),
1918
-            'htmlvar_name' => 'post_date',
1919
-            'field_icon' =>  'fa fa-calendar',
1920
-            'description' =>  __('Sort by date added', 'geodirectory')
1921
-        );
1922
-        $fields[] = array(
1923
-            'post_type' => $post_type,
1924
-            'data_type' => '',
1925
-            'field_type' => 'bigint',
1926
-            'site_title' => __('Review', 'geodirectory'),
1927
-            'htmlvar_name' => 'comment_count',
1928
-            'field_icon' =>  'fa fa-commenting-o',
1929
-            'description' =>  __('Sort by the number of reviews', 'geodirectory')
1930
-        );
1931
-        $fields[] = array(
1932
-            'post_type' => $post_type,
1933
-            'data_type' => '',
1934
-            'field_type' => 'float',
1935
-            'site_title' => __('Rating', 'geodirectory'),
1936
-            'htmlvar_name' => 'overall_rating',
1937
-            'field_icon' =>  'fa fa-star-o',
1938
-            'description' =>  __('Sort by the overall rating value', 'geodirectory')
1939
-        );
1940
-        $fields[] = array(
1941
-            'post_type' => $post_type,
1942
-            'data_type' => '',
1943
-            'field_type' => 'text',
1944
-            'site_title' => __('Title', 'geodirectory'),
1945
-            'htmlvar_name' => 'post_title',
1946
-            'field_icon' =>  'fa fa-sort-alpha-desc',
1947
-            'description' =>  __('Sort alphabetically by title', 'geodirectory')
1948
-        );
1949
-
1950
-        /**
1951
-         * Hook to add custom sort options.
1952
-         *
1953
-         * @since 1.0.0
1954
-         * @param array $fields Unmodified sort options array.
1955
-         * @param string $post_type Post type.
1956
-         */
1957
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1958
-
1959
-    }
1960
-
1961
-    return false;
1892
+	global $wpdb;
1893
+
1894
+	if ($post_type != '') {
1895
+
1896
+		$all_postypes = geodir_get_posttypes();
1897
+
1898
+		if (!in_array($post_type, $all_postypes))
1899
+			return false;
1900
+
1901
+		$fields = array();
1902
+
1903
+		$fields[] = array(
1904
+			'post_type' => $post_type,
1905
+			'data_type' => '',
1906
+			'field_type' => 'random',
1907
+			'site_title' => 'Random',
1908
+			'htmlvar_name' => 'post_title',
1909
+			'field_icon' =>  'fa fa-random',
1910
+			'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1911
+		);
1912
+
1913
+		$fields[] = array(
1914
+			'post_type' => $post_type,
1915
+			'data_type' => '',
1916
+			'field_type' => 'datetime',
1917
+			'site_title' => __('Add date', 'geodirectory'),
1918
+			'htmlvar_name' => 'post_date',
1919
+			'field_icon' =>  'fa fa-calendar',
1920
+			'description' =>  __('Sort by date added', 'geodirectory')
1921
+		);
1922
+		$fields[] = array(
1923
+			'post_type' => $post_type,
1924
+			'data_type' => '',
1925
+			'field_type' => 'bigint',
1926
+			'site_title' => __('Review', 'geodirectory'),
1927
+			'htmlvar_name' => 'comment_count',
1928
+			'field_icon' =>  'fa fa-commenting-o',
1929
+			'description' =>  __('Sort by the number of reviews', 'geodirectory')
1930
+		);
1931
+		$fields[] = array(
1932
+			'post_type' => $post_type,
1933
+			'data_type' => '',
1934
+			'field_type' => 'float',
1935
+			'site_title' => __('Rating', 'geodirectory'),
1936
+			'htmlvar_name' => 'overall_rating',
1937
+			'field_icon' =>  'fa fa-star-o',
1938
+			'description' =>  __('Sort by the overall rating value', 'geodirectory')
1939
+		);
1940
+		$fields[] = array(
1941
+			'post_type' => $post_type,
1942
+			'data_type' => '',
1943
+			'field_type' => 'text',
1944
+			'site_title' => __('Title', 'geodirectory'),
1945
+			'htmlvar_name' => 'post_title',
1946
+			'field_icon' =>  'fa fa-sort-alpha-desc',
1947
+			'description' =>  __('Sort alphabetically by title', 'geodirectory')
1948
+		);
1949
+
1950
+		/**
1951
+		 * Hook to add custom sort options.
1952
+		 *
1953
+		 * @since 1.0.0
1954
+		 * @param array $fields Unmodified sort options array.
1955
+		 * @param string $post_type Post type.
1956
+		 */
1957
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1958
+
1959
+	}
1960
+
1961
+	return false;
1962 1962
 }
1963 1963
 
1964 1964
 
@@ -1974,117 +1974,117 @@  discard block
 block discarded – undo
1974 1974
 function godir_set_sort_field_order($field_ids = array())
1975 1975
 {
1976 1976
 
1977
-    global $wpdb;
1977
+	global $wpdb;
1978 1978
 
1979
-    $count = 0;
1980
-    if (!empty($field_ids)):
1981
-        foreach ($field_ids as $id) {
1979
+	$count = 0;
1980
+	if (!empty($field_ids)):
1981
+		foreach ($field_ids as $id) {
1982 1982
 
1983
-            $cf = trim($id, '_');
1983
+			$cf = trim($id, '_');
1984 1984
 
1985
-            $post_meta_info = $wpdb->query(
1986
-                $wpdb->prepare(
1987
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1985
+			$post_meta_info = $wpdb->query(
1986
+				$wpdb->prepare(
1987
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1988 1988
 															sort_order=%d 
1989 1989
 															where id= %d",
1990
-                    array($count, $cf)
1991
-                )
1992
-            );
1993
-            $count++;
1994
-        }
1995
-
1996
-        return $field_ids;
1997
-    else:
1998
-        return false;
1999
-    endif;
1990
+					array($count, $cf)
1991
+				)
1992
+			);
1993
+			$count++;
1994
+		}
1995
+
1996
+		return $field_ids;
1997
+	else:
1998
+		return false;
1999
+	endif;
2000 2000
 }
2001 2001
 
2002 2002
 
2003 2003
 if (!function_exists('geodir_custom_sort_field_save')) {
2004
-    /**
2005
-     * Save or Update custom sort fields into the database.
2006
-     *
2007
-     * @since 1.0.0
2008
-     * @package GeoDirectory
2009
-     * @global object $wpdb WordPress Database object.
2010
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2011
-     * @param array $request_field {
2012
-     *    Attributes of the Request field.
2013
-     *
2014
-     *    @type string $action Ajax action name.
2015
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
2016
-     *    @type string $create_field Do you want to create this field?.
2017
-     *    @type string $field_ins_upd Field created or updated?.
2018
-     *    @type string $_wpnonce Nonce value.
2019
-     *    @type string $listing_type The Post type.
2020
-     *    @type string $field_type Field Type.
2021
-     *    @type string $field_id Field ID.
2022
-     *    @type string $data_type Data Type.
2023
-     *    @type string $htmlvar_name HTML variable name.
2024
-     *    @type string $site_title Section title which you wish to display in frontend.
2025
-     *    @type string $is_default Is this default sorting?.
2026
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
2027
-     *    @type string $sort_order Sort Order.
2028
-     *
2029
-     * }
2030
-     * @param bool $default Not yet implemented.
2031
-     * @return int Returns the last affected db table row id.
2032
-     */
2033
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
2034
-    {
2035
-
2036
-        global $wpdb, $plugin_prefix;
2037
-
2038
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2039
-
2040
-        $cf = trim($result_str, '_');
2041
-
2042
-        /*-------- check duplicate validation --------*/
2043
-
2044
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2045
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2046
-
2047
-        $post_type = $request_field['listing_type'];
2048
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2049
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2050
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2051
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2052
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2053
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2054
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2055
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2056
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2057
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2058
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2059
-
2060
-        $default_order = '';
2061
-        if ($is_default != '') {
2062
-            $default_order = $is_default;
2063
-            $is_default = '1';
2064
-        }
2065
-
2066
-
2067
-        $check_html_variable = $wpdb->get_var(
2068
-            $wpdb->prepare(
2069
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2070
-                array($cehhtmlvar_name, $post_type, $field_type)
2071
-            )
2072
-        );
2073
-
2074
-        if ($is_default == 1) {
2075
-
2076
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2077
-
2078
-        }
2079
-
2080
-
2081
-        if (!$check_html_variable) {
2082
-
2083
-            $wpdb->query(
2084
-
2085
-                $wpdb->prepare(
2086
-
2087
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2004
+	/**
2005
+	 * Save or Update custom sort fields into the database.
2006
+	 *
2007
+	 * @since 1.0.0
2008
+	 * @package GeoDirectory
2009
+	 * @global object $wpdb WordPress Database object.
2010
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2011
+	 * @param array $request_field {
2012
+	 *    Attributes of the Request field.
2013
+	 *
2014
+	 *    @type string $action Ajax action name.
2015
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
2016
+	 *    @type string $create_field Do you want to create this field?.
2017
+	 *    @type string $field_ins_upd Field created or updated?.
2018
+	 *    @type string $_wpnonce Nonce value.
2019
+	 *    @type string $listing_type The Post type.
2020
+	 *    @type string $field_type Field Type.
2021
+	 *    @type string $field_id Field ID.
2022
+	 *    @type string $data_type Data Type.
2023
+	 *    @type string $htmlvar_name HTML variable name.
2024
+	 *    @type string $site_title Section title which you wish to display in frontend.
2025
+	 *    @type string $is_default Is this default sorting?.
2026
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
2027
+	 *    @type string $sort_order Sort Order.
2028
+	 *
2029
+	 * }
2030
+	 * @param bool $default Not yet implemented.
2031
+	 * @return int Returns the last affected db table row id.
2032
+	 */
2033
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
2034
+	{
2035
+
2036
+		global $wpdb, $plugin_prefix;
2037
+
2038
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2039
+
2040
+		$cf = trim($result_str, '_');
2041
+
2042
+		/*-------- check duplicate validation --------*/
2043
+
2044
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2045
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2046
+
2047
+		$post_type = $request_field['listing_type'];
2048
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2049
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2050
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2051
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2052
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2053
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2054
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2055
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2056
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2057
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2058
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2059
+
2060
+		$default_order = '';
2061
+		if ($is_default != '') {
2062
+			$default_order = $is_default;
2063
+			$is_default = '1';
2064
+		}
2065
+
2066
+
2067
+		$check_html_variable = $wpdb->get_var(
2068
+			$wpdb->prepare(
2069
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2070
+				array($cehhtmlvar_name, $post_type, $field_type)
2071
+			)
2072
+		);
2073
+
2074
+		if ($is_default == 1) {
2075
+
2076
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2077
+
2078
+		}
2079
+
2080
+
2081
+		if (!$check_html_variable) {
2082
+
2083
+			$wpdb->query(
2084
+
2085
+				$wpdb->prepare(
2086
+
2087
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2088 2088
 				post_type = %s,
2089 2089
 				data_type = %s,
2090 2090
 				field_type = %s,
@@ -2099,23 +2099,23 @@  discard block
 block discarded – undo
2099 2099
 				asc_title = %s,
2100 2100
 				desc_title = %s",
2101 2101
 
2102
-                    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)
2103
-                )
2102
+					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)
2103
+				)
2104 2104
 
2105
-            );
2105
+			);
2106 2106
 
2107 2107
 
2108
-            $lastid = $wpdb->insert_id;
2108
+			$lastid = $wpdb->insert_id;
2109 2109
 
2110
-            $lastid = trim($lastid);
2110
+			$lastid = trim($lastid);
2111 2111
 
2112
-        } else {
2112
+		} else {
2113 2113
 
2114
-            $wpdb->query(
2114
+			$wpdb->query(
2115 2115
 
2116
-                $wpdb->prepare(
2116
+				$wpdb->prepare(
2117 2117
 
2118
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2118
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2119 2119
 				post_type = %s,
2120 2120
 				data_type = %s,
2121 2121
 				field_type = %s,
@@ -2131,123 +2131,123 @@  discard block
 block discarded – undo
2131 2131
 				desc_title = %s
2132 2132
 				where id = %d",
2133 2133
 
2134
-                    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)
2135
-                )
2134
+					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)
2135
+				)
2136 2136
 
2137
-            );
2137
+			);
2138 2138
 
2139
-            $lastid = trim($cf);
2139
+			$lastid = trim($cf);
2140 2140
 
2141
-        }
2141
+		}
2142 2142
 
2143 2143
 
2144
-        return (int)$lastid;
2144
+		return (int)$lastid;
2145 2145
 
2146
-    }
2146
+	}
2147 2147
 }
2148 2148
 
2149 2149
 
2150 2150
 if (!function_exists('geodir_custom_sort_field_delete')) {
2151
-    /**
2152
-     * Delete a custom sort field using field id.
2153
-     * @since 1.0.0
2154
-     * @package GeoDirectory
2155
-     * @global object $wpdb WordPress Database object.
2156
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2157
-     * @param string $field_id The field ID.
2158
-     * @return int|string Returns field id when successful deletion, else returns 0.
2159
-     */
2160
-    function geodir_custom_sort_field_delete($field_id = '')
2161
-    {
2162
-
2163
-        global $wpdb, $plugin_prefix;
2164
-        if ($field_id != '') {
2165
-            $cf = trim($field_id, '_');
2166
-
2167
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2168
-
2169
-            return $field_id;
2170
-
2171
-        } else
2172
-            return 0;
2173
-
2174
-    }
2151
+	/**
2152
+	 * Delete a custom sort field using field id.
2153
+	 * @since 1.0.0
2154
+	 * @package GeoDirectory
2155
+	 * @global object $wpdb WordPress Database object.
2156
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2157
+	 * @param string $field_id The field ID.
2158
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2159
+	 */
2160
+	function geodir_custom_sort_field_delete($field_id = '')
2161
+	{
2162
+
2163
+		global $wpdb, $plugin_prefix;
2164
+		if ($field_id != '') {
2165
+			$cf = trim($field_id, '_');
2166
+
2167
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2168
+
2169
+			return $field_id;
2170
+
2171
+		} else
2172
+			return 0;
2173
+
2174
+	}
2175 2175
 }
2176 2176
 
2177 2177
 
2178 2178
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2179
-    /**
2180
-     * Custom sort field admin html.
2181
-     *
2182
-     * @since 1.0.0
2183
-     * @package GeoDirectory
2184
-     * @global object $wpdb WordPress Database object.
2185
-     * @param string $field_type The form field type.
2186
-     * @param object|int $result_str The custom field results object or row id.
2187
-     * @param string $field_ins_upd When set to "submit" displays form.
2188
-     * @param bool $default when set to true field will be for admin use only.
2189
-     */
2190
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2191
-    {
2192
-        global $wpdb;
2193
-        $cf = $result_str;
2194
-        if (!is_object($cf)) {
2195
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2196
-        } else {
2197
-            $field_info = $cf;
2198
-            $result_str = $cf->id;
2199
-        }
2200
-
2201
-        $field_info = stripslashes_deep($field_info); // strip slashes
2202
-
2203
-        if (!isset($field_info->post_type)) {
2204
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2205
-        } else {
2206
-            $post_type = $field_info->post_type;
2207
-        }
2208
-
2209
-
2210
-        $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2211
-
2212
-        $site_title = '';
2213
-        if ($site_title == '')
2214
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2215
-
2216
-        if ($site_title == '') {
2217
-            $fields = geodir_get_custom_sort_options($post_type);
2218
-
2219
-            foreach ($fields as $val) {
2220
-                $val = stripslashes_deep($val); // strip slashes
2221
-
2222
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2223
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
2224
-                }
2225
-            }
2226
-        }
2227
-
2228
-        if ($htmlvar_name == '')
2229
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2230
-
2231
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2232
-
2233
-        $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2234
-        $cso_arr = geodir_get_custom_sort_options($post_type);
2235
-
2236
-        $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2237
-        foreach($cso_arr as $cso){
2238
-            if($cur_field_type==$cso['field_type']){
2239
-
2240
-                if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2241
-                    $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2242
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2243
-                    $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cso['field_icon'].'\')"></b>';
2244
-                }
2245
-
2246
-            }
2247
-        }
2248
-
2249
-        $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2250
-        ?>
2179
+	/**
2180
+	 * Custom sort field admin html.
2181
+	 *
2182
+	 * @since 1.0.0
2183
+	 * @package GeoDirectory
2184
+	 * @global object $wpdb WordPress Database object.
2185
+	 * @param string $field_type The form field type.
2186
+	 * @param object|int $result_str The custom field results object or row id.
2187
+	 * @param string $field_ins_upd When set to "submit" displays form.
2188
+	 * @param bool $default when set to true field will be for admin use only.
2189
+	 */
2190
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2191
+	{
2192
+		global $wpdb;
2193
+		$cf = $result_str;
2194
+		if (!is_object($cf)) {
2195
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2196
+		} else {
2197
+			$field_info = $cf;
2198
+			$result_str = $cf->id;
2199
+		}
2200
+
2201
+		$field_info = stripslashes_deep($field_info); // strip slashes
2202
+
2203
+		if (!isset($field_info->post_type)) {
2204
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2205
+		} else {
2206
+			$post_type = $field_info->post_type;
2207
+		}
2208
+
2209
+
2210
+		$htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2211
+
2212
+		$site_title = '';
2213
+		if ($site_title == '')
2214
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2215
+
2216
+		if ($site_title == '') {
2217
+			$fields = geodir_get_custom_sort_options($post_type);
2218
+
2219
+			foreach ($fields as $val) {
2220
+				$val = stripslashes_deep($val); // strip slashes
2221
+
2222
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2223
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
2224
+				}
2225
+			}
2226
+		}
2227
+
2228
+		if ($htmlvar_name == '')
2229
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2230
+
2231
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
2232
+
2233
+		$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2234
+		$cso_arr = geodir_get_custom_sort_options($post_type);
2235
+
2236
+		$cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2237
+		foreach($cso_arr as $cso){
2238
+			if($cur_field_type==$cso['field_type']){
2239
+
2240
+				if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2241
+					$field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2242
+				}elseif(isset($cso['field_icon']) && $cso['field_icon']){
2243
+					$field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cso['field_icon'].'\')"></b>';
2244
+				}
2245
+
2246
+			}
2247
+		}
2248
+
2249
+		$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2250
+		?>
2251 2251
 
2252 2252
         <li class="text" id="licontainer_<?php echo $result_str;?>">
2253 2253
             <form><!-- we need to wrap in a form so we can use radio buttons with same name -->
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2257 2257
                 <?php
2258 2258
 
2259
-                ?>
2259
+				?>
2260 2260
 
2261 2261
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2262 2262
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -2271,17 +2271,17 @@  discard block
 block discarded – undo
2271 2271
 
2272 2272
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2273 2273
                  style="display:<?php if ($field_ins_upd == 'submit') {
2274
-                     echo 'block;';
2275
-                 } else {
2276
-                     echo 'none;';
2277
-                 } ?>">
2274
+					 echo 'block;';
2275
+				 } else {
2276
+					 echo 'none;';
2277
+				 } ?>">
2278 2278
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2279 2279
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2280 2280
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2281 2281
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2282 2282
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2283
-                    echo $field_info->data_type;
2284
-                }?>"/>
2283
+					echo $field_info->data_type;
2284
+				}?>"/>
2285 2285
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2286 2286
 
2287 2287
 
@@ -2304,14 +2304,14 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
                                 <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2306 2306
                                     <?php if ($value == '1') {
2307
-                                        echo 'checked';
2308
-                                    } ?>/>
2307
+										echo 'checked';
2308
+									} ?>/>
2309 2309
                                 <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>
2310 2310
 
2311 2311
                                 <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2312 2312
                                     <?php if ($value == '0' || !$value) {
2313
-                                        echo 'checked';
2314
-                                    } ?>/>
2313
+										echo 'checked';
2314
+									} ?>/>
2315 2315
                                 <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>
2316 2316
 
2317 2317
                             </div>
@@ -2348,8 +2348,8 @@  discard block
 block discarded – undo
2348 2348
 
2349 2349
                                 <input type="radio" name="is_default"
2350 2350
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2351
-                                    echo 'checked="checked"';
2352
-                                } ?>/>
2351
+									echo 'checked="checked"';
2352
+								} ?>/>
2353 2353
                             </div>
2354 2354
 
2355 2355
                         </li>
@@ -2369,14 +2369,14 @@  discard block
 block discarded – undo
2369 2369
 
2370 2370
                                 <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2371 2371
                                     <?php if ($value == '1') {
2372
-                                        echo 'checked';
2373
-                                    } ?>/>
2372
+										echo 'checked';
2373
+									} ?>/>
2374 2374
                                 <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>
2375 2375
 
2376 2376
                                 <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2377 2377
                                     <?php if ($value == '0' || !$value) {
2378
-                                        echo 'checked';
2379
-                                    } ?>/>
2378
+										echo 'checked';
2379
+									} ?>/>
2380 2380
                                 <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>
2381 2381
 
2382 2382
                             </div>
@@ -2412,8 +2412,8 @@  discard block
 block discarded – undo
2412 2412
 
2413 2413
                                 <input type="radio" name="is_default"
2414 2414
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2415
-                                    echo 'checked="checked"';
2416
-                                } ?>/>
2415
+									echo 'checked="checked"';
2416
+								} ?>/>
2417 2417
                             </div>
2418 2418
 
2419 2419
                         </li>
@@ -2455,8 +2455,8 @@  discard block
 block discarded – undo
2455 2455
 
2456 2456
                                 <input type="checkbox" name="is_default"
2457 2457
                                        value="<?php echo $field_type; ?>"  <?php if (isset($value) && $value == '1') {
2458
-                                    echo 'checked="checked"';
2459
-                                } ?>/>
2458
+									echo 'checked="checked"';
2459
+								} ?>/>
2460 2460
                             </div>
2461 2461
 
2462 2462
 
@@ -2479,14 +2479,14 @@  discard block
 block discarded – undo
2479 2479
 
2480 2480
                             <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2481 2481
                                 <?php if ($value == '1') {
2482
-                                    echo 'checked';
2483
-                                } ?>/>
2482
+									echo 'checked';
2483
+								} ?>/>
2484 2484
                             <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2485 2485
 
2486 2486
                             <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2487 2487
                                 <?php if ($value == '0' || !$value) {
2488
-                                    echo 'checked';
2489
-                                } ?>/>
2488
+									echo 'checked';
2489
+								} ?>/>
2490 2490
                             <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2491 2491
 
2492 2492
                         </div>
@@ -2496,8 +2496,8 @@  discard block
 block discarded – undo
2496 2496
 
2497 2497
                     <input type="hidden" readonly="readonly" name="sort_order" id="sort_order"
2498 2498
                                                 value="<?php if (isset($field_info->sort_order)) {
2499
-                                                    echo esc_attr($field_info->sort_order);
2500
-                                                }?>" size="50"/>
2499
+													echo esc_attr($field_info->sort_order);
2500
+												}?>" size="50"/>
2501 2501
 
2502 2502
 
2503 2503
 
@@ -2521,38 +2521,38 @@  discard block
 block discarded – undo
2521 2521
             </form>
2522 2522
         </li> <?php
2523 2523
 
2524
-    }
2524
+	}
2525 2525
 }
2526 2526
 
2527 2527
 if (!function_exists('check_field_visibility')) {
2528
-    /**
2529
-     * Check field visibility as per price package.
2530
-     *
2531
-     * @since 1.0.0
2532
-     * @package GeoDirectory
2533
-     * @global object $wpdb WordPress Database object.
2534
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
2535
-     * @param int|string $package_id The package ID.
2536
-     * @param string $field_name The field name.
2537
-     * @param string $post_type Optional. The wordpress post type.
2538
-     * @return bool Returns true when field visible, otherwise false.
2539
-     */
2540
-    function check_field_visibility($package_id, $field_name, $post_type)
2541
-    {
2542
-        global $wpdb, $geodir_addon_list;
2543
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2544
-            return true;
2545
-        }
2546
-        if (!$package_id || !$field_name || !$post_type) {
2547
-            return true;
2548
-        }
2549
-        $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));
2550
-
2551
-        if ($wpdb->get_var($sql)) {
2552
-            return true;
2553
-        }
2554
-        return false;
2555
-    }
2528
+	/**
2529
+	 * Check field visibility as per price package.
2530
+	 *
2531
+	 * @since 1.0.0
2532
+	 * @package GeoDirectory
2533
+	 * @global object $wpdb WordPress Database object.
2534
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
2535
+	 * @param int|string $package_id The package ID.
2536
+	 * @param string $field_name The field name.
2537
+	 * @param string $post_type Optional. The wordpress post type.
2538
+	 * @return bool Returns true when field visible, otherwise false.
2539
+	 */
2540
+	function check_field_visibility($package_id, $field_name, $post_type)
2541
+	{
2542
+		global $wpdb, $geodir_addon_list;
2543
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2544
+			return true;
2545
+		}
2546
+		if (!$package_id || !$field_name || !$post_type) {
2547
+			return true;
2548
+		}
2549
+		$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));
2550
+
2551
+		if ($wpdb->get_var($sql)) {
2552
+			return true;
2553
+		}
2554
+		return false;
2555
+	}
2556 2556
 }
2557 2557
 
2558 2558
 /**
@@ -2568,43 +2568,43 @@  discard block
 block discarded – undo
2568 2568
  */
2569 2569
 function geodir_string_to_options($input = '', $translated = false)
2570 2570
 {
2571
-    $return = array();
2572
-    if ($input != '') {
2573
-        $input = trim($input);
2574
-        $input = rtrim($input, ",");
2575
-        $input = ltrim($input, ",");
2576
-        $input = trim($input);
2577
-    }
2578
-
2579
-    $input_arr = explode(',', $input);
2580
-
2581
-    if (!empty($input_arr)) {
2582
-        foreach ($input_arr as $input_str) {
2583
-            $input_str = trim($input_str);
2584
-
2585
-            if (strpos($input_str, "/") !== false) {
2586
-                $input_str = explode("/", $input_str, 2);
2587
-                $label = trim($input_str[0]);
2588
-                if ($translated && $label != '') {
2589
-                    $label = __($label, 'geodirectory');
2590
-                }
2591
-                $label = geodir_utf8_ucfirst($label);
2592
-                $value = trim($input_str[1]);
2593
-            } else {
2594
-                $value = $input_str;
2595
-                if ($translated && $input_str != '') {
2596
-                    $input_str = __($input_str, 'geodirectory');
2597
-                }
2598
-                $label = geodir_utf8_ucfirst($input_str);
2599
-            }
2600
-
2601
-            if ($label != '') {
2602
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2603
-            }
2604
-        }
2605
-    }
2606
-
2607
-    return $return;
2571
+	$return = array();
2572
+	if ($input != '') {
2573
+		$input = trim($input);
2574
+		$input = rtrim($input, ",");
2575
+		$input = ltrim($input, ",");
2576
+		$input = trim($input);
2577
+	}
2578
+
2579
+	$input_arr = explode(',', $input);
2580
+
2581
+	if (!empty($input_arr)) {
2582
+		foreach ($input_arr as $input_str) {
2583
+			$input_str = trim($input_str);
2584
+
2585
+			if (strpos($input_str, "/") !== false) {
2586
+				$input_str = explode("/", $input_str, 2);
2587
+				$label = trim($input_str[0]);
2588
+				if ($translated && $label != '') {
2589
+					$label = __($label, 'geodirectory');
2590
+				}
2591
+				$label = geodir_utf8_ucfirst($label);
2592
+				$value = trim($input_str[1]);
2593
+			} else {
2594
+				$value = $input_str;
2595
+				if ($translated && $input_str != '') {
2596
+					$input_str = __($input_str, 'geodirectory');
2597
+				}
2598
+				$label = geodir_utf8_ucfirst($input_str);
2599
+			}
2600
+
2601
+			if ($label != '') {
2602
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2603
+			}
2604
+		}
2605
+	}
2606
+
2607
+	return $return;
2608 2608
 }
2609 2609
 
2610 2610
 /**
@@ -2619,66 +2619,66 @@  discard block
 block discarded – undo
2619 2619
  */
2620 2620
 function geodir_string_values_to_options($option_values = '', $translated = false)
2621 2621
 {
2622
-    $options = array();
2623
-    if ($option_values == '') {
2624
-        return NULL;
2625
-    }
2626
-
2627
-    if (strpos($option_values, "{/optgroup}") !== false) {
2628
-        $option_values_arr = explode("{/optgroup}", $option_values);
2629
-
2630
-        foreach ($option_values_arr as $optgroup) {
2631
-            if (strpos($optgroup, "{optgroup}") !== false) {
2632
-                $optgroup_arr = explode("{optgroup}", $optgroup);
2633
-
2634
-                $count = 0;
2635
-                foreach ($optgroup_arr as $optgroup_str) {
2636
-                    $count++;
2637
-                    $optgroup_str = trim($optgroup_str);
2638
-
2639
-                    $optgroup_label = '';
2640
-                    if (strpos($optgroup_str, "|") !== false) {
2641
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
2642
-                        $optgroup_label = trim($optgroup_str_arr[0]);
2643
-                        if ($translated && $optgroup_label != '') {
2644
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
2645
-                        }
2646
-                        $optgroup_label = geodir_utf8_ucfirst($optgroup_label);
2647
-                        $optgroup_str = $optgroup_str_arr[1];
2648
-                    }
2649
-
2650
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2651
-
2652
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2653
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2654
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2655
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2656
-                    }
2657
-                    $options = array_merge($options, $optgroup3);
2658
-                }
2659
-            } else {
2660
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
2661
-                $options = array_merge($options, $optgroup1);
2662
-            }
2663
-        }
2664
-    } else {
2665
-        $options = geodir_string_to_options($option_values, $translated);
2666
-    }
2667
-
2668
-    return $options;
2622
+	$options = array();
2623
+	if ($option_values == '') {
2624
+		return NULL;
2625
+	}
2626
+
2627
+	if (strpos($option_values, "{/optgroup}") !== false) {
2628
+		$option_values_arr = explode("{/optgroup}", $option_values);
2629
+
2630
+		foreach ($option_values_arr as $optgroup) {
2631
+			if (strpos($optgroup, "{optgroup}") !== false) {
2632
+				$optgroup_arr = explode("{optgroup}", $optgroup);
2633
+
2634
+				$count = 0;
2635
+				foreach ($optgroup_arr as $optgroup_str) {
2636
+					$count++;
2637
+					$optgroup_str = trim($optgroup_str);
2638
+
2639
+					$optgroup_label = '';
2640
+					if (strpos($optgroup_str, "|") !== false) {
2641
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
2642
+						$optgroup_label = trim($optgroup_str_arr[0]);
2643
+						if ($translated && $optgroup_label != '') {
2644
+							$optgroup_label = __($optgroup_label, 'geodirectory');
2645
+						}
2646
+						$optgroup_label = geodir_utf8_ucfirst($optgroup_label);
2647
+						$optgroup_str = $optgroup_str_arr[1];
2648
+					}
2649
+
2650
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2651
+
2652
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2653
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2654
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2655
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2656
+					}
2657
+					$options = array_merge($options, $optgroup3);
2658
+				}
2659
+			} else {
2660
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
2661
+				$options = array_merge($options, $optgroup1);
2662
+			}
2663
+		}
2664
+	} else {
2665
+		$options = geodir_string_to_options($option_values, $translated);
2666
+	}
2667
+
2668
+	return $options;
2669 2669
 }
2670 2670
 
2671 2671
 
2672 2672
 function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2673
-    ob_start();
2674
-
2675
-    $dt_value = '';
2676
-    if (isset($field_info->data_type)) {
2677
-        $dt_value  = esc_attr($field_info->data_type);
2678
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2679
-        $dt_value  = $cf['defaults']['data_type'];
2680
-    }
2681
-    ?>
2673
+	ob_start();
2674
+
2675
+	$dt_value = '';
2676
+	if (isset($field_info->data_type)) {
2677
+		$dt_value  = esc_attr($field_info->data_type);
2678
+	}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2679
+		$dt_value  = $cf['defaults']['data_type'];
2680
+	}
2681
+	?>
2682 2682
     <li>
2683 2683
         <label for="data_type"><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
2684 2684
         <div class="gd-cf-input-wrap">
@@ -2687,16 +2687,16 @@  discard block
 block discarded – undo
2687 2687
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2688 2688
                 <option
2689 2689
                     value="XVARCHAR" <?php if ($dt_value  == 'VARCHAR') {
2690
-                    echo 'selected="selected"';
2691
-                } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2690
+					echo 'selected="selected"';
2691
+				} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2692 2692
                 <option
2693 2693
                     value="INT" <?php if ($dt_value   == 'INT') {
2694
-                    echo 'selected="selected"';
2695
-                } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2694
+					echo 'selected="selected"';
2695
+				} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2696 2696
                 <option
2697 2697
                     value="FLOAT" <?php if ($dt_value   == 'FLOAT') {
2698
-                    echo 'selected="selected"';
2699
-                } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2698
+					echo 'selected="selected"';
2699
+				} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2700 2700
             </select>
2701 2701
             <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
2702 2702
 
@@ -2704,13 +2704,13 @@  discard block
 block discarded – undo
2704 2704
     </li>
2705 2705
 
2706 2706
     <?php
2707
-    $value = '';
2708
-    if (isset($field_info->decimal_point)) {
2709
-        $value = esc_attr($field_info->decimal_point);
2710
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2711
-        $value = $cf['defaults']['decimal_point'];
2712
-    }
2713
-    ?>
2707
+	$value = '';
2708
+	if (isset($field_info->decimal_point)) {
2709
+		$value = esc_attr($field_info->decimal_point);
2710
+	}elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2711
+		$value = $cf['defaults']['decimal_point'];
2712
+	}
2713
+	?>
2714 2714
 
2715 2715
     <li class="decimal-point-wrapper"
2716 2716
         style="<?php echo ($dt_value  == 'FLOAT') ? '' : 'display:none' ?>">
@@ -2719,7 +2719,7 @@  discard block
 block discarded – undo
2719 2719
             <select name="decimal_point" id="decimal_point">
2720 2720
                 <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
2721 2721
                 <?php for ($i = 1; $i <= 10; $i++) {
2722
-                    $selected = $i == $value ? 'selected="selected"' : ''; ?>
2722
+					$selected = $i == $value ? 'selected="selected"' : ''; ?>
2723 2723
                     <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
2724 2724
                 <?php } ?>
2725 2725
             </select>
@@ -2728,8 +2728,8 @@  discard block
 block discarded – undo
2728 2728
     </li>
2729 2729
 <?php
2730 2730
 
2731
-    $output = ob_get_clean();
2732
-    return $output;
2731
+	$output = ob_get_clean();
2732
+	return $output;
2733 2733
 }
2734 2734
 add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2735 2735
 
@@ -2765,9 +2765,9 @@  discard block
 block discarded – undo
2765 2765
 
2766 2766
 
2767 2767
 function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2768
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2769
-    ob_start();
2770
-    ?>
2768
+	if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2769
+	ob_start();
2770
+	?>
2771 2771
     <li>
2772 2772
         <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'); ?>
2773 2773
             <div class="gdcf-tooltip">
@@ -2778,13 +2778,13 @@  discard block
 block discarded – undo
2778 2778
         <div class="gd-cf-input-wrap">
2779 2779
 
2780 2780
             <?php
2781
-            $selected = '';
2782
-            if (isset($field_info->extra_fields))
2783
-                $advanced_editor = unserialize($field_info->extra_fields);
2781
+			$selected = '';
2782
+			if (isset($field_info->extra_fields))
2783
+				$advanced_editor = unserialize($field_info->extra_fields);
2784 2784
 
2785
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2786
-                $selected = 'checked="checked"';
2787
-            ?>
2785
+			if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2786
+				$selected = 'checked="checked"';
2787
+			?>
2788 2788
 
2789 2789
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
2790 2790
                    value="1" <?php echo $selected; ?>/>
@@ -2793,22 +2793,22 @@  discard block
 block discarded – undo
2793 2793
     </li>
2794 2794
     <?php
2795 2795
 
2796
-    $output = ob_get_clean();
2797
-    return $output;
2796
+	$output = ob_get_clean();
2797
+	return $output;
2798 2798
 }
2799 2799
 add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2800 2800
 
2801 2801
 
2802 2802
 function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2803
-    ob_start();
2804
-
2805
-    $value = '';
2806
-    if (isset($field_info->validation_pattern)) {
2807
-        $value = esc_attr($field_info->validation_pattern);
2808
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2809
-        $value = esc_attr($cf['defaults']['validation_pattern']);
2810
-    }
2811
-    ?>
2803
+	ob_start();
2804
+
2805
+	$value = '';
2806
+	if (isset($field_info->validation_pattern)) {
2807
+		$value = esc_attr($field_info->validation_pattern);
2808
+	}elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2809
+		$value = esc_attr($cf['defaults']['validation_pattern']);
2810
+	}
2811
+	?>
2812 2812
     <li>
2813 2813
         <label for="validation_pattern" class="gd-cf-tooltip-wrap">
2814 2814
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -2822,13 +2822,13 @@  discard block
 block discarded – undo
2822 2822
         </div>
2823 2823
     </li>
2824 2824
     <?php
2825
-    $value = '';
2826
-    if (isset($field_info->validation_msg)) {
2827
-        $value = esc_attr($field_info->validation_msg);
2828
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2829
-        $value = esc_attr($cf['defaults']['validation_msg']);
2830
-    }
2831
-    ?>
2825
+	$value = '';
2826
+	if (isset($field_info->validation_msg)) {
2827
+		$value = esc_attr($field_info->validation_msg);
2828
+	}elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2829
+		$value = esc_attr($cf['defaults']['validation_msg']);
2830
+	}
2831
+	?>
2832 2832
     <li>
2833 2833
         <label for="validation_msg" class="gd-cf-tooltip-wrap">
2834 2834
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
@@ -2843,21 +2843,21 @@  discard block
 block discarded – undo
2843 2843
     </li>
2844 2844
     <?php
2845 2845
 
2846
-    $output = ob_get_clean();
2847
-    return $output;
2846
+	$output = ob_get_clean();
2847
+	return $output;
2848 2848
 }
2849 2849
 add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2850 2850
 
2851 2851
 
2852 2852
 function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2853
-    ob_start();
2854
-    global $post_type;
2855
-
2856
-    if (!isset($field_info->post_type)) {
2857
-        $post_type = sanitize_text_field($_REQUEST['listing_type']);
2858
-    } else
2859
-        $post_type = $field_info->post_type;
2860
-    ?>
2853
+	ob_start();
2854
+	global $post_type;
2855
+
2856
+	if (!isset($field_info->post_type)) {
2857
+		$post_type = sanitize_text_field($_REQUEST['listing_type']);
2858
+	} else
2859
+		$post_type = $field_info->post_type;
2860
+	?>
2861 2861
     <li style="display: none;">
2862 2862
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
2863 2863
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -2868,15 +2868,15 @@  discard block
 block discarded – undo
2868 2868
         <div class="gd-cf-input-wrap">
2869 2869
             <select name="htmlvar_name" id="htmlvar_name">
2870 2870
                 <?php
2871
-                $gd_taxonomy = geodir_get_taxonomies($post_type);
2871
+				$gd_taxonomy = geodir_get_taxonomies($post_type);
2872 2872
 
2873
-                foreach ($gd_taxonomy as $gd_tax) {
2874
-                    ?>
2873
+				foreach ($gd_taxonomy as $gd_tax) {
2874
+					?>
2875 2875
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2876
-                        echo 'selected="selected"';
2877
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2878
-                }
2879
-                ?>
2876
+						echo 'selected="selected"';
2877
+					}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2878
+				}
2879
+				?>
2880 2880
             </select>
2881 2881
         </div>
2882 2882
     </li>
@@ -2892,49 +2892,49 @@  discard block
 block discarded – undo
2892 2892
 
2893 2893
             <select name="cat_display_type" id="cat_display_type">
2894 2894
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2895
-                    echo 'selected="selected"';
2896
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2895
+					echo 'selected="selected"';
2896
+				}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2897 2897
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2898
-                    echo 'selected="selected"';
2899
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2898
+					echo 'selected="selected"';
2899
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2900 2900
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2901
-                    echo 'selected="selected"';
2902
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2901
+					echo 'selected="selected"';
2902
+				}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2903 2903
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2904
-                    echo 'selected="selected"';
2905
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2904
+					echo 'selected="selected"';
2905
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2906 2906
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2907
-                    echo 'selected="selected"';
2908
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2907
+					echo 'selected="selected"';
2908
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2909 2909
             </select>
2910 2910
         </div>
2911 2911
     </li>
2912 2912
     <?php
2913 2913
 
2914
-    $output = ob_get_clean();
2915
-    return $output;
2914
+	$output = ob_get_clean();
2915
+	return $output;
2916 2916
 }
2917 2917
 add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2918 2918
 
2919 2919
 
2920 2920
 function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2921 2921
 
2922
-    ob_start();
2923
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2924
-        $address = stripslashes_deep(unserialize($field_info->extra_fields));
2925
-    }
2922
+	ob_start();
2923
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2924
+		$address = stripslashes_deep(unserialize($field_info->extra_fields));
2925
+	}
2926 2926
 
2927
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2928
-    ?>
2927
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2928
+	?>
2929 2929
     <?php
2930
-    /**
2931
-     * Called on the add custom fields settings page before the address field is output.
2932
-     *
2933
-     * @since 1.0.0
2934
-     * @param array $address The address settings array.
2935
-     * @param object $field_info Extra fields info.
2936
-     */
2937
-    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2930
+	/**
2931
+	 * Called on the add custom fields settings page before the address field is output.
2932
+	 *
2933
+	 * @since 1.0.0
2934
+	 * @param array $address The address settings array.
2935
+	 * @param object $field_info Extra fields info.
2936
+	 */
2937
+	do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2938 2938
 
2939 2939
     <li>
2940 2940
         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -2947,14 +2947,14 @@  discard block
 block discarded – undo
2947 2947
 
2948 2948
             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2949 2949
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2950
-                    echo 'checked';
2951
-                } ?>/>
2950
+					echo 'checked';
2951
+				} ?>/>
2952 2952
             <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>
2953 2953
 
2954 2954
             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2955 2955
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2956
-                    echo 'checked';
2957
-                } ?>/>
2956
+					echo 'checked';
2957
+				} ?>/>
2958 2958
             <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>
2959 2959
 
2960 2960
 
@@ -2971,8 +2971,8 @@  discard block
 block discarded – undo
2971 2971
         <div class="gd-cf-input-wrap">
2972 2972
             <input type="text" name="extra[zip_lable]" id="zip_lable"
2973 2973
                    value="<?php if (isset($address['zip_lable'])) {
2974
-                       echo esc_attr($address['zip_lable']);
2975
-                   }?>"/>
2974
+					   echo esc_attr($address['zip_lable']);
2975
+				   }?>"/>
2976 2976
         </div>
2977 2977
     </li>
2978 2978
 
@@ -2989,8 +2989,8 @@  discard block
 block discarded – undo
2989 2989
         <div class="gd-cf-input-wrap">
2990 2990
             <input type="text" name="extra[map_lable]" id="map_lable"
2991 2991
                    value="<?php if (isset($address['map_lable'])) {
2992
-                       echo esc_attr($address['map_lable']);
2993
-                   }?>"/>
2992
+					   echo esc_attr($address['map_lable']);
2993
+				   }?>"/>
2994 2994
         </div>
2995 2995
     </li>
2996 2996
 
@@ -3005,14 +3005,14 @@  discard block
 block discarded – undo
3005 3005
 
3006 3006
             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
3007 3007
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
3008
-                    echo 'checked';
3009
-                } ?>/>
3008
+					echo 'checked';
3009
+				} ?>/>
3010 3010
             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3011 3011
 
3012 3012
             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
3013 3013
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
3014
-                    echo 'checked';
3015
-                } ?>/>
3014
+					echo 'checked';
3015
+				} ?>/>
3016 3016
             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3017 3017
 
3018 3018
         </div>
@@ -3029,14 +3029,14 @@  discard block
 block discarded – undo
3029 3029
 
3030 3030
             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
3031 3031
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
3032
-                    echo 'checked';
3033
-                } ?>/>
3032
+					echo 'checked';
3033
+				} ?>/>
3034 3034
             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3035 3035
 
3036 3036
             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
3037 3037
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
3038
-                    echo 'checked';
3039
-                } ?>/>
3038
+					echo 'checked';
3039
+				} ?>/>
3040 3040
             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3041 3041
 
3042 3042
         </div>
@@ -3053,8 +3053,8 @@  discard block
 block discarded – undo
3053 3053
         <div class="gd-cf-input-wrap">
3054 3054
             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
3055 3055
                    value="<?php if (isset($address['mapview_lable'])) {
3056
-                       echo esc_attr($address['mapview_lable']);
3057
-                   }?>"/>
3056
+					   echo esc_attr($address['mapview_lable']);
3057
+				   }?>"/>
3058 3058
         </div>
3059 3059
     </li>
3060 3060
     <li>
@@ -3068,29 +3068,29 @@  discard block
 block discarded – undo
3068 3068
 
3069 3069
             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3070 3070
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3071
-                    echo 'checked';
3072
-                } ?>/>
3071
+					echo 'checked';
3072
+				} ?>/>
3073 3073
             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3074 3074
 
3075 3075
             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3076 3076
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3077
-                    echo 'checked';
3078
-                } ?>/>
3077
+					echo 'checked';
3078
+				} ?>/>
3079 3079
             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3080 3080
 
3081 3081
         </div>
3082 3082
     </li>
3083 3083
     <?php
3084 3084
 
3085
-    $html = ob_get_clean();
3086
-    return $output.$html;
3085
+	$html = ob_get_clean();
3086
+	return $output.$html;
3087 3087
 }
3088 3088
 add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3089 3089
 
3090 3090
 
3091 3091
 function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3092
-    ob_start();
3093
-    ?>
3092
+	ob_start();
3093
+	?>
3094 3094
     <li>
3095 3095
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3096 3096
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -3102,14 +3102,14 @@  discard block
 block discarded – undo
3102 3102
 
3103 3103
             <select name="multi_display_type" id="multi_display_type">
3104 3104
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3105
-                    echo 'selected="selected"';
3106
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3105
+					echo 'selected="selected"';
3106
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
3107 3107
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3108
-                    echo 'selected="selected"';
3109
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3108
+					echo 'selected="selected"';
3109
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3110 3110
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3111
-                    echo 'selected="selected"';
3112
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3111
+					echo 'selected="selected"';
3112
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3113 3113
             </select>
3114 3114
 
3115 3115
             <br/>
@@ -3117,25 +3117,25 @@  discard block
 block discarded – undo
3117 3117
     </li>
3118 3118
     <?php
3119 3119
 
3120
-    $html = ob_get_clean();
3121
-    return $output.$html;
3120
+	$html = ob_get_clean();
3121
+	return $output.$html;
3122 3122
 }
3123 3123
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3124 3124
 
3125 3125
 
3126 3126
 function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3127 3127
 
3128
-    ob_start();
3128
+	ob_start();
3129 3129
 
3130
-    $value = '';
3131
-    if (isset($field_info->option_values)) {
3132
-        $value = esc_attr($field_info->option_values);
3133
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3134
-        $value = esc_attr($cf['defaults']['option_values']);
3135
-    }
3130
+	$value = '';
3131
+	if (isset($field_info->option_values)) {
3132
+		$value = esc_attr($field_info->option_values);
3133
+	}elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3134
+		$value = esc_attr($cf['defaults']['option_values']);
3135
+	}
3136 3136
 
3137
-    $field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3138
-    ?>
3137
+	$field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3138
+	?>
3139 3139
     <li>
3140 3140
         <label for="option_values" class="gd-cf-tooltip-wrap">
3141 3141
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -3162,8 +3162,8 @@  discard block
 block discarded – undo
3162 3162
     </li>
3163 3163
     <?php
3164 3164
 
3165
-    $html = ob_get_clean();
3166
-    return $output.$html;
3165
+	$html = ob_get_clean();
3166
+	return $output.$html;
3167 3167
 }
3168 3168
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3169 3169
 add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
@@ -3171,12 +3171,12 @@  discard block
 block discarded – undo
3171 3171
 
3172 3172
 
3173 3173
 function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3174
-    ob_start();
3175
-    $extra = array();
3176
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3177
-        $extra = unserialize($field_info->extra_fields);
3178
-    }
3179
-    ?>
3174
+	ob_start();
3175
+	$extra = array();
3176
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3177
+		$extra = unserialize($field_info->extra_fields);
3178
+	}
3179
+	?>
3180 3180
     <li>
3181 3181
         <label for="date_format" class="gd-cf-tooltip-wrap">
3182 3182
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -3186,52 +3186,52 @@  discard block
 block discarded – undo
3186 3186
         </label>
3187 3187
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
3188 3188
             <?php
3189
-            $date_formats = array(
3190
-                'm/d/Y',
3191
-                'd/m/Y',
3192
-                'Y/m/d',
3193
-                'm-d-Y',
3194
-                'd-m-Y',
3195
-                'Y-m-d',
3196
-                'F j, Y',
3197
-            );
3198
-            /**
3199
-             * Filter the custom field date format options.
3200
-             *
3201
-             * @since 1.6.5
3202
-             * @param array $date_formats The PHP date format array.
3203
-             */
3204
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3205
-            ?>
3189
+			$date_formats = array(
3190
+				'm/d/Y',
3191
+				'd/m/Y',
3192
+				'Y/m/d',
3193
+				'm-d-Y',
3194
+				'd-m-Y',
3195
+				'Y-m-d',
3196
+				'F j, Y',
3197
+			);
3198
+			/**
3199
+			 * Filter the custom field date format options.
3200
+			 *
3201
+			 * @since 1.6.5
3202
+			 * @param array $date_formats The PHP date format array.
3203
+			 */
3204
+			$date_formats = apply_filters('geodir_date_formats',$date_formats);
3205
+			?>
3206 3206
             <select name="extra[date_format]" id="date_format">
3207 3207
                 <?php
3208
-                foreach($date_formats as $format){
3209
-                    $selected = '';
3210
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3211
-                        $selected = "selected='selected'";
3212
-                    }
3213
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3214
-                }
3215
-                ?>
3208
+				foreach($date_formats as $format){
3209
+					$selected = '';
3210
+					if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3211
+						$selected = "selected='selected'";
3212
+					}
3213
+					echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3214
+				}
3215
+				?>
3216 3216
             </select>
3217 3217
 
3218 3218
         </div>
3219 3219
     </li>
3220 3220
     <?php
3221 3221
 
3222
-    $html = ob_get_clean();
3223
-    return $output.$html;
3222
+	$html = ob_get_clean();
3223
+	return $output.$html;
3224 3224
 }
3225 3225
 add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3226 3226
 
3227 3227
 
3228 3228
 function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3229
-    ob_start();
3230
-    $allowed_file_types = geodir_allowed_mime_types();
3229
+	ob_start();
3230
+	$allowed_file_types = geodir_allowed_mime_types();
3231 3231
 
3232
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3233
-    $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3234
-    ?>
3232
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3233
+	$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3234
+	?>
3235 3235
     <li>
3236 3236
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3237 3237
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
@@ -3254,33 +3254,33 @@  discard block
 block discarded – undo
3254 3254
     </li>
3255 3255
     <?php
3256 3256
 
3257
-    $html = ob_get_clean();
3258
-    return $output.$html;
3257
+	$html = ob_get_clean();
3258
+	return $output.$html;
3259 3259
 }
3260 3260
 add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3261 3261
 
3262 3262
 function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
3263
-    ob_start();
3263
+	ob_start();
3264 3264
 
3265
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3265
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3266 3266
    // print_r($cf);echo '###';
3267 3267
 
3268 3268
 
3269 3269
 
3270
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
3270
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
3271 3271
 
3272 3272
 
3273
-    $value = '';
3274
-    if ($extra_fields && isset($extra_fields['is_price'])) {
3275
-    $value = esc_attr($extra_fields['is_price']);
3276
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3277
-    $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3278
-    }
3273
+	$value = '';
3274
+	if ($extra_fields && isset($extra_fields['is_price'])) {
3275
+	$value = esc_attr($extra_fields['is_price']);
3276
+	}elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3277
+	$value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3278
+	}
3279 3279
 
3280
-    $show_price_extra = ($value==1) ? 1 : 0;
3280
+	$show_price_extra = ($value==1) ? 1 : 0;
3281 3281
 
3282
-    $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0;
3283
-    ?>
3282
+	$show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0;
3283
+	?>
3284 3284
     <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
3285 3285
         <label for="is_price" class="gd-cf-tooltip-wrap">
3286 3286
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
@@ -3292,14 +3292,14 @@  discard block
 block discarded – undo
3292 3292
 
3293 3293
             <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled"  value="1"
3294 3294
                 <?php if ($value == '1') {
3295
-                    echo 'checked';
3296
-                } ?>/>
3295
+					echo 'checked';
3296
+				} ?>/>
3297 3297
             <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>
3298 3298
 
3299 3299
             <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0"
3300 3300
                 <?php if ($value == '0' || !$value) {
3301
-                    echo 'checked';
3302
-                } ?>/>
3301
+					echo 'checked';
3302
+				} ?>/>
3303 3303
             <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>
3304 3304
 
3305 3305
         </div>
@@ -3307,13 +3307,13 @@  discard block
 block discarded – undo
3307 3307
 
3308 3308
     <?php
3309 3309
 
3310
-    $value = '';
3311
-    if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3312
-        $value = esc_attr($extra_fields['thousand_separator']);
3313
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3314
-        $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3315
-    }
3316
-    ?>
3310
+	$value = '';
3311
+	if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3312
+		$value = esc_attr($extra_fields['thousand_separator']);
3313
+	}elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3314
+		$value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3315
+	}
3316
+	?>
3317 3317
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3318 3318
         <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
3319 3319
             <div class="gdcf-tooltip">
@@ -3334,13 +3334,13 @@  discard block
 block discarded – undo
3334 3334
 
3335 3335
     <?php
3336 3336
 
3337
-    $value = '';
3338
-    if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3339
-        $value = esc_attr($extra_fields['decimal_separator']);
3340
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3341
-        $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3342
-    }
3343
-    ?>
3337
+	$value = '';
3338
+	if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3339
+		$value = esc_attr($extra_fields['decimal_separator']);
3340
+	}elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3341
+		$value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3342
+	}
3343
+	?>
3344 3344
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3345 3345
         <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
3346 3346
             <div class="gdcf-tooltip">
@@ -3357,13 +3357,13 @@  discard block
 block discarded – undo
3357 3357
 
3358 3358
     <?php
3359 3359
 
3360
-    $value = '';
3361
-    if ($extra_fields && isset($extra_fields['decimal_display'])) {
3362
-        $value = esc_attr($extra_fields['decimal_display']);
3363
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3364
-        $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3365
-    }
3366
-    ?>
3360
+	$value = '';
3361
+	if ($extra_fields && isset($extra_fields['decimal_display'])) {
3362
+		$value = esc_attr($extra_fields['decimal_display']);
3363
+	}elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3364
+		$value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3365
+	}
3366
+	?>
3367 3367
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3368 3368
         <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
3369 3369
             <div class="gdcf-tooltip">
@@ -3380,13 +3380,13 @@  discard block
 block discarded – undo
3380 3380
 
3381 3381
     <?php
3382 3382
 
3383
-    $value = '';
3384
-    if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3385
-        $value = esc_attr($extra_fields['currency_symbol']);
3386
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3387
-        $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3388
-    }
3389
-    ?>
3383
+	$value = '';
3384
+	if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3385
+		$value = esc_attr($extra_fields['currency_symbol']);
3386
+	}elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3387
+		$value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3388
+	}
3389
+	?>
3390 3390
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3391 3391
         <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
3392 3392
             <div class="gdcf-tooltip">
@@ -3401,13 +3401,13 @@  discard block
 block discarded – undo
3401 3401
 
3402 3402
     <?php
3403 3403
 
3404
-    $value = '';
3405
-    if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3406
-        $value = esc_attr($extra_fields['currency_symbol_placement']);
3407
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3408
-        $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3409
-    }
3410
-    ?>
3404
+	$value = '';
3405
+	if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3406
+		$value = esc_attr($extra_fields['currency_symbol_placement']);
3407
+	}elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3408
+		$value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3409
+	}
3410
+	?>
3411 3411
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3412 3412
         <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');?>
3413 3413
             <div class="gdcf-tooltip">
@@ -3425,225 +3425,225 @@  discard block
 block discarded – undo
3425 3425
 
3426 3426
     <?php
3427 3427
 
3428
-    $html = ob_get_clean();
3429
-    return $output.$html;
3428
+	$html = ob_get_clean();
3429
+	return $output.$html;
3430 3430
 }
3431 3431
 add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
3432 3432
 
3433 3433
 function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3434
-    $fields = array();
3435
-    $package = ($package_id=='') ? '' : array($package_id);
3436
-
3437
-    $fields[] = array('listing_type' => $post_type,
3438
-                      'data_type' => 'VARCHAR',
3439
-                      'field_type' => 'taxonomy',
3440
-                      'admin_title' => __('Category', 'geodirectory'),
3441
-                      'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3442
-                      'site_title' => __('Category', 'geodirectory'),
3443
-                      'htmlvar_name' => $post_type.'category',
3444
-                      'default_value' => '',
3445
-                      'is_default' => '1',
3446
-                      'is_admin' => '1',
3447
-                      'is_required' => '1',
3448
-                      'show_in'   =>  '[detail]',
3449
-                      'show_on_pkg' => $package,
3450
-                      'clabels' => __('Category', 'geodirectory'));
3451
-
3452
-    $fields[] = array('listing_type' => $post_type,
3453
-                      'data_type' => 'VARCHAR',
3454
-                      'field_type' => 'address',
3455
-                      'admin_title' => __('Address', 'geodirectory'),
3456
-                      'admin_desc' => ADDRESS_MSG,
3457
-                      'site_title' => __('Address', 'geodirectory'),
3458
-                      'htmlvar_name' => 'post',
3459
-                      'default_value' => '',
3460
-                      'option_values' => '',
3461
-                      'is_default' => '1',
3462
-                      'is_admin' => '1',
3463
-                      'is_required' => '1',
3464
-                      'show_in'   =>  '[detail],[mapbubble]',
3465
-                      'show_on_pkg' => $package,
3466
-                      'required_msg' => __('Address fields are required', 'geodirectory'),
3467
-                      'clabels' => __('Address', 'geodirectory'),
3468
-                      'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3469
-                                       'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3470
-                                       'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3471
-                                       'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3472
-                                       'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3473
-                                       'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3474
-                                       'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3475
-                                       'show_latlng' => 1));
3476
-
3477
-    $fields[] = array('listing_type' => $post_type,
3478
-                      'data_type' => 'VARCHAR',
3479
-                      'field_type' => 'text',
3480
-                      'admin_title' => __('Time', 'geodirectory'),
3481
-                      'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3482
-                      'site_title' => __('Time', 'geodirectory'),
3483
-                      'htmlvar_name' => 'timing',
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' => __('Time', 'geodirectory'));
3491
-
3492
-    $fields[] = array('listing_type' => $post_type,
3493
-                      'data_type' => 'VARCHAR',
3494
-                      'field_type' => 'phone',
3495
-                      'admin_title' => __('Phone', 'geodirectory'),
3496
-                      'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3497
-                      'site_title' => __('Phone', 'geodirectory'),
3498
-                      'htmlvar_name' => 'contact',
3499
-                      'default_value' => '',
3500
-                      'option_values' => '',
3501
-                      'is_default' => '1',
3502
-                      'is_admin' => '1',
3503
-                      'show_in' =>  '[detail],[mapbubble]',
3504
-                      'show_on_pkg' => $package,
3505
-                      'clabels' => __('Phone', 'geodirectory'));
3506
-
3507
-    $fields[] = array('listing_type' => $post_type,
3508
-                      'data_type' => 'VARCHAR',
3509
-                      'field_type' => 'email',
3510
-                      'admin_title' => __('Email', 'geodirectory'),
3511
-                      'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3512
-                      'site_title' => __('Email', 'geodirectory'),
3513
-                      'htmlvar_name' => 'email',
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' => __('Email', 'geodirectory'));
3521
-
3522
-    $fields[] = array('listing_type' => $post_type,
3523
-                      'data_type' => 'VARCHAR',
3524
-                      'field_type' => 'url',
3525
-                      'admin_title' => __('Website', 'geodirectory'),
3526
-                      'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3527
-                      'site_title' => __('Website', 'geodirectory'),
3528
-                      'htmlvar_name' => 'website',
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' => __('Website', 'geodirectory'));
3536
-
3537
-    $fields[] = array('listing_type' => $post_type,
3538
-                      'data_type' => 'VARCHAR',
3539
-                      'field_type' => 'url',
3540
-                      'admin_title' => __('Twitter', 'geodirectory'),
3541
-                      'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3542
-                      'site_title' => __('Twitter', 'geodirectory'),
3543
-                      'htmlvar_name' => 'twitter',
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' => __('Twitter', 'geodirectory'));
3551
-
3552
-    $fields[] = array('listing_type' => $post_type,
3553
-                      'data_type' => 'VARCHAR',
3554
-                      'field_type' => 'url',
3555
-                      'admin_title' => __('Facebook', 'geodirectory'),
3556
-                      'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3557
-                      'site_title' => __('Facebook', 'geodirectory'),
3558
-                      'htmlvar_name' => 'facebook',
3559
-                      'default_value' => '',
3560
-                      'option_values' => '',
3561
-                      'is_default' => '1',
3562
-                      'is_admin' => '1',
3563
-                      'show_in' => '[detail]',
3564
-                      'show_on_pkg' => $package,
3565
-                      'clabels' => __('Facebook', 'geodirectory'));
3566
-
3567
-    $fields[] = array('listing_type' => $post_type,
3568
-                      'data_type' => 'TEXT',
3569
-                      'field_type' => 'textarea',
3570
-                      'admin_title' => __('Video', 'geodirectory'),
3571
-                      'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3572
-                      'site_title' => __('Video', 'geodirectory'),
3573
-                      'htmlvar_name' => 'video',
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' => __('Video', 'geodirectory'));
3581
-
3582
-    $fields[] = array('listing_type' => $post_type,
3583
-                      'data_type' => 'TEXT',
3584
-                      'field_type' => 'textarea',
3585
-                      'admin_title' => __('Special Offers', 'geodirectory'),
3586
-                      'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3587
-                      'site_title' => __('Special Offers', 'geodirectory'),
3588
-                      'htmlvar_name' => 'special_offers',
3589
-                      'default_value' => '',
3590
-                      'option_values' => '',
3591
-                      'is_default' => '0',
3592
-                      'is_admin' => '1',
3593
-                      'show_in' => '[owntab]',
3594
-                      'show_on_pkg' => $package,
3595
-                      'clabels' => __('Special Offers', 'geodirectory'));
3596
-
3597
-    /**
3598
-     * Filter the array of default custom fields DB table data.
3599
-     *
3600
-     * @since 1.6.6
3601
-     * @param string $fields The default custom fields as an array.
3602
-     */
3603
-    $fields = apply_filters('geodir_default_custom_fields', $fields);
3604
-
3605
-    return  $fields;
3434
+	$fields = array();
3435
+	$package = ($package_id=='') ? '' : array($package_id);
3436
+
3437
+	$fields[] = array('listing_type' => $post_type,
3438
+					  'data_type' => 'VARCHAR',
3439
+					  'field_type' => 'taxonomy',
3440
+					  'admin_title' => __('Category', 'geodirectory'),
3441
+					  'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3442
+					  'site_title' => __('Category', 'geodirectory'),
3443
+					  'htmlvar_name' => $post_type.'category',
3444
+					  'default_value' => '',
3445
+					  'is_default' => '1',
3446
+					  'is_admin' => '1',
3447
+					  'is_required' => '1',
3448
+					  'show_in'   =>  '[detail]',
3449
+					  'show_on_pkg' => $package,
3450
+					  'clabels' => __('Category', 'geodirectory'));
3451
+
3452
+	$fields[] = array('listing_type' => $post_type,
3453
+					  'data_type' => 'VARCHAR',
3454
+					  'field_type' => 'address',
3455
+					  'admin_title' => __('Address', 'geodirectory'),
3456
+					  'admin_desc' => ADDRESS_MSG,
3457
+					  'site_title' => __('Address', 'geodirectory'),
3458
+					  'htmlvar_name' => 'post',
3459
+					  'default_value' => '',
3460
+					  'option_values' => '',
3461
+					  'is_default' => '1',
3462
+					  'is_admin' => '1',
3463
+					  'is_required' => '1',
3464
+					  'show_in'   =>  '[detail],[mapbubble]',
3465
+					  'show_on_pkg' => $package,
3466
+					  'required_msg' => __('Address fields are required', 'geodirectory'),
3467
+					  'clabels' => __('Address', 'geodirectory'),
3468
+					  'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3469
+									   'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3470
+									   'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3471
+									   'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3472
+									   'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3473
+									   'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3474
+									   'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3475
+									   'show_latlng' => 1));
3476
+
3477
+	$fields[] = array('listing_type' => $post_type,
3478
+					  'data_type' => 'VARCHAR',
3479
+					  'field_type' => 'text',
3480
+					  'admin_title' => __('Time', 'geodirectory'),
3481
+					  'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3482
+					  'site_title' => __('Time', 'geodirectory'),
3483
+					  'htmlvar_name' => 'timing',
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' => __('Time', 'geodirectory'));
3491
+
3492
+	$fields[] = array('listing_type' => $post_type,
3493
+					  'data_type' => 'VARCHAR',
3494
+					  'field_type' => 'phone',
3495
+					  'admin_title' => __('Phone', 'geodirectory'),
3496
+					  'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3497
+					  'site_title' => __('Phone', 'geodirectory'),
3498
+					  'htmlvar_name' => 'contact',
3499
+					  'default_value' => '',
3500
+					  'option_values' => '',
3501
+					  'is_default' => '1',
3502
+					  'is_admin' => '1',
3503
+					  'show_in' =>  '[detail],[mapbubble]',
3504
+					  'show_on_pkg' => $package,
3505
+					  'clabels' => __('Phone', 'geodirectory'));
3506
+
3507
+	$fields[] = array('listing_type' => $post_type,
3508
+					  'data_type' => 'VARCHAR',
3509
+					  'field_type' => 'email',
3510
+					  'admin_title' => __('Email', 'geodirectory'),
3511
+					  'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3512
+					  'site_title' => __('Email', 'geodirectory'),
3513
+					  'htmlvar_name' => 'email',
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' => __('Email', 'geodirectory'));
3521
+
3522
+	$fields[] = array('listing_type' => $post_type,
3523
+					  'data_type' => 'VARCHAR',
3524
+					  'field_type' => 'url',
3525
+					  'admin_title' => __('Website', 'geodirectory'),
3526
+					  'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3527
+					  'site_title' => __('Website', 'geodirectory'),
3528
+					  'htmlvar_name' => 'website',
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' => __('Website', 'geodirectory'));
3536
+
3537
+	$fields[] = array('listing_type' => $post_type,
3538
+					  'data_type' => 'VARCHAR',
3539
+					  'field_type' => 'url',
3540
+					  'admin_title' => __('Twitter', 'geodirectory'),
3541
+					  'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3542
+					  'site_title' => __('Twitter', 'geodirectory'),
3543
+					  'htmlvar_name' => 'twitter',
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' => __('Twitter', 'geodirectory'));
3551
+
3552
+	$fields[] = array('listing_type' => $post_type,
3553
+					  'data_type' => 'VARCHAR',
3554
+					  'field_type' => 'url',
3555
+					  'admin_title' => __('Facebook', 'geodirectory'),
3556
+					  'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3557
+					  'site_title' => __('Facebook', 'geodirectory'),
3558
+					  'htmlvar_name' => 'facebook',
3559
+					  'default_value' => '',
3560
+					  'option_values' => '',
3561
+					  'is_default' => '1',
3562
+					  'is_admin' => '1',
3563
+					  'show_in' => '[detail]',
3564
+					  'show_on_pkg' => $package,
3565
+					  'clabels' => __('Facebook', 'geodirectory'));
3566
+
3567
+	$fields[] = array('listing_type' => $post_type,
3568
+					  'data_type' => 'TEXT',
3569
+					  'field_type' => 'textarea',
3570
+					  'admin_title' => __('Video', 'geodirectory'),
3571
+					  'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3572
+					  'site_title' => __('Video', 'geodirectory'),
3573
+					  'htmlvar_name' => 'video',
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' => __('Video', 'geodirectory'));
3581
+
3582
+	$fields[] = array('listing_type' => $post_type,
3583
+					  'data_type' => 'TEXT',
3584
+					  'field_type' => 'textarea',
3585
+					  'admin_title' => __('Special Offers', 'geodirectory'),
3586
+					  'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3587
+					  'site_title' => __('Special Offers', 'geodirectory'),
3588
+					  'htmlvar_name' => 'special_offers',
3589
+					  'default_value' => '',
3590
+					  'option_values' => '',
3591
+					  'is_default' => '0',
3592
+					  'is_admin' => '1',
3593
+					  'show_in' => '[owntab]',
3594
+					  'show_on_pkg' => $package,
3595
+					  'clabels' => __('Special Offers', 'geodirectory'));
3596
+
3597
+	/**
3598
+	 * Filter the array of default custom fields DB table data.
3599
+	 *
3600
+	 * @since 1.6.6
3601
+	 * @param string $fields The default custom fields as an array.
3602
+	 */
3603
+	$fields = apply_filters('geodir_default_custom_fields', $fields);
3604
+
3605
+	return  $fields;
3606 3606
 }
3607 3607
 
3608 3608
 function geodir_currency_format_number($number='',$cf=''){
3609 3609
 
3610
-    $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3610
+	$cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3611 3611
 
3612
-    $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$';
3613
-    $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2;
3614
-    $decimal_display = !empty($cf['decimal_display']) ? $cf['decimal_display'] : (!empty($cs['decimal_display']) ? $cs['decimal_display'] : 'if');
3615
-    $decimalpoint = '.';
3612
+	$symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$';
3613
+	$decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2;
3614
+	$decimal_display = !empty($cf['decimal_display']) ? $cf['decimal_display'] : (!empty($cs['decimal_display']) ? $cs['decimal_display'] : 'if');
3615
+	$decimalpoint = '.';
3616 3616
 
3617
-    if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3618
-        $decimalpoint = ',';
3619
-    }
3617
+	if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3618
+		$decimalpoint = ',';
3619
+	}
3620 3620
 
3621
-    $separator = ',';
3621
+	$separator = ',';
3622 3622
 
3623
-    if(isset($cs['thousand_separator'])){
3624
-        if($cs['thousand_separator']=='comma'){$separator = ',';}
3625
-        if($cs['thousand_separator']=='slash'){$separator = '\\';}
3626
-        if($cs['thousand_separator']=='period'){$separator = '.';}
3627
-        if($cs['thousand_separator']=='space'){$separator = ' ';}
3628
-        if($cs['thousand_separator']=='none'){$separator = '';}
3629
-    }
3623
+	if(isset($cs['thousand_separator'])){
3624
+		if($cs['thousand_separator']=='comma'){$separator = ',';}
3625
+		if($cs['thousand_separator']=='slash'){$separator = '\\';}
3626
+		if($cs['thousand_separator']=='period'){$separator = '.';}
3627
+		if($cs['thousand_separator']=='space'){$separator = ' ';}
3628
+		if($cs['thousand_separator']=='none'){$separator = '';}
3629
+	}
3630 3630
 
3631
-    $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3631
+	$currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3632 3632
 
3633
-    if($decimals>0 && $decimal_display=='if'){
3634
-        if(is_int($number) || floor( $number ) == $number)
3635
-            $decimals = 0;
3636
-    }
3633
+	if($decimals>0 && $decimal_display=='if'){
3634
+		if(is_int($number) || floor( $number ) == $number)
3635
+			$decimals = 0;
3636
+	}
3637 3637
 
3638
-    $number = number_format($number,$decimals,$decimalpoint,$separator);
3638
+	$number = number_format($number,$decimals,$decimalpoint,$separator);
3639 3639
 
3640 3640
 
3641 3641
 
3642
-    if($currency_symbol_placement=='left'){
3643
-        $number = $symbol . $number;
3644
-    }else{
3645
-        $number = $number . $symbol;
3646
-    }
3642
+	if($currency_symbol_placement=='left'){
3643
+		$number = $symbol . $number;
3644
+	}else{
3645
+		$number = $number . $symbol;
3646
+	}
3647 3647
 
3648 3648
 
3649 3649
    return $number;
Please login to merge, or discard this patch.
geodirectory-templates/popup-forms.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -28,68 +28,68 @@
 block discarded – undo
28 28
               action="<?php echo get_permalink($post_info->ID); ?>">
29 29
 
30 30
             <?php
31
-            wp_nonce_field( 'send_inquiry_'.$post_info->ID );
32
-            ?>
31
+			wp_nonce_field( 'send_inquiry_'.$post_info->ID );
32
+			?>
33 33
             <input type="hidden" name="sendact" value="send_inqury"/>
34 34
             <input type="hidden" name="pid" value="<?php echo $post_info->ID;?>"/>
35 35
 
36 36
             <h3><?php
37
-                /**
38
-                 * Filter the title for the send inquiry popup form.
39
-                 *
40
-                 * @since 1.0.0
41
-                 * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text.
42
-                 */
43
-                echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3>
37
+				/**
38
+				 * Filter the title for the send inquiry popup form.
39
+				 *
40
+				 * @since 1.0.0
41
+				 * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text.
42
+				 */
43
+				echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3>
44 44
 
45 45
             <p id="inquiry_send_success" class="sucess_msg" style="display:none;"></p>
46 46
             <?php
47
-            /**
48
-             * Called before each field in the send inquiry template.
49
-             *
50
-             * @since 1.0.0
51
-             * @param string $field The field name the actions is called before.
52
-             */
53
-            do_action('geodir_before_inquiry_form_field', 'inq_name');?>
47
+			/**
48
+			 * Called before each field in the send inquiry template.
49
+			 *
50
+			 * @since 1.0.0
51
+			 * @param string $field The field name the actions is called before.
52
+			 */
53
+			do_action('geodir_before_inquiry_form_field', 'inq_name');?>
54 54
             <div class="row  clearfix">
55 55
                     <input required field_type="text" name="inq_name" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory');?>"/>
56 56
             </div>
57 57
             <?php
58
-            /**
59
-             * Called after each field in the send inquiry template.
60
-             *
61
-             * @since 1.0.0
62
-             * @param string $field The field name the actions is called after.
63
-             */
64
-            do_action('geodir_after_inquiry_form_field', 'inq_name');?>
58
+			/**
59
+			 * Called after each field in the send inquiry template.
60
+			 *
61
+			 * @since 1.0.0
62
+			 * @param string $field The field name the actions is called after.
63
+			 */
64
+			do_action('geodir_after_inquiry_form_field', 'inq_name');?>
65 65
             <?php
66
-            /** This action is documented in geodirectory-templates/popup-forms.php */
67
-            do_action('geodir_before_inquiry_form_field', 'inq_email');?>
66
+			/** This action is documented in geodirectory-templates/popup-forms.php */
67
+			do_action('geodir_before_inquiry_form_field', 'inq_email');?>
68 68
             <div class="row  clearfix">
69 69
                     <input required field_type="email" name="inq_email" type="email" value="" placeholder="<?php _e('Email', 'geodirectory');?>"/>
70 70
             </div>
71 71
             <?php
72
-            /** This action is documented in geodirectory-templates/popup-forms.php */
73
-            do_action('geodir_after_inquiry_form_field', 'inq_email');?>
72
+			/** This action is documented in geodirectory-templates/popup-forms.php */
73
+			do_action('geodir_after_inquiry_form_field', 'inq_email');?>
74 74
             <?php
75
-            /** This action is documented in geodirectory-templates/popup-forms.php */
76
-            do_action('geodir_before_inquiry_form_field', 'inq_phone');?>
75
+			/** This action is documented in geodirectory-templates/popup-forms.php */
76
+			do_action('geodir_before_inquiry_form_field', 'inq_phone');?>
77 77
             <div class="row  clearfix">
78 78
                     <input name="inq_phone" id="agt_mail_phone" type="text" value="" placeholder="<?php _e('Phone number', 'geodirectory');?>"/>
79 79
             </div>
80 80
             <?php
81
-            /** This action is documented in geodirectory-templates/popup-forms.php */
82
-            do_action('geodir_after_inquiry_form_field', 'inq_phone');?>
81
+			/** This action is documented in geodirectory-templates/popup-forms.php */
82
+			do_action('geodir_after_inquiry_form_field', 'inq_phone');?>
83 83
             <?php
84
-            /** This action is documented in geodirectory-templates/popup-forms.php */
85
-            do_action('geodir_before_inquiry_form_field', 'inq_msg');?>
84
+			/** This action is documented in geodirectory-templates/popup-forms.php */
85
+			do_action('geodir_before_inquiry_form_field', 'inq_msg');?>
86 86
             <div class="row  clearfix">
87 87
                     <textarea required field_type="textarea" name="inq_msg" cols=""
88 88
                               rows="" placeholder="<?php echo SEND_INQUIRY_SAMPLE_CONTENT;?>"></textarea>
89 89
             </div>
90 90
             <?php
91
-            /** This action is documented in geodirectory-templates/popup-forms.php */
92
-            do_action('geodir_after_inquiry_form_field', 'inq_msg');?>
91
+			/** This action is documented in geodirectory-templates/popup-forms.php */
92
+			do_action('geodir_after_inquiry_form_field', 'inq_msg');?>
93 93
             <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory');?>"
94 94
                    class="button clearfix"/>
95 95
         </form>
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 1 patch
Indentation   +1212 added lines, -1212 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
-    if ($geodir_theme_location) {
228
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
229
-    } else {
230
-        update_option('geodir_theme_location_nav', '');
231
-    }
226
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
+	if ($geodir_theme_location) {
228
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
229
+	} else {
230
+		update_option('geodir_theme_location_nav', '');
231
+	}
232 232
 }
233 233
 
234 234
 /// add action for theme switch to blank previous theme navigation location setting
@@ -249,42 +249,42 @@  discard block
 block discarded – undo
249 249
  */
250 250
 function geodir_add_post_filters()
251 251
 {
252
-    /**
253
-     * Contains all function for filtering listing.
254
-     *
255
-     * @since 1.0.0
256
-     * @package GeoDirectory
257
-     */
258
-    include_once('geodirectory-functions/listing_filters.php');
252
+	/**
253
+	 * Contains all function for filtering listing.
254
+	 *
255
+	 * @since 1.0.0
256
+	 * @package GeoDirectory
257
+	 */
258
+	include_once('geodirectory-functions/listing_filters.php');
259 259
     
260
-    // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
-    }
260
+	// Theme My Login compatibility fix
261
+	if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
+		remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
+	}
264 264
     
265
-    if ( isset( $_REQUEST['geodir_search'] ) ) {
266
-        add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
-        add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
268
-    }
265
+	if ( isset( $_REQUEST['geodir_search'] ) ) {
266
+		add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
+		add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
268
+	}
269 269
 }
270 270
 
271 271
 
272 272
 if (!function_exists('geodir_init_defaults')) {
273
-    /**
274
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
275
-     *
276
-     * @since 1.0.0
277
-     * @package GeoDirectory
278
-     */
279
-    function geodir_init_defaults()
280
-    {
281
-        if (function_exists('geodir_register_defaults')) {
273
+	/**
274
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
275
+	 *
276
+	 * @since 1.0.0
277
+	 * @package GeoDirectory
278
+	 */
279
+	function geodir_init_defaults()
280
+	{
281
+		if (function_exists('geodir_register_defaults')) {
282 282
 
283
-            geodir_register_defaults();
283
+			geodir_register_defaults();
284 284
 
285
-        }
285
+		}
286 286
 
287
-    }
287
+	}
288 288
 }
289 289
 
290 290
 
@@ -306,26 +306,26 @@  discard block
 block discarded – undo
306 306
 // CALLED ON 'sidebars_widgets' FILTER
307 307
 
308 308
 if (!function_exists('geodir_restrict_widget')) {
309
-    /**
310
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
311
-     *
312
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
313
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
314
-     * @since 1.0.0
315
-     * @package GeoDirectory
316
-     */
317
-    function geodir_restrict_widget()
318
-    {
319
-        global $is_listing, $is_single_place;
309
+	/**
310
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
311
+	 *
312
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
313
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
314
+	 * @since 1.0.0
315
+	 * @package GeoDirectory
316
+	 */
317
+	function geodir_restrict_widget()
318
+	{
319
+		global $is_listing, $is_single_place;
320 320
 
321
-        // set is listing	
322
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
321
+		// set is listing	
322
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
323 323
 
324
-        // set is single place
325
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
324
+		// set is single place
325
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
326 326
 
327 327
 
328
-    }
328
+	}
329 329
 }
330 330
 
331 331
 
@@ -346,31 +346,31 @@  discard block
 block discarded – undo
346 346
  */
347 347
 function geodir_detail_page_sidebar_content_sorting()
348 348
 {
349
-    $arr_detail_page_sidebar_content =
350
-        /**
351
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
352
-         *
353
-         * This filter can be used to remove sections of the details page sidebar,
354
-         * add new sections or rearrange the order of the sections.
355
-         *
356
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
357
-         * @since 1.0.0
358
-         */
359
-        apply_filters('geodir_detail_page_sidebar_content',
360
-            array('geodir_social_sharing_buttons',
361
-                'geodir_detail_page_google_analytics',
362
-                'geodir_edit_post_link',
363
-                'geodir_detail_page_review_rating',
364
-                'geodir_detail_page_more_info'
365
-            ) // end of array 
366
-        ); // end of apply filter
367
-    if (!empty($arr_detail_page_sidebar_content)) {
368
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
369
-            if (function_exists($content_function)) {
370
-                add_action('geodir_detail_page_sidebar', $content_function);
371
-            }
372
-        }
373
-    }
349
+	$arr_detail_page_sidebar_content =
350
+		/**
351
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
352
+		 *
353
+		 * This filter can be used to remove sections of the details page sidebar,
354
+		 * add new sections or rearrange the order of the sections.
355
+		 *
356
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
357
+		 * @since 1.0.0
358
+		 */
359
+		apply_filters('geodir_detail_page_sidebar_content',
360
+			array('geodir_social_sharing_buttons',
361
+				'geodir_detail_page_google_analytics',
362
+				'geodir_edit_post_link',
363
+				'geodir_detail_page_review_rating',
364
+				'geodir_detail_page_more_info'
365
+			) // end of array 
366
+		); // end of apply filter
367
+	if (!empty($arr_detail_page_sidebar_content)) {
368
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
369
+			if (function_exists($content_function)) {
370
+				add_action('geodir_detail_page_sidebar', $content_function);
371
+			}
372
+		}
373
+	}
374 374
 }
375 375
 
376 376
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_add_to_favourite_link()
387 387
 {
388
-    global $post, $preview;
389
-    if (!$preview && geodir_is_page('detail')) {
390
-        ?>
388
+	global $post, $preview;
389
+	if (!$preview && geodir_is_page('detail')) {
390
+		?>
391 391
         <p class="edit_link">
392 392
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
393 393
         </p>
394 394
     <?php
395
-    }
395
+	}
396 396
 }
397 397
 
398 398
 /**
@@ -406,41 +406,41 @@  discard block
 block discarded – undo
406 406
  */
407 407
 function geodir_social_sharing_buttons()
408 408
 {
409
-    global $preview;
410
-    ob_start(); // Start  buffering;
411
-    /**
412
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
413
-     *
414
-     * @since 1.0.0
415
-     */
416
-    do_action('geodir_before_social_sharing_buttons');
417
-    if (!$preview) {
418
-        ?>
409
+	global $preview;
410
+	ob_start(); // Start  buffering;
411
+	/**
412
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
413
+	 *
414
+	 * @since 1.0.0
415
+	 */
416
+	do_action('geodir_before_social_sharing_buttons');
417
+	if (!$preview) {
418
+		?>
419 419
         <div class="likethis">
420 420
             <?php geodir_twitter_tweet_button(); ?>
421 421
             <?php geodir_fb_like_button(); ?>
422 422
             <?php geodir_google_plus_button(); ?>
423 423
         </div>
424 424
     <?php
425
-    }// end of if, if its a preview or not
426
-
427
-    /**
428
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
429
-     *
430
-     * @since 1.0.0
431
-     */
432
-    do_action('geodir_after_social_sharing_buttons');
433
-    $content_html = ob_get_clean();
434
-    if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437
-        /**
438
-         * Filter the geodir_social_sharing_buttons() function content.
439
-         *
440
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
441
-         */
442
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
443
-    }
425
+	}// end of if, if its a preview or not
426
+
427
+	/**
428
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
429
+	 *
430
+	 * @since 1.0.0
431
+	 */
432
+	do_action('geodir_after_social_sharing_buttons');
433
+	$content_html = ob_get_clean();
434
+	if (trim($content_html) != '')
435
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437
+		/**
438
+		 * Filter the geodir_social_sharing_buttons() function content.
439
+		 *
440
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
441
+		 */
442
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
443
+	}
444 444
 
445 445
 
446 446
 }
@@ -458,46 +458,46 @@  discard block
 block discarded – undo
458 458
  */
459 459
 function geodir_edit_post_link()
460 460
 {
461
-    global $post, $preview;
462
-    ob_start(); // Start buffering;
463
-    /**
464
-     * This is called before the edit post link html in the function geodir_edit_post_link()
465
-     *
466
-     * @since 1.0.0
467
-     */
468
-    do_action('geodir_before_edit_post_link');
469
-    if (!$preview) {
470
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
461
+	global $post, $preview;
462
+	ob_start(); // Start buffering;
463
+	/**
464
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
465
+	 *
466
+	 * @since 1.0.0
467
+	 */
468
+	do_action('geodir_before_edit_post_link');
469
+	if (!$preview) {
470
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
471 471
         
472
-        if ($is_current_user_owner) {
473
-            $post_id = $post->ID;
472
+		if ($is_current_user_owner) {
473
+			$post_id = $post->ID;
474 474
             
475
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
-                $post_id = (int)$_REQUEST['pid'];
477
-            }
475
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
+				$post_id = (int)$_REQUEST['pid'];
477
+			}
478 478
 
479
-            $postlink = get_permalink(geodir_add_listing_page_id());
480
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
482
-        }
483
-    }// end of if, if its a preview or not
484
-    /**
485
-     * This is called after the edit post link html in the function geodir_edit_post_link()
486
-     *
487
-     * @since 1.0.0
488
-     */
489
-    do_action('geodir_after_edit_post_link');
490
-    $content_html = ob_get_clean();
491
-    if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
494
-        /**
495
-         * Filter the geodir_edit_post_link() function content.
496
-         *
497
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
498
-         */
499
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
500
-    }
479
+			$postlink = get_permalink(geodir_add_listing_page_id());
480
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
482
+		}
483
+	}// end of if, if its a preview or not
484
+	/**
485
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
486
+	 *
487
+	 * @since 1.0.0
488
+	 */
489
+	do_action('geodir_after_edit_post_link');
490
+	$content_html = ob_get_clean();
491
+	if (trim($content_html) != '')
492
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
494
+		/**
495
+		 * Filter the geodir_edit_post_link() function content.
496
+		 *
497
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
498
+		 */
499
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
500
+	}
501 501
 }
502 502
 
503 503
 /**
@@ -511,42 +511,42 @@  discard block
 block discarded – undo
511 511
  */
512 512
 function geodir_detail_page_google_analytics()
513 513
 {
514
-    global $post,$preview;
515
-    if($preview){return '';}
516
-    $package_info = array();
517
-    $package_info = geodir_post_package_info($package_info, $post);
514
+	global $post,$preview;
515
+	if($preview){return '';}
516
+	$package_info = array();
517
+	$package_info = geodir_post_package_info($package_info, $post);
518 518
 
519
-    $id = trim(get_option('geodir_ga_account_id'));
519
+	$id = trim(get_option('geodir_ga_account_id'));
520 520
 
521
-    if (!$id) {
522
-        return; //if no Google Analytics ID then bail.
523
-    }
521
+	if (!$id) {
522
+		return; //if no Google Analytics ID then bail.
523
+	}
524 524
 
525
-    ob_start(); // Start buffering;
526
-    /**
527
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
528
-     *
529
-     * @since 1.0.0
530
-     */
531
-    do_action('geodir_before_google_analytics');
525
+	ob_start(); // Start buffering;
526
+	/**
527
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
528
+	 *
529
+	 * @since 1.0.0
530
+	 */
531
+	do_action('geodir_before_google_analytics');
532 532
     
533
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
534
-    /**
535
-     * Filter the time interval to check & refresh new users results.
536
-     *
537
-     * @since 1.5.9
538
-     *
539
-     * @param int $refresh_time Time interval to check & refresh new users results.
540
-     */
541
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
542
-    $refresh_time = absint($refresh_time * 1000);
533
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
534
+	/**
535
+	 * Filter the time interval to check & refresh new users results.
536
+	 *
537
+	 * @since 1.5.9
538
+	 *
539
+	 * @param int $refresh_time Time interval to check & refresh new users results.
540
+	 */
541
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
542
+	$refresh_time = absint($refresh_time * 1000);
543 543
     
544
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
544
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
545 545
     
546
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
547
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
548
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
549
-        ?>
546
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
547
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
548
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
549
+		?>
550 550
         <script type="text/javascript">
551 551
             var gd_gaTimeOut;
552 552
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -798,15 +798,15 @@  discard block
 block discarded – undo
798 798
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
799 799
 
800 800
                     <?php
801
-                    // Here we list the shorthand days of the week so it can be used in translation.
802
-                    __("Mon",'geodirectory');
803
-                    __("Tue",'geodirectory');
804
-                    __("Wed",'geodirectory');
805
-                    __("Thu",'geodirectory');
806
-                    __("Fri",'geodirectory');
807
-                    __("Sat",'geodirectory');
808
-                    __("Sun",'geodirectory');
809
-                    ?>
801
+					// Here we list the shorthand days of the week so it can be used in translation.
802
+					__("Mon",'geodirectory');
803
+					__("Tue",'geodirectory');
804
+					__("Wed",'geodirectory');
805
+					__("Thu",'geodirectory');
806
+					__("Fri",'geodirectory');
807
+					__("Sat",'geodirectory');
808
+					__("Sun",'geodirectory');
809
+					?>
810 810
 
811 811
                     labels = [
812 812
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1055,24 +1055,24 @@  discard block
 block discarded – undo
1055 1055
         </span>
1056 1056
 
1057 1057
     <?php
1058
-    }
1059
-    /**
1060
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1061
-     *
1062
-     * @since 1.0.0
1063
-     */
1064
-    do_action('geodir_after_google_analytics');
1065
-    $content_html = ob_get_clean();
1066
-    if (trim($content_html) != '')
1067
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1068
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1069
-        /**
1070
-         * Filter the geodir_edit_post_link() function content.
1071
-         *
1072
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1073
-         */
1074
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1075
-    }
1058
+	}
1059
+	/**
1060
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1061
+	 *
1062
+	 * @since 1.0.0
1063
+	 */
1064
+	do_action('geodir_after_google_analytics');
1065
+	$content_html = ob_get_clean();
1066
+	if (trim($content_html) != '')
1067
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1068
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1069
+		/**
1070
+		 * Filter the geodir_edit_post_link() function content.
1071
+		 *
1072
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1073
+		 */
1074
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1075
+	}
1076 1076
 }
1077 1077
 
1078 1078
 /**
@@ -1089,94 +1089,94 @@  discard block
 block discarded – undo
1089 1089
  */
1090 1090
 function geodir_detail_page_review_rating()
1091 1091
 {
1092
-    global $post, $preview, $post_images;
1092
+	global $post, $preview, $post_images;
1093 1093
     
1094
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1095
-        return;
1096
-    }
1097
-    ob_start(); // Start  buffering;
1098
-    /**
1099
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1100
-     *
1101
-     * This is called outside the check for an actual rating and the check for preview page.
1102
-     *
1103
-     * @since 1.0.0
1104
-     */
1105
-    do_action('geodir_before_detail_page_review_rating');
1106
-
1107
-    $comment_count = geodir_get_review_count_total($post->ID);
1108
-    $post_avgratings = geodir_get_post_rating($post->ID);
1109
-
1110
-    if ($post_avgratings != 0 && !$preview) {
1111
-        /**
1112
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1113
-         *
1114
-         * This is called inside the check for an actual rating and the check for preview page.
1115
-         *
1116
-         * @since 1.0.0
1117
-         * @param float $post_avgratings Average rating for the current post.
1118
-         * @param int $post->ID Current post ID.
1119
-         */
1120
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1121
-
1122
-        $html = '<p style=" float:left;">';
1123
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1124
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1125
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1094
+	if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1095
+		return;
1096
+	}
1097
+	ob_start(); // Start  buffering;
1098
+	/**
1099
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1100
+	 *
1101
+	 * This is called outside the check for an actual rating and the check for preview page.
1102
+	 *
1103
+	 * @since 1.0.0
1104
+	 */
1105
+	do_action('geodir_before_detail_page_review_rating');
1106
+
1107
+	$comment_count = geodir_get_review_count_total($post->ID);
1108
+	$post_avgratings = geodir_get_post_rating($post->ID);
1109
+
1110
+	if ($post_avgratings != 0 && !$preview) {
1111
+		/**
1112
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1113
+		 *
1114
+		 * This is called inside the check for an actual rating and the check for preview page.
1115
+		 *
1116
+		 * @since 1.0.0
1117
+		 * @param float $post_avgratings Average rating for the current post.
1118
+		 * @param int $post->ID Current post ID.
1119
+		 */
1120
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1121
+
1122
+		$html = '<p style=" float:left;">';
1123
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1124
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1125
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1126 1126
        
1127 1127
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1128 1128
 	   
1129 1129
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1130 1130
 
1131
-        $html .= '<span class="item">';
1132
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1131
+		$html .= '<span class="item">';
1132
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1133 1133
 
1134
-        if ($post_images) {
1135
-            foreach ($post_images as $img) {
1136
-                $post_img = $img->src;
1137
-                break;
1138
-            }
1139
-        }
1140
-
1141
-        if (isset($post_img) && $post_img) {
1142
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1143
-        }
1144
-
1145
-        $html .= '</span>';
1146
-
1147
-        echo $html .= '</div>';
1148
-        /**
1149
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1150
-         *
1151
-         * This is called inside the check for an actual rating and the check for preview page.
1152
-         *
1153
-         * @since 1.0.0
1154
-         * @param float $post_avgratings Average rating for the current post.
1155
-         * @param int $post->ID Current post ID.
1156
-         */
1157
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1158
-    }
1159
-    /**
1160
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1161
-     *
1162
-     * This is called outside the check for an actual rating and the check for preview page.
1163
-     *
1164
-     * @since 1.0.0
1165
-     */
1166
-    do_action('geodir_after_detail_page_review_rating');
1167
-    $content_html = ob_get_clean();
1168
-    if (trim($content_html) != '') {
1169
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1170
-    }
1171
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1172
-        /**
1173
-         * Filter the geodir_detail_page_review_rating() function content.
1174
-         *
1175
-         * @since 1.0.0
1176
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1177
-         */
1178
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1179
-    }
1134
+		if ($post_images) {
1135
+			foreach ($post_images as $img) {
1136
+				$post_img = $img->src;
1137
+				break;
1138
+			}
1139
+		}
1140
+
1141
+		if (isset($post_img) && $post_img) {
1142
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1143
+		}
1144
+
1145
+		$html .= '</span>';
1146
+
1147
+		echo $html .= '</div>';
1148
+		/**
1149
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1150
+		 *
1151
+		 * This is called inside the check for an actual rating and the check for preview page.
1152
+		 *
1153
+		 * @since 1.0.0
1154
+		 * @param float $post_avgratings Average rating for the current post.
1155
+		 * @param int $post->ID Current post ID.
1156
+		 */
1157
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1158
+	}
1159
+	/**
1160
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1161
+	 *
1162
+	 * This is called outside the check for an actual rating and the check for preview page.
1163
+	 *
1164
+	 * @since 1.0.0
1165
+	 */
1166
+	do_action('geodir_after_detail_page_review_rating');
1167
+	$content_html = ob_get_clean();
1168
+	if (trim($content_html) != '') {
1169
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1170
+	}
1171
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1172
+		/**
1173
+		 * Filter the geodir_detail_page_review_rating() function content.
1174
+		 *
1175
+		 * @since 1.0.0
1176
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1177
+		 */
1178
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1179
+	}
1180 1180
 }
1181 1181
 
1182 1182
 /**
@@ -1188,35 +1188,35 @@  discard block
 block discarded – undo
1188 1188
  */
1189 1189
 function geodir_detail_page_more_info()
1190 1190
 {
1191
-    ob_start(); // Start  buffering;
1192
-    /**
1193
-     * This is called before the info section html.
1194
-     *
1195
-     * @since 1.0.0
1196
-     */
1197
-    do_action('geodir_before_detail_page_more_info');
1198
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1199
-        echo $geodir_post_detail_fields;
1200
-    }
1201
-    /**
1202
-     * This is called after the info section html.
1203
-     *
1204
-     * @since 1.0.0
1205
-     */
1206
-    do_action('geodir_after_detail_page_more_info');
1207
-
1208
-    $content_html = ob_get_clean();
1209
-    if (trim($content_html) != '')
1210
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1211
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1212
-        /**
1213
-         * Filter the output html for function geodir_detail_page_more_info().
1214
-         *
1215
-         * @since 1.0.0
1216
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1217
-         */
1218
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1219
-    }
1191
+	ob_start(); // Start  buffering;
1192
+	/**
1193
+	 * This is called before the info section html.
1194
+	 *
1195
+	 * @since 1.0.0
1196
+	 */
1197
+	do_action('geodir_before_detail_page_more_info');
1198
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1199
+		echo $geodir_post_detail_fields;
1200
+	}
1201
+	/**
1202
+	 * This is called after the info section html.
1203
+	 *
1204
+	 * @since 1.0.0
1205
+	 */
1206
+	do_action('geodir_after_detail_page_more_info');
1207
+
1208
+	$content_html = ob_get_clean();
1209
+	if (trim($content_html) != '')
1210
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1211
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1212
+		/**
1213
+		 * Filter the output html for function geodir_detail_page_more_info().
1214
+		 *
1215
+		 * @since 1.0.0
1216
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1217
+		 */
1218
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1219
+	}
1220 1220
 }
1221 1221
 
1222 1222
 
@@ -1230,15 +1230,15 @@  discard block
 block discarded – undo
1230 1230
  */
1231 1231
 function geodir_localize_all_js_msg()
1232 1232
 {// check_ajax_referer function is used to make sure no files are uploaded remotely but it will fail if used between https and non https so we do the check below of the urls
1233
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1234
-        $ajax_url = admin_url('admin-ajax.php');
1235
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1236
-        $ajax_url = admin_url('admin-ajax.php');
1237
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1238
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1239
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1240
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1241
-    }
1233
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1234
+		$ajax_url = admin_url('admin-ajax.php');
1235
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1236
+		$ajax_url = admin_url('admin-ajax.php');
1237
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1238
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1239
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1240
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1241
+	}
1242 1242
 	
1243 1243
 	/**
1244 1244
 	 * Filter the allowed image type extensions for post images.
@@ -1248,62 +1248,62 @@  discard block
 block discarded – undo
1248 1248
 	 */
1249 1249
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1250 1250
 	
1251
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1252
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1253
-    $default_marker_width = $default_marker_size['w'];
1254
-    $default_marker_height = $default_marker_size['h'];
1251
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1252
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1253
+	$default_marker_width = $default_marker_size['w'];
1254
+	$default_marker_height = $default_marker_size['h'];
1255 1255
     
1256
-    $arr_alert_msg = array(
1257
-        'geodir_plugin_url' => geodir_plugin_url(),
1258
-        'geodir_admin_ajax_url' => $ajax_url,
1259
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1260
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1261
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1262
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1263
-        //start not show alert msg
1264
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1265
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1266
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1267
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1268
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1269
-        // end not show alert msg
1270
-        'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1271
-        'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1272
-        //start not show alert msg
1273
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1274
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1275
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1276
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1277
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1278
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1279
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1280
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1281
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1282
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1283
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1284
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1285
-        'geodir_default_marker_icon' => $default_marker_icon,
1286
-        'geodir_default_marker_w' => $default_marker_width,
1287
-        'geodir_default_marker_h' => $default_marker_height,
1288
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1289
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1290
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1291
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1292
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1293
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1294
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1295
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1296
-        'err_empty_review' => __('Please type a review.', 'geodirectory'),
1297
-        'err_empty_reply' => __('Please type a reply.', 'geodirectory'),
1298
-        /* on/off dragging for phone devices */
1299
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1300
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1301
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1302
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1303
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1304
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1305
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1306
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1256
+	$arr_alert_msg = array(
1257
+		'geodir_plugin_url' => geodir_plugin_url(),
1258
+		'geodir_admin_ajax_url' => $ajax_url,
1259
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1260
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1261
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1262
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1263
+		//start not show alert msg
1264
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1265
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1266
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1267
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1268
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1269
+		// end not show alert msg
1270
+		'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1271
+		'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1272
+		//start not show alert msg
1273
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1274
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1275
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1276
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1277
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1278
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1279
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1280
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1281
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1282
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1283
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1284
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1285
+		'geodir_default_marker_icon' => $default_marker_icon,
1286
+		'geodir_default_marker_w' => $default_marker_width,
1287
+		'geodir_default_marker_h' => $default_marker_height,
1288
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1289
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1290
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1291
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1292
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1293
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1294
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1295
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1296
+		'err_empty_review' => __('Please type a review.', 'geodirectory'),
1297
+		'err_empty_reply' => __('Please type a reply.', 'geodirectory'),
1298
+		/* on/off dragging for phone devices */
1299
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1300
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1301
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1302
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1303
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1304
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1305
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1306
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1307 1307
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1308 1308
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1309 1309
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1311,41 +1311,41 @@  discard block
 block discarded – undo
1311 1311
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1312 1312
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1313 1313
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1314
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1315
-        'geodir_map_name' => geodir_map_name(),
1316
-        'osmStart' => __('Start', 'geodirectory'),
1317
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1318
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1319
-        'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1320
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1321
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1322
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1323
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1324
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1325
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1314
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1315
+		'geodir_map_name' => geodir_map_name(),
1316
+		'osmStart' => __('Start', 'geodirectory'),
1317
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1318
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1319
+		'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1320
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1321
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1322
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1323
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1324
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1325
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1326 1326
 		'mapLanguage' => geodir_get_map_default_language()
1327
-    );
1328
-
1329
-    /**
1330
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1331
-     *
1332
-     * With this filter you can add, remove or change translated JS strings.
1333
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1334
-     *
1335
-     * @since 1.0.0
1336
-     */
1337
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1338
-
1339
-    foreach ($arr_alert_msg as $key => $value) {
1340
-        if (!is_scalar($value))
1341
-            continue;
1342
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1343
-    }
1327
+	);
1328
+
1329
+	/**
1330
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1331
+	 *
1332
+	 * With this filter you can add, remove or change translated JS strings.
1333
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1334
+	 *
1335
+	 * @since 1.0.0
1336
+	 */
1337
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1344 1338
 
1345
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1346
-    echo '<script>';
1347
-    echo $script;
1348
-    echo '</script>';
1339
+	foreach ($arr_alert_msg as $key => $value) {
1340
+		if (!is_scalar($value))
1341
+			continue;
1342
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1343
+	}
1344
+
1345
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1346
+	echo '<script>';
1347
+	echo $script;
1348
+	echo '</script>';
1349 1349
 }
1350 1350
 
1351 1351
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1361,11 +1361,11 @@  discard block
 block discarded – undo
1361 1361
  */
1362 1362
 function geodir_admin_bar_site_menu($wp_admin_bar)
1363 1363
 {
1364
-    if (get_option("geodir_installed")) {
1365
-        if (current_user_can('manage_options')) {
1366
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1367
-        }
1368
-    }
1364
+	if (get_option("geodir_installed")) {
1365
+		if (current_user_can('manage_options')) {
1366
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1367
+		}
1368
+	}
1369 1369
 }
1370 1370
 
1371 1371
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1391,25 +1391,25 @@  discard block
 block discarded – undo
1391 1391
  */
1392 1392
 function geodir_store_sidebars()
1393 1393
 {
1394
-    global $geodir_sidebars;
1395
-    global $sidebars_widgets;
1396
-
1397
-    if (!is_array($sidebars_widgets))
1398
-        $sidebars_widgets = wp_get_sidebars_widgets();
1399
-    $geodir_old_sidebars = array();
1400
-
1401
-    if (is_array($geodir_sidebars)) {
1402
-        foreach ($geodir_sidebars as $val) {
1403
-            if (is_array($sidebars_widgets)) {
1404
-                if (array_key_exists($val, $sidebars_widgets))
1405
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1406
-                else
1407
-                    $geodir_old_sidebars[$val] = array();
1408
-            }
1409
-        }
1410
-    }
1411
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1412
-    geodir_option_version_backup('geodir_sidebars');
1394
+	global $geodir_sidebars;
1395
+	global $sidebars_widgets;
1396
+
1397
+	if (!is_array($sidebars_widgets))
1398
+		$sidebars_widgets = wp_get_sidebars_widgets();
1399
+	$geodir_old_sidebars = array();
1400
+
1401
+	if (is_array($geodir_sidebars)) {
1402
+		foreach ($geodir_sidebars as $val) {
1403
+			if (is_array($sidebars_widgets)) {
1404
+				if (array_key_exists($val, $sidebars_widgets))
1405
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1406
+				else
1407
+					$geodir_old_sidebars[$val] = array();
1408
+			}
1409
+		}
1410
+	}
1411
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1412
+	geodir_option_version_backup('geodir_sidebars');
1413 1413
 
1414 1414
 }
1415 1415
 
@@ -1423,28 +1423,28 @@  discard block
 block discarded – undo
1423 1423
  */
1424 1424
 function geodir_restore_sidebars()
1425 1425
 {
1426
-    global $sidebars_widgets;
1427
-
1428
-    if (!is_array($sidebars_widgets))
1429
-        $sidebars_widgets = wp_get_sidebars_widgets();
1430
-
1431
-    if (is_array($sidebars_widgets)) {
1432
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1433
-        if (is_array($geodir_old_sidebars)) {
1434
-            foreach ($geodir_old_sidebars as $key => $val) {
1435
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1436
-                {
1437
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1438
-                }
1426
+	global $sidebars_widgets;
1439 1427
 
1428
+	if (!is_array($sidebars_widgets))
1429
+		$sidebars_widgets = wp_get_sidebars_widgets();
1440 1430
 
1441
-            }
1442
-        }
1431
+	if (is_array($sidebars_widgets)) {
1432
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1433
+		if (is_array($geodir_old_sidebars)) {
1434
+			foreach ($geodir_old_sidebars as $key => $val) {
1435
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1436
+				{
1437
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1438
+				}
1443 1439
 
1444
-    }
1445 1440
 
1446
-    update_option('sidebars_widgets', $sidebars_widgets);
1447
-    update_option('geodir_sidebars', '');
1441
+			}
1442
+		}
1443
+
1444
+	}
1445
+
1446
+	update_option('sidebars_widgets', $sidebars_widgets);
1447
+	update_option('geodir_sidebars', '');
1448 1448
 }
1449 1449
 
1450 1450
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1457,9 +1457,9 @@  discard block
 block discarded – undo
1457 1457
  */
1458 1458
 function geodir_after_listing_post_gridview()
1459 1459
 {
1460
-    global $gridview_columns;
1460
+	global $gridview_columns;
1461 1461
 
1462
-    $gridview_columns = '';
1462
+	$gridview_columns = '';
1463 1463
 
1464 1464
 }
1465 1465
 
@@ -1487,11 +1487,11 @@  discard block
 block discarded – undo
1487 1487
  */
1488 1488
 function so_handle_038($url, $original_url, $_context)
1489 1489
 {
1490
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1491
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1492
-    }
1490
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1491
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1492
+	}
1493 1493
 
1494
-    return $url;
1494
+	return $url;
1495 1495
 }
1496 1496
 
1497 1497
 
@@ -1507,34 +1507,34 @@  discard block
 block discarded – undo
1507 1507
 function geodir_after_main_form_fields() {
1508 1508
 	global $gd_session;
1509 1509
 	
1510
-    if (get_option('geodir_accept_term_condition')) {
1511
-        global $post;
1512
-        $term_condition = '';
1513
-        if (isset($_REQUEST['backandedit'])) {
1514
-            $post = (object)$gd_session->get('listing');
1515
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1516
-        }
1517
-
1518
-        ?>
1510
+	if (get_option('geodir_accept_term_condition')) {
1511
+		global $post;
1512
+		$term_condition = '';
1513
+		if (isset($_REQUEST['backandedit'])) {
1514
+			$post = (object)$gd_session->get('listing');
1515
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1516
+		}
1517
+
1518
+		?>
1519 1519
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1520 1520
             <label>&nbsp;</label>
1521 1521
 
1522 1522
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1523 1523
 				<span style="display:block"> 
1524 1524
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1525
-                    echo 'checked="checked"';
1526
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1525
+					echo 'checked="checked"';
1526
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1527 1527
                        class="geodir_textfield" value="1"
1528 1528
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1529 1529
 				</span>
1530 1530
             </div>
1531 1531
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1532
-                    _e($required_msg, 'geodirectory');
1533
-                } ?></span>
1532
+					_e($required_msg, 'geodirectory');
1533
+				} ?></span>
1534 1534
         </div>
1535 1535
     <?php
1536 1536
 
1537
-    }
1537
+	}
1538 1538
 }
1539 1539
 
1540 1540
 
@@ -1559,42 +1559,42 @@  discard block
 block discarded – undo
1559 1559
  */
1560 1560
 function geodir_detail_page_tab_is_display($is_display, $tab)
1561 1561
 {
1562
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1562
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1563 1563
 
1564
-    if ($tab == 'post_profile') {
1565
-        /** This action is documented in geodirectory_template_actions.php */
1566
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1564
+	if ($tab == 'post_profile') {
1565
+		/** This action is documented in geodirectory_template_actions.php */
1566
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1567 1567
         
1568
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1569
-            $is_display = false;
1570
-        }
1571
-    }
1568
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1569
+			$is_display = false;
1570
+		}
1571
+	}
1572 1572
     
1573
-    if ($tab == 'post_info')
1574
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1573
+	if ($tab == 'post_info')
1574
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1575 1575
     
1576
-    if ($tab == 'post_images')
1577
-        $is_display = (!empty($post_images)) ? true : false;
1576
+	if ($tab == 'post_images')
1577
+		$is_display = (!empty($post_images)) ? true : false;
1578 1578
 
1579
-    if ($tab == 'post_video')
1580
-        $is_display = (!empty($video)) ? true : false;
1579
+	if ($tab == 'post_video')
1580
+		$is_display = (!empty($video)) ? true : false;
1581 1581
 
1582
-    if ($tab == 'special_offers')
1583
-        $is_display = (!empty($special_offers)) ? true : false;
1582
+	if ($tab == 'special_offers')
1583
+		$is_display = (!empty($special_offers)) ? true : false;
1584 1584
 
1585
-    if ($tab == 'reviews')
1586
-        $is_display = (geodir_is_page('detail')) ? true : false;
1585
+	if ($tab == 'reviews')
1586
+		$is_display = (geodir_is_page('detail')) ? true : false;
1587 1587
 
1588
-    if ($tab == 'related_listing') {
1589
-       $message = __('No listings found which match your selection.', 'geodirectory');
1588
+	if ($tab == 'related_listing') {
1589
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1590 1590
        
1591
-       /** This action is documented in geodirectory-functions/template_functions.php */
1592
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1591
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1592
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1593 1593
        
1594
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1595
-    }
1594
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1595
+	}
1596 1596
 
1597
-    return $is_display;
1597
+	return $is_display;
1598 1598
 }
1599 1599
 
1600 1600
 
@@ -1610,69 +1610,69 @@  discard block
 block discarded – undo
1610 1610
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1611 1611
  */
1612 1612
 function geodir_changes_in_custom_fields_table() {
1613
-    global $wpdb, $plugin_prefix;
1613
+	global $wpdb, $plugin_prefix;
1614 1614
 	
1615 1615
 	// Remove unused virtual page
1616 1616
 	$listings_page_id = (int)get_option('geodir_listing_page');
1617 1617
 	if ($listings_page_id) {
1618 1618
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1619
-        delete_option('geodir_listing_page');
1619
+		delete_option('geodir_listing_page');
1620 1620
 	}
1621 1621
 
1622
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1623
-        $wpdb->query(
1624
-            $wpdb->prepare(
1625
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1626
-                array('1', '1', 'admin')
1627
-            )
1628
-        );
1622
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1623
+		$wpdb->query(
1624
+			$wpdb->prepare(
1625
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1626
+				array('1', '1', 'admin')
1627
+			)
1628
+		);
1629 1629
 
1630 1630
 
1631
-        /* --- terms meta value set --- */
1631
+		/* --- terms meta value set --- */
1632 1632
 
1633
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1633
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1634 1634
 
1635
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1635
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1636 1636
 
1637
-        if (!empty($options_data)) {
1637
+		if (!empty($options_data)) {
1638 1638
 
1639
-            foreach ($options_data as $optobj) {
1639
+			foreach ($options_data as $optobj) {
1640 1640
 
1641
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1641
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1642 1642
 
1643
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1643
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1644 1644
 
1645
-                if (!empty($taxonomies_data)) {
1645
+				if (!empty($taxonomies_data)) {
1646 1646
 
1647
-                    foreach ($taxonomies_data as $taxobj) {
1647
+					foreach ($taxonomies_data as $taxobj) {
1648 1648
 
1649
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1650
-                        $post_type = $taxObject->object_type[0];
1649
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1650
+						$post_type = $taxObject->object_type[0];
1651 1651
 
1652
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1652
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1653 1653
 
1654
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1654
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1655 1655
 
1656
-                        if ($duplicate_data) {
1656
+						if ($duplicate_data) {
1657 1657
 
1658
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1658
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1659 1659
 
1660
-                        } else {
1660
+						} else {
1661 1661
 
1662
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1662
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1663 1663
 
1664
-                        }
1664
+						}
1665 1665
 
1666
-                    }
1666
+					}
1667 1667
 
1668
-                }
1668
+				}
1669 1669
 
1670
-            }
1671
-        }
1670
+			}
1671
+		}
1672 1672
 
1673
-        update_option('geodir_changes_in_custom_fields_table', '1');
1673
+		update_option('geodir_changes_in_custom_fields_table', '1');
1674 1674
 
1675
-    }
1675
+	}
1676 1676
 
1677 1677
 }
1678 1678
 
@@ -1691,24 +1691,24 @@  discard block
 block discarded – undo
1691 1691
 function geodir_location_slug_check($slug)
1692 1692
 {
1693 1693
 
1694
-    global $wpdb, $table_prefix;
1694
+	global $wpdb, $table_prefix;
1695 1695
 
1696
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1696
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1697 1697
 
1698
-    if ($slug_exists) {
1698
+	if ($slug_exists) {
1699 1699
 
1700
-        $suffix = 1;
1701
-        do {
1702
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1703
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1704
-            $suffix++;
1705
-        } while ($location_slug_check && $suffix < 100);
1700
+		$suffix = 1;
1701
+		do {
1702
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1703
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1704
+			$suffix++;
1705
+		} while ($location_slug_check && $suffix < 100);
1706 1706
 
1707
-        $slug = $alt_location_name;
1707
+		$slug = $alt_location_name;
1708 1708
 
1709
-    }
1709
+	}
1710 1710
 
1711
-    return $slug;
1711
+	return $slug;
1712 1712
 
1713 1713
 }
1714 1714
 
@@ -1733,42 +1733,42 @@  discard block
 block discarded – undo
1733 1733
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1734 1734
 {
1735 1735
 
1736
-    global $wpdb, $plugin_prefix, $table_prefix;
1736
+	global $wpdb, $plugin_prefix, $table_prefix;
1737 1737
 
1738
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1738
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1739 1739
 
1740
-    $slug = $tern_data->slug;
1740
+	$slug = $tern_data->slug;
1741 1741
 
1742
-    /**
1743
-     * Filter if a term slug exists.
1744
-     *
1745
-     * @since 1.0.0
1746
-     * @package GeoDirectory
1747
-     * @param bool $bool Default: false.
1748
-     * @param string $slug The term slug.
1749
-     * @param int $term_id The term ID.
1750
-     */
1751
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1742
+	/**
1743
+	 * Filter if a term slug exists.
1744
+	 *
1745
+	 * @since 1.0.0
1746
+	 * @package GeoDirectory
1747
+	 * @param bool $bool Default: false.
1748
+	 * @param string $slug The term slug.
1749
+	 * @param int $term_id The term ID.
1750
+	 */
1751
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1752 1752
 
1753
-    if ($slug_exists) {
1753
+	if ($slug_exists) {
1754 1754
 
1755
-        $suffix = 1;
1756
-        do {
1757
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1755
+		$suffix = 1;
1756
+		do {
1757
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1758 1758
 
1759
-            /** This action is documented in geodirectory_hooks_actions.php */
1760
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1759
+			/** This action is documented in geodirectory_hooks_actions.php */
1760
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1761 1761
 
1762
-            $suffix++;
1763
-        } while ($term_slug_check && $suffix < 100);
1762
+			$suffix++;
1763
+		} while ($term_slug_check && $suffix < 100);
1764 1764
 
1765
-        $slug = $new_slug;
1765
+		$slug = $new_slug;
1766 1766
 
1767
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1767
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1768 1768
 
1769
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1769
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1770 1770
 
1771
-    }
1771
+	}
1772 1772
 	
1773 1773
 	// Update tag in detail table.
1774 1774
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1809,21 +1809,21 @@  discard block
 block discarded – undo
1809 1809
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1810 1810
 {
1811 1811
 
1812
-    global $wpdb, $table_prefix;
1812
+	global $wpdb, $table_prefix;
1813 1813
 
1814
-    $default_location = geodir_get_default_location();
1814
+	$default_location = geodir_get_default_location();
1815 1815
 
1816
-    $country_slug = $default_location->country_slug;
1817
-    $region_slug = $default_location->region_slug;
1818
-    $city_slug = $default_location->city_slug;
1816
+	$country_slug = $default_location->country_slug;
1817
+	$region_slug = $default_location->region_slug;
1818
+	$city_slug = $default_location->city_slug;
1819 1819
 
1820
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1821
-        return $slug_exists = true;
1820
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1821
+		return $slug_exists = true;
1822 1822
 
1823
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1824
-        return $slug_exists = true;
1823
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1824
+		return $slug_exists = true;
1825 1825
 
1826
-    return $slug_exists;
1826
+	return $slug_exists;
1827 1827
 }
1828 1828
 
1829 1829
 
@@ -1843,75 +1843,75 @@  discard block
 block discarded – undo
1843 1843
  */
1844 1844
 function geodir_custom_page_title($title = '', $sep = '')
1845 1845
 {
1846
-    global $wp;
1847
-    if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1848
-        return $title;
1849
-    }
1846
+	global $wp;
1847
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1848
+		return $title;
1849
+	}
1850 1850
 
1851
-    if ($sep == '') {
1852
-        /**
1853
-         * Filter the page title separator.
1854
-         *
1855
-         * @since 1.0.0
1856
-         * @package GeoDirectory
1857
-         * @param string $sep The separator, default: `|`.
1858
-         */
1859
-        $sep = apply_filters('geodir_page_title_separator', '|');
1860
-    }
1851
+	if ($sep == '') {
1852
+		/**
1853
+		 * Filter the page title separator.
1854
+		 *
1855
+		 * @since 1.0.0
1856
+		 * @package GeoDirectory
1857
+		 * @param string $sep The separator, default: `|`.
1858
+		 */
1859
+		$sep = apply_filters('geodir_page_title_separator', '|');
1860
+	}
1861 1861
 
1862 1862
 
1863
-    $gd_page = '';
1864
-    if(geodir_is_page('home')){
1865
-        $gd_page = 'home';
1866
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1867
-    }
1868
-    elseif(geodir_is_page('detail')){
1869
-        $gd_page = 'detail';
1870
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1871
-    }
1872
-    elseif(geodir_is_page('pt')){
1873
-        $gd_page = 'pt';
1874
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1875
-    }
1876
-    elseif(geodir_is_page('listing')){
1877
-        $gd_page = 'listing';
1878
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('location')){
1881
-        $gd_page = 'location';
1882
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1883
-    }
1884
-    elseif(geodir_is_page('search')){
1885
-        $gd_page = 'search';
1886
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1887
-    }
1888
-    elseif(geodir_is_page('add-listing')){
1889
-        $gd_page = 'add-listing';
1890
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1891
-    }
1892
-    elseif(geodir_is_page('author')){
1893
-        $gd_page = 'author';
1894
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1895
-    }
1896
-    elseif(geodir_is_page('login')){
1897
-        $gd_page = 'login';
1898
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1899
-    }
1900
-    elseif(geodir_is_page('listing-success')){
1901
-        $gd_page = 'listing-success';
1902
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1903
-    }
1863
+	$gd_page = '';
1864
+	if(geodir_is_page('home')){
1865
+		$gd_page = 'home';
1866
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1867
+	}
1868
+	elseif(geodir_is_page('detail')){
1869
+		$gd_page = 'detail';
1870
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1871
+	}
1872
+	elseif(geodir_is_page('pt')){
1873
+		$gd_page = 'pt';
1874
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1875
+	}
1876
+	elseif(geodir_is_page('listing')){
1877
+		$gd_page = 'listing';
1878
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1879
+	}
1880
+	elseif(geodir_is_page('location')){
1881
+		$gd_page = 'location';
1882
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1883
+	}
1884
+	elseif(geodir_is_page('search')){
1885
+		$gd_page = 'search';
1886
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1887
+	}
1888
+	elseif(geodir_is_page('add-listing')){
1889
+		$gd_page = 'add-listing';
1890
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1891
+	}
1892
+	elseif(geodir_is_page('author')){
1893
+		$gd_page = 'author';
1894
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1895
+	}
1896
+	elseif(geodir_is_page('login')){
1897
+		$gd_page = 'login';
1898
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1899
+	}
1900
+	elseif(geodir_is_page('listing-success')){
1901
+		$gd_page = 'listing-success';
1902
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1903
+	}
1904 1904
 
1905 1905
 
1906
-    /**
1907
-     * Filter page meta title to replace variables.
1908
-     *
1909
-     * @since 1.5.4
1910
-     * @param string $title The page title including variables.
1911
-     * @param string $gd_page The GeoDirectory page type if any.
1912
-     * @param string $sep The title separator symbol.
1913
-     */
1914
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1906
+	/**
1907
+	 * Filter page meta title to replace variables.
1908
+	 *
1909
+	 * @since 1.5.4
1910
+	 * @param string $title The page title including variables.
1911
+	 * @param string $gd_page The GeoDirectory page type if any.
1912
+	 * @param string $sep The title separator symbol.
1913
+	 */
1914
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1915 1915
 
1916 1916
 }
1917 1917
 
@@ -1927,36 +1927,36 @@  discard block
 block discarded – undo
1927 1927
 function geodir_set_post_attachment()
1928 1928
 {
1929 1929
 
1930
-    if (!get_option('geodir_set_post_attachments')) {
1930
+	if (!get_option('geodir_set_post_attachments')) {
1931 1931
 
1932
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1933
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1932
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1933
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1934 1934
 
1935
-        $all_postypes = geodir_get_posttypes();
1935
+		$all_postypes = geodir_get_posttypes();
1936 1936
 
1937
-        foreach($all_postypes as $post_type){
1938
-            $args = array(
1939
-                'posts_per_page' => -1,
1940
-                'post_type' => $post_type,
1941
-                'post_status' => 'publish');
1937
+		foreach($all_postypes as $post_type){
1938
+			$args = array(
1939
+				'posts_per_page' => -1,
1940
+				'post_type' => $post_type,
1941
+				'post_status' => 'publish');
1942 1942
 
1943
-            $posts_array = get_posts($args);
1943
+			$posts_array = get_posts($args);
1944 1944
 
1945
-            if (!empty($posts_array)) {
1945
+			if (!empty($posts_array)) {
1946 1946
 
1947
-                foreach ($posts_array as $post) {
1947
+				foreach ($posts_array as $post) {
1948 1948
 
1949
-                    geodir_set_wp_featured_image($post->ID);
1949
+					geodir_set_wp_featured_image($post->ID);
1950 1950
 
1951
-                }
1951
+				}
1952 1952
 
1953
-            }
1954
-        }
1953
+			}
1954
+		}
1955 1955
 
1956 1956
 
1957
-        update_option('geodir_set_post_attachments', '1');
1957
+		update_option('geodir_set_post_attachments', '1');
1958 1958
 
1959
-    }
1959
+	}
1960 1960
 
1961 1961
 }
1962 1962
 
@@ -1973,19 +1973,19 @@  discard block
 block discarded – undo
1973 1973
 function geodir_remove_url_seperator()
1974 1974
 {
1975 1975
 
1976
-    if (!get_option('geodir_remove_url_seperator')) {
1976
+	if (!get_option('geodir_remove_url_seperator')) {
1977 1977
 
1978
-        if (get_option('geodir_listingurl_separator'))
1979
-            delete_option('geodir_listingurl_separator');
1978
+		if (get_option('geodir_listingurl_separator'))
1979
+			delete_option('geodir_listingurl_separator');
1980 1980
 
1981
-        if (get_option('geodir_detailurl_separator'))
1982
-            delete_option('geodir_detailurl_separator');
1981
+		if (get_option('geodir_detailurl_separator'))
1982
+			delete_option('geodir_detailurl_separator');
1983 1983
 
1984
-        flush_rewrite_rules(false);
1984
+		flush_rewrite_rules(false);
1985 1985
 
1986
-        update_option('geodir_remove_url_seperator', '1');
1986
+		update_option('geodir_remove_url_seperator', '1');
1987 1987
 
1988
-    }
1988
+	}
1989 1989
 
1990 1990
 }
1991 1991
 
@@ -2001,19 +2001,19 @@  discard block
 block discarded – undo
2001 2001
  */
2002 2002
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2003 2003
 {
2004
-    foreach ($permalink_arr as $key => $value) {
2004
+	foreach ($permalink_arr as $key => $value) {
2005 2005
 
2006
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2007
-            unset($permalink_arr[$key]);
2006
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2007
+			unset($permalink_arr[$key]);
2008 2008
 
2009
-    }
2009
+	}
2010 2010
 
2011
-    return $permalink_arr;
2011
+	return $permalink_arr;
2012 2012
 
2013 2013
 }
2014 2014
 
2015 2015
 if (!is_admin()) {
2016
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2016
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2017 2017
 }
2018 2018
 /**
2019 2019
  * Set status from draft to publish.
@@ -2026,16 +2026,16 @@  discard block
 block discarded – undo
2026 2026
  */
2027 2027
 function geodir_set_status_draft_to_publish_for_own_post($post)
2028 2028
 {
2029
-    $user_id = get_current_user_id();
2029
+	$user_id = get_current_user_id();
2030 2030
 
2031
-    if(!$user_id){return $post;}
2031
+	if(!$user_id){return $post;}
2032 2032
 
2033
-    $gd_post_types = geodir_get_posttypes();
2033
+	$gd_post_types = geodir_get_posttypes();
2034 2034
 
2035
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2036
-        $post[0]->post_status = 'publish';
2037
-    }
2038
-    return $post;
2035
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2036
+		$post[0]->post_status = 'publish';
2037
+	}
2038
+	return $post;
2039 2039
 }
2040 2040
 
2041 2041
 
@@ -2127,33 +2127,33 @@  discard block
 block discarded – undo
2127 2127
  */
2128 2128
 function geodir_detail_page_tab_headings_change($tabs_arr)
2129 2129
 {
2130
-    global $wpdb;
2130
+	global $wpdb;
2131 2131
 
2132
-    $post_type = geodir_get_current_posttype();
2132
+	$post_type = geodir_get_current_posttype();
2133 2133
 
2134
-    $all_postypes = geodir_get_posttypes();
2134
+	$all_postypes = geodir_get_posttypes();
2135 2135
 
2136
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2136
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2137 2137
 
2138
-        if (array_key_exists('post_video', $tabs_arr)) {
2138
+		if (array_key_exists('post_video', $tabs_arr)) {
2139 2139
 
2140
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2140
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2141 2141
 
2142
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2143
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2144
-        }
2142
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2143
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2144
+		}
2145 2145
 
2146
-        if (array_key_exists('special_offers', $tabs_arr)) {
2146
+		if (array_key_exists('special_offers', $tabs_arr)) {
2147 2147
 
2148
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2148
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2149 2149
 
2150
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2151
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2152
-        }
2150
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2151
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2152
+		}
2153 2153
 
2154
-    }
2154
+	}
2155 2155
 
2156
-    return $tabs_arr;
2156
+	return $tabs_arr;
2157 2157
 
2158 2158
 }
2159 2159
 
@@ -2166,10 +2166,10 @@  discard block
 block discarded – undo
2166 2166
  */
2167 2167
 function geodir_remove_template_redirect_actions()
2168 2168
 {
2169
-    if (geodir_is_page('login')){
2170
-        remove_all_actions('template_redirect');
2171
-        remove_action('init', 'avia_modify_front', 10);
2172
-    }
2169
+	if (geodir_is_page('login')){
2170
+		remove_all_actions('template_redirect');
2171
+		remove_action('init', 'avia_modify_front', 10);
2172
+	}
2173 2173
 }
2174 2174
 
2175 2175
 
@@ -2191,51 +2191,51 @@  discard block
 block discarded – undo
2191 2191
 function geodirectory_before_featured_image_delete($attachment_id)
2192 2192
 {
2193 2193
 
2194
-    global $wpdb, $plugin_prefix;
2194
+	global $wpdb, $plugin_prefix;
2195 2195
 
2196
-    $post_id = get_post_field('post_parent', $attachment_id);
2196
+	$post_id = get_post_field('post_parent', $attachment_id);
2197 2197
 
2198
-    $attachment_url = wp_get_attachment_url($attachment_id);
2198
+	$attachment_url = wp_get_attachment_url($attachment_id);
2199 2199
 
2200
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2200
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2201 2201
 
2202
-        $post_type = get_post_type($post_id);
2202
+		$post_type = get_post_type($post_id);
2203 2203
 
2204
-        $all_postypes = geodir_get_posttypes();
2204
+		$all_postypes = geodir_get_posttypes();
2205 2205
 
2206
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2207
-            return false;
2206
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2207
+			return false;
2208 2208
 
2209
-        $uploads = wp_upload_dir();
2209
+		$uploads = wp_upload_dir();
2210 2210
 
2211
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2211
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2212 2212
 
2213
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2213
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2214 2214
 
2215
-        $wpdb->query(
2216
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2217
-                array($post_id, $split_img_file_path)
2218
-            )
2219
-        );
2215
+		$wpdb->query(
2216
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2217
+				array($post_id, $split_img_file_path)
2218
+			)
2219
+		);
2220 2220
 
2221
-        $attachment_data = $wpdb->get_row(
2222
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2223
-                array($post_id)
2224
-            )
2225
-        );
2221
+		$attachment_data = $wpdb->get_row(
2222
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2223
+				array($post_id)
2224
+			)
2225
+		);
2226 2226
 
2227
-        if (!empty($attachment_data)) {
2228
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2229
-        }
2227
+		if (!empty($attachment_data)) {
2228
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2229
+		}
2230 2230
 
2231 2231
 
2232
-        $table_name = $plugin_prefix . $post_type . '_detail';
2232
+		$table_name = $plugin_prefix . $post_type . '_detail';
2233 2233
 
2234
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2234
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2235 2235
 
2236
-        geodir_set_wp_featured_image($post_id);
2236
+		geodir_set_wp_featured_image($post_id);
2237 2237
 
2238
-    }
2238
+	}
2239 2239
 
2240 2240
 }
2241 2241
 
@@ -2253,79 +2253,79 @@  discard block
 block discarded – undo
2253 2253
 function geodir_temp_set_post_attachment()
2254 2254
 {
2255 2255
 
2256
-    global $wpdb, $plugin_prefix;
2256
+	global $wpdb, $plugin_prefix;
2257 2257
 
2258
-    $all_postypes = geodir_get_posttypes();
2258
+	$all_postypes = geodir_get_posttypes();
2259 2259
 
2260
-    foreach ($all_postypes as $posttype) {
2260
+	foreach ($all_postypes as $posttype) {
2261 2261
 
2262
-        $tablename = $plugin_prefix . $posttype . '_detail';
2262
+		$tablename = $plugin_prefix . $posttype . '_detail';
2263 2263
 
2264
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2264
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2265 2265
 
2266
-        if (!empty($get_post_data)) {
2266
+		if (!empty($get_post_data)) {
2267 2267
 
2268
-            foreach ($get_post_data as $data) {
2268
+			foreach ($get_post_data as $data) {
2269 2269
 
2270
-                $post_id = $data->post_id;
2270
+				$post_id = $data->post_id;
2271 2271
 
2272
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2272
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2273 2273
 
2274
-                if (!empty($attachment_data)) {
2274
+				if (!empty($attachment_data)) {
2275 2275
 
2276
-                    foreach ($attachment_data as $attach) {
2276
+					foreach ($attachment_data as $attach) {
2277 2277
 
2278
-                        $file_info = pathinfo($attach->file);
2278
+						$file_info = pathinfo($attach->file);
2279 2279
 
2280
-                        $sub_dir = '';
2281
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2282
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2280
+						$sub_dir = '';
2281
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2282
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2283 2283
 
2284
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2285
-                        $uploads_path = $uploads['basedir'];
2284
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2285
+						$uploads_path = $uploads['basedir'];
2286 2286
 
2287
-                        $file_name = $file_info['basename'];
2287
+						$file_name = $file_info['basename'];
2288 2288
 
2289
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2289
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2290 2290
 
2291
-                        if (!file_exists($img_arr['path'])) {
2291
+						if (!file_exists($img_arr['path'])) {
2292 2292
 
2293
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2293
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2294 2294
 
2295
-                        }
2295
+						}
2296 2296
 
2297
-                    }
2297
+					}
2298 2298
 
2299
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2299
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2300 2300
 
2301
-                    if (!empty($attachment_data)) {
2301
+					if (!empty($attachment_data)) {
2302 2302
 
2303
-                        if ($attachment_data->ID)
2304
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2303
+						if ($attachment_data->ID)
2304
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2305 2305
 
2306
-                    } else {
2306
+					} else {
2307 2307
 
2308
-                        if (has_post_thumbnail($post_id)) {
2308
+						if (has_post_thumbnail($post_id)) {
2309 2309
 
2310
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2310
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2311 2311
 
2312
-                            wp_delete_attachment($post_thumbnail_id);
2312
+							wp_delete_attachment($post_thumbnail_id);
2313 2313
 
2314
-                        }
2314
+						}
2315 2315
 
2316
-                    }
2316
+					}
2317 2317
 
2318
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2318
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2319 2319
 
2320
-                    geodir_set_wp_featured_image($post_id);
2320
+					geodir_set_wp_featured_image($post_id);
2321 2321
 
2322
-                }
2322
+				}
2323 2323
 
2324
-            }
2324
+			}
2325 2325
 
2326
-        }
2326
+		}
2327 2327
 
2328
-    }
2328
+	}
2329 2329
 
2330 2330
 }
2331 2331
 
@@ -2343,9 +2343,9 @@  discard block
 block discarded – undo
2343 2343
 function geodir_default_rating_star_icon()
2344 2344
 {
2345 2345
 
2346
-    if (!get_option('geodir_default_rating_star_icon')) {
2347
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2348
-    }
2346
+	if (!get_option('geodir_default_rating_star_icon')) {
2347
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2348
+	}
2349 2349
 
2350 2350
 }
2351 2351
 
@@ -2363,25 +2363,25 @@  discard block
 block discarded – undo
2363 2363
  */
2364 2364
 function geodir_user_post_listing_count($user_id = 0)
2365 2365
 {
2366
-    global $wpdb, $plugin_prefix, $current_user;
2367
-    if(!$user_id){
2368
-        $user_id = $current_user->ID;
2369
-    }
2366
+	global $wpdb, $plugin_prefix, $current_user;
2367
+	if(!$user_id){
2368
+		$user_id = $current_user->ID;
2369
+	}
2370 2370
 
2371
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2371
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2372 2372
 
2373
-    $user_listing = array();
2374
-    if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2375
-        foreach ($all_posts as $ptype) {
2376
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2373
+	$user_listing = array();
2374
+	if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2375
+		foreach ($all_posts as $ptype) {
2376
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2377 2377
 
2378
-            if ($total_posts > 0) {
2379
-                $user_listing[$ptype] = $total_posts;
2380
-            }
2381
-        }
2382
-    }
2378
+			if ($total_posts > 0) {
2379
+				$user_listing[$ptype] = $total_posts;
2380
+			}
2381
+		}
2382
+	}
2383 2383
 
2384
-    return $user_listing;
2384
+	return $user_listing;
2385 2385
 }
2386 2386
 
2387 2387
 
@@ -2401,189 +2401,189 @@  discard block
 block discarded – undo
2401 2401
  */
2402 2402
 function geodir_detail_page_custom_field_tab($tabs_arr)
2403 2403
 {
2404
-    global $post;
2405
-
2406
-    $post_type = geodir_get_current_posttype();
2407
-    $all_postypes = geodir_get_posttypes();
2408
-
2409
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2410
-        $package_info = array();
2411
-        $package_info = geodir_post_package_info($package_info, $post);
2412
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2413
-        $fields_location = 'owntab';
2414
-
2415
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2416
-        //remove video and special offers if it is already set to show
2417
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2418
-            $unset_video = true;
2419
-        }
2420
-
2421
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2422
-            $unset_special_offers = true;
2423
-        }
2424
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2425
-            foreach($custom_fields as $key => $custom_field){
2426
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2427
-                    unset($custom_fields[$key]);
2428
-                }
2429
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2430
-                    unset($custom_fields[$key]);
2431
-                }
2432
-            }
2433
-        }
2434
-
2435
-
2436
-        if (!empty($custom_fields)) {
2437
-            $parse_custom_fields = array();
2438
-            foreach ($custom_fields as $field) {
2439
-                $field = stripslashes_deep($field); // strip slashes
2440
-                $type = $field;
2441
-                $field_name = $field['htmlvar_name'];
2442
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2443
-                    $post->{$field_name} = $_REQUEST[$field_name];
2444
-                }
2404
+	global $post;
2445 2405
 
2446
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2447
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2448
-                        continue;
2449
-                    }
2406
+	$post_type = geodir_get_current_posttype();
2407
+	$all_postypes = geodir_get_posttypes();
2450 2408
 
2451
-                    $parse_custom_fields[] = $field;
2452
-                }
2453
-            }
2454
-            $custom_fields = $parse_custom_fields;
2455
-        }
2456
-        //print_r($custom_fields);
2457
-        if (!empty($custom_fields)) {
2409
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2410
+		$package_info = array();
2411
+		$package_info = geodir_post_package_info($package_info, $post);
2412
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2413
+		$fields_location = 'owntab';
2458 2414
 
2459
-            global $field_set_start;
2415
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2416
+		//remove video and special offers if it is already set to show
2417
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2418
+			$unset_video = true;
2419
+		}
2460 2420
 
2461
-            $post = stripslashes_deep($post); // strip slashes
2462
-            
2463
-            $field_set_start = 0;
2464
-            $fieldset_count = 0;
2465
-            $fieldset = '';
2466
-            $total_fields = count($custom_fields);
2467
-            $count_field = 0;
2468
-            $fieldset_arr = array();
2469
-            $i = 0;
2470
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2471
-
2472
-            foreach ($custom_fields as $field) {
2473
-                $count_field++;
2474
-                $field_name = $field['htmlvar_name'];
2475
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2476
-                    $post->{$field_name} = $_REQUEST[$field_name];
2477
-                }
2421
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2422
+			$unset_special_offers = true;
2423
+		}
2424
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2425
+			foreach($custom_fields as $key => $custom_field){
2426
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2427
+					unset($custom_fields[$key]);
2428
+				}
2429
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2430
+					unset($custom_fields[$key]);
2431
+				}
2432
+			}
2433
+		}
2478 2434
 
2479
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2480
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2481
-                    $site_title = trim($field['site_title']);
2482
-                    $type = $field;
2483
-                    $variables_array = array();
2484 2435
 
2485
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2486
-                        continue;
2487
-                    }
2436
+		if (!empty($custom_fields)) {
2437
+			$parse_custom_fields = array();
2438
+			foreach ($custom_fields as $field) {
2439
+				$field = stripslashes_deep($field); // strip slashes
2440
+				$type = $field;
2441
+				$field_name = $field['htmlvar_name'];
2442
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2443
+					$post->{$field_name} = $_REQUEST[$field_name];
2444
+				}
2488 2445
 
2489
-                    if ($type['type'] != 'fieldset') {
2490
-                        $i++;
2491
-                        $variables_array['post_id'] = $post->ID;
2492
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2493
-                        $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2494
-
2495
-                    }else{
2496
-                        $i = 0;
2497
-                        $fieldset_count++;
2498
-                        $field_set_start = 1;
2499
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2500
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2501
-                    }
2446
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2447
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2448
+						continue;
2449
+					}
2502 2450
 
2451
+					$parse_custom_fields[] = $field;
2452
+				}
2453
+			}
2454
+			$custom_fields = $parse_custom_fields;
2455
+		}
2456
+		//print_r($custom_fields);
2457
+		if (!empty($custom_fields)) {
2503 2458
 
2504
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2505
-                    $type = stripslashes_deep($type); // strip slashes
2506
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2507
-                    $html = '';
2508
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2509
-                    if($html_var=='post'){$html_var='post_address';}
2510
-                    $field_icon = geodir_field_icon_proccess($type);
2511
-                    $filed_type = $type['type'];
2512
-
2513
-                    /**
2514
-                     * Filter the output for custom fields.
2515
-                     *
2516
-                     * Here we can remove or add new functions depending on the field type.
2517
-                     *
2518
-                     * @param string $html The html to be filtered (blank).
2519
-                     * @param string $fields_location The location the field is to be show.
2520
-                     * @param array $type The array of field values.
2521
-                     */
2522
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2523
-
2524
-
2525
-                    /**
2526
-                     * Filter custom field output in tab.
2527
-                     *
2528
-                     * @since 1.5.6
2529
-                     *
2530
-                     * @param string $html_var The HTML variable name for the field.
2531
-                     * @param string $html Custom field unfiltered HTML.
2532
-                     * @param array $variables_array Custom field variables array.
2533
-                     */
2534
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2535
-
2536
-                    $fieldset_html = '';
2537
-                    if ($field_set_start == 1) {
2538
-                        $add_html = false;
2539
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2540
-                            if ($fieldset != '') {
2541
-                                $add_html = true;
2542
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2543
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2544
-                            }
2545
-                            $fieldset_html = $fieldset;
2546
-                            $fieldset = '';
2547
-                        } else {
2548
-                            $fieldset .= $html;
2549
-                            if ($total_fields == $count_field && $fieldset != '') {
2550
-                                $add_html = true;
2551
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2552
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2553
-                                $fieldset_html = $fieldset;
2554
-                            }
2555
-                        }
2459
+			global $field_set_start;
2556 2460
 
2557
-                        if ($add_html) {
2558
-                            $tabs_arr[$htmlvar_name] = array(
2559
-                                'heading_text' => __($label, 'geodirectory'),
2560
-                                'is_active_tab' => false,
2561
-                                /**
2562
-                                 * Filter if a custom field should be displayed on the details page tab.
2563
-                                 *
2564
-                                 * @since 1.0.0
2565
-                                 * @param string $htmlvar_name The field HTML var name.
2566
-                                 */
2567
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2568
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2569
-                            );
2570
-                        }
2571
-                    } else {
2572
-                        if ($html != '') {
2573
-                            $tabs_arr[$html_var] = array(
2574
-                                'heading_text' => __($label, 'geodirectory'),
2575
-                                'is_active_tab' => false,
2576
-                                /** This action is documented in geodirectory_hooks_actions.php */
2577
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2578
-                                'tab_content' => $html
2579
-                            );
2580
-                        }
2581
-                    }
2582
-                }
2583
-            }
2584
-        }
2585
-    }
2586
-    return $tabs_arr;
2461
+			$post = stripslashes_deep($post); // strip slashes
2462
+            
2463
+			$field_set_start = 0;
2464
+			$fieldset_count = 0;
2465
+			$fieldset = '';
2466
+			$total_fields = count($custom_fields);
2467
+			$count_field = 0;
2468
+			$fieldset_arr = array();
2469
+			$i = 0;
2470
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2471
+
2472
+			foreach ($custom_fields as $field) {
2473
+				$count_field++;
2474
+				$field_name = $field['htmlvar_name'];
2475
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2476
+					$post->{$field_name} = $_REQUEST[$field_name];
2477
+				}
2478
+
2479
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2480
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2481
+					$site_title = trim($field['site_title']);
2482
+					$type = $field;
2483
+					$variables_array = array();
2484
+
2485
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2486
+						continue;
2487
+					}
2488
+
2489
+					if ($type['type'] != 'fieldset') {
2490
+						$i++;
2491
+						$variables_array['post_id'] = $post->ID;
2492
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2493
+						$variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2494
+
2495
+					}else{
2496
+						$i = 0;
2497
+						$fieldset_count++;
2498
+						$field_set_start = 1;
2499
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2500
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2501
+					}
2502
+
2503
+
2504
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2505
+					$type = stripslashes_deep($type); // strip slashes
2506
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2507
+					$html = '';
2508
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2509
+					if($html_var=='post'){$html_var='post_address';}
2510
+					$field_icon = geodir_field_icon_proccess($type);
2511
+					$filed_type = $type['type'];
2512
+
2513
+					/**
2514
+					 * Filter the output for custom fields.
2515
+					 *
2516
+					 * Here we can remove or add new functions depending on the field type.
2517
+					 *
2518
+					 * @param string $html The html to be filtered (blank).
2519
+					 * @param string $fields_location The location the field is to be show.
2520
+					 * @param array $type The array of field values.
2521
+					 */
2522
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2523
+
2524
+
2525
+					/**
2526
+					 * Filter custom field output in tab.
2527
+					 *
2528
+					 * @since 1.5.6
2529
+					 *
2530
+					 * @param string $html_var The HTML variable name for the field.
2531
+					 * @param string $html Custom field unfiltered HTML.
2532
+					 * @param array $variables_array Custom field variables array.
2533
+					 */
2534
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2535
+
2536
+					$fieldset_html = '';
2537
+					if ($field_set_start == 1) {
2538
+						$add_html = false;
2539
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2540
+							if ($fieldset != '') {
2541
+								$add_html = true;
2542
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2543
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2544
+							}
2545
+							$fieldset_html = $fieldset;
2546
+							$fieldset = '';
2547
+						} else {
2548
+							$fieldset .= $html;
2549
+							if ($total_fields == $count_field && $fieldset != '') {
2550
+								$add_html = true;
2551
+								$label = $fieldset_arr[$fieldset_count]['label'];
2552
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2553
+								$fieldset_html = $fieldset;
2554
+							}
2555
+						}
2556
+
2557
+						if ($add_html) {
2558
+							$tabs_arr[$htmlvar_name] = array(
2559
+								'heading_text' => __($label, 'geodirectory'),
2560
+								'is_active_tab' => false,
2561
+								/**
2562
+								 * Filter if a custom field should be displayed on the details page tab.
2563
+								 *
2564
+								 * @since 1.0.0
2565
+								 * @param string $htmlvar_name The field HTML var name.
2566
+								 */
2567
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2568
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2569
+							);
2570
+						}
2571
+					} else {
2572
+						if ($html != '') {
2573
+							$tabs_arr[$html_var] = array(
2574
+								'heading_text' => __($label, 'geodirectory'),
2575
+								'is_active_tab' => false,
2576
+								/** This action is documented in geodirectory_hooks_actions.php */
2577
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2578
+								'tab_content' => $html
2579
+							);
2580
+						}
2581
+					}
2582
+				}
2583
+			}
2584
+		}
2585
+	}
2586
+	return $tabs_arr;
2587 2587
 }
2588 2588
 
2589 2589
 /* display add listing page for wpml */
@@ -2607,41 +2607,41 @@  discard block
 block discarded – undo
2607 2607
  */
2608 2608
 function geodir_add_post_status_author_page()
2609 2609
 {
2610
-    global $wpdb, $post;
2611
-
2612
-    $html = '';
2613
-    if (get_current_user_id()) {
2614
-
2615
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2616
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2617
-
2618
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2619
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2620
-            $status = "<strong>(";
2621
-            $status_icon = '<i class="fa fa-play"></i>';
2622
-            if ($real_status == 'publish') {
2623
-                $status .= __('Published', 'geodirectory');
2624
-            }elseif ($real_status == 'pending') {
2625
-                $status .= __('Awaiting Review', 'geodirectory');
2626
-            } else {
2627
-                $status .= __('Not published', 'geodirectory');
2628
-                $status_icon = '<i class="fa fa-pause"></i>';
2629
-            }
2630
-            $status .= ")</strong>";
2610
+	global $wpdb, $post;
2611
+
2612
+	$html = '';
2613
+	if (get_current_user_id()) {
2614
+
2615
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2616
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2617
+
2618
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2619
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2620
+			$status = "<strong>(";
2621
+			$status_icon = '<i class="fa fa-play"></i>';
2622
+			if ($real_status == 'publish') {
2623
+				$status .= __('Published', 'geodirectory');
2624
+			}elseif ($real_status == 'pending') {
2625
+				$status .= __('Awaiting Review', 'geodirectory');
2626
+			} else {
2627
+				$status .= __('Not published', 'geodirectory');
2628
+				$status_icon = '<i class="fa fa-pause"></i>';
2629
+			}
2630
+			$status .= ")</strong>";
2631 2631
 
2632
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2633
-        }
2634
-    }
2632
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2633
+		}
2634
+	}
2635 2635
 
2636
-    if ($html != '') {
2637
-        /**
2638
-         * Filter the post status text on the author page.
2639
-         *
2640
-         * @since 1.0.0
2641
-         * @param string $html The HTML of the status.
2642
-         */
2643
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2644
-    }
2636
+	if ($html != '') {
2637
+		/**
2638
+		 * Filter the post status text on the author page.
2639
+		 *
2640
+		 * @since 1.0.0
2641
+		 * @param string $html The HTML of the status.
2642
+		 */
2643
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2644
+	}
2645 2645
 
2646 2646
 
2647 2647
 }
@@ -2655,9 +2655,9 @@  discard block
 block discarded – undo
2655 2655
  * @package GeoDirectory
2656 2656
  */
2657 2657
 function geodir_init_no_rating() {
2658
-    if (geodir_rating_disabled_post_types()) {
2659
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2660
-    }
2658
+	if (geodir_rating_disabled_post_types()) {
2659
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2660
+	}
2661 2661
 }
2662 2662
 
2663 2663
 /**
@@ -2671,22 +2671,22 @@  discard block
 block discarded – undo
2671 2671
  * @return array Modified sort options array.
2672 2672
  */
2673 2673
 function geodir_no_rating_get_sort_options($options, $post_type = '') {
2674
-    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2675
-        $new_options = array();
2674
+	if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2675
+		$new_options = array();
2676 2676
         
2677
-        if (!empty($options)) {
2678
-            foreach ($options as $option) {
2679
-                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2680
-                    continue;
2681
-                }
2682
-                $new_options[] = $option;
2683
-            }
2677
+		if (!empty($options)) {
2678
+			foreach ($options as $option) {
2679
+				if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2680
+					continue;
2681
+				}
2682
+				$new_options[] = $option;
2683
+			}
2684 2684
 
2685
-            $options = $new_options;
2686
-        }
2687
-    }
2685
+			$options = $new_options;
2686
+		}
2687
+	}
2688 2688
 
2689
-    return $options;
2689
+	return $options;
2690 2690
 }
2691 2691
 
2692 2692
 /**
@@ -2698,9 +2698,9 @@  discard block
 block discarded – undo
2698 2698
  * @return array Modified class array.
2699 2699
  */
2700 2700
 function geodir_body_class_active_map($classes = array()) {
2701
-    $classes[] = 'gd-map-' . geodir_map_name();
2701
+	$classes[] = 'gd-map-' . geodir_map_name();
2702 2702
 
2703
-    return $classes;
2703
+	return $classes;
2704 2704
 }
2705 2705
 add_filter('body_class', 'geodir_body_class_active_map', 100);
2706 2706
 
@@ -2713,9 +2713,9 @@  discard block
 block discarded – undo
2713 2713
  * @return string Modified class string.
2714 2714
  */
2715 2715
 function geodir_admin_body_class_active_map($class = '') {    
2716
-    $class .= ' gd-map-' . geodir_map_name();
2716
+	$class .= ' gd-map-' . geodir_map_name();
2717 2717
 
2718
-    return $class;
2718
+	return $class;
2719 2719
 }
2720 2720
 add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
2721 2721
 
@@ -2733,36 +2733,36 @@  discard block
 block discarded – undo
2733 2733
  * @return array Translation texts.
2734 2734
  */
2735 2735
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2736
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2737
-
2738
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2739
-
2740
-    /**
2741
-     * Filters the geodirectory option names that requires to add for translation.
2742
-     *
2743
-     * @since 1.5.7
2744
-     * @package GeoDirectory
2745
-     *
2746
-     * @param  array $gd_options Array of option names.
2747
-     */
2748
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2749
-    $gd_options = array_unique($gd_options);
2750
-
2751
-    if (!empty($gd_options)) {
2752
-        foreach ($gd_options as $gd_option) {
2753
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2754
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2736
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2737
+
2738
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2739
+
2740
+	/**
2741
+	 * Filters the geodirectory option names that requires to add for translation.
2742
+	 *
2743
+	 * @since 1.5.7
2744
+	 * @package GeoDirectory
2745
+	 *
2746
+	 * @param  array $gd_options Array of option names.
2747
+	 */
2748
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2749
+	$gd_options = array_unique($gd_options);
2750
+
2751
+	if (!empty($gd_options)) {
2752
+		foreach ($gd_options as $gd_option) {
2753
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2754
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2755 2755
                 
2756
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2757
-                    $translation_texts[] = stripslashes_deep($option_value);
2758
-                }
2759
-            }
2760
-        }
2761
-    }
2756
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2757
+					$translation_texts[] = stripslashes_deep($option_value);
2758
+				}
2759
+			}
2760
+		}
2761
+	}
2762 2762
 
2763
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2763
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2764 2764
 
2765
-    return $translation_texts;
2765
+	return $translation_texts;
2766 2766
 }
2767 2767
 
2768 2768
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2776,15 +2776,15 @@  discard block
 block discarded – undo
2776 2776
 
2777 2777
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2778 2778
 function gd_get_comments_link($comments_link, $post_id) {
2779
-    $post_type = get_post_type($post_id);
2779
+	$post_type = get_post_type($post_id);
2780 2780
 
2781
-    $all_postypes = geodir_get_posttypes();
2782
-    if (in_array($post_type, $all_postypes)) {
2783
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2784
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2785
-    }
2781
+	$all_postypes = geodir_get_posttypes();
2782
+	if (in_array($post_type, $all_postypes)) {
2783
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2784
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2785
+	}
2786 2786
 
2787
-    return $comments_link;
2787
+	return $comments_link;
2788 2788
 }
2789 2789
 
2790 2790
 
@@ -2802,11 +2802,11 @@  discard block
 block discarded – undo
2802 2802
 function geodir_add_nav_menu_class( $args )
2803 2803
 {
2804 2804
 
2805
-        if(isset($args['menu_class'])){
2806
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2807
-        }
2805
+		if(isset($args['menu_class'])){
2806
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2807
+		}
2808 2808
     
2809
-    return $args;
2809
+	return $args;
2810 2810
 }
2811 2811
 
2812 2812
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2823,15 +2823,15 @@  discard block
 block discarded – undo
2823 2823
  * @return string Filtered locale ID.
2824 2824
  */
2825 2825
 function geodir_wpml_filter_locale($locale) {
2826
-    global $sitepress;
2826
+	global $sitepress;
2827 2827
     
2828
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2828
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2829 2829
     
2830
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2831
-        $locale = $sitepress->get_locale($current_lang);
2832
-    }
2830
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2831
+		$locale = $sitepress->get_locale($current_lang);
2832
+	}
2833 2833
     
2834
-    return $locale;
2834
+	return $locale;
2835 2835
 }
2836 2836
 
2837 2837
 /**
@@ -2841,20 +2841,20 @@  discard block
 block discarded – undo
2841 2841
  * @package GeoDirectory
2842 2842
  */
2843 2843
 function geodir_wpml_set_filter() {
2844
-    if (geodir_is_wpml()) {
2845
-        global $sitepress;
2844
+	if (geodir_is_wpml()) {
2845
+		global $sitepress;
2846 2846
         
2847
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2848
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2849
-        }
2847
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2848
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2849
+		}
2850 2850
         
2851
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2852
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2851
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2852
+		add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2853 2853
 		add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' );
2854
-        if (is_admin()) {
2855
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2856
-        }
2857
-    }
2854
+		if (is_admin()) {
2855
+			add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2856
+		}
2857
+	}
2858 2858
 }
2859 2859
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2860 2860
 
@@ -2867,38 +2867,38 @@  discard block
 block discarded – undo
2867 2867
  * @return array Filtered languages.
2868 2868
  */
2869 2869
 function geodir_wpml_filter_ls_languages($languages) {    
2870
-    if (geodir_is_geodir_page()) {        
2871
-        $keep_vars = array();
2870
+	if (geodir_is_geodir_page()) {        
2871
+		$keep_vars = array();
2872 2872
         
2873
-        if (geodir_is_page('add-listing')) {
2874
-            $keep_vars = array('listing_type', 'package_id');
2875
-        } else if (geodir_is_page('search')) {
2876
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2877
-        } else if (geodir_is_page('author')) {
2878
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2879
-        } else if (geodir_is_page('login')) {
2880
-            $keep_vars = array('forgot', 'signup');
2881
-        }        
2873
+		if (geodir_is_page('add-listing')) {
2874
+			$keep_vars = array('listing_type', 'package_id');
2875
+		} else if (geodir_is_page('search')) {
2876
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2877
+		} else if (geodir_is_page('author')) {
2878
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2879
+		} else if (geodir_is_page('login')) {
2880
+			$keep_vars = array('forgot', 'signup');
2881
+		}        
2882 2882
         
2883
-        if (!empty($keep_vars)) {
2884
-            foreach ( $languages as $code => $url) {
2885
-                $filter_url = $url['url'];
2883
+		if (!empty($keep_vars)) {
2884
+			foreach ( $languages as $code => $url) {
2885
+				$filter_url = $url['url'];
2886 2886
                 
2887
-                foreach ($keep_vars as $var) {
2888
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2889
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2890
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2891
-                    }
2892
-                }
2887
+				foreach ($keep_vars as $var) {
2888
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2889
+						$filter_url = remove_query_arg(array($var), $filter_url);
2890
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2891
+					}
2892
+				}
2893 2893
                 
2894
-                if ($filter_url != $url['url']) {
2895
-                    $languages[$code]['url'] = $filter_url;
2896
-                }
2897
-            }
2898
-        }
2899
-    }
2894
+				if ($filter_url != $url['url']) {
2895
+					$languages[$code]['url'] = $filter_url;
2896
+				}
2897
+			}
2898
+		}
2899
+	}
2900 2900
 
2901
-    return $languages;
2901
+	return $languages;
2902 2902
 }
2903 2903
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2904 2904
 
@@ -2909,18 +2909,18 @@  discard block
 block discarded – undo
2909 2909
  *
2910 2910
  */
2911 2911
 function geodir_remove_yoast_seo_metas(){
2912
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2913
-        $wpseo = WPSEO_Frontend::get_instance();
2912
+	if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2913
+		$wpseo = WPSEO_Frontend::get_instance();
2914 2914
         
2915
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2916
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2917
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2918
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2919
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2920
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2915
+		remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2916
+		remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2917
+		remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2918
+		remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2919
+		remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2920
+		remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2921 2921
         
2922
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2923
-    }
2922
+		remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2923
+	}
2924 2924
 }
2925 2925
 
2926 2926
 /**
@@ -2934,20 +2934,20 @@  discard block
 block discarded – undo
2934 2934
  *
2935 2935
  */
2936 2936
  function geodir_wpml_ajax_set_guest_lang() {    
2937
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2938
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2939
-            global $sitepress;
2937
+	if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2938
+		if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2939
+			global $sitepress;
2940 2940
             
2941
-            $referer = wp_get_referer();
2941
+			$referer = wp_get_referer();
2942 2942
             
2943
-            $current_lang = $sitepress->get_current_language();
2944
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2943
+			$current_lang = $sitepress->get_current_language();
2944
+			$referrer_lang = $sitepress->get_language_from_url( $referer );
2945 2945
             
2946
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2947
-                $_GET['lang'] = $referrer_lang;
2948
-            }
2949
-        }
2950
-    }
2946
+			if ( $referrer_lang && $current_lang != $referrer_lang ) {
2947
+				$_GET['lang'] = $referrer_lang;
2948
+			}
2949
+		}
2950
+	}
2951 2951
 }
2952 2952
 add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2953 2953
 
@@ -2959,36 +2959,36 @@  discard block
 block discarded – undo
2959 2959
  * @param object $wp The WordPress object.
2960 2960
  */
2961 2961
 function geodir_check_redirect($wp) {
2962
-    if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2963
-        $current_url = geodir_curPageURL();
2964
-        $search = 'czech-republic';
2965
-        $replace = 'czechia';        
2962
+	if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2963
+		$current_url = geodir_curPageURL();
2964
+		$search = 'czech-republic';
2965
+		$replace = 'czechia';        
2966 2966
         
2967
-        $has_slash = substr($current_url, -1);
2968
-        if ($has_slash != "/") {
2969
-            $current_url .= '/';
2970
-        }
2967
+		$has_slash = substr($current_url, -1);
2968
+		if ($has_slash != "/") {
2969
+			$current_url .= '/';
2970
+		}
2971 2971
         
2972
-        $redirect = false;
2973
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2974
-            $redirect = true;
2975
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2976
-        }
2972
+		$redirect = false;
2973
+		if (strpos($current_url, '/' . $search . '/') !== false) {
2974
+			$redirect = true;
2975
+			$current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2976
+		}
2977 2977
         
2978
-        if ($has_slash != "/") {
2979
-            $current_url = trim($current_url, '/');
2980
-        }
2978
+		if ($has_slash != "/") {
2979
+			$current_url = trim($current_url, '/');
2980
+		}
2981 2981
         
2982
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2983
-            $redirect = true;
2984
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2985
-        }
2986
-
2987
-        if ($redirect) {
2988
-            wp_redirect($current_url);
2989
-            exit;
2990
-        }
2991
-    }
2982
+		if (strpos($current_url, 'gd_country=' . $search) !== false) {
2983
+			$redirect = true;
2984
+			$current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2985
+		}
2986
+
2987
+		if ($redirect) {
2988
+			wp_redirect($current_url);
2989
+			exit;
2990
+		}
2991
+	}
2992 2992
 }
2993 2993
 add_action('parse_request', 'geodir_check_redirect', 101, 1);
2994 2994
 
@@ -3008,50 +3008,50 @@  discard block
 block discarded – undo
3008 3008
  * @param string $original_slug The original post slug.
3009 3009
  */
3010 3010
 function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3011
-    global $wpdb, $sitepress;
3011
+	global $wpdb, $sitepress;
3012 3012
     
3013
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3014
-        $wpml_post_join = "";
3015
-        $wpml_post_where = "";
3016
-        $wpml_term_join = "";
3017
-        $wpml_term_where = "";
3013
+	if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3014
+		$wpml_post_join = "";
3015
+		$wpml_post_where = "";
3016
+		$wpml_term_join = "";
3017
+		$wpml_term_where = "";
3018 3018
         
3019
-        if (geodir_wpml_is_post_type_translated($post_type)) {
3020
-            $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3021
-            $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3022
-            if (!$post_language) {
3023
-                $post_language = $sitepress->get_current_language();
3024
-            }
3019
+		if (geodir_wpml_is_post_type_translated($post_type)) {
3020
+			$post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3021
+			$post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3022
+			if (!$post_language) {
3023
+				$post_language = $sitepress->get_current_language();
3024
+			}
3025 3025
             
3026
-            $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3027
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3026
+			$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3027
+			$wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3028 3028
             
3029
-            $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3030
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3031
-        }
3029
+			$wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3030
+			$wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3031
+		}
3032 3032
 
3033
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3033
+		$term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3034 3034
 
3035
-        if ( $term_slug_check ) {
3036
-            $suffix = 1;
3035
+		if ( $term_slug_check ) {
3036
+			$suffix = 1;
3037 3037
             
3038
-            do {
3039
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3038
+			do {
3039
+				$alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3040 3040
                 
3041
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3041
+				$term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3042 3042
                 
3043
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3043
+				$post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3044 3044
                 
3045
-                $term_slug_check = $term_check || $post_check;
3045
+				$term_slug_check = $term_check || $post_check;
3046 3046
                 
3047
-                $suffix++;
3048
-            } while ( $term_slug_check );
3047
+				$suffix++;
3048
+			} while ( $term_slug_check );
3049 3049
             
3050
-            $slug = $alt_slug;
3051
-        }
3052
-    }
3050
+			$slug = $alt_slug;
3051
+		}
3052
+	}
3053 3053
     
3054
-    return $slug;
3054
+	return $slug;
3055 3055
 }
3056 3056
 add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3057 3057
 
@@ -3071,48 +3071,48 @@  discard block
 block discarded – undo
3071 3071
  * @return bool true when exists. false when not exists.
3072 3072
  */
3073 3073
 function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3074
-    global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3074
+	global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3075 3075
     
3076
-    if ( $slug_exists ) {
3077
-        return $slug_exists;
3078
-    }
3076
+	if ( $slug_exists ) {
3077
+		return $slug_exists;
3078
+	}
3079 3079
     
3080
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3081
-        $taxonomy = $gd_term_taxonomy[$term_id];
3082
-    } else {
3083
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3084
-        $gd_term_taxonomy[$term_id] = $taxonomy;
3085
-    }
3080
+	if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3081
+		$taxonomy = $gd_term_taxonomy[$term_id];
3082
+	} else {
3083
+		$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3084
+		$gd_term_taxonomy[$term_id] = $taxonomy;
3085
+	}
3086 3086
     
3087
-    if ( empty($taxonomy) ) {
3088
-        return $slug_exists;
3089
-    }
3087
+	if ( empty($taxonomy) ) {
3088
+		return $slug_exists;
3089
+	}
3090 3090
     
3091
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3092
-        $post_type = $gd_term_post_type[$term_id];
3093
-    } else {
3094
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3095
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3096
-    }
3091
+	if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3092
+		$post_type = $gd_term_post_type[$term_id];
3093
+	} else {
3094
+		$taxonomy_obj = get_taxonomy( $taxonomy );
3095
+		$post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3096
+	}
3097 3097
     
3098
-    $wpml_post_join = "";
3099
-    $wpml_post_where = "";
3098
+	$wpml_post_join = "";
3099
+	$wpml_post_where = "";
3100 3100
     
3101
-    if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3102
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3103
-        if (!$term_language) {
3104
-            $term_language = $sitepress->get_current_language();
3105
-        }
3101
+	if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3102
+		$term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3103
+		if (!$term_language) {
3104
+			$term_language = $sitepress->get_current_language();
3105
+		}
3106 3106
         
3107
-        $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3108
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3109
-    }
3107
+		$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3108
+		$wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3109
+	}
3110 3110
     
3111
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3112
-        $slug_exists = true;
3113
-    }
3111
+	if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3112
+		$slug_exists = true;
3113
+	}
3114 3114
 
3115
-    return $slug_exists;
3115
+	return $slug_exists;
3116 3116
 }
3117 3117
 add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3118 3118
 
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/notifications_settings_array.php 1 patch
Indentation   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -17,278 +17,278 @@
 block discarded – undo
17 17
 $geodir_settings['notifications_settings'] = apply_filters('geodir_notifications_settings', array(
18 18
 
19 19
 
20
-    array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'),
21
-
22
-
23
-    array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'),
24
-
25
-    array(
26
-        'name' => __('List of usable shortcodes', 'geodirectory'),
27
-        'desc' => __('[#client_name#],[#listing_link#],[#posted_date#],[#number_of_days#],[#number_of_grace_days#],[#login_url#],[#username#],[#user_email#],[#site_name_url#],[#renew_link#],[#post_id#],[#site_name#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'),
28
-        'id' => 'geodir_list_of_usable_shordcodes',
29
-        'type' => 'html_content',
30
-        'css' => 'min-width:300px;',
31
-        'std' => 'All Places' // Default value for the page title - changed in settings
32
-    ),
33
-
34
-    array(
35
-        'name' => __('Use advanced editor? (slow loading)', 'geodirectory'),
36
-        'desc' => __('Yes', 'geodirectory'),
37
-        'id' => 'geodir_tiny_editor',
38
-        'std' => 'yes',
39
-        'type' => 'radio',
40
-        'value' => '1',
41
-        'radiogroup' => 'start'
42
-    ),
43
-    array(
44
-        'name' => __('Use advanced editor?(slow loading)', 'geodirectory'),
45
-        'desc' => __('No', 'geodirectory'),
46
-        'id' => 'geodir_tiny_editor',
47
-        'std' => 'yes',
48
-        'type' => 'radio',
49
-        'value' => '0',
50
-        'radiogroup' => 'end'
51
-    ),
52
-
53
-
54
-    array('type' => 'sectionend', 'id' => 'notification_options'),
55
-
56
-
57
-    array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'),
58
-
59
-    array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'),
60
-
61
-    array(
62
-        'name' => __('New user registration', 'geodirectory'),
63
-        'desc' => __('Yes', 'geodirectory'),
64
-        'id' => 'geodir_bcc_new_user',
65
-        'std' => 'yes',
66
-        'type' => 'radio',
67
-        'value' => '1',
68
-        'radiogroup' => 'start'
69
-    ),
70
-    array(
71
-        'name' => __('New user registration', 'geodirectory'),
72
-        'desc' => __('No', 'geodirectory'),
73
-        'id' => 'geodir_bcc_new_user',
74
-        'std' => 'yes',
75
-        'type' => 'radio',
76
-        'value' => '0',
77
-        'radiogroup' => 'end'
78
-    ),
79
-
80
-    array(
81
-        'name' => __('Send enquiry', 'geodirectory'),
82
-        'desc' => __('Yes', 'geodirectory'),
83
-        'id' => 'geodir_bcc_enquiry',
84
-        'std' => 'yes',
85
-        'type' => 'radio',
86
-        'value' => '1',
87
-        'radiogroup' => 'start'
88
-    ),
89
-    array(
90
-        'name' => __('Send enquiry', 'geodirectory'),
91
-        'desc' => __('No', 'geodirectory'),
92
-        'id' => 'geodir_bcc_enquiry',
93
-        'std' => 'yes',
94
-        'type' => 'radio',
95
-        'value' => '0',
96
-        'radiogroup' => 'end'
97
-    ),
98
-
99
-
100
-    array('type' => 'sectionend', 'id' => 'site_bcc_options'),
101
-
102
-
103
-    array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'),
104
-
105
-    array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'),
106
-
107
-    array(
108
-        'name' => __('Notify to admin on post submit', 'geodirectory'),
109
-        'desc' => __('Yes', 'geodirectory'),
110
-        'id' => 'geodir_notify_post_submit',
111
-        'std' => '1',
112
-        'type' => 'radio',
113
-        'value' => '1',
114
-        'radiogroup' => 'start'
115
-    ),
116
-    array(
117
-        'name' => __('Notify to admin on post submit', 'geodirectory'),
118
-        'desc' => __('No', 'geodirectory'),
119
-        'id' => 'geodir_notify_post_submit',
120
-        'std' => '1',
121
-        'type' => 'radio',
122
-        'value' => '0',
123
-        'radiogroup' => 'end'
124
-    ),
125
-    array(
126
-        'name' => __('Post submit success to admin email', 'geodirectory'),
127
-        'desc' => '',
128
-        'id' => 'geodir_post_submited_success_email_subject_admin',
129
-        'type' => 'text',
130
-        'css' => 'min-width:300px;',
131
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
132
-    ),
133
-     array(
134
-        'name' => '',
135
-        'desc' => '',
136
-        'id' => 'geodir_post_submited_success_email_content_admin',
137
-        'css' => 'width:500px; height: 150px;',
138
-        'type' => 'textarea',
139
-        'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory')
140
-    ),
141
-    array(
142
-        'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
143
-        'desc' => __('Yes', 'geodirectory'),
144
-        'id' => 'geodir_notify_post_edited',
145
-        'std' => '0',
146
-        'type' => 'radio',
147
-        'value' => '1',
148
-        'radiogroup' => 'start'
149
-    ),
150
-    array(
151
-        'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
152
-        'desc' => __('No', 'geodirectory'),
153
-        'id' => 'geodir_notify_post_edited',
154
-        'std' => '0',
155
-        'type' => 'radio',
156
-        'value' => '0',
157
-        'radiogroup' => 'end'
158
-    ),
159
-    array(
160
-        'name' => __('Listing edited by Author', 'geodirectory'),
161
-        'desc' => '',
162
-        'id' => 'geodir_post_edited_email_subject_admin',
163
-        'type' => 'text',
164
-        'css' => 'min-width:300px;',
165
-        'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory')
166
-    ),
167
-    array(
168
-        'name' => '',
169
-        'desc' => '',
170
-        'id' => 'geodir_post_edited_email_content_admin',
171
-        'css' => 'width:500px; height: 150px;',
172
-        'type' => 'textarea',
173
-        'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory')
174
-    ),
175
-
176
-
177
-    array('type' => 'sectionend', 'id' => 'admin_emails'),
178
-
179
-
180
-    array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'),
181
-
182
-    array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'),
183
-
184
-    array(
185
-        'name' => __('Post submit success to client email', 'geodirectory'),
186
-        'desc' => '',
187
-        'id' => 'geodir_post_submited_success_email_subject',
188
-        'type' => 'text',
189
-        'css' => 'min-width:300px;',
190
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
191
-    ),
192
-    array(
193
-        'name' => '',
194
-        'desc' => '',
195
-        'id' => 'geodir_post_submited_success_email_content',
196
-        'css' => 'width:500px; height: 150px;',
197
-        'type' => 'textarea',
198
-        'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory')
199
-    ),
200
-
201
-
202
-    array(
203
-        'name' => __('User forgot password email', 'geodirectory'),
204
-        'desc' => '',
205
-        'id' => 'geodir_forgot_password_subject',
206
-        'type' => 'text',
207
-        'css' => 'min-width:300px;',
208
-        'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings
209
-    ),
210
-    array(
211
-        'name' => '',
212
-        'desc' => '',
213
-        'id' => 'geodir_forgot_password_content',
214
-        'css' => 'width:500px; height: 150px;',
215
-        'type' => 'textarea',
216
-        'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
217
-    ),
218
-
219
-    array(
220
-        'name' => __('Registration success email', 'geodirectory'),
221
-        'desc' => '',
222
-        'id' => 'geodir_registration_success_email_subject',
223
-        'type' => 'text',
224
-        'css' => 'min-width:300px;',
225
-        'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings
226
-    ),
227
-    array(
228
-        'name' => '',
229
-        'desc' => '',
230
-        'id' => 'geodir_registration_success_email_content',
231
-        'css' => 'width:500px; height: 150px;',
232
-        'type' => 'textarea',
233
-        'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
234
-    ),
235
-    array(
236
-        'name' => __('Listing published email', 'geodirectory'),
237
-        'desc' => '',
238
-        'id' => 'geodir_post_published_email_subject',
239
-        'type' => 'text',
240
-        'css' => 'min-width:300px;',
241
-        'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings
242
-    ),
243
-    array(
244
-        'name' => '',
245
-        'desc' => '',
246
-        'id' => 'geodir_post_published_email_content',
247
-        'css' => 'width:500px; height: 150px;',
248
-        'type' => 'textarea',
249
-        'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory')
250
-    ),
251
-
252
-    array('type' => 'sectionend', 'id' => 'client_emails'),
253
-
254
-    array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'),
255
-
256
-    array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'),
257
-
258
-    array(
259
-        'name' => __('Email enquiry', 'geodirectory'),
260
-        'desc' => '',
261
-        'id' => 'geodir_email_enquiry_subject',
262
-        'type' => 'text',
263
-        'css' => 'min-width:300px;',
264
-        'std' => __('Website Enquiry', 'geodirectory')
265
-    ),
266
-    array(
267
-        'name' => '',
268
-        'desc' => '',
269
-        'id' => 'geodir_email_enquiry_content',
270
-        'css' => 'width:500px; height: 150px;',
271
-        'type' => 'textarea',
272
-        'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
273
-    ),
274
-
275
-    array('type' => 'sectionend', 'id' => 'other_emails'),
276
-
277
-
278
-    array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'),
279
-
280
-    array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'),
281
-
282
-    array(
283
-        'name' => __('Post submitted success', 'geodirectory'),
284
-        'desc' => '',
285
-        'id' => 'geodir_post_added_success_msg_content',
286
-        'css' => 'width:500px; height: 150px;',
287
-        'type' => 'textarea',
288
-        'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory')
289
-    ),
290
-
291
-
292
-    array('type' => 'sectionend', 'id' => 'messages'),
20
+	array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'),
21
+
22
+
23
+	array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'),
24
+
25
+	array(
26
+		'name' => __('List of usable shortcodes', 'geodirectory'),
27
+		'desc' => __('[#client_name#],[#listing_link#],[#posted_date#],[#number_of_days#],[#number_of_grace_days#],[#login_url#],[#username#],[#user_email#],[#site_name_url#],[#renew_link#],[#post_id#],[#site_name#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'),
28
+		'id' => 'geodir_list_of_usable_shordcodes',
29
+		'type' => 'html_content',
30
+		'css' => 'min-width:300px;',
31
+		'std' => 'All Places' // Default value for the page title - changed in settings
32
+	),
33
+
34
+	array(
35
+		'name' => __('Use advanced editor? (slow loading)', 'geodirectory'),
36
+		'desc' => __('Yes', 'geodirectory'),
37
+		'id' => 'geodir_tiny_editor',
38
+		'std' => 'yes',
39
+		'type' => 'radio',
40
+		'value' => '1',
41
+		'radiogroup' => 'start'
42
+	),
43
+	array(
44
+		'name' => __('Use advanced editor?(slow loading)', 'geodirectory'),
45
+		'desc' => __('No', 'geodirectory'),
46
+		'id' => 'geodir_tiny_editor',
47
+		'std' => 'yes',
48
+		'type' => 'radio',
49
+		'value' => '0',
50
+		'radiogroup' => 'end'
51
+	),
52
+
53
+
54
+	array('type' => 'sectionend', 'id' => 'notification_options'),
55
+
56
+
57
+	array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'),
58
+
59
+	array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'),
60
+
61
+	array(
62
+		'name' => __('New user registration', 'geodirectory'),
63
+		'desc' => __('Yes', 'geodirectory'),
64
+		'id' => 'geodir_bcc_new_user',
65
+		'std' => 'yes',
66
+		'type' => 'radio',
67
+		'value' => '1',
68
+		'radiogroup' => 'start'
69
+	),
70
+	array(
71
+		'name' => __('New user registration', 'geodirectory'),
72
+		'desc' => __('No', 'geodirectory'),
73
+		'id' => 'geodir_bcc_new_user',
74
+		'std' => 'yes',
75
+		'type' => 'radio',
76
+		'value' => '0',
77
+		'radiogroup' => 'end'
78
+	),
79
+
80
+	array(
81
+		'name' => __('Send enquiry', 'geodirectory'),
82
+		'desc' => __('Yes', 'geodirectory'),
83
+		'id' => 'geodir_bcc_enquiry',
84
+		'std' => 'yes',
85
+		'type' => 'radio',
86
+		'value' => '1',
87
+		'radiogroup' => 'start'
88
+	),
89
+	array(
90
+		'name' => __('Send enquiry', 'geodirectory'),
91
+		'desc' => __('No', 'geodirectory'),
92
+		'id' => 'geodir_bcc_enquiry',
93
+		'std' => 'yes',
94
+		'type' => 'radio',
95
+		'value' => '0',
96
+		'radiogroup' => 'end'
97
+	),
98
+
99
+
100
+	array('type' => 'sectionend', 'id' => 'site_bcc_options'),
101
+
102
+
103
+	array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'),
104
+
105
+	array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'),
106
+
107
+	array(
108
+		'name' => __('Notify to admin on post submit', 'geodirectory'),
109
+		'desc' => __('Yes', 'geodirectory'),
110
+		'id' => 'geodir_notify_post_submit',
111
+		'std' => '1',
112
+		'type' => 'radio',
113
+		'value' => '1',
114
+		'radiogroup' => 'start'
115
+	),
116
+	array(
117
+		'name' => __('Notify to admin on post submit', 'geodirectory'),
118
+		'desc' => __('No', 'geodirectory'),
119
+		'id' => 'geodir_notify_post_submit',
120
+		'std' => '1',
121
+		'type' => 'radio',
122
+		'value' => '0',
123
+		'radiogroup' => 'end'
124
+	),
125
+	array(
126
+		'name' => __('Post submit success to admin email', 'geodirectory'),
127
+		'desc' => '',
128
+		'id' => 'geodir_post_submited_success_email_subject_admin',
129
+		'type' => 'text',
130
+		'css' => 'min-width:300px;',
131
+		'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
132
+	),
133
+	 array(
134
+		'name' => '',
135
+		'desc' => '',
136
+		'id' => 'geodir_post_submited_success_email_content_admin',
137
+		'css' => 'width:500px; height: 150px;',
138
+		'type' => 'textarea',
139
+		'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory')
140
+	),
141
+	array(
142
+		'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
143
+		'desc' => __('Yes', 'geodirectory'),
144
+		'id' => 'geodir_notify_post_edited',
145
+		'std' => '0',
146
+		'type' => 'radio',
147
+		'value' => '1',
148
+		'radiogroup' => 'start'
149
+	),
150
+	array(
151
+		'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
152
+		'desc' => __('No', 'geodirectory'),
153
+		'id' => 'geodir_notify_post_edited',
154
+		'std' => '0',
155
+		'type' => 'radio',
156
+		'value' => '0',
157
+		'radiogroup' => 'end'
158
+	),
159
+	array(
160
+		'name' => __('Listing edited by Author', 'geodirectory'),
161
+		'desc' => '',
162
+		'id' => 'geodir_post_edited_email_subject_admin',
163
+		'type' => 'text',
164
+		'css' => 'min-width:300px;',
165
+		'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory')
166
+	),
167
+	array(
168
+		'name' => '',
169
+		'desc' => '',
170
+		'id' => 'geodir_post_edited_email_content_admin',
171
+		'css' => 'width:500px; height: 150px;',
172
+		'type' => 'textarea',
173
+		'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory')
174
+	),
175
+
176
+
177
+	array('type' => 'sectionend', 'id' => 'admin_emails'),
178
+
179
+
180
+	array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'),
181
+
182
+	array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'),
183
+
184
+	array(
185
+		'name' => __('Post submit success to client email', 'geodirectory'),
186
+		'desc' => '',
187
+		'id' => 'geodir_post_submited_success_email_subject',
188
+		'type' => 'text',
189
+		'css' => 'min-width:300px;',
190
+		'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
191
+	),
192
+	array(
193
+		'name' => '',
194
+		'desc' => '',
195
+		'id' => 'geodir_post_submited_success_email_content',
196
+		'css' => 'width:500px; height: 150px;',
197
+		'type' => 'textarea',
198
+		'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory')
199
+	),
200
+
201
+
202
+	array(
203
+		'name' => __('User forgot password email', 'geodirectory'),
204
+		'desc' => '',
205
+		'id' => 'geodir_forgot_password_subject',
206
+		'type' => 'text',
207
+		'css' => 'min-width:300px;',
208
+		'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings
209
+	),
210
+	array(
211
+		'name' => '',
212
+		'desc' => '',
213
+		'id' => 'geodir_forgot_password_content',
214
+		'css' => 'width:500px; height: 150px;',
215
+		'type' => 'textarea',
216
+		'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
217
+	),
218
+
219
+	array(
220
+		'name' => __('Registration success email', 'geodirectory'),
221
+		'desc' => '',
222
+		'id' => 'geodir_registration_success_email_subject',
223
+		'type' => 'text',
224
+		'css' => 'min-width:300px;',
225
+		'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings
226
+	),
227
+	array(
228
+		'name' => '',
229
+		'desc' => '',
230
+		'id' => 'geodir_registration_success_email_content',
231
+		'css' => 'width:500px; height: 150px;',
232
+		'type' => 'textarea',
233
+		'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
234
+	),
235
+	array(
236
+		'name' => __('Listing published email', 'geodirectory'),
237
+		'desc' => '',
238
+		'id' => 'geodir_post_published_email_subject',
239
+		'type' => 'text',
240
+		'css' => 'min-width:300px;',
241
+		'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings
242
+	),
243
+	array(
244
+		'name' => '',
245
+		'desc' => '',
246
+		'id' => 'geodir_post_published_email_content',
247
+		'css' => 'width:500px; height: 150px;',
248
+		'type' => 'textarea',
249
+		'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory')
250
+	),
251
+
252
+	array('type' => 'sectionend', 'id' => 'client_emails'),
253
+
254
+	array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'),
255
+
256
+	array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'),
257
+
258
+	array(
259
+		'name' => __('Email enquiry', 'geodirectory'),
260
+		'desc' => '',
261
+		'id' => 'geodir_email_enquiry_subject',
262
+		'type' => 'text',
263
+		'css' => 'min-width:300px;',
264
+		'std' => __('Website Enquiry', 'geodirectory')
265
+	),
266
+	array(
267
+		'name' => '',
268
+		'desc' => '',
269
+		'id' => 'geodir_email_enquiry_content',
270
+		'css' => 'width:500px; height: 150px;',
271
+		'type' => 'textarea',
272
+		'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
273
+	),
274
+
275
+	array('type' => 'sectionend', 'id' => 'other_emails'),
276
+
277
+
278
+	array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'),
279
+
280
+	array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'),
281
+
282
+	array(
283
+		'name' => __('Post submitted success', 'geodirectory'),
284
+		'desc' => '',
285
+		'id' => 'geodir_post_added_success_msg_content',
286
+		'css' => 'width:500px; height: 150px;',
287
+		'type' => 'textarea',
288
+		'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory')
289
+	),
290
+
291
+
292
+	array('type' => 'sectionend', 'id' => 'messages'),
293 293
 
294 294
 )); // End Manage NOtifications settings
Please login to merge, or discard this patch.