Test Failed
Push — master ( ebc234...b84796 )
by Stiofan
09:19
created
geodirectory-functions/custom_fields_output_functions.php 2 patches
Indentation   +1525 added lines, -1525 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 = 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 = 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,84 +617,84 @@  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>' . $post->{$cf['htmlvar_name']} . '</div>';
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>' . $post->{$cf['htmlvar_name']} . '</div>';
692 692
 
693
-        endif;
693
+		endif;
694 694
 
695
-    }
695
+	}
696 696
 
697
-    return $html;
697
+	return $html;
698 698
 }
699 699
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
700 700
 
@@ -711,98 +711,98 @@  discard block
 block discarded – undo
711 711
  */
712 712
 function geodir_cf_radio($html,$location,$cf,$p=''){
713 713
 
714
-    // check we have the post value
715
-    if(is_int($p)){$post = geodir_get_post_info($p);}
716
-    else{ global $post;}
717
-
718
-    if(!is_array($cf) && $cf!=''){
719
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
720
-        if(!$cf){return NULL;}
721
-    }
722
-
723
-    $html_var = $cf['htmlvar_name'];
724
-
725
-    // Check if there is a location specific filter.
726
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
727
-        /**
728
-         * Filter the radio html by location.
729
-         *
730
-         * @param string $html The html to filter.
731
-         * @param array $cf The custom field array.
732
-         * @since 1.6.6
733
-         */
734
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
735
-    }
736
-
737
-    // Check if there is a custom field specific filter.
738
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
739
-        /**
740
-         * Filter the radio html by individual custom field.
741
-         *
742
-         * @param string $html The html to filter.
743
-         * @param string $location The location to output the html.
744
-         * @param array $cf The custom field array.
745
-         * @since 1.6.6
746
-         */
747
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
748
-    }
749
-
750
-    // Check if there is a custom field key specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
752
-        /**
753
-         * Filter the radio html by field type key.
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_key_{$cf['field_type_key']}",$html,$location,$cf);
761
-    }
762
-
763
-    // If not html then we run the standard output.
764
-    if(empty($html)){
765
-
766
-        $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
767
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
768
-
769
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
770
-                $html_val = __('No', 'geodirectory');
771
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
772
-                $html_val = __('Yes', 'geodirectory');
773
-            } else {
774
-                if (!empty($cf['option_values'])) {
775
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
776
-
777
-                    if (!empty($cf_option_values)) {
778
-                        foreach ($cf_option_values as $cf_option_value) {
779
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
780
-                                $html_val = $cf_option_value['label'];
781
-                            }
782
-                        }
783
-                    }
784
-                }
785
-            }
786
-
787
-            $field_icon = geodir_field_icon_proccess($cf);
788
-            if (strpos($field_icon, 'http') !== false) {
789
-                $field_icon_af = '';
790
-            } elseif ($field_icon == '') {
791
-                $field_icon_af = '';
792
-            } else {
793
-                $field_icon_af = $field_icon;
794
-                $field_icon = '';
795
-            }
796
-
797
-
798
-            $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;
799
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
800
-            $html .= '</span>' . $html_val . '</div>';
801
-        endif;
802
-
803
-    }
804
-
805
-    return $html;
714
+	// check we have the post value
715
+	if(is_int($p)){$post = geodir_get_post_info($p);}
716
+	else{ global $post;}
717
+
718
+	if(!is_array($cf) && $cf!=''){
719
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
720
+		if(!$cf){return NULL;}
721
+	}
722
+
723
+	$html_var = $cf['htmlvar_name'];
724
+
725
+	// Check if there is a location specific filter.
726
+	if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
727
+		/**
728
+		 * Filter the radio html by location.
729
+		 *
730
+		 * @param string $html The html to filter.
731
+		 * @param array $cf The custom field array.
732
+		 * @since 1.6.6
733
+		 */
734
+		$html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
735
+	}
736
+
737
+	// Check if there is a custom field specific filter.
738
+	if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
739
+		/**
740
+		 * Filter the radio html by individual custom field.
741
+		 *
742
+		 * @param string $html The html to filter.
743
+		 * @param string $location The location to output the html.
744
+		 * @param array $cf The custom field array.
745
+		 * @since 1.6.6
746
+		 */
747
+		$html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
748
+	}
749
+
750
+	// Check if there is a custom field key specific filter.
751
+	if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
752
+		/**
753
+		 * Filter the radio html by field type key.
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_key_{$cf['field_type_key']}",$html,$location,$cf);
761
+	}
762
+
763
+	// If not html then we run the standard output.
764
+	if(empty($html)){
765
+
766
+		$html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
767
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
768
+
769
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
770
+				$html_val = __('No', 'geodirectory');
771
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
772
+				$html_val = __('Yes', 'geodirectory');
773
+			} else {
774
+				if (!empty($cf['option_values'])) {
775
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
776
+
777
+					if (!empty($cf_option_values)) {
778
+						foreach ($cf_option_values as $cf_option_value) {
779
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
780
+								$html_val = $cf_option_value['label'];
781
+							}
782
+						}
783
+					}
784
+				}
785
+			}
786
+
787
+			$field_icon = geodir_field_icon_proccess($cf);
788
+			if (strpos($field_icon, 'http') !== false) {
789
+				$field_icon_af = '';
790
+			} elseif ($field_icon == '') {
791
+				$field_icon_af = '';
792
+			} else {
793
+				$field_icon_af = $field_icon;
794
+				$field_icon = '';
795
+			}
796
+
797
+
798
+			$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;
799
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
800
+			$html .= '</span>' . $html_val . '</div>';
801
+		endif;
802
+
803
+	}
804
+
805
+	return $html;
806 806
 }
807 807
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
808 808
 
@@ -819,92 +819,92 @@  discard block
 block discarded – undo
819 819
  */
820 820
 function geodir_cf_select($html,$location,$cf,$p=''){
821 821
 
822
-    // check we have the post value
823
-    if(is_int($p)){$post = geodir_get_post_info($p);}
824
-    else{ global $post;}
825
-
826
-    if(!is_array($cf) && $cf!=''){
827
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
828
-        if(!$cf){return NULL;}
829
-    }
830
-
831
-    $html_var = $cf['htmlvar_name'];
832
-
833
-    // Check if there is a location specific filter.
834
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
835
-        /**
836
-         * Filter the select html by location.
837
-         *
838
-         * @param string $html The html to filter.
839
-         * @param array $cf The custom field array.
840
-         * @since 1.6.6
841
-         */
842
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
843
-    }
844
-
845
-    // Check if there is a custom field specific filter.
846
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
847
-        /**
848
-         * Filter the select html by individual custom field.
849
-         *
850
-         * @param string $html The html to filter.
851
-         * @param string $location The location to output the html.
852
-         * @param array $cf The custom field array.
853
-         * @since 1.6.6
854
-         */
855
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
856
-    }
857
-
858
-    // Check if there is a custom field key specific filter.
859
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
860
-        /**
861
-         * Filter the select html by field type key.
862
-         *
863
-         * @param string $html The html to filter.
864
-         * @param string $location The location to output the html.
865
-         * @param array $cf The custom field array.
866
-         * @since 1.6.6
867
-         */
868
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
869
-    }
870
-
871
-    // If not html then we run the standard output.
872
-    if(empty($html)){
873
-
874
-        if ($post->{$cf['htmlvar_name']}):
875
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
876
-
877
-            if (!empty($cf['option_values'])) {
878
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
879
-
880
-                if (!empty($cf_option_values)) {
881
-                    foreach ($cf_option_values as $cf_option_value) {
882
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
883
-                            //$field_value = $cf_option_value['label']; // no longer needed here.
884
-                        }
885
-                    }
886
-                }
887
-            }
888
-
889
-            $field_icon = geodir_field_icon_proccess($cf);
890
-            if (strpos($field_icon, 'http') !== false) {
891
-                $field_icon_af = '';
892
-            } elseif ($field_icon == '') {
893
-                $field_icon_af = '';
894
-            } else {
895
-                $field_icon_af = $field_icon;
896
-                $field_icon = '';
897
-            }
898
-
899
-
900
-            $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;
901
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
902
-            $html .= '</span>' . $field_value . '</div>';
903
-        endif;
904
-
905
-    }
906
-
907
-    return $html;
822
+	// check we have the post value
823
+	if(is_int($p)){$post = geodir_get_post_info($p);}
824
+	else{ global $post;}
825
+
826
+	if(!is_array($cf) && $cf!=''){
827
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
828
+		if(!$cf){return NULL;}
829
+	}
830
+
831
+	$html_var = $cf['htmlvar_name'];
832
+
833
+	// Check if there is a location specific filter.
834
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
835
+		/**
836
+		 * Filter the select html by location.
837
+		 *
838
+		 * @param string $html The html to filter.
839
+		 * @param array $cf The custom field array.
840
+		 * @since 1.6.6
841
+		 */
842
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
843
+	}
844
+
845
+	// Check if there is a custom field specific filter.
846
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
847
+		/**
848
+		 * Filter the select html by individual custom field.
849
+		 *
850
+		 * @param string $html The html to filter.
851
+		 * @param string $location The location to output the html.
852
+		 * @param array $cf The custom field array.
853
+		 * @since 1.6.6
854
+		 */
855
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
856
+	}
857
+
858
+	// Check if there is a custom field key specific filter.
859
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
860
+		/**
861
+		 * Filter the select html by field type key.
862
+		 *
863
+		 * @param string $html The html to filter.
864
+		 * @param string $location The location to output the html.
865
+		 * @param array $cf The custom field array.
866
+		 * @since 1.6.6
867
+		 */
868
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
869
+	}
870
+
871
+	// If not html then we run the standard output.
872
+	if(empty($html)){
873
+
874
+		if ($post->{$cf['htmlvar_name']}):
875
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
876
+
877
+			if (!empty($cf['option_values'])) {
878
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
879
+
880
+				if (!empty($cf_option_values)) {
881
+					foreach ($cf_option_values as $cf_option_value) {
882
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
883
+							//$field_value = $cf_option_value['label']; // no longer needed here.
884
+						}
885
+					}
886
+				}
887
+			}
888
+
889
+			$field_icon = geodir_field_icon_proccess($cf);
890
+			if (strpos($field_icon, 'http') !== false) {
891
+				$field_icon_af = '';
892
+			} elseif ($field_icon == '') {
893
+				$field_icon_af = '';
894
+			} else {
895
+				$field_icon_af = $field_icon;
896
+				$field_icon = '';
897
+			}
898
+
899
+
900
+			$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;
901
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
902
+			$html .= '</span>' . $field_value . '</div>';
903
+		endif;
904
+
905
+	}
906
+
907
+	return $html;
908 908
 }
909 909
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
910 910
 
@@ -921,113 +921,113 @@  discard block
 block discarded – undo
921 921
  */
922 922
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
923 923
 
924
-    // check we have the post value
925
-    if(is_int($p)){$post = geodir_get_post_info($p);}
926
-    else{ global $post;}
927
-
928
-    if(!is_array($cf) && $cf!=''){
929
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
930
-        if(!$cf){return NULL;}
931
-    }
932
-
933
-    $html_var = $cf['htmlvar_name'];
934
-
935
-    // Check if there is a location specific filter.
936
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
937
-        /**
938
-         * Filter the multiselect html by location.
939
-         *
940
-         * @param string $html The html to filter.
941
-         * @param array $cf The custom field array.
942
-         * @since 1.6.6
943
-         */
944
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
945
-    }
946
-
947
-    // Check if there is a custom field specific filter.
948
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
949
-        /**
950
-         * Filter the multiselect html by individual custom field.
951
-         *
952
-         * @param string $html The html to filter.
953
-         * @param string $location The location to output the html.
954
-         * @param array $cf The custom field array.
955
-         * @since 1.6.6
956
-         */
957
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
958
-    }
959
-
960
-    // Check if there is a custom field key specific filter.
961
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
962
-        /**
963
-         * Filter the multiselect html by field type key.
964
-         *
965
-         * @param string $html The html to filter.
966
-         * @param string $location The location to output the html.
967
-         * @param array $cf The custom field array.
968
-         * @since 1.6.6
969
-         */
970
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
971
-    }
972
-
973
-    // If not html then we run the standard output.
974
-    if(empty($html)){
975
-
976
-
977
-        if (!empty($post->{$cf['htmlvar_name']})):
978
-
979
-            if (is_array($post->{$cf['htmlvar_name']})) {
980
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
981
-            }
982
-
983
-            $field_icon = geodir_field_icon_proccess($cf);
984
-            if (strpos($field_icon, 'http') !== false) {
985
-                $field_icon_af = '';
986
-            } elseif ($field_icon == '') {
987
-                $field_icon_af = '';
988
-            } else {
989
-                $field_icon_af = $field_icon;
990
-                $field_icon = '';
991
-            }
992
-
993
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
994
-
995
-            $option_values = array();
996
-            if (!empty($cf['option_values'])) {
997
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
998
-
999
-                if (!empty($cf_option_values)) {
1000
-                    foreach ($cf_option_values as $cf_option_value) {
1001
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1002
-                            $option_values[] = $cf_option_value['label'];
1003
-                        }
1004
-                    }
1005
-                }
1006
-            }
1007
-
1008
-
1009
-            $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;
1010
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1011
-            $html .= '</span>';
1012
-
1013
-            if (count($option_values) > 1) {
1014
-                $html .= '<ul>';
1015
-
1016
-                foreach ($option_values as $val) {
1017
-                    $html .= '<li>' . $val . '</li>';
1018
-                }
1019
-
1020
-                $html .= '</ul>';
1021
-            } else {
1022
-                $html .= $post->{$cf['htmlvar_name']};
1023
-            }
1024
-
1025
-            $html .= '</div>';
1026
-        endif;
1027
-
1028
-    }
1029
-
1030
-    return $html;
924
+	// check we have the post value
925
+	if(is_int($p)){$post = geodir_get_post_info($p);}
926
+	else{ global $post;}
927
+
928
+	if(!is_array($cf) && $cf!=''){
929
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
930
+		if(!$cf){return NULL;}
931
+	}
932
+
933
+	$html_var = $cf['htmlvar_name'];
934
+
935
+	// Check if there is a location specific filter.
936
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
937
+		/**
938
+		 * Filter the multiselect html by location.
939
+		 *
940
+		 * @param string $html The html to filter.
941
+		 * @param array $cf The custom field array.
942
+		 * @since 1.6.6
943
+		 */
944
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
945
+	}
946
+
947
+	// Check if there is a custom field specific filter.
948
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
949
+		/**
950
+		 * Filter the multiselect html by individual custom field.
951
+		 *
952
+		 * @param string $html The html to filter.
953
+		 * @param string $location The location to output the html.
954
+		 * @param array $cf The custom field array.
955
+		 * @since 1.6.6
956
+		 */
957
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
958
+	}
959
+
960
+	// Check if there is a custom field key specific filter.
961
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
962
+		/**
963
+		 * Filter the multiselect html by field type key.
964
+		 *
965
+		 * @param string $html The html to filter.
966
+		 * @param string $location The location to output the html.
967
+		 * @param array $cf The custom field array.
968
+		 * @since 1.6.6
969
+		 */
970
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
971
+	}
972
+
973
+	// If not html then we run the standard output.
974
+	if(empty($html)){
975
+
976
+
977
+		if (!empty($post->{$cf['htmlvar_name']})):
978
+
979
+			if (is_array($post->{$cf['htmlvar_name']})) {
980
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
981
+			}
982
+
983
+			$field_icon = geodir_field_icon_proccess($cf);
984
+			if (strpos($field_icon, 'http') !== false) {
985
+				$field_icon_af = '';
986
+			} elseif ($field_icon == '') {
987
+				$field_icon_af = '';
988
+			} else {
989
+				$field_icon_af = $field_icon;
990
+				$field_icon = '';
991
+			}
992
+
993
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
994
+
995
+			$option_values = array();
996
+			if (!empty($cf['option_values'])) {
997
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
998
+
999
+				if (!empty($cf_option_values)) {
1000
+					foreach ($cf_option_values as $cf_option_value) {
1001
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1002
+							$option_values[] = $cf_option_value['label'];
1003
+						}
1004
+					}
1005
+				}
1006
+			}
1007
+
1008
+
1009
+			$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;
1010
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1011
+			$html .= '</span>';
1012
+
1013
+			if (count($option_values) > 1) {
1014
+				$html .= '<ul>';
1015
+
1016
+				foreach ($option_values as $val) {
1017
+					$html .= '<li>' . $val . '</li>';
1018
+				}
1019
+
1020
+				$html .= '</ul>';
1021
+			} else {
1022
+				$html .= $post->{$cf['htmlvar_name']};
1023
+			}
1024
+
1025
+			$html .= '</div>';
1026
+		endif;
1027
+
1028
+	}
1029
+
1030
+	return $html;
1031 1031
 }
1032 1032
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1033 1033
 
@@ -1044,152 +1044,152 @@  discard block
 block discarded – undo
1044 1044
  */
1045 1045
 function geodir_cf_email($html,$location,$cf,$p=''){
1046 1046
 
1047
-    // check we have the post value
1048
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1049
-    else{ global $post;}
1050
-
1051
-    if(!is_array($cf) && $cf!=''){
1052
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1053
-        if(!$cf){return NULL;}
1054
-    }
1055
-
1056
-    $html_var = $cf['htmlvar_name'];
1057
-
1058
-    // Check if there is a location specific filter.
1059
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1060
-        /**
1061
-         * Filter the email html by location.
1062
-         *
1063
-         * @param string $html The html to filter.
1064
-         * @param array $cf The custom field array.
1065
-         * @since 1.6.6
1066
-         */
1067
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1068
-    }
1069
-
1070
-    // Check if there is a custom field specific filter.
1071
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1072
-        /**
1073
-         * Filter the email html by individual custom field.
1074
-         *
1075
-         * @param string $html The html to filter.
1076
-         * @param string $location The location to output the html.
1077
-         * @param array $cf The custom field array.
1078
-         * @since 1.6.6
1079
-         */
1080
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1081
-    }
1082
-
1083
-    // Check if there is a custom field key specific filter.
1084
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1085
-        /**
1086
-         * Filter the email html by field type key.
1087
-         *
1088
-         * @param string $html The html to filter.
1089
-         * @param string $location The location to output the html.
1090
-         * @param array $cf The custom field array.
1091
-         * @since 1.6.6
1092
-         */
1093
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1094
-    }
1095
-
1096
-    // If not html then we run the standard output.
1097
-    if(empty($html)){
1098
-
1099
-        global $preview;
1100
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1101
-            return ''; // Remove Send Enquiry | Send To Friend from listings page
1102
-        }
1103
-
1104
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1105
-
1106
-        if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1107
-            $send_to_friend = true;
1108
-            $b_send_inquiry = '';
1109
-            $b_sendtofriend = '';
1110
-
1111
-            $html = '';
1112
-            if (!$preview) {
1113
-                $b_send_inquiry = 'b_send_inquiry';
1114
-                $b_sendtofriend = 'b_sendtofriend';
1115
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1116
-            }
1117
-
1118
-            $field_icon = geodir_field_icon_proccess($cf);
1119
-            if (strpos($field_icon, 'http') !== false) {
1120
-                $field_icon_af = '';
1121
-            } elseif ($field_icon == '') {
1122
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1123
-            } else {
1124
-                $field_icon_af = $field_icon;
1125
-                $field_icon = '';
1126
-            }
1127
-
1128
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1129
-            $seperator = '';
1130
-            if ($post->{$cf['htmlvar_name']}) {
1131
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1132
-                $seperator = ' | ';
1133
-            }
1134
-
1135
-            if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1136
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1137
-            }
1138
-
1139
-            $html .= '</span></div>';
1140
-
1141
-
1142
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1143
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1144
-            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1145
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1146
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1147
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1148
-            }
1149
-
1150
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1151
-
1152
-        } else {
1153
-
1154
-            if ($post->{$cf['htmlvar_name']}) {
1155
-
1156
-                $field_icon = geodir_field_icon_proccess($cf);
1157
-                if (strpos($field_icon, 'http') !== false) {
1158
-                    $field_icon_af = '';
1159
-                } elseif ($field_icon == '') {
1160
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1161
-                } else {
1162
-                    $field_icon_af = $field_icon;
1163
-                    $field_icon = '';
1164
-                }
1165
-
1166
-
1167
-                $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;
1168
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1169
-                $html .= '</span><span class="geodir-email-address-output">';
1170
-                $email = $post->{$cf['htmlvar_name']} ;
1171
-                if($e_split = explode('@',$email)){
1172
-                    /**
1173
-                     * Filter email custom field name output.
1174
-                     *
1175
-                     * @since 1.5.3
1176
-                     *
1177
-                     * @param string $email The email string being output.
1178
-                     * @param array $cf Custom field variables array.
1179
-                     */
1180
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1181
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1182
-                }else{
1183
-                    $html .=  $email;
1184
-                }
1185
-                $html .= '</span></div>';
1186
-            }
1187
-
1188
-        }
1189
-
1190
-    }
1191
-
1192
-    return $html;
1047
+	// check we have the post value
1048
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1049
+	else{ global $post;}
1050
+
1051
+	if(!is_array($cf) && $cf!=''){
1052
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1053
+		if(!$cf){return NULL;}
1054
+	}
1055
+
1056
+	$html_var = $cf['htmlvar_name'];
1057
+
1058
+	// Check if there is a location specific filter.
1059
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1060
+		/**
1061
+		 * Filter the email html by location.
1062
+		 *
1063
+		 * @param string $html The html to filter.
1064
+		 * @param array $cf The custom field array.
1065
+		 * @since 1.6.6
1066
+		 */
1067
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1068
+	}
1069
+
1070
+	// Check if there is a custom field specific filter.
1071
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1072
+		/**
1073
+		 * Filter the email html by individual custom field.
1074
+		 *
1075
+		 * @param string $html The html to filter.
1076
+		 * @param string $location The location to output the html.
1077
+		 * @param array $cf The custom field array.
1078
+		 * @since 1.6.6
1079
+		 */
1080
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1081
+	}
1082
+
1083
+	// Check if there is a custom field key specific filter.
1084
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1085
+		/**
1086
+		 * Filter the email html by field type key.
1087
+		 *
1088
+		 * @param string $html The html to filter.
1089
+		 * @param string $location The location to output the html.
1090
+		 * @param array $cf The custom field array.
1091
+		 * @since 1.6.6
1092
+		 */
1093
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1094
+	}
1095
+
1096
+	// If not html then we run the standard output.
1097
+	if(empty($html)){
1098
+
1099
+		global $preview;
1100
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1101
+			return ''; // Remove Send Enquiry | Send To Friend from listings page
1102
+		}
1103
+
1104
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1105
+
1106
+		if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1107
+			$send_to_friend = true;
1108
+			$b_send_inquiry = '';
1109
+			$b_sendtofriend = '';
1110
+
1111
+			$html = '';
1112
+			if (!$preview) {
1113
+				$b_send_inquiry = 'b_send_inquiry';
1114
+				$b_sendtofriend = 'b_sendtofriend';
1115
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1116
+			}
1117
+
1118
+			$field_icon = geodir_field_icon_proccess($cf);
1119
+			if (strpos($field_icon, 'http') !== false) {
1120
+				$field_icon_af = '';
1121
+			} elseif ($field_icon == '') {
1122
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1123
+			} else {
1124
+				$field_icon_af = $field_icon;
1125
+				$field_icon = '';
1126
+			}
1127
+
1128
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1129
+			$seperator = '';
1130
+			if ($post->{$cf['htmlvar_name']}) {
1131
+				$html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1132
+				$seperator = ' | ';
1133
+			}
1134
+
1135
+			if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1136
+				$html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1137
+			}
1138
+
1139
+			$html .= '</span></div>';
1140
+
1141
+
1142
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1143
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1144
+			} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1145
+				$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1146
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1147
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1148
+			}
1149
+
1150
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1151
+
1152
+		} else {
1153
+
1154
+			if ($post->{$cf['htmlvar_name']}) {
1155
+
1156
+				$field_icon = geodir_field_icon_proccess($cf);
1157
+				if (strpos($field_icon, 'http') !== false) {
1158
+					$field_icon_af = '';
1159
+				} elseif ($field_icon == '') {
1160
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1161
+				} else {
1162
+					$field_icon_af = $field_icon;
1163
+					$field_icon = '';
1164
+				}
1165
+
1166
+
1167
+				$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;
1168
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1169
+				$html .= '</span><span class="geodir-email-address-output">';
1170
+				$email = $post->{$cf['htmlvar_name']} ;
1171
+				if($e_split = explode('@',$email)){
1172
+					/**
1173
+					 * Filter email custom field name output.
1174
+					 *
1175
+					 * @since 1.5.3
1176
+					 *
1177
+					 * @param string $email The email string being output.
1178
+					 * @param array $cf Custom field variables array.
1179
+					 */
1180
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1181
+					$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1182
+				}else{
1183
+					$html .=  $email;
1184
+				}
1185
+				$html .= '</span></div>';
1186
+			}
1187
+
1188
+		}
1189
+
1190
+	}
1191
+
1192
+	return $html;
1193 1193
 }
1194 1194
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1195 1195
 
@@ -1206,130 +1206,130 @@  discard block
 block discarded – undo
1206 1206
  */
1207 1207
 function geodir_cf_file($html,$location,$cf,$p=''){
1208 1208
 
1209
-    // check we have the post value
1210
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1211
-    else{ global $post;}
1212
-
1213
-    if(!is_array($cf) && $cf!=''){
1214
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1215
-        if(!$cf){return NULL;}
1216
-    }
1217
-
1218
-    $html_var = $cf['htmlvar_name'];
1219
-
1220
-    // Check if there is a location specific filter.
1221
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1222
-        /**
1223
-         * Filter the file html by location.
1224
-         *
1225
-         * @param string $html The html to filter.
1226
-         * @param array $cf The custom field array.
1227
-         * @since 1.6.6
1228
-         */
1229
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1230
-    }
1231
-
1232
-    // Check if there is a custom field specific filter.
1233
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1234
-        /**
1235
-         * Filter the file html by individual custom field.
1236
-         *
1237
-         * @param string $html The html to filter.
1238
-         * @param string $location The location to output the html.
1239
-         * @param array $cf The custom field array.
1240
-         * @since 1.6.6
1241
-         */
1242
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1243
-    }
1244
-
1245
-    // Check if there is a custom field key specific filter.
1246
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1247
-        /**
1248
-         * Filter the file html by field type key.
1249
-         *
1250
-         * @param string $html The html to filter.
1251
-         * @param string $location The location to output the html.
1252
-         * @param array $cf The custom field array.
1253
-         * @since 1.6.6
1254
-         */
1255
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1256
-    }
1257
-
1258
-    // If not html then we run the standard output.
1259
-    if(empty($html)){
1260
-
1261
-        if (!empty($post->{$cf['htmlvar_name']})):
1262
-
1263
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1264
-            if (!empty($files)):
1265
-
1266
-                $extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1267
-                $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'] : '';
1268
-
1269
-                $file_paths = '';
1270
-                foreach ($files as $file) {
1271
-                    if (!empty($file)) {
1272
-
1273
-                        // $filetype = wp_check_filetype($file);
1274
-
1275
-                        $image_name_arr = explode('/', $file);
1276
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1277
-                        $filename = end($image_name_arr);
1278
-                        $img_name_arr = explode('.', $filename);
1279
-
1280
-                        $arr_file_type = wp_check_filetype($filename);
1281
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1282
-                            continue;
1283
-                        }
1284
-
1285
-                        $uploaded_file_type = $arr_file_type['type'];
1286
-                        $uploaded_file_ext = $arr_file_type['ext'];
1287
-
1288
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1289
-                            continue; // Invalid file type.
1290
-                        }
1291
-
1292
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1293
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1294
-
1295
-                        // If the uploaded file is image
1296
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1297
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1298
-                            $file_paths .= '<a href="'.$file.'">';
1299
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1300
-                            $file_paths .= '</a>';
1301
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1302
-                            $file_paths .= '</div>';
1303
-                        } else {
1304
-                            $ext_path = '_' . $html_var . '_';
1305
-                            $filename = explode($ext_path, $filename);
1306
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1307
-                        }
1308
-                    }
1309
-                }
1310
-
1311
-                $field_icon = geodir_field_icon_proccess($cf);
1312
-                if (strpos($field_icon, 'http') !== false) {
1313
-                    $field_icon_af = '';
1314
-                } elseif ($field_icon == '') {
1315
-                    $field_icon_af = '';
1316
-                } else {
1317
-                    $field_icon_af = $field_icon;
1318
-                    $field_icon = '';
1319
-                }
1320
-
1321
-                $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;
1322
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1323
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1324
-                $html .= '</span>';
1325
-                $html .= $file_paths . '</div></div>';
1326
-
1327
-            endif;
1328
-        endif;
1329
-
1330
-    }
1331
-
1332
-    return $html;
1209
+	// check we have the post value
1210
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1211
+	else{ global $post;}
1212
+
1213
+	if(!is_array($cf) && $cf!=''){
1214
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1215
+		if(!$cf){return NULL;}
1216
+	}
1217
+
1218
+	$html_var = $cf['htmlvar_name'];
1219
+
1220
+	// Check if there is a location specific filter.
1221
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1222
+		/**
1223
+		 * Filter the file html by location.
1224
+		 *
1225
+		 * @param string $html The html to filter.
1226
+		 * @param array $cf The custom field array.
1227
+		 * @since 1.6.6
1228
+		 */
1229
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1230
+	}
1231
+
1232
+	// Check if there is a custom field specific filter.
1233
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1234
+		/**
1235
+		 * Filter the file html by individual custom field.
1236
+		 *
1237
+		 * @param string $html The html to filter.
1238
+		 * @param string $location The location to output the html.
1239
+		 * @param array $cf The custom field array.
1240
+		 * @since 1.6.6
1241
+		 */
1242
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1243
+	}
1244
+
1245
+	// Check if there is a custom field key specific filter.
1246
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1247
+		/**
1248
+		 * Filter the file html by field type key.
1249
+		 *
1250
+		 * @param string $html The html to filter.
1251
+		 * @param string $location The location to output the html.
1252
+		 * @param array $cf The custom field array.
1253
+		 * @since 1.6.6
1254
+		 */
1255
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1256
+	}
1257
+
1258
+	// If not html then we run the standard output.
1259
+	if(empty($html)){
1260
+
1261
+		if (!empty($post->{$cf['htmlvar_name']})):
1262
+
1263
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1264
+			if (!empty($files)):
1265
+
1266
+				$extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1267
+				$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'] : '';
1268
+
1269
+				$file_paths = '';
1270
+				foreach ($files as $file) {
1271
+					if (!empty($file)) {
1272
+
1273
+						// $filetype = wp_check_filetype($file);
1274
+
1275
+						$image_name_arr = explode('/', $file);
1276
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1277
+						$filename = end($image_name_arr);
1278
+						$img_name_arr = explode('.', $filename);
1279
+
1280
+						$arr_file_type = wp_check_filetype($filename);
1281
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1282
+							continue;
1283
+						}
1284
+
1285
+						$uploaded_file_type = $arr_file_type['type'];
1286
+						$uploaded_file_ext = $arr_file_type['ext'];
1287
+
1288
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1289
+							continue; // Invalid file type.
1290
+						}
1291
+
1292
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1293
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1294
+
1295
+						// If the uploaded file is image
1296
+						if (in_array($uploaded_file_type, $image_file_types)) {
1297
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1298
+							$file_paths .= '<a href="'.$file.'">';
1299
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1300
+							$file_paths .= '</a>';
1301
+							//$file_paths .= '<img src="'.$file.'"  />';	
1302
+							$file_paths .= '</div>';
1303
+						} else {
1304
+							$ext_path = '_' . $html_var . '_';
1305
+							$filename = explode($ext_path, $filename);
1306
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1307
+						}
1308
+					}
1309
+				}
1310
+
1311
+				$field_icon = geodir_field_icon_proccess($cf);
1312
+				if (strpos($field_icon, 'http') !== false) {
1313
+					$field_icon_af = '';
1314
+				} elseif ($field_icon == '') {
1315
+					$field_icon_af = '';
1316
+				} else {
1317
+					$field_icon_af = $field_icon;
1318
+					$field_icon = '';
1319
+				}
1320
+
1321
+				$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;
1322
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1323
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1324
+				$html .= '</span>';
1325
+				$html .= $file_paths . '</div></div>';
1326
+
1327
+			endif;
1328
+		endif;
1329
+
1330
+	}
1331
+
1332
+	return $html;
1333 1333
 }
1334 1334
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1335 1335
 
@@ -1347,80 +1347,80 @@  discard block
 block discarded – undo
1347 1347
  */
1348 1348
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1349 1349
 
1350
-    // check we have the post value
1351
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1352
-    else{ global $post;}
1353
-
1354
-    if(!is_array($cf) && $cf!=''){
1355
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1356
-        if(!$cf){return NULL;}
1357
-    }
1358
-
1359
-    $html_var = $cf['htmlvar_name'];
1360
-
1361
-    // Check if there is a location specific filter.
1362
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1363
-        /**
1364
-         * Filter the textarea html by location.
1365
-         *
1366
-         * @param string $html The html to filter.
1367
-         * @param array $cf The custom field array.
1368
-         * @since 1.6.6
1369
-         */
1370
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1371
-    }
1372
-
1373
-    // Check if there is a custom field specific filter.
1374
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1375
-        /**
1376
-         * Filter the textarea html by individual custom field.
1377
-         *
1378
-         * @param string $html The html to filter.
1379
-         * @param string $location The location to output the html.
1380
-         * @param array $cf The custom field array.
1381
-         * @since 1.6.6
1382
-         */
1383
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1384
-    }
1385
-
1386
-    // Check if there is a custom field key specific filter.
1387
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1388
-        /**
1389
-         * Filter the textarea html by field type key.
1390
-         *
1391
-         * @param string $html The html to filter.
1392
-         * @param string $location The location to output the html.
1393
-         * @param array $cf The custom field array.
1394
-         * @since 1.6.6
1395
-         */
1396
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1397
-    }
1398
-
1399
-    // If not html then we run the standard output.
1400
-    if(empty($html)){
1401
-
1402
-        if (!empty($post->{$cf['htmlvar_name']})) {
1403
-
1404
-            $field_icon = geodir_field_icon_proccess($cf);
1405
-            if (strpos($field_icon, 'http') !== false) {
1406
-                $field_icon_af = '';
1407
-            } elseif ($field_icon == '') {
1408
-                $field_icon_af = '';
1409
-            } else {
1410
-                $field_icon_af = $field_icon;
1411
-                $field_icon = '';
1412
-            }
1413
-
1414
-
1415
-            $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;
1416
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1417
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1418
-
1419
-        }
1420
-
1421
-    }
1422
-
1423
-    return $html;
1350
+	// check we have the post value
1351
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1352
+	else{ global $post;}
1353
+
1354
+	if(!is_array($cf) && $cf!=''){
1355
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1356
+		if(!$cf){return NULL;}
1357
+	}
1358
+
1359
+	$html_var = $cf['htmlvar_name'];
1360
+
1361
+	// Check if there is a location specific filter.
1362
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1363
+		/**
1364
+		 * Filter the textarea html by location.
1365
+		 *
1366
+		 * @param string $html The html to filter.
1367
+		 * @param array $cf The custom field array.
1368
+		 * @since 1.6.6
1369
+		 */
1370
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1371
+	}
1372
+
1373
+	// Check if there is a custom field specific filter.
1374
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1375
+		/**
1376
+		 * Filter the textarea html by individual custom field.
1377
+		 *
1378
+		 * @param string $html The html to filter.
1379
+		 * @param string $location The location to output the html.
1380
+		 * @param array $cf The custom field array.
1381
+		 * @since 1.6.6
1382
+		 */
1383
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1384
+	}
1385
+
1386
+	// Check if there is a custom field key specific filter.
1387
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1388
+		/**
1389
+		 * Filter the textarea html by field type key.
1390
+		 *
1391
+		 * @param string $html The html to filter.
1392
+		 * @param string $location The location to output the html.
1393
+		 * @param array $cf The custom field array.
1394
+		 * @since 1.6.6
1395
+		 */
1396
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1397
+	}
1398
+
1399
+	// If not html then we run the standard output.
1400
+	if(empty($html)){
1401
+
1402
+		if (!empty($post->{$cf['htmlvar_name']})) {
1403
+
1404
+			$field_icon = geodir_field_icon_proccess($cf);
1405
+			if (strpos($field_icon, 'http') !== false) {
1406
+				$field_icon_af = '';
1407
+			} elseif ($field_icon == '') {
1408
+				$field_icon_af = '';
1409
+			} else {
1410
+				$field_icon_af = $field_icon;
1411
+				$field_icon = '';
1412
+			}
1413
+
1414
+
1415
+			$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;
1416
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1417
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1418
+
1419
+		}
1420
+
1421
+	}
1422
+
1423
+	return $html;
1424 1424
 }
1425 1425
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1426 1426
 
@@ -1438,79 +1438,79 @@  discard block
 block discarded – undo
1438 1438
  */
1439 1439
 function geodir_cf_html($html,$location,$cf,$p=''){
1440 1440
 
1441
-    // check we have the post value
1442
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1443
-    else{ global $post;}
1444
-
1445
-    if(!is_array($cf) && $cf!=''){
1446
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1447
-        if(!$cf){return NULL;}
1448
-    }
1449
-
1450
-    $html_var = $cf['htmlvar_name'];
1451
-
1452
-    // Check if there is a location specific filter.
1453
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1454
-        /**
1455
-         * Filter the html html by location.
1456
-         *
1457
-         * @param string $html The html to filter.
1458
-         * @param array $cf The custom field array.
1459
-         * @since 1.6.6
1460
-         */
1461
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1462
-    }
1463
-
1464
-    // Check if there is a custom field specific filter.
1465
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1466
-        /**
1467
-         * Filter the html html by individual custom field.
1468
-         *
1469
-         * @param string $html The html to filter.
1470
-         * @param string $location The location to output the html.
1471
-         * @param array $cf The custom field array.
1472
-         * @since 1.6.6
1473
-         */
1474
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1475
-    }
1476
-
1477
-    // Check if there is a custom field key specific filter.
1478
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1479
-        /**
1480
-         * Filter the html html by field type key.
1481
-         *
1482
-         * @param string $html The html to filter.
1483
-         * @param string $location The location to output the html.
1484
-         * @param array $cf The custom field array.
1485
-         * @since 1.6.6
1486
-         */
1487
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1488
-    }
1489
-
1490
-    // If not html then we run the standard output.
1491
-    if(empty($html)){
1492
-
1493
-        if (!empty($post->{$cf['htmlvar_name']})) {
1494
-
1495
-            $field_icon = geodir_field_icon_proccess($cf);
1496
-            if (strpos($field_icon, 'http') !== false) {
1497
-                $field_icon_af = '';
1498
-            } elseif ($field_icon == '') {
1499
-                $field_icon_af = '';
1500
-            } else {
1501
-                $field_icon_af = $field_icon;
1502
-                $field_icon = '';
1503
-            }
1504
-
1505
-            $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;
1506
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1507
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1508
-
1509
-        }
1510
-
1511
-    }
1512
-
1513
-    return $html;
1441
+	// check we have the post value
1442
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1443
+	else{ global $post;}
1444
+
1445
+	if(!is_array($cf) && $cf!=''){
1446
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1447
+		if(!$cf){return NULL;}
1448
+	}
1449
+
1450
+	$html_var = $cf['htmlvar_name'];
1451
+
1452
+	// Check if there is a location specific filter.
1453
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1454
+		/**
1455
+		 * Filter the html html by location.
1456
+		 *
1457
+		 * @param string $html The html to filter.
1458
+		 * @param array $cf The custom field array.
1459
+		 * @since 1.6.6
1460
+		 */
1461
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1462
+	}
1463
+
1464
+	// Check if there is a custom field specific filter.
1465
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1466
+		/**
1467
+		 * Filter the html html by individual custom field.
1468
+		 *
1469
+		 * @param string $html The html to filter.
1470
+		 * @param string $location The location to output the html.
1471
+		 * @param array $cf The custom field array.
1472
+		 * @since 1.6.6
1473
+		 */
1474
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1475
+	}
1476
+
1477
+	// Check if there is a custom field key specific filter.
1478
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1479
+		/**
1480
+		 * Filter the html html by field type key.
1481
+		 *
1482
+		 * @param string $html The html to filter.
1483
+		 * @param string $location The location to output the html.
1484
+		 * @param array $cf The custom field array.
1485
+		 * @since 1.6.6
1486
+		 */
1487
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1488
+	}
1489
+
1490
+	// If not html then we run the standard output.
1491
+	if(empty($html)){
1492
+
1493
+		if (!empty($post->{$cf['htmlvar_name']})) {
1494
+
1495
+			$field_icon = geodir_field_icon_proccess($cf);
1496
+			if (strpos($field_icon, 'http') !== false) {
1497
+				$field_icon_af = '';
1498
+			} elseif ($field_icon == '') {
1499
+				$field_icon_af = '';
1500
+			} else {
1501
+				$field_icon_af = $field_icon;
1502
+				$field_icon = '';
1503
+			}
1504
+
1505
+			$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;
1506
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1507
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1508
+
1509
+		}
1510
+
1511
+	}
1512
+
1513
+	return $html;
1514 1514
 }
1515 1515
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1516 1516
 
@@ -1528,113 +1528,113 @@  discard block
 block discarded – undo
1528 1528
  */
1529 1529
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1530 1530
 
1531
-    // check we have the post value
1532
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1533
-    else{ global $post;}
1534
-
1535
-    if(!is_array($cf) && $cf!=''){
1536
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1537
-        if(!$cf){return NULL;}
1538
-    }
1539
-
1540
-    $html_var = $cf['htmlvar_name'];
1541
-
1542
-    // Check if there is a location specific filter.
1543
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1544
-        /**
1545
-         * Filter the taxonomy html by location.
1546
-         *
1547
-         * @param string $html The html to filter.
1548
-         * @param array $cf The custom field array.
1549
-         * @since 1.6.6
1550
-         */
1551
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1552
-    }
1553
-
1554
-    // Check if there is a custom field specific filter.
1555
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1556
-        /**
1557
-         * Filter the taxonomy html by individual custom field.
1558
-         *
1559
-         * @param string $html The html to filter.
1560
-         * @param string $location The location to output the html.
1561
-         * @param array $cf The custom field array.
1562
-         * @since 1.6.6
1563
-         */
1564
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1565
-    }
1566
-
1567
-    // Check if there is a custom field key specific filter.
1568
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1569
-        /**
1570
-         * Filter the taxonomy html by field type key.
1571
-         *
1572
-         * @param string $html The html to filter.
1573
-         * @param string $location The location to output the html.
1574
-         * @param array $cf The custom field array.
1575
-         * @since 1.6.6
1576
-         */
1577
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1578
-    }
1579
-
1580
-    // If not html then we run the standard output.
1581
-    if(empty($html)){
1582
-
1583
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1584
-            $post_taxonomy = $post->post_type . 'category';
1585
-            $field_value = $post->{$html_var};
1586
-            $links = array();
1587
-            $terms = array();
1588
-            $termsOrdered = array();
1589
-            if (!is_array($field_value)) {
1590
-                $field_value = explode(",", trim($field_value, ","));
1591
-            }
1592
-
1593
-            $field_value = array_unique($field_value);
1594
-
1595
-            if (!empty($field_value)) {
1596
-                foreach ($field_value as $term) {
1597
-                    $term = trim($term);
1598
-
1599
-                    if ($term != '') {
1600
-                        $term = get_term_by('id', $term, $html_var);
1601
-                        if (is_object($term)) {
1602
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1603
-                            $terms[] = $term;
1604
-                        }
1605
-                    }
1606
-                }
1607
-                if (!empty($links)) {
1608
-                    // order alphabetically
1609
-                    asort($links);
1610
-                    foreach (array_keys($links) as $key) {
1611
-                        $termsOrdered[$key] = $terms[$key];
1612
-                    }
1613
-                    $terms = $termsOrdered;
1614
-                }
1615
-            }
1616
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1617
-
1618
-            if ($html_value != '') {
1619
-                $field_icon = geodir_field_icon_proccess($cf);
1620
-                if (strpos($field_icon, 'http') !== false) {
1621
-                    $field_icon_af = '';
1622
-                } else if ($field_icon == '') {
1623
-                    $field_icon_af = '';
1624
-                } else {
1625
-                    $field_icon_af = $field_icon;
1626
-                    $field_icon = '';
1627
-                }
1628
-
1629
-                $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;
1630
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1631
-                $html .= '</span> ' . $html_value . '</div>';
1632
-            }
1633
-        }
1634
-
1635
-    }
1636
-
1637
-    return $html;
1531
+	// check we have the post value
1532
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1533
+	else{ global $post;}
1534
+
1535
+	if(!is_array($cf) && $cf!=''){
1536
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1537
+		if(!$cf){return NULL;}
1538
+	}
1539
+
1540
+	$html_var = $cf['htmlvar_name'];
1541
+
1542
+	// Check if there is a location specific filter.
1543
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1544
+		/**
1545
+		 * Filter the taxonomy html by location.
1546
+		 *
1547
+		 * @param string $html The html to filter.
1548
+		 * @param array $cf The custom field array.
1549
+		 * @since 1.6.6
1550
+		 */
1551
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1552
+	}
1553
+
1554
+	// Check if there is a custom field specific filter.
1555
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1556
+		/**
1557
+		 * Filter the taxonomy html by individual custom field.
1558
+		 *
1559
+		 * @param string $html The html to filter.
1560
+		 * @param string $location The location to output the html.
1561
+		 * @param array $cf The custom field array.
1562
+		 * @since 1.6.6
1563
+		 */
1564
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1565
+	}
1566
+
1567
+	// Check if there is a custom field key specific filter.
1568
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1569
+		/**
1570
+		 * Filter the taxonomy html by field type key.
1571
+		 *
1572
+		 * @param string $html The html to filter.
1573
+		 * @param string $location The location to output the html.
1574
+		 * @param array $cf The custom field array.
1575
+		 * @since 1.6.6
1576
+		 */
1577
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1578
+	}
1579
+
1580
+	// If not html then we run the standard output.
1581
+	if(empty($html)){
1582
+
1583
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1584
+			$post_taxonomy = $post->post_type . 'category';
1585
+			$field_value = $post->{$html_var};
1586
+			$links = array();
1587
+			$terms = array();
1588
+			$termsOrdered = array();
1589
+			if (!is_array($field_value)) {
1590
+				$field_value = explode(",", trim($field_value, ","));
1591
+			}
1592
+
1593
+			$field_value = array_unique($field_value);
1594
+
1595
+			if (!empty($field_value)) {
1596
+				foreach ($field_value as $term) {
1597
+					$term = trim($term);
1598
+
1599
+					if ($term != '') {
1600
+						$term = get_term_by('id', $term, $html_var);
1601
+						if (is_object($term)) {
1602
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1603
+							$terms[] = $term;
1604
+						}
1605
+					}
1606
+				}
1607
+				if (!empty($links)) {
1608
+					// order alphabetically
1609
+					asort($links);
1610
+					foreach (array_keys($links) as $key) {
1611
+						$termsOrdered[$key] = $terms[$key];
1612
+					}
1613
+					$terms = $termsOrdered;
1614
+				}
1615
+			}
1616
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1617
+
1618
+			if ($html_value != '') {
1619
+				$field_icon = geodir_field_icon_proccess($cf);
1620
+				if (strpos($field_icon, 'http') !== false) {
1621
+					$field_icon_af = '';
1622
+				} else if ($field_icon == '') {
1623
+					$field_icon_af = '';
1624
+				} else {
1625
+					$field_icon_af = $field_icon;
1626
+					$field_icon = '';
1627
+				}
1628
+
1629
+				$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;
1630
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1631
+				$html .= '</span> ' . $html_value . '</div>';
1632
+			}
1633
+		}
1634
+
1635
+	}
1636
+
1637
+	return $html;
1638 1638
 }
1639 1639
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1640 1640
 
@@ -1651,162 +1651,162 @@  discard block
 block discarded – undo
1651 1651
  */
1652 1652
 function geodir_cf_address($html,$location,$cf,$p=''){
1653 1653
 
1654
-    // check we have the post value
1655
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1656
-    else{ global $post;}
1657
-
1658
-    if(!is_array($cf) && $cf!=''){
1659
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1660
-        if(!$cf){return NULL;}
1661
-    }
1662
-
1663
-    $html_var = $cf['htmlvar_name'];
1664
-
1665
-    // Check if there is a location specific filter.
1666
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1667
-        /**
1668
-         * Filter the address html by location.
1669
-         *
1670
-         * @param string $html The html to filter.
1671
-         * @param array $cf The custom field array.
1672
-         * @since 1.6.6
1673
-         */
1674
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1675
-    }
1676
-
1677
-    // Check if there is a custom field specific filter.
1678
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1679
-        /**
1680
-         * Filter the address html by individual custom field.
1681
-         *
1682
-         * @param string $html The html to filter.
1683
-         * @param string $location The location to output the html.
1684
-         * @param array $cf The custom field array.
1685
-         * @since 1.6.6
1686
-         */
1687
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1688
-    }
1689
-
1690
-    // Check if there is a custom field key specific filter.
1691
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1692
-        /**
1693
-         * Filter the address html by field type key.
1694
-         *
1695
-         * @param string $html The html to filter.
1696
-         * @param string $location The location to output the html.
1697
-         * @param array $cf The custom field array.
1698
-         * @since 1.6.6
1699
-         */
1700
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1701
-    }
1702
-
1703
-    // If not html then we run the standard output.
1704
-    if(empty($html)){
1705
-
1706
-        global $preview;
1707
-        $html_var = $cf['htmlvar_name'] . '_address';
1708
-
1709
-        if ($cf['extra_fields']) {
1710
-
1711
-            $extra_fields = unserialize($cf['extra_fields']);
1712
-
1713
-            $addition_fields = '';
1714
-
1715
-            if (!empty($extra_fields)) {
1716
-
1717
-                $show_city_in_address = false;
1718
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1719
-                    $show_city_in_address = true;
1720
-                }
1721
-                /**
1722
-                 * Filter "show city in address" value.
1723
-                 *
1724
-                 * @since 1.0.0
1725
-                 */
1726
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1727
-
1728
-
1729
-                $show_region_in_address = false;
1730
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1731
-                    $show_region_in_address = true;
1732
-                }
1733
-                /**
1734
-                 * Filter "show region in address" value.
1735
-                 *
1736
-                 * @since 1.6.6
1737
-                 */
1738
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1739
-
1740
-                $show_country_in_address = false;
1741
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1742
-                    $show_country_in_address = true;
1743
-                }
1744
-                /**
1745
-                 * Filter "show country in address" value.
1746
-                 *
1747
-                 * @since 1.6.6
1748
-                 */
1749
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1750
-
1751
-                $show_zip_in_address = false;
1752
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1753
-                    $show_zip_in_address = true;
1754
-                }
1755
-                /**
1756
-                 * Filter "show zip in address" value.
1757
-                 *
1758
-                 * @since 1.6.6
1759
-                 */
1760
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1761
-
1762
-
1763
-            }
1764
-
1765
-        }
1766
-
1767
-
1768
-        if ($post->{$html_var}) {
1769
-
1770
-            $field_icon = geodir_field_icon_proccess( $cf );
1771
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1772
-                $field_icon_af = '';
1773
-            } elseif ( $field_icon == '' ) {
1774
-                $field_icon_af = '<i class="fa fa-home"></i>';
1775
-            } else {
1776
-                $field_icon_af = $field_icon;
1777
-                $field_icon    = '';
1778
-            }
1654
+	// check we have the post value
1655
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1656
+	else{ global $post;}
1657
+
1658
+	if(!is_array($cf) && $cf!=''){
1659
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1660
+		if(!$cf){return NULL;}
1661
+	}
1662
+
1663
+	$html_var = $cf['htmlvar_name'];
1664
+
1665
+	// Check if there is a location specific filter.
1666
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1667
+		/**
1668
+		 * Filter the address html by location.
1669
+		 *
1670
+		 * @param string $html The html to filter.
1671
+		 * @param array $cf The custom field array.
1672
+		 * @since 1.6.6
1673
+		 */
1674
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1675
+	}
1676
+
1677
+	// Check if there is a custom field specific filter.
1678
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1679
+		/**
1680
+		 * Filter the address html by individual custom field.
1681
+		 *
1682
+		 * @param string $html The html to filter.
1683
+		 * @param string $location The location to output the html.
1684
+		 * @param array $cf The custom field array.
1685
+		 * @since 1.6.6
1686
+		 */
1687
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1688
+	}
1689
+
1690
+	// Check if there is a custom field key specific filter.
1691
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1692
+		/**
1693
+		 * Filter the address html by field type key.
1694
+		 *
1695
+		 * @param string $html The html to filter.
1696
+		 * @param string $location The location to output the html.
1697
+		 * @param array $cf The custom field array.
1698
+		 * @since 1.6.6
1699
+		 */
1700
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1701
+	}
1702
+
1703
+	// If not html then we run the standard output.
1704
+	if(empty($html)){
1705
+
1706
+		global $preview;
1707
+		$html_var = $cf['htmlvar_name'] . '_address';
1708
+
1709
+		if ($cf['extra_fields']) {
1710
+
1711
+			$extra_fields = unserialize($cf['extra_fields']);
1712
+
1713
+			$addition_fields = '';
1714
+
1715
+			if (!empty($extra_fields)) {
1716
+
1717
+				$show_city_in_address = false;
1718
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1719
+					$show_city_in_address = true;
1720
+				}
1721
+				/**
1722
+				 * Filter "show city in address" value.
1723
+				 *
1724
+				 * @since 1.0.0
1725
+				 */
1726
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1727
+
1728
+
1729
+				$show_region_in_address = false;
1730
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1731
+					$show_region_in_address = true;
1732
+				}
1733
+				/**
1734
+				 * Filter "show region in address" value.
1735
+				 *
1736
+				 * @since 1.6.6
1737
+				 */
1738
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1739
+
1740
+				$show_country_in_address = false;
1741
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1742
+					$show_country_in_address = true;
1743
+				}
1744
+				/**
1745
+				 * Filter "show country in address" value.
1746
+				 *
1747
+				 * @since 1.6.6
1748
+				 */
1749
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1750
+
1751
+				$show_zip_in_address = false;
1752
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1753
+					$show_zip_in_address = true;
1754
+				}
1755
+				/**
1756
+				 * Filter "show zip in address" value.
1757
+				 *
1758
+				 * @since 1.6.6
1759
+				 */
1760
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1761
+
1762
+
1763
+			}
1764
+
1765
+		}
1766
+
1767
+
1768
+		if ($post->{$html_var}) {
1769
+
1770
+			$field_icon = geodir_field_icon_proccess( $cf );
1771
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1772
+				$field_icon_af = '';
1773
+			} elseif ( $field_icon == '' ) {
1774
+				$field_icon_af = '<i class="fa fa-home"></i>';
1775
+			} else {
1776
+				$field_icon_af = $field_icon;
1777
+				$field_icon    = '';
1778
+			}
1779 1779
             
1780 1780
 
1781 1781
 
1782
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1783
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1784
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1785
-            $html .= '</span>';
1782
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1783
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1784
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1785
+			$html .= '</span>';
1786 1786
 
1787 1787
 
1788
-            if ( $post->post_address ) {
1789
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1790
-            }
1791
-            if ($show_city_in_address && $post->post_city ) {
1792
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1793
-            }
1794
-            if ($show_region_in_address && $post->post_region ) {
1795
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1796
-            }
1797
-            if ($show_zip_in_address && $post->post_zip ) {
1798
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1799
-            }
1800
-            if ($show_country_in_address && $post->post_country ) {
1801
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1802
-            }
1803
-            $html .= '</div>';
1788
+			if ( $post->post_address ) {
1789
+				$html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1790
+			}
1791
+			if ($show_city_in_address && $post->post_city ) {
1792
+				$html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1793
+			}
1794
+			if ($show_region_in_address && $post->post_region ) {
1795
+				$html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1796
+			}
1797
+			if ($show_zip_in_address && $post->post_zip ) {
1798
+				$html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1799
+			}
1800
+			if ($show_country_in_address && $post->post_country ) {
1801
+				$html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1802
+			}
1803
+			$html .= '</div>';
1804 1804
 
1805
-        }
1805
+		}
1806 1806
 
1807
-    }
1807
+	}
1808 1808
 
1809 1809
 
1810
-    return $html;
1810
+	return $html;
1811 1811
 }
1812 1812
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1813 1813
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return string The html to output for the custom field.
21 21
  */
22
-function geodir_cf_checkbox($html,$location,$cf,$p=''){
22
+function geodir_cf_checkbox($html, $location, $cf, $p = '') {
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
26
+    else { global $post; }
27 27
 
28
-    if(!is_array($cf) && $cf!=''){
28
+    if (!is_array($cf) && $cf != '') {
29 29
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
30
+        if (!$cf) {return NULL; }
31 31
     }
32 32
 
33 33
     $html_var = $cf['htmlvar_name'];
34 34
 
35 35
     // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
36
+    if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) {
37 37
         /**
38 38
          * Filter the checkbox html by location.
39 39
          *
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
          * @param array $cf The custom field array.
42 42
          * @since 1.6.6
43 43
          */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
44
+        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf);
45 45
     }
46 46
 
47 47
     // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
48
+    if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) {
49 49
         /**
50 50
          * Filter the checkbox html by individual custom field.
51 51
          *
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
          * @param array $cf The custom field array.
55 55
          * @since 1.6.6
56 56
          */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
57
+        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf);
58 58
     }
59 59
 
60 60
     // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
61
+    if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) {
62 62
         /**
63 63
          * Filter the checkbox html by field type key.
64 64
          *
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
          * @param array $cf The custom field array.
68 68
          * @since 1.6.6
69 69
          */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
70
+        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf);
71 71
     }
72 72
 
73 73
     // If not html then we run the standard output.
74
-    if(empty($html)){
74
+    if (empty($html)) {
75 75
 
76
-        if ( (int) $post->{$html_var} == 1 ):
76
+        if ((int) $post->{$html_var} == 1):
77 77
 
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
78
+            if ($post->{$html_var} == '1'):
79
+                $html_val = __('Yes', 'geodirectory');
80 80
             else:
81
-                $html_val = __( 'No', 'geodirectory' );
81
+                $html_val = __('No', 'geodirectory');
82 82
             endif;
83 83
 
84 84
             $field_icon = geodir_field_icon_proccess($cf);
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
                 $field_icon = '';
92 92
             }
93 93
 
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
94
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;
95
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
96
+            $html .= '</span>'.$html_val.'</div>';
97 97
         endif;
98 98
 
99 99
     }
100 100
 
101 101
     return $html;
102 102
 }
103
-add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
103
+add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3);
104 104
 
105 105
 
106 106
 /**
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string The html to output for the custom field.
115 115
  */
116
-function geodir_cf_fieldset($html,$location,$cf,$p=''){
116
+function geodir_cf_fieldset($html, $location, $cf, $p = '') {
117 117
 
118 118
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
119
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
120
+    else { global $post; }
121 121
 
122
-    if(!is_array($cf) && $cf!=''){
122
+    if (!is_array($cf) && $cf != '') {
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
124
+        if (!$cf) {return NULL; }
125 125
     }
126 126
 
127 127
     $html_var = $cf['htmlvar_name'];
128 128
 
129 129
     // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
130
+    if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) {
131 131
         /**
132 132
          * Filter the fieldset html by location.
133 133
          *
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
          * @param array $cf The custom field array.
136 136
          * @since 1.6.6
137 137
          */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
138
+        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf);
139 139
     }
140 140
 
141 141
     // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
142
+    if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) {
143 143
         /**
144 144
          * Filter the fieldset html by individual custom field.
145 145
          *
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
          * @param array $cf The custom field array.
149 149
          * @since 1.6.6
150 150
          */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
151
+        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf);
152 152
     }
153 153
 
154 154
     // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
155
+    if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) {
156 156
         /**
157 157
          * Filter the fieldset html by field type key.
158 158
          *
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
          * @param array $cf The custom field array.
162 162
          * @since 1.6.6
163 163
          */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
164
+        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf);
165 165
     }
166 166
 
167 167
     // If not html then we run the standard output.
168
-    if(empty($html)){
168
+    if (empty($html)) {
169 169
 
170 170
         global $field_set_start;
171 171
         $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         if ($field_set_start == 1) {
174 174
             $html = '';
175 175
         } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
176
+            $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
177 177
             //$field_set_start = 1;
178 178
         }
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     return $html;
183 183
 }
184
-add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
184
+add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3);
185 185
 
186 186
 
187 187
 /**
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return string The html to output for the custom field.
196 196
  */
197
-function geodir_cf_url($html,$location,$cf,$p=''){
197
+function geodir_cf_url($html, $location, $cf, $p = '') {
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
201
+    else { global $post; }
202 202
 
203
-    if(!is_array($cf) && $cf!=''){
203
+    if (!is_array($cf) && $cf != '') {
204 204
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
205
+        if (!$cf) {return NULL; }
206 206
     }
207 207
 
208 208
     $html_var = $cf['htmlvar_name'];
209 209
 
210 210
     // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
211
+    if (has_filter("geodir_custom_field_output_url_loc_{$location}")) {
212 212
         /**
213 213
          * Filter the url html by location.
214 214
          *
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
          * @param array $cf The custom field array.
217 217
          * @since 1.6.6
218 218
          */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
219
+        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf);
220 220
     }
221 221
 
222 222
     // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
223
+    if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) {
224 224
         /**
225 225
          * Filter the url html by individual custom field.
226 226
          *
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
          * @param array $cf The custom field array.
230 230
          * @since 1.6.6
231 231
          */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
232
+        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf);
233 233
     }
234 234
 
235 235
     // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
236
+    if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) {
237 237
         /**
238 238
          * Filter the url html by field type key.
239 239
          *
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
          * @param array $cf The custom field array.
243 243
          * @since 1.6.6
244 244
          */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
245
+        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf);
246 246
     }
247 247
 
248 248
     // If not html then we run the standard output.
249
-    if(empty($html)){
249
+    if (empty($html)) {
250 250
 
251 251
         if ($post->{$cf['htmlvar_name']}):
252 252
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
             $website = !empty($a_url['url']) ? $a_url['url'] : '';
275 275
             $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
276
+            if (!empty($cf['default_value'])) {$title = $cf['default_value']; }
277 277
             $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278 278
 
279 279
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
              * @param string $website Website URL.
290 290
              * @param int $post->ID Post ID.
291 291
              */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
292
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
293 293
 
294 294
         endif;
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
     return $html;
299 299
 }
300
-add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
300
+add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3);
301 301
 
302 302
 
303 303
 /**
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
  *
311 311
  * @return string The html to output for the custom field.
312 312
  */
313
-function geodir_cf_phone($html,$location,$cf,$p=''){
313
+function geodir_cf_phone($html, $location, $cf, $p = '') {
314 314
 
315 315
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
316
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
317
+    else { global $post; }
318 318
 
319
-    if(!is_array($cf) && $cf!=''){
319
+    if (!is_array($cf) && $cf != '') {
320 320
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
321
+        if (!$cf) {return NULL; }
322 322
     }
323 323
 
324 324
     $html_var = $cf['htmlvar_name'];
325 325
 
326 326
     // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
327
+    if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) {
328 328
         /**
329 329
          * Filter the phone html by location.
330 330
          *
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
          * @param array $cf The custom field array.
333 333
          * @since 1.6.6
334 334
          */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
335
+        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf);
336 336
     }
337 337
 
338 338
     // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
339
+    if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) {
340 340
         /**
341 341
          * Filter the phone html by individual custom field.
342 342
          *
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
          * @param array $cf The custom field array.
346 346
          * @since 1.6.6
347 347
          */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
348
+        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf);
349 349
     }
350 350
 
351 351
     // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
352
+    if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) {
353 353
         /**
354 354
          * Filter the phone html by field type key.
355 355
          *
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
          * @param array $cf The custom field array.
359 359
          * @since 1.6.6
360 360
          */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
361
+        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf);
362 362
     }
363 363
 
364 364
     // If not html then we run the standard output.
365
-    if(empty($html)){
365
+    if (empty($html)) {
366 366
 
367 367
         if ($post->{$cf['htmlvar_name']}):
368 368
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
             }
378 378
 
379 379
 
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
380
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af.
381
+                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
382
+            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>';
383 383
 
384 384
         endif;
385 385
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     return $html;
389 389
 }
390
-add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
390
+add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3);
391 391
 
392 392
 
393 393
 /**
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return string The html to output for the custom field.
402 402
  */
403
-function geodir_cf_time($html,$location,$cf,$p=''){
403
+function geodir_cf_time($html, $location, $cf, $p = '') {
404 404
 
405 405
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
406
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
407
+    else { global $post; }
408 408
 
409
-    if(!is_array($cf) && $cf!=''){
409
+    if (!is_array($cf) && $cf != '') {
410 410
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
411
+        if (!$cf) {return NULL; }
412 412
     }
413 413
 
414 414
     $html_var = $cf['htmlvar_name'];
415 415
 
416 416
     // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
417
+    if (has_filter("geodir_custom_field_output_time_loc_{$location}")) {
418 418
         /**
419 419
          * Filter the time html by location.
420 420
          *
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
          * @param array $cf The custom field array.
423 423
          * @since 1.6.6
424 424
          */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
425
+        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf);
426 426
     }
427 427
 
428 428
     // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
429
+    if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) {
430 430
         /**
431 431
          * Filter the time html by individual custom field.
432 432
          *
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
          * @param array $cf The custom field array.
436 436
          * @since 1.6.6
437 437
          */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
438
+        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf);
439 439
     }
440 440
 
441 441
     // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
442
+    if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) {
443 443
         /**
444 444
          * Filter the time html by field type key.
445 445
          *
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
          * @param array $cf The custom field array.
449 449
          * @since 1.6.6
450 450
          */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
451
+        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf);
452 452
     }
453 453
 
454 454
     // If not html then we run the standard output.
455
-    if(empty($html)){
455
+    if (empty($html)) {
456 456
 
457 457
         if ($post->{$cf['htmlvar_name']}):
458 458
 
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
             }
473 473
 
474 474
 
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
475
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;
476
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
477
+            $html .= '</span>'.$value.'</div>';
478 478
 
479 479
         endif;
480 480
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
     return $html;
484 484
 }
485
-add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
485
+add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3);
486 486
 
487 487
 
488 488
 /**
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string The html to output for the custom field.
497 497
  */
498
-function geodir_cf_datepicker($html,$location,$cf,$p=''){
498
+function geodir_cf_datepicker($html, $location, $cf, $p = '') {
499 499
     global $preview;
500 500
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
501
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
502
+    else { global $post; }
503 503
 
504
-    if(!is_array($cf) && $cf!=''){
504
+    if (!is_array($cf) && $cf != '') {
505 505
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
506
+        if (!$cf) {return NULL; }
507 507
     }
508 508
 
509 509
     $html_var = $cf['htmlvar_name'];
510 510
 
511 511
     // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
512
+    if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) {
513 513
         /**
514 514
          * Filter the datepicker html by location.
515 515
          *
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
          * @param array $cf The custom field array.
518 518
          * @since 1.6.6
519 519
          */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
520
+        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf);
521 521
     }
522 522
 
523 523
     // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
524
+    if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) {
525 525
         /**
526 526
          * Filter the datepicker html by individual custom field.
527 527
          *
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
          * @param array $cf The custom field array.
531 531
          * @since 1.6.6
532 532
          */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
533
+        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf);
534 534
     }
535 535
 
536 536
     // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
537
+    if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) {
538 538
         /**
539 539
          * Filter the datepicker html by field type key.
540 540
          *
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
          * @param array $cf The custom field array.
544 544
          * @since 1.6.6
545 545
          */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
546
+        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf);
547 547
     }
548 548
 
549 549
     // If not html then we run the standard output.
550
-    if(empty($html)){
550
+    if (empty($html)) {
551 551
 
552 552
         if ($post->{$cf['htmlvar_name']}):
553 553
 
@@ -558,24 +558,24 @@  discard block
 block discarded – undo
558 558
             }
559 559
             // check if we need to change the format or not
560 560
             $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
561
+            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
562 562
 
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
563
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
564
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
565 565
 
566 566
                 $date_format = str_replace($search, $replace, $date_format);
567 567
 
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
568
+                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+            } else {
570 570
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 571
             }
572 572
 
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
573
+            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") {
574 574
                 $date_format_from = $preview ? $date_format : 'Y-m-d';
575 575
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 576
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 577
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
578
+            } else {
579 579
                 return '';
580 580
             }
581 581
 
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 
593 593
 
594 594
 
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
595
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;
596
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
597
+            $html .= '</span>'.$value.'</div>';
598 598
 
599 599
         endif;
600 600
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
     return $html;
604 604
 }
605
-add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
605
+add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3);
606 606
 
607 607
 
608 608
 /**
@@ -615,21 +615,21 @@  discard block
 block discarded – undo
615 615
  *
616 616
  * @return string The html to output for the custom field.
617 617
  */
618
-function geodir_cf_text($html,$location,$cf,$p=''){
618
+function geodir_cf_text($html, $location, $cf, $p = '') {
619 619
 
620 620
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
621
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
622
+    else { global $post; }
623 623
 
624
-    if(!is_array($cf) && $cf!=''){
624
+    if (!is_array($cf) && $cf != '') {
625 625
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
626
+        if (!$cf) {return NULL; }
627 627
     }
628 628
 
629 629
     $html_var = $cf['htmlvar_name'];
630 630
 
631 631
     // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
632
+    if (has_filter("geodir_custom_field_output_text_loc_{$location}")) {
633 633
         /**
634 634
          * Filter the text html by location.
635 635
          *
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
          * @param array $cf The custom field array.
638 638
          * @since 1.6.6
639 639
          */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
640
+        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf);
641 641
     }
642 642
 
643 643
     // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
644
+    if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) {
645 645
         /**
646 646
          * Filter the text html by individual custom field.
647 647
          *
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
          * @param array $cf The custom field array.
651 651
          * @since 1.6.6
652 652
          */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
653
+        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf);
654 654
     }
655 655
 
656 656
     // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
657
+    if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) {
658 658
         /**
659 659
          * Filter the text html by field type key.
660 660
          *
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
          * @param array $cf The custom field array.
664 664
          * @since 1.6.6
665 665
          */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
666
+        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf);
667 667
     }
668 668
 
669 669
     
670 670
 
671 671
     // If not html then we run the standard output.
672
-    if(empty($html)){
672
+    if (empty($html)) {
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
675 675
 
676 676
             $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
             }
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
-            $html .= '</span>' . $post->{$cf['htmlvar_name']} . '</div>';
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>'.$post->{$cf['htmlvar_name']}.'</div>';
692 692
 
693 693
         endif;
694 694
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
     return $html;
698 698
 }
699
-add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
699
+add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3);
700 700
 
701 701
 
702 702
 /**
@@ -709,21 +709,21 @@  discard block
 block discarded – undo
709 709
  *
710 710
  * @return string The html to output for the custom field.
711 711
  */
712
-function geodir_cf_radio($html,$location,$cf,$p=''){
712
+function geodir_cf_radio($html, $location, $cf, $p = '') {
713 713
 
714 714
     // check we have the post value
715
-    if(is_int($p)){$post = geodir_get_post_info($p);}
716
-    else{ global $post;}
715
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
716
+    else { global $post; }
717 717
 
718
-    if(!is_array($cf) && $cf!=''){
718
+    if (!is_array($cf) && $cf != '') {
719 719
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
720
-        if(!$cf){return NULL;}
720
+        if (!$cf) {return NULL; }
721 721
     }
722 722
 
723 723
     $html_var = $cf['htmlvar_name'];
724 724
 
725 725
     // Check if there is a location specific filter.
726
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
726
+    if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) {
727 727
         /**
728 728
          * Filter the radio html by location.
729 729
          *
@@ -731,11 +731,11 @@  discard block
 block discarded – undo
731 731
          * @param array $cf The custom field array.
732 732
          * @since 1.6.6
733 733
          */
734
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
734
+        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf);
735 735
     }
736 736
 
737 737
     // Check if there is a custom field specific filter.
738
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
738
+    if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) {
739 739
         /**
740 740
          * Filter the radio html by individual custom field.
741 741
          *
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
          * @param array $cf The custom field array.
745 745
          * @since 1.6.6
746 746
          */
747
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
747
+        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf);
748 748
     }
749 749
 
750 750
     // Check if there is a custom field key specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
751
+    if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) {
752 752
         /**
753 753
          * Filter the radio html by field type key.
754 754
          *
@@ -757,11 +757,11 @@  discard block
 block discarded – undo
757 757
          * @param array $cf The custom field array.
758 758
          * @since 1.6.6
759 759
          */
760
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
760
+        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf);
761 761
     }
762 762
 
763 763
     // If not html then we run the standard output.
764
-    if(empty($html)){
764
+    if (empty($html)) {
765 765
 
766 766
         $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
767 767
         if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
@@ -795,16 +795,16 @@  discard block
 block discarded – undo
795 795
             }
796 796
 
797 797
 
798
-            $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;
799
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
800
-            $html .= '</span>' . $html_val . '</div>';
798
+            $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;
799
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
800
+            $html .= '</span>'.$html_val.'</div>';
801 801
         endif;
802 802
 
803 803
     }
804 804
 
805 805
     return $html;
806 806
 }
807
-add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
807
+add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3);
808 808
 
809 809
 
810 810
 /**
@@ -817,21 +817,21 @@  discard block
 block discarded – undo
817 817
  *
818 818
  * @return string The html to output for the custom field.
819 819
  */
820
-function geodir_cf_select($html,$location,$cf,$p=''){
820
+function geodir_cf_select($html, $location, $cf, $p = '') {
821 821
 
822 822
     // check we have the post value
823
-    if(is_int($p)){$post = geodir_get_post_info($p);}
824
-    else{ global $post;}
823
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
824
+    else { global $post; }
825 825
 
826
-    if(!is_array($cf) && $cf!=''){
826
+    if (!is_array($cf) && $cf != '') {
827 827
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
828
-        if(!$cf){return NULL;}
828
+        if (!$cf) {return NULL; }
829 829
     }
830 830
 
831 831
     $html_var = $cf['htmlvar_name'];
832 832
 
833 833
     // Check if there is a location specific filter.
834
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
834
+    if (has_filter("geodir_custom_field_output_select_loc_{$location}")) {
835 835
         /**
836 836
          * Filter the select html by location.
837 837
          *
@@ -839,11 +839,11 @@  discard block
 block discarded – undo
839 839
          * @param array $cf The custom field array.
840 840
          * @since 1.6.6
841 841
          */
842
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
842
+        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf);
843 843
     }
844 844
 
845 845
     // Check if there is a custom field specific filter.
846
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
846
+    if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) {
847 847
         /**
848 848
          * Filter the select html by individual custom field.
849 849
          *
@@ -852,11 +852,11 @@  discard block
 block discarded – undo
852 852
          * @param array $cf The custom field array.
853 853
          * @since 1.6.6
854 854
          */
855
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
855
+        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf);
856 856
     }
857 857
 
858 858
     // Check if there is a custom field key specific filter.
859
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
859
+    if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) {
860 860
         /**
861 861
          * Filter the select html by field type key.
862 862
          *
@@ -865,11 +865,11 @@  discard block
 block discarded – undo
865 865
          * @param array $cf The custom field array.
866 866
          * @since 1.6.6
867 867
          */
868
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
868
+        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf);
869 869
     }
870 870
 
871 871
     // If not html then we run the standard output.
872
-    if(empty($html)){
872
+    if (empty($html)) {
873 873
 
874 874
         if ($post->{$cf['htmlvar_name']}):
875 875
             $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
@@ -897,16 +897,16 @@  discard block
 block discarded – undo
897 897
             }
898 898
 
899 899
 
900
-            $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;
901
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
902
-            $html .= '</span>' . $field_value . '</div>';
900
+            $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;
901
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
902
+            $html .= '</span>'.$field_value.'</div>';
903 903
         endif;
904 904
 
905 905
     }
906 906
 
907 907
     return $html;
908 908
 }
909
-add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
909
+add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3);
910 910
 
911 911
 
912 912
 /**
@@ -919,21 +919,21 @@  discard block
 block discarded – undo
919 919
  *
920 920
  * @return string The html to output for the custom field.
921 921
  */
922
-function geodir_cf_multiselect($html,$location,$cf,$p=''){
922
+function geodir_cf_multiselect($html, $location, $cf, $p = '') {
923 923
 
924 924
     // check we have the post value
925
-    if(is_int($p)){$post = geodir_get_post_info($p);}
926
-    else{ global $post;}
925
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
926
+    else { global $post; }
927 927
 
928
-    if(!is_array($cf) && $cf!=''){
928
+    if (!is_array($cf) && $cf != '') {
929 929
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
930
-        if(!$cf){return NULL;}
930
+        if (!$cf) {return NULL; }
931 931
     }
932 932
 
933 933
     $html_var = $cf['htmlvar_name'];
934 934
 
935 935
     // Check if there is a location specific filter.
936
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
936
+    if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) {
937 937
         /**
938 938
          * Filter the multiselect html by location.
939 939
          *
@@ -941,11 +941,11 @@  discard block
 block discarded – undo
941 941
          * @param array $cf The custom field array.
942 942
          * @since 1.6.6
943 943
          */
944
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
944
+        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf);
945 945
     }
946 946
 
947 947
     // Check if there is a custom field specific filter.
948
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
948
+    if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) {
949 949
         /**
950 950
          * Filter the multiselect html by individual custom field.
951 951
          *
@@ -954,11 +954,11 @@  discard block
 block discarded – undo
954 954
          * @param array $cf The custom field array.
955 955
          * @since 1.6.6
956 956
          */
957
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
957
+        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf);
958 958
     }
959 959
 
960 960
     // Check if there is a custom field key specific filter.
961
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
961
+    if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) {
962 962
         /**
963 963
          * Filter the multiselect html by field type key.
964 964
          *
@@ -967,11 +967,11 @@  discard block
 block discarded – undo
967 967
          * @param array $cf The custom field array.
968 968
          * @since 1.6.6
969 969
          */
970
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
970
+        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf);
971 971
     }
972 972
 
973 973
     // If not html then we run the standard output.
974
-    if(empty($html)){
974
+    if (empty($html)) {
975 975
 
976 976
 
977 977
         if (!empty($post->{$cf['htmlvar_name']})):
@@ -1006,15 +1006,15 @@  discard block
 block discarded – undo
1006 1006
             }
1007 1007
 
1008 1008
 
1009
-            $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;
1010
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1009
+            $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;
1010
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1011 1011
             $html .= '</span>';
1012 1012
 
1013 1013
             if (count($option_values) > 1) {
1014 1014
                 $html .= '<ul>';
1015 1015
 
1016 1016
                 foreach ($option_values as $val) {
1017
-                    $html .= '<li>' . $val . '</li>';
1017
+                    $html .= '<li>'.$val.'</li>';
1018 1018
                 }
1019 1019
 
1020 1020
                 $html .= '</ul>';
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
     return $html;
1031 1031
 }
1032
-add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1032
+add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3);
1033 1033
 
1034 1034
 
1035 1035
 /**
@@ -1042,21 +1042,21 @@  discard block
 block discarded – undo
1042 1042
  *
1043 1043
  * @return string The html to output for the custom field.
1044 1044
  */
1045
-function geodir_cf_email($html,$location,$cf,$p=''){
1045
+function geodir_cf_email($html, $location, $cf, $p = '') {
1046 1046
 
1047 1047
     // check we have the post value
1048
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1049
-    else{ global $post;}
1048
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1049
+    else { global $post; }
1050 1050
 
1051
-    if(!is_array($cf) && $cf!=''){
1051
+    if (!is_array($cf) && $cf != '') {
1052 1052
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1053
-        if(!$cf){return NULL;}
1053
+        if (!$cf) {return NULL; }
1054 1054
     }
1055 1055
 
1056 1056
     $html_var = $cf['htmlvar_name'];
1057 1057
 
1058 1058
     // Check if there is a location specific filter.
1059
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1059
+    if (has_filter("geodir_custom_field_output_email_loc_{$location}")) {
1060 1060
         /**
1061 1061
          * Filter the email html by location.
1062 1062
          *
@@ -1064,11 +1064,11 @@  discard block
 block discarded – undo
1064 1064
          * @param array $cf The custom field array.
1065 1065
          * @since 1.6.6
1066 1066
          */
1067
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1067
+        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf);
1068 1068
     }
1069 1069
 
1070 1070
     // Check if there is a custom field specific filter.
1071
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1071
+    if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) {
1072 1072
         /**
1073 1073
          * Filter the email html by individual custom field.
1074 1074
          *
@@ -1077,11 +1077,11 @@  discard block
 block discarded – undo
1077 1077
          * @param array $cf The custom field array.
1078 1078
          * @since 1.6.6
1079 1079
          */
1080
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1080
+        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf);
1081 1081
     }
1082 1082
 
1083 1083
     // Check if there is a custom field key specific filter.
1084
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1084
+    if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) {
1085 1085
         /**
1086 1086
          * Filter the email html by field type key.
1087 1087
          *
@@ -1090,18 +1090,18 @@  discard block
 block discarded – undo
1090 1090
          * @param array $cf The custom field array.
1091 1091
          * @since 1.6.6
1092 1092
          */
1093
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1093
+        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf);
1094 1094
     }
1095 1095
 
1096 1096
     // If not html then we run the standard output.
1097
-    if(empty($html)){
1097
+    if (empty($html)) {
1098 1098
 
1099 1099
         global $preview;
1100 1100
         if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1101 1101
             return ''; // Remove Send Enquiry | Send To Friend from listings page
1102 1102
         }
1103 1103
 
1104
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1104
+        $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type);
1105 1105
 
1106 1106
         if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1107 1107
             $send_to_friend = true;
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
             if (!$preview) {
1113 1113
                 $b_send_inquiry = 'b_send_inquiry';
1114 1114
                 $b_sendtofriend = 'b_sendtofriend';
1115
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1115
+                $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';
1116 1116
             }
1117 1117
 
1118 1118
             $field_icon = geodir_field_icon_proccess($cf);
@@ -1125,26 +1125,26 @@  discard block
 block discarded – undo
1125 1125
                 $field_icon = '';
1126 1126
             }
1127 1127
 
1128
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1128
+            $html .= '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1129 1129
             $seperator = '';
1130 1130
             if ($post->{$cf['htmlvar_name']}) {
1131
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1131
+                $html .= '<a href="javascript:void(0);" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';
1132 1132
                 $seperator = ' | ';
1133 1133
             }
1134 1134
 
1135 1135
             if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1136
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1136
+                $html .= $seperator.'<a href="javascript:void(0);" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>';
1137 1137
             }
1138 1138
 
1139 1139
             $html .= '</span></div>';
1140 1140
 
1141 1141
 
1142 1142
             if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1143
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1143
+                $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';
1144 1144
             } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1145
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1145
+                $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>';
1146 1146
             } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1147
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1147
+                $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';
1148 1148
             }
1149 1149
 
1150 1150
             /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
@@ -1164,11 +1164,11 @@  discard block
 block discarded – undo
1164 1164
                 }
1165 1165
 
1166 1166
 
1167
-                $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;
1168
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1167
+                $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;
1168
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1169 1169
                 $html .= '</span><span class="geodir-email-address-output">';
1170 1170
                 $email = $post->{$cf['htmlvar_name']} ;
1171
-                if($e_split = explode('@',$email)){
1171
+                if ($e_split = explode('@', $email)) {
1172 1172
                     /**
1173 1173
                      * Filter email custom field name output.
1174 1174
                      *
@@ -1177,10 +1177,10 @@  discard block
 block discarded – undo
1177 1177
                      * @param string $email The email string being output.
1178 1178
                      * @param array $cf Custom field variables array.
1179 1179
                      */
1180
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1181
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1182
-                }else{
1183
-                    $html .=  $email;
1180
+                    $email_name = apply_filters('geodir_email_field_name_output', $email, $cf);
1181
+                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1182
+                } else {
1183
+                    $html .= $email;
1184 1184
                 }
1185 1185
                 $html .= '</span></div>';
1186 1186
             }
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 
1192 1192
     return $html;
1193 1193
 }
1194
-add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1194
+add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3);
1195 1195
 
1196 1196
 
1197 1197
 /**
@@ -1204,21 +1204,21 @@  discard block
 block discarded – undo
1204 1204
  *
1205 1205
  * @return string The html to output for the custom field.
1206 1206
  */
1207
-function geodir_cf_file($html,$location,$cf,$p=''){
1207
+function geodir_cf_file($html, $location, $cf, $p = '') {
1208 1208
 
1209 1209
     // check we have the post value
1210
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1211
-    else{ global $post;}
1210
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1211
+    else { global $post; }
1212 1212
 
1213
-    if(!is_array($cf) && $cf!=''){
1213
+    if (!is_array($cf) && $cf != '') {
1214 1214
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1215
-        if(!$cf){return NULL;}
1215
+        if (!$cf) {return NULL; }
1216 1216
     }
1217 1217
 
1218 1218
     $html_var = $cf['htmlvar_name'];
1219 1219
 
1220 1220
     // Check if there is a location specific filter.
1221
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1221
+    if (has_filter("geodir_custom_field_output_file_loc_{$location}")) {
1222 1222
         /**
1223 1223
          * Filter the file html by location.
1224 1224
          *
@@ -1226,11 +1226,11 @@  discard block
 block discarded – undo
1226 1226
          * @param array $cf The custom field array.
1227 1227
          * @since 1.6.6
1228 1228
          */
1229
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1229
+        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf);
1230 1230
     }
1231 1231
 
1232 1232
     // Check if there is a custom field specific filter.
1233
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1233
+    if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) {
1234 1234
         /**
1235 1235
          * Filter the file html by individual custom field.
1236 1236
          *
@@ -1239,11 +1239,11 @@  discard block
 block discarded – undo
1239 1239
          * @param array $cf The custom field array.
1240 1240
          * @since 1.6.6
1241 1241
          */
1242
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1242
+        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf);
1243 1243
     }
1244 1244
 
1245 1245
     // Check if there is a custom field key specific filter.
1246
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1246
+    if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) {
1247 1247
         /**
1248 1248
          * Filter the file html by field type key.
1249 1249
          *
@@ -1252,11 +1252,11 @@  discard block
 block discarded – undo
1252 1252
          * @param array $cf The custom field array.
1253 1253
          * @since 1.6.6
1254 1254
          */
1255
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1255
+        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf);
1256 1256
     }
1257 1257
 
1258 1258
     // If not html then we run the standard output.
1259
-    if(empty($html)){
1259
+    if (empty($html)) {
1260 1260
 
1261 1261
         if (!empty($post->{$cf['htmlvar_name']})):
1262 1262
 
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
             if (!empty($files)):
1265 1265
 
1266 1266
                 $extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1267
-                $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'] : '';
1267
+                $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'] : '';
1268 1268
 
1269 1269
                 $file_paths = '';
1270 1270
                 foreach ($files as $file) {
@@ -1301,9 +1301,9 @@  discard block
 block discarded – undo
1301 1301
                             //$file_paths .= '<img src="'.$file.'"  />';	
1302 1302
                             $file_paths .= '</div>';
1303 1303
                         } else {
1304
-                            $ext_path = '_' . $html_var . '_';
1304
+                            $ext_path = '_'.$html_var.'_';
1305 1305
                             $filename = explode($ext_path, $filename);
1306
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1306
+                            $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
1307 1307
                         }
1308 1308
                     }
1309 1309
                 }
@@ -1318,11 +1318,11 @@  discard block
 block discarded – undo
1318 1318
                     $field_icon = '';
1319 1319
                 }
1320 1320
 
1321
-                $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;
1321
+                $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;
1322 1322
                 $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1323
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1323
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1324 1324
                 $html .= '</span>';
1325
-                $html .= $file_paths . '</div></div>';
1325
+                $html .= $file_paths.'</div></div>';
1326 1326
 
1327 1327
             endif;
1328 1328
         endif;
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
 
1332 1332
     return $html;
1333 1333
 }
1334
-add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1334
+add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3);
1335 1335
 
1336 1336
 
1337 1337
 
@@ -1345,21 +1345,21 @@  discard block
 block discarded – undo
1345 1345
  *
1346 1346
  * @return string The html to output for the custom field.
1347 1347
  */
1348
-function geodir_cf_textarea($html,$location,$cf,$p=''){
1348
+function geodir_cf_textarea($html, $location, $cf, $p = '') {
1349 1349
 
1350 1350
     // check we have the post value
1351
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1352
-    else{ global $post;}
1351
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1352
+    else { global $post; }
1353 1353
 
1354
-    if(!is_array($cf) && $cf!=''){
1354
+    if (!is_array($cf) && $cf != '') {
1355 1355
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1356
-        if(!$cf){return NULL;}
1356
+        if (!$cf) {return NULL; }
1357 1357
     }
1358 1358
 
1359 1359
     $html_var = $cf['htmlvar_name'];
1360 1360
 
1361 1361
     // Check if there is a location specific filter.
1362
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1362
+    if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) {
1363 1363
         /**
1364 1364
          * Filter the textarea html by location.
1365 1365
          *
@@ -1367,11 +1367,11 @@  discard block
 block discarded – undo
1367 1367
          * @param array $cf The custom field array.
1368 1368
          * @since 1.6.6
1369 1369
          */
1370
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1370
+        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf);
1371 1371
     }
1372 1372
 
1373 1373
     // Check if there is a custom field specific filter.
1374
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1374
+    if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) {
1375 1375
         /**
1376 1376
          * Filter the textarea html by individual custom field.
1377 1377
          *
@@ -1380,11 +1380,11 @@  discard block
 block discarded – undo
1380 1380
          * @param array $cf The custom field array.
1381 1381
          * @since 1.6.6
1382 1382
          */
1383
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1383
+        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf);
1384 1384
     }
1385 1385
 
1386 1386
     // Check if there is a custom field key specific filter.
1387
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1387
+    if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) {
1388 1388
         /**
1389 1389
          * Filter the textarea html by field type key.
1390 1390
          *
@@ -1393,11 +1393,11 @@  discard block
 block discarded – undo
1393 1393
          * @param array $cf The custom field array.
1394 1394
          * @since 1.6.6
1395 1395
          */
1396
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1396
+        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf);
1397 1397
     }
1398 1398
 
1399 1399
     // If not html then we run the standard output.
1400
-    if(empty($html)){
1400
+    if (empty($html)) {
1401 1401
 
1402 1402
         if (!empty($post->{$cf['htmlvar_name']})) {
1403 1403
 
@@ -1412,9 +1412,9 @@  discard block
 block discarded – undo
1412 1412
             }
1413 1413
 
1414 1414
 
1415
-            $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;
1416
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1417
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1415
+            $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;
1416
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1417
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1418 1418
 
1419 1419
         }
1420 1420
 
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 
1423 1423
     return $html;
1424 1424
 }
1425
-add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1425
+add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3);
1426 1426
 
1427 1427
 
1428 1428
 
@@ -1436,21 +1436,21 @@  discard block
 block discarded – undo
1436 1436
  *
1437 1437
  * @return string The html to output for the custom field.
1438 1438
  */
1439
-function geodir_cf_html($html,$location,$cf,$p=''){
1439
+function geodir_cf_html($html, $location, $cf, $p = '') {
1440 1440
 
1441 1441
     // check we have the post value
1442
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1443
-    else{ global $post;}
1442
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1443
+    else { global $post; }
1444 1444
 
1445
-    if(!is_array($cf) && $cf!=''){
1445
+    if (!is_array($cf) && $cf != '') {
1446 1446
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1447
-        if(!$cf){return NULL;}
1447
+        if (!$cf) {return NULL; }
1448 1448
     }
1449 1449
 
1450 1450
     $html_var = $cf['htmlvar_name'];
1451 1451
 
1452 1452
     // Check if there is a location specific filter.
1453
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1453
+    if (has_filter("geodir_custom_field_output_html_loc_{$location}")) {
1454 1454
         /**
1455 1455
          * Filter the html html by location.
1456 1456
          *
@@ -1458,11 +1458,11 @@  discard block
 block discarded – undo
1458 1458
          * @param array $cf The custom field array.
1459 1459
          * @since 1.6.6
1460 1460
          */
1461
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1461
+        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf);
1462 1462
     }
1463 1463
 
1464 1464
     // Check if there is a custom field specific filter.
1465
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1465
+    if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) {
1466 1466
         /**
1467 1467
          * Filter the html html by individual custom field.
1468 1468
          *
@@ -1471,11 +1471,11 @@  discard block
 block discarded – undo
1471 1471
          * @param array $cf The custom field array.
1472 1472
          * @since 1.6.6
1473 1473
          */
1474
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1474
+        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf);
1475 1475
     }
1476 1476
 
1477 1477
     // Check if there is a custom field key specific filter.
1478
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1478
+    if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) {
1479 1479
         /**
1480 1480
          * Filter the html html by field type key.
1481 1481
          *
@@ -1484,11 +1484,11 @@  discard block
 block discarded – undo
1484 1484
          * @param array $cf The custom field array.
1485 1485
          * @since 1.6.6
1486 1486
          */
1487
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1487
+        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf);
1488 1488
     }
1489 1489
 
1490 1490
     // If not html then we run the standard output.
1491
-    if(empty($html)){
1491
+    if (empty($html)) {
1492 1492
 
1493 1493
         if (!empty($post->{$cf['htmlvar_name']})) {
1494 1494
 
@@ -1502,9 +1502,9 @@  discard block
 block discarded – undo
1502 1502
                 $field_icon = '';
1503 1503
             }
1504 1504
 
1505
-            $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;
1506
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1507
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1505
+            $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;
1506
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1507
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1508 1508
 
1509 1509
         }
1510 1510
 
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 
1513 1513
     return $html;
1514 1514
 }
1515
-add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1515
+add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3);
1516 1516
 
1517 1517
 
1518 1518
 
@@ -1526,21 +1526,21 @@  discard block
 block discarded – undo
1526 1526
  *
1527 1527
  * @return string The html to output for the custom field.
1528 1528
  */
1529
-function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1529
+function geodir_cf_taxonomy($html, $location, $cf, $p = '') {
1530 1530
 
1531 1531
     // check we have the post value
1532
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1533
-    else{ global $post;}
1532
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1533
+    else { global $post; }
1534 1534
 
1535
-    if(!is_array($cf) && $cf!=''){
1535
+    if (!is_array($cf) && $cf != '') {
1536 1536
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1537
-        if(!$cf){return NULL;}
1537
+        if (!$cf) {return NULL; }
1538 1538
     }
1539 1539
 
1540 1540
     $html_var = $cf['htmlvar_name'];
1541 1541
 
1542 1542
     // Check if there is a location specific filter.
1543
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1543
+    if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) {
1544 1544
         /**
1545 1545
          * Filter the taxonomy html by location.
1546 1546
          *
@@ -1548,11 +1548,11 @@  discard block
 block discarded – undo
1548 1548
          * @param array $cf The custom field array.
1549 1549
          * @since 1.6.6
1550 1550
          */
1551
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1551
+        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf);
1552 1552
     }
1553 1553
 
1554 1554
     // Check if there is a custom field specific filter.
1555
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1555
+    if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) {
1556 1556
         /**
1557 1557
          * Filter the taxonomy html by individual custom field.
1558 1558
          *
@@ -1561,11 +1561,11 @@  discard block
 block discarded – undo
1561 1561
          * @param array $cf The custom field array.
1562 1562
          * @since 1.6.6
1563 1563
          */
1564
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1564
+        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf);
1565 1565
     }
1566 1566
 
1567 1567
     // Check if there is a custom field key specific filter.
1568
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1568
+    if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) {
1569 1569
         /**
1570 1570
          * Filter the taxonomy html by field type key.
1571 1571
          *
@@ -1574,14 +1574,14 @@  discard block
 block discarded – undo
1574 1574
          * @param array $cf The custom field array.
1575 1575
          * @since 1.6.6
1576 1576
          */
1577
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1577
+        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf);
1578 1578
     }
1579 1579
 
1580 1580
     // If not html then we run the standard output.
1581
-    if(empty($html)){
1581
+    if (empty($html)) {
1582 1582
 
1583
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1584
-            $post_taxonomy = $post->post_type . 'category';
1583
+        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
1584
+            $post_taxonomy = $post->post_type.'category';
1585 1585
             $field_value = $post->{$html_var};
1586 1586
             $links = array();
1587 1587
             $terms = array();
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
                     if ($term != '') {
1600 1600
                         $term = get_term_by('id', $term, $html_var);
1601 1601
                         if (is_object($term)) {
1602
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1602
+                            $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";
1603 1603
                             $terms[] = $term;
1604 1604
                         }
1605 1605
                     }
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
                     $terms = $termsOrdered;
1614 1614
                 }
1615 1615
             }
1616
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1616
+            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
1617 1617
 
1618 1618
             if ($html_value != '') {
1619 1619
                 $field_icon = geodir_field_icon_proccess($cf);
@@ -1626,9 +1626,9 @@  discard block
 block discarded – undo
1626 1626
                     $field_icon = '';
1627 1627
                 }
1628 1628
 
1629
-                $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;
1630
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1631
-                $html .= '</span> ' . $html_value . '</div>';
1629
+                $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;
1630
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1631
+                $html .= '</span> '.$html_value.'</div>';
1632 1632
             }
1633 1633
         }
1634 1634
 
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
 
1637 1637
     return $html;
1638 1638
 }
1639
-add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1639
+add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3);
1640 1640
 
1641 1641
 
1642 1642
 /**
@@ -1649,21 +1649,21 @@  discard block
 block discarded – undo
1649 1649
  *
1650 1650
  * @return string The html to output for the custom field.
1651 1651
  */
1652
-function geodir_cf_address($html,$location,$cf,$p=''){
1652
+function geodir_cf_address($html, $location, $cf, $p = '') {
1653 1653
 
1654 1654
     // check we have the post value
1655
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1656
-    else{ global $post;}
1655
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1656
+    else { global $post; }
1657 1657
 
1658
-    if(!is_array($cf) && $cf!=''){
1658
+    if (!is_array($cf) && $cf != '') {
1659 1659
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1660
-        if(!$cf){return NULL;}
1660
+        if (!$cf) {return NULL; }
1661 1661
     }
1662 1662
 
1663 1663
     $html_var = $cf['htmlvar_name'];
1664 1664
 
1665 1665
     // Check if there is a location specific filter.
1666
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1666
+    if (has_filter("geodir_custom_field_output_address_loc_{$location}")) {
1667 1667
         /**
1668 1668
          * Filter the address html by location.
1669 1669
          *
@@ -1671,11 +1671,11 @@  discard block
 block discarded – undo
1671 1671
          * @param array $cf The custom field array.
1672 1672
          * @since 1.6.6
1673 1673
          */
1674
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1674
+        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf);
1675 1675
     }
1676 1676
 
1677 1677
     // Check if there is a custom field specific filter.
1678
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1678
+    if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) {
1679 1679
         /**
1680 1680
          * Filter the address html by individual custom field.
1681 1681
          *
@@ -1684,11 +1684,11 @@  discard block
 block discarded – undo
1684 1684
          * @param array $cf The custom field array.
1685 1685
          * @since 1.6.6
1686 1686
          */
1687
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1687
+        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf);
1688 1688
     }
1689 1689
 
1690 1690
     // Check if there is a custom field key specific filter.
1691
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1691
+    if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) {
1692 1692
         /**
1693 1693
          * Filter the address html by field type key.
1694 1694
          *
@@ -1697,14 +1697,14 @@  discard block
 block discarded – undo
1697 1697
          * @param array $cf The custom field array.
1698 1698
          * @since 1.6.6
1699 1699
          */
1700
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1700
+        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf);
1701 1701
     }
1702 1702
 
1703 1703
     // If not html then we run the standard output.
1704
-    if(empty($html)){
1704
+    if (empty($html)) {
1705 1705
 
1706 1706
         global $preview;
1707
-        $html_var = $cf['htmlvar_name'] . '_address';
1707
+        $html_var = $cf['htmlvar_name'].'_address';
1708 1708
 
1709 1709
         if ($cf['extra_fields']) {
1710 1710
 
@@ -1767,10 +1767,10 @@  discard block
 block discarded – undo
1767 1767
 
1768 1768
         if ($post->{$html_var}) {
1769 1769
 
1770
-            $field_icon = geodir_field_icon_proccess( $cf );
1771
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1770
+            $field_icon = geodir_field_icon_proccess($cf);
1771
+            if (strpos($field_icon, 'http') !== false) {
1772 1772
                 $field_icon_af = '';
1773
-            } elseif ( $field_icon == '' ) {
1773
+            } elseif ($field_icon == '') {
1774 1774
                 $field_icon_af = '<i class="fa fa-home"></i>';
1775 1775
             } else {
1776 1776
                 $field_icon_af = $field_icon;
@@ -1779,26 +1779,26 @@  discard block
 block discarded – undo
1779 1779
             
1780 1780
 
1781 1781
 
1782
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1783
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1784
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1782
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1783
+            $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
1784
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
1785 1785
             $html .= '</span>';
1786 1786
 
1787 1787
 
1788
-            if ( $post->post_address ) {
1789
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1788
+            if ($post->post_address) {
1789
+                $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';
1790 1790
             }
1791
-            if ($show_city_in_address && $post->post_city ) {
1792
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1791
+            if ($show_city_in_address && $post->post_city) {
1792
+                $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';
1793 1793
             }
1794
-            if ($show_region_in_address && $post->post_region ) {
1795
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1794
+            if ($show_region_in_address && $post->post_region) {
1795
+                $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>';
1796 1796
             }
1797
-            if ($show_zip_in_address && $post->post_zip ) {
1798
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1797
+            if ($show_zip_in_address && $post->post_zip) {
1798
+                $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>';
1799 1799
             }
1800
-            if ($show_country_in_address && $post->post_country ) {
1801
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1800
+            if ($show_country_in_address && $post->post_country) {
1801
+                $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>';
1802 1802
             }
1803 1803
             $html .= '</div>';
1804 1804
 
@@ -1809,4 +1809,4 @@  discard block
 block discarded – undo
1809 1809
 
1810 1810
     return $html;
1811 1811
 }
1812
-add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1813 1812
\ No newline at end of file
1813
+add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3);
1814 1814
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 2 patches
Indentation   +1105 added lines, -1105 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
-    if ($geodir_theme_location) {
227
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
228
-    } else {
229
-        update_option('geodir_theme_location_nav', '');
230
-    }
225
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+	if ($geodir_theme_location) {
227
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
228
+	} else {
229
+		update_option('geodir_theme_location_nav', '');
230
+	}
231 231
 }
232 232
 
233 233
 /// add action for theme switch to blank previous theme navigation location setting
@@ -248,32 +248,32 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function geodir_add_post_filters()
250 250
 {
251
-    /**
252
-     * Contains all function for filtering listing.
253
-     *
254
-     * @since 1.0.0
255
-     * @package GeoDirectory
256
-     */
257
-    include_once('geodirectory-functions/listing_filters.php');
251
+	/**
252
+	 * Contains all function for filtering listing.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @package GeoDirectory
256
+	 */
257
+	include_once('geodirectory-functions/listing_filters.php');
258 258
 }
259 259
 
260 260
 
261 261
 if (!function_exists('geodir_init_defaults')) {
262
-    /**
263
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
-     *
265
-     * @since 1.0.0
266
-     * @package GeoDirectory
267
-     */
268
-    function geodir_init_defaults()
269
-    {
270
-        if (function_exists('geodir_register_defaults')) {
262
+	/**
263
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
+	 *
265
+	 * @since 1.0.0
266
+	 * @package GeoDirectory
267
+	 */
268
+	function geodir_init_defaults()
269
+	{
270
+		if (function_exists('geodir_register_defaults')) {
271 271
 
272
-            geodir_register_defaults();
272
+			geodir_register_defaults();
273 273
 
274
-        }
274
+		}
275 275
 
276
-    }
276
+	}
277 277
 }
278 278
 
279 279
 
@@ -295,26 +295,26 @@  discard block
 block discarded – undo
295 295
 // CALLED ON 'sidebars_widgets' FILTER
296 296
 
297 297
 if (!function_exists('geodir_restrict_widget')) {
298
-    /**
299
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
-     *
301
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function geodir_restrict_widget()
307
-    {
308
-        global $is_listing, $is_single_place;
298
+	/**
299
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
+	 *
301
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function geodir_restrict_widget()
307
+	{
308
+		global $is_listing, $is_single_place;
309 309
 
310
-        // set is listing	
311
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
310
+		// set is listing	
311
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
312 312
 
313
-        // set is single place
314
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
313
+		// set is single place
314
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
315 315
 
316 316
 
317
-    }
317
+	}
318 318
 }
319 319
 
320 320
 
@@ -335,32 +335,32 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function geodir_detail_page_sidebar_content_sorting()
337 337
 {
338
-    $arr_detail_page_sidebar_content =
339
-        /**
340
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
341
-         *
342
-         * This filter can be used to remove sections of the details page sidebar,
343
-         * add new sections or rearrange the order of the sections.
344
-         *
345
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
-         * @since 1.0.0
347
-         */
348
-        apply_filters('geodir_detail_page_sidebar_content',
349
-            array('geodir_social_sharing_buttons',
350
-                'geodir_share_this_button',
351
-                'geodir_detail_page_google_analytics',
352
-                'geodir_edit_post_link',
353
-                'geodir_detail_page_review_rating',
354
-                'geodir_detail_page_more_info'
355
-            ) // end of array 
356
-        ); // end of apply filter
357
-    if (!empty($arr_detail_page_sidebar_content)) {
358
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
359
-            if (function_exists($content_function)) {
360
-                add_action('geodir_detail_page_sidebar', $content_function);
361
-            }
362
-        }
363
-    }
338
+	$arr_detail_page_sidebar_content =
339
+		/**
340
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
341
+		 *
342
+		 * This filter can be used to remove sections of the details page sidebar,
343
+		 * add new sections or rearrange the order of the sections.
344
+		 *
345
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
+		 * @since 1.0.0
347
+		 */
348
+		apply_filters('geodir_detail_page_sidebar_content',
349
+			array('geodir_social_sharing_buttons',
350
+				'geodir_share_this_button',
351
+				'geodir_detail_page_google_analytics',
352
+				'geodir_edit_post_link',
353
+				'geodir_detail_page_review_rating',
354
+				'geodir_detail_page_more_info'
355
+			) // end of array 
356
+		); // end of apply filter
357
+	if (!empty($arr_detail_page_sidebar_content)) {
358
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
359
+			if (function_exists($content_function)) {
360
+				add_action('geodir_detail_page_sidebar', $content_function);
361
+			}
362
+		}
363
+	}
364 364
 }
365 365
 
366 366
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function geodir_add_to_favourite_link()
377 377
 {
378
-    global $post, $preview;
379
-    if (!$preview && geodir_is_page('detail')) {
380
-        ?>
378
+	global $post, $preview;
379
+	if (!$preview && geodir_is_page('detail')) {
380
+		?>
381 381
         <p class="edit_link">
382 382
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
383 383
         </p>
384 384
     <?php
385
-    }
385
+	}
386 386
 }
387 387
 
388 388
 /**
@@ -396,41 +396,41 @@  discard block
 block discarded – undo
396 396
  */
397 397
 function geodir_social_sharing_buttons()
398 398
 {
399
-    global $preview;
400
-    ob_start(); // Start  buffering;
401
-    /**
402
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
-     *
404
-     * @since 1.0.0
405
-     */
406
-    do_action('geodir_before_social_sharing_buttons');
407
-    if (!$preview) {
408
-        ?>
399
+	global $preview;
400
+	ob_start(); // Start  buffering;
401
+	/**
402
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
+	 *
404
+	 * @since 1.0.0
405
+	 */
406
+	do_action('geodir_before_social_sharing_buttons');
407
+	if (!$preview) {
408
+		?>
409 409
         <div class="likethis">
410 410
             <?php geodir_twitter_tweet_button(); ?>
411 411
             <?php geodir_fb_like_button(); ?>
412 412
             <?php geodir_google_plus_button(); ?>
413 413
         </div>
414 414
     <?php
415
-    }// end of if, if its a preview or not
416
-
417
-    /**
418
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
-     *
420
-     * @since 1.0.0
421
-     */
422
-    do_action('geodir_after_social_sharing_buttons');
423
-    $content_html = ob_get_clean();
424
-    if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
-        /**
428
-         * Filter the geodir_social_sharing_buttons() function content.
429
-         *
430
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
-         */
432
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
-    }
415
+	}// end of if, if its a preview or not
416
+
417
+	/**
418
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
+	 *
420
+	 * @since 1.0.0
421
+	 */
422
+	do_action('geodir_after_social_sharing_buttons');
423
+	$content_html = ob_get_clean();
424
+	if (trim($content_html) != '')
425
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
+		/**
428
+		 * Filter the geodir_social_sharing_buttons() function content.
429
+		 *
430
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
+		 */
432
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
+	}
434 434
 
435 435
 
436 436
 }
@@ -446,39 +446,39 @@  discard block
 block discarded – undo
446 446
  */
447 447
 function geodir_share_this_button()
448 448
 {
449
-    global $preview;
450
-    ob_start(); // Start buffering;
451
-    /**
452
-     * This is called before the share this html in the function geodir_share_this_button()
453
-     *
454
-     * @since 1.0.0
455
-     */
456
-    do_action('geodir_before_share_this_button');
457
-    if (!$preview) {
458
-        ?>
449
+	global $preview;
450
+	ob_start(); // Start buffering;
451
+	/**
452
+	 * This is called before the share this html in the function geodir_share_this_button()
453
+	 *
454
+	 * @since 1.0.0
455
+	 */
456
+	do_action('geodir_before_share_this_button');
457
+	if (!$preview) {
458
+		?>
459 459
         <div class="share clearfix">
460 460
             <?php geodir_share_this_button_code(); ?>
461 461
         </div>
462 462
     <?php
463
-    }// end of if, if its a preview or not
464
-    /**
465
-     * This is called after the share this html in the function geodir_share_this_button()
466
-     *
467
-     * @since 1.0.0
468
-     */
469
-    do_action('geodir_after_share_this_button');
470
-    $content_html = ob_get_clean();
471
-    if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
-        /**
475
-         * Filter the geodir_share_this_button() function content.
476
-         *
477
-         * @param string $content_html The output html of the geodir_share_this_button() function.
478
-         * @since 1.0.0
479
-         */
480
-        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
-    }
463
+	}// end of if, if its a preview or not
464
+	/**
465
+	 * This is called after the share this html in the function geodir_share_this_button()
466
+	 *
467
+	 * @since 1.0.0
468
+	 */
469
+	do_action('geodir_after_share_this_button');
470
+	$content_html = ob_get_clean();
471
+	if (trim($content_html) != '')
472
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
+	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
+		/**
475
+		 * Filter the geodir_share_this_button() function content.
476
+		 *
477
+		 * @param string $content_html The output html of the geodir_share_this_button() function.
478
+		 * @since 1.0.0
479
+		 */
480
+		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
+	}
482 482
 
483 483
 }
484 484
 
@@ -494,46 +494,46 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_edit_post_link()
496 496
 {
497
-    global $post, $preview;
498
-    ob_start(); // Start buffering;
499
-    /**
500
-     * This is called before the edit post link html in the function geodir_edit_post_link()
501
-     *
502
-     * @since 1.0.0
503
-     */
504
-    do_action('geodir_before_edit_post_link');
505
-    if (!$preview) {
506
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
497
+	global $post, $preview;
498
+	ob_start(); // Start buffering;
499
+	/**
500
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
501
+	 *
502
+	 * @since 1.0.0
503
+	 */
504
+	do_action('geodir_before_edit_post_link');
505
+	if (!$preview) {
506
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
507 507
         
508
-        if ($is_current_user_owner) {
509
-            $post_id = $post->ID;
508
+		if ($is_current_user_owner) {
509
+			$post_id = $post->ID;
510 510
             
511
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
-                $post_id = (int)$_REQUEST['pid'];
513
-            }
511
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
+				$post_id = (int)$_REQUEST['pid'];
513
+			}
514 514
 
515
-            $postlink = get_permalink(geodir_add_listing_page_id());
516
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
-        }
519
-    }// end of if, if its a preview or not
520
-    /**
521
-     * This is called after the edit post link html in the function geodir_edit_post_link()
522
-     *
523
-     * @since 1.0.0
524
-     */
525
-    do_action('geodir_after_edit_post_link');
526
-    $content_html = ob_get_clean();
527
-    if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
-        /**
531
-         * Filter the geodir_edit_post_link() function content.
532
-         *
533
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
534
-         */
535
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
-    }
515
+			$postlink = get_permalink(geodir_add_listing_page_id());
516
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
+		}
519
+	}// end of if, if its a preview or not
520
+	/**
521
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
522
+	 *
523
+	 * @since 1.0.0
524
+	 */
525
+	do_action('geodir_after_edit_post_link');
526
+	$content_html = ob_get_clean();
527
+	if (trim($content_html) != '')
528
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
+		/**
531
+		 * Filter the geodir_edit_post_link() function content.
532
+		 *
533
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
534
+		 */
535
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
+	}
537 537
 }
538 538
 
539 539
 /**
@@ -547,41 +547,41 @@  discard block
 block discarded – undo
547 547
  */
548 548
 function geodir_detail_page_google_analytics()
549 549
 {
550
-    global $post;
551
-    $package_info = array();
552
-    $package_info = geodir_post_package_info($package_info, $post);
550
+	global $post;
551
+	$package_info = array();
552
+	$package_info = geodir_post_package_info($package_info, $post);
553 553
 
554
-    $id = trim(get_option('geodir_ga_id'));
554
+	$id = trim(get_option('geodir_ga_id'));
555 555
 
556
-    if (!$id) {
557
-        return; //if no Google Analytics ID then bail.
558
-    }
556
+	if (!$id) {
557
+		return; //if no Google Analytics ID then bail.
558
+	}
559 559
 
560
-    ob_start(); // Start buffering;
561
-    /**
562
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
-     *
564
-     * @since 1.0.0
565
-     */
566
-    do_action('geodir_before_google_analytics');
560
+	ob_start(); // Start buffering;
561
+	/**
562
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
+	 *
564
+	 * @since 1.0.0
565
+	 */
566
+	do_action('geodir_before_google_analytics');
567 567
     
568
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
569
-    /**
570
-     * Filter the time interval to check & refresh new users results.
571
-     *
572
-     * @since 1.5.9
573
-     *
574
-     * @param int $refresh_time Time interval to check & refresh new users results.
575
-     */
576
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
-    $refresh_time = absint($refresh_time * 1000);
568
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
569
+	/**
570
+	 * Filter the time interval to check & refresh new users results.
571
+	 *
572
+	 * @since 1.5.9
573
+	 *
574
+	 * @param int $refresh_time Time interval to check & refresh new users results.
575
+	 */
576
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
+	$refresh_time = absint($refresh_time * 1000);
578 578
     
579
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
579
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
580 580
     
581
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
584
-        ?>
581
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
584
+		?>
585 585
         <script type="text/javascript">
586 586
             var gd_gaTimeOut;
587 587
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -833,15 +833,15 @@  discard block
 block discarded – undo
833 833
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
834 834
 
835 835
                     <?php
836
-                    // Here we list the shorthand days of the week so it can be used in translation.
837
-                    __("Mon",'geodirectory');
838
-                    __("Tue",'geodirectory');
839
-                    __("Wed",'geodirectory');
840
-                    __("Thu",'geodirectory');
841
-                    __("Fri",'geodirectory');
842
-                    __("Sat",'geodirectory');
843
-                    __("Sun",'geodirectory');
844
-                    ?>
836
+					// Here we list the shorthand days of the week so it can be used in translation.
837
+					__("Mon",'geodirectory');
838
+					__("Tue",'geodirectory');
839
+					__("Wed",'geodirectory');
840
+					__("Thu",'geodirectory');
841
+					__("Fri",'geodirectory');
842
+					__("Sat",'geodirectory');
843
+					__("Sun",'geodirectory');
844
+					?>
845 845
 
846 846
                     labels = [
847 847
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1090,24 +1090,24 @@  discard block
 block discarded – undo
1090 1090
         </span>
1091 1091
 
1092 1092
     <?php
1093
-    }
1094
-    /**
1095
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
-     *
1097
-     * @since 1.0.0
1098
-     */
1099
-    do_action('geodir_after_google_analytics');
1100
-    $content_html = ob_get_clean();
1101
-    if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
-        /**
1105
-         * Filter the geodir_edit_post_link() function content.
1106
-         *
1107
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
-         */
1109
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
-    }
1093
+	}
1094
+	/**
1095
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
+	 *
1097
+	 * @since 1.0.0
1098
+	 */
1099
+	do_action('geodir_after_google_analytics');
1100
+	$content_html = ob_get_clean();
1101
+	if (trim($content_html) != '')
1102
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
+		/**
1105
+		 * Filter the geodir_edit_post_link() function content.
1106
+		 *
1107
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
+		 */
1109
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
+	}
1111 1111
 }
1112 1112
 
1113 1113
 /**
@@ -1123,90 +1123,90 @@  discard block
 block discarded – undo
1123 1123
  */
1124 1124
 function geodir_detail_page_review_rating()
1125 1125
 {
1126
-    global $post, $preview, $post_images;
1127
-    ob_start(); // Start  buffering;
1128
-    /**
1129
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
-     *
1131
-     * This is called outside the check for an actual rating and the check for preview page.
1132
-     *
1133
-     * @since 1.0.0
1134
-     */
1135
-    do_action('geodir_before_detail_page_review_rating');
1136
-
1137
-    $comment_count = geodir_get_review_count_total($post->ID);
1138
-    $post_avgratings = geodir_get_post_rating($post->ID);
1139
-
1140
-    if ($post_avgratings != 0 && !$preview) {
1141
-        /**
1142
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
-         *
1144
-         * This is called inside the check for an actual rating and the check for preview page.
1145
-         *
1146
-         * @since 1.0.0
1147
-         * @param float $post_avgratings Average rating for the surrent post.
1148
-         * @param int $post->ID Current post ID.
1149
-         */
1150
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
-
1152
-        $html = '<p style=" float:left;">';
1153
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1126
+	global $post, $preview, $post_images;
1127
+	ob_start(); // Start  buffering;
1128
+	/**
1129
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
+	 *
1131
+	 * This is called outside the check for an actual rating and the check for preview page.
1132
+	 *
1133
+	 * @since 1.0.0
1134
+	 */
1135
+	do_action('geodir_before_detail_page_review_rating');
1136
+
1137
+	$comment_count = geodir_get_review_count_total($post->ID);
1138
+	$post_avgratings = geodir_get_post_rating($post->ID);
1139
+
1140
+	if ($post_avgratings != 0 && !$preview) {
1141
+		/**
1142
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
+		 *
1144
+		 * This is called inside the check for an actual rating and the check for preview page.
1145
+		 *
1146
+		 * @since 1.0.0
1147
+		 * @param float $post_avgratings Average rating for the surrent post.
1148
+		 * @param int $post->ID Current post ID.
1149
+		 */
1150
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
+
1152
+		$html = '<p style=" float:left;">';
1153
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1156 1156
        
1157 1157
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1158 1158
 	   
1159 1159
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1160 1160
 
1161
-        $html .= '<span class="item">';
1162
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1161
+		$html .= '<span class="item">';
1162
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1163 1163
 
1164
-        if ($post_images) {
1165
-            foreach ($post_images as $img) {
1166
-                $post_img = $img->src;
1167
-                break;
1168
-            }
1169
-        }
1170
-
1171
-        if (isset($post_img) && $post_img) {
1172
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
-        }
1174
-
1175
-        $html .= '</span>';
1176
-
1177
-        echo $html .= '</div>';
1178
-        /**
1179
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
-         *
1181
-         * This is called inside the check for an actual rating and the check for preview page.
1182
-         *
1183
-         * @since 1.0.0
1184
-         * @param float $post_avgratings Average rating for the surrent post.
1185
-         * @param int $post->ID Current post ID.
1186
-         */
1187
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
-    }
1189
-    /**
1190
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
-     *
1192
-     * This is called outside the check for an actual rating and the check for preview page.
1193
-     *
1194
-     * @since 1.0.0
1195
-     */
1196
-    do_action('geodir_after_detail_page_review_rating');
1197
-    $content_html = ob_get_clean();
1198
-    if (trim($content_html) != '') {
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
-    }
1201
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
-        /**
1203
-         * Filter the geodir_detail_page_review_rating() function content.
1204
-         *
1205
-         * @since 1.0.0
1206
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
-         */
1208
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
-    }
1164
+		if ($post_images) {
1165
+			foreach ($post_images as $img) {
1166
+				$post_img = $img->src;
1167
+				break;
1168
+			}
1169
+		}
1170
+
1171
+		if (isset($post_img) && $post_img) {
1172
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
+		}
1174
+
1175
+		$html .= '</span>';
1176
+
1177
+		echo $html .= '</div>';
1178
+		/**
1179
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
+		 *
1181
+		 * This is called inside the check for an actual rating and the check for preview page.
1182
+		 *
1183
+		 * @since 1.0.0
1184
+		 * @param float $post_avgratings Average rating for the surrent post.
1185
+		 * @param int $post->ID Current post ID.
1186
+		 */
1187
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
+	}
1189
+	/**
1190
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
+	 *
1192
+	 * This is called outside the check for an actual rating and the check for preview page.
1193
+	 *
1194
+	 * @since 1.0.0
1195
+	 */
1196
+	do_action('geodir_after_detail_page_review_rating');
1197
+	$content_html = ob_get_clean();
1198
+	if (trim($content_html) != '') {
1199
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
+	}
1201
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
+		/**
1203
+		 * Filter the geodir_detail_page_review_rating() function content.
1204
+		 *
1205
+		 * @since 1.0.0
1206
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
+		 */
1208
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
+	}
1210 1210
 }
1211 1211
 
1212 1212
 /**
@@ -1218,35 +1218,35 @@  discard block
 block discarded – undo
1218 1218
  */
1219 1219
 function geodir_detail_page_more_info()
1220 1220
 {
1221
-    ob_start(); // Start  buffering;
1222
-    /**
1223
-     * This is called before the info section html.
1224
-     *
1225
-     * @since 1.0.0
1226
-     */
1227
-    do_action('geodir_before_detail_page_more_info');
1228
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1229
-        echo $geodir_post_detail_fields;
1230
-    }
1231
-    /**
1232
-     * This is called after the info section html.
1233
-     *
1234
-     * @since 1.0.0
1235
-     */
1236
-    do_action('geodir_after_detail_page_more_info');
1237
-
1238
-    $content_html = ob_get_clean();
1239
-    if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
-        /**
1243
-         * Filter the output html for function geodir_detail_page_more_info().
1244
-         *
1245
-         * @since 1.0.0
1246
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
-         */
1248
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
-    }
1221
+	ob_start(); // Start  buffering;
1222
+	/**
1223
+	 * This is called before the info section html.
1224
+	 *
1225
+	 * @since 1.0.0
1226
+	 */
1227
+	do_action('geodir_before_detail_page_more_info');
1228
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1229
+		echo $geodir_post_detail_fields;
1230
+	}
1231
+	/**
1232
+	 * This is called after the info section html.
1233
+	 *
1234
+	 * @since 1.0.0
1235
+	 */
1236
+	do_action('geodir_after_detail_page_more_info');
1237
+
1238
+	$content_html = ob_get_clean();
1239
+	if (trim($content_html) != '')
1240
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
+		/**
1243
+		 * Filter the output html for function geodir_detail_page_more_info().
1244
+		 *
1245
+		 * @since 1.0.0
1246
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
+		 */
1248
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
+	}
1250 1250
 }
1251 1251
 
1252 1252
 
@@ -1260,15 +1260,15 @@  discard block
 block discarded – undo
1260 1260
  */
1261 1261
 function geodir_localize_all_js_msg()
1262 1262
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1263
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
-        $ajax_url = admin_url('admin-ajax.php');
1265
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
-        $ajax_url = admin_url('admin-ajax.php');
1267
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
-    }
1263
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
+		$ajax_url = admin_url('admin-ajax.php');
1265
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
+		$ajax_url = admin_url('admin-ajax.php');
1267
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
+	}
1272 1272
 	
1273 1273
 	/**
1274 1274
 	 * Filter the allowed image type extensions for post images.
@@ -1278,60 +1278,60 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1280 1280
 	
1281
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1282
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
-    $default_marker_width = $default_marker_size['w'];
1284
-    $default_marker_height = $default_marker_size['h'];
1281
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1282
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
+	$default_marker_width = $default_marker_size['w'];
1284
+	$default_marker_height = $default_marker_size['h'];
1285 1285
     
1286
-    $arr_alert_msg = array(
1287
-        'geodir_plugin_url' => geodir_plugin_url(),
1288
-        'geodir_admin_ajax_url' => $ajax_url,
1289
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
-        //start not show alert msg
1294
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
-        // end not show alert msg
1300
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
-        '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'),
1302
-        //start not show alert msg
1303
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1304
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1305
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1306
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1307
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1308
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1309
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1310
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1311
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1312
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1313
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1314
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1315
-        'geodir_default_marker_icon' => $default_marker_icon,
1316
-        'geodir_default_marker_w' => $default_marker_width,
1317
-        'geodir_default_marker_h' => $default_marker_height,
1318
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1319
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1320
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1321
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1322
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1323
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1324
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1325
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1326
-        /* on/off dragging for phone devices */
1327
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1328
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1329
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1330
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1331
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1332
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1333
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1334
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1286
+	$arr_alert_msg = array(
1287
+		'geodir_plugin_url' => geodir_plugin_url(),
1288
+		'geodir_admin_ajax_url' => $ajax_url,
1289
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
+		//start not show alert msg
1294
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
+		// end not show alert msg
1300
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
+		'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'),
1302
+		//start not show alert msg
1303
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1304
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1305
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1306
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1307
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1308
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1309
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1310
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1311
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1312
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1313
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1314
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1315
+		'geodir_default_marker_icon' => $default_marker_icon,
1316
+		'geodir_default_marker_w' => $default_marker_width,
1317
+		'geodir_default_marker_h' => $default_marker_height,
1318
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1319
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1320
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1321
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1322
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1323
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1324
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1325
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1326
+		/* on/off dragging for phone devices */
1327
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1328
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1329
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1330
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1331
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1332
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1333
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1334
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1335 1335
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1336 1336
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1337 1337
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1339,32 +1339,32 @@  discard block
 block discarded – undo
1339 1339
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1340 1340
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1341 1341
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1342
-        'geodir_map_name' => geodir_map_name(),
1343
-        'osmStart' => __('Start', 'geodirectory'),
1344
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1345
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1346
-    );
1347
-
1348
-    /**
1349
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1350
-     *
1351
-     * With this filter you can add, remove or change translated JS strings.
1352
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1353
-     *
1354
-     * @since 1.0.0
1355
-     */
1356
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1357
-
1358
-    foreach ($arr_alert_msg as $key => $value) {
1359
-        if (!is_scalar($value))
1360
-            continue;
1361
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1362
-    }
1342
+		'geodir_map_name' => geodir_map_name(),
1343
+		'osmStart' => __('Start', 'geodirectory'),
1344
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1345
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1346
+	);
1363 1347
 
1364
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1365
-    echo '<script>';
1366
-    echo $script;
1367
-    echo '</script>';
1348
+	/**
1349
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1350
+	 *
1351
+	 * With this filter you can add, remove or change translated JS strings.
1352
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1353
+	 *
1354
+	 * @since 1.0.0
1355
+	 */
1356
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1357
+
1358
+	foreach ($arr_alert_msg as $key => $value) {
1359
+		if (!is_scalar($value))
1360
+			continue;
1361
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1362
+	}
1363
+
1364
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1365
+	echo '<script>';
1366
+	echo $script;
1367
+	echo '</script>';
1368 1368
 }
1369 1369
 
1370 1370
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1380,11 +1380,11 @@  discard block
 block discarded – undo
1380 1380
  */
1381 1381
 function geodir_admin_bar_site_menu($wp_admin_bar)
1382 1382
 {
1383
-    if (get_option("geodir_installed")) {
1384
-        if (current_user_can('manage_options')) {
1385
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1386
-        }
1387
-    }
1383
+	if (get_option("geodir_installed")) {
1384
+		if (current_user_can('manage_options')) {
1385
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1386
+		}
1387
+	}
1388 1388
 }
1389 1389
 
1390 1390
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1410,25 +1410,25 @@  discard block
 block discarded – undo
1410 1410
  */
1411 1411
 function geodir_store_sidebars()
1412 1412
 {
1413
-    global $geodir_sidebars;
1414
-    global $sidebars_widgets;
1415
-
1416
-    if (!is_array($sidebars_widgets))
1417
-        $sidebars_widgets = wp_get_sidebars_widgets();
1418
-    $geodir_old_sidebars = array();
1419
-
1420
-    if (is_array($geodir_sidebars)) {
1421
-        foreach ($geodir_sidebars as $val) {
1422
-            if (is_array($sidebars_widgets)) {
1423
-                if (array_key_exists($val, $sidebars_widgets))
1424
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1425
-                else
1426
-                    $geodir_old_sidebars[$val] = array();
1427
-            }
1428
-        }
1429
-    }
1430
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1431
-    geodir_option_version_backup('geodir_sidebars');
1413
+	global $geodir_sidebars;
1414
+	global $sidebars_widgets;
1415
+
1416
+	if (!is_array($sidebars_widgets))
1417
+		$sidebars_widgets = wp_get_sidebars_widgets();
1418
+	$geodir_old_sidebars = array();
1419
+
1420
+	if (is_array($geodir_sidebars)) {
1421
+		foreach ($geodir_sidebars as $val) {
1422
+			if (is_array($sidebars_widgets)) {
1423
+				if (array_key_exists($val, $sidebars_widgets))
1424
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1425
+				else
1426
+					$geodir_old_sidebars[$val] = array();
1427
+			}
1428
+		}
1429
+	}
1430
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1431
+	geodir_option_version_backup('geodir_sidebars');
1432 1432
 
1433 1433
 }
1434 1434
 
@@ -1442,28 +1442,28 @@  discard block
 block discarded – undo
1442 1442
  */
1443 1443
 function geodir_restore_sidebars()
1444 1444
 {
1445
-    global $sidebars_widgets;
1446
-
1447
-    if (!is_array($sidebars_widgets))
1448
-        $sidebars_widgets = wp_get_sidebars_widgets();
1449
-
1450
-    if (is_array($sidebars_widgets)) {
1451
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1452
-        if (is_array($geodir_old_sidebars)) {
1453
-            foreach ($geodir_old_sidebars as $key => $val) {
1454
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1455
-                {
1456
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1457
-                }
1445
+	global $sidebars_widgets;
1458 1446
 
1447
+	if (!is_array($sidebars_widgets))
1448
+		$sidebars_widgets = wp_get_sidebars_widgets();
1459 1449
 
1460
-            }
1461
-        }
1450
+	if (is_array($sidebars_widgets)) {
1451
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1452
+		if (is_array($geodir_old_sidebars)) {
1453
+			foreach ($geodir_old_sidebars as $key => $val) {
1454
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1455
+				{
1456
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1457
+				}
1462 1458
 
1463
-    }
1464 1459
 
1465
-    update_option('sidebars_widgets', $sidebars_widgets);
1466
-    update_option('geodir_sidebars', '');
1460
+			}
1461
+		}
1462
+
1463
+	}
1464
+
1465
+	update_option('sidebars_widgets', $sidebars_widgets);
1466
+	update_option('geodir_sidebars', '');
1467 1467
 }
1468 1468
 
1469 1469
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1476,9 +1476,9 @@  discard block
 block discarded – undo
1476 1476
  */
1477 1477
 function geodir_after_listing_post_gridview()
1478 1478
 {
1479
-    global $gridview_columns;
1479
+	global $gridview_columns;
1480 1480
 
1481
-    $gridview_columns = '';
1481
+	$gridview_columns = '';
1482 1482
 
1483 1483
 }
1484 1484
 
@@ -1506,11 +1506,11 @@  discard block
 block discarded – undo
1506 1506
  */
1507 1507
 function so_handle_038($url, $original_url, $_context)
1508 1508
 {
1509
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1510
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1511
-    }
1509
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1510
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1511
+	}
1512 1512
 
1513
-    return $url;
1513
+	return $url;
1514 1514
 }
1515 1515
 
1516 1516
 
@@ -1526,34 +1526,34 @@  discard block
 block discarded – undo
1526 1526
 function geodir_after_main_form_fields() {
1527 1527
 	global $gd_session;
1528 1528
 	
1529
-    if (get_option('geodir_accept_term_condition')) {
1530
-        global $post;
1531
-        $term_condition = '';
1532
-        if (isset($_REQUEST['backandedit'])) {
1533
-            $post = (object)$gd_session->get('listing');
1534
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1535
-        }
1536
-
1537
-        ?>
1529
+	if (get_option('geodir_accept_term_condition')) {
1530
+		global $post;
1531
+		$term_condition = '';
1532
+		if (isset($_REQUEST['backandedit'])) {
1533
+			$post = (object)$gd_session->get('listing');
1534
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1535
+		}
1536
+
1537
+		?>
1538 1538
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1539 1539
             <label>&nbsp;</label>
1540 1540
 
1541 1541
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1542 1542
 				<span style="display:block"> 
1543 1543
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1544
-                    echo 'checked="checked"';
1545
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1544
+					echo 'checked="checked"';
1545
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1546 1546
                        class="geodir_textfield" value="1"
1547 1547
                        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>
1548 1548
 				</span>
1549 1549
             </div>
1550 1550
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1551
-                    _e($required_msg, 'geodirectory');
1552
-                } ?></span>
1551
+					_e($required_msg, 'geodirectory');
1552
+				} ?></span>
1553 1553
         </div>
1554 1554
     <?php
1555 1555
 
1556
-    }
1556
+	}
1557 1557
 }
1558 1558
 
1559 1559
 
@@ -1578,42 +1578,42 @@  discard block
 block discarded – undo
1578 1578
  */
1579 1579
 function geodir_detail_page_tab_is_display($is_display, $tab)
1580 1580
 {
1581
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1581
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1582 1582
 
1583
-    if ($tab == 'post_profile') {
1584
-        /** This action is documented in geodirectory_template_actions.php */
1585
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1583
+	if ($tab == 'post_profile') {
1584
+		/** This action is documented in geodirectory_template_actions.php */
1585
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1586 1586
         
1587
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1588
-            $is_display = false;
1589
-        }
1590
-    }
1587
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1588
+			$is_display = false;
1589
+		}
1590
+	}
1591 1591
     
1592
-    if ($tab == 'post_info')
1593
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1592
+	if ($tab == 'post_info')
1593
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1594 1594
     
1595
-    if ($tab == 'post_images')
1596
-        $is_display = (!empty($post_images)) ? true : false;
1595
+	if ($tab == 'post_images')
1596
+		$is_display = (!empty($post_images)) ? true : false;
1597 1597
 
1598
-    if ($tab == 'post_video')
1599
-        $is_display = (!empty($video)) ? true : false;
1598
+	if ($tab == 'post_video')
1599
+		$is_display = (!empty($video)) ? true : false;
1600 1600
 
1601
-    if ($tab == 'special_offers')
1602
-        $is_display = (!empty($special_offers)) ? true : false;
1601
+	if ($tab == 'special_offers')
1602
+		$is_display = (!empty($special_offers)) ? true : false;
1603 1603
 
1604
-    if ($tab == 'reviews')
1605
-        $is_display = (geodir_is_page('detail')) ? true : false;
1604
+	if ($tab == 'reviews')
1605
+		$is_display = (geodir_is_page('detail')) ? true : false;
1606 1606
 
1607
-    if ($tab == 'related_listing') {
1608
-       $message = __('No listings found which match your selection.', 'geodirectory');
1607
+	if ($tab == 'related_listing') {
1608
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1609 1609
        
1610
-       /** This action is documented in geodirectory-functions/template_functions.php */
1611
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1610
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1611
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1612 1612
        
1613
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1614
-    }
1613
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1614
+	}
1615 1615
 
1616
-    return $is_display;
1616
+	return $is_display;
1617 1617
 }
1618 1618
 
1619 1619
 
@@ -1629,69 +1629,69 @@  discard block
 block discarded – undo
1629 1629
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1630 1630
  */
1631 1631
 function geodir_changes_in_custom_fields_table() {
1632
-    global $wpdb, $plugin_prefix;
1632
+	global $wpdb, $plugin_prefix;
1633 1633
 	
1634 1634
 	// Remove unused virtual page
1635 1635
 	$listings_page_id = (int)get_option('geodir_listing_page');
1636 1636
 	if ($listings_page_id) {
1637 1637
 		$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')));
1638
-        delete_option('geodir_listing_page');
1638
+		delete_option('geodir_listing_page');
1639 1639
 	}
1640 1640
 
1641
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1642
-        $wpdb->query(
1643
-            $wpdb->prepare(
1644
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1645
-                array('1', '1', 'admin')
1646
-            )
1647
-        );
1641
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1642
+		$wpdb->query(
1643
+			$wpdb->prepare(
1644
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1645
+				array('1', '1', 'admin')
1646
+			)
1647
+		);
1648 1648
 
1649 1649
 
1650
-        /* --- terms meta value set --- */
1650
+		/* --- terms meta value set --- */
1651 1651
 
1652
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1652
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1653 1653
 
1654
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1654
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1655 1655
 
1656
-        if (!empty($options_data)) {
1656
+		if (!empty($options_data)) {
1657 1657
 
1658
-            foreach ($options_data as $optobj) {
1658
+			foreach ($options_data as $optobj) {
1659 1659
 
1660
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1660
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1661 1661
 
1662
-                $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)));
1662
+				$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)));
1663 1663
 
1664
-                if (!empty($taxonomies_data)) {
1664
+				if (!empty($taxonomies_data)) {
1665 1665
 
1666
-                    foreach ($taxonomies_data as $taxobj) {
1666
+					foreach ($taxonomies_data as $taxobj) {
1667 1667
 
1668
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1669
-                        $post_type = $taxObject->object_type[0];
1668
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1669
+						$post_type = $taxObject->object_type[0];
1670 1670
 
1671
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1671
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1672 1672
 
1673
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1673
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1674 1674
 
1675
-                        if ($duplicate_data) {
1675
+						if ($duplicate_data) {
1676 1676
 
1677
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1677
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1678 1678
 
1679
-                        } else {
1679
+						} else {
1680 1680
 
1681
-                            $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)));
1681
+							$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)));
1682 1682
 
1683
-                        }
1683
+						}
1684 1684
 
1685
-                    }
1685
+					}
1686 1686
 
1687
-                }
1687
+				}
1688 1688
 
1689
-            }
1690
-        }
1689
+			}
1690
+		}
1691 1691
 
1692
-        update_option('geodir_changes_in_custom_fields_table', '1');
1692
+		update_option('geodir_changes_in_custom_fields_table', '1');
1693 1693
 
1694
-    }
1694
+	}
1695 1695
 
1696 1696
 }
1697 1697
 
@@ -1710,24 +1710,24 @@  discard block
 block discarded – undo
1710 1710
 function geodir_location_slug_check($slug)
1711 1711
 {
1712 1712
 
1713
-    global $wpdb, $table_prefix;
1713
+	global $wpdb, $table_prefix;
1714 1714
 
1715
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1715
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1716 1716
 
1717
-    if ($slug_exists) {
1717
+	if ($slug_exists) {
1718 1718
 
1719
-        $suffix = 1;
1720
-        do {
1721
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1722
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1723
-            $suffix++;
1724
-        } while ($location_slug_check && $suffix < 100);
1719
+		$suffix = 1;
1720
+		do {
1721
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1722
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1723
+			$suffix++;
1724
+		} while ($location_slug_check && $suffix < 100);
1725 1725
 
1726
-        $slug = $alt_location_name;
1726
+		$slug = $alt_location_name;
1727 1727
 
1728
-    }
1728
+	}
1729 1729
 
1730
-    return $slug;
1730
+	return $slug;
1731 1731
 
1732 1732
 }
1733 1733
 
@@ -1752,42 +1752,42 @@  discard block
 block discarded – undo
1752 1752
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1753 1753
 {
1754 1754
 
1755
-    global $wpdb, $plugin_prefix, $table_prefix;
1755
+	global $wpdb, $plugin_prefix, $table_prefix;
1756 1756
 
1757
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1757
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1758 1758
 
1759
-    $slug = $tern_data->slug;
1759
+	$slug = $tern_data->slug;
1760 1760
 
1761
-    /**
1762
-     * Filter if a term slug exists.
1763
-     *
1764
-     * @since 1.0.0
1765
-     * @package GeoDirectory
1766
-     * @param bool $bool Default: false.
1767
-     * @param string $slug The term slug.
1768
-     * @param int $term_id The term ID.
1769
-     */
1770
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1761
+	/**
1762
+	 * Filter if a term slug exists.
1763
+	 *
1764
+	 * @since 1.0.0
1765
+	 * @package GeoDirectory
1766
+	 * @param bool $bool Default: false.
1767
+	 * @param string $slug The term slug.
1768
+	 * @param int $term_id The term ID.
1769
+	 */
1770
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1771 1771
 
1772
-    if ($slug_exists) {
1772
+	if ($slug_exists) {
1773 1773
 
1774
-        $suffix = 1;
1775
-        do {
1776
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1774
+		$suffix = 1;
1775
+		do {
1776
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1777 1777
 
1778
-            /** This action is documented in geodirectory_hooks_actions.php */
1779
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1778
+			/** This action is documented in geodirectory_hooks_actions.php */
1779
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1780 1780
 
1781
-            $suffix++;
1782
-        } while ($term_slug_check && $suffix < 100);
1781
+			$suffix++;
1782
+		} while ($term_slug_check && $suffix < 100);
1783 1783
 
1784
-        $slug = $new_slug;
1784
+		$slug = $new_slug;
1785 1785
 
1786
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1786
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1787 1787
 
1788
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1788
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1789 1789
 
1790
-    }
1790
+	}
1791 1791
 	
1792 1792
 	// Update tag in detail table.
1793 1793
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1828,21 +1828,21 @@  discard block
 block discarded – undo
1828 1828
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1829 1829
 {
1830 1830
 
1831
-    global $wpdb, $table_prefix;
1831
+	global $wpdb, $table_prefix;
1832 1832
 
1833
-    $default_location = geodir_get_default_location();
1833
+	$default_location = geodir_get_default_location();
1834 1834
 
1835
-    $country_slug = $default_location->country_slug;
1836
-    $region_slug = $default_location->region_slug;
1837
-    $city_slug = $default_location->city_slug;
1835
+	$country_slug = $default_location->country_slug;
1836
+	$region_slug = $default_location->region_slug;
1837
+	$city_slug = $default_location->city_slug;
1838 1838
 
1839
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1840
-        return $slug_exists = true;
1839
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1840
+		return $slug_exists = true;
1841 1841
 
1842
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1843
-        return $slug_exists = true;
1842
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1843
+		return $slug_exists = true;
1844 1844
 
1845
-    return $slug_exists;
1845
+	return $slug_exists;
1846 1846
 }
1847 1847
 
1848 1848
 
@@ -1861,75 +1861,75 @@  discard block
 block discarded – undo
1861 1861
  */
1862 1862
 function geodir_custom_page_title($title = '', $sep = '')
1863 1863
 {
1864
-    global $wp;
1865
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1866
-        return $title;
1867
-    }
1864
+	global $wp;
1865
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1866
+		return $title;
1867
+	}
1868 1868
 
1869
-    if ($sep == '') {
1870
-        /**
1871
-         * Filter the page title separator.
1872
-         *
1873
-         * @since 1.0.0
1874
-         * @package GeoDirectory
1875
-         * @param string $sep The separator, default: `|`.
1876
-         */
1877
-        $sep = apply_filters('geodir_page_title_separator', '|');
1878
-    }
1869
+	if ($sep == '') {
1870
+		/**
1871
+		 * Filter the page title separator.
1872
+		 *
1873
+		 * @since 1.0.0
1874
+		 * @package GeoDirectory
1875
+		 * @param string $sep The separator, default: `|`.
1876
+		 */
1877
+		$sep = apply_filters('geodir_page_title_separator', '|');
1878
+	}
1879 1879
 
1880 1880
 
1881
-    $gd_page = '';
1882
-    if(geodir_is_page('home')){
1883
-        $gd_page = 'home';
1884
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1885
-    }
1886
-    elseif(geodir_is_page('detail')){
1887
-        $gd_page = 'detail';
1888
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1889
-    }
1890
-    elseif(geodir_is_page('pt')){
1891
-        $gd_page = 'pt';
1892
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1893
-    }
1894
-    elseif(geodir_is_page('listing')){
1895
-        $gd_page = 'listing';
1896
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1897
-    }
1898
-    elseif(geodir_is_page('location')){
1899
-        $gd_page = 'location';
1900
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1901
-    }
1902
-    elseif(geodir_is_page('search')){
1903
-        $gd_page = 'search';
1904
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1905
-    }
1906
-    elseif(geodir_is_page('add-listing')){
1907
-        $gd_page = 'add-listing';
1908
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1909
-    }
1910
-    elseif(geodir_is_page('author')){
1911
-        $gd_page = 'author';
1912
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1913
-    }
1914
-    elseif(geodir_is_page('login')){
1915
-        $gd_page = 'login';
1916
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1917
-    }
1918
-    elseif(geodir_is_page('listing-success')){
1919
-        $gd_page = 'listing-success';
1920
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1921
-    }
1881
+	$gd_page = '';
1882
+	if(geodir_is_page('home')){
1883
+		$gd_page = 'home';
1884
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1885
+	}
1886
+	elseif(geodir_is_page('detail')){
1887
+		$gd_page = 'detail';
1888
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1889
+	}
1890
+	elseif(geodir_is_page('pt')){
1891
+		$gd_page = 'pt';
1892
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1893
+	}
1894
+	elseif(geodir_is_page('listing')){
1895
+		$gd_page = 'listing';
1896
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1897
+	}
1898
+	elseif(geodir_is_page('location')){
1899
+		$gd_page = 'location';
1900
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1901
+	}
1902
+	elseif(geodir_is_page('search')){
1903
+		$gd_page = 'search';
1904
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1905
+	}
1906
+	elseif(geodir_is_page('add-listing')){
1907
+		$gd_page = 'add-listing';
1908
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1909
+	}
1910
+	elseif(geodir_is_page('author')){
1911
+		$gd_page = 'author';
1912
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1913
+	}
1914
+	elseif(geodir_is_page('login')){
1915
+		$gd_page = 'login';
1916
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1917
+	}
1918
+	elseif(geodir_is_page('listing-success')){
1919
+		$gd_page = 'listing-success';
1920
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1921
+	}
1922 1922
 
1923 1923
 
1924
-    /**
1925
-     * Filter page meta title to replace variables.
1926
-     *
1927
-     * @since 1.5.4
1928
-     * @param string $title The page title including variables.
1929
-     * @param string $gd_page The GeoDirectory page type if any.
1930
-     * @param string $sep The title separator symbol.
1931
-     */
1932
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1924
+	/**
1925
+	 * Filter page meta title to replace variables.
1926
+	 *
1927
+	 * @since 1.5.4
1928
+	 * @param string $title The page title including variables.
1929
+	 * @param string $gd_page The GeoDirectory page type if any.
1930
+	 * @param string $sep The title separator symbol.
1931
+	 */
1932
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1933 1933
 
1934 1934
 }
1935 1935
 
@@ -1945,36 +1945,36 @@  discard block
 block discarded – undo
1945 1945
 function geodir_set_post_attachment()
1946 1946
 {
1947 1947
 
1948
-    if (!get_option('geodir_set_post_attachments')) {
1948
+	if (!get_option('geodir_set_post_attachments')) {
1949 1949
 
1950
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1951
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1950
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1951
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1952 1952
 
1953
-        $all_postypes = geodir_get_posttypes();
1953
+		$all_postypes = geodir_get_posttypes();
1954 1954
 
1955
-        foreach($all_postypes as $post_type){
1956
-            $args = array(
1957
-                'posts_per_page' => -1,
1958
-                'post_type' => $post_type,
1959
-                'post_status' => 'publish');
1955
+		foreach($all_postypes as $post_type){
1956
+			$args = array(
1957
+				'posts_per_page' => -1,
1958
+				'post_type' => $post_type,
1959
+				'post_status' => 'publish');
1960 1960
 
1961
-            $posts_array = get_posts($args);
1961
+			$posts_array = get_posts($args);
1962 1962
 
1963
-            if (!empty($posts_array)) {
1963
+			if (!empty($posts_array)) {
1964 1964
 
1965
-                foreach ($posts_array as $post) {
1965
+				foreach ($posts_array as $post) {
1966 1966
 
1967
-                    geodir_set_wp_featured_image($post->ID);
1967
+					geodir_set_wp_featured_image($post->ID);
1968 1968
 
1969
-                }
1969
+				}
1970 1970
 
1971
-            }
1972
-        }
1971
+			}
1972
+		}
1973 1973
 
1974 1974
 
1975
-        update_option('geodir_set_post_attachments', '1');
1975
+		update_option('geodir_set_post_attachments', '1');
1976 1976
 
1977
-    }
1977
+	}
1978 1978
 
1979 1979
 }
1980 1980
 
@@ -1991,19 +1991,19 @@  discard block
 block discarded – undo
1991 1991
 function geodir_remove_url_seperator()
1992 1992
 {
1993 1993
 
1994
-    if (!get_option('geodir_remove_url_seperator')) {
1994
+	if (!get_option('geodir_remove_url_seperator')) {
1995 1995
 
1996
-        if (get_option('geodir_listingurl_separator'))
1997
-            delete_option('geodir_listingurl_separator');
1996
+		if (get_option('geodir_listingurl_separator'))
1997
+			delete_option('geodir_listingurl_separator');
1998 1998
 
1999
-        if (get_option('geodir_detailurl_separator'))
2000
-            delete_option('geodir_detailurl_separator');
1999
+		if (get_option('geodir_detailurl_separator'))
2000
+			delete_option('geodir_detailurl_separator');
2001 2001
 
2002
-        flush_rewrite_rules(false);
2002
+		flush_rewrite_rules(false);
2003 2003
 
2004
-        update_option('geodir_remove_url_seperator', '1');
2004
+		update_option('geodir_remove_url_seperator', '1');
2005 2005
 
2006
-    }
2006
+	}
2007 2007
 
2008 2008
 }
2009 2009
 
@@ -2019,19 +2019,19 @@  discard block
 block discarded – undo
2019 2019
  */
2020 2020
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2021 2021
 {
2022
-    foreach ($permalink_arr as $key => $value) {
2022
+	foreach ($permalink_arr as $key => $value) {
2023 2023
 
2024
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2025
-            unset($permalink_arr[$key]);
2024
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2025
+			unset($permalink_arr[$key]);
2026 2026
 
2027
-    }
2027
+	}
2028 2028
 
2029
-    return $permalink_arr;
2029
+	return $permalink_arr;
2030 2030
 
2031 2031
 }
2032 2032
 
2033 2033
 if (!is_admin()) {
2034
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2034
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2035 2035
 }
2036 2036
 /**
2037 2037
  * Set status from draft to publish.
@@ -2044,16 +2044,16 @@  discard block
 block discarded – undo
2044 2044
  */
2045 2045
 function geodir_set_status_draft_to_publish_for_own_post($post)
2046 2046
 {
2047
-    $user_id = get_current_user_id();
2047
+	$user_id = get_current_user_id();
2048 2048
 
2049
-    if(!$user_id){return $post;}
2049
+	if(!$user_id){return $post;}
2050 2050
 
2051
-    $gd_post_types = geodir_get_posttypes();
2051
+	$gd_post_types = geodir_get_posttypes();
2052 2052
 
2053
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2054
-        $post[0]->post_status = 'publish';
2055
-    }
2056
-    return $post;
2053
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2054
+		$post[0]->post_status = 'publish';
2055
+	}
2056
+	return $post;
2057 2057
 }
2058 2058
 
2059 2059
 
@@ -2145,33 +2145,33 @@  discard block
 block discarded – undo
2145 2145
  */
2146 2146
 function geodir_detail_page_tab_headings_change($tabs_arr)
2147 2147
 {
2148
-    global $wpdb;
2148
+	global $wpdb;
2149 2149
 
2150
-    $post_type = geodir_get_current_posttype();
2150
+	$post_type = geodir_get_current_posttype();
2151 2151
 
2152
-    $all_postypes = geodir_get_posttypes();
2152
+	$all_postypes = geodir_get_posttypes();
2153 2153
 
2154
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2154
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2155 2155
 
2156
-        if (array_key_exists('post_video', $tabs_arr)) {
2156
+		if (array_key_exists('post_video', $tabs_arr)) {
2157 2157
 
2158
-            $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)));
2158
+			$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)));
2159 2159
 
2160
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2161
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2162
-        }
2160
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2161
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2162
+		}
2163 2163
 
2164
-        if (array_key_exists('special_offers', $tabs_arr)) {
2164
+		if (array_key_exists('special_offers', $tabs_arr)) {
2165 2165
 
2166
-            $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)));
2166
+			$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)));
2167 2167
 
2168
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2169
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2170
-        }
2168
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2169
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2170
+		}
2171 2171
 
2172
-    }
2172
+	}
2173 2173
 
2174
-    return $tabs_arr;
2174
+	return $tabs_arr;
2175 2175
 
2176 2176
 }
2177 2177
 
@@ -2184,10 +2184,10 @@  discard block
 block discarded – undo
2184 2184
  */
2185 2185
 function geodir_remove_template_redirect_actions()
2186 2186
 {
2187
-    if (geodir_is_page('login')){
2188
-        remove_all_actions('template_redirect');
2189
-        remove_action('init', 'avia_modify_front', 10);
2190
-    }
2187
+	if (geodir_is_page('login')){
2188
+		remove_all_actions('template_redirect');
2189
+		remove_action('init', 'avia_modify_front', 10);
2190
+	}
2191 2191
 }
2192 2192
 
2193 2193
 
@@ -2209,51 +2209,51 @@  discard block
 block discarded – undo
2209 2209
 function geodirectory_before_featured_image_delete($attachment_id)
2210 2210
 {
2211 2211
 
2212
-    global $wpdb, $plugin_prefix;
2212
+	global $wpdb, $plugin_prefix;
2213 2213
 
2214
-    $post_id = get_post_field('post_parent', $attachment_id);
2214
+	$post_id = get_post_field('post_parent', $attachment_id);
2215 2215
 
2216
-    $attachment_url = wp_get_attachment_url($attachment_id);
2216
+	$attachment_url = wp_get_attachment_url($attachment_id);
2217 2217
 
2218
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2218
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2219 2219
 
2220
-        $post_type = get_post_type($post_id);
2220
+		$post_type = get_post_type($post_id);
2221 2221
 
2222
-        $all_postypes = geodir_get_posttypes();
2222
+		$all_postypes = geodir_get_posttypes();
2223 2223
 
2224
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2225
-            return false;
2224
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2225
+			return false;
2226 2226
 
2227
-        $uploads = wp_upload_dir();
2227
+		$uploads = wp_upload_dir();
2228 2228
 
2229
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2229
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2230 2230
 
2231
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2231
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2232 2232
 
2233
-        $wpdb->query(
2234
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2235
-                array($post_id, $split_img_file_path)
2236
-            )
2237
-        );
2233
+		$wpdb->query(
2234
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2235
+				array($post_id, $split_img_file_path)
2236
+			)
2237
+		);
2238 2238
 
2239
-        $attachment_data = $wpdb->get_row(
2240
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2241
-                array($post_id)
2242
-            )
2243
-        );
2239
+		$attachment_data = $wpdb->get_row(
2240
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2241
+				array($post_id)
2242
+			)
2243
+		);
2244 2244
 
2245
-        if (!empty($attachment_data)) {
2246
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2247
-        }
2245
+		if (!empty($attachment_data)) {
2246
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2247
+		}
2248 2248
 
2249 2249
 
2250
-        $table_name = $plugin_prefix . $post_type . '_detail';
2250
+		$table_name = $plugin_prefix . $post_type . '_detail';
2251 2251
 
2252
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2252
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2253 2253
 
2254
-        geodir_set_wp_featured_image($post_id);
2254
+		geodir_set_wp_featured_image($post_id);
2255 2255
 
2256
-    }
2256
+	}
2257 2257
 
2258 2258
 }
2259 2259
 
@@ -2271,79 +2271,79 @@  discard block
 block discarded – undo
2271 2271
 function geodir_temp_set_post_attachment()
2272 2272
 {
2273 2273
 
2274
-    global $wpdb, $plugin_prefix;
2274
+	global $wpdb, $plugin_prefix;
2275 2275
 
2276
-    $all_postypes = geodir_get_posttypes();
2276
+	$all_postypes = geodir_get_posttypes();
2277 2277
 
2278
-    foreach ($all_postypes as $posttype) {
2278
+	foreach ($all_postypes as $posttype) {
2279 2279
 
2280
-        $tablename = $plugin_prefix . $posttype . '_detail';
2280
+		$tablename = $plugin_prefix . $posttype . '_detail';
2281 2281
 
2282
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2282
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2283 2283
 
2284
-        if (!empty($get_post_data)) {
2284
+		if (!empty($get_post_data)) {
2285 2285
 
2286
-            foreach ($get_post_data as $data) {
2286
+			foreach ($get_post_data as $data) {
2287 2287
 
2288
-                $post_id = $data->post_id;
2288
+				$post_id = $data->post_id;
2289 2289
 
2290
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2290
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2291 2291
 
2292
-                if (!empty($attachment_data)) {
2292
+				if (!empty($attachment_data)) {
2293 2293
 
2294
-                    foreach ($attachment_data as $attach) {
2294
+					foreach ($attachment_data as $attach) {
2295 2295
 
2296
-                        $file_info = pathinfo($attach->file);
2296
+						$file_info = pathinfo($attach->file);
2297 2297
 
2298
-                        $sub_dir = '';
2299
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2300
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2298
+						$sub_dir = '';
2299
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2300
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2301 2301
 
2302
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2303
-                        $uploads_path = $uploads['basedir'];
2302
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2303
+						$uploads_path = $uploads['basedir'];
2304 2304
 
2305
-                        $file_name = $file_info['basename'];
2305
+						$file_name = $file_info['basename'];
2306 2306
 
2307
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2307
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2308 2308
 
2309
-                        if (!file_exists($img_arr['path'])) {
2309
+						if (!file_exists($img_arr['path'])) {
2310 2310
 
2311
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2311
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2312 2312
 
2313
-                        }
2313
+						}
2314 2314
 
2315
-                    }
2315
+					}
2316 2316
 
2317
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2317
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2318 2318
 
2319
-                    if (!empty($attachment_data)) {
2319
+					if (!empty($attachment_data)) {
2320 2320
 
2321
-                        if ($attachment_data->ID)
2322
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2321
+						if ($attachment_data->ID)
2322
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2323 2323
 
2324
-                    } else {
2324
+					} else {
2325 2325
 
2326
-                        if (has_post_thumbnail($post_id)) {
2326
+						if (has_post_thumbnail($post_id)) {
2327 2327
 
2328
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2328
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2329 2329
 
2330
-                            wp_delete_attachment($post_thumbnail_id);
2330
+							wp_delete_attachment($post_thumbnail_id);
2331 2331
 
2332
-                        }
2332
+						}
2333 2333
 
2334
-                    }
2334
+					}
2335 2335
 
2336
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2336
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2337 2337
 
2338
-                    geodir_set_wp_featured_image($post_id);
2338
+					geodir_set_wp_featured_image($post_id);
2339 2339
 
2340
-                }
2340
+				}
2341 2341
 
2342
-            }
2342
+			}
2343 2343
 
2344
-        }
2344
+		}
2345 2345
 
2346
-    }
2346
+	}
2347 2347
 
2348 2348
 }
2349 2349
 
@@ -2361,9 +2361,9 @@  discard block
 block discarded – undo
2361 2361
 function geodir_default_rating_star_icon()
2362 2362
 {
2363 2363
 
2364
-    if (!get_option('geodir_default_rating_star_icon')) {
2365
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2366
-    }
2364
+	if (!get_option('geodir_default_rating_star_icon')) {
2365
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2366
+	}
2367 2367
 
2368 2368
 }
2369 2369
 
@@ -2381,27 +2381,27 @@  discard block
 block discarded – undo
2381 2381
  */
2382 2382
 function geodir_user_post_listing_count($user_id=null)
2383 2383
 {
2384
-    global $wpdb, $plugin_prefix, $current_user;
2385
-    if(!$user_id){
2386
-        $user_id = $current_user->ID;
2387
-    }
2384
+	global $wpdb, $plugin_prefix, $current_user;
2385
+	if(!$user_id){
2386
+		$user_id = $current_user->ID;
2387
+	}
2388 2388
 
2389
-    $user_id = $current_user->ID;
2390
-    $all_postypes = geodir_get_posttypes();
2391
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2389
+	$user_id = $current_user->ID;
2390
+	$all_postypes = geodir_get_posttypes();
2391
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2392 2392
 
2393
-    $user_listing = array();
2394
-    if (is_array($all_posts) && !empty($all_posts)) {
2395
-        foreach ($all_posts as $ptype) {
2396
-            $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' )");
2393
+	$user_listing = array();
2394
+	if (is_array($all_posts) && !empty($all_posts)) {
2395
+		foreach ($all_posts as $ptype) {
2396
+			$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' )");
2397 2397
 
2398
-            if ($total_posts > 0) {
2399
-                $user_listing[$ptype] = $total_posts;
2400
-            }
2401
-        }
2402
-    }
2398
+			if ($total_posts > 0) {
2399
+				$user_listing[$ptype] = $total_posts;
2400
+			}
2401
+		}
2402
+	}
2403 2403
 
2404
-    return $user_listing;
2404
+	return $user_listing;
2405 2405
 }
2406 2406
 
2407 2407
 
@@ -2421,189 +2421,189 @@  discard block
 block discarded – undo
2421 2421
  */
2422 2422
 function geodir_detail_page_custom_field_tab($tabs_arr)
2423 2423
 {
2424
-    global $post;
2425
-
2426
-    $post_type = geodir_get_current_posttype();
2427
-    $all_postypes = geodir_get_posttypes();
2428
-
2429
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2430
-        $package_info = array();
2431
-        $package_info = geodir_post_package_info($package_info, $post);
2432
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2433
-        $fields_location = 'owntab';
2434
-
2435
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2436
-
2437
-        //remove video and special offers if it is already set to show
2438
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2439
-            $unset_video = true;
2440
-        }
2441
-
2442
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2443
-            $unset_special_offers = true;
2444
-        }
2445
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2446
-            foreach($custom_fields as $key => $custom_field){
2447
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2448
-                    unset($custom_fields[$key]);
2449
-                }
2450
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2451
-                    unset($custom_fields[$key]);
2452
-                }
2453
-            }
2454
-        }
2424
+	global $post;
2455 2425
 
2426
+	$post_type = geodir_get_current_posttype();
2427
+	$all_postypes = geodir_get_posttypes();
2456 2428
 
2429
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2430
+		$package_info = array();
2431
+		$package_info = geodir_post_package_info($package_info, $post);
2432
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2433
+		$fields_location = 'owntab';
2457 2434
 
2458
-        if (!empty($custom_fields)) {
2459
-            $parse_custom_fields = array();
2460
-            foreach ($custom_fields as $field) {
2461
-                $field = stripslashes_deep($field); // strip slashes
2462
-                
2463
-                $type = $field;
2464
-                $field_name = $field['htmlvar_name'];
2465
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2466
-                    $post->{$field_name} = $_REQUEST[$field_name];
2467
-                }
2468
-
2469
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2470
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2471
-                        continue;
2472
-                    }
2435
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2473 2436
 
2474
-                    $parse_custom_fields[] = $field;
2475
-                }
2476
-            }
2477
-            $custom_fields = $parse_custom_fields;
2478
-        }
2479
-        //print_r($custom_fields);
2480
-        if (!empty($custom_fields)) {
2481
-
2482
-            global $field_set_start;
2437
+		//remove video and special offers if it is already set to show
2438
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2439
+			$unset_video = true;
2440
+		}
2483 2441
 
2484
-            $post = stripslashes_deep($post); // strip slashes
2485
-            
2486
-            $field_set_start = 0;
2487
-            $fieldset_count = 0;
2488
-            $fieldset = '';
2489
-            $total_fields = count($custom_fields);
2490
-            $count_field = 0;
2491
-            $fieldset_arr = array();
2492
-            $i = 0;
2493
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2494
-
2495
-            foreach ($custom_fields as $field) {
2496
-                $count_field++;
2497
-                $field_name = $field['htmlvar_name'];
2498
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2499
-                    $post->{$field_name} = $_REQUEST[$field_name];
2500
-                }
2442
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2443
+			$unset_special_offers = true;
2444
+		}
2445
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2446
+			foreach($custom_fields as $key => $custom_field){
2447
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2448
+					unset($custom_fields[$key]);
2449
+				}
2450
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2451
+					unset($custom_fields[$key]);
2452
+				}
2453
+			}
2454
+		}
2501 2455
 
2502
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2503
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2504
-                    $site_title = trim($field['site_title']);
2505
-                    $type = $field;
2506
-                    $variables_array = array();
2507 2456
 
2508
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2509
-                        continue;
2510
-                    }
2511 2457
 
2512
-                    if ($type['type'] != 'fieldset') {
2513
-                        $i++;
2514
-                        $variables_array['post_id'] = $post->ID;
2515
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2516
-                        $variables_array['value'] = '';
2517
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2518
-                    }else{
2519
-                        $i = 0;
2520
-                        $fieldset_count++;
2521
-                        $field_set_start = 1;
2522
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2523
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2524
-                    }
2458
+		if (!empty($custom_fields)) {
2459
+			$parse_custom_fields = array();
2460
+			foreach ($custom_fields as $field) {
2461
+				$field = stripslashes_deep($field); // strip slashes
2462
+                
2463
+				$type = $field;
2464
+				$field_name = $field['htmlvar_name'];
2465
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2466
+					$post->{$field_name} = $_REQUEST[$field_name];
2467
+				}
2468
+
2469
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2470
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2471
+						continue;
2472
+					}
2473
+
2474
+					$parse_custom_fields[] = $field;
2475
+				}
2476
+			}
2477
+			$custom_fields = $parse_custom_fields;
2478
+		}
2479
+		//print_r($custom_fields);
2480
+		if (!empty($custom_fields)) {
2525 2481
 
2482
+			global $field_set_start;
2526 2483
 
2527
-                    $type = stripslashes_deep($type); // strip slashes
2528
-                    $html = '';
2529
-                    $html_var = '';
2530
-                    $field_icon = geodir_field_icon_proccess($type);
2531
-                    $filed_type = $type['type'];
2532
-
2533
-                    /**
2534
-                     * Filter the output for custom fields.
2535
-                     *
2536
-                     * Here we can remove or add new functions depending on the field type.
2537
-                     *
2538
-                     * @param string $html The html to be filtered (blank).
2539
-                     * @param string $fields_location The location the field is to be show.
2540
-                     * @param array $type The array of field values.
2541
-                     */
2542
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2543
-
2544
-
2545
-                    /**
2546
-                     * Filter custom field output in tab.
2547
-                     *
2548
-                     * @since 1.5.6
2549
-                     *
2550
-                     * @param string $html_var The HTML variable name for the field.
2551
-                     * @param string $html Custom field unfiltered HTML.
2552
-                     * @param array $variables_array Custom field variables array.
2553
-                     */
2554
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2555
-
2556
-                    $fieldset_html = '';
2557
-                    if ($field_set_start == 1) {
2558
-                        $add_html = false;
2559
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2560
-                            if ($fieldset != '') {
2561
-                                $add_html = true;
2562
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2563
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2564
-                            }
2565
-                            $fieldset_html = $fieldset;
2566
-                            $fieldset = '';
2567
-                        } else {
2568
-                            $fieldset .= $html;
2569
-                            if ($total_fields == $count_field && $fieldset != '') {
2570
-                                $add_html = true;
2571
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2572
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2573
-                                $fieldset_html = $fieldset;
2574
-                            }
2575
-                        }
2576
-
2577
-                        if ($add_html) {
2578
-                            $tabs_arr[$htmlvar_name] = array(
2579
-                                'heading_text' => __($label, 'geodirectory'),
2580
-                                'is_active_tab' => false,
2581
-                                /**
2582
-                                 * Filter if a custom field should be displayed on the details page tab.
2583
-                                 *
2584
-                                 * @since 1.0.0
2585
-                                 * @param string $htmlvar_name The field HTML var name.
2586
-                                 */
2587
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2588
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2589
-                            );
2590
-                        }
2591
-                    } else {
2592
-                        if ($html != '') {
2593
-                            $tabs_arr[$field['htmlvar_name']] = array(
2594
-                                'heading_text' => __($label, 'geodirectory'),
2595
-                                'is_active_tab' => false,
2596
-                                /** This action is documented in geodirectory_hooks_actions.php */
2597
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2598
-                                'tab_content' => $html
2599
-                            );
2600
-                        }
2601
-                    }
2602
-                }
2603
-            }
2604
-        }
2605
-    }
2606
-    return $tabs_arr;
2484
+			$post = stripslashes_deep($post); // strip slashes
2485
+            
2486
+			$field_set_start = 0;
2487
+			$fieldset_count = 0;
2488
+			$fieldset = '';
2489
+			$total_fields = count($custom_fields);
2490
+			$count_field = 0;
2491
+			$fieldset_arr = array();
2492
+			$i = 0;
2493
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2494
+
2495
+			foreach ($custom_fields as $field) {
2496
+				$count_field++;
2497
+				$field_name = $field['htmlvar_name'];
2498
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2499
+					$post->{$field_name} = $_REQUEST[$field_name];
2500
+				}
2501
+
2502
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2503
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2504
+					$site_title = trim($field['site_title']);
2505
+					$type = $field;
2506
+					$variables_array = array();
2507
+
2508
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2509
+						continue;
2510
+					}
2511
+
2512
+					if ($type['type'] != 'fieldset') {
2513
+						$i++;
2514
+						$variables_array['post_id'] = $post->ID;
2515
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2516
+						$variables_array['value'] = '';
2517
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2518
+					}else{
2519
+						$i = 0;
2520
+						$fieldset_count++;
2521
+						$field_set_start = 1;
2522
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2523
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2524
+					}
2525
+
2526
+
2527
+					$type = stripslashes_deep($type); // strip slashes
2528
+					$html = '';
2529
+					$html_var = '';
2530
+					$field_icon = geodir_field_icon_proccess($type);
2531
+					$filed_type = $type['type'];
2532
+
2533
+					/**
2534
+					 * Filter the output for custom fields.
2535
+					 *
2536
+					 * Here we can remove or add new functions depending on the field type.
2537
+					 *
2538
+					 * @param string $html The html to be filtered (blank).
2539
+					 * @param string $fields_location The location the field is to be show.
2540
+					 * @param array $type The array of field values.
2541
+					 */
2542
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2543
+
2544
+
2545
+					/**
2546
+					 * Filter custom field output in tab.
2547
+					 *
2548
+					 * @since 1.5.6
2549
+					 *
2550
+					 * @param string $html_var The HTML variable name for the field.
2551
+					 * @param string $html Custom field unfiltered HTML.
2552
+					 * @param array $variables_array Custom field variables array.
2553
+					 */
2554
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2555
+
2556
+					$fieldset_html = '';
2557
+					if ($field_set_start == 1) {
2558
+						$add_html = false;
2559
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2560
+							if ($fieldset != '') {
2561
+								$add_html = true;
2562
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2563
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2564
+							}
2565
+							$fieldset_html = $fieldset;
2566
+							$fieldset = '';
2567
+						} else {
2568
+							$fieldset .= $html;
2569
+							if ($total_fields == $count_field && $fieldset != '') {
2570
+								$add_html = true;
2571
+								$label = $fieldset_arr[$fieldset_count]['label'];
2572
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2573
+								$fieldset_html = $fieldset;
2574
+							}
2575
+						}
2576
+
2577
+						if ($add_html) {
2578
+							$tabs_arr[$htmlvar_name] = array(
2579
+								'heading_text' => __($label, 'geodirectory'),
2580
+								'is_active_tab' => false,
2581
+								/**
2582
+								 * Filter if a custom field should be displayed on the details page tab.
2583
+								 *
2584
+								 * @since 1.0.0
2585
+								 * @param string $htmlvar_name The field HTML var name.
2586
+								 */
2587
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2588
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2589
+							);
2590
+						}
2591
+					} else {
2592
+						if ($html != '') {
2593
+							$tabs_arr[$field['htmlvar_name']] = array(
2594
+								'heading_text' => __($label, 'geodirectory'),
2595
+								'is_active_tab' => false,
2596
+								/** This action is documented in geodirectory_hooks_actions.php */
2597
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2598
+								'tab_content' => $html
2599
+							);
2600
+						}
2601
+					}
2602
+				}
2603
+			}
2604
+		}
2605
+	}
2606
+	return $tabs_arr;
2607 2607
 }
2608 2608
 
2609 2609
 /* display add listing page for wpml */
@@ -2627,37 +2627,37 @@  discard block
 block discarded – undo
2627 2627
  */
2628 2628
 function geodir_add_post_status_author_page()
2629 2629
 {
2630
-    global $wpdb, $post;
2631
-
2632
-    $html = '';
2633
-    if (get_current_user_id()) {
2634
-        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2635
-
2636
-            // 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.
2637
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2638
-            $status = "<strong>(";
2639
-            $status_icon = '<i class="fa fa-play"></i>';
2640
-            if ($real_status == 'publish') {
2641
-                $status .= __('Published', 'geodirectory');
2642
-            } else {
2643
-                $status .= __('Not published', 'geodirectory');
2644
-                $status_icon = '<i class="fa fa-pause"></i>';
2645
-            }
2646
-            $status .= ")</strong>";
2630
+	global $wpdb, $post;
2631
+
2632
+	$html = '';
2633
+	if (get_current_user_id()) {
2634
+		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2635
+
2636
+			// 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.
2637
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2638
+			$status = "<strong>(";
2639
+			$status_icon = '<i class="fa fa-play"></i>';
2640
+			if ($real_status == 'publish') {
2641
+				$status .= __('Published', 'geodirectory');
2642
+			} else {
2643
+				$status .= __('Not published', 'geodirectory');
2644
+				$status_icon = '<i class="fa fa-pause"></i>';
2645
+			}
2646
+			$status .= ")</strong>";
2647 2647
 
2648
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2649
-        }
2650
-    }
2648
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2649
+		}
2650
+	}
2651 2651
 
2652
-    if ($html != '') {
2653
-        /**
2654
-         * Filter the post status text on the author page.
2655
-         *
2656
-         * @since 1.0.0
2657
-         * @param string $html The HTML of the status.
2658
-         */
2659
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2660
-    }
2652
+	if ($html != '') {
2653
+		/**
2654
+		 * Filter the post status text on the author page.
2655
+		 *
2656
+		 * @since 1.0.0
2657
+		 * @param string $html The HTML of the status.
2658
+		 */
2659
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2660
+	}
2661 2661
 
2662 2662
 
2663 2663
 }
@@ -2671,21 +2671,21 @@  discard block
 block discarded – undo
2671 2671
  */
2672 2672
 function geodir_init_no_rating()
2673 2673
 {
2674
-    if (get_option('geodir_disable_rating')) {
2675
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2676
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2677
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2678
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2679
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2680
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2681
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2682
-
2683
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2684
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2685
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2686
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2687
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2688
-    }
2674
+	if (get_option('geodir_disable_rating')) {
2675
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2676
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2677
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2678
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2679
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2680
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2681
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2682
+
2683
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2684
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2685
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2686
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2687
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2688
+	}
2689 2689
 }
2690 2690
 
2691 2691
 /**
@@ -2697,20 +2697,20 @@  discard block
 block discarded – undo
2697 2697
  */
2698 2698
 function geodir_no_rating_rating_fields()
2699 2699
 {
2700
-    global $post;
2700
+	global $post;
2701 2701
 
2702
-    $post_types = geodir_get_posttypes();
2702
+	$post_types = geodir_get_posttypes();
2703 2703
 
2704
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2705
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2706
-            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2707
-            if (get_option('geodir_reviewrating_enable_images')) {
2708
-                geodir_reviewrating_rating_img_html();
2709
-            }
2710
-        } else {
2711
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2712
-        }
2713
-    }
2704
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2705
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2706
+			echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2707
+			if (get_option('geodir_reviewrating_enable_images')) {
2708
+				geodir_reviewrating_rating_img_html();
2709
+			}
2710
+		} else {
2711
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2712
+		}
2713
+	}
2714 2714
 }
2715 2715
 
2716 2716
 /**
@@ -2724,11 +2724,11 @@  discard block
 block discarded – undo
2724 2724
  */
2725 2725
 function geodir_no_rating_comment_text($content, $comment = '')
2726 2726
 {
2727
-    if (!is_admin()) {
2728
-        return '<div class="description">' . $content . '</div>';
2729
-    } else {
2730
-        return $content;
2731
-    }
2727
+	if (!is_admin()) {
2728
+		return '<div class="description">' . $content . '</div>';
2729
+	} else {
2730
+		return $content;
2731
+	}
2732 2732
 }
2733 2733
 
2734 2734
 /**
@@ -2741,7 +2741,7 @@  discard block
 block discarded – undo
2741 2741
  */
2742 2742
 function geodir_no_rating_review_rating_html($content = '')
2743 2743
 {
2744
-    return NULL;
2744
+	return NULL;
2745 2745
 }
2746 2746
 
2747 2747
 /**
@@ -2755,19 +2755,19 @@  discard block
 block discarded – undo
2755 2755
  */
2756 2756
 function geodir_no_rating_get_sort_options($options, $post_type = '')
2757 2757
 {
2758
-    $new_options = array();
2759
-    if (!empty($options)) {
2760
-        foreach ($options as $option) {
2761
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2762
-                continue;
2763
-            }
2764
-            $new_options[] = $option;
2765
-        }
2758
+	$new_options = array();
2759
+	if (!empty($options)) {
2760
+		foreach ($options as $option) {
2761
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2762
+				continue;
2763
+			}
2764
+			$new_options[] = $option;
2765
+		}
2766 2766
 
2767
-        $options = $new_options;
2768
-    }
2767
+		$options = $new_options;
2768
+	}
2769 2769
 
2770
-    return $options;
2770
+	return $options;
2771 2771
 }
2772 2772
 
2773 2773
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -2781,11 +2781,11 @@  discard block
 block discarded – undo
2781 2781
  */
2782 2782
 function geodir_all_js_msg_no_rating($msg = array())
2783 2783
 {
2784
-    if (get_option('geodir_disable_rating')) {
2785
-        $msg['gd_cmt_no_rating'] = true;
2786
-    }
2784
+	if (get_option('geodir_disable_rating')) {
2785
+		$msg['gd_cmt_no_rating'] = true;
2786
+	}
2787 2787
 
2788
-    return $msg;
2788
+	return $msg;
2789 2789
 }
2790 2790
 
2791 2791
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -2799,13 +2799,13 @@  discard block
 block discarded – undo
2799 2799
  */
2800 2800
 function geodir_body_class_no_rating($classes = array())
2801 2801
 {
2802
-    if (get_option('geodir_disable_rating')) {
2803
-        $classes[] = 'gd-no-rating';
2804
-    }
2802
+	if (get_option('geodir_disable_rating')) {
2803
+		$classes[] = 'gd-no-rating';
2804
+	}
2805 2805
     
2806
-    $classes[] = 'gd-map-' . geodir_map_name();
2806
+	$classes[] = 'gd-map-' . geodir_map_name();
2807 2807
 
2808
-    return $classes;
2808
+	return $classes;
2809 2809
 }
2810 2810
 
2811 2811
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -2819,13 +2819,13 @@  discard block
 block discarded – undo
2819 2819
  */
2820 2820
 function geodir_admin_body_class_no_rating($class = '')
2821 2821
 {
2822
-    if (get_option('geodir_disable_rating')) {
2823
-        $class .= ' gd-no-rating';
2824
-    }
2822
+	if (get_option('geodir_disable_rating')) {
2823
+		$class .= ' gd-no-rating';
2824
+	}
2825 2825
     
2826
-    $class .= ' gd-map-' . geodir_map_name();
2826
+	$class .= ' gd-map-' . geodir_map_name();
2827 2827
 
2828
-    return $class;
2828
+	return $class;
2829 2829
 }
2830 2830
 
2831 2831
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -2838,10 +2838,10 @@  discard block
 block discarded – undo
2838 2838
  */
2839 2839
 function geodir_wp_head_no_rating()
2840 2840
 {
2841
-    if (get_option('geodir_disable_rating')) {
2842
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2843
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2844
-    }
2841
+	if (get_option('geodir_disable_rating')) {
2842
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2843
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2844
+	}
2845 2845
 }
2846 2846
 
2847 2847
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -2858,36 +2858,36 @@  discard block
 block discarded – undo
2858 2858
  * @return array Translation texts.
2859 2859
  */
2860 2860
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2861
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2862
-
2863
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2864
-
2865
-    /**
2866
-     * Filters the geodirectory option names that requires to add for translation.
2867
-     *
2868
-     * @since 1.5.7
2869
-     * @package GeoDirectory
2870
-     *
2871
-     * @param  array $gd_options Array of option names.
2872
-     */
2873
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2874
-    $gd_options = array_unique($gd_options);
2875
-
2876
-    if (!empty($gd_options)) {
2877
-        foreach ($gd_options as $gd_option) {
2878
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2879
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2861
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2862
+
2863
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2864
+
2865
+	/**
2866
+	 * Filters the geodirectory option names that requires to add for translation.
2867
+	 *
2868
+	 * @since 1.5.7
2869
+	 * @package GeoDirectory
2870
+	 *
2871
+	 * @param  array $gd_options Array of option names.
2872
+	 */
2873
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2874
+	$gd_options = array_unique($gd_options);
2875
+
2876
+	if (!empty($gd_options)) {
2877
+		foreach ($gd_options as $gd_option) {
2878
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2879
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2880 2880
                 
2881
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2882
-                    $translation_texts[] = stripslashes_deep($option_value);
2883
-                }
2884
-            }
2885
-        }
2886
-    }
2881
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2882
+					$translation_texts[] = stripslashes_deep($option_value);
2883
+				}
2884
+			}
2885
+		}
2886
+	}
2887 2887
 
2888
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2888
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2889 2889
 
2890
-    return $translation_texts;
2890
+	return $translation_texts;
2891 2891
 }
2892 2892
 
2893 2893
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2901,15 +2901,15 @@  discard block
 block discarded – undo
2901 2901
 
2902 2902
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2903 2903
 function gd_get_comments_link($comments_link, $post_id) {
2904
-    $post_type = get_post_type($post_id);
2904
+	$post_type = get_post_type($post_id);
2905 2905
 
2906
-    $all_postypes = geodir_get_posttypes();
2907
-    if (in_array($post_type, $all_postypes)) {
2908
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2909
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2910
-    }
2906
+	$all_postypes = geodir_get_posttypes();
2907
+	if (in_array($post_type, $all_postypes)) {
2908
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2909
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2910
+	}
2911 2911
 
2912
-    return $comments_link;
2912
+	return $comments_link;
2913 2913
 }
2914 2914
 
2915 2915
 
@@ -2927,11 +2927,11 @@  discard block
 block discarded – undo
2927 2927
 function geodir_add_nav_menu_class( $args )
2928 2928
 {
2929 2929
 
2930
-        if(isset($args['menu_class'])){
2931
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2932
-        }
2930
+		if(isset($args['menu_class'])){
2931
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2932
+		}
2933 2933
     
2934
-    return $args;
2934
+	return $args;
2935 2935
 }
2936 2936
 
2937 2937
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2938 2938
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 /* WP REVIEW COUNT ACTIONS */
177 177
 ////////////////////////
178 178
 
179
-add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
179
+add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
180 180
 //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
181
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
181
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
182 182
 //add_action('created_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
184 184
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
226 226
     if ($geodir_theme_location) {
227 227
         update_option('geodir_theme_location_nav', $geodir_theme_location);
228 228
     } else {
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 
321 321
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
322 322
 
323
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
324
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
323
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
324
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
325 325
 
326 326
 // Detail page sidebar content 
327 327
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
     do_action('geodir_after_social_sharing_buttons');
423 423
     $content_html = ob_get_clean();
424 424
     if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
425
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
426
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
427 427
         /**
428 428
          * Filter the geodir_social_sharing_buttons() function content.
429 429
          *
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
     do_action('geodir_after_share_this_button');
470 470
     $content_html = ob_get_clean();
471 471
     if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
472
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">'.$content_html.'</div>';
473
+    if ((int) get_option('geodir_disable_sharethis_button_section') != 1) {
474 474
         /**
475 475
          * Filter the geodir_share_this_button() function content.
476 476
          *
@@ -509,12 +509,12 @@  discard block
 block discarded – undo
509 509
             $post_id = $post->ID;
510 510
             
511 511
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
-                $post_id = (int)$_REQUEST['pid'];
512
+                $post_id = (int) $_REQUEST['pid'];
513 513
             }
514 514
 
515 515
             $postlink = get_permalink(geodir_add_listing_page_id());
516 516
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
517
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
518 518
         }
519 519
     }// end of if, if its a preview or not
520 520
     /**
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
     do_action('geodir_after_edit_post_link');
526 526
     $content_html = ob_get_clean();
527 527
     if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
528
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
529
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
530 530
         /**
531 531
          * Filter the geodir_edit_post_link() function content.
532 532
          *
@@ -579,14 +579,14 @@  discard block
 block discarded – undo
579 579
     $hide_refresh = get_option('geodir_ga_auto_refresh');
580 580
     
581 581
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
582
+    if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
583 583
         $page_url = urlencode($_SERVER['REQUEST_URI']);
584 584
         ?>
585 585
         <script type="text/javascript">
586 586
             var gd_gaTimeOut;
587
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
588
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
589
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
587
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
588
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
589
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
590 590
             ga_data1 = false;
591 591
             ga_data2 = false;
592 592
             ga_data3 = false;
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
             }
728 728
 
729 729
             function gdga_noResults() {
730
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
730
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
731 731
                 jQuery('#gdga-legend-container').html('');
732 732
             }
733 733
 
@@ -759,18 +759,18 @@  discard block
 block discarded – undo
759 759
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
760 760
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
761 761
 
762
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
763
-                        '<?php _e('Feb', 'geodirectory');?>',
764
-                        '<?php _e('Mar', 'geodirectory');?>',
765
-                        '<?php _e('Apr', 'geodirectory');?>',
766
-                        '<?php _e('May', 'geodirectory');?>',
767
-                        '<?php _e('Jun', 'geodirectory');?>',
768
-                        '<?php _e('Jul', 'geodirectory');?>',
769
-                        '<?php _e('Aug', 'geodirectory');?>',
770
-                        '<?php _e('Sep', 'geodirectory');?>',
771
-                        '<?php _e('Oct', 'geodirectory');?>',
772
-                        '<?php _e('Nov', 'geodirectory');?>',
773
-                        '<?php _e('Dec', 'geodirectory');?>'];
762
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
763
+                        '<?php _e('Feb', 'geodirectory'); ?>',
764
+                        '<?php _e('Mar', 'geodirectory'); ?>',
765
+                        '<?php _e('Apr', 'geodirectory'); ?>',
766
+                        '<?php _e('May', 'geodirectory'); ?>',
767
+                        '<?php _e('Jun', 'geodirectory'); ?>',
768
+                        '<?php _e('Jul', 'geodirectory'); ?>',
769
+                        '<?php _e('Aug', 'geodirectory'); ?>',
770
+                        '<?php _e('Sep', 'geodirectory'); ?>',
771
+                        '<?php _e('Oct', 'geodirectory'); ?>',
772
+                        '<?php _e('Nov', 'geodirectory'); ?>',
773
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
774 774
 
775 775
                     // Ensure the data arrays are at least as long as the labels array.
776 776
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -783,13 +783,13 @@  discard block
 block discarded – undo
783 783
                         labels : labels,
784 784
                         datasets : [
785 785
                             {
786
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
786
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
787 787
                                 fillColor : "rgba(220,220,220,0.5)",
788 788
                                 strokeColor : "rgba(220,220,220,1)",
789 789
                                 data : data2
790 790
                             },
791 791
                             {
792
-                                label: '<?php _e('This Year', 'geodirectory');?>',
792
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
793 793
                                 fillColor : "rgba(151,187,205,0.5)",
794 794
                                 strokeColor : "rgba(151,187,205,1)",
795 795
                                 data : data1
@@ -834,30 +834,30 @@  discard block
 block discarded – undo
834 834
 
835 835
                     <?php
836 836
                     // Here we list the shorthand days of the week so it can be used in translation.
837
-                    __("Mon",'geodirectory');
838
-                    __("Tue",'geodirectory');
839
-                    __("Wed",'geodirectory');
840
-                    __("Thu",'geodirectory');
841
-                    __("Fri",'geodirectory');
842
-                    __("Sat",'geodirectory');
843
-                    __("Sun",'geodirectory');
837
+                    __("Mon", 'geodirectory');
838
+                    __("Tue", 'geodirectory');
839
+                    __("Wed", 'geodirectory');
840
+                    __("Thu", 'geodirectory');
841
+                    __("Fri", 'geodirectory');
842
+                    __("Sat", 'geodirectory');
843
+                    __("Sun", 'geodirectory');
844 844
                     ?>
845 845
 
846 846
                     labels = [
847
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
848
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
849
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
850
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
851
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
852
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
853
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
847
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
848
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
849
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
850
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
851
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
852
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
853
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
854 854
                     ];
855 855
 
856 856
                     var data = {
857 857
                         labels : labels,
858 858
                         datasets : [
859 859
                             {
860
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
860
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
861 861
                                 fillColor : "rgba(220,220,220,0.5)",
862 862
                                 strokeColor : "rgba(220,220,220,1)",
863 863
                                 pointColor : "rgba(220,220,220,1)",
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
                                 data : data2
866 866
                             },
867 867
                             {
868
-                                label: '<?php _e('This Week', 'geodirectory');?>',
868
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
869 869
                                 fillColor : "rgba(151,187,205,0.5)",
870 870
                                 strokeColor : "rgba(151,187,205,1)",
871 871
                                 pointColor : "rgba(151,187,205,1)",
@@ -1072,18 +1072,18 @@  discard block
 block discarded – undo
1072 1072
         </style>
1073 1073
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1074 1074
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1075
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1075
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1076 1076
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1077
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1077
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1078 1078
             <div id="gd-active-users-container">
1079
-                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
1079
+                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
1080 1080
                     <b class="gd-ActiveUsers-value">0</b>
1081 1081
                 </div>
1082 1082
             </div>
1083 1083
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1084
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1085
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1086
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1084
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1085
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1086
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1087 1087
             </select>
1088 1088
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1089 1089
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
     do_action('geodir_after_google_analytics');
1100 1100
     $content_html = ob_get_clean();
1101 1101
     if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1102
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1103
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1104 1104
         /**
1105 1105
          * Filter the geodir_edit_post_link() function content.
1106 1106
          *
@@ -1156,10 +1156,10 @@  discard block
 block discarded – undo
1156 1156
        
1157 1157
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1158 1158
 	   
1159
-	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1159
+	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />';
1160 1160
 
1161 1161
         $html .= '<span class="item">';
1162
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1162
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1163 1163
 
1164 1164
         if ($post_images) {
1165 1165
             foreach ($post_images as $img) {
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
         }
1170 1170
 
1171 1171
         if (isset($post_img) && $post_img) {
1172
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1172
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1173 1173
         }
1174 1174
 
1175 1175
         $html .= '</span>';
@@ -1196,9 +1196,9 @@  discard block
 block discarded – undo
1196 1196
     do_action('geodir_after_detail_page_review_rating');
1197 1197
     $content_html = ob_get_clean();
1198 1198
     if (trim($content_html) != '') {
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1199
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1200 1200
     }
1201
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1201
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1202 1202
         /**
1203 1203
          * Filter the geodir_detail_page_review_rating() function content.
1204 1204
          *
@@ -1237,8 +1237,8 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
     $content_html = ob_get_clean();
1239 1239
     if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1240
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1241
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1242 1242
         /**
1243 1243
          * Filter the output html for function geodir_detail_page_more_info().
1244 1244
          *
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1338 1338
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1339 1339
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1340
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1340
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1341 1341
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1342 1342
         'geodir_map_name' => geodir_map_name(),
1343 1343
         'osmStart' => __('Start', 'geodirectory'),
@@ -1358,10 +1358,10 @@  discard block
 block discarded – undo
1358 1358
     foreach ($arr_alert_msg as $key => $value) {
1359 1359
         if (!is_scalar($value))
1360 1360
             continue;
1361
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1361
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1362 1362
     }
1363 1363
 
1364
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1364
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1365 1365
     echo '<script>';
1366 1366
     echo $script;
1367 1367
     echo '</script>';
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
         $geodir_old_sidebars = get_option('geodir_sidebars');
1452 1452
         if (is_array($geodir_old_sidebars)) {
1453 1453
             foreach ($geodir_old_sidebars as $key => $val) {
1454
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1454
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1455 1455
                 {
1456 1456
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1457 1457
                 }
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
         global $post;
1531 1531
         $term_condition = '';
1532 1532
         if (isset($_REQUEST['backandedit'])) {
1533
-            $post = (object)$gd_session->get('listing');
1533
+            $post = (object) $gd_session->get('listing');
1534 1534
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1535 1535
         }
1536 1536
 
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
                     echo 'checked="checked"';
1545 1545
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1546 1546
                        class="geodir_textfield" value="1"
1547
-                       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>
1547
+                       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>
1548 1548
 				</span>
1549 1549
             </div>
1550 1550
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
         /** This action is documented in geodirectory_template_actions.php */
1585 1585
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1586 1586
         
1587
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1587
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1588 1588
             $is_display = false;
1589 1589
         }
1590 1590
     }
@@ -1632,16 +1632,16 @@  discard block
 block discarded – undo
1632 1632
     global $wpdb, $plugin_prefix;
1633 1633
 	
1634 1634
 	// Remove unused virtual page
1635
-	$listings_page_id = (int)get_option('geodir_listing_page');
1635
+	$listings_page_id = (int) get_option('geodir_listing_page');
1636 1636
 	if ($listings_page_id) {
1637
-		$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')));
1637
+		$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')));
1638 1638
         delete_option('geodir_listing_page');
1639 1639
 	}
1640 1640
 
1641 1641
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1642 1642
         $wpdb->query(
1643 1643
             $wpdb->prepare(
1644
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1644
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1645 1645
                 array('1', '1', 'admin')
1646 1646
             )
1647 1647
         );
@@ -1649,9 +1649,9 @@  discard block
 block discarded – undo
1649 1649
 
1650 1650
         /* --- terms meta value set --- */
1651 1651
 
1652
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1652
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1653 1653
 
1654
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1654
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1655 1655
 
1656 1656
         if (!empty($options_data)) {
1657 1657
 
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
 
1660 1660
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1661 1661
 
1662
-                $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)));
1662
+                $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)));
1663 1663
 
1664 1664
                 if (!empty($taxonomies_data)) {
1665 1665
 
@@ -1668,17 +1668,17 @@  discard block
 block discarded – undo
1668 1668
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1669 1669
                         $post_type = $taxObject->object_type[0];
1670 1670
 
1671
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1671
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1672 1672
 
1673
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1673
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1674 1674
 
1675 1675
                         if ($duplicate_data) {
1676 1676
 
1677
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1677
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1678 1678
 
1679 1679
                         } else {
1680 1680
 
1681
-                            $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)));
1681
+                            $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)));
1682 1682
 
1683 1683
                         }
1684 1684
 
@@ -1712,14 +1712,14 @@  discard block
 block discarded – undo
1712 1712
 
1713 1713
     global $wpdb, $table_prefix;
1714 1714
 
1715
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1715
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1716 1716
 
1717 1717
     if ($slug_exists) {
1718 1718
 
1719 1719
         $suffix = 1;
1720 1720
         do {
1721
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1722
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1721
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1722
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1723 1723
             $suffix++;
1724 1724
         } while ($location_slug_check && $suffix < 100);
1725 1725
 
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 
1774 1774
         $suffix = 1;
1775 1775
         do {
1776
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1776
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1777 1777
 
1778 1778
             /** This action is documented in geodirectory_hooks_actions.php */
1779 1779
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
 
1786 1786
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1787 1787
 
1788
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1788
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1789 1789
 
1790 1790
     }
1791 1791
 	
@@ -1794,18 +1794,18 @@  discard block
 block discarded – undo
1794 1794
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1795 1795
 	
1796 1796
 	$post_types = geodir_get_posttypes();
1797
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1798
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1797
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1798
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1799 1799
 		
1800 1800
 		if (!empty($posts_obj)) {
1801 1801
 			foreach ($posts_obj as $post_obj) {
1802 1802
 				$post_id = $post_obj->object_id;
1803 1803
 				
1804
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1804
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1805 1805
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1806 1806
 				
1807
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1808
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1807
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1808
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1809 1809
 			}
1810 1810
 		}
1811 1811
 	}
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1840 1840
         return $slug_exists = true;
1841 1841
 
1842
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1842
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1843 1843
         return $slug_exists = true;
1844 1844
 
1845 1845
     return $slug_exists;
@@ -1879,43 +1879,43 @@  discard block
 block discarded – undo
1879 1879
 
1880 1880
 
1881 1881
     $gd_page = '';
1882
-    if(geodir_is_page('home')){
1882
+    if (geodir_is_page('home')) {
1883 1883
         $gd_page = 'home';
1884 1884
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1885 1885
     }
1886
-    elseif(geodir_is_page('detail')){
1886
+    elseif (geodir_is_page('detail')) {
1887 1887
         $gd_page = 'detail';
1888 1888
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1889 1889
     }
1890
-    elseif(geodir_is_page('pt')){
1890
+    elseif (geodir_is_page('pt')) {
1891 1891
         $gd_page = 'pt';
1892 1892
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1893 1893
     }
1894
-    elseif(geodir_is_page('listing')){
1894
+    elseif (geodir_is_page('listing')) {
1895 1895
         $gd_page = 'listing';
1896 1896
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1897 1897
     }
1898
-    elseif(geodir_is_page('location')){
1898
+    elseif (geodir_is_page('location')) {
1899 1899
         $gd_page = 'location';
1900 1900
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1901 1901
     }
1902
-    elseif(geodir_is_page('search')){
1902
+    elseif (geodir_is_page('search')) {
1903 1903
         $gd_page = 'search';
1904 1904
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1905 1905
     }
1906
-    elseif(geodir_is_page('add-listing')){
1906
+    elseif (geodir_is_page('add-listing')) {
1907 1907
         $gd_page = 'add-listing';
1908 1908
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1909 1909
     }
1910
-    elseif(geodir_is_page('author')){
1910
+    elseif (geodir_is_page('author')) {
1911 1911
         $gd_page = 'author';
1912 1912
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1913 1913
     }
1914
-    elseif(geodir_is_page('login')){
1914
+    elseif (geodir_is_page('login')) {
1915 1915
         $gd_page = 'login';
1916 1916
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1917 1917
     }
1918
-    elseif(geodir_is_page('listing-success')){
1918
+    elseif (geodir_is_page('listing-success')) {
1919 1919
         $gd_page = 'listing-success';
1920 1920
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1921 1921
     }
@@ -1947,12 +1947,12 @@  discard block
 block discarded – undo
1947 1947
 
1948 1948
     if (!get_option('geodir_set_post_attachments')) {
1949 1949
 
1950
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1951
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1950
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1951
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1952 1952
 
1953 1953
         $all_postypes = geodir_get_posttypes();
1954 1954
 
1955
-        foreach($all_postypes as $post_type){
1955
+        foreach ($all_postypes as $post_type) {
1956 1956
             $args = array(
1957 1957
                 'posts_per_page' => -1,
1958 1958
                 'post_type' => $post_type,
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
 {
2047 2047
     $user_id = get_current_user_id();
2048 2048
 
2049
-    if(!$user_id){return $post;}
2049
+    if (!$user_id) {return $post; }
2050 2050
 
2051 2051
     $gd_post_types = geodir_get_posttypes();
2052 2052
 
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
 
2156 2156
         if (array_key_exists('post_video', $tabs_arr)) {
2157 2157
 
2158
-            $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)));
2158
+            $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)));
2159 2159
 
2160 2160
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2161 2161
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2163,7 +2163,7 @@  discard block
 block discarded – undo
2163 2163
 
2164 2164
         if (array_key_exists('special_offers', $tabs_arr)) {
2165 2165
 
2166
-            $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)));
2166
+            $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)));
2167 2167
 
2168 2168
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2169 2169
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2184,7 +2184,7 @@  discard block
 block discarded – undo
2184 2184
  */
2185 2185
 function geodir_remove_template_redirect_actions()
2186 2186
 {
2187
-    if (geodir_is_page('login')){
2187
+    if (geodir_is_page('login')) {
2188 2188
         remove_all_actions('template_redirect');
2189 2189
         remove_action('init', 'avia_modify_front', 10);
2190 2190
     }
@@ -2231,25 +2231,25 @@  discard block
 block discarded – undo
2231 2231
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2232 2232
 
2233 2233
         $wpdb->query(
2234
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2234
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2235 2235
                 array($post_id, $split_img_file_path)
2236 2236
             )
2237 2237
         );
2238 2238
 
2239 2239
         $attachment_data = $wpdb->get_row(
2240
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2240
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2241 2241
                 array($post_id)
2242 2242
             )
2243 2243
         );
2244 2244
 
2245 2245
         if (!empty($attachment_data)) {
2246
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2246
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2247 2247
         }
2248 2248
 
2249 2249
 
2250
-        $table_name = $plugin_prefix . $post_type . '_detail';
2250
+        $table_name = $plugin_prefix.$post_type.'_detail';
2251 2251
 
2252
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2252
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2253 2253
 
2254 2254
         geodir_set_wp_featured_image($post_id);
2255 2255
 
@@ -2277,9 +2277,9 @@  discard block
 block discarded – undo
2277 2277
 
2278 2278
     foreach ($all_postypes as $posttype) {
2279 2279
 
2280
-        $tablename = $plugin_prefix . $posttype . '_detail';
2280
+        $tablename = $plugin_prefix.$posttype.'_detail';
2281 2281
 
2282
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2282
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2283 2283
 
2284 2284
         if (!empty($get_post_data)) {
2285 2285
 
@@ -2287,7 +2287,7 @@  discard block
 block discarded – undo
2287 2287
 
2288 2288
                 $post_id = $data->post_id;
2289 2289
 
2290
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2290
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2291 2291
 
2292 2292
                 if (!empty($attachment_data)) {
2293 2293
 
@@ -2304,22 +2304,22 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
                         $file_name = $file_info['basename'];
2306 2306
 
2307
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2307
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2308 2308
 
2309 2309
                         if (!file_exists($img_arr['path'])) {
2310 2310
 
2311
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2311
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2312 2312
 
2313 2313
                         }
2314 2314
 
2315 2315
                     }
2316 2316
 
2317
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2317
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2318 2318
 
2319 2319
                     if (!empty($attachment_data)) {
2320 2320
 
2321 2321
                         if ($attachment_data->ID)
2322
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2322
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2323 2323
 
2324 2324
                     } else {
2325 2325
 
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
 
2334 2334
                     }
2335 2335
 
2336
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2336
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2337 2337
 
2338 2338
                     geodir_set_wp_featured_image($post_id);
2339 2339
 
@@ -2362,7 +2362,7 @@  discard block
 block discarded – undo
2362 2362
 {
2363 2363
 
2364 2364
     if (!get_option('geodir_default_rating_star_icon')) {
2365
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2365
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2366 2366
     }
2367 2367
 
2368 2368
 }
@@ -2379,10 +2379,10 @@  discard block
 block discarded – undo
2379 2379
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2380 2380
  * @return array User listing count for each post type.
2381 2381
  */
2382
-function geodir_user_post_listing_count($user_id=null)
2382
+function geodir_user_post_listing_count($user_id = null)
2383 2383
 {
2384 2384
     global $wpdb, $plugin_prefix, $current_user;
2385
-    if(!$user_id){
2385
+    if (!$user_id) {
2386 2386
         $user_id = $current_user->ID;
2387 2387
     }
2388 2388
 
@@ -2393,7 +2393,7 @@  discard block
 block discarded – undo
2393 2393
     $user_listing = array();
2394 2394
     if (is_array($all_posts) && !empty($all_posts)) {
2395 2395
         foreach ($all_posts as $ptype) {
2396
-            $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' )");
2396
+            $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' )");
2397 2397
 
2398 2398
             if ($total_posts > 0) {
2399 2399
                 $user_listing[$ptype] = $total_posts;
@@ -2435,19 +2435,19 @@  discard block
 block discarded – undo
2435 2435
         $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2436 2436
 
2437 2437
         //remove video and special offers if it is already set to show
2438
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2438
+        if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
2439 2439
             $unset_video = true;
2440 2440
         }
2441 2441
 
2442
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2442
+        if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
2443 2443
             $unset_special_offers = true;
2444 2444
         }
2445
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2446
-            foreach($custom_fields as $key => $custom_field){
2447
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2445
+        if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
2446
+            foreach ($custom_fields as $key => $custom_field) {
2447
+                if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
2448 2448
                     unset($custom_fields[$key]);
2449 2449
                 }
2450
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2450
+                if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
2451 2451
                     unset($custom_fields[$key]);
2452 2452
                 }
2453 2453
             }
@@ -2466,7 +2466,7 @@  discard block
 block discarded – undo
2466 2466
                     $post->{$field_name} = $_REQUEST[$field_name];
2467 2467
                 }
2468 2468
 
2469
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2469
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2470 2470
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2471 2471
                         continue;
2472 2472
                     }
@@ -2515,11 +2515,11 @@  discard block
 block discarded – undo
2515 2515
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2516 2516
                         $variables_array['value'] = '';
2517 2517
                         $variables_array['value'] = $post->{$type['htmlvar_name']};
2518
-                    }else{
2518
+                    } else {
2519 2519
                         $i = 0;
2520 2520
                         $fieldset_count++;
2521 2521
                         $field_set_start = 1;
2522
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2522
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2523 2523
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2524 2524
                     }
2525 2525
 
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
                      * @param string $fields_location The location the field is to be show.
2540 2540
                      * @param array $type The array of field values.
2541 2541
                      */
2542
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2542
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2543 2543
 
2544 2544
 
2545 2545
                     /**
@@ -2585,7 +2585,7 @@  discard block
 block discarded – undo
2585 2585
                                  * @param string $htmlvar_name The field HTML var name.
2586 2586
                                  */
2587 2587
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2588
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2588
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2589 2589
                             );
2590 2590
                         }
2591 2591
                     } else {
@@ -2645,7 +2645,7 @@  discard block
 block discarded – undo
2645 2645
             }
2646 2646
             $status .= ")</strong>";
2647 2647
 
2648
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2648
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2649 2649
         }
2650 2650
     }
2651 2651
 
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
 function geodir_no_rating_comment_text($content, $comment = '')
2726 2726
 {
2727 2727
     if (!is_admin()) {
2728
-        return '<div class="description">' . $content . '</div>';
2728
+        return '<div class="description">'.$content.'</div>';
2729 2729
     } else {
2730 2730
         return $content;
2731 2731
     }
@@ -2803,7 +2803,7 @@  discard block
 block discarded – undo
2803 2803
         $classes[] = 'gd-no-rating';
2804 2804
     }
2805 2805
     
2806
-    $classes[] = 'gd-map-' . geodir_map_name();
2806
+    $classes[] = 'gd-map-'.geodir_map_name();
2807 2807
 
2808 2808
     return $classes;
2809 2809
 }
@@ -2823,7 +2823,7 @@  discard block
 block discarded – undo
2823 2823
         $class .= ' gd-no-rating';
2824 2824
     }
2825 2825
     
2826
-    $class .= ' gd-map-' . geodir_map_name();
2826
+    $class .= ' gd-map-'.geodir_map_name();
2827 2827
 
2828 2828
     return $class;
2829 2829
 }
@@ -2858,7 +2858,7 @@  discard block
 block discarded – undo
2858 2858
  * @return array Translation texts.
2859 2859
  */
2860 2860
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2861
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2861
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2862 2862
 
2863 2863
     $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2864 2864
 
@@ -2924,14 +2924,14 @@  discard block
 block discarded – undo
2924 2924
  * @param array $args The array of menu arguments.
2925 2925
  * @return array The modified arguments.
2926 2926
  */
2927
-function geodir_add_nav_menu_class( $args )
2927
+function geodir_add_nav_menu_class($args)
2928 2928
 {
2929 2929
 
2930
-        if(isset($args['menu_class'])){
2930
+        if (isset($args['menu_class'])) {
2931 2931
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2932 2932
         }
2933 2933
     
2934 2934
     return $args;
2935 2935
 }
2936 2936
 
2937
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2938 2937
\ No newline at end of file
2938
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2939 2939
\ No newline at end of file
Please login to merge, or discard this patch.