@@ -22,8 +22,7 @@ discard block |
||
22 | 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);} else{ global $post;} |
|
27 | 26 | |
28 | 27 | if(!is_array($cf) && $cf!=''){ |
29 | 28 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -77,8 +76,10 @@ discard block |
||
77 | 76 | |
78 | 77 | if ( $post->{$html_var} == '1' ): |
79 | 78 | $html_val = __( 'Yes', 'geodirectory' ); |
80 | - else: |
|
79 | + else { |
|
80 | + : |
|
81 | 81 | $html_val = __( 'No', 'geodirectory' ); |
82 | + } |
|
82 | 83 | endif; |
83 | 84 | |
84 | 85 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -116,8 +117,7 @@ discard block |
||
116 | 117 | function geodir_cf_fieldset($html,$location,$cf,$p=''){ |
117 | 118 | |
118 | 119 | // check we have the post value |
119 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
120 | - else{ global $post;} |
|
120 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
121 | 121 | |
122 | 122 | if(!is_array($cf) && $cf!=''){ |
123 | 123 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -197,8 +197,7 @@ discard block |
||
197 | 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);} else{ global $post;} |
|
202 | 201 | |
203 | 202 | if(!is_array($cf) && $cf!=''){ |
204 | 203 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -313,8 +312,7 @@ discard block |
||
313 | 312 | function geodir_cf_phone($html,$location,$cf,$p=''){ |
314 | 313 | |
315 | 314 | // check we have the post value |
316 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
317 | - else{ global $post;} |
|
315 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
318 | 316 | |
319 | 317 | if(!is_array($cf) && $cf!=''){ |
320 | 318 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -403,8 +401,7 @@ discard block |
||
403 | 401 | function geodir_cf_time($html,$location,$cf,$p=''){ |
404 | 402 | |
405 | 403 | // check we have the post value |
406 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
407 | - else{ global $post;} |
|
404 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
408 | 405 | |
409 | 406 | if(!is_array($cf) && $cf!=''){ |
410 | 407 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -457,9 +454,10 @@ discard block |
||
457 | 454 | if ($post->{$cf['htmlvar_name']}): |
458 | 455 | |
459 | 456 | $value = ''; |
460 | - if ($post->{$cf['htmlvar_name']} != '') |
|
461 | - //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
457 | + if ($post->{$cf['htmlvar_name']} != '') { |
|
458 | + //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
462 | 459 | $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']})); |
460 | + } |
|
463 | 461 | |
464 | 462 | $field_icon = geodir_field_icon_proccess($cf); |
465 | 463 | if (strpos($field_icon, 'http') !== false) { |
@@ -498,8 +496,7 @@ discard block |
||
498 | 496 | function geodir_cf_datepicker($html,$location,$cf,$p=''){ |
499 | 497 | global $preview; |
500 | 498 | // check we have the post value |
501 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
502 | - else{ global $post;} |
|
499 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
503 | 500 | |
504 | 501 | if(!is_array($cf) && $cf!=''){ |
505 | 502 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -566,7 +563,7 @@ discard block |
||
566 | 563 | $date_format = str_replace($search, $replace, $date_format); |
567 | 564 | |
568 | 565 | $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{ |
|
566 | + } else{ |
|
570 | 567 | $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
571 | 568 | } |
572 | 569 | |
@@ -575,7 +572,7 @@ discard block |
||
575 | 572 | $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
576 | 573 | //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
577 | 574 | //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
578 | - }else{ |
|
575 | + } else{ |
|
579 | 576 | return ''; |
580 | 577 | } |
581 | 578 | |
@@ -618,8 +615,7 @@ discard block |
||
618 | 615 | function geodir_cf_text($html,$location,$cf,$p=''){ |
619 | 616 | |
620 | 617 | // check we have the post value |
621 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
622 | - else{ global $post;} |
|
618 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
623 | 619 | |
624 | 620 | if(!is_array($cf) && $cf!=''){ |
625 | 621 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -725,8 +721,7 @@ discard block |
||
725 | 721 | function geodir_cf_radio($html,$location,$cf,$p=''){ |
726 | 722 | |
727 | 723 | // check we have the post value |
728 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
729 | - else{ global $post;} |
|
724 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
730 | 725 | |
731 | 726 | if(!is_array($cf) && $cf!=''){ |
732 | 727 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -834,8 +829,7 @@ discard block |
||
834 | 829 | function geodir_cf_select($html,$location,$cf,$p=''){ |
835 | 830 | |
836 | 831 | // check we have the post value |
837 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
838 | - else{ global $post;} |
|
832 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
839 | 833 | |
840 | 834 | if(!is_array($cf) && $cf!=''){ |
841 | 835 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -936,8 +930,7 @@ discard block |
||
936 | 930 | function geodir_cf_multiselect($html,$location,$cf,$p=''){ |
937 | 931 | |
938 | 932 | // check we have the post value |
939 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
940 | - else{ global $post;} |
|
933 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
941 | 934 | |
942 | 935 | if(!is_array($cf) && $cf!=''){ |
943 | 936 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1063,8 +1056,7 @@ discard block |
||
1063 | 1056 | function geodir_cf_email($html,$location,$cf,$p=''){ |
1064 | 1057 | |
1065 | 1058 | // check we have the post value |
1066 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1067 | - else{ global $post;} |
|
1059 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
1068 | 1060 | |
1069 | 1061 | if(!is_array($cf) && $cf!=''){ |
1070 | 1062 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1201,11 +1193,11 @@ discard block |
||
1201 | 1193 | $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
1202 | 1194 | if($location=='mapbubble'){ |
1203 | 1195 | $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
1204 | - }else{ |
|
1196 | + } else{ |
|
1205 | 1197 | $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
1206 | 1198 | } |
1207 | 1199 | |
1208 | - }else{ |
|
1200 | + } else{ |
|
1209 | 1201 | $html .= $email; |
1210 | 1202 | } |
1211 | 1203 | $html .= '</span></div>'; |
@@ -1233,8 +1225,7 @@ discard block |
||
1233 | 1225 | function geodir_cf_file($html,$location,$cf,$p=''){ |
1234 | 1226 | |
1235 | 1227 | // check we have the post value |
1236 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1237 | - else{ global $post;} |
|
1228 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
1238 | 1229 | |
1239 | 1230 | if(!is_array($cf) && $cf!=''){ |
1240 | 1231 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1327,7 +1318,7 @@ discard block |
||
1327 | 1318 | $file_paths .= '</a>'; |
1328 | 1319 | //$file_paths .= '<img src="'.$file.'" />'; |
1329 | 1320 | $file_paths .= '</div>'; |
1330 | - }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
1321 | + } elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
1331 | 1322 | $ext_path = '_' . $html_var . '_'; |
1332 | 1323 | $filename = explode($ext_path, $filename); |
1333 | 1324 | $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
@@ -1380,8 +1371,7 @@ discard block |
||
1380 | 1371 | function geodir_cf_textarea($html,$location,$cf,$p=''){ |
1381 | 1372 | |
1382 | 1373 | // check we have the post value |
1383 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1384 | - else{ global $post;} |
|
1374 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
1385 | 1375 | |
1386 | 1376 | if(!is_array($cf) && $cf!=''){ |
1387 | 1377 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1471,8 +1461,7 @@ discard block |
||
1471 | 1461 | function geodir_cf_html($html,$location,$cf,$p=''){ |
1472 | 1462 | |
1473 | 1463 | // check we have the post value |
1474 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1475 | - else{ global $post;} |
|
1464 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
1476 | 1465 | |
1477 | 1466 | if(!is_array($cf) && $cf!=''){ |
1478 | 1467 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1561,8 +1550,7 @@ discard block |
||
1561 | 1550 | function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
1562 | 1551 | |
1563 | 1552 | // check we have the post value |
1564 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1565 | - else{ global $post;} |
|
1553 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
1566 | 1554 | |
1567 | 1555 | if(!is_array($cf) && $cf!=''){ |
1568 | 1556 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1685,8 +1673,7 @@ discard block |
||
1685 | 1673 | function geodir_cf_address($html,$location,$cf,$p=''){ |
1686 | 1674 | |
1687 | 1675 | // check we have the post value |
1688 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1689 | - else{ global $post;} |
|
1676 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
1690 | 1677 | |
1691 | 1678 | if(!is_array($cf) && $cf!=''){ |
1692 | 1679 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -21,84 +21,84 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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') . ': ' : ' '; |
|
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') . ': ' : ' '; |
|
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 |
||
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') . ': ' : ' '; |
|
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') . ': ' : ' '; |
|
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 |
||
496 | 496 | * @return string The html to output for the custom field. |
497 | 497 | */ |
498 | 498 | function geodir_cf_datepicker($html,$location,$cf,$p=''){ |
499 | - global $preview; |
|
500 | - // check we have the post value |
|
501 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
502 | - else{ global $post;} |
|
503 | - |
|
504 | - if(!is_array($cf) && $cf!=''){ |
|
505 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
506 | - if(!$cf){return NULL;} |
|
507 | - } |
|
508 | - |
|
509 | - $html_var = $cf['htmlvar_name']; |
|
510 | - |
|
511 | - // Check if there is a location specific filter. |
|
512 | - if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){ |
|
513 | - /** |
|
514 | - * Filter the datepicker html by location. |
|
515 | - * |
|
516 | - * @param string $html The html to filter. |
|
517 | - * @param array $cf The custom field array. |
|
518 | - * @since 1.6.6 |
|
519 | - */ |
|
520 | - $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf); |
|
521 | - } |
|
522 | - |
|
523 | - // Check if there is a custom field specific filter. |
|
524 | - if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){ |
|
525 | - /** |
|
526 | - * Filter the datepicker html by individual custom field. |
|
527 | - * |
|
528 | - * @param string $html The html to filter. |
|
529 | - * @param string $location The location to output the html. |
|
530 | - * @param array $cf The custom field array. |
|
531 | - * @since 1.6.6 |
|
532 | - */ |
|
533 | - $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf); |
|
534 | - } |
|
535 | - |
|
536 | - // Check if there is a custom field key specific filter. |
|
537 | - if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){ |
|
538 | - /** |
|
539 | - * Filter the datepicker html by field type key. |
|
540 | - * |
|
541 | - * @param string $html The html to filter. |
|
542 | - * @param string $location The location to output the html. |
|
543 | - * @param array $cf The custom field array. |
|
544 | - * @since 1.6.6 |
|
545 | - */ |
|
546 | - $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
547 | - } |
|
548 | - |
|
549 | - // If not html then we run the standard output. |
|
550 | - if(empty($html)){ |
|
551 | - |
|
552 | - if ($post->{$cf['htmlvar_name']}): |
|
553 | - |
|
554 | - $date_format = geodir_default_date_format(); |
|
555 | - if ($cf['extra_fields'] != '') { |
|
556 | - $date_format = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
557 | - $date_format = $date_format['date_format']; |
|
558 | - } |
|
559 | - // check if we need to change the format or not |
|
560 | - $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
561 | - if($date_format_len>5){// if greater then 4 then it's the old style format. |
|
562 | - |
|
563 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
564 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
565 | - |
|
566 | - $date_format = str_replace($search, $replace, $date_format); |
|
567 | - |
|
568 | - $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
569 | - }else{ |
|
570 | - $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
|
571 | - } |
|
572 | - |
|
573 | - if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") { |
|
574 | - $date_format_from = $preview ? $date_format : 'Y-m-d'; |
|
575 | - $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
|
576 | - //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
|
577 | - //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
|
578 | - }else{ |
|
579 | - return ''; |
|
580 | - } |
|
581 | - |
|
582 | - $field_icon = geodir_field_icon_proccess($cf); |
|
583 | - |
|
584 | - if (strpos($field_icon, 'http') !== false) { |
|
585 | - $field_icon_af = ''; |
|
586 | - } elseif ($field_icon == '') { |
|
587 | - $field_icon_af = '<i class="fa fa-calendar"></i>'; |
|
588 | - } else { |
|
589 | - $field_icon_af = $field_icon; |
|
590 | - $field_icon = ''; |
|
591 | - } |
|
592 | - |
|
593 | - |
|
594 | - |
|
595 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
596 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
597 | - $html .= '</span>' . $value . '</div>'; |
|
598 | - |
|
599 | - endif; |
|
600 | - |
|
601 | - } |
|
602 | - |
|
603 | - return $html; |
|
499 | + global $preview; |
|
500 | + // check we have the post value |
|
501 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
502 | + else{ global $post;} |
|
503 | + |
|
504 | + if(!is_array($cf) && $cf!=''){ |
|
505 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
506 | + if(!$cf){return NULL;} |
|
507 | + } |
|
508 | + |
|
509 | + $html_var = $cf['htmlvar_name']; |
|
510 | + |
|
511 | + // Check if there is a location specific filter. |
|
512 | + if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){ |
|
513 | + /** |
|
514 | + * Filter the datepicker html by location. |
|
515 | + * |
|
516 | + * @param string $html The html to filter. |
|
517 | + * @param array $cf The custom field array. |
|
518 | + * @since 1.6.6 |
|
519 | + */ |
|
520 | + $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf); |
|
521 | + } |
|
522 | + |
|
523 | + // Check if there is a custom field specific filter. |
|
524 | + if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){ |
|
525 | + /** |
|
526 | + * Filter the datepicker html by individual custom field. |
|
527 | + * |
|
528 | + * @param string $html The html to filter. |
|
529 | + * @param string $location The location to output the html. |
|
530 | + * @param array $cf The custom field array. |
|
531 | + * @since 1.6.6 |
|
532 | + */ |
|
533 | + $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf); |
|
534 | + } |
|
535 | + |
|
536 | + // Check if there is a custom field key specific filter. |
|
537 | + if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){ |
|
538 | + /** |
|
539 | + * Filter the datepicker html by field type key. |
|
540 | + * |
|
541 | + * @param string $html The html to filter. |
|
542 | + * @param string $location The location to output the html. |
|
543 | + * @param array $cf The custom field array. |
|
544 | + * @since 1.6.6 |
|
545 | + */ |
|
546 | + $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
547 | + } |
|
548 | + |
|
549 | + // If not html then we run the standard output. |
|
550 | + if(empty($html)){ |
|
551 | + |
|
552 | + if ($post->{$cf['htmlvar_name']}): |
|
553 | + |
|
554 | + $date_format = geodir_default_date_format(); |
|
555 | + if ($cf['extra_fields'] != '') { |
|
556 | + $date_format = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
557 | + $date_format = $date_format['date_format']; |
|
558 | + } |
|
559 | + // check if we need to change the format or not |
|
560 | + $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
561 | + if($date_format_len>5){// if greater then 4 then it's the old style format. |
|
562 | + |
|
563 | + $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
564 | + $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
565 | + |
|
566 | + $date_format = str_replace($search, $replace, $date_format); |
|
567 | + |
|
568 | + $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
569 | + }else{ |
|
570 | + $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
|
571 | + } |
|
572 | + |
|
573 | + if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") { |
|
574 | + $date_format_from = $preview ? $date_format : 'Y-m-d'; |
|
575 | + $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
|
576 | + //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
|
577 | + //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
|
578 | + }else{ |
|
579 | + return ''; |
|
580 | + } |
|
581 | + |
|
582 | + $field_icon = geodir_field_icon_proccess($cf); |
|
583 | + |
|
584 | + if (strpos($field_icon, 'http') !== false) { |
|
585 | + $field_icon_af = ''; |
|
586 | + } elseif ($field_icon == '') { |
|
587 | + $field_icon_af = '<i class="fa fa-calendar"></i>'; |
|
588 | + } else { |
|
589 | + $field_icon_af = $field_icon; |
|
590 | + $field_icon = ''; |
|
591 | + } |
|
592 | + |
|
593 | + |
|
594 | + |
|
595 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
596 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
597 | + $html .= '</span>' . $value . '</div>'; |
|
598 | + |
|
599 | + endif; |
|
600 | + |
|
601 | + } |
|
602 | + |
|
603 | + return $html; |
|
604 | 604 | } |
605 | 605 | add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3); |
606 | 606 | |
@@ -617,97 +617,97 @@ discard block |
||
617 | 617 | */ |
618 | 618 | function geodir_cf_text($html,$location,$cf,$p=''){ |
619 | 619 | |
620 | - // check we have the post value |
|
621 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
622 | - else{ global $post;} |
|
623 | - |
|
624 | - if(!is_array($cf) && $cf!=''){ |
|
625 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
626 | - if(!$cf){return NULL;} |
|
627 | - } |
|
628 | - |
|
629 | - $html_var = $cf['htmlvar_name']; |
|
630 | - |
|
631 | - // Check if there is a location specific filter. |
|
632 | - if(has_filter("geodir_custom_field_output_text_loc_{$location}")){ |
|
633 | - /** |
|
634 | - * Filter the text html by location. |
|
635 | - * |
|
636 | - * @param string $html The html to filter. |
|
637 | - * @param array $cf The custom field array. |
|
638 | - * @since 1.6.6 |
|
639 | - */ |
|
640 | - $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf); |
|
641 | - } |
|
642 | - |
|
643 | - // Check if there is a custom field specific filter. |
|
644 | - if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){ |
|
645 | - /** |
|
646 | - * Filter the text html by individual custom field. |
|
647 | - * |
|
648 | - * @param string $html The html to filter. |
|
649 | - * @param string $location The location to output the html. |
|
650 | - * @param array $cf The custom field array. |
|
651 | - * @since 1.6.6 |
|
652 | - */ |
|
653 | - $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf); |
|
654 | - } |
|
655 | - |
|
656 | - // Check if there is a custom field key specific filter. |
|
657 | - if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){ |
|
658 | - /** |
|
659 | - * Filter the text html by field type key. |
|
660 | - * |
|
661 | - * @param string $html The html to filter. |
|
662 | - * @param string $location The location to output the html. |
|
663 | - * @param array $cf The custom field array. |
|
664 | - * @since 1.6.6 |
|
665 | - */ |
|
666 | - $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
667 | - } |
|
620 | + // check we have the post value |
|
621 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
622 | + else{ global $post;} |
|
623 | + |
|
624 | + if(!is_array($cf) && $cf!=''){ |
|
625 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
626 | + if(!$cf){return NULL;} |
|
627 | + } |
|
628 | + |
|
629 | + $html_var = $cf['htmlvar_name']; |
|
630 | + |
|
631 | + // Check if there is a location specific filter. |
|
632 | + if(has_filter("geodir_custom_field_output_text_loc_{$location}")){ |
|
633 | + /** |
|
634 | + * Filter the text html by location. |
|
635 | + * |
|
636 | + * @param string $html The html to filter. |
|
637 | + * @param array $cf The custom field array. |
|
638 | + * @since 1.6.6 |
|
639 | + */ |
|
640 | + $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf); |
|
641 | + } |
|
642 | + |
|
643 | + // Check if there is a custom field specific filter. |
|
644 | + if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){ |
|
645 | + /** |
|
646 | + * Filter the text html by individual custom field. |
|
647 | + * |
|
648 | + * @param string $html The html to filter. |
|
649 | + * @param string $location The location to output the html. |
|
650 | + * @param array $cf The custom field array. |
|
651 | + * @since 1.6.6 |
|
652 | + */ |
|
653 | + $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf); |
|
654 | + } |
|
655 | + |
|
656 | + // Check if there is a custom field key specific filter. |
|
657 | + if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){ |
|
658 | + /** |
|
659 | + * Filter the text html by field type key. |
|
660 | + * |
|
661 | + * @param string $html The html to filter. |
|
662 | + * @param string $location The location to output the html. |
|
663 | + * @param array $cf The custom field array. |
|
664 | + * @since 1.6.6 |
|
665 | + */ |
|
666 | + $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
667 | + } |
|
668 | 668 | |
669 | 669 | |
670 | 670 | |
671 | - // If not html then we run the standard output. |
|
672 | - if(empty($html)){ |
|
671 | + // If not html then we run the standard output. |
|
672 | + if(empty($html)){ |
|
673 | 673 | |
674 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
674 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
675 | 675 | |
676 | - $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
676 | + $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
677 | 677 | |
678 | - $field_icon = geodir_field_icon_proccess($cf); |
|
679 | - if (strpos($field_icon, 'http') !== false) { |
|
680 | - $field_icon_af = ''; |
|
681 | - } elseif ($field_icon == '') { |
|
682 | - $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
683 | - } else { |
|
684 | - $field_icon_af = $field_icon; |
|
685 | - $field_icon = ''; |
|
686 | - } |
|
678 | + $field_icon = geodir_field_icon_proccess($cf); |
|
679 | + if (strpos($field_icon, 'http') !== false) { |
|
680 | + $field_icon_af = ''; |
|
681 | + } elseif ($field_icon == '') { |
|
682 | + $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
683 | + } else { |
|
684 | + $field_icon_af = $field_icon; |
|
685 | + $field_icon = ''; |
|
686 | + } |
|
687 | 687 | |
688 | 688 | |
689 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af; |
|
690 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
691 | - $html .= '</span>'; |
|
689 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af; |
|
690 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
691 | + $html .= '</span>'; |
|
692 | 692 | |
693 | - $value = $post->{$cf['htmlvar_name']}; |
|
694 | - if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){ |
|
695 | - $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields'])); |
|
696 | - if(isset($extra_fields['is_price']) && $extra_fields['is_price']){ |
|
697 | - if(!ceil($value) > 0){return '';}// dont output blank prices |
|
698 | - $value = geodir_currency_format_number($value,$cf); |
|
699 | - } |
|
700 | - } |
|
693 | + $value = $post->{$cf['htmlvar_name']}; |
|
694 | + if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){ |
|
695 | + $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields'])); |
|
696 | + if(isset($extra_fields['is_price']) && $extra_fields['is_price']){ |
|
697 | + if(!ceil($value) > 0){return '';}// dont output blank prices |
|
698 | + $value = geodir_currency_format_number($value,$cf); |
|
699 | + } |
|
700 | + } |
|
701 | 701 | |
702 | 702 | |
703 | - $html .= $value; |
|
704 | - $html .= '</div>'; |
|
703 | + $html .= $value; |
|
704 | + $html .= '</div>'; |
|
705 | 705 | |
706 | - endif; |
|
706 | + endif; |
|
707 | 707 | |
708 | - } |
|
708 | + } |
|
709 | 709 | |
710 | - return $html; |
|
710 | + return $html; |
|
711 | 711 | } |
712 | 712 | add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3); |
713 | 713 | |
@@ -724,98 +724,98 @@ discard block |
||
724 | 724 | */ |
725 | 725 | function geodir_cf_radio($html,$location,$cf,$p=''){ |
726 | 726 | |
727 | - // check we have the post value |
|
728 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
729 | - else{ global $post;} |
|
730 | - |
|
731 | - if(!is_array($cf) && $cf!=''){ |
|
732 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
733 | - if(!$cf){return NULL;} |
|
734 | - } |
|
735 | - |
|
736 | - $html_var = $cf['htmlvar_name']; |
|
737 | - |
|
738 | - // Check if there is a location specific filter. |
|
739 | - if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){ |
|
740 | - /** |
|
741 | - * Filter the radio html by location. |
|
742 | - * |
|
743 | - * @param string $html The html to filter. |
|
744 | - * @param array $cf The custom field array. |
|
745 | - * @since 1.6.6 |
|
746 | - */ |
|
747 | - $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf); |
|
748 | - } |
|
749 | - |
|
750 | - // Check if there is a custom field specific filter. |
|
751 | - if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){ |
|
752 | - /** |
|
753 | - * Filter the radio html by individual custom field. |
|
754 | - * |
|
755 | - * @param string $html The html to filter. |
|
756 | - * @param string $location The location to output the html. |
|
757 | - * @param array $cf The custom field array. |
|
758 | - * @since 1.6.6 |
|
759 | - */ |
|
760 | - $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf); |
|
761 | - } |
|
762 | - |
|
763 | - // Check if there is a custom field key specific filter. |
|
764 | - if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){ |
|
765 | - /** |
|
766 | - * Filter the radio html by field type key. |
|
767 | - * |
|
768 | - * @param string $html The html to filter. |
|
769 | - * @param string $location The location to output the html. |
|
770 | - * @param array $cf The custom field array. |
|
771 | - * @since 1.6.6 |
|
772 | - */ |
|
773 | - $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
774 | - } |
|
775 | - |
|
776 | - // If not html then we run the standard output. |
|
777 | - if(empty($html)){ |
|
778 | - |
|
779 | - $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : ''; |
|
780 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
781 | - |
|
782 | - if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') { |
|
783 | - $html_val = __('No', 'geodirectory'); |
|
784 | - } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') { |
|
785 | - $html_val = __('Yes', 'geodirectory'); |
|
786 | - } else { |
|
787 | - if (!empty($cf['option_values'])) { |
|
788 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
789 | - |
|
790 | - if (!empty($cf_option_values)) { |
|
791 | - foreach ($cf_option_values as $cf_option_value) { |
|
792 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
793 | - $html_val = $cf_option_value['label']; |
|
794 | - } |
|
795 | - } |
|
796 | - } |
|
797 | - } |
|
798 | - } |
|
799 | - |
|
800 | - $field_icon = geodir_field_icon_proccess($cf); |
|
801 | - if (strpos($field_icon, 'http') !== false) { |
|
802 | - $field_icon_af = ''; |
|
803 | - } elseif ($field_icon == '') { |
|
804 | - $field_icon_af = ''; |
|
805 | - } else { |
|
806 | - $field_icon_af = $field_icon; |
|
807 | - $field_icon = ''; |
|
808 | - } |
|
809 | - |
|
810 | - |
|
811 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
812 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
813 | - $html .= '</span>' . $html_val . '</div>'; |
|
814 | - endif; |
|
815 | - |
|
816 | - } |
|
817 | - |
|
818 | - return $html; |
|
727 | + // check we have the post value |
|
728 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
729 | + else{ global $post;} |
|
730 | + |
|
731 | + if(!is_array($cf) && $cf!=''){ |
|
732 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
733 | + if(!$cf){return NULL;} |
|
734 | + } |
|
735 | + |
|
736 | + $html_var = $cf['htmlvar_name']; |
|
737 | + |
|
738 | + // Check if there is a location specific filter. |
|
739 | + if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){ |
|
740 | + /** |
|
741 | + * Filter the radio html by location. |
|
742 | + * |
|
743 | + * @param string $html The html to filter. |
|
744 | + * @param array $cf The custom field array. |
|
745 | + * @since 1.6.6 |
|
746 | + */ |
|
747 | + $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf); |
|
748 | + } |
|
749 | + |
|
750 | + // Check if there is a custom field specific filter. |
|
751 | + if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){ |
|
752 | + /** |
|
753 | + * Filter the radio html by individual custom field. |
|
754 | + * |
|
755 | + * @param string $html The html to filter. |
|
756 | + * @param string $location The location to output the html. |
|
757 | + * @param array $cf The custom field array. |
|
758 | + * @since 1.6.6 |
|
759 | + */ |
|
760 | + $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf); |
|
761 | + } |
|
762 | + |
|
763 | + // Check if there is a custom field key specific filter. |
|
764 | + if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){ |
|
765 | + /** |
|
766 | + * Filter the radio html by field type key. |
|
767 | + * |
|
768 | + * @param string $html The html to filter. |
|
769 | + * @param string $location The location to output the html. |
|
770 | + * @param array $cf The custom field array. |
|
771 | + * @since 1.6.6 |
|
772 | + */ |
|
773 | + $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
774 | + } |
|
775 | + |
|
776 | + // If not html then we run the standard output. |
|
777 | + if(empty($html)){ |
|
778 | + |
|
779 | + $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : ''; |
|
780 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
781 | + |
|
782 | + if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') { |
|
783 | + $html_val = __('No', 'geodirectory'); |
|
784 | + } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') { |
|
785 | + $html_val = __('Yes', 'geodirectory'); |
|
786 | + } else { |
|
787 | + if (!empty($cf['option_values'])) { |
|
788 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
789 | + |
|
790 | + if (!empty($cf_option_values)) { |
|
791 | + foreach ($cf_option_values as $cf_option_value) { |
|
792 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
793 | + $html_val = $cf_option_value['label']; |
|
794 | + } |
|
795 | + } |
|
796 | + } |
|
797 | + } |
|
798 | + } |
|
799 | + |
|
800 | + $field_icon = geodir_field_icon_proccess($cf); |
|
801 | + if (strpos($field_icon, 'http') !== false) { |
|
802 | + $field_icon_af = ''; |
|
803 | + } elseif ($field_icon == '') { |
|
804 | + $field_icon_af = ''; |
|
805 | + } else { |
|
806 | + $field_icon_af = $field_icon; |
|
807 | + $field_icon = ''; |
|
808 | + } |
|
809 | + |
|
810 | + |
|
811 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
812 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
813 | + $html .= '</span>' . $html_val . '</div>'; |
|
814 | + endif; |
|
815 | + |
|
816 | + } |
|
817 | + |
|
818 | + return $html; |
|
819 | 819 | } |
820 | 820 | add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3); |
821 | 821 | |
@@ -833,92 +833,92 @@ discard block |
||
833 | 833 | */ |
834 | 834 | function geodir_cf_select($html,$location,$cf,$p=''){ |
835 | 835 | |
836 | - // check we have the post value |
|
837 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
838 | - else{ global $post;} |
|
839 | - |
|
840 | - if(!is_array($cf) && $cf!=''){ |
|
841 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
842 | - if(!$cf){return NULL;} |
|
843 | - } |
|
844 | - |
|
845 | - $html_var = $cf['htmlvar_name']; |
|
846 | - |
|
847 | - // Check if there is a location specific filter. |
|
848 | - if(has_filter("geodir_custom_field_output_select_loc_{$location}")){ |
|
849 | - /** |
|
850 | - * Filter the select html by location. |
|
851 | - * |
|
852 | - * @param string $html The html to filter. |
|
853 | - * @param array $cf The custom field array. |
|
854 | - * @since 1.6.6 |
|
855 | - */ |
|
856 | - $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf); |
|
857 | - } |
|
858 | - |
|
859 | - // Check if there is a custom field specific filter. |
|
860 | - if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){ |
|
861 | - /** |
|
862 | - * Filter the select html by individual custom field. |
|
863 | - * |
|
864 | - * @param string $html The html to filter. |
|
865 | - * @param string $location The location to output the html. |
|
866 | - * @param array $cf The custom field array. |
|
867 | - * @since 1.6.6 |
|
868 | - */ |
|
869 | - $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf); |
|
870 | - } |
|
871 | - |
|
872 | - // Check if there is a custom field key specific filter. |
|
873 | - if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){ |
|
874 | - /** |
|
875 | - * Filter the select html by field type key. |
|
876 | - * |
|
877 | - * @param string $html The html to filter. |
|
878 | - * @param string $location The location to output the html. |
|
879 | - * @param array $cf The custom field array. |
|
880 | - * @since 1.6.6 |
|
881 | - */ |
|
882 | - $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
883 | - } |
|
884 | - |
|
885 | - // If not html then we run the standard output. |
|
886 | - if(empty($html)){ |
|
887 | - |
|
888 | - if ($post->{$cf['htmlvar_name']}): |
|
889 | - $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
890 | - |
|
891 | - if (!empty($cf['option_values'])) { |
|
892 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
893 | - |
|
894 | - if (!empty($cf_option_values)) { |
|
895 | - foreach ($cf_option_values as $cf_option_value) { |
|
896 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
897 | - $field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2". |
|
898 | - } |
|
899 | - } |
|
900 | - } |
|
901 | - } |
|
902 | - |
|
903 | - $field_icon = geodir_field_icon_proccess($cf); |
|
904 | - if (strpos($field_icon, 'http') !== false) { |
|
905 | - $field_icon_af = ''; |
|
906 | - } elseif ($field_icon == '') { |
|
907 | - $field_icon_af = ''; |
|
908 | - } else { |
|
909 | - $field_icon_af = $field_icon; |
|
910 | - $field_icon = ''; |
|
911 | - } |
|
912 | - |
|
913 | - |
|
914 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
915 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
916 | - $html .= '</span>' . $field_value . '</div>'; |
|
917 | - endif; |
|
918 | - |
|
919 | - } |
|
920 | - |
|
921 | - return $html; |
|
836 | + // check we have the post value |
|
837 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
838 | + else{ global $post;} |
|
839 | + |
|
840 | + if(!is_array($cf) && $cf!=''){ |
|
841 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
842 | + if(!$cf){return NULL;} |
|
843 | + } |
|
844 | + |
|
845 | + $html_var = $cf['htmlvar_name']; |
|
846 | + |
|
847 | + // Check if there is a location specific filter. |
|
848 | + if(has_filter("geodir_custom_field_output_select_loc_{$location}")){ |
|
849 | + /** |
|
850 | + * Filter the select html by location. |
|
851 | + * |
|
852 | + * @param string $html The html to filter. |
|
853 | + * @param array $cf The custom field array. |
|
854 | + * @since 1.6.6 |
|
855 | + */ |
|
856 | + $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf); |
|
857 | + } |
|
858 | + |
|
859 | + // Check if there is a custom field specific filter. |
|
860 | + if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){ |
|
861 | + /** |
|
862 | + * Filter the select html by individual custom field. |
|
863 | + * |
|
864 | + * @param string $html The html to filter. |
|
865 | + * @param string $location The location to output the html. |
|
866 | + * @param array $cf The custom field array. |
|
867 | + * @since 1.6.6 |
|
868 | + */ |
|
869 | + $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf); |
|
870 | + } |
|
871 | + |
|
872 | + // Check if there is a custom field key specific filter. |
|
873 | + if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){ |
|
874 | + /** |
|
875 | + * Filter the select html by field type key. |
|
876 | + * |
|
877 | + * @param string $html The html to filter. |
|
878 | + * @param string $location The location to output the html. |
|
879 | + * @param array $cf The custom field array. |
|
880 | + * @since 1.6.6 |
|
881 | + */ |
|
882 | + $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
883 | + } |
|
884 | + |
|
885 | + // If not html then we run the standard output. |
|
886 | + if(empty($html)){ |
|
887 | + |
|
888 | + if ($post->{$cf['htmlvar_name']}): |
|
889 | + $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
890 | + |
|
891 | + if (!empty($cf['option_values'])) { |
|
892 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
893 | + |
|
894 | + if (!empty($cf_option_values)) { |
|
895 | + foreach ($cf_option_values as $cf_option_value) { |
|
896 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
897 | + $field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2". |
|
898 | + } |
|
899 | + } |
|
900 | + } |
|
901 | + } |
|
902 | + |
|
903 | + $field_icon = geodir_field_icon_proccess($cf); |
|
904 | + if (strpos($field_icon, 'http') !== false) { |
|
905 | + $field_icon_af = ''; |
|
906 | + } elseif ($field_icon == '') { |
|
907 | + $field_icon_af = ''; |
|
908 | + } else { |
|
909 | + $field_icon_af = $field_icon; |
|
910 | + $field_icon = ''; |
|
911 | + } |
|
912 | + |
|
913 | + |
|
914 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
915 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
916 | + $html .= '</span>' . $field_value . '</div>'; |
|
917 | + endif; |
|
918 | + |
|
919 | + } |
|
920 | + |
|
921 | + return $html; |
|
922 | 922 | } |
923 | 923 | add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3); |
924 | 924 | |
@@ -935,117 +935,117 @@ discard block |
||
935 | 935 | */ |
936 | 936 | function geodir_cf_multiselect($html,$location,$cf,$p=''){ |
937 | 937 | |
938 | - // check we have the post value |
|
939 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
940 | - else{ global $post;} |
|
941 | - |
|
942 | - if(!is_array($cf) && $cf!=''){ |
|
943 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
944 | - if(!$cf){return NULL;} |
|
945 | - } |
|
946 | - |
|
947 | - $html_var = $cf['htmlvar_name']; |
|
948 | - |
|
949 | - // Check if there is a location specific filter. |
|
950 | - if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){ |
|
951 | - /** |
|
952 | - * Filter the multiselect html by location. |
|
953 | - * |
|
954 | - * @param string $html The html to filter. |
|
955 | - * @param array $cf The custom field array. |
|
956 | - * @since 1.6.6 |
|
957 | - */ |
|
958 | - $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf); |
|
959 | - } |
|
960 | - |
|
961 | - // Check if there is a custom field specific filter. |
|
962 | - if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){ |
|
963 | - /** |
|
964 | - * Filter the multiselect html by individual custom field. |
|
965 | - * |
|
966 | - * @param string $html The html to filter. |
|
967 | - * @param string $location The location to output the html. |
|
968 | - * @param array $cf The custom field array. |
|
969 | - * @since 1.6.6 |
|
970 | - */ |
|
971 | - $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf); |
|
972 | - } |
|
973 | - |
|
974 | - // Check if there is a custom field key specific filter. |
|
975 | - if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){ |
|
976 | - /** |
|
977 | - * Filter the multiselect html by field type key. |
|
978 | - * |
|
979 | - * @param string $html The html to filter. |
|
980 | - * @param string $location The location to output the html. |
|
981 | - * @param array $cf The custom field array. |
|
982 | - * @since 1.6.6 |
|
983 | - */ |
|
984 | - $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
985 | - } |
|
986 | - |
|
987 | - // If not html then we run the standard output. |
|
988 | - if(empty($html)){ |
|
989 | - |
|
990 | - |
|
991 | - if (!empty($post->{$cf['htmlvar_name']})): |
|
992 | - |
|
993 | - if (is_array($post->{$cf['htmlvar_name']})) { |
|
994 | - $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']}); |
|
995 | - } |
|
996 | - |
|
997 | - $field_icon = geodir_field_icon_proccess($cf); |
|
998 | - if (strpos($field_icon, 'http') !== false) { |
|
999 | - $field_icon_af = ''; |
|
1000 | - } elseif ($field_icon == '') { |
|
1001 | - $field_icon_af = ''; |
|
1002 | - } else { |
|
1003 | - $field_icon_af = $field_icon; |
|
1004 | - $field_icon = ''; |
|
1005 | - } |
|
1006 | - |
|
1007 | - $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ",")); |
|
1008 | - |
|
1009 | - if(is_array($field_values)){ |
|
1010 | - $field_values = array_map('trim', $field_values); |
|
1011 | - } |
|
1012 | - |
|
1013 | - $option_values = array(); |
|
1014 | - if (!empty($cf['option_values'])) { |
|
1015 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
1016 | - |
|
1017 | - if (!empty($cf_option_values)) { |
|
1018 | - foreach ($cf_option_values as $cf_option_value) { |
|
1019 | - if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
1020 | - $option_values[] = $cf_option_value['label']; |
|
1021 | - } |
|
1022 | - } |
|
1023 | - } |
|
1024 | - } |
|
1025 | - |
|
1026 | - |
|
1027 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
1028 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1029 | - $html .= '</span>'; |
|
1030 | - |
|
1031 | - if (count($option_values) > 1) { |
|
1032 | - $html .= '<ul>'; |
|
1033 | - |
|
1034 | - foreach ($option_values as $val) { |
|
1035 | - $html .= '<li>' . $val . '</li>'; |
|
1036 | - } |
|
1037 | - |
|
1038 | - $html .= '</ul>'; |
|
1039 | - } else { |
|
1040 | - $html .= __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
1041 | - } |
|
1042 | - |
|
1043 | - $html .= '</div>'; |
|
1044 | - endif; |
|
1045 | - |
|
1046 | - } |
|
1047 | - |
|
1048 | - return $html; |
|
938 | + // check we have the post value |
|
939 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
940 | + else{ global $post;} |
|
941 | + |
|
942 | + if(!is_array($cf) && $cf!=''){ |
|
943 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
944 | + if(!$cf){return NULL;} |
|
945 | + } |
|
946 | + |
|
947 | + $html_var = $cf['htmlvar_name']; |
|
948 | + |
|
949 | + // Check if there is a location specific filter. |
|
950 | + if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){ |
|
951 | + /** |
|
952 | + * Filter the multiselect html by location. |
|
953 | + * |
|
954 | + * @param string $html The html to filter. |
|
955 | + * @param array $cf The custom field array. |
|
956 | + * @since 1.6.6 |
|
957 | + */ |
|
958 | + $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf); |
|
959 | + } |
|
960 | + |
|
961 | + // Check if there is a custom field specific filter. |
|
962 | + if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){ |
|
963 | + /** |
|
964 | + * Filter the multiselect html by individual custom field. |
|
965 | + * |
|
966 | + * @param string $html The html to filter. |
|
967 | + * @param string $location The location to output the html. |
|
968 | + * @param array $cf The custom field array. |
|
969 | + * @since 1.6.6 |
|
970 | + */ |
|
971 | + $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf); |
|
972 | + } |
|
973 | + |
|
974 | + // Check if there is a custom field key specific filter. |
|
975 | + if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){ |
|
976 | + /** |
|
977 | + * Filter the multiselect html by field type key. |
|
978 | + * |
|
979 | + * @param string $html The html to filter. |
|
980 | + * @param string $location The location to output the html. |
|
981 | + * @param array $cf The custom field array. |
|
982 | + * @since 1.6.6 |
|
983 | + */ |
|
984 | + $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
985 | + } |
|
986 | + |
|
987 | + // If not html then we run the standard output. |
|
988 | + if(empty($html)){ |
|
989 | + |
|
990 | + |
|
991 | + if (!empty($post->{$cf['htmlvar_name']})): |
|
992 | + |
|
993 | + if (is_array($post->{$cf['htmlvar_name']})) { |
|
994 | + $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']}); |
|
995 | + } |
|
996 | + |
|
997 | + $field_icon = geodir_field_icon_proccess($cf); |
|
998 | + if (strpos($field_icon, 'http') !== false) { |
|
999 | + $field_icon_af = ''; |
|
1000 | + } elseif ($field_icon == '') { |
|
1001 | + $field_icon_af = ''; |
|
1002 | + } else { |
|
1003 | + $field_icon_af = $field_icon; |
|
1004 | + $field_icon = ''; |
|
1005 | + } |
|
1006 | + |
|
1007 | + $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ",")); |
|
1008 | + |
|
1009 | + if(is_array($field_values)){ |
|
1010 | + $field_values = array_map('trim', $field_values); |
|
1011 | + } |
|
1012 | + |
|
1013 | + $option_values = array(); |
|
1014 | + if (!empty($cf['option_values'])) { |
|
1015 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
1016 | + |
|
1017 | + if (!empty($cf_option_values)) { |
|
1018 | + foreach ($cf_option_values as $cf_option_value) { |
|
1019 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
1020 | + $option_values[] = $cf_option_value['label']; |
|
1021 | + } |
|
1022 | + } |
|
1023 | + } |
|
1024 | + } |
|
1025 | + |
|
1026 | + |
|
1027 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
1028 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1029 | + $html .= '</span>'; |
|
1030 | + |
|
1031 | + if (count($option_values) > 1) { |
|
1032 | + $html .= '<ul>'; |
|
1033 | + |
|
1034 | + foreach ($option_values as $val) { |
|
1035 | + $html .= '<li>' . $val . '</li>'; |
|
1036 | + } |
|
1037 | + |
|
1038 | + $html .= '</ul>'; |
|
1039 | + } else { |
|
1040 | + $html .= __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
1041 | + } |
|
1042 | + |
|
1043 | + $html .= '</div>'; |
|
1044 | + endif; |
|
1045 | + |
|
1046 | + } |
|
1047 | + |
|
1048 | + return $html; |
|
1049 | 1049 | } |
1050 | 1050 | add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3); |
1051 | 1051 | |
@@ -1062,148 +1062,148 @@ discard block |
||
1062 | 1062 | */ |
1063 | 1063 | function geodir_cf_email($html,$location,$cf,$p=''){ |
1064 | 1064 | |
1065 | - // check we have the post value |
|
1066 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1067 | - else{ global $post;} |
|
1068 | - |
|
1069 | - if(!is_array($cf) && $cf!=''){ |
|
1070 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1071 | - if(!$cf){return NULL;} |
|
1072 | - } |
|
1073 | - |
|
1074 | - $html_var = $cf['htmlvar_name']; |
|
1075 | - |
|
1076 | - // Check if there is a location specific filter. |
|
1077 | - if(has_filter("geodir_custom_field_output_email_loc_{$location}")){ |
|
1078 | - /** |
|
1079 | - * Filter the email html by location. |
|
1080 | - * |
|
1081 | - * @param string $html The html to filter. |
|
1082 | - * @param array $cf The custom field array. |
|
1083 | - * @since 1.6.6 |
|
1084 | - */ |
|
1085 | - $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf); |
|
1086 | - } |
|
1087 | - |
|
1088 | - // Check if there is a custom field specific filter. |
|
1089 | - if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){ |
|
1090 | - /** |
|
1091 | - * Filter the email html by individual custom field. |
|
1092 | - * |
|
1093 | - * @param string $html The html to filter. |
|
1094 | - * @param string $location The location to output the html. |
|
1095 | - * @param array $cf The custom field array. |
|
1096 | - * @since 1.6.6 |
|
1097 | - */ |
|
1098 | - $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf); |
|
1099 | - } |
|
1100 | - |
|
1101 | - // Check if there is a custom field key specific filter. |
|
1102 | - if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){ |
|
1103 | - /** |
|
1104 | - * Filter the email html by field type key. |
|
1105 | - * |
|
1106 | - * @param string $html The html to filter. |
|
1107 | - * @param string $location The location to output the html. |
|
1108 | - * @param array $cf The custom field array. |
|
1109 | - * @since 1.6.6 |
|
1110 | - */ |
|
1111 | - $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1112 | - } |
|
1113 | - |
|
1114 | - // If not html then we run the standard output. |
|
1115 | - if(empty($html)){ |
|
1116 | - |
|
1117 | - global $preview; |
|
1118 | - if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
1119 | - return ''; // Remove Send Enquiry from listings page |
|
1120 | - } |
|
1121 | - |
|
1122 | - $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type); |
|
1123 | - |
|
1124 | - if ($cf['htmlvar_name'] == 'geodir_email' && $post->{$cf['htmlvar_name']}) { |
|
1125 | - $b_send_inquiry = ''; |
|
1126 | - |
|
1127 | - $html = ''; |
|
1128 | - if (!$preview) { |
|
1129 | - $b_send_inquiry = 'b_send_inquiry'; |
|
1130 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
1131 | - } |
|
1132 | - |
|
1133 | - $field_icon = geodir_field_icon_proccess($cf); |
|
1134 | - if (strpos($field_icon, 'http') !== false) { |
|
1135 | - $field_icon_af = ''; |
|
1136 | - } elseif ($field_icon == '') { |
|
1137 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
1138 | - } else { |
|
1139 | - $field_icon_af = $field_icon; |
|
1140 | - $field_icon = ''; |
|
1141 | - } |
|
1142 | - |
|
1143 | - $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
1144 | - $seperator = ''; |
|
1145 | - if ($post->{$cf['htmlvar_name']}) { |
|
1146 | - $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); |
|
1147 | - $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
1148 | - } |
|
1149 | - |
|
1150 | - $html .= '</span></div>'; |
|
1151 | - |
|
1152 | - |
|
1153 | - if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
1154 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
1155 | - } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
1156 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
1157 | - } |
|
1158 | - |
|
1159 | - /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
1160 | - |
|
1161 | - } else { |
|
1162 | - |
|
1163 | - if ($post->{$cf['htmlvar_name']}) { |
|
1164 | - |
|
1165 | - $field_icon = geodir_field_icon_proccess($cf); |
|
1166 | - if (strpos($field_icon, 'http') !== false) { |
|
1167 | - $field_icon_af = ''; |
|
1168 | - } elseif ($field_icon == '') { |
|
1169 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
1170 | - } else { |
|
1171 | - $field_icon_af = $field_icon; |
|
1172 | - $field_icon = ''; |
|
1173 | - } |
|
1174 | - |
|
1175 | - |
|
1176 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
1177 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1178 | - $html .= '</span><span class="geodir-email-address-output">'; |
|
1179 | - $email = $post->{$cf['htmlvar_name']} ; |
|
1180 | - if($e_split = explode('@',$email)){ |
|
1181 | - /** |
|
1182 | - * Filter email custom field name output. |
|
1183 | - * |
|
1184 | - * @since 1.5.3 |
|
1185 | - * |
|
1186 | - * @param string $email The email string being output. |
|
1187 | - * @param array $cf Custom field variables array. |
|
1188 | - */ |
|
1189 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
1190 | - if($location=='mapbubble'){ |
|
1191 | - $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
|
1192 | - }else{ |
|
1193 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
1194 | - } |
|
1195 | - |
|
1196 | - }else{ |
|
1197 | - $html .= $email; |
|
1198 | - } |
|
1199 | - $html .= '</span></div>'; |
|
1200 | - } |
|
1201 | - |
|
1202 | - } |
|
1203 | - |
|
1204 | - } |
|
1205 | - |
|
1206 | - return $html; |
|
1065 | + // check we have the post value |
|
1066 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1067 | + else{ global $post;} |
|
1068 | + |
|
1069 | + if(!is_array($cf) && $cf!=''){ |
|
1070 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1071 | + if(!$cf){return NULL;} |
|
1072 | + } |
|
1073 | + |
|
1074 | + $html_var = $cf['htmlvar_name']; |
|
1075 | + |
|
1076 | + // Check if there is a location specific filter. |
|
1077 | + if(has_filter("geodir_custom_field_output_email_loc_{$location}")){ |
|
1078 | + /** |
|
1079 | + * Filter the email html by location. |
|
1080 | + * |
|
1081 | + * @param string $html The html to filter. |
|
1082 | + * @param array $cf The custom field array. |
|
1083 | + * @since 1.6.6 |
|
1084 | + */ |
|
1085 | + $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf); |
|
1086 | + } |
|
1087 | + |
|
1088 | + // Check if there is a custom field specific filter. |
|
1089 | + if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){ |
|
1090 | + /** |
|
1091 | + * Filter the email html by individual custom field. |
|
1092 | + * |
|
1093 | + * @param string $html The html to filter. |
|
1094 | + * @param string $location The location to output the html. |
|
1095 | + * @param array $cf The custom field array. |
|
1096 | + * @since 1.6.6 |
|
1097 | + */ |
|
1098 | + $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf); |
|
1099 | + } |
|
1100 | + |
|
1101 | + // Check if there is a custom field key specific filter. |
|
1102 | + if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){ |
|
1103 | + /** |
|
1104 | + * Filter the email html by field type key. |
|
1105 | + * |
|
1106 | + * @param string $html The html to filter. |
|
1107 | + * @param string $location The location to output the html. |
|
1108 | + * @param array $cf The custom field array. |
|
1109 | + * @since 1.6.6 |
|
1110 | + */ |
|
1111 | + $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1112 | + } |
|
1113 | + |
|
1114 | + // If not html then we run the standard output. |
|
1115 | + if(empty($html)){ |
|
1116 | + |
|
1117 | + global $preview; |
|
1118 | + if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
1119 | + return ''; // Remove Send Enquiry from listings page |
|
1120 | + } |
|
1121 | + |
|
1122 | + $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type); |
|
1123 | + |
|
1124 | + if ($cf['htmlvar_name'] == 'geodir_email' && $post->{$cf['htmlvar_name']}) { |
|
1125 | + $b_send_inquiry = ''; |
|
1126 | + |
|
1127 | + $html = ''; |
|
1128 | + if (!$preview) { |
|
1129 | + $b_send_inquiry = 'b_send_inquiry'; |
|
1130 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
1131 | + } |
|
1132 | + |
|
1133 | + $field_icon = geodir_field_icon_proccess($cf); |
|
1134 | + if (strpos($field_icon, 'http') !== false) { |
|
1135 | + $field_icon_af = ''; |
|
1136 | + } elseif ($field_icon == '') { |
|
1137 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
1138 | + } else { |
|
1139 | + $field_icon_af = $field_icon; |
|
1140 | + $field_icon = ''; |
|
1141 | + } |
|
1142 | + |
|
1143 | + $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
1144 | + $seperator = ''; |
|
1145 | + if ($post->{$cf['htmlvar_name']}) { |
|
1146 | + $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); |
|
1147 | + $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
1148 | + } |
|
1149 | + |
|
1150 | + $html .= '</span></div>'; |
|
1151 | + |
|
1152 | + |
|
1153 | + if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
1154 | + $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
1155 | + } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
1156 | + $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
1157 | + } |
|
1158 | + |
|
1159 | + /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
1160 | + |
|
1161 | + } else { |
|
1162 | + |
|
1163 | + if ($post->{$cf['htmlvar_name']}) { |
|
1164 | + |
|
1165 | + $field_icon = geodir_field_icon_proccess($cf); |
|
1166 | + if (strpos($field_icon, 'http') !== false) { |
|
1167 | + $field_icon_af = ''; |
|
1168 | + } elseif ($field_icon == '') { |
|
1169 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
1170 | + } else { |
|
1171 | + $field_icon_af = $field_icon; |
|
1172 | + $field_icon = ''; |
|
1173 | + } |
|
1174 | + |
|
1175 | + |
|
1176 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
1177 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1178 | + $html .= '</span><span class="geodir-email-address-output">'; |
|
1179 | + $email = $post->{$cf['htmlvar_name']} ; |
|
1180 | + if($e_split = explode('@',$email)){ |
|
1181 | + /** |
|
1182 | + * Filter email custom field name output. |
|
1183 | + * |
|
1184 | + * @since 1.5.3 |
|
1185 | + * |
|
1186 | + * @param string $email The email string being output. |
|
1187 | + * @param array $cf Custom field variables array. |
|
1188 | + */ |
|
1189 | + $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
1190 | + if($location=='mapbubble'){ |
|
1191 | + $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
|
1192 | + }else{ |
|
1193 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
1194 | + } |
|
1195 | + |
|
1196 | + }else{ |
|
1197 | + $html .= $email; |
|
1198 | + } |
|
1199 | + $html .= '</span></div>'; |
|
1200 | + } |
|
1201 | + |
|
1202 | + } |
|
1203 | + |
|
1204 | + } |
|
1205 | + |
|
1206 | + return $html; |
|
1207 | 1207 | } |
1208 | 1208 | add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3); |
1209 | 1209 | |
@@ -1220,136 +1220,136 @@ discard block |
||
1220 | 1220 | */ |
1221 | 1221 | function geodir_cf_file($html,$location,$cf,$p=''){ |
1222 | 1222 | |
1223 | - // check we have the post value |
|
1224 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1225 | - else{ global $post;} |
|
1226 | - |
|
1227 | - if(!is_array($cf) && $cf!=''){ |
|
1228 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1229 | - if(!$cf){return NULL;} |
|
1230 | - } |
|
1231 | - |
|
1232 | - $html_var = $cf['htmlvar_name']; |
|
1233 | - |
|
1234 | - // Check if there is a location specific filter. |
|
1235 | - if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
1236 | - /** |
|
1237 | - * Filter the file html by location. |
|
1238 | - * |
|
1239 | - * @param string $html The html to filter. |
|
1240 | - * @param array $cf The custom field array. |
|
1241 | - * @since 1.6.6 |
|
1242 | - */ |
|
1243 | - $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
1244 | - } |
|
1245 | - |
|
1246 | - // Check if there is a custom field specific filter. |
|
1247 | - if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
1248 | - /** |
|
1249 | - * Filter the file html by individual custom field. |
|
1250 | - * |
|
1251 | - * @param string $html The html to filter. |
|
1252 | - * @param string $location The location to output the html. |
|
1253 | - * @param array $cf The custom field array. |
|
1254 | - * @since 1.6.6 |
|
1255 | - */ |
|
1256 | - $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
1257 | - } |
|
1258 | - |
|
1259 | - // Check if there is a custom field key specific filter. |
|
1260 | - if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
1261 | - /** |
|
1262 | - * Filter the file html by field type key. |
|
1263 | - * |
|
1264 | - * @param string $html The html to filter. |
|
1265 | - * @param string $location The location to output the html. |
|
1266 | - * @param array $cf The custom field array. |
|
1267 | - * @since 1.6.6 |
|
1268 | - */ |
|
1269 | - $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1270 | - } |
|
1271 | - |
|
1272 | - // If not html then we run the standard output. |
|
1273 | - if(empty($html)){ |
|
1274 | - |
|
1275 | - if (!empty($post->{$cf['htmlvar_name']})): |
|
1276 | - |
|
1277 | - $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
1278 | - if (!empty($files)): |
|
1279 | - |
|
1280 | - $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
1281 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
1282 | - |
|
1283 | - $file_paths = ''; |
|
1284 | - foreach ($files as $file) { |
|
1285 | - if (!empty($file)) { |
|
1286 | - |
|
1287 | - // $filetype = wp_check_filetype($file); |
|
1288 | - |
|
1289 | - $image_name_arr = explode('/', $file); |
|
1290 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
1291 | - $filename = end($image_name_arr); |
|
1292 | - $img_name_arr = explode('.', $filename); |
|
1293 | - |
|
1294 | - $arr_file_type = wp_check_filetype($filename); |
|
1295 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
1296 | - continue; |
|
1297 | - } |
|
1298 | - |
|
1299 | - $uploaded_file_type = $arr_file_type['type']; |
|
1300 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
1301 | - |
|
1302 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
1303 | - continue; // Invalid file type. |
|
1304 | - } |
|
1305 | - |
|
1306 | - //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
1307 | - $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
1308 | - $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
1309 | - |
|
1310 | - // If the uploaded file is image |
|
1311 | - if (in_array($uploaded_file_type, $image_file_types)) { |
|
1312 | - $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
1313 | - $file_paths .= '<a href="'.$file.'">'; |
|
1314 | - $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
1315 | - $file_paths .= '</a>'; |
|
1316 | - //$file_paths .= '<img src="'.$file.'" />'; |
|
1317 | - $file_paths .= '</div>'; |
|
1318 | - }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
1319 | - $ext_path = '_' . $html_var . '_'; |
|
1320 | - $filename = explode($ext_path, $filename); |
|
1321 | - $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
|
1322 | - $file_paths .= do_shortcode('[audio src="'.$file.'" ]'); |
|
1323 | - } else { |
|
1324 | - $ext_path = '_' . $html_var . '_'; |
|
1325 | - $filename = explode($ext_path, $filename); |
|
1326 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
1327 | - } |
|
1328 | - } |
|
1329 | - } |
|
1330 | - |
|
1331 | - $field_icon = geodir_field_icon_proccess($cf); |
|
1332 | - if (strpos($field_icon, 'http') !== false) { |
|
1333 | - $field_icon_af = ''; |
|
1334 | - } elseif ($field_icon == '') { |
|
1335 | - $field_icon_af = ''; |
|
1336 | - } else { |
|
1337 | - $field_icon_af = $field_icon; |
|
1338 | - $field_icon = ''; |
|
1339 | - } |
|
1340 | - |
|
1341 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
1342 | - $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
1343 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1344 | - $html .= '</span>'; |
|
1345 | - $html .= $file_paths . '</div></div>'; |
|
1346 | - |
|
1347 | - endif; |
|
1348 | - endif; |
|
1349 | - |
|
1350 | - } |
|
1351 | - |
|
1352 | - return $html; |
|
1223 | + // check we have the post value |
|
1224 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1225 | + else{ global $post;} |
|
1226 | + |
|
1227 | + if(!is_array($cf) && $cf!=''){ |
|
1228 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1229 | + if(!$cf){return NULL;} |
|
1230 | + } |
|
1231 | + |
|
1232 | + $html_var = $cf['htmlvar_name']; |
|
1233 | + |
|
1234 | + // Check if there is a location specific filter. |
|
1235 | + if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
1236 | + /** |
|
1237 | + * Filter the file html by location. |
|
1238 | + * |
|
1239 | + * @param string $html The html to filter. |
|
1240 | + * @param array $cf The custom field array. |
|
1241 | + * @since 1.6.6 |
|
1242 | + */ |
|
1243 | + $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
1244 | + } |
|
1245 | + |
|
1246 | + // Check if there is a custom field specific filter. |
|
1247 | + if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
1248 | + /** |
|
1249 | + * Filter the file html by individual custom field. |
|
1250 | + * |
|
1251 | + * @param string $html The html to filter. |
|
1252 | + * @param string $location The location to output the html. |
|
1253 | + * @param array $cf The custom field array. |
|
1254 | + * @since 1.6.6 |
|
1255 | + */ |
|
1256 | + $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
1257 | + } |
|
1258 | + |
|
1259 | + // Check if there is a custom field key specific filter. |
|
1260 | + if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
1261 | + /** |
|
1262 | + * Filter the file html by field type key. |
|
1263 | + * |
|
1264 | + * @param string $html The html to filter. |
|
1265 | + * @param string $location The location to output the html. |
|
1266 | + * @param array $cf The custom field array. |
|
1267 | + * @since 1.6.6 |
|
1268 | + */ |
|
1269 | + $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1270 | + } |
|
1271 | + |
|
1272 | + // If not html then we run the standard output. |
|
1273 | + if(empty($html)){ |
|
1274 | + |
|
1275 | + if (!empty($post->{$cf['htmlvar_name']})): |
|
1276 | + |
|
1277 | + $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
1278 | + if (!empty($files)): |
|
1279 | + |
|
1280 | + $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
1281 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
1282 | + |
|
1283 | + $file_paths = ''; |
|
1284 | + foreach ($files as $file) { |
|
1285 | + if (!empty($file)) { |
|
1286 | + |
|
1287 | + // $filetype = wp_check_filetype($file); |
|
1288 | + |
|
1289 | + $image_name_arr = explode('/', $file); |
|
1290 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
1291 | + $filename = end($image_name_arr); |
|
1292 | + $img_name_arr = explode('.', $filename); |
|
1293 | + |
|
1294 | + $arr_file_type = wp_check_filetype($filename); |
|
1295 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
1296 | + continue; |
|
1297 | + } |
|
1298 | + |
|
1299 | + $uploaded_file_type = $arr_file_type['type']; |
|
1300 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
1301 | + |
|
1302 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
1303 | + continue; // Invalid file type. |
|
1304 | + } |
|
1305 | + |
|
1306 | + //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
1307 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
1308 | + $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
1309 | + |
|
1310 | + // If the uploaded file is image |
|
1311 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
1312 | + $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
1313 | + $file_paths .= '<a href="'.$file.'">'; |
|
1314 | + $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
1315 | + $file_paths .= '</a>'; |
|
1316 | + //$file_paths .= '<img src="'.$file.'" />'; |
|
1317 | + $file_paths .= '</div>'; |
|
1318 | + }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
1319 | + $ext_path = '_' . $html_var . '_'; |
|
1320 | + $filename = explode($ext_path, $filename); |
|
1321 | + $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
|
1322 | + $file_paths .= do_shortcode('[audio src="'.$file.'" ]'); |
|
1323 | + } else { |
|
1324 | + $ext_path = '_' . $html_var . '_'; |
|
1325 | + $filename = explode($ext_path, $filename); |
|
1326 | + $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
1327 | + } |
|
1328 | + } |
|
1329 | + } |
|
1330 | + |
|
1331 | + $field_icon = geodir_field_icon_proccess($cf); |
|
1332 | + if (strpos($field_icon, 'http') !== false) { |
|
1333 | + $field_icon_af = ''; |
|
1334 | + } elseif ($field_icon == '') { |
|
1335 | + $field_icon_af = ''; |
|
1336 | + } else { |
|
1337 | + $field_icon_af = $field_icon; |
|
1338 | + $field_icon = ''; |
|
1339 | + } |
|
1340 | + |
|
1341 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
1342 | + $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
1343 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1344 | + $html .= '</span>'; |
|
1345 | + $html .= $file_paths . '</div></div>'; |
|
1346 | + |
|
1347 | + endif; |
|
1348 | + endif; |
|
1349 | + |
|
1350 | + } |
|
1351 | + |
|
1352 | + return $html; |
|
1353 | 1353 | } |
1354 | 1354 | add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3); |
1355 | 1355 | |
@@ -1367,80 +1367,80 @@ discard block |
||
1367 | 1367 | */ |
1368 | 1368 | function geodir_cf_textarea($html,$location,$cf,$p=''){ |
1369 | 1369 | |
1370 | - // check we have the post value |
|
1371 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1372 | - else{ global $post;} |
|
1373 | - |
|
1374 | - if(!is_array($cf) && $cf!=''){ |
|
1375 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1376 | - if(!$cf){return NULL;} |
|
1377 | - } |
|
1378 | - |
|
1379 | - $html_var = $cf['htmlvar_name']; |
|
1380 | - |
|
1381 | - // Check if there is a location specific filter. |
|
1382 | - if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
1383 | - /** |
|
1384 | - * Filter the textarea html by location. |
|
1385 | - * |
|
1386 | - * @param string $html The html to filter. |
|
1387 | - * @param array $cf The custom field array. |
|
1388 | - * @since 1.6.6 |
|
1389 | - */ |
|
1390 | - $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
1391 | - } |
|
1392 | - |
|
1393 | - // Check if there is a custom field specific filter. |
|
1394 | - if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
1395 | - /** |
|
1396 | - * Filter the textarea html by individual custom field. |
|
1397 | - * |
|
1398 | - * @param string $html The html to filter. |
|
1399 | - * @param string $location The location to output the html. |
|
1400 | - * @param array $cf The custom field array. |
|
1401 | - * @since 1.6.6 |
|
1402 | - */ |
|
1403 | - $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
1404 | - } |
|
1405 | - |
|
1406 | - // Check if there is a custom field key specific filter. |
|
1407 | - if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
1408 | - /** |
|
1409 | - * Filter the textarea html by field type key. |
|
1410 | - * |
|
1411 | - * @param string $html The html to filter. |
|
1412 | - * @param string $location The location to output the html. |
|
1413 | - * @param array $cf The custom field array. |
|
1414 | - * @since 1.6.6 |
|
1415 | - */ |
|
1416 | - $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1417 | - } |
|
1418 | - |
|
1419 | - // If not html then we run the standard output. |
|
1420 | - if(empty($html)){ |
|
1421 | - |
|
1422 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
1423 | - |
|
1424 | - $field_icon = geodir_field_icon_proccess($cf); |
|
1425 | - if (strpos($field_icon, 'http') !== false) { |
|
1426 | - $field_icon_af = ''; |
|
1427 | - } elseif ($field_icon == '') { |
|
1428 | - $field_icon_af = ''; |
|
1429 | - } else { |
|
1430 | - $field_icon_af = $field_icon; |
|
1431 | - $field_icon = ''; |
|
1432 | - } |
|
1433 | - |
|
1434 | - |
|
1435 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
1436 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1437 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
1438 | - |
|
1439 | - } |
|
1440 | - |
|
1441 | - } |
|
1442 | - |
|
1443 | - return $html; |
|
1370 | + // check we have the post value |
|
1371 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1372 | + else{ global $post;} |
|
1373 | + |
|
1374 | + if(!is_array($cf) && $cf!=''){ |
|
1375 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1376 | + if(!$cf){return NULL;} |
|
1377 | + } |
|
1378 | + |
|
1379 | + $html_var = $cf['htmlvar_name']; |
|
1380 | + |
|
1381 | + // Check if there is a location specific filter. |
|
1382 | + if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
1383 | + /** |
|
1384 | + * Filter the textarea html by location. |
|
1385 | + * |
|
1386 | + * @param string $html The html to filter. |
|
1387 | + * @param array $cf The custom field array. |
|
1388 | + * @since 1.6.6 |
|
1389 | + */ |
|
1390 | + $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
1391 | + } |
|
1392 | + |
|
1393 | + // Check if there is a custom field specific filter. |
|
1394 | + if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
1395 | + /** |
|
1396 | + * Filter the textarea html by individual custom field. |
|
1397 | + * |
|
1398 | + * @param string $html The html to filter. |
|
1399 | + * @param string $location The location to output the html. |
|
1400 | + * @param array $cf The custom field array. |
|
1401 | + * @since 1.6.6 |
|
1402 | + */ |
|
1403 | + $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
1404 | + } |
|
1405 | + |
|
1406 | + // Check if there is a custom field key specific filter. |
|
1407 | + if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
1408 | + /** |
|
1409 | + * Filter the textarea html by field type key. |
|
1410 | + * |
|
1411 | + * @param string $html The html to filter. |
|
1412 | + * @param string $location The location to output the html. |
|
1413 | + * @param array $cf The custom field array. |
|
1414 | + * @since 1.6.6 |
|
1415 | + */ |
|
1416 | + $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1417 | + } |
|
1418 | + |
|
1419 | + // If not html then we run the standard output. |
|
1420 | + if(empty($html)){ |
|
1421 | + |
|
1422 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
1423 | + |
|
1424 | + $field_icon = geodir_field_icon_proccess($cf); |
|
1425 | + if (strpos($field_icon, 'http') !== false) { |
|
1426 | + $field_icon_af = ''; |
|
1427 | + } elseif ($field_icon == '') { |
|
1428 | + $field_icon_af = ''; |
|
1429 | + } else { |
|
1430 | + $field_icon_af = $field_icon; |
|
1431 | + $field_icon = ''; |
|
1432 | + } |
|
1433 | + |
|
1434 | + |
|
1435 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
1436 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1437 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
1438 | + |
|
1439 | + } |
|
1440 | + |
|
1441 | + } |
|
1442 | + |
|
1443 | + return $html; |
|
1444 | 1444 | } |
1445 | 1445 | add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3); |
1446 | 1446 | |
@@ -1458,79 +1458,79 @@ discard block |
||
1458 | 1458 | */ |
1459 | 1459 | function geodir_cf_html($html,$location,$cf,$p=''){ |
1460 | 1460 | |
1461 | - // check we have the post value |
|
1462 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1463 | - else{ global $post;} |
|
1464 | - |
|
1465 | - if(!is_array($cf) && $cf!=''){ |
|
1466 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1467 | - if(!$cf){return NULL;} |
|
1468 | - } |
|
1469 | - |
|
1470 | - $html_var = $cf['htmlvar_name']; |
|
1471 | - |
|
1472 | - // Check if there is a location specific filter. |
|
1473 | - if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
1474 | - /** |
|
1475 | - * Filter the html html by location. |
|
1476 | - * |
|
1477 | - * @param string $html The html to filter. |
|
1478 | - * @param array $cf The custom field array. |
|
1479 | - * @since 1.6.6 |
|
1480 | - */ |
|
1481 | - $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
1482 | - } |
|
1483 | - |
|
1484 | - // Check if there is a custom field specific filter. |
|
1485 | - if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
1486 | - /** |
|
1487 | - * Filter the html html by individual custom field. |
|
1488 | - * |
|
1489 | - * @param string $html The html to filter. |
|
1490 | - * @param string $location The location to output the html. |
|
1491 | - * @param array $cf The custom field array. |
|
1492 | - * @since 1.6.6 |
|
1493 | - */ |
|
1494 | - $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
1495 | - } |
|
1496 | - |
|
1497 | - // Check if there is a custom field key specific filter. |
|
1498 | - if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
1499 | - /** |
|
1500 | - * Filter the html html by field type key. |
|
1501 | - * |
|
1502 | - * @param string $html The html to filter. |
|
1503 | - * @param string $location The location to output the html. |
|
1504 | - * @param array $cf The custom field array. |
|
1505 | - * @since 1.6.6 |
|
1506 | - */ |
|
1507 | - $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1508 | - } |
|
1509 | - |
|
1510 | - // If not html then we run the standard output. |
|
1511 | - if(empty($html)){ |
|
1512 | - |
|
1513 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
1514 | - |
|
1515 | - $field_icon = geodir_field_icon_proccess($cf); |
|
1516 | - if (strpos($field_icon, 'http') !== false) { |
|
1517 | - $field_icon_af = ''; |
|
1518 | - } elseif ($field_icon == '') { |
|
1519 | - $field_icon_af = ''; |
|
1520 | - } else { |
|
1521 | - $field_icon_af = $field_icon; |
|
1522 | - $field_icon = ''; |
|
1523 | - } |
|
1524 | - |
|
1525 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
1526 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1527 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
1528 | - |
|
1529 | - } |
|
1530 | - |
|
1531 | - } |
|
1532 | - |
|
1533 | - return $html; |
|
1461 | + // check we have the post value |
|
1462 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1463 | + else{ global $post;} |
|
1464 | + |
|
1465 | + if(!is_array($cf) && $cf!=''){ |
|
1466 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1467 | + if(!$cf){return NULL;} |
|
1468 | + } |
|
1469 | + |
|
1470 | + $html_var = $cf['htmlvar_name']; |
|
1471 | + |
|
1472 | + // Check if there is a location specific filter. |
|
1473 | + if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
1474 | + /** |
|
1475 | + * Filter the html html by location. |
|
1476 | + * |
|
1477 | + * @param string $html The html to filter. |
|
1478 | + * @param array $cf The custom field array. |
|
1479 | + * @since 1.6.6 |
|
1480 | + */ |
|
1481 | + $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
1482 | + } |
|
1483 | + |
|
1484 | + // Check if there is a custom field specific filter. |
|
1485 | + if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
1486 | + /** |
|
1487 | + * Filter the html html by individual custom field. |
|
1488 | + * |
|
1489 | + * @param string $html The html to filter. |
|
1490 | + * @param string $location The location to output the html. |
|
1491 | + * @param array $cf The custom field array. |
|
1492 | + * @since 1.6.6 |
|
1493 | + */ |
|
1494 | + $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
1495 | + } |
|
1496 | + |
|
1497 | + // Check if there is a custom field key specific filter. |
|
1498 | + if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
1499 | + /** |
|
1500 | + * Filter the html html by field type key. |
|
1501 | + * |
|
1502 | + * @param string $html The html to filter. |
|
1503 | + * @param string $location The location to output the html. |
|
1504 | + * @param array $cf The custom field array. |
|
1505 | + * @since 1.6.6 |
|
1506 | + */ |
|
1507 | + $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1508 | + } |
|
1509 | + |
|
1510 | + // If not html then we run the standard output. |
|
1511 | + if(empty($html)){ |
|
1512 | + |
|
1513 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
1514 | + |
|
1515 | + $field_icon = geodir_field_icon_proccess($cf); |
|
1516 | + if (strpos($field_icon, 'http') !== false) { |
|
1517 | + $field_icon_af = ''; |
|
1518 | + } elseif ($field_icon == '') { |
|
1519 | + $field_icon_af = ''; |
|
1520 | + } else { |
|
1521 | + $field_icon_af = $field_icon; |
|
1522 | + $field_icon = ''; |
|
1523 | + } |
|
1524 | + |
|
1525 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
1526 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1527 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
1528 | + |
|
1529 | + } |
|
1530 | + |
|
1531 | + } |
|
1532 | + |
|
1533 | + return $html; |
|
1534 | 1534 | } |
1535 | 1535 | add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3); |
1536 | 1536 | |
@@ -1548,113 +1548,113 @@ discard block |
||
1548 | 1548 | */ |
1549 | 1549 | function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
1550 | 1550 | |
1551 | - // check we have the post value |
|
1552 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1553 | - else{ global $post;} |
|
1554 | - |
|
1555 | - if(!is_array($cf) && $cf!=''){ |
|
1556 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1557 | - if(!$cf){return NULL;} |
|
1558 | - } |
|
1559 | - |
|
1560 | - $html_var = $cf['htmlvar_name']; |
|
1561 | - |
|
1562 | - // Check if there is a location specific filter. |
|
1563 | - if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
1564 | - /** |
|
1565 | - * Filter the taxonomy html by location. |
|
1566 | - * |
|
1567 | - * @param string $html The html to filter. |
|
1568 | - * @param array $cf The custom field array. |
|
1569 | - * @since 1.6.6 |
|
1570 | - */ |
|
1571 | - $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
1572 | - } |
|
1573 | - |
|
1574 | - // Check if there is a custom field specific filter. |
|
1575 | - if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
1576 | - /** |
|
1577 | - * Filter the taxonomy html by individual custom field. |
|
1578 | - * |
|
1579 | - * @param string $html The html to filter. |
|
1580 | - * @param string $location The location to output the html. |
|
1581 | - * @param array $cf The custom field array. |
|
1582 | - * @since 1.6.6 |
|
1583 | - */ |
|
1584 | - $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
1585 | - } |
|
1586 | - |
|
1587 | - // Check if there is a custom field key specific filter. |
|
1588 | - if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
1589 | - /** |
|
1590 | - * Filter the taxonomy html by field type key. |
|
1591 | - * |
|
1592 | - * @param string $html The html to filter. |
|
1593 | - * @param string $location The location to output the html. |
|
1594 | - * @param array $cf The custom field array. |
|
1595 | - * @since 1.6.6 |
|
1596 | - */ |
|
1597 | - $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1598 | - } |
|
1599 | - |
|
1600 | - // If not html then we run the standard output. |
|
1601 | - if(empty($html)){ |
|
1602 | - |
|
1603 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
1604 | - $post_taxonomy = $post->post_type . 'category'; |
|
1605 | - $field_value = $post->{$html_var}; |
|
1606 | - $links = array(); |
|
1607 | - $terms = array(); |
|
1608 | - $termsOrdered = array(); |
|
1609 | - if (!is_array($field_value)) { |
|
1610 | - $field_value = explode(",", trim($field_value, ",")); |
|
1611 | - } |
|
1612 | - |
|
1613 | - $field_value = array_unique($field_value); |
|
1614 | - |
|
1615 | - if (!empty($field_value)) { |
|
1616 | - foreach ($field_value as $term) { |
|
1617 | - $term = trim($term); |
|
1618 | - |
|
1619 | - if ($term != '') { |
|
1620 | - $term = get_term_by('id', $term, $html_var); |
|
1621 | - if (is_object($term)) { |
|
1622 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
1623 | - $terms[] = $term; |
|
1624 | - } |
|
1625 | - } |
|
1626 | - } |
|
1627 | - if (!empty($links)) { |
|
1628 | - // order alphabetically |
|
1629 | - asort($links); |
|
1630 | - foreach (array_keys($links) as $key) { |
|
1631 | - $termsOrdered[$key] = $terms[$key]; |
|
1632 | - } |
|
1633 | - $terms = $termsOrdered; |
|
1634 | - } |
|
1635 | - } |
|
1636 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
1637 | - |
|
1638 | - if ($html_value != '') { |
|
1639 | - $field_icon = geodir_field_icon_proccess($cf); |
|
1640 | - if (strpos($field_icon, 'http') !== false) { |
|
1641 | - $field_icon_af = ''; |
|
1642 | - } else if ($field_icon == '') { |
|
1643 | - $field_icon_af = ''; |
|
1644 | - } else { |
|
1645 | - $field_icon_af = $field_icon; |
|
1646 | - $field_icon = ''; |
|
1647 | - } |
|
1648 | - |
|
1649 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
1650 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1651 | - $html .= '</span> ' . $html_value . '</div>'; |
|
1652 | - } |
|
1653 | - } |
|
1654 | - |
|
1655 | - } |
|
1656 | - |
|
1657 | - return $html; |
|
1551 | + // check we have the post value |
|
1552 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1553 | + else{ global $post;} |
|
1554 | + |
|
1555 | + if(!is_array($cf) && $cf!=''){ |
|
1556 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1557 | + if(!$cf){return NULL;} |
|
1558 | + } |
|
1559 | + |
|
1560 | + $html_var = $cf['htmlvar_name']; |
|
1561 | + |
|
1562 | + // Check if there is a location specific filter. |
|
1563 | + if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
1564 | + /** |
|
1565 | + * Filter the taxonomy html by location. |
|
1566 | + * |
|
1567 | + * @param string $html The html to filter. |
|
1568 | + * @param array $cf The custom field array. |
|
1569 | + * @since 1.6.6 |
|
1570 | + */ |
|
1571 | + $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
1572 | + } |
|
1573 | + |
|
1574 | + // Check if there is a custom field specific filter. |
|
1575 | + if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
1576 | + /** |
|
1577 | + * Filter the taxonomy html by individual custom field. |
|
1578 | + * |
|
1579 | + * @param string $html The html to filter. |
|
1580 | + * @param string $location The location to output the html. |
|
1581 | + * @param array $cf The custom field array. |
|
1582 | + * @since 1.6.6 |
|
1583 | + */ |
|
1584 | + $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
1585 | + } |
|
1586 | + |
|
1587 | + // Check if there is a custom field key specific filter. |
|
1588 | + if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
1589 | + /** |
|
1590 | + * Filter the taxonomy html by field type key. |
|
1591 | + * |
|
1592 | + * @param string $html The html to filter. |
|
1593 | + * @param string $location The location to output the html. |
|
1594 | + * @param array $cf The custom field array. |
|
1595 | + * @since 1.6.6 |
|
1596 | + */ |
|
1597 | + $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1598 | + } |
|
1599 | + |
|
1600 | + // If not html then we run the standard output. |
|
1601 | + if(empty($html)){ |
|
1602 | + |
|
1603 | + if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
1604 | + $post_taxonomy = $post->post_type . 'category'; |
|
1605 | + $field_value = $post->{$html_var}; |
|
1606 | + $links = array(); |
|
1607 | + $terms = array(); |
|
1608 | + $termsOrdered = array(); |
|
1609 | + if (!is_array($field_value)) { |
|
1610 | + $field_value = explode(",", trim($field_value, ",")); |
|
1611 | + } |
|
1612 | + |
|
1613 | + $field_value = array_unique($field_value); |
|
1614 | + |
|
1615 | + if (!empty($field_value)) { |
|
1616 | + foreach ($field_value as $term) { |
|
1617 | + $term = trim($term); |
|
1618 | + |
|
1619 | + if ($term != '') { |
|
1620 | + $term = get_term_by('id', $term, $html_var); |
|
1621 | + if (is_object($term)) { |
|
1622 | + $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
1623 | + $terms[] = $term; |
|
1624 | + } |
|
1625 | + } |
|
1626 | + } |
|
1627 | + if (!empty($links)) { |
|
1628 | + // order alphabetically |
|
1629 | + asort($links); |
|
1630 | + foreach (array_keys($links) as $key) { |
|
1631 | + $termsOrdered[$key] = $terms[$key]; |
|
1632 | + } |
|
1633 | + $terms = $termsOrdered; |
|
1634 | + } |
|
1635 | + } |
|
1636 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
1637 | + |
|
1638 | + if ($html_value != '') { |
|
1639 | + $field_icon = geodir_field_icon_proccess($cf); |
|
1640 | + if (strpos($field_icon, 'http') !== false) { |
|
1641 | + $field_icon_af = ''; |
|
1642 | + } else if ($field_icon == '') { |
|
1643 | + $field_icon_af = ''; |
|
1644 | + } else { |
|
1645 | + $field_icon_af = $field_icon; |
|
1646 | + $field_icon = ''; |
|
1647 | + } |
|
1648 | + |
|
1649 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
1650 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1651 | + $html .= '</span> ' . $html_value . '</div>'; |
|
1652 | + } |
|
1653 | + } |
|
1654 | + |
|
1655 | + } |
|
1656 | + |
|
1657 | + return $html; |
|
1658 | 1658 | } |
1659 | 1659 | add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3); |
1660 | 1660 | |
@@ -1672,176 +1672,176 @@ discard block |
||
1672 | 1672 | */ |
1673 | 1673 | function geodir_cf_address($html,$location,$cf,$p=''){ |
1674 | 1674 | |
1675 | - // check we have the post value |
|
1676 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1677 | - else{ global $post;} |
|
1678 | - |
|
1679 | - if(!is_array($cf) && $cf!=''){ |
|
1680 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1681 | - if(!$cf){return NULL;} |
|
1682 | - } |
|
1683 | - |
|
1684 | - $html_var = $cf['htmlvar_name']; |
|
1685 | - |
|
1686 | - // Check if there is a location specific filter. |
|
1687 | - if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
1688 | - /** |
|
1689 | - * Filter the address html by location. |
|
1690 | - * |
|
1691 | - * @param string $html The html to filter. |
|
1692 | - * @param array $cf The custom field array. |
|
1693 | - * @since 1.6.6 |
|
1694 | - */ |
|
1695 | - $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
1696 | - } |
|
1697 | - |
|
1698 | - // Check if there is a custom field specific filter. |
|
1699 | - if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
1700 | - /** |
|
1701 | - * Filter the address html by individual custom field. |
|
1702 | - * |
|
1703 | - * @param string $html The html to filter. |
|
1704 | - * @param string $location The location to output the html. |
|
1705 | - * @param array $cf The custom field array. |
|
1706 | - * @since 1.6.6 |
|
1707 | - */ |
|
1708 | - $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
1709 | - } |
|
1710 | - |
|
1711 | - // Check if there is a custom field key specific filter. |
|
1712 | - if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
1713 | - /** |
|
1714 | - * Filter the address html by field type key. |
|
1715 | - * |
|
1716 | - * @param string $html The html to filter. |
|
1717 | - * @param string $location The location to output the html. |
|
1718 | - * @param array $cf The custom field array. |
|
1719 | - * @since 1.6.6 |
|
1720 | - */ |
|
1721 | - $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1722 | - } |
|
1723 | - |
|
1724 | - // If not html then we run the standard output. |
|
1725 | - if(empty($html)){ |
|
1726 | - |
|
1727 | - global $preview; |
|
1728 | - $html_var = $cf['htmlvar_name'] . '_address'; |
|
1729 | - |
|
1730 | - if ($cf['extra_fields']) { |
|
1731 | - |
|
1732 | - $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
1733 | - |
|
1734 | - $addition_fields = ''; |
|
1735 | - |
|
1736 | - if (!empty($extra_fields)) { |
|
1737 | - |
|
1738 | - $show_city_in_address = false; |
|
1739 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
1740 | - $show_city_in_address = true; |
|
1741 | - } |
|
1742 | - /** |
|
1743 | - * Filter "show city in address" value. |
|
1744 | - * |
|
1745 | - * @since 1.0.0 |
|
1746 | - */ |
|
1747 | - $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
1748 | - |
|
1749 | - |
|
1750 | - $show_region_in_address = false; |
|
1751 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
1752 | - $show_region_in_address = true; |
|
1753 | - } |
|
1754 | - /** |
|
1755 | - * Filter "show region in address" value. |
|
1756 | - * |
|
1757 | - * @since 1.6.6 |
|
1758 | - */ |
|
1759 | - $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
1760 | - |
|
1761 | - $show_country_in_address = false; |
|
1762 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
1763 | - $show_country_in_address = true; |
|
1764 | - } |
|
1765 | - /** |
|
1766 | - * Filter "show country in address" value. |
|
1767 | - * |
|
1768 | - * @since 1.6.6 |
|
1769 | - */ |
|
1770 | - $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
1771 | - |
|
1772 | - $show_zip_in_address = false; |
|
1773 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
1774 | - $show_zip_in_address = true; |
|
1775 | - } |
|
1776 | - /** |
|
1777 | - * Filter "show zip in address" value. |
|
1778 | - * |
|
1779 | - * @since 1.6.6 |
|
1780 | - */ |
|
1781 | - $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
1782 | - |
|
1783 | - |
|
1784 | - } |
|
1785 | - |
|
1786 | - } |
|
1787 | - |
|
1788 | - |
|
1789 | - if ($post->{$html_var}) { |
|
1790 | - |
|
1791 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
1792 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
1793 | - $field_icon_af = ''; |
|
1794 | - } elseif ( $field_icon == '' ) { |
|
1795 | - $field_icon_af = '<i class="fa fa-home"></i>'; |
|
1796 | - } else { |
|
1797 | - $field_icon_af = $field_icon; |
|
1798 | - $field_icon = ''; |
|
1799 | - } |
|
1675 | + // check we have the post value |
|
1676 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1677 | + else{ global $post;} |
|
1678 | + |
|
1679 | + if(!is_array($cf) && $cf!=''){ |
|
1680 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
1681 | + if(!$cf){return NULL;} |
|
1682 | + } |
|
1683 | + |
|
1684 | + $html_var = $cf['htmlvar_name']; |
|
1685 | + |
|
1686 | + // Check if there is a location specific filter. |
|
1687 | + if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
1688 | + /** |
|
1689 | + * Filter the address html by location. |
|
1690 | + * |
|
1691 | + * @param string $html The html to filter. |
|
1692 | + * @param array $cf The custom field array. |
|
1693 | + * @since 1.6.6 |
|
1694 | + */ |
|
1695 | + $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
1696 | + } |
|
1697 | + |
|
1698 | + // Check if there is a custom field specific filter. |
|
1699 | + if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
1700 | + /** |
|
1701 | + * Filter the address html by individual custom field. |
|
1702 | + * |
|
1703 | + * @param string $html The html to filter. |
|
1704 | + * @param string $location The location to output the html. |
|
1705 | + * @param array $cf The custom field array. |
|
1706 | + * @since 1.6.6 |
|
1707 | + */ |
|
1708 | + $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
1709 | + } |
|
1710 | + |
|
1711 | + // Check if there is a custom field key specific filter. |
|
1712 | + if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
1713 | + /** |
|
1714 | + * Filter the address html by field type key. |
|
1715 | + * |
|
1716 | + * @param string $html The html to filter. |
|
1717 | + * @param string $location The location to output the html. |
|
1718 | + * @param array $cf The custom field array. |
|
1719 | + * @since 1.6.6 |
|
1720 | + */ |
|
1721 | + $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1722 | + } |
|
1723 | + |
|
1724 | + // If not html then we run the standard output. |
|
1725 | + if(empty($html)){ |
|
1726 | + |
|
1727 | + global $preview; |
|
1728 | + $html_var = $cf['htmlvar_name'] . '_address'; |
|
1729 | + |
|
1730 | + if ($cf['extra_fields']) { |
|
1731 | + |
|
1732 | + $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
1733 | + |
|
1734 | + $addition_fields = ''; |
|
1735 | + |
|
1736 | + if (!empty($extra_fields)) { |
|
1737 | + |
|
1738 | + $show_city_in_address = false; |
|
1739 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
1740 | + $show_city_in_address = true; |
|
1741 | + } |
|
1742 | + /** |
|
1743 | + * Filter "show city in address" value. |
|
1744 | + * |
|
1745 | + * @since 1.0.0 |
|
1746 | + */ |
|
1747 | + $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
1748 | + |
|
1749 | + |
|
1750 | + $show_region_in_address = false; |
|
1751 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
1752 | + $show_region_in_address = true; |
|
1753 | + } |
|
1754 | + /** |
|
1755 | + * Filter "show region in address" value. |
|
1756 | + * |
|
1757 | + * @since 1.6.6 |
|
1758 | + */ |
|
1759 | + $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
1760 | + |
|
1761 | + $show_country_in_address = false; |
|
1762 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
1763 | + $show_country_in_address = true; |
|
1764 | + } |
|
1765 | + /** |
|
1766 | + * Filter "show country in address" value. |
|
1767 | + * |
|
1768 | + * @since 1.6.6 |
|
1769 | + */ |
|
1770 | + $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
1771 | + |
|
1772 | + $show_zip_in_address = false; |
|
1773 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
1774 | + $show_zip_in_address = true; |
|
1775 | + } |
|
1776 | + /** |
|
1777 | + * Filter "show zip in address" value. |
|
1778 | + * |
|
1779 | + * @since 1.6.6 |
|
1780 | + */ |
|
1781 | + $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
1782 | + |
|
1783 | + |
|
1784 | + } |
|
1785 | + |
|
1786 | + } |
|
1787 | + |
|
1788 | + |
|
1789 | + if ($post->{$html_var}) { |
|
1790 | + |
|
1791 | + $field_icon = geodir_field_icon_proccess( $cf ); |
|
1792 | + if ( strpos( $field_icon, 'http' ) !== false ) { |
|
1793 | + $field_icon_af = ''; |
|
1794 | + } elseif ( $field_icon == '' ) { |
|
1795 | + $field_icon_af = '<i class="fa fa-home"></i>'; |
|
1796 | + } else { |
|
1797 | + $field_icon_af = $field_icon; |
|
1798 | + $field_icon = ''; |
|
1799 | + } |
|
1800 | 1800 | |
1801 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
1802 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
1803 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
1804 | - $html .= '</span>'; |
|
1801 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
1802 | + $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
1803 | + $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
1804 | + $html .= '</span>'; |
|
1805 | 1805 | |
1806 | - $address_fields = array(); |
|
1807 | - |
|
1808 | - if ( isset($post->post_address) ) { |
|
1809 | - $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>'; |
|
1810 | - } |
|
1811 | - if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
1812 | - $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>'; |
|
1813 | - } |
|
1814 | - if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
1815 | - $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>'; |
|
1816 | - } |
|
1817 | - if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
1818 | - $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>'; |
|
1819 | - } |
|
1820 | - if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
1821 | - $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>'; |
|
1822 | - } |
|
1806 | + $address_fields = array(); |
|
1807 | + |
|
1808 | + if ( isset($post->post_address) ) { |
|
1809 | + $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>'; |
|
1810 | + } |
|
1811 | + if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
1812 | + $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>'; |
|
1813 | + } |
|
1814 | + if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
1815 | + $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>'; |
|
1816 | + } |
|
1817 | + if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
1818 | + $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>'; |
|
1819 | + } |
|
1820 | + if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
1821 | + $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>'; |
|
1822 | + } |
|
1823 | 1823 | |
1824 | - /** |
|
1825 | - * Filter the address fields array being displayed. |
|
1826 | - * |
|
1827 | - * @param array $address_fields The array of address fields. |
|
1828 | - * @param object $post The current post object. |
|
1829 | - * @param array $cf The custom field array details. |
|
1830 | - * @param string $location The location to output the html. |
|
1831 | - * |
|
1832 | - * @since 1.6.21 |
|
1833 | - */ |
|
1834 | - $address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location); |
|
1824 | + /** |
|
1825 | + * Filter the address fields array being displayed. |
|
1826 | + * |
|
1827 | + * @param array $address_fields The array of address fields. |
|
1828 | + * @param object $post The current post object. |
|
1829 | + * @param array $cf The custom field array details. |
|
1830 | + * @param string $location The location to output the html. |
|
1831 | + * |
|
1832 | + * @since 1.6.21 |
|
1833 | + */ |
|
1834 | + $address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location); |
|
1835 | 1835 | |
1836 | - if (!empty($address_fields) && is_array($address_fields)) { |
|
1837 | - $address_fields = array_values($address_fields); |
|
1838 | - $html .= implode('<br>', $address_fields); |
|
1839 | - } |
|
1836 | + if (!empty($address_fields) && is_array($address_fields)) { |
|
1837 | + $address_fields = array_values($address_fields); |
|
1838 | + $html .= implode('<br>', $address_fields); |
|
1839 | + } |
|
1840 | 1840 | |
1841 | - $html .= '</div>'; |
|
1842 | - } |
|
1843 | - } |
|
1841 | + $html .= '</div>'; |
|
1842 | + } |
|
1843 | + } |
|
1844 | 1844 | |
1845 | - return $html; |
|
1845 | + return $html; |
|
1846 | 1846 | } |
1847 | 1847 | add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3); |
1848 | 1848 | \ No newline at end of file |
@@ -19,21 +19,21 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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') . ': ' : ' '; |
|
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').': ' : ' '; |
|
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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') . ': ' : ' '; |
|
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').': ' : ' '; |
|
477 | + $html .= '</span>'.$value.'</div>'; |
|
478 | 478 | |
479 | 479 | endif; |
480 | 480 | |
@@ -482,7 +482,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
663 | 663 | * @param array $cf The custom field array. |
664 | 664 | * @since 1.6.6 |
665 | 665 | */ |
666 | - $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
666 | + $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
670 | 670 | |
671 | 671 | // If not html then we run the standard output. |
672 | - if(empty($html)){ |
|
672 | + if (empty($html)) { |
|
673 | 673 | |
674 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
674 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
675 | 675 | |
676 | 676 | $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
677 | 677 | |
@@ -686,16 +686,16 @@ discard block |
||
686 | 686 | } |
687 | 687 | |
688 | 688 | |
689 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af; |
|
690 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
689 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af; |
|
690 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
691 | 691 | $html .= '</span>'; |
692 | 692 | |
693 | 693 | $value = $post->{$cf['htmlvar_name']}; |
694 | - if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){ |
|
694 | + if (isset($cf['data_type']) && ($cf['data_type'] == 'INT' || $cf['data_type'] == 'FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']) { |
|
695 | 695 | $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields'])); |
696 | - if(isset($extra_fields['is_price']) && $extra_fields['is_price']){ |
|
697 | - if(!ceil($value) > 0){return '';}// dont output blank prices |
|
698 | - $value = geodir_currency_format_number($value,$cf); |
|
696 | + if (isset($extra_fields['is_price']) && $extra_fields['is_price']) { |
|
697 | + if (!ceil($value) > 0) {return ''; }// dont output blank prices |
|
698 | + $value = geodir_currency_format_number($value, $cf); |
|
699 | 699 | } |
700 | 700 | } |
701 | 701 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | return $html; |
711 | 711 | } |
712 | -add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3); |
|
712 | +add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3); |
|
713 | 713 | |
714 | 714 | |
715 | 715 | /** |
@@ -722,21 +722,21 @@ discard block |
||
722 | 722 | * |
723 | 723 | * @return string The html to output for the custom field. |
724 | 724 | */ |
725 | -function geodir_cf_radio($html,$location,$cf,$p=''){ |
|
725 | +function geodir_cf_radio($html, $location, $cf, $p = '') { |
|
726 | 726 | |
727 | 727 | // check we have the post value |
728 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
729 | - else{ global $post;} |
|
728 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
729 | + else { global $post; } |
|
730 | 730 | |
731 | - if(!is_array($cf) && $cf!=''){ |
|
731 | + if (!is_array($cf) && $cf != '') { |
|
732 | 732 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
733 | - if(!$cf){return NULL;} |
|
733 | + if (!$cf) {return NULL; } |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | $html_var = $cf['htmlvar_name']; |
737 | 737 | |
738 | 738 | // Check if there is a location specific filter. |
739 | - if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){ |
|
739 | + if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) { |
|
740 | 740 | /** |
741 | 741 | * Filter the radio html by location. |
742 | 742 | * |
@@ -744,11 +744,11 @@ discard block |
||
744 | 744 | * @param array $cf The custom field array. |
745 | 745 | * @since 1.6.6 |
746 | 746 | */ |
747 | - $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf); |
|
747 | + $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | // Check if there is a custom field specific filter. |
751 | - if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){ |
|
751 | + if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) { |
|
752 | 752 | /** |
753 | 753 | * Filter the radio html by individual custom field. |
754 | 754 | * |
@@ -757,11 +757,11 @@ discard block |
||
757 | 757 | * @param array $cf The custom field array. |
758 | 758 | * @since 1.6.6 |
759 | 759 | */ |
760 | - $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf); |
|
760 | + $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf); |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | // Check if there is a custom field key specific filter. |
764 | - if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){ |
|
764 | + if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) { |
|
765 | 765 | /** |
766 | 766 | * Filter the radio html by field type key. |
767 | 767 | * |
@@ -770,11 +770,11 @@ discard block |
||
770 | 770 | * @param array $cf The custom field array. |
771 | 771 | * @since 1.6.6 |
772 | 772 | */ |
773 | - $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
773 | + $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | // If not html then we run the standard output. |
777 | - if(empty($html)){ |
|
777 | + if (empty($html)) { |
|
778 | 778 | |
779 | 779 | $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : ''; |
780 | 780 | if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
@@ -808,16 +808,16 @@ discard block |
||
808 | 808 | } |
809 | 809 | |
810 | 810 | |
811 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
812 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
813 | - $html .= '</span>' . $html_val . '</div>'; |
|
811 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af; |
|
812 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
813 | + $html .= '</span>'.$html_val.'</div>'; |
|
814 | 814 | endif; |
815 | 815 | |
816 | 816 | } |
817 | 817 | |
818 | 818 | return $html; |
819 | 819 | } |
820 | -add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3); |
|
820 | +add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3); |
|
821 | 821 | |
822 | 822 | |
823 | 823 | /** |
@@ -831,21 +831,21 @@ discard block |
||
831 | 831 | * |
832 | 832 | * @return string The html to output for the custom field. |
833 | 833 | */ |
834 | -function geodir_cf_select($html,$location,$cf,$p=''){ |
|
834 | +function geodir_cf_select($html, $location, $cf, $p = '') { |
|
835 | 835 | |
836 | 836 | // check we have the post value |
837 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
838 | - else{ global $post;} |
|
837 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
838 | + else { global $post; } |
|
839 | 839 | |
840 | - if(!is_array($cf) && $cf!=''){ |
|
840 | + if (!is_array($cf) && $cf != '') { |
|
841 | 841 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
842 | - if(!$cf){return NULL;} |
|
842 | + if (!$cf) {return NULL; } |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | $html_var = $cf['htmlvar_name']; |
846 | 846 | |
847 | 847 | // Check if there is a location specific filter. |
848 | - if(has_filter("geodir_custom_field_output_select_loc_{$location}")){ |
|
848 | + if (has_filter("geodir_custom_field_output_select_loc_{$location}")) { |
|
849 | 849 | /** |
850 | 850 | * Filter the select html by location. |
851 | 851 | * |
@@ -853,11 +853,11 @@ discard block |
||
853 | 853 | * @param array $cf The custom field array. |
854 | 854 | * @since 1.6.6 |
855 | 855 | */ |
856 | - $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf); |
|
856 | + $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf); |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | // Check if there is a custom field specific filter. |
860 | - if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){ |
|
860 | + if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) { |
|
861 | 861 | /** |
862 | 862 | * Filter the select html by individual custom field. |
863 | 863 | * |
@@ -866,11 +866,11 @@ discard block |
||
866 | 866 | * @param array $cf The custom field array. |
867 | 867 | * @since 1.6.6 |
868 | 868 | */ |
869 | - $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf); |
|
869 | + $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf); |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | // Check if there is a custom field key specific filter. |
873 | - if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){ |
|
873 | + if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) { |
|
874 | 874 | /** |
875 | 875 | * Filter the select html by field type key. |
876 | 876 | * |
@@ -879,11 +879,11 @@ discard block |
||
879 | 879 | * @param array $cf The custom field array. |
880 | 880 | * @since 1.6.6 |
881 | 881 | */ |
882 | - $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
882 | + $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | // If not html then we run the standard output. |
886 | - if(empty($html)){ |
|
886 | + if (empty($html)) { |
|
887 | 887 | |
888 | 888 | if ($post->{$cf['htmlvar_name']}): |
889 | 889 | $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
@@ -911,16 +911,16 @@ discard block |
||
911 | 911 | } |
912 | 912 | |
913 | 913 | |
914 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
915 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
916 | - $html .= '</span>' . $field_value . '</div>'; |
|
914 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
915 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
916 | + $html .= '</span>'.$field_value.'</div>'; |
|
917 | 917 | endif; |
918 | 918 | |
919 | 919 | } |
920 | 920 | |
921 | 921 | return $html; |
922 | 922 | } |
923 | -add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3); |
|
923 | +add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3); |
|
924 | 924 | |
925 | 925 | |
926 | 926 | /** |
@@ -933,21 +933,21 @@ discard block |
||
933 | 933 | * |
934 | 934 | * @return string The html to output for the custom field. |
935 | 935 | */ |
936 | -function geodir_cf_multiselect($html,$location,$cf,$p=''){ |
|
936 | +function geodir_cf_multiselect($html, $location, $cf, $p = '') { |
|
937 | 937 | |
938 | 938 | // check we have the post value |
939 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
940 | - else{ global $post;} |
|
939 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
940 | + else { global $post; } |
|
941 | 941 | |
942 | - if(!is_array($cf) && $cf!=''){ |
|
942 | + if (!is_array($cf) && $cf != '') { |
|
943 | 943 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
944 | - if(!$cf){return NULL;} |
|
944 | + if (!$cf) {return NULL; } |
|
945 | 945 | } |
946 | 946 | |
947 | 947 | $html_var = $cf['htmlvar_name']; |
948 | 948 | |
949 | 949 | // Check if there is a location specific filter. |
950 | - if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){ |
|
950 | + if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) { |
|
951 | 951 | /** |
952 | 952 | * Filter the multiselect html by location. |
953 | 953 | * |
@@ -955,11 +955,11 @@ discard block |
||
955 | 955 | * @param array $cf The custom field array. |
956 | 956 | * @since 1.6.6 |
957 | 957 | */ |
958 | - $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf); |
|
958 | + $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf); |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | // Check if there is a custom field specific filter. |
962 | - if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){ |
|
962 | + if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) { |
|
963 | 963 | /** |
964 | 964 | * Filter the multiselect html by individual custom field. |
965 | 965 | * |
@@ -968,11 +968,11 @@ discard block |
||
968 | 968 | * @param array $cf The custom field array. |
969 | 969 | * @since 1.6.6 |
970 | 970 | */ |
971 | - $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf); |
|
971 | + $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf); |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | // Check if there is a custom field key specific filter. |
975 | - if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){ |
|
975 | + if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) { |
|
976 | 976 | /** |
977 | 977 | * Filter the multiselect html by field type key. |
978 | 978 | * |
@@ -981,11 +981,11 @@ discard block |
||
981 | 981 | * @param array $cf The custom field array. |
982 | 982 | * @since 1.6.6 |
983 | 983 | */ |
984 | - $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
984 | + $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | // If not html then we run the standard output. |
988 | - if(empty($html)){ |
|
988 | + if (empty($html)) { |
|
989 | 989 | |
990 | 990 | |
991 | 991 | if (!empty($post->{$cf['htmlvar_name']})): |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | |
1007 | 1007 | $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ",")); |
1008 | 1008 | |
1009 | - if(is_array($field_values)){ |
|
1009 | + if (is_array($field_values)) { |
|
1010 | 1010 | $field_values = array_map('trim', $field_values); |
1011 | 1011 | } |
1012 | 1012 | |
@@ -1024,15 +1024,15 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | |
1027 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
1028 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1027 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
1028 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
1029 | 1029 | $html .= '</span>'; |
1030 | 1030 | |
1031 | 1031 | if (count($option_values) > 1) { |
1032 | 1032 | $html .= '<ul>'; |
1033 | 1033 | |
1034 | 1034 | foreach ($option_values as $val) { |
1035 | - $html .= '<li>' . $val . '</li>'; |
|
1035 | + $html .= '<li>'.$val.'</li>'; |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | $html .= '</ul>'; |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | |
1048 | 1048 | return $html; |
1049 | 1049 | } |
1050 | -add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3); |
|
1050 | +add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3); |
|
1051 | 1051 | |
1052 | 1052 | |
1053 | 1053 | /** |
@@ -1060,21 +1060,21 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @return string The html to output for the custom field. |
1062 | 1062 | */ |
1063 | -function geodir_cf_email($html,$location,$cf,$p=''){ |
|
1063 | +function geodir_cf_email($html, $location, $cf, $p = '') { |
|
1064 | 1064 | |
1065 | 1065 | // check we have the post value |
1066 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1067 | - else{ global $post;} |
|
1066 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
1067 | + else { global $post; } |
|
1068 | 1068 | |
1069 | - if(!is_array($cf) && $cf!=''){ |
|
1069 | + if (!is_array($cf) && $cf != '') { |
|
1070 | 1070 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
1071 | - if(!$cf){return NULL;} |
|
1071 | + if (!$cf) {return NULL; } |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | $html_var = $cf['htmlvar_name']; |
1075 | 1075 | |
1076 | 1076 | // Check if there is a location specific filter. |
1077 | - if(has_filter("geodir_custom_field_output_email_loc_{$location}")){ |
|
1077 | + if (has_filter("geodir_custom_field_output_email_loc_{$location}")) { |
|
1078 | 1078 | /** |
1079 | 1079 | * Filter the email html by location. |
1080 | 1080 | * |
@@ -1082,11 +1082,11 @@ discard block |
||
1082 | 1082 | * @param array $cf The custom field array. |
1083 | 1083 | * @since 1.6.6 |
1084 | 1084 | */ |
1085 | - $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf); |
|
1085 | + $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf); |
|
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | // Check if there is a custom field specific filter. |
1089 | - if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){ |
|
1089 | + if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) { |
|
1090 | 1090 | /** |
1091 | 1091 | * Filter the email html by individual custom field. |
1092 | 1092 | * |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | * @param array $cf The custom field array. |
1096 | 1096 | * @since 1.6.6 |
1097 | 1097 | */ |
1098 | - $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf); |
|
1098 | + $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | // Check if there is a custom field key specific filter. |
1102 | - if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){ |
|
1102 | + if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) { |
|
1103 | 1103 | /** |
1104 | 1104 | * Filter the email html by field type key. |
1105 | 1105 | * |
@@ -1108,18 +1108,18 @@ discard block |
||
1108 | 1108 | * @param array $cf The custom field array. |
1109 | 1109 | * @since 1.6.6 |
1110 | 1110 | */ |
1111 | - $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1111 | + $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | // If not html then we run the standard output. |
1115 | - if(empty($html)){ |
|
1115 | + if (empty($html)) { |
|
1116 | 1116 | |
1117 | 1117 | global $preview; |
1118 | 1118 | if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
1119 | 1119 | return ''; // Remove Send Enquiry from listings page |
1120 | 1120 | } |
1121 | 1121 | |
1122 | - $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type); |
|
1122 | + $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type); |
|
1123 | 1123 | |
1124 | 1124 | if ($cf['htmlvar_name'] == 'geodir_email' && $post->{$cf['htmlvar_name']}) { |
1125 | 1125 | $b_send_inquiry = ''; |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | $html = ''; |
1128 | 1128 | if (!$preview) { |
1129 | 1129 | $b_send_inquiry = 'b_send_inquiry'; |
1130 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
1130 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>'; |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -1140,20 +1140,20 @@ discard block |
||
1140 | 1140 | $field_icon = ''; |
1141 | 1141 | } |
1142 | 1142 | |
1143 | - $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
1143 | + $html .= '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af; |
|
1144 | 1144 | $seperator = ''; |
1145 | 1145 | if ($post->{$cf['htmlvar_name']}) { |
1146 | 1146 | $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); |
1147 | - $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
1147 | + $html .= '<a href="'.$b_send_inquiry_url.'" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>'; |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | $html .= '</span></div>'; |
1151 | 1151 | |
1152 | 1152 | |
1153 | 1153 | if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
1154 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
1154 | + $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>'; |
|
1155 | 1155 | } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
1156 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
1156 | + $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>'; |
|
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
@@ -1173,11 +1173,11 @@ discard block |
||
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | |
1176 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
1177 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1176 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af; |
|
1177 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
1178 | 1178 | $html .= '</span><span class="geodir-email-address-output">'; |
1179 | 1179 | $email = $post->{$cf['htmlvar_name']} ; |
1180 | - if($e_split = explode('@',$email)){ |
|
1180 | + if ($e_split = explode('@', $email)) { |
|
1181 | 1181 | /** |
1182 | 1182 | * Filter email custom field name output. |
1183 | 1183 | * |
@@ -1186,15 +1186,15 @@ discard block |
||
1186 | 1186 | * @param string $email The email string being output. |
1187 | 1187 | * @param array $cf Custom field variables array. |
1188 | 1188 | */ |
1189 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
1190 | - if($location=='mapbubble'){ |
|
1191 | - $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
|
1192 | - }else{ |
|
1193 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
1189 | + $email_name = apply_filters('geodir_email_field_name_output', $email, $cf); |
|
1190 | + if ($location == 'mapbubble') { |
|
1191 | + $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
|
1192 | + } else { |
|
1193 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
1194 | 1194 | } |
1195 | 1195 | |
1196 | - }else{ |
|
1197 | - $html .= $email; |
|
1196 | + } else { |
|
1197 | + $html .= $email; |
|
1198 | 1198 | } |
1199 | 1199 | $html .= '</span></div>'; |
1200 | 1200 | } |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | |
1206 | 1206 | return $html; |
1207 | 1207 | } |
1208 | -add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3); |
|
1208 | +add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3); |
|
1209 | 1209 | |
1210 | 1210 | |
1211 | 1211 | /** |
@@ -1218,21 +1218,21 @@ discard block |
||
1218 | 1218 | * |
1219 | 1219 | * @return string The html to output for the custom field. |
1220 | 1220 | */ |
1221 | -function geodir_cf_file($html,$location,$cf,$p=''){ |
|
1221 | +function geodir_cf_file($html, $location, $cf, $p = '') { |
|
1222 | 1222 | |
1223 | 1223 | // check we have the post value |
1224 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1225 | - else{ global $post;} |
|
1224 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
1225 | + else { global $post; } |
|
1226 | 1226 | |
1227 | - if(!is_array($cf) && $cf!=''){ |
|
1227 | + if (!is_array($cf) && $cf != '') { |
|
1228 | 1228 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
1229 | - if(!$cf){return NULL;} |
|
1229 | + if (!$cf) {return NULL; } |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | $html_var = $cf['htmlvar_name']; |
1233 | 1233 | |
1234 | 1234 | // Check if there is a location specific filter. |
1235 | - if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
1235 | + if (has_filter("geodir_custom_field_output_file_loc_{$location}")) { |
|
1236 | 1236 | /** |
1237 | 1237 | * Filter the file html by location. |
1238 | 1238 | * |
@@ -1240,11 +1240,11 @@ discard block |
||
1240 | 1240 | * @param array $cf The custom field array. |
1241 | 1241 | * @since 1.6.6 |
1242 | 1242 | */ |
1243 | - $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
1243 | + $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf); |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | // Check if there is a custom field specific filter. |
1247 | - if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
1247 | + if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) { |
|
1248 | 1248 | /** |
1249 | 1249 | * Filter the file html by individual custom field. |
1250 | 1250 | * |
@@ -1253,11 +1253,11 @@ discard block |
||
1253 | 1253 | * @param array $cf The custom field array. |
1254 | 1254 | * @since 1.6.6 |
1255 | 1255 | */ |
1256 | - $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
1256 | + $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf); |
|
1257 | 1257 | } |
1258 | 1258 | |
1259 | 1259 | // Check if there is a custom field key specific filter. |
1260 | - if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
1260 | + if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) { |
|
1261 | 1261 | /** |
1262 | 1262 | * Filter the file html by field type key. |
1263 | 1263 | * |
@@ -1266,11 +1266,11 @@ discard block |
||
1266 | 1266 | * @param array $cf The custom field array. |
1267 | 1267 | * @since 1.6.6 |
1268 | 1268 | */ |
1269 | - $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1269 | + $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
1270 | 1270 | } |
1271 | 1271 | |
1272 | 1272 | // If not html then we run the standard output. |
1273 | - if(empty($html)){ |
|
1273 | + if (empty($html)) { |
|
1274 | 1274 | |
1275 | 1275 | if (!empty($post->{$cf['htmlvar_name']})): |
1276 | 1276 | |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | if (!empty($files)): |
1279 | 1279 | |
1280 | 1280 | $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
1281 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
1281 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : ''; |
|
1282 | 1282 | |
1283 | 1283 | $file_paths = ''; |
1284 | 1284 | foreach ($files as $file) { |
@@ -1316,14 +1316,14 @@ discard block |
||
1316 | 1316 | //$file_paths .= '<img src="'.$file.'" />'; |
1317 | 1317 | $file_paths .= '</div>'; |
1318 | 1318 | }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
1319 | - $ext_path = '_' . $html_var . '_'; |
|
1319 | + $ext_path = '_'.$html_var.'_'; |
|
1320 | 1320 | $filename = explode($ext_path, $filename); |
1321 | 1321 | $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
1322 | 1322 | $file_paths .= do_shortcode('[audio src="'.$file.'" ]'); |
1323 | 1323 | } else { |
1324 | - $ext_path = '_' . $html_var . '_'; |
|
1324 | + $ext_path = '_'.$html_var.'_'; |
|
1325 | 1325 | $filename = explode($ext_path, $filename); |
1326 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
1326 | + $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>'; |
|
1327 | 1327 | } |
1328 | 1328 | } |
1329 | 1329 | } |
@@ -1338,11 +1338,11 @@ discard block |
||
1338 | 1338 | $field_icon = ''; |
1339 | 1339 | } |
1340 | 1340 | |
1341 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
1341 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' geodir-custom-file-box '.$cf['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
1342 | 1342 | $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
1343 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1343 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
1344 | 1344 | $html .= '</span>'; |
1345 | - $html .= $file_paths . '</div></div>'; |
|
1345 | + $html .= $file_paths.'</div></div>'; |
|
1346 | 1346 | |
1347 | 1347 | endif; |
1348 | 1348 | endif; |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | |
1352 | 1352 | return $html; |
1353 | 1353 | } |
1354 | -add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3); |
|
1354 | +add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3); |
|
1355 | 1355 | |
1356 | 1356 | |
1357 | 1357 | |
@@ -1365,21 +1365,21 @@ discard block |
||
1365 | 1365 | * |
1366 | 1366 | * @return string The html to output for the custom field. |
1367 | 1367 | */ |
1368 | -function geodir_cf_textarea($html,$location,$cf,$p=''){ |
|
1368 | +function geodir_cf_textarea($html, $location, $cf, $p = '') { |
|
1369 | 1369 | |
1370 | 1370 | // check we have the post value |
1371 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1372 | - else{ global $post;} |
|
1371 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
1372 | + else { global $post; } |
|
1373 | 1373 | |
1374 | - if(!is_array($cf) && $cf!=''){ |
|
1374 | + if (!is_array($cf) && $cf != '') { |
|
1375 | 1375 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
1376 | - if(!$cf){return NULL;} |
|
1376 | + if (!$cf) {return NULL; } |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | $html_var = $cf['htmlvar_name']; |
1380 | 1380 | |
1381 | 1381 | // Check if there is a location specific filter. |
1382 | - if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
1382 | + if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) { |
|
1383 | 1383 | /** |
1384 | 1384 | * Filter the textarea html by location. |
1385 | 1385 | * |
@@ -1387,11 +1387,11 @@ discard block |
||
1387 | 1387 | * @param array $cf The custom field array. |
1388 | 1388 | * @since 1.6.6 |
1389 | 1389 | */ |
1390 | - $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
1390 | + $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf); |
|
1391 | 1391 | } |
1392 | 1392 | |
1393 | 1393 | // Check if there is a custom field specific filter. |
1394 | - if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
1394 | + if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) { |
|
1395 | 1395 | /** |
1396 | 1396 | * Filter the textarea html by individual custom field. |
1397 | 1397 | * |
@@ -1400,11 +1400,11 @@ discard block |
||
1400 | 1400 | * @param array $cf The custom field array. |
1401 | 1401 | * @since 1.6.6 |
1402 | 1402 | */ |
1403 | - $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
1403 | + $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf); |
|
1404 | 1404 | } |
1405 | 1405 | |
1406 | 1406 | // Check if there is a custom field key specific filter. |
1407 | - if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
1407 | + if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) { |
|
1408 | 1408 | /** |
1409 | 1409 | * Filter the textarea html by field type key. |
1410 | 1410 | * |
@@ -1413,11 +1413,11 @@ discard block |
||
1413 | 1413 | * @param array $cf The custom field array. |
1414 | 1414 | * @since 1.6.6 |
1415 | 1415 | */ |
1416 | - $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1416 | + $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | // If not html then we run the standard output. |
1420 | - if(empty($html)){ |
|
1420 | + if (empty($html)) { |
|
1421 | 1421 | |
1422 | 1422 | if (!empty($post->{$cf['htmlvar_name']})) { |
1423 | 1423 | |
@@ -1432,9 +1432,9 @@ discard block |
||
1432 | 1432 | } |
1433 | 1433 | |
1434 | 1434 | |
1435 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
1436 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1437 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
1435 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af; |
|
1436 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
1437 | + $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>'; |
|
1438 | 1438 | |
1439 | 1439 | } |
1440 | 1440 | |
@@ -1442,7 +1442,7 @@ discard block |
||
1442 | 1442 | |
1443 | 1443 | return $html; |
1444 | 1444 | } |
1445 | -add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3); |
|
1445 | +add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3); |
|
1446 | 1446 | |
1447 | 1447 | |
1448 | 1448 | |
@@ -1456,21 +1456,21 @@ discard block |
||
1456 | 1456 | * |
1457 | 1457 | * @return string The html to output for the custom field. |
1458 | 1458 | */ |
1459 | -function geodir_cf_html($html,$location,$cf,$p=''){ |
|
1459 | +function geodir_cf_html($html, $location, $cf, $p = '') { |
|
1460 | 1460 | |
1461 | 1461 | // check we have the post value |
1462 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1463 | - else{ global $post;} |
|
1462 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
1463 | + else { global $post; } |
|
1464 | 1464 | |
1465 | - if(!is_array($cf) && $cf!=''){ |
|
1465 | + if (!is_array($cf) && $cf != '') { |
|
1466 | 1466 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
1467 | - if(!$cf){return NULL;} |
|
1467 | + if (!$cf) {return NULL; } |
|
1468 | 1468 | } |
1469 | 1469 | |
1470 | 1470 | $html_var = $cf['htmlvar_name']; |
1471 | 1471 | |
1472 | 1472 | // Check if there is a location specific filter. |
1473 | - if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
1473 | + if (has_filter("geodir_custom_field_output_html_loc_{$location}")) { |
|
1474 | 1474 | /** |
1475 | 1475 | * Filter the html html by location. |
1476 | 1476 | * |
@@ -1478,11 +1478,11 @@ discard block |
||
1478 | 1478 | * @param array $cf The custom field array. |
1479 | 1479 | * @since 1.6.6 |
1480 | 1480 | */ |
1481 | - $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
1481 | + $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf); |
|
1482 | 1482 | } |
1483 | 1483 | |
1484 | 1484 | // Check if there is a custom field specific filter. |
1485 | - if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
1485 | + if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) { |
|
1486 | 1486 | /** |
1487 | 1487 | * Filter the html html by individual custom field. |
1488 | 1488 | * |
@@ -1491,11 +1491,11 @@ discard block |
||
1491 | 1491 | * @param array $cf The custom field array. |
1492 | 1492 | * @since 1.6.6 |
1493 | 1493 | */ |
1494 | - $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
1494 | + $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf); |
|
1495 | 1495 | } |
1496 | 1496 | |
1497 | 1497 | // Check if there is a custom field key specific filter. |
1498 | - if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
1498 | + if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) { |
|
1499 | 1499 | /** |
1500 | 1500 | * Filter the html html by field type key. |
1501 | 1501 | * |
@@ -1504,11 +1504,11 @@ discard block |
||
1504 | 1504 | * @param array $cf The custom field array. |
1505 | 1505 | * @since 1.6.6 |
1506 | 1506 | */ |
1507 | - $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1507 | + $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
1508 | 1508 | } |
1509 | 1509 | |
1510 | 1510 | // If not html then we run the standard output. |
1511 | - if(empty($html)){ |
|
1511 | + if (empty($html)) { |
|
1512 | 1512 | |
1513 | 1513 | if (!empty($post->{$cf['htmlvar_name']})) { |
1514 | 1514 | |
@@ -1522,9 +1522,9 @@ discard block |
||
1522 | 1522 | $field_icon = ''; |
1523 | 1523 | } |
1524 | 1524 | |
1525 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
1526 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1527 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
1525 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af; |
|
1526 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
1527 | + $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>'; |
|
1528 | 1528 | |
1529 | 1529 | } |
1530 | 1530 | |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | return $html; |
1534 | 1534 | } |
1535 | -add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3); |
|
1535 | +add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3); |
|
1536 | 1536 | |
1537 | 1537 | |
1538 | 1538 | |
@@ -1546,21 +1546,21 @@ discard block |
||
1546 | 1546 | * |
1547 | 1547 | * @return string The html to output for the custom field. |
1548 | 1548 | */ |
1549 | -function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
|
1549 | +function geodir_cf_taxonomy($html, $location, $cf, $p = '') { |
|
1550 | 1550 | |
1551 | 1551 | // check we have the post value |
1552 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1553 | - else{ global $post;} |
|
1552 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
1553 | + else { global $post; } |
|
1554 | 1554 | |
1555 | - if(!is_array($cf) && $cf!=''){ |
|
1555 | + if (!is_array($cf) && $cf != '') { |
|
1556 | 1556 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
1557 | - if(!$cf){return NULL;} |
|
1557 | + if (!$cf) {return NULL; } |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | $html_var = $cf['htmlvar_name']; |
1561 | 1561 | |
1562 | 1562 | // Check if there is a location specific filter. |
1563 | - if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
1563 | + if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) { |
|
1564 | 1564 | /** |
1565 | 1565 | * Filter the taxonomy html by location. |
1566 | 1566 | * |
@@ -1568,11 +1568,11 @@ discard block |
||
1568 | 1568 | * @param array $cf The custom field array. |
1569 | 1569 | * @since 1.6.6 |
1570 | 1570 | */ |
1571 | - $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
1571 | + $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf); |
|
1572 | 1572 | } |
1573 | 1573 | |
1574 | 1574 | // Check if there is a custom field specific filter. |
1575 | - if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
1575 | + if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) { |
|
1576 | 1576 | /** |
1577 | 1577 | * Filter the taxonomy html by individual custom field. |
1578 | 1578 | * |
@@ -1581,11 +1581,11 @@ discard block |
||
1581 | 1581 | * @param array $cf The custom field array. |
1582 | 1582 | * @since 1.6.6 |
1583 | 1583 | */ |
1584 | - $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
1584 | + $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf); |
|
1585 | 1585 | } |
1586 | 1586 | |
1587 | 1587 | // Check if there is a custom field key specific filter. |
1588 | - if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
1588 | + if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) { |
|
1589 | 1589 | /** |
1590 | 1590 | * Filter the taxonomy html by field type key. |
1591 | 1591 | * |
@@ -1594,14 +1594,14 @@ discard block |
||
1594 | 1594 | * @param array $cf The custom field array. |
1595 | 1595 | * @since 1.6.6 |
1596 | 1596 | */ |
1597 | - $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1597 | + $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | // If not html then we run the standard output. |
1601 | - if(empty($html)){ |
|
1601 | + if (empty($html)) { |
|
1602 | 1602 | |
1603 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
1604 | - $post_taxonomy = $post->post_type . 'category'; |
|
1603 | + if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) { |
|
1604 | + $post_taxonomy = $post->post_type.'category'; |
|
1605 | 1605 | $field_value = $post->{$html_var}; |
1606 | 1606 | $links = array(); |
1607 | 1607 | $terms = array(); |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | if ($term != '') { |
1620 | 1620 | $term = get_term_by('id', $term, $html_var); |
1621 | 1621 | if (is_object($term)) { |
1622 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
1622 | + $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>"; |
|
1623 | 1623 | $terms[] = $term; |
1624 | 1624 | } |
1625 | 1625 | } |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | $terms = $termsOrdered; |
1634 | 1634 | } |
1635 | 1635 | } |
1636 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
1636 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : ''; |
|
1637 | 1637 | |
1638 | 1638 | if ($html_value != '') { |
1639 | 1639 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -1646,9 +1646,9 @@ discard block |
||
1646 | 1646 | $field_icon = ''; |
1647 | 1647 | } |
1648 | 1648 | |
1649 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
1650 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
1651 | - $html .= '</span> ' . $html_value . '</div>'; |
|
1649 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af; |
|
1650 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
1651 | + $html .= '</span> '.$html_value.'</div>'; |
|
1652 | 1652 | } |
1653 | 1653 | } |
1654 | 1654 | |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | |
1657 | 1657 | return $html; |
1658 | 1658 | } |
1659 | -add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3); |
|
1659 | +add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3); |
|
1660 | 1660 | |
1661 | 1661 | |
1662 | 1662 | /** |
@@ -1670,21 +1670,21 @@ discard block |
||
1670 | 1670 | * |
1671 | 1671 | * @return string The html to output for the custom field. |
1672 | 1672 | */ |
1673 | -function geodir_cf_address($html,$location,$cf,$p=''){ |
|
1673 | +function geodir_cf_address($html, $location, $cf, $p = '') { |
|
1674 | 1674 | |
1675 | 1675 | // check we have the post value |
1676 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
1677 | - else{ global $post;} |
|
1676 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
1677 | + else { global $post; } |
|
1678 | 1678 | |
1679 | - if(!is_array($cf) && $cf!=''){ |
|
1679 | + if (!is_array($cf) && $cf != '') { |
|
1680 | 1680 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
1681 | - if(!$cf){return NULL;} |
|
1681 | + if (!$cf) {return NULL; } |
|
1682 | 1682 | } |
1683 | 1683 | |
1684 | 1684 | $html_var = $cf['htmlvar_name']; |
1685 | 1685 | |
1686 | 1686 | // Check if there is a location specific filter. |
1687 | - if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
1687 | + if (has_filter("geodir_custom_field_output_address_loc_{$location}")) { |
|
1688 | 1688 | /** |
1689 | 1689 | * Filter the address html by location. |
1690 | 1690 | * |
@@ -1692,11 +1692,11 @@ discard block |
||
1692 | 1692 | * @param array $cf The custom field array. |
1693 | 1693 | * @since 1.6.6 |
1694 | 1694 | */ |
1695 | - $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
1695 | + $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf); |
|
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | // Check if there is a custom field specific filter. |
1699 | - if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
1699 | + if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) { |
|
1700 | 1700 | /** |
1701 | 1701 | * Filter the address html by individual custom field. |
1702 | 1702 | * |
@@ -1705,11 +1705,11 @@ discard block |
||
1705 | 1705 | * @param array $cf The custom field array. |
1706 | 1706 | * @since 1.6.6 |
1707 | 1707 | */ |
1708 | - $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
1708 | + $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf); |
|
1709 | 1709 | } |
1710 | 1710 | |
1711 | 1711 | // Check if there is a custom field key specific filter. |
1712 | - if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
1712 | + if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) { |
|
1713 | 1713 | /** |
1714 | 1714 | * Filter the address html by field type key. |
1715 | 1715 | * |
@@ -1718,14 +1718,14 @@ discard block |
||
1718 | 1718 | * @param array $cf The custom field array. |
1719 | 1719 | * @since 1.6.6 |
1720 | 1720 | */ |
1721 | - $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
1721 | + $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
1722 | 1722 | } |
1723 | 1723 | |
1724 | 1724 | // If not html then we run the standard output. |
1725 | - if(empty($html)){ |
|
1725 | + if (empty($html)) { |
|
1726 | 1726 | |
1727 | 1727 | global $preview; |
1728 | - $html_var = $cf['htmlvar_name'] . '_address'; |
|
1728 | + $html_var = $cf['htmlvar_name'].'_address'; |
|
1729 | 1729 | |
1730 | 1730 | if ($cf['extra_fields']) { |
1731 | 1731 | |
@@ -1788,37 +1788,37 @@ discard block |
||
1788 | 1788 | |
1789 | 1789 | if ($post->{$html_var}) { |
1790 | 1790 | |
1791 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
1792 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
1791 | + $field_icon = geodir_field_icon_proccess($cf); |
|
1792 | + if (strpos($field_icon, 'http') !== false) { |
|
1793 | 1793 | $field_icon_af = ''; |
1794 | - } elseif ( $field_icon == '' ) { |
|
1794 | + } elseif ($field_icon == '') { |
|
1795 | 1795 | $field_icon_af = '<i class="fa fa-home"></i>'; |
1796 | 1796 | } else { |
1797 | 1797 | $field_icon_af = $field_icon; |
1798 | 1798 | $field_icon = ''; |
1799 | 1799 | } |
1800 | 1800 | |
1801 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
1802 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
1803 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
1801 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
1802 | + $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af; |
|
1803 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ' '; |
|
1804 | 1804 | $html .= '</span>'; |
1805 | 1805 | |
1806 | 1806 | $address_fields = array(); |
1807 | 1807 | |
1808 | - if ( isset($post->post_address) ) { |
|
1809 | - $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>'; |
|
1808 | + if (isset($post->post_address)) { |
|
1809 | + $address_fields['post_address'] = '<span itemprop="streetAddress">'.$post->post_address.'</span>'; |
|
1810 | 1810 | } |
1811 | - if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
1812 | - $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>'; |
|
1811 | + if ($show_city_in_address && isset($post->post_city) && $post->post_city) { |
|
1812 | + $address_fields['post_city'] = '<span itemprop="addressLocality">'.$post->post_city.'</span>'; |
|
1813 | 1813 | } |
1814 | - if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
1815 | - $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>'; |
|
1814 | + if ($show_region_in_address && isset($post->post_region) && $post->post_region) { |
|
1815 | + $address_fields['post_region'] = '<span itemprop="addressRegion">'.$post->post_region.'</span>'; |
|
1816 | 1816 | } |
1817 | - if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
1818 | - $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>'; |
|
1817 | + if ($show_zip_in_address && isset($post->post_zip) && $post->post_zip) { |
|
1818 | + $address_fields['post_zip'] = '<span itemprop="postalCode">'.$post->post_zip.'</span>'; |
|
1819 | 1819 | } |
1820 | - if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
1821 | - $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>'; |
|
1820 | + if ($show_country_in_address && isset($post->post_country) && $post->post_country) { |
|
1821 | + $address_fields['post_country'] = '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span>'; |
|
1822 | 1822 | } |
1823 | 1823 | |
1824 | 1824 | /** |
@@ -1844,4 +1844,4 @@ discard block |
||
1844 | 1844 | |
1845 | 1845 | return $html; |
1846 | 1846 | } |
1847 | -add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3); |
|
1848 | 1847 | \ No newline at end of file |
1848 | +add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3); |
|
1849 | 1849 | \ No newline at end of file |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function geodir_divi_signup_body_class($classes) |
21 | 21 | { |
22 | - if (geodir_is_page('login')) { |
|
23 | - $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
24 | - $classes[] = 'divi-gd-signup'; |
|
25 | - } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) { |
|
26 | - $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar'; |
|
27 | - } |
|
28 | - return $classes; |
|
22 | + if (geodir_is_page('login')) { |
|
23 | + $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
24 | + $classes[] = 'divi-gd-signup'; |
|
25 | + } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) { |
|
26 | + $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar'; |
|
27 | + } |
|
28 | + return $classes; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | add_action('geodir_wrapper_close', 'geodir_divi_action_wrapper_close', 11); |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function geodir_divi_action_wrapper_close() |
39 | 39 | { |
40 | - if (geodir_is_page('login')) { |
|
41 | - // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
42 | - echo '</div></div>'; |
|
43 | - } |
|
40 | + if (geodir_is_page('login')) { |
|
41 | + // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
42 | + echo '</div></div>'; |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -22,7 +22,7 @@ |
||
22 | 22 | if (geodir_is_page('login')) { |
23 | 23 | $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
24 | 24 | $classes[] = 'divi-gd-signup'; |
25 | - } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) { |
|
25 | + } else if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
26 | 26 | $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar'; |
27 | 27 | } |
28 | 28 | return $classes; |
@@ -17,26 +17,26 @@ discard block |
||
17 | 17 | function gd_compat_php_genesis() |
18 | 18 | { |
19 | 19 | // REPLACE GENESIS BREADCRUMBS WITH GD BREADCRUMBS |
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | 26 | |
27 | 27 | |
28 | - // make top section wide |
|
29 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
28 | + // make top section wide |
|
29 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
35 | 35 | |
36 | - // REMOVE PAGE TITLES |
|
37 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
36 | + // REMOVE PAGE TITLES |
|
37 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | } |
@@ -53,25 +53,25 @@ discard block |
||
53 | 53 | function gd_genesis_compat_left_sidebars() |
54 | 54 | { |
55 | 55 | |
56 | - if (is_page_geodir_home()) { |
|
57 | - remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | - } elseif (geodir_is_page('location')) { |
|
60 | - remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | - } elseif (geodir_is_page('listing')) { |
|
63 | - remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | - add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | - } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | - //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | - //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | - } elseif (geodir_is_page('search')) { |
|
69 | - remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | - add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | - } elseif (geodir_is_page('author')) { |
|
72 | - remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | - add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | - } |
|
56 | + if (is_page_geodir_home()) { |
|
57 | + remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | + } elseif (geodir_is_page('location')) { |
|
60 | + remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | + } elseif (geodir_is_page('listing')) { |
|
63 | + remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | + add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | + } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | + //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | + //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | + } elseif (geodir_is_page('search')) { |
|
69 | + remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | + add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | + } elseif (geodir_is_page('author')) { |
|
72 | + remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | + add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | } |
@@ -88,68 +88,68 @@ discard block |
||
88 | 88 | */ |
89 | 89 | function geodir_set_body_scs($classes) |
90 | 90 | { |
91 | - $remove_class = false; |
|
92 | - $new_class = ''; |
|
93 | - if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
94 | - $remove_class = true; |
|
95 | - if (get_option('geodir_show_home_left_section')) { |
|
96 | - $new_class .= 'sidebar-'; |
|
97 | - } |
|
98 | - if (get_option('geodir_show_home_contant_section')) { |
|
99 | - $new_class .= 'content'; |
|
100 | - } |
|
101 | - if (get_option('geodir_show_home_right_section')) { |
|
102 | - $new_class .= '-sidebar'; |
|
103 | - } |
|
104 | - } elseif (geodir_is_page('listing')) { |
|
105 | - $remove_class = true; |
|
106 | - if (get_option('geodir_show_listing_left_section')) { |
|
107 | - $new_class .= 'sidebar-'; |
|
108 | - } |
|
109 | - $new_class .= 'content'; |
|
110 | - if (get_option('geodir_show_listing_right_section')) { |
|
111 | - $new_class .= '-sidebar'; |
|
112 | - } |
|
113 | - } elseif (geodir_is_page('detail')) { |
|
114 | - $remove_class = true; |
|
115 | - if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | - $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | - } else { |
|
118 | - $new_class .= 'content-sidebar'; |
|
119 | - } |
|
120 | - } elseif (geodir_is_page('search')) { |
|
121 | - $remove_class = true; |
|
122 | - if (get_option('geodir_show_search_left_section')) { |
|
123 | - $new_class .= 'sidebar-'; |
|
124 | - } |
|
125 | - $new_class .= 'content'; |
|
126 | - if (get_option('geodir_show_search_right_section')) { |
|
127 | - $new_class .= '-sidebar'; |
|
128 | - } |
|
129 | - } elseif (geodir_is_page('author')) { |
|
130 | - $remove_class = true; |
|
131 | - if (get_option('geodir_show_author_left_section')) { |
|
132 | - $new_class .= 'sidebar-'; |
|
133 | - } |
|
134 | - $new_class .= 'content'; |
|
135 | - if (get_option('geodir_show_author_right_section')) { |
|
136 | - $new_class .= '-sidebar'; |
|
137 | - } |
|
138 | - } elseif (geodir_is_page('add-listing')) { |
|
139 | - $remove_class = true; |
|
140 | - $new_class .= 'content-sidebar'; |
|
141 | - } |
|
142 | - |
|
143 | - if ($remove_class) { |
|
144 | - $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | - if ( $new_class == 'content' ) { |
|
146 | - $new_class = 'content-no-sidebar'; |
|
147 | - $classes[] = 'full-width-content'; |
|
148 | - } |
|
149 | - $classes[] = $new_class; |
|
150 | - } |
|
151 | - |
|
152 | - return $classes; |
|
91 | + $remove_class = false; |
|
92 | + $new_class = ''; |
|
93 | + if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
94 | + $remove_class = true; |
|
95 | + if (get_option('geodir_show_home_left_section')) { |
|
96 | + $new_class .= 'sidebar-'; |
|
97 | + } |
|
98 | + if (get_option('geodir_show_home_contant_section')) { |
|
99 | + $new_class .= 'content'; |
|
100 | + } |
|
101 | + if (get_option('geodir_show_home_right_section')) { |
|
102 | + $new_class .= '-sidebar'; |
|
103 | + } |
|
104 | + } elseif (geodir_is_page('listing')) { |
|
105 | + $remove_class = true; |
|
106 | + if (get_option('geodir_show_listing_left_section')) { |
|
107 | + $new_class .= 'sidebar-'; |
|
108 | + } |
|
109 | + $new_class .= 'content'; |
|
110 | + if (get_option('geodir_show_listing_right_section')) { |
|
111 | + $new_class .= '-sidebar'; |
|
112 | + } |
|
113 | + } elseif (geodir_is_page('detail')) { |
|
114 | + $remove_class = true; |
|
115 | + if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | + $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | + } else { |
|
118 | + $new_class .= 'content-sidebar'; |
|
119 | + } |
|
120 | + } elseif (geodir_is_page('search')) { |
|
121 | + $remove_class = true; |
|
122 | + if (get_option('geodir_show_search_left_section')) { |
|
123 | + $new_class .= 'sidebar-'; |
|
124 | + } |
|
125 | + $new_class .= 'content'; |
|
126 | + if (get_option('geodir_show_search_right_section')) { |
|
127 | + $new_class .= '-sidebar'; |
|
128 | + } |
|
129 | + } elseif (geodir_is_page('author')) { |
|
130 | + $remove_class = true; |
|
131 | + if (get_option('geodir_show_author_left_section')) { |
|
132 | + $new_class .= 'sidebar-'; |
|
133 | + } |
|
134 | + $new_class .= 'content'; |
|
135 | + if (get_option('geodir_show_author_right_section')) { |
|
136 | + $new_class .= '-sidebar'; |
|
137 | + } |
|
138 | + } elseif (geodir_is_page('add-listing')) { |
|
139 | + $remove_class = true; |
|
140 | + $new_class .= 'content-sidebar'; |
|
141 | + } |
|
142 | + |
|
143 | + if ($remove_class) { |
|
144 | + $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | + if ( $new_class == 'content' ) { |
|
146 | + $new_class = 'content-no-sidebar'; |
|
147 | + $classes[] = 'full-width-content'; |
|
148 | + } |
|
149 | + $classes[] = $new_class; |
|
150 | + } |
|
151 | + |
|
152 | + return $classes; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | add_action('genesis_after_header', 'gd_genesis_compat_add_top_section_back', 11); |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | function gd_genesis_compat_add_top_section_back() |
163 | 163 | { |
164 | 164 | |
165 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
166 | - geodir_action_geodir_sidebar_home_top(); |
|
167 | - } elseif (geodir_is_page('listing')) { |
|
168 | - geodir_action_geodir_sidebar_listings_top(); |
|
169 | - } elseif (geodir_is_page('detail')) { |
|
170 | - geodir_action_geodir_sidebar_detail_top(); |
|
171 | - } elseif (geodir_is_page('search')) { |
|
172 | - geodir_action_geodir_sidebar_search_top(); |
|
173 | - } elseif (geodir_is_page('author')) { |
|
174 | - geodir_action_geodir_sidebar_author_top(); |
|
175 | - } |
|
165 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
166 | + geodir_action_geodir_sidebar_home_top(); |
|
167 | + } elseif (geodir_is_page('listing')) { |
|
168 | + geodir_action_geodir_sidebar_listings_top(); |
|
169 | + } elseif (geodir_is_page('detail')) { |
|
170 | + geodir_action_geodir_sidebar_detail_top(); |
|
171 | + } elseif (geodir_is_page('search')) { |
|
172 | + geodir_action_geodir_sidebar_search_top(); |
|
173 | + } elseif (geodir_is_page('author')) { |
|
174 | + geodir_action_geodir_sidebar_author_top(); |
|
175 | + } |
|
176 | 176 | |
177 | 177 | |
178 | 178 | } |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | */ |
186 | 186 | function geodir_replace_breadcrumb() |
187 | 187 | { |
188 | - if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
189 | - } else { |
|
190 | - echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
191 | - geodir_breadcrumb(); |
|
192 | - echo '</div></div>'; |
|
193 | - } |
|
188 | + if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
189 | + } else { |
|
190 | + echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
191 | + geodir_breadcrumb(); |
|
192 | + echo '</div></div>'; |
|
193 | + } |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | // Force Full Width on signup page |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | */ |
204 | 204 | function geodir_genesis_meta() |
205 | 205 | { |
206 | - if (geodir_is_page('login')) { |
|
207 | - add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
208 | - } |
|
206 | + if (geodir_is_page('login')) { |
|
207 | + add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
208 | + } |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | add_action('geodir_add_listing_page_title', 'geodir_add_listing_page_title_genesis_before', 8); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | function geodir_add_listing_page_title_genesis_before() |
219 | 219 | { |
220 | 220 | |
221 | - echo "<div class='entry' >"; |
|
221 | + echo "<div class='entry' >"; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | function geodir_add_listing_form_genesis_after() |
233 | 233 | { |
234 | 234 | |
235 | - echo "</div>"; |
|
235 | + echo "</div>"; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -251,38 +251,38 @@ discard block |
||
251 | 251 | { |
252 | 252 | |
253 | 253 | |
254 | - $title = ''; |
|
255 | - $subtitle = ''; |
|
256 | - |
|
257 | - if (geodir_is_page('listing')) { |
|
258 | - echo '<div class="wrap gd-title-wrap">'; |
|
259 | - geodir_action_listings_title(); |
|
260 | - echo '</div>'; |
|
261 | - } |
|
262 | - |
|
263 | - if (geodir_is_page('add-listing')) { |
|
264 | - echo '<div class="wrap gd-title-wrap">'; |
|
265 | - geodir_action_add_listing_page_title(); |
|
266 | - echo '</div>'; |
|
267 | - } |
|
268 | - |
|
269 | - if (geodir_is_page('author')) { |
|
270 | - echo '<div class="wrap gd-title-wrap">'; |
|
271 | - geodir_action_author_page_title(); |
|
272 | - echo '</div>'; |
|
273 | - } |
|
274 | - |
|
275 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
276 | - echo '<div class="wrap gd-title-wrap">'; |
|
277 | - echo get_the_title(); |
|
278 | - echo '</div>'; |
|
279 | - } |
|
280 | - |
|
281 | - if (geodir_is_page('search')) { |
|
282 | - echo '<div class="wrap gd-title-wrap">'; |
|
283 | - geodir_action_search_page_title(); |
|
284 | - echo '</div>'; |
|
285 | - } |
|
254 | + $title = ''; |
|
255 | + $subtitle = ''; |
|
256 | + |
|
257 | + if (geodir_is_page('listing')) { |
|
258 | + echo '<div class="wrap gd-title-wrap">'; |
|
259 | + geodir_action_listings_title(); |
|
260 | + echo '</div>'; |
|
261 | + } |
|
262 | + |
|
263 | + if (geodir_is_page('add-listing')) { |
|
264 | + echo '<div class="wrap gd-title-wrap">'; |
|
265 | + geodir_action_add_listing_page_title(); |
|
266 | + echo '</div>'; |
|
267 | + } |
|
268 | + |
|
269 | + if (geodir_is_page('author')) { |
|
270 | + echo '<div class="wrap gd-title-wrap">'; |
|
271 | + geodir_action_author_page_title(); |
|
272 | + echo '</div>'; |
|
273 | + } |
|
274 | + |
|
275 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
276 | + echo '<div class="wrap gd-title-wrap">'; |
|
277 | + echo get_the_title(); |
|
278 | + echo '</div>'; |
|
279 | + } |
|
280 | + |
|
281 | + if (geodir_is_page('search')) { |
|
282 | + echo '<div class="wrap gd-title-wrap">'; |
|
283 | + geodir_action_search_page_title(); |
|
284 | + echo '</div>'; |
|
285 | + } |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | */ |
296 | 296 | function gd_genesis_listing_page_title_bar() |
297 | 297 | { |
298 | - geodir_action_listings_title(); |
|
299 | - //geodir_action_listings_description(); |
|
298 | + geodir_action_listings_title(); |
|
299 | + //geodir_action_listings_description(); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
@@ -309,19 +309,19 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function gd_compat_php_genesis_geo_1280_fix() |
311 | 311 | { |
312 | - if (function_exists('geo1280_search_bar')) { |
|
313 | - remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
314 | - add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
312 | + if (function_exists('geo1280_search_bar')) { |
|
313 | + remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
314 | + add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
315 | 315 | |
316 | - // |
|
316 | + // |
|
317 | 317 | |
318 | - remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
319 | - remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
320 | - add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
318 | + remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
319 | + remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
320 | + add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
321 | 321 | |
322 | - remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
323 | - add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
324 | - } |
|
322 | + remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
323 | + add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
324 | + } |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | function geo1280_search_bar_fix() |
334 | 334 | { |
335 | 335 | |
336 | - echo '<div class="geo1280-placeholder"></div>'; |
|
337 | - if (is_active_sidebar('search-bar')) { |
|
338 | - genesis_widget_area('search-bar', array( |
|
339 | - 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
340 | - 'after' => '</div></div>', |
|
341 | - )); |
|
342 | - } |
|
336 | + echo '<div class="geo1280-placeholder"></div>'; |
|
337 | + if (is_active_sidebar('search-bar')) { |
|
338 | + genesis_widget_area('search-bar', array( |
|
339 | + 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
340 | + 'after' => '</div></div>', |
|
341 | + )); |
|
342 | + } |
|
343 | 343 | } |
@@ -142,7 +142,7 @@ |
||
142 | 142 | |
143 | 143 | if ($remove_class) { |
144 | 144 | $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
145 | - if ( $new_class == 'content' ) { |
|
145 | + if ($new_class == 'content') { |
|
146 | 146 | $new_class = 'content-no-sidebar'; |
147 | 147 | $classes[] = 'full-width-content'; |
148 | 148 | } |
@@ -13,34 +13,34 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function geodir_user_favourite_listing_count($user_id=false) |
15 | 15 | { |
16 | - global $wpdb, $plugin_prefix, $current_user; |
|
16 | + global $wpdb, $plugin_prefix, $current_user; |
|
17 | 17 | |
18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
19 | - if(!$user_id){return array();} |
|
18 | + if(!$user_id){$user_id = $current_user->ID;} |
|
19 | + if(!$user_id){return array();} |
|
20 | 20 | |
21 | - $site_id = ''; |
|
22 | - if ( is_multisite() ) { |
|
23 | - $blog_id = get_current_blog_id(); |
|
24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
25 | - } |
|
21 | + $site_id = ''; |
|
22 | + if ( is_multisite() ) { |
|
23 | + $blog_id = get_current_blog_id(); |
|
24 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
25 | + } |
|
26 | 26 | |
27 | - $user_favorites = geodir_get_user_favourites($user_id); |
|
28 | - $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
27 | + $user_favorites = geodir_get_user_favourites($user_id); |
|
28 | + $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
29 | 29 | |
30 | - $user_listing = array(); |
|
31 | - if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
30 | + $user_listing = array(); |
|
31 | + if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
32 | + $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
33 | 33 | |
34 | - foreach ($all_posts as $ptype) { |
|
35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
34 | + foreach ($all_posts as $ptype) { |
|
35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
36 | 36 | |
37 | - if ($total_posts > 0) { |
|
38 | - $user_listing[$ptype] = $total_posts; |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
37 | + if ($total_posts > 0) { |
|
38 | + $user_listing[$ptype] = $total_posts; |
|
39 | + } |
|
40 | + } |
|
41 | + } |
|
42 | 42 | |
43 | - return $user_listing; |
|
43 | + return $user_listing; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,48 +50,48 @@ discard block |
||
50 | 50 | * @package GeoDirectory |
51 | 51 | */ |
52 | 52 | function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) { |
53 | - // My Favourites in Dashboard |
|
54 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
55 | - $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
56 | - |
|
57 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
58 | - $favourite_links = $output_type == 'link' ? array() : ''; |
|
59 | - $post_types = geodir_get_posttypes( 'object' ); |
|
60 | - |
|
61 | - $author_link = get_author_posts_url( $user_id ); |
|
62 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
63 | - |
|
64 | - foreach ( $post_types as $key => $postobj ) { |
|
65 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
66 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
67 | - $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
68 | - |
|
69 | - /** |
|
70 | - * Filter favorite listing link. |
|
71 | - * |
|
72 | - * @since 1.0.0 |
|
73 | - * @param string $post_type_link Favorite listing link. |
|
74 | - * @param string $key Favorite listing array key. |
|
75 | - * @param int $current_user->ID Current user ID. |
|
76 | - */ |
|
77 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
78 | - |
|
79 | - if ( $output_type == 'select' ) { |
|
80 | - $selected = ''; |
|
81 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
82 | - $selected = 'selected="selected"'; |
|
83 | - } |
|
84 | - |
|
85 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
86 | - } elseif ( $output_type == 'link' ) { |
|
87 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
88 | - } |
|
89 | - } |
|
90 | - } |
|
91 | - |
|
92 | - if ( ! empty( $favourite_links ) ) { |
|
93 | - if ( $output_type == 'select' ) { |
|
94 | - ?> |
|
53 | + // My Favourites in Dashboard |
|
54 | + $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
55 | + $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
56 | + |
|
57 | + if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
58 | + $favourite_links = $output_type == 'link' ? array() : ''; |
|
59 | + $post_types = geodir_get_posttypes( 'object' ); |
|
60 | + |
|
61 | + $author_link = get_author_posts_url( $user_id ); |
|
62 | + $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
63 | + |
|
64 | + foreach ( $post_types as $key => $postobj ) { |
|
65 | + if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
66 | + $name = __( $postobj->labels->name, 'geodirectory' ); |
|
67 | + $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
68 | + |
|
69 | + /** |
|
70 | + * Filter favorite listing link. |
|
71 | + * |
|
72 | + * @since 1.0.0 |
|
73 | + * @param string $post_type_link Favorite listing link. |
|
74 | + * @param string $key Favorite listing array key. |
|
75 | + * @param int $current_user->ID Current user ID. |
|
76 | + */ |
|
77 | + $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
78 | + |
|
79 | + if ( $output_type == 'select' ) { |
|
80 | + $selected = ''; |
|
81 | + if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
82 | + $selected = 'selected="selected"'; |
|
83 | + } |
|
84 | + |
|
85 | + $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
86 | + } elseif ( $output_type == 'link' ) { |
|
87 | + $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
88 | + } |
|
89 | + } |
|
90 | + } |
|
91 | + |
|
92 | + if ( ! empty( $favourite_links ) ) { |
|
93 | + if ( $output_type == 'select' ) { |
|
94 | + ?> |
|
95 | 95 | <li> |
96 | 96 | <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>"> |
97 | 97 | <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
@@ -99,55 +99,55 @@ discard block |
||
99 | 99 | </select> |
100 | 100 | </li> |
101 | 101 | <?php |
102 | - } elseif ( $output_type == 'link' ) { |
|
103 | - echo implode( " | ", $favourite_links ); |
|
104 | - } |
|
105 | - } |
|
106 | - } |
|
102 | + } elseif ( $output_type == 'link' ) { |
|
103 | + echo implode( " | ", $favourite_links ); |
|
104 | + } |
|
105 | + } |
|
106 | + } |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) { |
110 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
111 | - $user_listing = geodir_user_post_listing_count( $user_id ); |
|
112 | - |
|
113 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
114 | - $listing_links = $output_type == 'link' ? array() : ''; |
|
115 | - |
|
116 | - $post_types = geodir_get_posttypes( 'object' ); |
|
117 | - |
|
118 | - $author_link = get_author_posts_url( $user_id ); |
|
119 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
120 | - |
|
121 | - foreach ( $post_types as $key => $postobj ) { |
|
122 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
123 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
124 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
125 | - |
|
126 | - /** |
|
127 | - * Filter my listing link. |
|
128 | - * |
|
129 | - * @since 1.0.0 |
|
130 | - * @param string $listing_link My listing link. |
|
131 | - * @param string $key My listing array key. |
|
132 | - * @param int $current_user->ID Current user ID. |
|
133 | - */ |
|
134 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
135 | - if ( $output_type == 'select' ) { |
|
136 | - $selected = ''; |
|
137 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
138 | - $selected = 'selected="selected"'; |
|
139 | - } |
|
140 | - |
|
141 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
142 | - } elseif ( $output_type == 'link' ) { |
|
143 | - $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
144 | - } |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - if ( ! empty( $listing_links ) ) { |
|
149 | - if ( $output_type == 'select' ) { |
|
150 | - ?> |
|
110 | + $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
111 | + $user_listing = geodir_user_post_listing_count( $user_id ); |
|
112 | + |
|
113 | + if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
114 | + $listing_links = $output_type == 'link' ? array() : ''; |
|
115 | + |
|
116 | + $post_types = geodir_get_posttypes( 'object' ); |
|
117 | + |
|
118 | + $author_link = get_author_posts_url( $user_id ); |
|
119 | + $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
120 | + |
|
121 | + foreach ( $post_types as $key => $postobj ) { |
|
122 | + if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
123 | + $name = __( $postobj->labels->name, 'geodirectory' ); |
|
124 | + $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
125 | + |
|
126 | + /** |
|
127 | + * Filter my listing link. |
|
128 | + * |
|
129 | + * @since 1.0.0 |
|
130 | + * @param string $listing_link My listing link. |
|
131 | + * @param string $key My listing array key. |
|
132 | + * @param int $current_user->ID Current user ID. |
|
133 | + */ |
|
134 | + $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
135 | + if ( $output_type == 'select' ) { |
|
136 | + $selected = ''; |
|
137 | + if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
138 | + $selected = 'selected="selected"'; |
|
139 | + } |
|
140 | + |
|
141 | + $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
142 | + } elseif ( $output_type == 'link' ) { |
|
143 | + $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + if ( ! empty( $listing_links ) ) { |
|
149 | + if ( $output_type == 'select' ) { |
|
150 | + ?> |
|
151 | 151 | <li> |
152 | 152 | <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>"> |
153 | 153 | <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | </select> |
156 | 156 | </li> |
157 | 157 | <?php |
158 | - } elseif ( $output_type == 'link' ) { |
|
159 | - echo implode( " | ", $listing_links ); |
|
160 | - } |
|
161 | - } |
|
162 | - } |
|
158 | + } elseif ( $output_type == 'link' ) { |
|
159 | + echo implode( " | ", $listing_links ); |
|
160 | + } |
|
161 | + } |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | * @return mixed |
171 | 171 | */ |
172 | 172 | function geodir_get_user_favourites($user_id=''){ |
173 | - if(!$user_id){$user_id = get_current_user_id();} |
|
174 | - $site_id = ''; |
|
175 | - if ( is_multisite() ) { |
|
176 | - $blog_id = get_current_blog_id(); |
|
177 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
178 | - } |
|
179 | - |
|
180 | - return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
173 | + if(!$user_id){$user_id = get_current_user_id();} |
|
174 | + $site_id = ''; |
|
175 | + if ( is_multisite() ) { |
|
176 | + $blog_id = get_current_blog_id(); |
|
177 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
178 | + } |
|
179 | + |
|
180 | + return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
181 | 181 | } |
182 | 182 | \ No newline at end of file |
@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
12 | 12 | * @return array User listing count for each post type. |
13 | 13 | */ |
14 | -function geodir_user_favourite_listing_count($user_id=false) |
|
14 | +function geodir_user_favourite_listing_count($user_id = false) |
|
15 | 15 | { |
16 | 16 | global $wpdb, $plugin_prefix, $current_user; |
17 | 17 | |
18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
19 | - if(!$user_id){return array();} |
|
18 | + if (!$user_id) {$user_id = $current_user->ID; } |
|
19 | + if (!$user_id) {return array(); } |
|
20 | 20 | |
21 | 21 | $site_id = ''; |
22 | - if ( is_multisite() ) { |
|
22 | + if (is_multisite()) { |
|
23 | 23 | $blog_id = get_current_blog_id(); |
24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
24 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $user_favorites = geodir_get_user_favourites($user_id); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | |
30 | 30 | $user_listing = array(); |
31 | 31 | if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
32 | + $user_favorites = "'".implode("','", $user_favorites)."'"; |
|
33 | 33 | |
34 | 34 | foreach ($all_posts as $ptype) { |
35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_type='".$ptype."' AND post_status = 'publish' AND ID IN (".$user_favorites.")"); |
|
36 | 36 | |
37 | 37 | if ($total_posts > 0) { |
38 | 38 | $user_listing[$ptype] = $total_posts; |
@@ -49,22 +49,22 @@ discard block |
||
49 | 49 | * @since 1.5.9 |
50 | 50 | * @package GeoDirectory |
51 | 51 | */ |
52 | -function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) { |
|
52 | +function geodir_user_show_favourites($user_id = '', $output_type = 'select') { |
|
53 | 53 | // My Favourites in Dashboard |
54 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
55 | - $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
54 | + $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
55 | + $user_favourite = geodir_user_favourite_listing_count($user_id); |
|
56 | 56 | |
57 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
57 | + if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
58 | 58 | $favourite_links = $output_type == 'link' ? array() : ''; |
59 | - $post_types = geodir_get_posttypes( 'object' ); |
|
59 | + $post_types = geodir_get_posttypes('object'); |
|
60 | 60 | |
61 | - $author_link = get_author_posts_url( $user_id ); |
|
62 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
61 | + $author_link = get_author_posts_url($user_id); |
|
62 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
63 | 63 | |
64 | - foreach ( $post_types as $key => $postobj ) { |
|
65 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
66 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
67 | - $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
64 | + foreach ($post_types as $key => $postobj) { |
|
65 | + if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
66 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
67 | + $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filter favorite listing link. |
@@ -74,54 +74,54 @@ discard block |
||
74 | 74 | * @param string $key Favorite listing array key. |
75 | 75 | * @param int $current_user->ID Current user ID. |
76 | 76 | */ |
77 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
77 | + $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id); |
|
78 | 78 | |
79 | - if ( $output_type == 'select' ) { |
|
79 | + if ($output_type == 'select') { |
|
80 | 80 | $selected = ''; |
81 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
81 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
82 | 82 | $selected = 'selected="selected"'; |
83 | 83 | } |
84 | 84 | |
85 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
86 | - } elseif ( $output_type == 'link' ) { |
|
87 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
85 | + $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.$name.'</option>'; |
|
86 | + } elseif ($output_type == 'link') { |
|
87 | + $favourite_links[] = '<a href="'.$post_type_link.'">'.$name.'</a>'; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - if ( ! empty( $favourite_links ) ) { |
|
93 | - if ( $output_type == 'select' ) { |
|
92 | + if (!empty($favourite_links)) { |
|
93 | + if ($output_type == 'select') { |
|
94 | 94 | ?> |
95 | 95 | <li> |
96 | - <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>"> |
|
97 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
96 | + <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Favorites', 'geodirectory'); ?>"> |
|
97 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Favorites", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
98 | 98 | <?php echo $favourite_links; ?> |
99 | 99 | </select> |
100 | 100 | </li> |
101 | 101 | <?php |
102 | - } elseif ( $output_type == 'link' ) { |
|
103 | - echo implode( " | ", $favourite_links ); |
|
102 | + } elseif ($output_type == 'link') { |
|
103 | + echo implode(" | ", $favourite_links); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | -function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) { |
|
110 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
111 | - $user_listing = geodir_user_post_listing_count( $user_id ); |
|
109 | +function geodir_user_show_listings($user_id = '', $output_type = 'select') { |
|
110 | + $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
111 | + $user_listing = geodir_user_post_listing_count($user_id); |
|
112 | 112 | |
113 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
113 | + if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
114 | 114 | $listing_links = $output_type == 'link' ? array() : ''; |
115 | 115 | |
116 | - $post_types = geodir_get_posttypes( 'object' ); |
|
116 | + $post_types = geodir_get_posttypes('object'); |
|
117 | 117 | |
118 | - $author_link = get_author_posts_url( $user_id ); |
|
119 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
118 | + $author_link = get_author_posts_url($user_id); |
|
119 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
120 | 120 | |
121 | - foreach ( $post_types as $key => $postobj ) { |
|
122 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
123 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
124 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
121 | + foreach ($post_types as $key => $postobj) { |
|
122 | + if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
123 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
124 | + $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Filter my listing link. |
@@ -131,32 +131,32 @@ discard block |
||
131 | 131 | * @param string $key My listing array key. |
132 | 132 | * @param int $current_user->ID Current user ID. |
133 | 133 | */ |
134 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
135 | - if ( $output_type == 'select' ) { |
|
134 | + $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id); |
|
135 | + if ($output_type == 'select') { |
|
136 | 136 | $selected = ''; |
137 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
137 | + if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
138 | 138 | $selected = 'selected="selected"'; |
139 | 139 | } |
140 | 140 | |
141 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
142 | - } elseif ( $output_type == 'link' ) { |
|
143 | - $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
141 | + $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.$name.'</option>'; |
|
142 | + } elseif ($output_type == 'link') { |
|
143 | + $listing_links[] = '<a href="'.$listing_link.'">'.$name.'</a>'; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - if ( ! empty( $listing_links ) ) { |
|
149 | - if ( $output_type == 'select' ) { |
|
148 | + if (!empty($listing_links)) { |
|
149 | + if ($output_type == 'select') { |
|
150 | 150 | ?> |
151 | 151 | <li> |
152 | - <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>"> |
|
153 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
152 | + <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Listings', 'geodirectory'); ?>"> |
|
153 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Listings", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
154 | 154 | <?php echo $listing_links; ?> |
155 | 155 | </select> |
156 | 156 | </li> |
157 | 157 | <?php |
158 | - } elseif ( $output_type == 'link' ) { |
|
159 | - echo implode( " | ", $listing_links ); |
|
158 | + } elseif ($output_type == 'link') { |
|
159 | + echo implode(" | ", $listing_links); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | * @since 1.6.24 |
170 | 170 | * @return mixed |
171 | 171 | */ |
172 | -function geodir_get_user_favourites($user_id=''){ |
|
173 | - if(!$user_id){$user_id = get_current_user_id();} |
|
172 | +function geodir_get_user_favourites($user_id = '') { |
|
173 | + if (!$user_id) {$user_id = get_current_user_id(); } |
|
174 | 174 | $site_id = ''; |
175 | - if ( is_multisite() ) { |
|
175 | + if (is_multisite()) { |
|
176 | 176 | $blog_id = get_current_blog_id(); |
177 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
177 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | global $post_type; |
19 | 19 | |
20 | 20 | if (!isset($field_info->post_type)) { |
21 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
21 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
22 | 22 | } else |
23 | - $post_type = $field_info->post_type; |
|
23 | + $post_type = $field_info->post_type; |
|
24 | 24 | |
25 | 25 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){ |
26 | 26 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $field_admin_title = ''; |
50 | 50 | if (isset($field_info->admin_title)) |
51 | - $field_admin_title = $field_info->admin_title; |
|
51 | + $field_admin_title = $field_info->admin_title; |
|
52 | 52 | |
53 | 53 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
54 | 54 | |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | //print_r($field_info); |
69 | 69 | |
70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
71 | - $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
71 | + $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
72 | 72 | }elseif(isset($cf['icon']) && $cf['icon']){ |
73 | - $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
|
73 | + $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
|
74 | 74 | }else{ |
75 | - $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
75 | + $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | if(isset($cf['name']) && $cf['name']){ |
79 | - $field_type_name = $cf['name']; |
|
79 | + $field_type_name = $cf['name']; |
|
80 | 80 | }else{ |
81 | - $field_type_name = $field_type; |
|
81 | + $field_type_name = $field_type; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') { |
85 | - $field_info->data_type = 'XVARCHAR'; |
|
85 | + $field_info->data_type = 'XVARCHAR'; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | ?> |
@@ -92,45 +92,45 @@ discard block |
||
92 | 92 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" > |
93 | 93 | <?php |
94 | 94 | |
95 | - $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
96 | - ?> |
|
95 | + $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
96 | + ?> |
|
97 | 97 | |
98 | 98 | <?php if (!$default): ?> |
99 | 99 | <div title="<?php _e('Click to remove field', 'geodirectory'); ?>" |
100 | 100 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')" |
101 | 101 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
102 | 102 | <?php endif; |
103 | - if ($field_type == 'fieldset') { |
|
104 | - ?> |
|
103 | + if ($field_type == 'fieldset') { |
|
104 | + ?> |
|
105 | 105 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
106 | 106 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
107 | 107 | <b style="cursor:pointer;" |
108 | 108 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b> |
109 | 109 | <?php |
110 | - } else {echo $field_icon; |
|
111 | - ?> |
|
110 | + } else {echo $field_icon; |
|
111 | + ?> |
|
112 | 112 | <b style="cursor:pointer;" |
113 | 113 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b> |
114 | 114 | <?php |
115 | - } |
|
116 | - ?> |
|
115 | + } |
|
116 | + ?> |
|
117 | 117 | </div> |
118 | 118 | |
119 | 119 | <form><!-- we need to wrap in a fom so we can use radio buttons with same name --> |
120 | 120 | <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
121 | 121 | style="display:<?php if ($field_ins_upd == 'submit') { |
122 | - echo 'block;'; |
|
123 | - } else { |
|
124 | - echo 'none;'; |
|
125 | - } ?>"> |
|
122 | + echo 'block;'; |
|
123 | + } else { |
|
124 | + echo 'none;'; |
|
125 | + } ?>"> |
|
126 | 126 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/> |
127 | 127 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
128 | 128 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
129 | 129 | <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/> |
130 | 130 | <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/> |
131 | 131 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) { |
132 | - echo $field_info->data_type; |
|
133 | - } ?>"/> |
|
132 | + echo $field_info->data_type; |
|
133 | + } ?>"/> |
|
134 | 134 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
135 | 135 | |
136 | 136 | <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
@@ -142,37 +142,37 @@ discard block |
||
142 | 142 | |
143 | 143 | <?php |
144 | 144 | |
145 | - // data_type |
|
146 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
145 | + // data_type |
|
146 | + if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
147 | 147 | |
148 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
148 | + echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
149 | 149 | |
150 | - }else{ |
|
151 | - $value = ''; |
|
152 | - if (isset($field_info->data_type)) { |
|
153 | - $value = esc_attr($field_info->data_type); |
|
154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
155 | - $value = $cf['defaults']['data_type']; |
|
156 | - } |
|
157 | - ?> |
|
150 | + }else{ |
|
151 | + $value = ''; |
|
152 | + if (isset($field_info->data_type)) { |
|
153 | + $value = esc_attr($field_info->data_type); |
|
154 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
155 | + $value = $cf['defaults']['data_type']; |
|
156 | + } |
|
157 | + ?> |
|
158 | 158 | <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
159 | 159 | <?php |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | 162 | |
163 | - // admin_title |
|
164 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
163 | + // admin_title |
|
164 | + if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
165 | 165 | |
166 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
166 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
167 | 167 | |
168 | - }else{ |
|
169 | - $value = ''; |
|
170 | - if (isset($field_info->admin_title)) { |
|
171 | - $value = esc_attr($field_info->admin_title); |
|
172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
173 | - $value = $cf['defaults']['admin_title']; |
|
174 | - } |
|
175 | - ?> |
|
168 | + }else{ |
|
169 | + $value = ''; |
|
170 | + if (isset($field_info->admin_title)) { |
|
171 | + $value = esc_attr($field_info->admin_title); |
|
172 | + }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
173 | + $value = $cf['defaults']['admin_title']; |
|
174 | + } |
|
175 | + ?> |
|
176 | 176 | <li> |
177 | 177 | <label for="admin_title" class="gd-cf-tooltip-wrap"> |
178 | 178 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?> |
@@ -186,22 +186,22 @@ discard block |
||
186 | 186 | </div> |
187 | 187 | </li> |
188 | 188 | <?php |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | 191 | |
192 | - // site_title |
|
193 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
192 | + // site_title |
|
193 | + if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
194 | 194 | |
195 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
195 | + echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
196 | 196 | |
197 | - }else{ |
|
198 | - $value = ''; |
|
199 | - if (isset($field_info->site_title)) { |
|
200 | - $value = esc_attr($field_info->site_title); |
|
201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
202 | - $value = $cf['defaults']['site_title']; |
|
203 | - } |
|
204 | - ?> |
|
197 | + }else{ |
|
198 | + $value = ''; |
|
199 | + if (isset($field_info->site_title)) { |
|
200 | + $value = esc_attr($field_info->site_title); |
|
201 | + }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
202 | + $value = $cf['defaults']['site_title']; |
|
203 | + } |
|
204 | + ?> |
|
205 | 205 | <li> |
206 | 206 | <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?> |
207 | 207 | <div class="gdcf-tooltip"> |
@@ -214,22 +214,22 @@ discard block |
||
214 | 214 | </div> |
215 | 215 | </li> |
216 | 216 | <?php |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | - // admin_desc |
|
221 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
220 | + // admin_desc |
|
221 | + if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
222 | 222 | |
223 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
223 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
224 | 224 | |
225 | - }else{ |
|
226 | - $value = ''; |
|
227 | - if (isset($field_info->admin_desc)) { |
|
228 | - $value = esc_attr($field_info->admin_desc); |
|
229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
230 | - $value = $cf['defaults']['admin_desc']; |
|
231 | - } |
|
232 | - ?> |
|
225 | + }else{ |
|
226 | + $value = ''; |
|
227 | + if (isset($field_info->admin_desc)) { |
|
228 | + $value = esc_attr($field_info->admin_desc); |
|
229 | + }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
230 | + $value = $cf['defaults']['admin_desc']; |
|
231 | + } |
|
232 | + ?> |
|
233 | 233 | <li> |
234 | 234 | <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?> |
235 | 235 | <div class="gdcf-tooltip"> |
@@ -241,23 +241,23 @@ discard block |
||
241 | 241 | </div> |
242 | 242 | </li> |
243 | 243 | <?php |
244 | - } |
|
244 | + } |
|
245 | 245 | |
246 | 246 | |
247 | 247 | |
248 | - // htmlvar_name |
|
249 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
248 | + // htmlvar_name |
|
249 | + if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
250 | 250 | |
251 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
251 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
252 | 252 | |
253 | - }else{ |
|
254 | - $value = ''; |
|
255 | - if (isset($field_info->htmlvar_name)) { |
|
256 | - $value = esc_attr($field_info->htmlvar_name); |
|
257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
258 | - $value = $cf['defaults']['htmlvar_name']; |
|
259 | - } |
|
260 | - ?> |
|
253 | + }else{ |
|
254 | + $value = ''; |
|
255 | + if (isset($field_info->htmlvar_name)) { |
|
256 | + $value = esc_attr($field_info->htmlvar_name); |
|
257 | + }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
258 | + $value = $cf['defaults']['htmlvar_name']; |
|
259 | + } |
|
260 | + ?> |
|
261 | 261 | <li> |
262 | 262 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?> |
263 | 263 | <div class="gdcf-tooltip"> |
@@ -267,29 +267,29 @@ discard block |
||
267 | 267 | <div class="gd-cf-input-wrap"> |
268 | 268 | <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>" |
269 | 269 | value="<?php if ($value) { |
270 | - echo preg_replace('/geodir_/', '', $value, 1); |
|
271 | - }?>" <?php if ($default) { |
|
272 | - echo 'readonly="readonly"'; |
|
273 | - }?> /> |
|
270 | + echo preg_replace('/geodir_/', '', $value, 1); |
|
271 | + }?>" <?php if ($default) { |
|
272 | + echo 'readonly="readonly"'; |
|
273 | + }?> /> |
|
274 | 274 | </div> |
275 | 275 | </li> |
276 | 276 | <?php |
277 | - } |
|
277 | + } |
|
278 | 278 | |
279 | 279 | |
280 | - // is_active |
|
281 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
280 | + // is_active |
|
281 | + if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
282 | 282 | |
283 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
283 | + echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
284 | 284 | |
285 | - }else{ |
|
286 | - $value = ''; |
|
287 | - if (isset($field_info->is_active)) { |
|
288 | - $value = esc_attr($field_info->is_active); |
|
289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
290 | - $value = $cf['defaults']['is_active']; |
|
291 | - } |
|
292 | - ?> |
|
285 | + }else{ |
|
286 | + $value = ''; |
|
287 | + if (isset($field_info->is_active)) { |
|
288 | + $value = esc_attr($field_info->is_active); |
|
289 | + }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
290 | + $value = $cf['defaults']['is_active']; |
|
291 | + } |
|
292 | + ?> |
|
293 | 293 | <li <?php echo $field_display; ?>> |
294 | 294 | <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?> |
295 | 295 | <div class="gdcf-tooltip"> |
@@ -300,35 +300,35 @@ discard block |
||
300 | 300 | |
301 | 301 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
302 | 302 | <?php if ($value == '1') { |
303 | - echo 'checked'; |
|
304 | - } ?>/> |
|
303 | + echo 'checked'; |
|
304 | + } ?>/> |
|
305 | 305 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
306 | 306 | |
307 | 307 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
308 | 308 | <?php if ($value == '0' || !$value) { |
309 | - echo 'checked'; |
|
310 | - } ?>/> |
|
309 | + echo 'checked'; |
|
310 | + } ?>/> |
|
311 | 311 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
312 | 312 | |
313 | 313 | </div> |
314 | 314 | </li> |
315 | 315 | <?php |
316 | - } |
|
316 | + } |
|
317 | 317 | |
318 | 318 | |
319 | - // for_admin_use |
|
320 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
319 | + // for_admin_use |
|
320 | + if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
321 | 321 | |
322 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
322 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
323 | 323 | |
324 | - }else{ |
|
325 | - $value = ''; |
|
326 | - if (isset($field_info->for_admin_use)) { |
|
327 | - $value = esc_attr($field_info->for_admin_use); |
|
328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
329 | - $value = $cf['defaults']['for_admin_use']; |
|
330 | - } |
|
331 | - ?> |
|
324 | + }else{ |
|
325 | + $value = ''; |
|
326 | + if (isset($field_info->for_admin_use)) { |
|
327 | + $value = esc_attr($field_info->for_admin_use); |
|
328 | + }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
329 | + $value = $cf['defaults']['for_admin_use']; |
|
330 | + } |
|
331 | + ?> |
|
332 | 332 | <li> |
333 | 333 | <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?> |
334 | 334 | <div class="gdcf-tooltip"> |
@@ -339,47 +339,47 @@ discard block |
||
339 | 339 | |
340 | 340 | <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
341 | 341 | <?php if ($value == '1') { |
342 | - echo 'checked'; |
|
343 | - } ?>/> |
|
342 | + echo 'checked'; |
|
343 | + } ?>/> |
|
344 | 344 | <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
345 | 345 | |
346 | 346 | <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
347 | 347 | <?php if ($value == '0' || !$value) { |
348 | - echo 'checked'; |
|
349 | - } ?>/> |
|
348 | + echo 'checked'; |
|
349 | + } ?>/> |
|
350 | 350 | <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
351 | 351 | |
352 | 352 | </div> |
353 | 353 | </li> |
354 | 354 | <?php |
355 | - } |
|
355 | + } |
|
356 | 356 | |
357 | 357 | |
358 | - // default_value |
|
359 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
358 | + // default_value |
|
359 | + if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
360 | 360 | |
361 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
361 | + echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
362 | 362 | |
363 | - }else{ |
|
364 | - $value = ''; |
|
365 | - if (isset($field_info->default_value)) { |
|
366 | - $value = esc_attr($field_info->default_value); |
|
367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
368 | - $value = $cf['defaults']['default_value']; |
|
369 | - } |
|
370 | - ?> |
|
363 | + }else{ |
|
364 | + $value = ''; |
|
365 | + if (isset($field_info->default_value)) { |
|
366 | + $value = esc_attr($field_info->default_value); |
|
367 | + }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
368 | + $value = $cf['defaults']['default_value']; |
|
369 | + } |
|
370 | + ?> |
|
371 | 371 | <li> |
372 | 372 | <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?> |
373 | 373 | <div class="gdcf-tooltip"> |
374 | 374 | <?php |
375 | - if ($field_type == 'checkbox') { |
|
376 | - _e('Should the checkbox be checked by default?', 'geodirectory'); |
|
377 | - } else if ($field_type == 'email') { |
|
378 | - _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory'); |
|
379 | - } else { |
|
380 | - _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory'); |
|
381 | - } |
|
382 | - ?> |
|
375 | + if ($field_type == 'checkbox') { |
|
376 | + _e('Should the checkbox be checked by default?', 'geodirectory'); |
|
377 | + } else if ($field_type == 'email') { |
|
378 | + _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory'); |
|
379 | + } else { |
|
380 | + _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory'); |
|
381 | + } |
|
382 | + ?> |
|
383 | 383 | </div> |
384 | 384 | </label> |
385 | 385 | <div class="gd-cf-input-wrap"> |
@@ -396,22 +396,22 @@ discard block |
||
396 | 396 | </div> |
397 | 397 | </li> |
398 | 398 | <?php |
399 | - } |
|
399 | + } |
|
400 | 400 | |
401 | 401 | |
402 | - // show_in |
|
403 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
402 | + // show_in |
|
403 | + if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
404 | 404 | |
405 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
405 | + echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
406 | 406 | |
407 | - }else{ |
|
408 | - $value = ''; |
|
409 | - if (isset($field_info->show_in)) { |
|
410 | - $value = esc_attr($field_info->show_in); |
|
411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
412 | - $value = esc_attr($cf['defaults']['show_in']); |
|
413 | - } |
|
414 | - ?> |
|
407 | + }else{ |
|
408 | + $value = ''; |
|
409 | + if (isset($field_info->show_in)) { |
|
410 | + $value = esc_attr($field_info->show_in); |
|
411 | + }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
412 | + $value = esc_attr($cf['defaults']['show_in']); |
|
413 | + } |
|
414 | + ?> |
|
415 | 415 | <li> |
416 | 416 | <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?> |
417 | 417 | <div class="gdcf-tooltip"> |
@@ -422,41 +422,41 @@ discard block |
||
422 | 422 | |
423 | 423 | <?php |
424 | 424 | |
425 | - /* |
|
425 | + /* |
|
426 | 426 | * We wrap the key values in [] so we can search the DB easier with a LIKE query. |
427 | 427 | */ |
428 | - $show_in_locations = array( |
|
429 | - "[detail]" => __("Details page sidebar", 'geodirectory'), |
|
430 | - "[moreinfo]" => __("More info tab", 'geodirectory'), |
|
431 | - "[listing]" => __("Listings page", 'geodirectory'), |
|
432 | - "[owntab]" => __("Details page own tab", 'geodirectory'), |
|
433 | - "[mapbubble]" => __("Map bubble", 'geodirectory'), |
|
434 | - ); |
|
435 | - |
|
436 | - /** |
|
437 | - * Filter the locations array for where to display custom fields. |
|
438 | - * |
|
439 | - * @since 1.6.6 |
|
440 | - * @param array $show_in_locations The array of locations and descriptions. |
|
441 | - * @param object $field_info The field being displayed info. |
|
442 | - * @param string $field_info The type of field. |
|
443 | - */ |
|
444 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
445 | - |
|
446 | - |
|
447 | - // remove some locations for some field types |
|
448 | - |
|
449 | - // don't show new tab option for some types |
|
450 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
451 | - }else{ |
|
452 | - unset($show_in_locations['[owntab]']); |
|
453 | - } |
|
454 | - |
|
455 | - if(!$display_on_listing){ |
|
456 | - unset($show_in_locations['[listings]']); |
|
457 | - } |
|
458 | - |
|
459 | - ?> |
|
428 | + $show_in_locations = array( |
|
429 | + "[detail]" => __("Details page sidebar", 'geodirectory'), |
|
430 | + "[moreinfo]" => __("More info tab", 'geodirectory'), |
|
431 | + "[listing]" => __("Listings page", 'geodirectory'), |
|
432 | + "[owntab]" => __("Details page own tab", 'geodirectory'), |
|
433 | + "[mapbubble]" => __("Map bubble", 'geodirectory'), |
|
434 | + ); |
|
435 | + |
|
436 | + /** |
|
437 | + * Filter the locations array for where to display custom fields. |
|
438 | + * |
|
439 | + * @since 1.6.6 |
|
440 | + * @param array $show_in_locations The array of locations and descriptions. |
|
441 | + * @param object $field_info The field being displayed info. |
|
442 | + * @param string $field_info The type of field. |
|
443 | + */ |
|
444 | + $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
445 | + |
|
446 | + |
|
447 | + // remove some locations for some field types |
|
448 | + |
|
449 | + // don't show new tab option for some types |
|
450 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
451 | + }else{ |
|
452 | + unset($show_in_locations['[owntab]']); |
|
453 | + } |
|
454 | + |
|
455 | + if(!$display_on_listing){ |
|
456 | + unset($show_in_locations['[listings]']); |
|
457 | + } |
|
458 | + |
|
459 | + ?> |
|
460 | 460 | |
461 | 461 | <select multiple="multiple" name="show_in[]" |
462 | 462 | id="show_in" |
@@ -466,38 +466,38 @@ discard block |
||
466 | 466 | option-ajaxchosen="false"> |
467 | 467 | <?php |
468 | 468 | |
469 | - $show_in_values = explode(',',$value); |
|
469 | + $show_in_values = explode(',',$value); |
|
470 | 470 | |
471 | - foreach( $show_in_locations as $key => $val){ |
|
472 | - $selected = ''; |
|
471 | + foreach( $show_in_locations as $key => $val){ |
|
472 | + $selected = ''; |
|
473 | 473 | |
474 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
475 | - $selected = 'selected'; |
|
476 | - } |
|
474 | + if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
475 | + $selected = 'selected'; |
|
476 | + } |
|
477 | 477 | |
478 | - ?> |
|
478 | + ?> |
|
479 | 479 | <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
480 | 480 | <?php |
481 | - } |
|
482 | - ?> |
|
481 | + } |
|
482 | + ?> |
|
483 | 483 | </select> |
484 | 484 | </div> |
485 | 485 | </li> |
486 | 486 | <?php |
487 | - } |
|
487 | + } |
|
488 | 488 | |
489 | 489 | |
490 | - // advanced_editor |
|
491 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
490 | + // advanced_editor |
|
491 | + if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
492 | 492 | |
493 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
493 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
494 | 494 | |
495 | - } |
|
495 | + } |
|
496 | 496 | |
497 | 497 | |
498 | 498 | |
499 | 499 | |
500 | - ?> |
|
500 | + ?> |
|
501 | 501 | |
502 | 502 | |
503 | 503 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
@@ -510,38 +510,38 @@ discard block |
||
510 | 510 | |
511 | 511 | <?php |
512 | 512 | |
513 | - $pricearr = array(); |
|
514 | - if (isset($field_info->packages) && $field_info->packages != '') { |
|
515 | - $pricearr = explode(',', trim($field_info->packages, ',')); |
|
516 | - } else { |
|
517 | - $package_info = array(); |
|
513 | + $pricearr = array(); |
|
514 | + if (isset($field_info->packages) && $field_info->packages != '') { |
|
515 | + $pricearr = explode(',', trim($field_info->packages, ',')); |
|
516 | + } else { |
|
517 | + $package_info = array(); |
|
518 | 518 | |
519 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
520 | - $pricearr[] = $package_info->pid; |
|
521 | - } |
|
519 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
520 | + $pricearr[] = $package_info->pid; |
|
521 | + } |
|
522 | 522 | |
523 | - ob_start() |
|
524 | - ?> |
|
523 | + ob_start() |
|
524 | + ?> |
|
525 | 525 | |
526 | 526 | <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple"> |
527 | 527 | <?php |
528 | - if (!empty($pricearr)) { |
|
529 | - foreach ($pricearr as $val) { |
|
530 | - ?> |
|
528 | + if (!empty($pricearr)) { |
|
529 | + foreach ($pricearr as $val) { |
|
530 | + ?> |
|
531 | 531 | <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php |
532 | - } |
|
533 | - } |
|
534 | - ?> |
|
532 | + } |
|
533 | + } |
|
534 | + ?> |
|
535 | 535 | </select> |
536 | 536 | |
537 | 537 | <?php |
538 | - $html = ob_get_clean(); |
|
538 | + $html = ob_get_clean(); |
|
539 | 539 | |
540 | 540 | /** |
541 | 541 | * Filter the price packages list. |
542 | 542 | * |
543 | 543 | * Filter the price packages list in custom field form in admin |
544 | - * custom fields settings. |
|
544 | + * custom fields settings. |
|
545 | 545 | * |
546 | 546 | * @since 1.0.0 |
547 | 547 | * |
@@ -550,25 +550,25 @@ discard block |
||
550 | 550 | */ |
551 | 551 | echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info); |
552 | 552 | |
553 | - ?> |
|
553 | + ?> |
|
554 | 554 | |
555 | 555 | |
556 | 556 | |
557 | 557 | <?php |
558 | 558 | |
559 | - // is_required |
|
560 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
559 | + // is_required |
|
560 | + if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
561 | 561 | |
562 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
562 | + echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
563 | 563 | |
564 | - }else{ |
|
565 | - $value = ''; |
|
566 | - if (isset($field_info->is_required)) { |
|
567 | - $value = esc_attr($field_info->is_required); |
|
568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
569 | - $value = $cf['defaults']['is_required']; |
|
570 | - } |
|
571 | - ?> |
|
564 | + }else{ |
|
565 | + $value = ''; |
|
566 | + if (isset($field_info->is_required)) { |
|
567 | + $value = esc_attr($field_info->is_required); |
|
568 | + }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
569 | + $value = $cf['defaults']['is_required']; |
|
570 | + } |
|
571 | + ?> |
|
572 | 572 | <li> |
573 | 573 | <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?> |
574 | 574 | <div class="gdcf-tooltip"> |
@@ -580,14 +580,14 @@ discard block |
||
580 | 580 | |
581 | 581 | <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
582 | 582 | <?php if ($value == '1') { |
583 | - echo 'checked'; |
|
584 | - } ?>/> |
|
583 | + echo 'checked'; |
|
584 | + } ?>/> |
|
585 | 585 | <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
586 | 586 | |
587 | 587 | <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
588 | 588 | <?php if ($value == '0' || !$value) { |
589 | - echo 'checked'; |
|
590 | - } ?>/> |
|
589 | + echo 'checked'; |
|
590 | + } ?>/> |
|
591 | 591 | <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
592 | 592 | |
593 | 593 | </div> |
@@ -595,21 +595,21 @@ discard block |
||
595 | 595 | </li> |
596 | 596 | |
597 | 597 | <?php |
598 | - } |
|
598 | + } |
|
599 | 599 | |
600 | - // required_msg |
|
601 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
600 | + // required_msg |
|
601 | + if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
602 | 602 | |
603 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
603 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
604 | 604 | |
605 | - }else{ |
|
606 | - $value = ''; |
|
607 | - if (isset($field_info->required_msg)) { |
|
608 | - $value = esc_attr($field_info->required_msg); |
|
609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
610 | - $value = $cf['defaults']['required_msg']; |
|
611 | - } |
|
612 | - ?> |
|
605 | + }else{ |
|
606 | + $value = ''; |
|
607 | + if (isset($field_info->required_msg)) { |
|
608 | + $value = esc_attr($field_info->required_msg); |
|
609 | + }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
610 | + $value = $cf['defaults']['required_msg']; |
|
611 | + } |
|
612 | + ?> |
|
613 | 613 | <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>> |
614 | 614 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
615 | 615 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?> |
@@ -623,38 +623,38 @@ discard block |
||
623 | 623 | </div> |
624 | 624 | </li> |
625 | 625 | <?php |
626 | - } |
|
626 | + } |
|
627 | 627 | |
628 | 628 | |
629 | - // required_msg |
|
630 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
629 | + // required_msg |
|
630 | + if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
631 | 631 | |
632 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
632 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
633 | 633 | |
634 | - } |
|
634 | + } |
|
635 | 635 | |
636 | 636 | |
637 | - // extra_fields |
|
638 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
637 | + // extra_fields |
|
638 | + if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
639 | 639 | |
640 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
640 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
641 | 641 | |
642 | - } |
|
642 | + } |
|
643 | 643 | |
644 | 644 | |
645 | - // field_icon |
|
646 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
645 | + // field_icon |
|
646 | + if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
647 | 647 | |
648 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
648 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
649 | 649 | |
650 | - }else{ |
|
651 | - $value = ''; |
|
652 | - if (isset($field_info->field_icon)) { |
|
653 | - $value = esc_attr($field_info->field_icon); |
|
654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
655 | - $value = $cf['defaults']['field_icon']; |
|
656 | - } |
|
657 | - ?> |
|
650 | + }else{ |
|
651 | + $value = ''; |
|
652 | + if (isset($field_info->field_icon)) { |
|
653 | + $value = esc_attr($field_info->field_icon); |
|
654 | + }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
655 | + $value = $cf['defaults']['field_icon']; |
|
656 | + } |
|
657 | + ?> |
|
658 | 658 | <li> |
659 | 659 | <h3><?php echo __('Custom css', 'geodirectory'); ?></h3> |
660 | 660 | |
@@ -672,22 +672,22 @@ discard block |
||
672 | 672 | |
673 | 673 | </li> |
674 | 674 | <?php |
675 | - } |
|
675 | + } |
|
676 | 676 | |
677 | 677 | |
678 | - // css_class |
|
679 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
678 | + // css_class |
|
679 | + if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
680 | 680 | |
681 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
681 | + echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
682 | 682 | |
683 | - }else{ |
|
684 | - $value = ''; |
|
685 | - if (isset($field_info->css_class)) { |
|
686 | - $value = esc_attr($field_info->css_class); |
|
687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
688 | - $value = $cf['defaults']['css_class']; |
|
689 | - } |
|
690 | - ?> |
|
683 | + }else{ |
|
684 | + $value = ''; |
|
685 | + if (isset($field_info->css_class)) { |
|
686 | + $value = esc_attr($field_info->css_class); |
|
687 | + }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
688 | + $value = $cf['defaults']['css_class']; |
|
689 | + } |
|
690 | + ?> |
|
691 | 691 | <li> |
692 | 692 | |
693 | 693 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
@@ -700,47 +700,47 @@ discard block |
||
700 | 700 | <div class="gd-cf-input-wrap"> |
701 | 701 | <input type="text" name="css_class" id="css_class" |
702 | 702 | value="<?php if (isset($field_info->css_class)) { |
703 | - echo esc_attr($field_info->css_class); |
|
704 | - }?>"/> |
|
703 | + echo esc_attr($field_info->css_class); |
|
704 | + }?>"/> |
|
705 | 705 | </div> |
706 | 706 | </li> |
707 | 707 | <?php |
708 | - } |
|
708 | + } |
|
709 | 709 | |
710 | 710 | |
711 | - // cat_sort |
|
712 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
711 | + // cat_sort |
|
712 | + if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
713 | 713 | |
714 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
714 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
715 | 715 | |
716 | - }else{ |
|
717 | - $value = ''; |
|
718 | - $hide_cat_sort =''; |
|
719 | - if (isset($field_info->cat_sort)) { |
|
720 | - $value = esc_attr($field_info->cat_sort); |
|
721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
722 | - $value = $cf['defaults']['cat_sort']; |
|
723 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
724 | - } |
|
716 | + }else{ |
|
717 | + $value = ''; |
|
718 | + $hide_cat_sort =''; |
|
719 | + if (isset($field_info->cat_sort)) { |
|
720 | + $value = esc_attr($field_info->cat_sort); |
|
721 | + }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
722 | + $value = $cf['defaults']['cat_sort']; |
|
723 | + $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
724 | + } |
|
725 | 725 | |
726 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
727 | - ?> |
|
726 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
727 | + ?> |
|
728 | 728 | <li <?php echo $hide_cat_sort ;?>> |
729 | 729 | <h3><?php |
730 | - /** |
|
731 | - * Filter the section title. |
|
732 | - * |
|
733 | - * Filter the section title in custom field form in admin |
|
734 | - * custom fields settings. |
|
735 | - * |
|
736 | - * @since 1.0.0 |
|
737 | - * |
|
738 | - * @param string $title Title of the section. |
|
739 | - * @param string $field_type Current field type. |
|
740 | - */ |
|
741 | - echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
742 | - |
|
743 | - ?></h3> |
|
730 | + /** |
|
731 | + * Filter the section title. |
|
732 | + * |
|
733 | + * Filter the section title in custom field form in admin |
|
734 | + * custom fields settings. |
|
735 | + * |
|
736 | + * @since 1.0.0 |
|
737 | + * |
|
738 | + * @param string $title Title of the section. |
|
739 | + * @param string $field_type Current field type. |
|
740 | + */ |
|
741 | + echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
742 | + |
|
743 | + ?></h3> |
|
744 | 744 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
745 | 745 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?> |
746 | 746 | <div class="gdcf-tooltip"> |
@@ -752,42 +752,42 @@ discard block |
||
752 | 752 | |
753 | 753 | <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
754 | 754 | <?php if ($value == '1') { |
755 | - echo 'checked'; |
|
756 | - } ?>/> |
|
755 | + echo 'checked'; |
|
756 | + } ?>/> |
|
757 | 757 | <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
758 | 758 | |
759 | 759 | <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
760 | 760 | <?php if (!$value) { |
761 | - echo 'checked'; |
|
762 | - } ?>/> |
|
761 | + echo 'checked'; |
|
762 | + } ?>/> |
|
763 | 763 | <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
764 | 764 | |
765 | 765 | </div> |
766 | 766 | </li> |
767 | 767 | <?php |
768 | - } |
|
769 | - |
|
770 | - |
|
771 | - |
|
772 | - switch ($field_type): |
|
773 | - case 'html': |
|
774 | - case 'file': |
|
775 | - case 'url': |
|
776 | - case 'fieldset': |
|
777 | - break; |
|
778 | - default: |
|
779 | - |
|
780 | - /** |
|
781 | - * Called at the end of the advanced custom fields settings page loop. |
|
782 | - * |
|
783 | - * Can be used to add or deal with different settings types. |
|
784 | - * |
|
785 | - * @since 1.0.0 |
|
786 | - * @since 1.6.6 $cf param added. |
|
787 | - * @param object $field_info The current fields info. |
|
788 | - * @param array $cf The custom field settings |
|
789 | - */ |
|
790 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
768 | + } |
|
769 | + |
|
770 | + |
|
771 | + |
|
772 | + switch ($field_type): |
|
773 | + case 'html': |
|
774 | + case 'file': |
|
775 | + case 'url': |
|
776 | + case 'fieldset': |
|
777 | + break; |
|
778 | + default: |
|
779 | + |
|
780 | + /** |
|
781 | + * Called at the end of the advanced custom fields settings page loop. |
|
782 | + * |
|
783 | + * Can be used to add or deal with different settings types. |
|
784 | + * |
|
785 | + * @since 1.0.0 |
|
786 | + * @since 1.6.6 $cf param added. |
|
787 | + * @param object $field_info The current fields info. |
|
788 | + * @param array $cf The custom field settings |
|
789 | + */ |
|
790 | + do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
791 | 791 | |
792 | 792 | |
793 | 793 | <?php endswitch; ?> |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : ''; |
40 | 40 | |
41 | 41 | |
42 | -if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;} |
|
42 | +if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; } |
|
43 | 43 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
44 | -if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;} |
|
44 | +if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; } |
|
45 | 45 | |
46 | 46 | |
47 | -$nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
47 | +$nonce = wp_create_nonce('custom_fields_'.$result_str); |
|
48 | 48 | |
49 | 49 | $field_admin_title = ''; |
50 | 50 | if (isset($field_info->admin_title)) |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
71 | 71 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
72 | -}elseif(isset($cf['icon']) && $cf['icon']){ |
|
72 | +}elseif (isset($cf['icon']) && $cf['icon']) { |
|
73 | 73 | $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
74 | -}else{ |
|
74 | +} else { |
|
75 | 75 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
76 | 76 | } |
77 | 77 | |
78 | -if(isset($cf['name']) && $cf['name']){ |
|
78 | +if (isset($cf['name']) && $cf['name']) { |
|
79 | 79 | $field_type_name = $cf['name']; |
80 | -}else{ |
|
80 | +} else { |
|
81 | 81 | $field_type_name = $field_type; |
82 | 82 | } |
83 | 83 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" > |
93 | 93 | <?php |
94 | 94 | |
95 | - $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
95 | + $nonce = wp_create_nonce('custom_fields_'.$result_str); |
|
96 | 96 | ?> |
97 | 97 | |
98 | 98 | <?php if (!$default): ?> |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
106 | 106 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
107 | 107 | <b style="cursor:pointer;" |
108 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b> |
|
108 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b> |
|
109 | 109 | <?php |
110 | 110 | } else {echo $field_icon; |
111 | 111 | ?> |
112 | 112 | <b style="cursor:pointer;" |
113 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b> |
|
113 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b> |
|
114 | 114 | <?php |
115 | 115 | } |
116 | 116 | ?> |
@@ -133,43 +133,43 @@ discard block |
||
133 | 133 | } ?>"/> |
134 | 134 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
135 | 135 | |
136 | - <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
|
137 | - <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
138 | - <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
139 | - <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" /> |
|
136 | + <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?> |
|
137 | + <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
138 | + <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
139 | + <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" /> |
|
140 | 140 | |
141 | 141 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
142 | 142 | |
143 | 143 | <?php |
144 | 144 | |
145 | 145 | // data_type |
146 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
146 | + if (has_filter("geodir_cfa_data_type_{$field_type}")) { |
|
147 | 147 | |
148 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
148 | + echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info); |
|
149 | 149 | |
150 | - }else{ |
|
150 | + } else { |
|
151 | 151 | $value = ''; |
152 | 152 | if (isset($field_info->data_type)) { |
153 | 153 | $value = esc_attr($field_info->data_type); |
154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
154 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) { |
|
155 | 155 | $value = $cf['defaults']['data_type']; |
156 | 156 | } |
157 | 157 | ?> |
158 | - <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
|
158 | + <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/> |
|
159 | 159 | <?php |
160 | 160 | } |
161 | 161 | |
162 | 162 | |
163 | 163 | // admin_title |
164 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
164 | + if (has_filter("geodir_cfa_admin_title_{$field_type}")) { |
|
165 | 165 | |
166 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
166 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info); |
|
167 | 167 | |
168 | - }else{ |
|
168 | + } else { |
|
169 | 169 | $value = ''; |
170 | 170 | if (isset($field_info->admin_title)) { |
171 | 171 | $value = esc_attr($field_info->admin_title); |
172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
172 | + }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) { |
|
173 | 173 | $value = $cf['defaults']['admin_title']; |
174 | 174 | } |
175 | 175 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | </label> |
183 | 183 | <div class="gd-cf-input-wrap"> |
184 | 184 | <input type="text" name="admin_title" id="admin_title" |
185 | - value="<?php echo $value;?>"/> |
|
185 | + value="<?php echo $value; ?>"/> |
|
186 | 186 | </div> |
187 | 187 | </li> |
188 | 188 | <?php |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | |
191 | 191 | |
192 | 192 | // site_title |
193 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
193 | + if (has_filter("geodir_cfa_site_title_{$field_type}")) { |
|
194 | 194 | |
195 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
195 | + echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info); |
|
196 | 196 | |
197 | - }else{ |
|
197 | + } else { |
|
198 | 198 | $value = ''; |
199 | 199 | if (isset($field_info->site_title)) { |
200 | 200 | $value = esc_attr($field_info->site_title); |
201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
201 | + }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) { |
|
202 | 202 | $value = $cf['defaults']['site_title']; |
203 | 203 | } |
204 | 204 | ?> |
@@ -218,15 +218,15 @@ discard block |
||
218 | 218 | |
219 | 219 | |
220 | 220 | // admin_desc |
221 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
221 | + if (has_filter("geodir_cfa_admin_desc_{$field_type}")) { |
|
222 | 222 | |
223 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
223 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info); |
|
224 | 224 | |
225 | - }else{ |
|
225 | + } else { |
|
226 | 226 | $value = ''; |
227 | 227 | if (isset($field_info->admin_desc)) { |
228 | 228 | $value = esc_attr($field_info->admin_desc); |
229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
229 | + }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) { |
|
230 | 230 | $value = $cf['defaults']['admin_desc']; |
231 | 231 | } |
232 | 232 | ?> |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | </div> |
238 | 238 | </label> |
239 | 239 | <div class="gd-cf-input-wrap"> |
240 | - <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/> |
|
240 | + <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/> |
|
241 | 241 | </div> |
242 | 242 | </li> |
243 | 243 | <?php |
@@ -246,26 +246,26 @@ discard block |
||
246 | 246 | |
247 | 247 | |
248 | 248 | // htmlvar_name |
249 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
249 | + if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) { |
|
250 | 250 | |
251 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
251 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info); |
|
252 | 252 | |
253 | - }else{ |
|
253 | + } else { |
|
254 | 254 | $value = ''; |
255 | 255 | if (isset($field_info->htmlvar_name)) { |
256 | 256 | $value = esc_attr($field_info->htmlvar_name); |
257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
257 | + }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) { |
|
258 | 258 | $value = $cf['defaults']['htmlvar_name']; |
259 | 259 | } |
260 | 260 | ?> |
261 | 261 | <li> |
262 | - <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?> |
|
262 | + <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?> |
|
263 | 263 | <div class="gdcf-tooltip"> |
264 | 264 | <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?> |
265 | 265 | </div> |
266 | 266 | </label> |
267 | 267 | <div class="gd-cf-input-wrap"> |
268 | - <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>" |
|
268 | + <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>" |
|
269 | 269 | value="<?php if ($value) { |
270 | 270 | echo preg_replace('/geodir_/', '', $value, 1); |
271 | 271 | }?>" <?php if ($default) { |
@@ -278,15 +278,15 @@ discard block |
||
278 | 278 | |
279 | 279 | |
280 | 280 | // is_active |
281 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
281 | + if (has_filter("geodir_cfa_is_active_{$field_type}")) { |
|
282 | 282 | |
283 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
283 | + echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info); |
|
284 | 284 | |
285 | - }else{ |
|
285 | + } else { |
|
286 | 286 | $value = ''; |
287 | 287 | if (isset($field_info->is_active)) { |
288 | 288 | $value = esc_attr($field_info->is_active); |
289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
289 | + }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) { |
|
290 | 290 | $value = $cf['defaults']['is_active']; |
291 | 291 | } |
292 | 292 | ?> |
@@ -298,17 +298,17 @@ discard block |
||
298 | 298 | </label> |
299 | 299 | <div class="gd-cf-input-wrap gd-switch"> |
300 | 300 | |
301 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
301 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
302 | 302 | <?php if ($value == '1') { |
303 | 303 | echo 'checked'; |
304 | 304 | } ?>/> |
305 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
305 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
306 | 306 | |
307 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
307 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
308 | 308 | <?php if ($value == '0' || !$value) { |
309 | 309 | echo 'checked'; |
310 | 310 | } ?>/> |
311 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
311 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
312 | 312 | |
313 | 313 | </div> |
314 | 314 | </li> |
@@ -317,15 +317,15 @@ discard block |
||
317 | 317 | |
318 | 318 | |
319 | 319 | // for_admin_use |
320 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
320 | + if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) { |
|
321 | 321 | |
322 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
322 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info); |
|
323 | 323 | |
324 | - }else{ |
|
324 | + } else { |
|
325 | 325 | $value = ''; |
326 | 326 | if (isset($field_info->for_admin_use)) { |
327 | 327 | $value = esc_attr($field_info->for_admin_use); |
328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
328 | + }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) { |
|
329 | 329 | $value = $cf['defaults']['for_admin_use']; |
330 | 330 | } |
331 | 331 | ?> |
@@ -337,17 +337,17 @@ discard block |
||
337 | 337 | </label> |
338 | 338 | <div class="gd-cf-input-wrap gd-switch"> |
339 | 339 | |
340 | - <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
340 | + <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
341 | 341 | <?php if ($value == '1') { |
342 | 342 | echo 'checked'; |
343 | 343 | } ?>/> |
344 | - <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
344 | + <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
345 | 345 | |
346 | - <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
346 | + <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
347 | 347 | <?php if ($value == '0' || !$value) { |
348 | 348 | echo 'checked'; |
349 | 349 | } ?>/> |
350 | - <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
350 | + <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
351 | 351 | |
352 | 352 | </div> |
353 | 353 | </li> |
@@ -356,20 +356,20 @@ discard block |
||
356 | 356 | |
357 | 357 | |
358 | 358 | // default_value |
359 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
359 | + if (has_filter("geodir_cfa_default_value_{$field_type}")) { |
|
360 | 360 | |
361 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
361 | + echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info); |
|
362 | 362 | |
363 | - }else{ |
|
363 | + } else { |
|
364 | 364 | $value = ''; |
365 | 365 | if (isset($field_info->default_value)) { |
366 | 366 | $value = esc_attr($field_info->default_value); |
367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
367 | + }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) { |
|
368 | 368 | $value = $cf['defaults']['default_value']; |
369 | 369 | } |
370 | 370 | ?> |
371 | 371 | <li> |
372 | - <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?> |
|
372 | + <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?> |
|
373 | 373 | <div class="gdcf-tooltip"> |
374 | 374 | <?php |
375 | 375 | if ($field_type == 'checkbox') { |
@@ -386,12 +386,12 @@ discard block |
||
386 | 386 | <?php if ($field_type == 'checkbox') { ?> |
387 | 387 | <select name="default_value" id="default_value"> |
388 | 388 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option> |
389 | - <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
389 | + <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
390 | 390 | </select> |
391 | 391 | <?php } else if ($field_type == 'email') { ?> |
392 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
392 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
393 | 393 | <?php } else { ?> |
394 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
394 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
395 | 395 | <?php } ?> |
396 | 396 | </div> |
397 | 397 | </li> |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | |
401 | 401 | |
402 | 402 | // show_in |
403 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
403 | + if (has_filter("geodir_cfa_show_in_{$field_type}")) { |
|
404 | 404 | |
405 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
405 | + echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info); |
|
406 | 406 | |
407 | - }else{ |
|
407 | + } else { |
|
408 | 408 | $value = ''; |
409 | 409 | if (isset($field_info->show_in)) { |
410 | 410 | $value = esc_attr($field_info->show_in); |
411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
411 | + }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) { |
|
412 | 412 | $value = esc_attr($cf['defaults']['show_in']); |
413 | 413 | } |
414 | 414 | ?> |
@@ -441,18 +441,18 @@ discard block |
||
441 | 441 | * @param object $field_info The field being displayed info. |
442 | 442 | * @param string $field_info The type of field. |
443 | 443 | */ |
444 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
444 | + $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type); |
|
445 | 445 | |
446 | 446 | |
447 | 447 | // remove some locations for some field types |
448 | 448 | |
449 | 449 | // don't show new tab option for some types |
450 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
451 | - }else{ |
|
450 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) { |
|
451 | + } else { |
|
452 | 452 | unset($show_in_locations['[owntab]']); |
453 | 453 | } |
454 | 454 | |
455 | - if(!$display_on_listing){ |
|
455 | + if (!$display_on_listing) { |
|
456 | 456 | unset($show_in_locations['[listings]']); |
457 | 457 | } |
458 | 458 | |
@@ -466,17 +466,17 @@ discard block |
||
466 | 466 | option-ajaxchosen="false"> |
467 | 467 | <?php |
468 | 468 | |
469 | - $show_in_values = explode(',',$value); |
|
469 | + $show_in_values = explode(',', $value); |
|
470 | 470 | |
471 | - foreach( $show_in_locations as $key => $val){ |
|
471 | + foreach ($show_in_locations as $key => $val) { |
|
472 | 472 | $selected = ''; |
473 | 473 | |
474 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
474 | + if (is_array($show_in_values) && in_array($key, $show_in_values)) { |
|
475 | 475 | $selected = 'selected'; |
476 | 476 | } |
477 | 477 | |
478 | 478 | ?> |
479 | - <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
|
479 | + <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option> |
|
480 | 480 | <?php |
481 | 481 | } |
482 | 482 | ?> |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | |
489 | 489 | |
490 | 490 | // advanced_editor |
491 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
491 | + if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) { |
|
492 | 492 | |
493 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
493 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info); |
|
494 | 494 | |
495 | 495 | } |
496 | 496 | |
@@ -501,10 +501,10 @@ discard block |
||
501 | 501 | |
502 | 502 | |
503 | 503 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
504 | - <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/> |
|
504 | + <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/> |
|
505 | 505 | |
506 | 506 | <?php // we dont need to show the sort order ?> |
507 | - <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/> |
|
507 | + <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/> |
|
508 | 508 | |
509 | 509 | |
510 | 510 | |
@@ -557,15 +557,15 @@ discard block |
||
557 | 557 | <?php |
558 | 558 | |
559 | 559 | // is_required |
560 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
560 | + if (has_filter("geodir_cfa_is_required_{$field_type}")) { |
|
561 | 561 | |
562 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
562 | + echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info); |
|
563 | 563 | |
564 | - }else{ |
|
564 | + } else { |
|
565 | 565 | $value = ''; |
566 | 566 | if (isset($field_info->is_required)) { |
567 | 567 | $value = esc_attr($field_info->is_required); |
568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
568 | + }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) { |
|
569 | 569 | $value = $cf['defaults']['is_required']; |
570 | 570 | } |
571 | 571 | ?> |
@@ -578,17 +578,17 @@ discard block |
||
578 | 578 | |
579 | 579 | <div class="gd-cf-input-wrap gd-switch"> |
580 | 580 | |
581 | - <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
|
581 | + <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled" value="1" |
|
582 | 582 | <?php if ($value == '1') { |
583 | 583 | echo 'checked'; |
584 | 584 | } ?>/> |
585 | - <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
585 | + <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
586 | 586 | |
587 | - <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
|
587 | + <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0" |
|
588 | 588 | <?php if ($value == '0' || !$value) { |
589 | 589 | echo 'checked'; |
590 | 590 | } ?>/> |
591 | - <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
591 | + <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
592 | 592 | |
593 | 593 | </div> |
594 | 594 | |
@@ -598,19 +598,19 @@ discard block |
||
598 | 598 | } |
599 | 599 | |
600 | 600 | // required_msg |
601 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
601 | + if (has_filter("geodir_cfa_required_msg_{$field_type}")) { |
|
602 | 602 | |
603 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
603 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info); |
|
604 | 604 | |
605 | - }else{ |
|
605 | + } else { |
|
606 | 606 | $value = ''; |
607 | 607 | if (isset($field_info->required_msg)) { |
608 | 608 | $value = esc_attr($field_info->required_msg); |
609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
609 | + }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) { |
|
610 | 610 | $value = $cf['defaults']['required_msg']; |
611 | 611 | } |
612 | 612 | ?> |
613 | - <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>> |
|
613 | + <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>> |
|
614 | 614 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
615 | 615 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?> |
616 | 616 | <div class="gdcf-tooltip"> |
@@ -627,31 +627,31 @@ discard block |
||
627 | 627 | |
628 | 628 | |
629 | 629 | // required_msg |
630 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
630 | + if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) { |
|
631 | 631 | |
632 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
632 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info); |
|
633 | 633 | |
634 | 634 | } |
635 | 635 | |
636 | 636 | |
637 | 637 | // extra_fields |
638 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
638 | + if (has_filter("geodir_cfa_extra_fields_{$field_type}")) { |
|
639 | 639 | |
640 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
640 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info); |
|
641 | 641 | |
642 | 642 | } |
643 | 643 | |
644 | 644 | |
645 | 645 | // field_icon |
646 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
646 | + if (has_filter("geodir_cfa_field_icon_{$field_type}")) { |
|
647 | 647 | |
648 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
648 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info); |
|
649 | 649 | |
650 | - }else{ |
|
650 | + } else { |
|
651 | 651 | $value = ''; |
652 | 652 | if (isset($field_info->field_icon)) { |
653 | 653 | $value = esc_attr($field_info->field_icon); |
654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
654 | + }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) { |
|
655 | 655 | $value = $cf['defaults']['field_icon']; |
656 | 656 | } |
657 | 657 | ?> |
@@ -662,12 +662,12 @@ discard block |
||
662 | 662 | <label for="field_icon" class="gd-cf-tooltip-wrap"> |
663 | 663 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?> |
664 | 664 | <div class="gdcf-tooltip"> |
665 | - <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?> |
|
665 | + <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?> |
|
666 | 666 | </div> |
667 | 667 | </label> |
668 | 668 | <div class="gd-cf-input-wrap"> |
669 | 669 | <input type="text" name="field_icon" id="field_icon" |
670 | - value="<?php echo $value;?>"/> |
|
670 | + value="<?php echo $value; ?>"/> |
|
671 | 671 | </div> |
672 | 672 | |
673 | 673 | </li> |
@@ -676,15 +676,15 @@ discard block |
||
676 | 676 | |
677 | 677 | |
678 | 678 | // css_class |
679 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
679 | + if (has_filter("geodir_cfa_css_class_{$field_type}")) { |
|
680 | 680 | |
681 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
681 | + echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info); |
|
682 | 682 | |
683 | - }else{ |
|
683 | + } else { |
|
684 | 684 | $value = ''; |
685 | 685 | if (isset($field_info->css_class)) { |
686 | 686 | $value = esc_attr($field_info->css_class); |
687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
687 | + }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) { |
|
688 | 688 | $value = $cf['defaults']['css_class']; |
689 | 689 | } |
690 | 690 | ?> |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
694 | 694 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?> |
695 | 695 | <div class="gdcf-tooltip"> |
696 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?> |
|
697 | - <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?> |
|
696 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?> |
|
697 | + <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?> |
|
698 | 698 | </div> |
699 | 699 | </label> |
700 | 700 | <div class="gd-cf-input-wrap"> |
@@ -709,23 +709,23 @@ discard block |
||
709 | 709 | |
710 | 710 | |
711 | 711 | // cat_sort |
712 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
712 | + if (has_filter("geodir_cfa_cat_sort_{$field_type}")) { |
|
713 | 713 | |
714 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
714 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info); |
|
715 | 715 | |
716 | - }else{ |
|
716 | + } else { |
|
717 | 717 | $value = ''; |
718 | - $hide_cat_sort =''; |
|
718 | + $hide_cat_sort = ''; |
|
719 | 719 | if (isset($field_info->cat_sort)) { |
720 | 720 | $value = esc_attr($field_info->cat_sort); |
721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
721 | + }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) { |
|
722 | 722 | $value = $cf['defaults']['cat_sort']; |
723 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
723 | + $hide_cat_sort = ($value === false) ? "style='display:none;'" : ''; |
|
724 | 724 | } |
725 | 725 | |
726 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
726 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : ''; |
|
727 | 727 | ?> |
728 | - <li <?php echo $hide_cat_sort ;?>> |
|
728 | + <li <?php echo $hide_cat_sort; ?>> |
|
729 | 729 | <h3><?php |
730 | 730 | /** |
731 | 731 | * Filter the section title. |
@@ -744,23 +744,23 @@ discard block |
||
744 | 744 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
745 | 745 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?> |
746 | 746 | <div class="gdcf-tooltip"> |
747 | - <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?> |
|
747 | + <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?> |
|
748 | 748 | </div> |
749 | 749 | </label> |
750 | 750 | |
751 | 751 | <div class="gd-cf-input-wrap gd-switch"> |
752 | 752 | |
753 | - <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
|
753 | + <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled" value="1" |
|
754 | 754 | <?php if ($value == '1') { |
755 | 755 | echo 'checked'; |
756 | 756 | } ?>/> |
757 | - <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
757 | + <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
758 | 758 | |
759 | - <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
|
759 | + <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0" |
|
760 | 760 | <?php if (!$value) { |
761 | 761 | echo 'checked'; |
762 | 762 | } ?>/> |
763 | - <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
763 | + <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
764 | 764 | |
765 | 765 | </div> |
766 | 766 | </li> |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | * @param object $field_info The current fields info. |
788 | 788 | * @param array $cf The custom field settings |
789 | 789 | */ |
790 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
790 | + do_action('geodir_advance_custom_fields', $field_info, $cf); ?> |
|
791 | 791 | |
792 | 792 | |
793 | 793 | <?php endswitch; ?> |
@@ -799,10 +799,10 @@ discard block |
||
799 | 799 | <h3></h3> |
800 | 800 | </label> |
801 | 801 | <div class="gd-cf-input-wrap"> |
802 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>" |
|
802 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>" |
|
803 | 803 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/> |
804 | 804 | <?php if (!$default): ?> |
805 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>" |
|
805 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>" |
|
806 | 806 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')" |
807 | 807 | class="button"/></a> |
808 | 808 | <?php endif; ?> |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | if (!isset($field_info->post_type)) { |
21 | 21 | $post_type = sanitize_text_field($_REQUEST['listing_type']); |
22 | -} else |
|
23 | - $post_type = $field_info->post_type; |
|
22 | +} else { |
|
23 | + $post_type = $field_info->post_type; |
|
24 | +} |
|
24 | 25 | |
25 | 26 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){ |
26 | 27 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -47,8 +48,9 @@ discard block |
||
47 | 48 | $nonce = wp_create_nonce('custom_fields_' . $result_str); |
48 | 49 | |
49 | 50 | $field_admin_title = ''; |
50 | -if (isset($field_info->admin_title)) |
|
51 | - $field_admin_title = $field_info->admin_title; |
|
51 | +if (isset($field_info->admin_title)) { |
|
52 | + $field_admin_title = $field_info->admin_title; |
|
53 | +} |
|
52 | 54 | |
53 | 55 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
54 | 56 | |
@@ -69,15 +71,15 @@ discard block |
||
69 | 71 | |
70 | 72 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
71 | 73 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
72 | -}elseif(isset($cf['icon']) && $cf['icon']){ |
|
74 | +} elseif(isset($cf['icon']) && $cf['icon']){ |
|
73 | 75 | $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
74 | -}else{ |
|
76 | +} else{ |
|
75 | 77 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
76 | 78 | } |
77 | 79 | |
78 | 80 | if(isset($cf['name']) && $cf['name']){ |
79 | 81 | $field_type_name = $cf['name']; |
80 | -}else{ |
|
82 | +} else{ |
|
81 | 83 | $field_type_name = $field_type; |
82 | 84 | } |
83 | 85 | |
@@ -147,11 +149,11 @@ discard block |
||
147 | 149 | |
148 | 150 | echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
149 | 151 | |
150 | - }else{ |
|
152 | + } else{ |
|
151 | 153 | $value = ''; |
152 | 154 | if (isset($field_info->data_type)) { |
153 | 155 | $value = esc_attr($field_info->data_type); |
154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
156 | + } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
155 | 157 | $value = $cf['defaults']['data_type']; |
156 | 158 | } |
157 | 159 | ?> |
@@ -165,11 +167,11 @@ discard block |
||
165 | 167 | |
166 | 168 | echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
167 | 169 | |
168 | - }else{ |
|
170 | + } else{ |
|
169 | 171 | $value = ''; |
170 | 172 | if (isset($field_info->admin_title)) { |
171 | 173 | $value = esc_attr($field_info->admin_title); |
172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
174 | + } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
173 | 175 | $value = $cf['defaults']['admin_title']; |
174 | 176 | } |
175 | 177 | ?> |
@@ -194,11 +196,11 @@ discard block |
||
194 | 196 | |
195 | 197 | echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
196 | 198 | |
197 | - }else{ |
|
199 | + } else{ |
|
198 | 200 | $value = ''; |
199 | 201 | if (isset($field_info->site_title)) { |
200 | 202 | $value = esc_attr($field_info->site_title); |
201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
203 | + } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
202 | 204 | $value = $cf['defaults']['site_title']; |
203 | 205 | } |
204 | 206 | ?> |
@@ -222,11 +224,11 @@ discard block |
||
222 | 224 | |
223 | 225 | echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
224 | 226 | |
225 | - }else{ |
|
227 | + } else{ |
|
226 | 228 | $value = ''; |
227 | 229 | if (isset($field_info->admin_desc)) { |
228 | 230 | $value = esc_attr($field_info->admin_desc); |
229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
231 | + } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
230 | 232 | $value = $cf['defaults']['admin_desc']; |
231 | 233 | } |
232 | 234 | ?> |
@@ -250,11 +252,11 @@ discard block |
||
250 | 252 | |
251 | 253 | echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
252 | 254 | |
253 | - }else{ |
|
255 | + } else{ |
|
254 | 256 | $value = ''; |
255 | 257 | if (isset($field_info->htmlvar_name)) { |
256 | 258 | $value = esc_attr($field_info->htmlvar_name); |
257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
259 | + } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
258 | 260 | $value = $cf['defaults']['htmlvar_name']; |
259 | 261 | } |
260 | 262 | ?> |
@@ -282,11 +284,11 @@ discard block |
||
282 | 284 | |
283 | 285 | echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
284 | 286 | |
285 | - }else{ |
|
287 | + } else{ |
|
286 | 288 | $value = ''; |
287 | 289 | if (isset($field_info->is_active)) { |
288 | 290 | $value = esc_attr($field_info->is_active); |
289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
291 | + } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
290 | 292 | $value = $cf['defaults']['is_active']; |
291 | 293 | } |
292 | 294 | ?> |
@@ -321,11 +323,11 @@ discard block |
||
321 | 323 | |
322 | 324 | echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
323 | 325 | |
324 | - }else{ |
|
326 | + } else{ |
|
325 | 327 | $value = ''; |
326 | 328 | if (isset($field_info->for_admin_use)) { |
327 | 329 | $value = esc_attr($field_info->for_admin_use); |
328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
330 | + } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
329 | 331 | $value = $cf['defaults']['for_admin_use']; |
330 | 332 | } |
331 | 333 | ?> |
@@ -360,11 +362,11 @@ discard block |
||
360 | 362 | |
361 | 363 | echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
362 | 364 | |
363 | - }else{ |
|
365 | + } else{ |
|
364 | 366 | $value = ''; |
365 | 367 | if (isset($field_info->default_value)) { |
366 | 368 | $value = esc_attr($field_info->default_value); |
367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
369 | + } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
368 | 370 | $value = $cf['defaults']['default_value']; |
369 | 371 | } |
370 | 372 | ?> |
@@ -404,11 +406,11 @@ discard block |
||
404 | 406 | |
405 | 407 | echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
406 | 408 | |
407 | - }else{ |
|
409 | + } else{ |
|
408 | 410 | $value = ''; |
409 | 411 | if (isset($field_info->show_in)) { |
410 | 412 | $value = esc_attr($field_info->show_in); |
411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
413 | + } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
412 | 414 | $value = esc_attr($cf['defaults']['show_in']); |
413 | 415 | } |
414 | 416 | ?> |
@@ -448,7 +450,7 @@ discard block |
||
448 | 450 | |
449 | 451 | // don't show new tab option for some types |
450 | 452 | if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
451 | - }else{ |
|
453 | + } else{ |
|
452 | 454 | unset($show_in_locations['[owntab]']); |
453 | 455 | } |
454 | 456 | |
@@ -561,11 +563,11 @@ discard block |
||
561 | 563 | |
562 | 564 | echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
563 | 565 | |
564 | - }else{ |
|
566 | + } else{ |
|
565 | 567 | $value = ''; |
566 | 568 | if (isset($field_info->is_required)) { |
567 | 569 | $value = esc_attr($field_info->is_required); |
568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
570 | + } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
569 | 571 | $value = $cf['defaults']['is_required']; |
570 | 572 | } |
571 | 573 | ?> |
@@ -602,11 +604,11 @@ discard block |
||
602 | 604 | |
603 | 605 | echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
604 | 606 | |
605 | - }else{ |
|
607 | + } else{ |
|
606 | 608 | $value = ''; |
607 | 609 | if (isset($field_info->required_msg)) { |
608 | 610 | $value = esc_attr($field_info->required_msg); |
609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
611 | + } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
610 | 612 | $value = $cf['defaults']['required_msg']; |
611 | 613 | } |
612 | 614 | ?> |
@@ -647,11 +649,11 @@ discard block |
||
647 | 649 | |
648 | 650 | echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
649 | 651 | |
650 | - }else{ |
|
652 | + } else{ |
|
651 | 653 | $value = ''; |
652 | 654 | if (isset($field_info->field_icon)) { |
653 | 655 | $value = esc_attr($field_info->field_icon); |
654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
656 | + } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
655 | 657 | $value = $cf['defaults']['field_icon']; |
656 | 658 | } |
657 | 659 | ?> |
@@ -680,11 +682,11 @@ discard block |
||
680 | 682 | |
681 | 683 | echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
682 | 684 | |
683 | - }else{ |
|
685 | + } else{ |
|
684 | 686 | $value = ''; |
685 | 687 | if (isset($field_info->css_class)) { |
686 | 688 | $value = esc_attr($field_info->css_class); |
687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
689 | + } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
688 | 690 | $value = $cf['defaults']['css_class']; |
689 | 691 | } |
690 | 692 | ?> |
@@ -713,12 +715,12 @@ discard block |
||
713 | 715 | |
714 | 716 | echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
715 | 717 | |
716 | - }else{ |
|
718 | + } else{ |
|
717 | 719 | $value = ''; |
718 | 720 | $hide_cat_sort =''; |
719 | 721 | if (isset($field_info->cat_sort)) { |
720 | 722 | $value = esc_attr($field_info->cat_sort); |
721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
723 | + } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
722 | 724 | $value = $cf['defaults']['cat_sort']; |
723 | 725 | $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
724 | 726 | } |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function init_listing_map_script() |
20 | 20 | { |
21 | - global $list_map_json; |
|
21 | + global $list_map_json; |
|
22 | 22 | |
23 | - $list_map_json = array(); |
|
23 | + $list_map_json = array(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function create_list_jsondata($post) |
37 | 37 | { |
38 | - global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | - |
|
40 | - if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | - /** |
|
42 | - * Filter the json data for search listing map. |
|
43 | - * |
|
44 | - * @since 1.5.7 |
|
45 | - * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | - * @param object $post The post object. |
|
47 | - */ |
|
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | - } |
|
38 | + global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | + |
|
40 | + if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | + /** |
|
42 | + * Filter the json data for search listing map. |
|
43 | + * |
|
44 | + * @since 1.5.7 |
|
45 | + * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | + * @param object $post The post object. |
|
47 | + */ |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -59,29 +59,29 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function show_listing_widget_map() |
61 | 61 | { |
62 | - global $list_map_json; |
|
62 | + global $list_map_json; |
|
63 | 63 | |
64 | - if (!empty($list_map_json)) { |
|
65 | - $list_map_json = array_unique($list_map_json); |
|
66 | - $cat_content_info[] = implode(',', $list_map_json); |
|
67 | - } |
|
64 | + if (!empty($list_map_json)) { |
|
65 | + $list_map_json = array_unique($list_map_json); |
|
66 | + $cat_content_info[] = implode(',', $list_map_json); |
|
67 | + } |
|
68 | 68 | |
69 | - $totalcount = count(array_unique($list_map_json)); |
|
69 | + $totalcount = count(array_unique($list_map_json)); |
|
70 | 70 | |
71 | 71 | |
72 | - if (!empty($cat_content_info)) { |
|
73 | - $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | - $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | - } else { |
|
78 | - $list_json = '[{"totalcount":"0"}]'; |
|
79 | - } |
|
72 | + if (!empty($cat_content_info)) { |
|
73 | + $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | + $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | + $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | + } else { |
|
78 | + $list_json = '[{"totalcount":"0"}]'; |
|
79 | + } |
|
80 | 80 | |
81 | - $listing_map_args = array('list_json' => $list_json); |
|
81 | + $listing_map_args = array('list_json' => $list_json); |
|
82 | 82 | |
83 | - // Pass the json data in listing map script |
|
84 | - wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
83 | + // Pass the json data in listing map script |
|
84 | + wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -93,110 +93,110 @@ discard block |
||
93 | 93 | class geodir_map_listingpage extends WP_Widget |
94 | 94 | { |
95 | 95 | |
96 | - /** |
|
96 | + /** |
|
97 | 97 | * Register the listing page map widget. |
98 | 98 | * |
99 | 99 | * @since 1.0.0 |
100 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
100 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
101 | 101 | */ |
102 | - public function __construct() { |
|
103 | - $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | - parent::__construct( |
|
105 | - 'geodir_map_v3_listing_map', // Base ID |
|
106 | - __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | - $widget_ops// Args |
|
108 | - ); |
|
102 | + public function __construct() { |
|
103 | + $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | + parent::__construct( |
|
105 | + 'geodir_map_v3_listing_map', // Base ID |
|
106 | + __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | + $widget_ops// Args |
|
108 | + ); |
|
109 | 109 | |
110 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
110 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
111 | 111 | |
112 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
112 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
113 | 113 | |
114 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | - } |
|
114 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | + } |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Front-end display content for listing page map widget. |
119 | 119 | * |
120 | 120 | * @since 1.0.0 |
121 | - * @since 1.5.1 Declare function public. |
|
121 | + * @since 1.5.1 Declare function public. |
|
122 | + * |
|
123 | + * @global object $post The current post object. |
|
122 | 124 | * |
123 | - * @global object $post The current post object. |
|
124 | - * |
|
125 | 125 | * @param array $args Widget arguments. |
126 | 126 | * @param array $instance Saved values from database. |
127 | 127 | */ |
128 | - public function widget($args, $instance) |
|
129 | - { |
|
130 | - |
|
131 | - if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | - || geodir_is_page('detail') |
|
133 | - ) : |
|
134 | - |
|
135 | - extract($args, EXTR_SKIP); |
|
136 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | - $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | - $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | - /** |
|
147 | - * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | - * |
|
149 | - * @since 1.0.0 |
|
150 | - * @param bool $sticky True if should be sticky, false if not |
|
151 | - */ |
|
152 | - $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | - $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
128 | + public function widget($args, $instance) |
|
129 | + { |
|
130 | + |
|
131 | + if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | + || geodir_is_page('detail') |
|
133 | + ) : |
|
134 | + |
|
135 | + extract($args, EXTR_SKIP); |
|
136 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | + $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | + $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | + /** |
|
147 | + * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | + * |
|
149 | + * @since 1.0.0 |
|
150 | + * @param bool $sticky True if should be sticky, false if not |
|
151 | + */ |
|
152 | + $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | + $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
156 | 156 | |
157 | 157 | /** |
158 | - * Filter the listing map should to be displayed or not. |
|
159 | - * |
|
160 | - * @since 1.4.6 |
|
158 | + * Filter the listing map should to be displayed or not. |
|
161 | 159 | * |
162 | - * @param bool $display true if map should be displayed, false if not. |
|
163 | - */ |
|
160 | + * @since 1.4.6 |
|
161 | + * |
|
162 | + * @param bool $display true if map should be displayed, false if not. |
|
163 | + */ |
|
164 | 164 | $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
165 | 165 | if ( !$show_map ) { |
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - $map_args = array(); |
|
170 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | - $map_args['width'] = $width; |
|
172 | - $map_args['height'] = $height; |
|
173 | - |
|
174 | - $map_args['scrollwheel'] = $scrollwheel; |
|
175 | - $map_args['showall'] = $showall; |
|
176 | - $map_args['child_collapse'] = '0'; |
|
177 | - $map_args['sticky'] = $sticky; |
|
178 | - $map_args['enable_cat_filters'] = false; |
|
179 | - $map_args['enable_text_search'] = false; |
|
180 | - $map_args['enable_post_type_filters'] = false; |
|
181 | - $map_args['enable_location_filters'] = false; |
|
182 | - $map_args['enable_jason_on_load'] = true; |
|
169 | + $map_args = array(); |
|
170 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | + $map_args['width'] = $width; |
|
172 | + $map_args['height'] = $height; |
|
173 | + |
|
174 | + $map_args['scrollwheel'] = $scrollwheel; |
|
175 | + $map_args['showall'] = $showall; |
|
176 | + $map_args['child_collapse'] = '0'; |
|
177 | + $map_args['sticky'] = $sticky; |
|
178 | + $map_args['enable_cat_filters'] = false; |
|
179 | + $map_args['enable_text_search'] = false; |
|
180 | + $map_args['enable_post_type_filters'] = false; |
|
181 | + $map_args['enable_location_filters'] = false; |
|
182 | + $map_args['enable_jason_on_load'] = true; |
|
183 | 183 | |
184 | - if (is_single()) { |
|
184 | + if (is_single()) { |
|
185 | 185 | |
186 | - global $post; |
|
187 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | - $mapview = $post->post_mapview; |
|
190 | - $mapzoom = $post->post_mapzoom; |
|
191 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
186 | + global $post; |
|
187 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | + $mapview = $post->post_mapview; |
|
190 | + $mapzoom = $post->post_mapzoom; |
|
191 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
192 | 192 | |
193 | - } else { |
|
194 | - $default_location = geodir_get_default_location(); |
|
193 | + } else { |
|
194 | + $default_location = geodir_get_default_location(); |
|
195 | 195 | |
196 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | - $mapview = $maptype; |
|
196 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | + $mapview = $maptype; |
|
200 | 200 | |
201 | 201 | if ( geodir_is_page( 'search' ) ) { |
202 | 202 | $map_default_lat = ''; |
@@ -213,83 +213,83 @@ discard block |
||
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - } |
|
217 | - |
|
218 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
219 | - |
|
220 | - // Set default map options |
|
221 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
222 | - $map_args['latitude'] = $map_default_lat; |
|
223 | - $map_args['longitude'] = $map_default_lng; |
|
224 | - $map_args['zoom'] = $zoom; |
|
225 | - //$map_args['scrollwheel'] = true; |
|
226 | - $map_args['scrollwheel'] = $scrollwheel; |
|
227 | - $map_args['showall'] = $showall; |
|
228 | - $map_args['streetViewControl'] = true; |
|
229 | - $map_args['maptype'] = $maptype; |
|
230 | - $map_args['showPreview'] = '0'; |
|
231 | - $map_args['maxZoom'] = 21; |
|
232 | - $map_args['autozoom'] = $autozoom; |
|
233 | - $map_args['bubble_size'] = 'small'; |
|
216 | + } |
|
217 | + |
|
218 | + if (empty($mapzoom)) $mapzoom = $zoom; |
|
219 | + |
|
220 | + // Set default map options |
|
221 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
222 | + $map_args['latitude'] = $map_default_lat; |
|
223 | + $map_args['longitude'] = $map_default_lng; |
|
224 | + $map_args['zoom'] = $zoom; |
|
225 | + //$map_args['scrollwheel'] = true; |
|
226 | + $map_args['scrollwheel'] = $scrollwheel; |
|
227 | + $map_args['showall'] = $showall; |
|
228 | + $map_args['streetViewControl'] = true; |
|
229 | + $map_args['maptype'] = $maptype; |
|
230 | + $map_args['showPreview'] = '0'; |
|
231 | + $map_args['maxZoom'] = 21; |
|
232 | + $map_args['autozoom'] = $autozoom; |
|
233 | + $map_args['bubble_size'] = 'small'; |
|
234 | 234 | |
235 | - $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
235 | + $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
236 | 236 | |
237 | - echo $before_widget; |
|
238 | - geodir_draw_map($map_args); |
|
239 | - echo $after_widget; |
|
237 | + echo $before_widget; |
|
238 | + geodir_draw_map($map_args); |
|
239 | + echo $after_widget; |
|
240 | 240 | |
241 | - endif; |
|
242 | - } |
|
241 | + endif; |
|
242 | + } |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * Sanitize listing page map widget form values as they are saved. |
246 | 246 | * |
247 | 247 | * @since 1.0.0 |
248 | - * @since 1.5.1 Declare function public. |
|
248 | + * @since 1.5.1 Declare function public. |
|
249 | 249 | * |
250 | 250 | * @param array $new_instance Values just sent to be saved. |
251 | 251 | * @param array $old_instance Previously saved values from database. |
252 | 252 | * |
253 | 253 | * @return array Updated safe values to be saved. |
254 | 254 | */ |
255 | - public function update($new_instance, $old_instance) { |
|
256 | - //save the widget |
|
257 | - $instance = $old_instance; |
|
258 | - $instance['width'] = strip_tags($new_instance['width']); |
|
259 | - $instance['heigh'] = ($new_instance['heigh']); |
|
260 | - $instance['maptype'] = ($new_instance['maptype']); |
|
261 | - $instance['zoom'] = ($new_instance['zoom']); |
|
262 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
263 | - $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
264 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
265 | - $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
266 | - $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
267 | - |
|
268 | - return $instance; |
|
269 | - } |
|
255 | + public function update($new_instance, $old_instance) { |
|
256 | + //save the widget |
|
257 | + $instance = $old_instance; |
|
258 | + $instance['width'] = strip_tags($new_instance['width']); |
|
259 | + $instance['heigh'] = ($new_instance['heigh']); |
|
260 | + $instance['maptype'] = ($new_instance['maptype']); |
|
261 | + $instance['zoom'] = ($new_instance['zoom']); |
|
262 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
263 | + $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
264 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
265 | + $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
266 | + $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
267 | + |
|
268 | + return $instance; |
|
269 | + } |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Back-end listing page map widget settings form. |
273 | 273 | * |
274 | 274 | * @since 1.0.0 |
275 | - * @since 1.5.1 Declare function public. |
|
275 | + * @since 1.5.1 Declare function public. |
|
276 | 276 | * |
277 | 277 | * @param array $instance Previously saved values from database. |
278 | 278 | */ |
279 | - public function form($instance) { |
|
280 | - // widget form in backend |
|
281 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
279 | + public function form($instance) { |
|
280 | + // widget form in backend |
|
281 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
282 | 282 | |
283 | - $width = strip_tags($instance['width']); |
|
284 | - $heigh = strip_tags($instance['heigh']); |
|
285 | - $maptype = strip_tags($instance['maptype']); |
|
286 | - $zoom = strip_tags($instance['zoom']); |
|
287 | - $autozoom = strip_tags($instance['autozoom']); |
|
288 | - $sticky = strip_tags($instance['sticky']); |
|
289 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
290 | - $showall = strip_tags($instance['showall']); |
|
291 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
292 | - ?> |
|
283 | + $width = strip_tags($instance['width']); |
|
284 | + $heigh = strip_tags($instance['heigh']); |
|
285 | + $maptype = strip_tags($instance['maptype']); |
|
286 | + $zoom = strip_tags($instance['zoom']); |
|
287 | + $autozoom = strip_tags($instance['autozoom']); |
|
288 | + $sticky = strip_tags($instance['sticky']); |
|
289 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
290 | + $showall = strip_tags($instance['showall']); |
|
291 | + $marker_cluster = (int)$instance['marker_cluster']; |
|
292 | + ?> |
|
293 | 293 | <p> |
294 | 294 | <label |
295 | 295 | for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?> |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | name="<?php echo $this->get_field_name('maptype'); ?>"> |
319 | 319 | |
320 | 320 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') { |
321 | - echo 'selected="selected"'; |
|
322 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
321 | + echo 'selected="selected"'; |
|
322 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
323 | 323 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') { |
324 | - echo 'selected="selected"'; |
|
325 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
324 | + echo 'selected="selected"'; |
|
325 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
326 | 326 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
327 | - echo 'selected="selected"'; |
|
328 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
327 | + echo 'selected="selected"'; |
|
328 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
329 | 329 | <option <?php selected($maptype, 'TERRAIN');?> |
330 | 330 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
331 | 331 | </select> |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | </p> |
334 | 334 | |
335 | 335 | <?php |
336 | - $map_zoom_level = geodir_map_zoom_level(); |
|
337 | - ?> |
|
336 | + $map_zoom_level = geodir_map_zoom_level(); |
|
337 | + ?> |
|
338 | 338 | |
339 | 339 | <p> |
340 | 340 | <label |
@@ -344,14 +344,14 @@ discard block |
||
344 | 344 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>" |
345 | 345 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php |
346 | 346 | |
347 | - foreach ($map_zoom_level as $level) { |
|
348 | - $selected = ''; |
|
349 | - if ($level == $zoom) |
|
350 | - $selected = 'selected="selected"'; |
|
347 | + foreach ($map_zoom_level as $level) { |
|
348 | + $selected = ''; |
|
349 | + if ($level == $zoom) |
|
350 | + $selected = 'selected="selected"'; |
|
351 | 351 | |
352 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
352 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
353 | 353 | |
354 | - } ?> |
|
354 | + } ?> |
|
355 | 355 | |
356 | 356 | </select> |
357 | 357 | |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | for="<?php echo $this->get_field_id('autozoom'); ?>"> |
364 | 364 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>" |
365 | 365 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) { |
366 | - echo 'checked="checked"'; |
|
367 | - } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
366 | + echo 'checked="checked"'; |
|
367 | + } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
368 | 368 | </p> |
369 | 369 | |
370 | 370 | <p> |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | for="<?php echo $this->get_field_id('sticky'); ?>"> |
373 | 373 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>" |
374 | 374 | name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) { |
375 | - echo 'checked="checked"'; |
|
376 | - } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
375 | + echo 'checked="checked"'; |
|
376 | + } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
377 | 377 | </label> |
378 | 378 | </p> |
379 | 379 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | </p> --> |
400 | 400 | |
401 | 401 | <?php |
402 | - } |
|
402 | + } |
|
403 | 403 | } // class geodir_map_listingpage |
404 | 404 | |
405 | 405 | register_widget('geodir_map_listingpage'); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $post->marker_json JSON representation of the post marker info. |
46 | 46 | * @param object $post The post object. |
47 | 47 | */ |
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $json_content = substr(implode(',', $cat_content_info), 1); |
74 | 74 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
75 | 75 | $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
76 | + $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']'; |
|
77 | 77 | } else { |
78 | 78 | $list_json = '[{"totalcount":"0"}]'; |
79 | 79 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @param bool $display true if map should be displayed, false if not. |
163 | 163 | */ |
164 | - $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
|
165 | - if ( !$show_map ) { |
|
164 | + $show_map = apply_filters('geodir_show_map_listing', $display = true); |
|
165 | + if (!$show_map) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | $map_args['map_class_name'] = 'geodir-map-listing-page'; |
199 | 199 | $mapview = $maptype; |
200 | 200 | |
201 | - if ( geodir_is_page( 'search' ) ) { |
|
201 | + if (geodir_is_page('search')) { |
|
202 | 202 | $map_default_lat = ''; |
203 | 203 | $map_default_lng = ''; |
204 | - if ( isset( $_REQUEST['sgeo_lat'] ) && isset( $_REQUEST['sgeo_lon'] ) ) { |
|
205 | - $map_default_lat = (float)sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
206 | - $map_default_lng = (float)sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
204 | + if (isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon'])) { |
|
205 | + $map_default_lat = (float) sanitize_text_field($_REQUEST['sgeo_lat']); |
|
206 | + $map_default_lng = (float) sanitize_text_field($_REQUEST['sgeo_lon']); |
|
207 | 207 | } |
208 | - if ( empty( $map_default_lat ) && empty( $map_default_lng ) && ! empty( $_REQUEST['set_location_type'] ) && ! empty( $_REQUEST['set_location_val'] ) && function_exists( 'geodir_get_location_by_id' ) ) { |
|
209 | - $location = geodir_get_location_by_id( '', (int)$_REQUEST['set_location_val'] ); |
|
210 | - if ( ! empty( $location ) ) { |
|
208 | + if (empty($map_default_lat) && empty($map_default_lng) && !empty($_REQUEST['set_location_type']) && !empty($_REQUEST['set_location_val']) && function_exists('geodir_get_location_by_id')) { |
|
209 | + $location = geodir_get_location_by_id('', (int) $_REQUEST['set_location_val']); |
|
210 | + if (!empty($location)) { |
|
211 | 211 | $map_default_lat = $location->city_latitude; |
212 | 212 | $map_default_lng = $location->city_longitude; |
213 | 213 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function form($instance) { |
280 | 280 | // widget form in backend |
281 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
281 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
282 | 282 | |
283 | 283 | $width = strip_tags($instance['width']); |
284 | 284 | $heigh = strip_tags($instance['heigh']); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $sticky = strip_tags($instance['sticky']); |
289 | 289 | $scrollwheel = strip_tags($instance['scrollwheel']); |
290 | 290 | $showall = strip_tags($instance['showall']); |
291 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
291 | + $marker_cluster = (int) $instance['marker_cluster']; |
|
292 | 292 | ?> |
293 | 293 | <p> |
294 | 294 | <label |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
327 | 327 | echo 'selected="selected"'; |
328 | 328 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
329 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
329 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
330 | 330 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
331 | 331 | </select> |
332 | 332 | </label> |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | if ($level == $zoom) |
350 | 350 | $selected = 'selected="selected"'; |
351 | 351 | |
352 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
352 | + echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>'; |
|
353 | 353 | |
354 | 354 | } ?> |
355 | 355 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | for="<?php echo $this->get_field_id('scrollwheel'); ?>"> |
383 | 383 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>" |
384 | 384 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1" |
385 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
385 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
386 | 386 | </label> |
387 | 387 | </p> |
388 | 388 | <?php if (defined('GDCLUSTER_VERSION')) { ?> |
@@ -215,7 +215,9 @@ discard block |
||
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
218 | + if (empty($mapzoom)) { |
|
219 | + $mapzoom = $zoom; |
|
220 | + } |
|
219 | 221 | |
220 | 222 | // Set default map options |
221 | 223 | $map_args['ajax_url'] = geodir_get_ajax_url(); |
@@ -346,8 +348,9 @@ discard block |
||
346 | 348 | |
347 | 349 | foreach ($map_zoom_level as $level) { |
348 | 350 | $selected = ''; |
349 | - if ($level == $zoom) |
|
350 | - $selected = 'selected="selected"'; |
|
351 | + if ($level == $zoom) { |
|
352 | + $selected = 'selected="selected"'; |
|
353 | + } |
|
351 | 354 | |
352 | 355 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
353 | 356 |
@@ -316,6 +316,10 @@ |
||
316 | 316 | return $personal_data; |
317 | 317 | } |
318 | 318 | |
319 | + /** |
|
320 | + * @param string $email_address |
|
321 | + * @param integer $page |
|
322 | + */ |
|
319 | 323 | public static function posts_by_author( $email_address, $post_type, $page ) { |
320 | 324 | if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) { |
321 | 325 | return array(); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy_Exporters Class. |
@@ -23,32 +23,32 @@ discard block |
||
23 | 23 | * @param int $page Page. |
24 | 24 | * @return array An array of personal data in name value pairs |
25 | 25 | */ |
26 | - public static function post_data_exporter( $email_address, $page ) { |
|
27 | - $post_type = GeoDir_Privacy::exporter_post_type(); |
|
26 | + public static function post_data_exporter($email_address, $page) { |
|
27 | + $post_type = GeoDir_Privacy::exporter_post_type(); |
|
28 | 28 | |
29 | 29 | $done = false; |
30 | 30 | $page = (int) $page; |
31 | 31 | $data_to_export = array(); |
32 | 32 | |
33 | - $posts = self::posts_by_author( $email_address, $post_type, $page ); |
|
33 | + $posts = self::posts_by_author($email_address, $post_type, $page); |
|
34 | 34 | |
35 | - if ( 0 < count( $posts ) ) { |
|
36 | - $obj_post_type = get_post_type_object( $post_type ); |
|
35 | + if (0 < count($posts)) { |
|
36 | + $obj_post_type = get_post_type_object($post_type); |
|
37 | 37 | |
38 | - foreach ( $posts as $post_ID ) { |
|
39 | - $gd_post = geodir_get_post_info( $post_ID ); |
|
40 | - if ( empty( $gd_post ) ) { |
|
38 | + foreach ($posts as $post_ID) { |
|
39 | + $gd_post = geodir_get_post_info($post_ID); |
|
40 | + if (empty($gd_post)) { |
|
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $data_to_export[] = array( |
45 | - 'group_id' => 'geodirectory-post-' . $post_type, |
|
46 | - 'group_label' => __( $obj_post_type->labels->name, 'geodirectory' ), |
|
47 | - 'item_id' => 'post-' . $post_ID, |
|
48 | - 'data' => self::get_post_personal_data( $gd_post ), |
|
45 | + 'group_id' => 'geodirectory-post-'.$post_type, |
|
46 | + 'group_label' => __($obj_post_type->labels->name, 'geodirectory'), |
|
47 | + 'item_id' => 'post-'.$post_ID, |
|
48 | + 'data' => self::get_post_personal_data($gd_post), |
|
49 | 49 | ); |
50 | 50 | } |
51 | - $done = 10 > count( $posts ); |
|
51 | + $done = 10 > count($posts); |
|
52 | 52 | } else { |
53 | 53 | $done = true; |
54 | 54 | } |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | * @param WP_Post $gd_post The post object. |
67 | 67 | * @return array |
68 | 68 | */ |
69 | - protected static function get_post_personal_data( $gd_post ) { |
|
69 | + protected static function get_post_personal_data($gd_post) { |
|
70 | 70 | $post_categories = array(); |
71 | 71 | $post_tags = array(); |
72 | 72 | $default_category = ''; |
73 | 73 | |
74 | - $cat_taxonomy = $gd_post->post_type . 'category'; |
|
75 | - $tag_taxonomy = $gd_post->post_type . '_tags'; |
|
74 | + $cat_taxonomy = $gd_post->post_type.'category'; |
|
75 | + $tag_taxonomy = $gd_post->post_type.'_tags'; |
|
76 | 76 | |
77 | - $post_terms = wp_get_post_terms( $gd_post->ID, array( $cat_taxonomy, $tag_taxonomy ) ); |
|
78 | - if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) { |
|
79 | - foreach ( $post_terms as $term ) { |
|
80 | - if ( $term->taxonomy == $cat_taxonomy ) { |
|
77 | + $post_terms = wp_get_post_terms($gd_post->ID, array($cat_taxonomy, $tag_taxonomy)); |
|
78 | + if (!empty($post_terms) && !is_wp_error($post_terms)) { |
|
79 | + foreach ($post_terms as $term) { |
|
80 | + if ($term->taxonomy == $cat_taxonomy) { |
|
81 | 81 | $post_categories[] = $term->name; |
82 | 82 | } else { |
83 | 83 | $post_tags[] = $term->name; |
84 | 84 | } |
85 | 85 | |
86 | - if ( $gd_post->default_category == $term->term_id ) { |
|
86 | + if ($gd_post->default_category == $term->term_id) { |
|
87 | 87 | $default_category = $term->name; |
88 | 88 | } |
89 | 89 | } |
@@ -91,189 +91,189 @@ discard block |
||
91 | 91 | |
92 | 92 | $personal_data = array(); |
93 | 93 | $personal_data[] = array( |
94 | - 'name' => __( 'Post ID', 'geodirectory' ), |
|
94 | + 'name' => __('Post ID', 'geodirectory'), |
|
95 | 95 | 'value' => $gd_post->ID, |
96 | 96 | ); |
97 | 97 | $personal_data[] = array( |
98 | - 'name' => __( 'Post Title', 'geodirectory' ), |
|
98 | + 'name' => __('Post Title', 'geodirectory'), |
|
99 | 99 | 'value' => $gd_post->post_title, |
100 | 100 | ); |
101 | 101 | $personal_data[] = array( |
102 | - 'name' => __( 'Post Description', 'geodirectory' ), |
|
102 | + 'name' => __('Post Description', 'geodirectory'), |
|
103 | 103 | 'value' => $gd_post->post_content, |
104 | 104 | ); |
105 | 105 | $personal_data[] = array( |
106 | - 'name' => __( 'Post Date', 'geodirectory' ), |
|
106 | + 'name' => __('Post Date', 'geodirectory'), |
|
107 | 107 | 'value' => $gd_post->post_date, |
108 | 108 | ); |
109 | - if ( ! empty( $gd_post->post_modified ) && $gd_post->post_modified != '0000-00-00 00:00:00' ) { |
|
109 | + if (!empty($gd_post->post_modified) && $gd_post->post_modified != '0000-00-00 00:00:00') { |
|
110 | 110 | $personal_data[] = array( |
111 | - 'name' => __( 'Post Modified Date', 'geodirectory' ), |
|
111 | + 'name' => __('Post Modified Date', 'geodirectory'), |
|
112 | 112 | 'value' => $gd_post->post_modified, |
113 | 113 | ); |
114 | 114 | } |
115 | 115 | $personal_data[] = array( |
116 | - 'name' => __( 'Post Status', 'geodirectory' ), |
|
116 | + 'name' => __('Post Status', 'geodirectory'), |
|
117 | 117 | 'value' => $gd_post->post_status, |
118 | 118 | ); |
119 | - if ( ! empty( $gd_post->submit_ip ) ) { |
|
119 | + if (!empty($gd_post->submit_ip)) { |
|
120 | 120 | $personal_data[] = array( |
121 | - 'name' => __( 'Submit IP', 'geodirectory' ), |
|
121 | + 'name' => __('Submit IP', 'geodirectory'), |
|
122 | 122 | 'value' => $gd_post->submit_ip, |
123 | 123 | ); |
124 | 124 | } |
125 | 125 | $personal_data[] = array( |
126 | - 'name' => __( 'Post Categories', 'geodirectory' ), |
|
127 | - 'value' => ( ! empty( $post_categories ) ? implode( ', ', $post_categories ) : '' ), |
|
126 | + 'name' => __('Post Categories', 'geodirectory'), |
|
127 | + 'value' => (!empty($post_categories) ? implode(', ', $post_categories) : ''), |
|
128 | 128 | ); |
129 | - if ( $default_category ) { |
|
129 | + if ($default_category) { |
|
130 | 130 | $personal_data[] = array( |
131 | - 'name' => __( 'Default Category', 'geodirectory' ), |
|
131 | + 'name' => __('Default Category', 'geodirectory'), |
|
132 | 132 | 'value' => $default_category, |
133 | 133 | ); |
134 | 134 | } |
135 | - if ( ! empty( $post_tags ) ) { |
|
135 | + if (!empty($post_tags)) { |
|
136 | 136 | $personal_data[] = array( |
137 | - 'name' => __( 'Post Tags', 'geodirectory' ), |
|
138 | - 'value' => implode( ', ', $post_tags ), |
|
137 | + 'name' => __('Post Tags', 'geodirectory'), |
|
138 | + 'value' => implode(', ', $post_tags), |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | $personal_data[] = array( |
142 | - 'name' => __( 'Post URL', 'geodirectory' ), |
|
143 | - 'value' => get_permalink( $gd_post->ID ), |
|
142 | + 'name' => __('Post URL', 'geodirectory'), |
|
143 | + 'value' => get_permalink($gd_post->ID), |
|
144 | 144 | ); |
145 | 145 | |
146 | 146 | // Post Images |
147 | - $post_images = geodir_get_images( $gd_post->ID ); |
|
148 | - if ( ! empty( $post_images ) ) { |
|
147 | + $post_images = geodir_get_images($gd_post->ID); |
|
148 | + if (!empty($post_images)) { |
|
149 | 149 | $images = array(); |
150 | - foreach ( $post_images as $key => $post_image ) { |
|
151 | - if ( ! empty( $post_image->src ) ) { |
|
150 | + foreach ($post_images as $key => $post_image) { |
|
151 | + if (!empty($post_image->src)) { |
|
152 | 152 | $images[] = $post_image->src; |
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - if ( ! empty( $images ) ) { |
|
156 | + if (!empty($images)) { |
|
157 | 157 | $personal_data[] = array( |
158 | - 'name' => __( 'Post Images', 'geodirectory' ), |
|
159 | - 'value' => self::parse_files_value( $images ), |
|
158 | + 'name' => __('Post Images', 'geodirectory'), |
|
159 | + 'value' => self::parse_files_value($images), |
|
160 | 160 | ); |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | // Post Rating |
165 | - $post_rating = geodir_get_post_rating( $gd_post->ID ); |
|
166 | - if ( $post_rating > 0 ) { |
|
167 | - $post_rating = ( is_float( $post_rating) || ( strpos( $post_rating, ".", 1 ) == 1 && strlen( $post_rating ) > 3 ) ) ? number_format( $post_rating, 1, '.', '' ) : $post_rating; |
|
165 | + $post_rating = geodir_get_post_rating($gd_post->ID); |
|
166 | + if ($post_rating > 0) { |
|
167 | + $post_rating = (is_float($post_rating) || (strpos($post_rating, ".", 1) == 1 && strlen($post_rating) > 3)) ? number_format($post_rating, 1, '.', '') : $post_rating; |
|
168 | 168 | $personal_data[] = array( |
169 | - 'name' => __( 'Post Rating', 'geodirectory' ), |
|
170 | - 'value' => $post_rating . ' / 5', |
|
169 | + 'name' => __('Post Rating', 'geodirectory'), |
|
170 | + 'value' => $post_rating.' / 5', |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
174 | 174 | // Post Reviews |
175 | - $post_reviews = geodir_get_review_count_total( $gd_post->ID ); |
|
176 | - if ( $post_reviews > 0 ) { |
|
175 | + $post_reviews = geodir_get_review_count_total($gd_post->ID); |
|
176 | + if ($post_reviews > 0) { |
|
177 | 177 | $personal_data[] = array( |
178 | - 'name' => __( 'Post Reviews', 'geodirectory' ), |
|
178 | + 'name' => __('Post Reviews', 'geodirectory'), |
|
179 | 179 | 'value' => $post_reviews, |
180 | 180 | ); |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! empty( $gd_post->is_featured ) ) { |
|
183 | + if (!empty($gd_post->is_featured)) { |
|
184 | 184 | $personal_data[] = array( |
185 | - 'name' => __( 'Post Featured', 'geodirectory' ), |
|
186 | - 'value' => __( 'Yes', 'geodirectory' ), |
|
185 | + 'name' => __('Post Featured', 'geodirectory'), |
|
186 | + 'value' => __('Yes', 'geodirectory'), |
|
187 | 187 | ); |
188 | 188 | } |
189 | 189 | |
190 | - $custom_fields = geodir_post_custom_fields( $gd_post->package_id, 'all', $gd_post->post_type ); |
|
191 | - $post_fields = array_keys( (array) $gd_post ); |
|
190 | + $custom_fields = geodir_post_custom_fields($gd_post->package_id, 'all', $gd_post->post_type); |
|
191 | + $post_fields = array_keys((array) $gd_post); |
|
192 | 192 | |
193 | - foreach ( $custom_fields as $key => $field ) { |
|
194 | - $field_name = ! empty( $field['htmlvar_name'] ) ? $field['htmlvar_name'] : ''; |
|
195 | - if ( empty( $field_name ) ) { |
|
193 | + foreach ($custom_fields as $key => $field) { |
|
194 | + $field_name = !empty($field['htmlvar_name']) ? $field['htmlvar_name'] : ''; |
|
195 | + if (empty($field_name)) { |
|
196 | 196 | continue; |
197 | 197 | } |
198 | 198 | |
199 | - $field = stripslashes_deep( $field ); |
|
199 | + $field = stripslashes_deep($field); |
|
200 | 200 | |
201 | - $extra_fields = ! empty( $field['extra_fields'] ) ? $field['extra_fields'] : array(); |
|
201 | + $extra_fields = !empty($field['extra_fields']) ? $field['extra_fields'] : array(); |
|
202 | 202 | $data_type = $field['data_type']; |
203 | 203 | $field_type = $field['field_type']; |
204 | - $field_title = $field['site_title']; |
|
205 | - if ( $field_name == 'post' ) { |
|
204 | + $field_title = $field['site_title']; |
|
205 | + if ($field_name == 'post') { |
|
206 | 206 | $field_name = 'post_address'; |
207 | 207 | } |
208 | 208 | |
209 | - if ( ! in_array( $field_name, $post_fields ) ) { |
|
209 | + if (!in_array($field_name, $post_fields)) { |
|
210 | 210 | continue; |
211 | 211 | } |
212 | 212 | |
213 | 213 | $name = $field_title; |
214 | 214 | $value = ''; |
215 | - switch ( $field_type ) { |
|
215 | + switch ($field_type) { |
|
216 | 216 | case 'address': |
217 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $gd_post->post_type ) ? false : true; |
|
218 | - if ( $location_allowed && ! empty( $gd_post->post_country ) && ! empty( $gd_post->post_region ) && ! empty( $gd_post->post_city ) ) { |
|
217 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($gd_post->post_type) ? false : true; |
|
218 | + if ($location_allowed && !empty($gd_post->post_country) && !empty($gd_post->post_region) && !empty($gd_post->post_city)) { |
|
219 | 219 | $personal_data[] = array( |
220 | - 'name' => __( 'Post Address', 'geodirectory' ), |
|
220 | + 'name' => __('Post Address', 'geodirectory'), |
|
221 | 221 | 'value' => $gd_post->post_address, |
222 | 222 | ); |
223 | 223 | $personal_data[] = array( |
224 | - 'name' => __( 'Post City', 'geodirectory' ), |
|
224 | + 'name' => __('Post City', 'geodirectory'), |
|
225 | 225 | 'value' => $gd_post->post_city, |
226 | 226 | ); |
227 | 227 | $personal_data[] = array( |
228 | - 'name' => __( 'Post Region', 'geodirectory' ), |
|
228 | + 'name' => __('Post Region', 'geodirectory'), |
|
229 | 229 | 'value' => $gd_post->post_region, |
230 | 230 | ); |
231 | 231 | $personal_data[] = array( |
232 | - 'name' => __( 'Post Country', 'geodirectory' ), |
|
232 | + 'name' => __('Post Country', 'geodirectory'), |
|
233 | 233 | 'value' => $gd_post->post_country, |
234 | 234 | ); |
235 | 235 | $personal_data[] = array( |
236 | - 'name' => __( 'Post Zip', 'geodirectory' ), |
|
236 | + 'name' => __('Post Zip', 'geodirectory'), |
|
237 | 237 | 'value' => $gd_post->post_zip, |
238 | 238 | ); |
239 | 239 | $personal_data[] = array( |
240 | - 'name' => __( 'Post Latitude', 'geodirectory' ), |
|
240 | + 'name' => __('Post Latitude', 'geodirectory'), |
|
241 | 241 | 'value' => $gd_post->post_latitude, |
242 | 242 | ); |
243 | 243 | $personal_data[] = array( |
244 | - 'name' => __( 'Post Longitude', 'geodirectory' ), |
|
244 | + 'name' => __('Post Longitude', 'geodirectory'), |
|
245 | 245 | 'value' => $gd_post->post_longitude, |
246 | 246 | ); |
247 | - if ( ! empty( $gd_post->post_neighbourhood ) ) { |
|
247 | + if (!empty($gd_post->post_neighbourhood)) { |
|
248 | 248 | $personal_data[] = array( |
249 | - 'name' => __( 'Post Neighbourhood', 'geodirectory' ), |
|
249 | + 'name' => __('Post Neighbourhood', 'geodirectory'), |
|
250 | 250 | 'value' => $gd_post->post_neighbourhood, |
251 | 251 | ); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | break; |
255 | 255 | case 'checkbox': |
256 | - if ( ! empty( $gd_post->{$field_name} ) ) { |
|
257 | - $value = __( 'Yes', 'geodirectory' ); |
|
256 | + if (!empty($gd_post->{$field_name} )) { |
|
257 | + $value = __('Yes', 'geodirectory'); |
|
258 | 258 | } else { |
259 | - $value = __( 'No', 'geodirectory' ); |
|
259 | + $value = __('No', 'geodirectory'); |
|
260 | 260 | } |
261 | 261 | break; |
262 | 262 | case 'datepicker': |
263 | 263 | $value = $gd_post->{$field_name} != '0000-00-00' ? $gd_post->{$field_name} : ''; |
264 | 264 | break; |
265 | 265 | case 'radio': |
266 | - if ( $gd_post->{$field_name} !== '' ) { |
|
267 | - if ( $gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
268 | - $value = __( 'No', 'geodirectory' ); |
|
269 | - } else if ( $gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
270 | - $value = __( 'Yes', 'geodirectory' ); |
|
266 | + if ($gd_post->{$field_name} !== '') { |
|
267 | + if ($gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
268 | + $value = __('No', 'geodirectory'); |
|
269 | + } else if ($gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
270 | + $value = __('Yes', 'geodirectory'); |
|
271 | 271 | } else { |
272 | - if ( !empty( $field['option_values'] ) ) { |
|
273 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
274 | - if ( ! empty( $cf_option_values ) ) { |
|
275 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
276 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
272 | + if (!empty($field['option_values'])) { |
|
273 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
274 | + if (!empty($cf_option_values)) { |
|
275 | + foreach ($cf_option_values as $cf_option_value) { |
|
276 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
277 | 277 | $value = $cf_option_value['label']; |
278 | 278 | } |
279 | 279 | } |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | } |
284 | 284 | break; |
285 | 285 | case 'select': |
286 | - $value = __( $gd_post->{$field_name}, 'geodirectory'); |
|
287 | - if ( !empty( $field['option_values'] ) ) { |
|
288 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
289 | - if ( ! empty( $cf_option_values ) ) { |
|
290 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
291 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
286 | + $value = __($gd_post->{$field_name}, 'geodirectory'); |
|
287 | + if (!empty($field['option_values'])) { |
|
288 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
289 | + if (!empty($cf_option_values)) { |
|
290 | + foreach ($cf_option_values as $cf_option_value) { |
|
291 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
292 | 292 | $value = $cf_option_value['label']; |
293 | 293 | } |
294 | 294 | } |
@@ -296,23 +296,23 @@ discard block |
||
296 | 296 | } |
297 | 297 | break; |
298 | 298 | case 'multiselect': |
299 | - $field_values = explode( ',', trim( $gd_post->{$field_name}, "," ) ); |
|
300 | - if ( is_array( $field_values ) ) { |
|
301 | - $field_values = array_map( 'trim', $field_values ); |
|
299 | + $field_values = explode(',', trim($gd_post->{$field_name}, ",")); |
|
300 | + if (is_array($field_values)) { |
|
301 | + $field_values = array_map('trim', $field_values); |
|
302 | 302 | } |
303 | 303 | $values = array(); |
304 | - if ( ! empty( $field['option_values'] ) ) { |
|
305 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
304 | + if (!empty($field['option_values'])) { |
|
305 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
306 | 306 | |
307 | - if ( ! empty( $cf_option_values ) ) { |
|
308 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
309 | - if ( isset( $cf_option_value['value'] ) && in_array( $cf_option_value['value'], $field_values ) ) { |
|
307 | + if (!empty($cf_option_values)) { |
|
308 | + foreach ($cf_option_values as $cf_option_value) { |
|
309 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
310 | 310 | $values[] = $cf_option_value['label']; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | } |
314 | 314 | } |
315 | - $value = ! empty( $values ) ? implode( ', ', $values ) : ''; |
|
315 | + $value = !empty($values) ? implode(', ', $values) : ''; |
|
316 | 316 | break; |
317 | 317 | case 'time': |
318 | 318 | $value = $gd_post->{$field_name} != '00:00:00' ? $gd_post->{$field_name} : ''; |
@@ -326,70 +326,70 @@ discard block |
||
326 | 326 | $value = $gd_post->{$field_name} ? $gd_post->{$field_name} : ''; |
327 | 327 | break; |
328 | 328 | case 'file': |
329 | - $files = explode( ",", $gd_post->{$field_name} ); |
|
330 | - if ( ! empty( $files ) ) { |
|
331 | - $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'] : ''; |
|
329 | + $files = explode(",", $gd_post->{$field_name} ); |
|
330 | + if (!empty($files)) { |
|
331 | + $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'] : ''; |
|
332 | 332 | |
333 | 333 | $file_urls = array(); |
334 | - foreach ( $files as $file ) { |
|
335 | - if ( ! empty( $file ) ) { |
|
336 | - $image_name_arr = explode( '/', $file ); |
|
337 | - $curr_img_dir = $image_name_arr[ count( $image_name_arr ) - 2]; |
|
334 | + foreach ($files as $file) { |
|
335 | + if (!empty($file)) { |
|
336 | + $image_name_arr = explode('/', $file); |
|
337 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
338 | 338 | $filename = end($image_name_arr); |
339 | 339 | $img_name_arr = explode('.', $filename); |
340 | 340 | |
341 | - $arr_file_type = wp_check_filetype( $filename ); |
|
342 | - if ( empty( $arr_file_type['ext'] ) || empty( $arr_file_type['type'] ) ) { |
|
341 | + $arr_file_type = wp_check_filetype($filename); |
|
342 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
343 | 343 | continue; |
344 | 344 | } |
345 | 345 | |
346 | 346 | $uploaded_file_type = $arr_file_type['type']; |
347 | 347 | $uploaded_file_ext = $arr_file_type['ext']; |
348 | 348 | |
349 | - if ( ! empty( $allowed_file_types ) && !in_array( $uploaded_file_ext, $allowed_file_types ) ) { |
|
349 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
350 | 350 | continue; // Invalid file type. |
351 | 351 | } |
352 | - $image_file_types = array( 'image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon' ); |
|
353 | - $audio_file_types = array( 'audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid' ); |
|
352 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
353 | + $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
354 | 354 | |
355 | 355 | // If the uploaded file is image |
356 | - if ( in_array( $uploaded_file_type, $image_file_types ) ) { |
|
356 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
357 | 357 | $file_urls[] = $file; |
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
361 | - $value = ! empty( $file_urls ) ? self::parse_files_value( $file_urls ) : ''; |
|
361 | + $value = !empty($file_urls) ? self::parse_files_value($file_urls) : ''; |
|
362 | 362 | } |
363 | 363 | break; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! empty( $name ) && $value !== '' ) { |
|
366 | + if (!empty($name) && $value !== '') { |
|
367 | 367 | $personal_data[] = array( |
368 | - 'name' => __( $name, 'geodirectory' ), |
|
368 | + 'name' => __($name, 'geodirectory'), |
|
369 | 369 | 'value' => $value, |
370 | 370 | ); |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! empty( $gd_post->geodir_link_business ) && ( $post_type = get_post_type( (int)$gd_post->geodir_link_business ) ) ) { |
|
374 | + if (!empty($gd_post->geodir_link_business) && ($post_type = get_post_type((int) $gd_post->geodir_link_business))) { |
|
375 | 375 | $personal_data[] = array( |
376 | - 'name' => __( 'Link Business Title', 'geodirectory' ), |
|
377 | - 'value' => get_the_title( (int)$gd_post->geodir_link_business ), |
|
376 | + 'name' => __('Link Business Title', 'geodirectory'), |
|
377 | + 'value' => get_the_title((int) $gd_post->geodir_link_business), |
|
378 | 378 | ); |
379 | 379 | $personal_data[] = array( |
380 | - 'name' => __( 'Link Business URL', 'geodirectory' ), |
|
381 | - 'value' => get_permalink( (int)$gd_post->geodir_link_business ), |
|
380 | + 'name' => __('Link Business URL', 'geodirectory'), |
|
381 | + 'value' => get_permalink((int) $gd_post->geodir_link_business), |
|
382 | 382 | ); |
383 | 383 | } |
384 | - if ( defined( 'GEODIR_FRANCHISE_VERSION' ) ) { |
|
385 | - if ( ! empty( $gd_post->franchise ) && ( $post_type = get_post_type( (int)$gd_post->franchise ) ) ) { |
|
384 | + if (defined('GEODIR_FRANCHISE_VERSION')) { |
|
385 | + if (!empty($gd_post->franchise) && ($post_type = get_post_type((int) $gd_post->franchise))) { |
|
386 | 386 | $personal_data[] = array( |
387 | - 'name' => __( 'Main Listing Title', 'geodirectory' ), |
|
388 | - 'value' => get_the_title( (int)$gd_post->franchise ), |
|
387 | + 'name' => __('Main Listing Title', 'geodirectory'), |
|
388 | + 'value' => get_the_title((int) $gd_post->franchise), |
|
389 | 389 | ); |
390 | 390 | $personal_data[] = array( |
391 | - 'name' => __( 'Main Listing URL', 'geodirectory' ), |
|
392 | - 'value' => get_permalink( (int)$gd_post->franchise ), |
|
391 | + 'name' => __('Main Listing URL', 'geodirectory'), |
|
392 | + 'value' => get_permalink((int) $gd_post->franchise), |
|
393 | 393 | ); |
394 | 394 | } |
395 | 395 | } |
@@ -401,28 +401,28 @@ discard block |
||
401 | 401 | * @param array $personal_data Array of name value pairs to expose in the export. |
402 | 402 | * @param WP_Post $gd_post The post object. |
403 | 403 | */ |
404 | - $personal_data = apply_filters( 'geodir_privacy_export_post_personal_data', $personal_data, $gd_post ); |
|
404 | + $personal_data = apply_filters('geodir_privacy_export_post_personal_data', $personal_data, $gd_post); |
|
405 | 405 | |
406 | 406 | return $personal_data; |
407 | 407 | } |
408 | 408 | |
409 | - public static function posts_by_author( $email_address, $post_type, $page ) { |
|
410 | - if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) { |
|
409 | + public static function posts_by_author($email_address, $post_type, $page) { |
|
410 | + if (empty($email_address) || empty($post_type) || empty($page)) { |
|
411 | 411 | return array(); |
412 | 412 | } |
413 | 413 | |
414 | - $user = get_user_by( 'email', $email_address ); |
|
415 | - if ( empty( $user ) ) { |
|
414 | + $user = get_user_by('email', $email_address); |
|
415 | + if (empty($user)) { |
|
416 | 416 | return array(); |
417 | 417 | } |
418 | 418 | |
419 | - $statuses = array_keys( get_post_statuses() ); |
|
419 | + $statuses = array_keys(get_post_statuses()); |
|
420 | 420 | $skip_statuses = geodir_imex_export_skip_statuses(); |
421 | - if ( ! empty( $skip_statuses ) ) { |
|
422 | - $statuses = array_diff( $statuses, $skip_statuses ); |
|
421 | + if (!empty($skip_statuses)) { |
|
422 | + $statuses = array_diff($statuses, $skip_statuses); |
|
423 | 423 | } |
424 | 424 | |
425 | - $query_args = array( |
|
425 | + $query_args = array( |
|
426 | 426 | 'post_type' => $post_type, |
427 | 427 | 'post_status' => $statuses, |
428 | 428 | 'fields' => 'ids', |
@@ -433,66 +433,66 @@ discard block |
||
433 | 433 | 'order' => 'ASC' |
434 | 434 | ); |
435 | 435 | |
436 | - $query_args = apply_filters( 'geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page ); |
|
436 | + $query_args = apply_filters('geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page); |
|
437 | 437 | |
438 | - $posts = get_posts( $query_args ); |
|
438 | + $posts = get_posts($query_args); |
|
439 | 439 | |
440 | - return apply_filters( 'geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page ); |
|
440 | + return apply_filters('geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page); |
|
441 | 441 | } |
442 | 442 | |
443 | - public static function review_data_exporter( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) { |
|
443 | + public static function review_data_exporter($response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key) { |
|
444 | 444 | global $wpdb; |
445 | 445 | |
446 | 446 | $exporter_key = GeoDir_Privacy::personal_data_exporter_key(); |
447 | 447 | |
448 | - if ( $exporter_key == 'wordpress-comments' && ! empty( $response['data'] ) ) { |
|
449 | - foreach ( $response['data'] as $key => $item ) { |
|
450 | - $comment_id = str_replace( 'comment-', '', $item['item_id'] ); |
|
448 | + if ($exporter_key == 'wordpress-comments' && !empty($response['data'])) { |
|
449 | + foreach ($response['data'] as $key => $item) { |
|
450 | + $comment_id = str_replace('comment-', '', $item['item_id']); |
|
451 | 451 | $data = $item['data']; |
452 | 452 | |
453 | - $review = geodir_get_review( $comment_id ); |
|
454 | - if ( ! empty( $review ) ) { |
|
455 | - if ( ! empty( $review->overall_rating ) ) { |
|
453 | + $review = geodir_get_review($comment_id); |
|
454 | + if (!empty($review)) { |
|
455 | + if (!empty($review->overall_rating)) { |
|
456 | 456 | $data[] = array( |
457 | - 'name' => __( 'Rating (Overall)', 'geodirectory' ), |
|
458 | - 'value' => (float)$review->overall_rating . ' / 5', |
|
457 | + 'name' => __('Rating (Overall)', 'geodirectory'), |
|
458 | + 'value' => (float) $review->overall_rating.' / 5', |
|
459 | 459 | ); |
460 | 460 | } |
461 | - if ( ! empty( $review->post_city ) ) { |
|
461 | + if (!empty($review->post_city)) { |
|
462 | 462 | $data[] = array( |
463 | - 'name' => __( 'Review City', 'geodirectory' ), |
|
463 | + 'name' => __('Review City', 'geodirectory'), |
|
464 | 464 | 'value' => $review->post_city, |
465 | 465 | ); |
466 | 466 | } |
467 | - if ( ! empty( $review->post_region ) ) { |
|
467 | + if (!empty($review->post_region)) { |
|
468 | 468 | $data[] = array( |
469 | - 'name' => __( 'Review Region', 'geodirectory' ), |
|
469 | + 'name' => __('Review Region', 'geodirectory'), |
|
470 | 470 | 'value' => $review->post_region, |
471 | 471 | ); |
472 | 472 | } |
473 | - if ( ! empty( $review->post_country ) ) { |
|
473 | + if (!empty($review->post_country)) { |
|
474 | 474 | $data[] = array( |
475 | - 'name' => __( 'Review Country', 'geodirectory' ), |
|
475 | + 'name' => __('Review Country', 'geodirectory'), |
|
476 | 476 | 'value' => $review->post_country, |
477 | 477 | ); |
478 | 478 | } |
479 | - if ( ! empty( $review->post_latitude ) ) { |
|
479 | + if (!empty($review->post_latitude)) { |
|
480 | 480 | $data[] = array( |
481 | - 'name' => __( 'Review Latitude', 'geodirectory' ), |
|
481 | + 'name' => __('Review Latitude', 'geodirectory'), |
|
482 | 482 | 'value' => $review->post_latitude, |
483 | 483 | ); |
484 | 484 | } |
485 | - if ( ! empty( $review->post_longitude ) ) { |
|
485 | + if (!empty($review->post_longitude)) { |
|
486 | 486 | $data[] = array( |
487 | - 'name' => __( 'Review Longitude', 'geodirectory' ), |
|
487 | + 'name' => __('Review Longitude', 'geodirectory'), |
|
488 | 488 | 'value' => $review->post_longitude, |
489 | 489 | ); |
490 | 490 | } |
491 | 491 | |
492 | - $data = apply_filters( 'geodir_privacy_export_review_data', $data, $review, $email_address ); |
|
492 | + $data = apply_filters('geodir_privacy_export_review_data', $data, $review, $email_address); |
|
493 | 493 | |
494 | - if ( ! empty( $data ) ) { |
|
495 | - $response['data'][ $key ]['data'] = $data; |
|
494 | + if (!empty($data)) { |
|
495 | + $response['data'][$key]['data'] = $data; |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | } |
@@ -508,36 +508,36 @@ discard block |
||
508 | 508 | * @param int $page Page. |
509 | 509 | * @return array An array of personal data in name value pairs |
510 | 510 | */ |
511 | - public static function favorites_data_exporter( $email_address, $page ) { |
|
511 | + public static function favorites_data_exporter($email_address, $page) { |
|
512 | 512 | $done = true; |
513 | 513 | $page = (int) $page; |
514 | 514 | $data_to_export = array(); |
515 | 515 | |
516 | - $items = GeoDir_Privacy::favorites_by_user( $email_address, $page ); |
|
516 | + $items = GeoDir_Privacy::favorites_by_user($email_address, $page); |
|
517 | 517 | |
518 | - if ( 0 < count( $items ) ) { |
|
519 | - foreach ( $items as $item ) { |
|
520 | - $gd_post = geodir_get_post_info( $item ); |
|
521 | - if ( empty( $gd_post ) ) { |
|
518 | + if (0 < count($items)) { |
|
519 | + foreach ($items as $item) { |
|
520 | + $gd_post = geodir_get_post_info($item); |
|
521 | + if (empty($gd_post)) { |
|
522 | 522 | continue; |
523 | 523 | } |
524 | 524 | |
525 | 525 | $data_to_export[] = array( |
526 | 526 | 'group_id' => 'geodirectory-post-favorites', |
527 | - 'group_label' => __( 'GeoDirectory Favorite Listings', 'geodirectory' ), |
|
528 | - 'item_id' => 'gd-favorite-' . $gd_post->ID, |
|
527 | + 'group_label' => __('GeoDirectory Favorite Listings', 'geodirectory'), |
|
528 | + 'item_id' => 'gd-favorite-'.$gd_post->ID, |
|
529 | 529 | 'data' => array( |
530 | 530 | array( |
531 | - 'name' => __( 'Post ID', 'geodirectory' ), |
|
531 | + 'name' => __('Post ID', 'geodirectory'), |
|
532 | 532 | 'value' => $gd_post->ID, |
533 | 533 | ), |
534 | 534 | array( |
535 | - 'name' => __( 'Post Title', 'geodirectory' ), |
|
535 | + 'name' => __('Post Title', 'geodirectory'), |
|
536 | 536 | 'value' => $gd_post->post_title, |
537 | 537 | ), |
538 | 538 | array( |
539 | - 'name' => __( 'Post URL', 'geodirectory' ), |
|
540 | - 'value' => get_permalink( $gd_post->ID ), |
|
539 | + 'name' => __('Post URL', 'geodirectory'), |
|
540 | + 'value' => get_permalink($gd_post->ID), |
|
541 | 541 | ) |
542 | 542 | ), |
543 | 543 | ); |
@@ -550,27 +550,27 @@ discard block |
||
550 | 550 | ); |
551 | 551 | } |
552 | 552 | |
553 | - public static function parse_files_value( $files ) { |
|
554 | - if ( empty( $files ) ) { |
|
553 | + public static function parse_files_value($files) { |
|
554 | + if (empty($files)) { |
|
555 | 555 | return ''; |
556 | 556 | } |
557 | 557 | |
558 | - if ( ! is_array( $files ) ) { |
|
558 | + if (!is_array($files)) { |
|
559 | 559 | return $files; |
560 | 560 | } |
561 | 561 | |
562 | - if ( count( $files ) == 1 ) { |
|
562 | + if (count($files) == 1) { |
|
563 | 563 | return $files[0]; |
564 | 564 | } |
565 | 565 | |
566 | 566 | $links = array(); |
567 | - foreach ( $files as $file ) { |
|
568 | - if ( false === strpos( $file, ' ' ) && ( 0 === strpos( $file, 'http://' ) || 0 === strpos( $file, 'https://' ) ) ) { |
|
569 | - $file = '<a href="' . esc_url( $file ) . '">' . esc_html( $file ) . '</a>'; |
|
567 | + foreach ($files as $file) { |
|
568 | + if (false === strpos($file, ' ') && (0 === strpos($file, 'http://') || 0 === strpos($file, 'https://'))) { |
|
569 | + $file = '<a href="'.esc_url($file).'">'.esc_html($file).'</a>'; |
|
570 | 570 | } |
571 | 571 | $links[] = $file; |
572 | 572 | } |
573 | - $links = ! empty( $links ) ? implode( ' <br> ', $links ) : ''; |
|
573 | + $links = !empty($links) ? implode(' <br> ', $links) : ''; |
|
574 | 574 | |
575 | 575 | return $links; |
576 | 576 | } |
@@ -103,6 +103,10 @@ |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | + /** |
|
107 | + * @param string $email_address |
|
108 | + * @param integer $page |
|
109 | + */ |
|
106 | 110 | public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) { |
107 | 111 | global $wpdb; |
108 | 112 |
@@ -159,12 +159,12 @@ |
||
159 | 159 | $messages = array(); |
160 | 160 | |
161 | 161 | $site_id = ''; |
162 | - if ( is_multisite() ) { |
|
163 | - $blog_id = get_current_blog_id(); |
|
164 | - if ( $blog_id && $blog_id != '1' ) { |
|
162 | + if ( is_multisite() ) { |
|
163 | + $blog_id = get_current_blog_id(); |
|
164 | + if ( $blog_id && $blog_id != '1' ) { |
|
165 | 165 | $site_id = '_' . $blog_id; |
166 | 166 | } |
167 | - } |
|
167 | + } |
|
168 | 168 | |
169 | 169 | if ( delete_user_meta( $user->ID, 'gd_user_favourite_post' . $site_id ) ) { |
170 | 170 | $messages[] = __( 'Removed "Favorite Listings" data from user.', 'geodirectory' ); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy_Erasers Class. |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param int $page Review page. |
23 | 23 | * @return array |
24 | 24 | */ |
25 | - public static function review_data_eraser( $email_address, $page ) { |
|
25 | + public static function review_data_eraser($email_address, $page) { |
|
26 | 26 | global $wpdb; |
27 | 27 | |
28 | 28 | $response = array( |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'done' => true, |
33 | 33 | ); |
34 | 34 | |
35 | - if ( empty( $email_address ) ) { |
|
35 | + if (empty($email_address)) { |
|
36 | 36 | return $response; |
37 | 37 | } |
38 | 38 | |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | $items_removed = false; |
41 | 41 | $items_retained = false; |
42 | 42 | |
43 | - $reviews = self::reviews_by_author( $email_address, $page ); |
|
43 | + $reviews = self::reviews_by_author($email_address, $page); |
|
44 | 44 | |
45 | - if ( empty( $reviews ) ) { |
|
45 | + if (empty($reviews)) { |
|
46 | 46 | return $response; |
47 | 47 | } |
48 | 48 | |
49 | - $messages = array(); |
|
49 | + $messages = array(); |
|
50 | 50 | |
51 | - foreach ( $reviews as $review ) { |
|
51 | + foreach ($reviews as $review) { |
|
52 | 52 | $anonymized_review = array(); |
53 | 53 | $anonymized_review['user_id'] = 0; |
54 | - $anonymized_review['rating_ip'] = wp_privacy_anonymize_data( 'ip', $review->rating_ip ); |
|
54 | + $anonymized_review['rating_ip'] = wp_privacy_anonymize_data('ip', $review->rating_ip); |
|
55 | 55 | |
56 | 56 | $review_id = (int) $review->id; |
57 | 57 | |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | * @param object $review Review object. |
66 | 66 | * @param array $anonymized_review Anonymized review data. |
67 | 67 | */ |
68 | - $anon_message = apply_filters( 'geodir_anonymize_post_review', true, $review, $anonymized_review ); |
|
68 | + $anon_message = apply_filters('geodir_anonymize_post_review', true, $review, $anonymized_review); |
|
69 | 69 | |
70 | - if ( true !== $anon_message ) { |
|
71 | - if ( $anon_message && is_string( $anon_message ) ) { |
|
72 | - $messages[] = esc_html( $anon_message ); |
|
70 | + if (true !== $anon_message) { |
|
71 | + if ($anon_message && is_string($anon_message)) { |
|
72 | + $messages[] = esc_html($anon_message); |
|
73 | 73 | } else { |
74 | 74 | /* translators: %d: Review ID */ |
75 | - $messages[] = sprintf( __( 'Review %d contains personal data but could not be anonymized.', 'geodirectory' ), $review_id ); |
|
75 | + $messages[] = sprintf(__('Review %d contains personal data but could not be anonymized.', 'geodirectory'), $review_id); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $items_retained = true; |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | 'id' => $review_id, |
85 | 85 | ); |
86 | 86 | |
87 | - $updated = $wpdb->update( GEODIR_REVIEW_TABLE, $anonymized_review, $args ); |
|
87 | + $updated = $wpdb->update(GEODIR_REVIEW_TABLE, $anonymized_review, $args); |
|
88 | 88 | |
89 | - if ( $updated ) { |
|
89 | + if ($updated) { |
|
90 | 90 | $items_removed = true; |
91 | 91 | } else { |
92 | 92 | $items_retained = true; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - $done = count( $reviews ) < $number; |
|
96 | + $done = count($reviews) < $number; |
|
97 | 97 | |
98 | 98 | return array( |
99 | 99 | 'items_removed' => $items_removed, |
@@ -103,29 +103,29 @@ discard block |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | - public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) { |
|
106 | + public static function reviews_by_author($email_address, $page, $posts_per_page = 10) { |
|
107 | 107 | global $wpdb; |
108 | 108 | |
109 | - if ( empty( $email_address ) || empty( $page ) ) { |
|
109 | + if (empty($email_address) || empty($page)) { |
|
110 | 110 | return array(); |
111 | 111 | } |
112 | 112 | |
113 | - $user = get_user_by( 'email', $email_address ); |
|
114 | - if ( empty( $user ) ) { |
|
113 | + $user = get_user_by('email', $email_address); |
|
114 | + if (empty($user)) { |
|
115 | 115 | return array(); |
116 | 116 | } |
117 | 117 | |
118 | - if ( absint( $page ) < 1 ) { |
|
118 | + if (absint($page) < 1) { |
|
119 | 119 | $page = 1; |
120 | 120 | } |
121 | 121 | |
122 | - $limit = absint( ( $page - 1 ) * $posts_per_page ) . ", " . $posts_per_page; |
|
122 | + $limit = absint(($page - 1) * $posts_per_page).", ".$posts_per_page; |
|
123 | 123 | |
124 | - $query = $wpdb->prepare( "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d ORDER BY comment_id ASC LIMIT " . $limit, array( $user->ID ) ); |
|
124 | + $query = $wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d ORDER BY comment_id ASC LIMIT ".$limit, array($user->ID)); |
|
125 | 125 | |
126 | - $reviews = $wpdb->get_results( $query ); |
|
126 | + $reviews = $wpdb->get_results($query); |
|
127 | 127 | |
128 | - return apply_filters( 'geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page ); |
|
128 | + return apply_filters('geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param int $page Page number. |
138 | 138 | * @return array |
139 | 139 | */ |
140 | - public static function favorites_data_eraser( $email_address, $page ) { |
|
140 | + public static function favorites_data_eraser($email_address, $page) { |
|
141 | 141 | $response = array( |
142 | 142 | 'items_removed' => false, |
143 | 143 | 'items_retained' => false, |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | 'done' => true, |
146 | 146 | ); |
147 | 147 | |
148 | - if ( empty( $email_address ) ) { |
|
148 | + if (empty($email_address)) { |
|
149 | 149 | return $response; |
150 | 150 | } |
151 | 151 | |
152 | - $user = get_user_by( 'email', $email_address ); |
|
153 | - if ( empty( $user ) ) { |
|
152 | + $user = get_user_by('email', $email_address); |
|
153 | + if (empty($user)) { |
|
154 | 154 | return $response; |
155 | 155 | } |
156 | 156 | |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | $messages = array(); |
160 | 160 | |
161 | 161 | $site_id = ''; |
162 | - if ( is_multisite() ) { |
|
162 | + if (is_multisite()) { |
|
163 | 163 | $blog_id = get_current_blog_id(); |
164 | - if ( $blog_id && $blog_id != '1' ) { |
|
165 | - $site_id = '_' . $blog_id; |
|
164 | + if ($blog_id && $blog_id != '1') { |
|
165 | + $site_id = '_'.$blog_id; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( delete_user_meta( $user->ID, 'gd_user_favourite_post' . $site_id ) ) { |
|
170 | - $messages[] = __( 'Removed "Favorite Listings" data from user.', 'geodirectory' ); |
|
169 | + if (delete_user_meta($user->ID, 'gd_user_favourite_post'.$site_id)) { |
|
170 | + $messages[] = __('Removed "Favorite Listings" data from user.', 'geodirectory'); |
|
171 | 171 | $items_removed = true; |
172 | 172 | } |
173 | 173 |
@@ -14,83 +14,83 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_popular_post_category extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
18 | - * Register the popular post category widget. |
|
19 | - * |
|
20 | - * @since 1.0.0 |
|
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'popular_post_category', // Base ID |
|
27 | - __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Front-end display content for popular post category widget. |
|
34 | - * |
|
35 | - * @since 1.0.0 |
|
36 | - * @since 1.5.1 Declare function public. |
|
37 | - * |
|
38 | - * @param array $args Widget arguments. |
|
39 | - * @param array $instance Saved values from database. |
|
40 | - */ |
|
41 | - public function widget($args, $instance) |
|
42 | - { |
|
43 | - geodir_popular_post_category_output($args, $instance); |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Sanitize popular post category widget form values as they are saved. |
|
48 | - * |
|
49 | - * @since 1.0.0 |
|
50 | - * @since 1.5.1 Declare function public. |
|
51 | - * @since 1.5.1 Added default_post_type parameter. |
|
52 | - * @since 1.6.9 Added parent_only parameter. |
|
53 | - * |
|
54 | - * @param array $new_instance Values just sent to be saved. |
|
55 | - * @param array $old_instance Previously saved values from database. |
|
56 | - * |
|
57 | - * @return array Updated safe values to be saved. |
|
58 | - */ |
|
59 | - public function update($new_instance, $old_instance) |
|
60 | - { |
|
61 | - //save the widget |
|
62 | - $instance = $old_instance; |
|
63 | - $instance['title'] = strip_tags($new_instance['title']); |
|
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
65 | - $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | - $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | - $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | - return $instance; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Back-end popular post category widget settings form. |
|
73 | - * |
|
74 | - * @since 1.0.0 |
|
75 | - * @since 1.5.1 Declare function public. |
|
76 | - * @since 1.5.1 Added option to set default post type. |
|
77 | - * @since 1.6.9 Added option to show parent categories only. |
|
78 | - * |
|
79 | - * @param array $instance Previously saved values from database. |
|
80 | - */ |
|
81 | - public function form($instance) |
|
82 | - { |
|
83 | - //widgetform in backend |
|
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | - |
|
86 | - $title = strip_tags($instance['title']); |
|
87 | - $category_limit = (int)$instance['category_limit']; |
|
88 | - $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | - $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
17 | + /** |
|
18 | + * Register the popular post category widget. |
|
19 | + * |
|
20 | + * @since 1.0.0 |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'popular_post_category', // Base ID |
|
27 | + __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Front-end display content for popular post category widget. |
|
34 | + * |
|
35 | + * @since 1.0.0 |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | + * |
|
38 | + * @param array $args Widget arguments. |
|
39 | + * @param array $instance Saved values from database. |
|
40 | + */ |
|
41 | + public function widget($args, $instance) |
|
42 | + { |
|
43 | + geodir_popular_post_category_output($args, $instance); |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Sanitize popular post category widget form values as they are saved. |
|
48 | + * |
|
49 | + * @since 1.0.0 |
|
50 | + * @since 1.5.1 Declare function public. |
|
51 | + * @since 1.5.1 Added default_post_type parameter. |
|
52 | + * @since 1.6.9 Added parent_only parameter. |
|
53 | + * |
|
54 | + * @param array $new_instance Values just sent to be saved. |
|
55 | + * @param array $old_instance Previously saved values from database. |
|
56 | + * |
|
57 | + * @return array Updated safe values to be saved. |
|
58 | + */ |
|
59 | + public function update($new_instance, $old_instance) |
|
60 | + { |
|
61 | + //save the widget |
|
62 | + $instance = $old_instance; |
|
63 | + $instance['title'] = strip_tags($new_instance['title']); |
|
64 | + $category_limit = (int)$new_instance['category_limit']; |
|
65 | + $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | + $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | + $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | + return $instance; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Back-end popular post category widget settings form. |
|
73 | + * |
|
74 | + * @since 1.0.0 |
|
75 | + * @since 1.5.1 Declare function public. |
|
76 | + * @since 1.5.1 Added option to set default post type. |
|
77 | + * @since 1.6.9 Added option to show parent categories only. |
|
78 | + * |
|
79 | + * @param array $instance Previously saved values from database. |
|
80 | + */ |
|
81 | + public function form($instance) |
|
82 | + { |
|
83 | + //widgetform in backend |
|
84 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | + |
|
86 | + $title = strip_tags($instance['title']); |
|
87 | + $category_limit = (int)$instance['category_limit']; |
|
88 | + $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | + $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | + $parent_only = !empty($instance['parent_only']) ? true: false; |
|
91 | 91 | |
92 | - $post_type_options = geodir_get_posttypes('options'); |
|
93 | - ?> |
|
92 | + $post_type_options = geodir_get_posttypes('options'); |
|
93 | + ?> |
|
94 | 94 | <p> |
95 | 95 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
96 | 96 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/> |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
117 | 117 | </p> |
118 | 118 | <?php |
119 | - } |
|
119 | + } |
|
120 | 120 | } // class geodir_popular_post_category |
121 | 121 | |
122 | 122 | register_widget('geodir_popular_post_category'); |
@@ -130,40 +130,40 @@ discard block |
||
130 | 130 | class geodir_popular_postview extends WP_Widget |
131 | 131 | { |
132 | 132 | |
133 | - /** |
|
133 | + /** |
|
134 | 134 | * Register the popular posts widget. |
135 | 135 | * |
136 | 136 | * @since 1.0.0 |
137 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
137 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
138 | 138 | */ |
139 | - public function __construct() { |
|
140 | - $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | - parent::__construct( |
|
142 | - 'popular_post_view', // Base ID |
|
143 | - __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | - $widget_ops// Args |
|
145 | - ); |
|
146 | - } |
|
139 | + public function __construct() { |
|
140 | + $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | + parent::__construct( |
|
142 | + 'popular_post_view', // Base ID |
|
143 | + __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | + $widget_ops// Args |
|
145 | + ); |
|
146 | + } |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Front-end display content for popular posts widget. |
150 | 150 | * |
151 | 151 | * @since 1.0.0 |
152 | - * @since 1.5.1 Declare function public. |
|
152 | + * @since 1.5.1 Declare function public. |
|
153 | 153 | * |
154 | 154 | * @param array $args Widget arguments. |
155 | 155 | * @param array $instance Saved values from database. |
156 | 156 | */ |
157 | 157 | public function widget($args, $instance) |
158 | - { |
|
159 | - geodir_popular_postview_output($args, $instance); |
|
160 | - } |
|
158 | + { |
|
159 | + geodir_popular_postview_output($args, $instance); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Sanitize popular posts widget form values as they are saved. |
164 | 164 | * |
165 | 165 | * @since 1.0.0 |
166 | - * @since 1.5.1 Declare function public. |
|
166 | + * @since 1.5.1 Declare function public. |
|
167 | 167 | * |
168 | 168 | * @param array $new_instance Values just sent to be saved. |
169 | 169 | * @param array $old_instance Previously saved values from database. |
@@ -171,106 +171,106 @@ discard block |
||
171 | 171 | * @return array Updated safe values to be saved. |
172 | 172 | */ |
173 | 173 | public function update($new_instance, $old_instance) |
174 | - { |
|
175 | - //save the widget |
|
176 | - $instance = $old_instance; |
|
177 | - |
|
178 | - if ($new_instance['title'] == '') { |
|
179 | - $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | - //$instance['title'] = $title; |
|
181 | - } |
|
182 | - $instance['title'] = strip_tags($new_instance['title']); |
|
183 | - |
|
184 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | - //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | - $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | - $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | - $instance['title_tag'] = strip_tags($new_instance['title_tag']); |
|
193 | - $instance['character_count'] = $new_instance['character_count']; |
|
194 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
195 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | - else |
|
197 | - $instance['add_location_filter'] = '0'; |
|
198 | - |
|
199 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
200 | - $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
201 | - $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
202 | - $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
203 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
204 | - $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0; |
|
205 | - |
|
206 | - return $instance; |
|
207 | - } |
|
174 | + { |
|
175 | + //save the widget |
|
176 | + $instance = $old_instance; |
|
177 | + |
|
178 | + if ($new_instance['title'] == '') { |
|
179 | + $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | + //$instance['title'] = $title; |
|
181 | + } |
|
182 | + $instance['title'] = strip_tags($new_instance['title']); |
|
183 | + |
|
184 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | + //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | + $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | + $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | + $instance['title_tag'] = strip_tags($new_instance['title_tag']); |
|
193 | + $instance['character_count'] = $new_instance['character_count']; |
|
194 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
195 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | + else |
|
197 | + $instance['add_location_filter'] = '0'; |
|
198 | + |
|
199 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
200 | + $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
201 | + $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
202 | + $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
203 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
204 | + $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0; |
|
205 | + |
|
206 | + return $instance; |
|
207 | + } |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Back-end popular posts widget settings form. |
211 | 211 | * |
212 | 212 | * @since 1.0.0 |
213 | - * @since 1.5.1 Declare function public. |
|
213 | + * @since 1.5.1 Declare function public. |
|
214 | 214 | * |
215 | 215 | * @param array $instance Previously saved values from database. |
216 | 216 | */ |
217 | 217 | public function form($instance) |
218 | - { |
|
219 | - //widgetform in backend |
|
220 | - $instance = wp_parse_args((array)$instance, |
|
221 | - array('title' => '', |
|
222 | - 'post_type' => '', |
|
223 | - 'category' => array(), |
|
224 | - 'category_title' => '', |
|
225 | - 'list_sort' => '', |
|
226 | - 'title_tag' => 'h3', |
|
227 | - 'list_order' => '', |
|
228 | - 'post_number' => '5', |
|
229 | - 'layout' => 'gridview_onehalf', |
|
230 | - 'listing_width' => '', |
|
231 | - 'add_location_filter' => '1', |
|
232 | - 'character_count' => '20', |
|
233 | - 'show_featured_only' => '', |
|
234 | - 'show_special_only' => '', |
|
235 | - 'with_pics_only' => '', |
|
236 | - 'with_videos_only' => '', |
|
237 | - 'use_viewing_post_type' => '', |
|
238 | - 'hide_if_empty' => '' |
|
239 | - ) |
|
240 | - ); |
|
218 | + { |
|
219 | + //widgetform in backend |
|
220 | + $instance = wp_parse_args((array)$instance, |
|
221 | + array('title' => '', |
|
222 | + 'post_type' => '', |
|
223 | + 'category' => array(), |
|
224 | + 'category_title' => '', |
|
225 | + 'list_sort' => '', |
|
226 | + 'title_tag' => 'h3', |
|
227 | + 'list_order' => '', |
|
228 | + 'post_number' => '5', |
|
229 | + 'layout' => 'gridview_onehalf', |
|
230 | + 'listing_width' => '', |
|
231 | + 'add_location_filter' => '1', |
|
232 | + 'character_count' => '20', |
|
233 | + 'show_featured_only' => '', |
|
234 | + 'show_special_only' => '', |
|
235 | + 'with_pics_only' => '', |
|
236 | + 'with_videos_only' => '', |
|
237 | + 'use_viewing_post_type' => '', |
|
238 | + 'hide_if_empty' => '' |
|
239 | + ) |
|
240 | + ); |
|
241 | 241 | |
242 | - $title = strip_tags($instance['title']); |
|
242 | + $title = strip_tags($instance['title']); |
|
243 | 243 | |
244 | - $post_type = strip_tags($instance['post_type']); |
|
244 | + $post_type = strip_tags($instance['post_type']); |
|
245 | 245 | |
246 | - $category = $instance['category']; |
|
246 | + $category = $instance['category']; |
|
247 | 247 | |
248 | - $category_title = strip_tags($instance['category_title']); |
|
248 | + $category_title = strip_tags($instance['category_title']); |
|
249 | 249 | |
250 | - $list_sort = strip_tags($instance['list_sort']); |
|
250 | + $list_sort = strip_tags($instance['list_sort']); |
|
251 | 251 | |
252 | - $list_order = strip_tags($instance['list_order']); |
|
252 | + $list_order = strip_tags($instance['list_order']); |
|
253 | 253 | |
254 | - $title_tag = strip_tags($instance['title_tag']); |
|
254 | + $title_tag = strip_tags($instance['title_tag']); |
|
255 | 255 | |
256 | - $post_number = strip_tags($instance['post_number']); |
|
256 | + $post_number = strip_tags($instance['post_number']); |
|
257 | 257 | |
258 | - $layout = strip_tags($instance['layout']); |
|
258 | + $layout = strip_tags($instance['layout']); |
|
259 | 259 | |
260 | - $listing_width = strip_tags($instance['listing_width']); |
|
260 | + $listing_width = strip_tags($instance['listing_width']); |
|
261 | 261 | |
262 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
262 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
263 | 263 | |
264 | - $character_count = $instance['character_count']; |
|
264 | + $character_count = $instance['character_count']; |
|
265 | 265 | |
266 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
267 | - $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
268 | - $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
269 | - $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
270 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
271 | - $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false; |
|
266 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
267 | + $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
268 | + $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
269 | + $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
270 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
271 | + $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false; |
|
272 | 272 | |
273 | - ?> |
|
273 | + ?> |
|
274 | 274 | <p> |
275 | 275 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
276 | 276 | <small>(%posttype_singular_label% , |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | <?php foreach ($postypes as $postypes_obj) { ?> |
305 | 305 | |
306 | 306 | <option <?php if ($post_type == $postypes_obj) { |
307 | - echo 'selected="selected"'; |
|
308 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
309 | - echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
307 | + echo 'selected="selected"'; |
|
308 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
309 | + echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
310 | 310 | |
311 | 311 | <?php } ?> |
312 | 312 | |
@@ -321,30 +321,30 @@ discard block |
||
321 | 321 | |
322 | 322 | <?php |
323 | 323 | |
324 | - $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
324 | + $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
325 | 325 | |
326 | - $all_postypes = geodir_get_posttypes(); |
|
326 | + $all_postypes = geodir_get_posttypes(); |
|
327 | 327 | |
328 | - if (!in_array($post_type, $all_postypes)) |
|
329 | - $post_type = 'gd_place'; |
|
328 | + if (!in_array($post_type, $all_postypes)) |
|
329 | + $post_type = 'gd_place'; |
|
330 | 330 | |
331 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
332 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
331 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
332 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
333 | 333 | |
334 | - ?> |
|
334 | + ?> |
|
335 | 335 | |
336 | 336 | <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]" |
337 | 337 | onchange="geodir_popular_widget_cat_title(this)"> |
338 | 338 | |
339 | 339 | <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) { |
340 | - echo 'selected="selected"'; |
|
341 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
340 | + echo 'selected="selected"'; |
|
341 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
342 | 342 | <?php foreach ($categories as $category_obj) { |
343 | - $selected = ''; |
|
344 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
345 | - echo $selected = 'selected="selected"'; |
|
343 | + $selected = ''; |
|
344 | + if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
345 | + echo $selected = 'selected="selected"'; |
|
346 | 346 | |
347 | - ?> |
|
347 | + ?> |
|
348 | 348 | |
349 | 349 | <option <?php echo $selected; ?> |
350 | 350 | value="<?php echo $category_obj->term_id; ?>"><?php echo geodir_utf8_ucfirst($category_obj->name); ?></option> |
@@ -365,32 +365,32 @@ discard block |
||
365 | 365 | <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
366 | 366 | |
367 | 367 | <?php |
368 | - $list_sort_arr = array( |
|
369 | - "az" => __('A-Z', 'geodirectory'), |
|
370 | - "latest" => __('Latest', 'geodirectory'), |
|
371 | - "featured" => __('Featured', 'geodirectory'), |
|
372 | - "high_review" => __('Review', 'geodirectory'), |
|
373 | - "high_rating" => __('Rating', 'geodirectory'), |
|
374 | - "random" => __('Random', 'geodirectory'), |
|
375 | - ); |
|
376 | - |
|
377 | - /** |
|
378 | - * Filter the Popular post view widget sorting options. |
|
379 | - * |
|
380 | - * @since 1.6.22 |
|
381 | - * @param array $list_sort_arr The array of key value pairs of settings. |
|
382 | - * @param array $instance The array of widget settings. |
|
383 | - */ |
|
384 | - $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
385 | - ?> |
|
368 | + $list_sort_arr = array( |
|
369 | + "az" => __('A-Z', 'geodirectory'), |
|
370 | + "latest" => __('Latest', 'geodirectory'), |
|
371 | + "featured" => __('Featured', 'geodirectory'), |
|
372 | + "high_review" => __('Review', 'geodirectory'), |
|
373 | + "high_rating" => __('Rating', 'geodirectory'), |
|
374 | + "random" => __('Random', 'geodirectory'), |
|
375 | + ); |
|
376 | + |
|
377 | + /** |
|
378 | + * Filter the Popular post view widget sorting options. |
|
379 | + * |
|
380 | + * @since 1.6.22 |
|
381 | + * @param array $list_sort_arr The array of key value pairs of settings. |
|
382 | + * @param array $instance The array of widget settings. |
|
383 | + */ |
|
384 | + $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
385 | + ?> |
|
386 | 386 | |
387 | 387 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
388 | 388 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
389 | 389 | <?php |
390 | - foreach($list_sort_arr as $sort_val => $sort_title){ |
|
391 | - echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
392 | - } |
|
393 | - ?> |
|
390 | + foreach($list_sort_arr as $sort_val => $sort_title){ |
|
391 | + echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
392 | + } |
|
393 | + ?> |
|
394 | 394 | </select> |
395 | 395 | </label> |
396 | 396 | </p> |
@@ -399,28 +399,28 @@ discard block |
||
399 | 399 | <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory');?> |
400 | 400 | |
401 | 401 | <?php |
402 | - $title_tag_arr = array( |
|
403 | - "h3" => __('h3 (default)', 'geodirectory'), |
|
404 | - "h2" => __('h2 (if main content of page)', 'geodirectory'), |
|
405 | - ); |
|
406 | - |
|
407 | - /** |
|
408 | - * Filter the Popular post view widget title tag. |
|
409 | - * |
|
410 | - * @since 1.6.26 |
|
411 | - * @param array $title_tag_arr The array of key value pairs of settings. |
|
412 | - * @param array $instance The array of widget settings. |
|
413 | - */ |
|
414 | - $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance); |
|
415 | - ?> |
|
402 | + $title_tag_arr = array( |
|
403 | + "h3" => __('h3 (default)', 'geodirectory'), |
|
404 | + "h2" => __('h2 (if main content of page)', 'geodirectory'), |
|
405 | + ); |
|
406 | + |
|
407 | + /** |
|
408 | + * Filter the Popular post view widget title tag. |
|
409 | + * |
|
410 | + * @since 1.6.26 |
|
411 | + * @param array $title_tag_arr The array of key value pairs of settings. |
|
412 | + * @param array $instance The array of widget settings. |
|
413 | + */ |
|
414 | + $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance); |
|
415 | + ?> |
|
416 | 416 | |
417 | 417 | <select class="widefat" id="<?php echo $this->get_field_id('title_tag'); ?>" |
418 | 418 | name="<?php echo $this->get_field_name('title_tag'); ?>"> |
419 | 419 | <?php |
420 | - foreach($title_tag_arr as $title_val => $title_title){ |
|
421 | - echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>"; |
|
422 | - } |
|
423 | - ?> |
|
420 | + foreach($title_tag_arr as $title_val => $title_title){ |
|
421 | + echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>"; |
|
422 | + } |
|
423 | + ?> |
|
424 | 424 | </select> |
425 | 425 | </label> |
426 | 426 | </p> |
@@ -442,24 +442,24 @@ discard block |
||
442 | 442 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
443 | 443 | name="<?php echo $this->get_field_name('layout'); ?>"> |
444 | 444 | <option <?php if ($layout == 'gridview_onehalf') { |
445 | - echo 'selected="selected"'; |
|
446 | - } ?> |
|
445 | + echo 'selected="selected"'; |
|
446 | + } ?> |
|
447 | 447 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
448 | 448 | <option <?php if ($layout == 'gridview_onethird') { |
449 | - echo 'selected="selected"'; |
|
450 | - } ?> |
|
449 | + echo 'selected="selected"'; |
|
450 | + } ?> |
|
451 | 451 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
452 | 452 | <option <?php if ($layout == 'gridview_onefourth') { |
453 | - echo 'selected="selected"'; |
|
454 | - } ?> |
|
453 | + echo 'selected="selected"'; |
|
454 | + } ?> |
|
455 | 455 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
456 | 456 | <option <?php if ($layout == 'gridview_onefifth') { |
457 | - echo 'selected="selected"'; |
|
458 | - } ?> |
|
457 | + echo 'selected="selected"'; |
|
458 | + } ?> |
|
459 | 459 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
460 | 460 | <option <?php if ($layout == 'list') { |
461 | - echo 'selected="selected"'; |
|
462 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
461 | + echo 'selected="selected"'; |
|
462 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
463 | 463 | |
464 | 464 | </select> |
465 | 465 | </label> |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
530 | 530 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
531 | 531 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
532 | - echo 'checked="checked"'; |
|
533 | - } ?> value="1"/> |
|
532 | + echo 'checked="checked"'; |
|
533 | + } ?> value="1"/> |
|
534 | 534 | </label> |
535 | 535 | </p> |
536 | 536 | <p> |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | </script> |
579 | 579 | |
580 | 580 | <?php |
581 | - } |
|
581 | + } |
|
582 | 582 | } // class geodir_popular_postview |
583 | 583 | |
584 | 584 | register_widget('geodir_popular_postview'); |
585 | 585 | \ No newline at end of file |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //save the widget |
62 | 62 | $instance = $old_instance; |
63 | 63 | $instance['title'] = strip_tags($new_instance['title']); |
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
64 | + $category_limit = (int) $new_instance['category_limit']; |
|
65 | 65 | $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
66 | 66 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
67 | 67 | $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | public function form($instance) |
82 | 82 | { |
83 | 83 | //widgetform in backend |
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
84 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | 85 | |
86 | 86 | $title = strip_tags($instance['title']); |
87 | - $category_limit = (int)$instance['category_limit']; |
|
87 | + $category_limit = (int) $instance['category_limit']; |
|
88 | 88 | $category_limit = $category_limit > 0 ? $category_limit : 15; |
89 | 89 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
90 | 90 | $parent_only = !empty($instance['parent_only']) ? true: false; |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | </label> |
98 | 98 | </p> |
99 | 99 | <p> |
100 | - <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?> |
|
100 | + <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?> |
|
101 | 101 | <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>"> |
102 | 102 | <?php foreach ($post_type_options as $name => $title) { ?> |
103 | - <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option> |
|
103 | + <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option> |
|
104 | 104 | <?php } ?> |
105 | 105 | </select> |
106 | 106 | </label> |
107 | 107 | </p> |
108 | 108 | <p> |
109 | 109 | <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?> |
110 | - <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/> |
|
110 | + <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/> |
|
111 | 111 | <p class="description" style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p> |
112 | 112 | </label> |
113 | 113 | </p> |
114 | 114 | <p> |
115 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" /> |
|
116 | - <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
|
115 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" /> |
|
116 | + <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label> |
|
117 | 117 | </p> |
118 | 118 | <?php |
119 | 119 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function form($instance) |
218 | 218 | { |
219 | 219 | //widgetform in backend |
220 | - $instance = wp_parse_args((array)$instance, |
|
220 | + $instance = wp_parse_args((array) $instance, |
|
221 | 221 | array('title' => '', |
222 | 222 | 'post_type' => '', |
223 | 223 | 'category' => array(), |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | |
273 | 273 | ?> |
274 | 274 | <p> |
275 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
275 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
276 | 276 | <small>(%posttype_singular_label% , |
277 | - %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>) |
|
277 | + %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>) |
|
278 | 278 | </small> |
279 | 279 | |
280 | 280 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | <p> |
287 | 287 | <label |
288 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
288 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
289 | 289 | |
290 | 290 | <?php $postypes = geodir_get_posttypes(); |
291 | 291 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | <p id="post_type_cats"> |
319 | 319 | <label |
320 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
|
320 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?> |
|
321 | 321 | |
322 | 322 | <?php |
323 | 323 | |
@@ -356,13 +356,13 @@ discard block |
||
356 | 356 | |
357 | 357 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
358 | 358 | id="<?php echo $this->get_field_id('category_title'); ?>" |
359 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
359 | + value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/> |
|
360 | 360 | |
361 | 361 | </label> |
362 | 362 | </p> |
363 | 363 | |
364 | 364 | <p> |
365 | - <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
365 | + <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
366 | 366 | |
367 | 367 | <?php |
368 | 368 | $list_sort_arr = array( |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | * @param array $list_sort_arr The array of key value pairs of settings. |
382 | 382 | * @param array $instance The array of widget settings. |
383 | 383 | */ |
384 | - $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
384 | + $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort', $list_sort_arr, $instance); |
|
385 | 385 | ?> |
386 | 386 | |
387 | 387 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
388 | 388 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
389 | 389 | <?php |
390 | - foreach($list_sort_arr as $sort_val => $sort_title){ |
|
391 | - echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
390 | + foreach ($list_sort_arr as $sort_val => $sort_title) { |
|
391 | + echo "<option value='$sort_val' ".selected($list_sort, $sort_val)." >$sort_title</option>"; |
|
392 | 392 | } |
393 | 393 | ?> |
394 | 394 | </select> |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | </p> |
397 | 397 | |
398 | 398 | <p> |
399 | - <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory');?> |
|
399 | + <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory'); ?> |
|
400 | 400 | |
401 | 401 | <?php |
402 | 402 | $title_tag_arr = array( |
@@ -411,14 +411,14 @@ discard block |
||
411 | 411 | * @param array $title_tag_arr The array of key value pairs of settings. |
412 | 412 | * @param array $instance The array of widget settings. |
413 | 413 | */ |
414 | - $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance); |
|
414 | + $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag', $title_tag_arr, $instance); |
|
415 | 415 | ?> |
416 | 416 | |
417 | 417 | <select class="widefat" id="<?php echo $this->get_field_id('title_tag'); ?>" |
418 | 418 | name="<?php echo $this->get_field_name('title_tag'); ?>"> |
419 | 419 | <?php |
420 | - foreach($title_tag_arr as $title_val => $title_title){ |
|
421 | - echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>"; |
|
420 | + foreach ($title_tag_arr as $title_val => $title_title) { |
|
421 | + echo "<option value='$title_val' ".selected($title_tag, $title_val)." >$title_title</option>"; |
|
422 | 422 | } |
423 | 423 | ?> |
424 | 424 | </select> |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | <p> |
429 | 429 | |
430 | 430 | <label |
431 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
431 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
432 | 432 | |
433 | 433 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
434 | 434 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | |
439 | 439 | <p> |
440 | 440 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
441 | - <?php _e('Layout:', 'geodirectory');?> |
|
441 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
442 | 442 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
443 | 443 | name="<?php echo $this->get_field_name('layout'); ?>"> |
444 | 444 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | |
468 | 468 | <p> |
469 | 469 | <label |
470 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
470 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
471 | 471 | |
472 | 472 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
473 | 473 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | |
478 | 478 | <p> |
479 | 479 | <label |
480 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
480 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
481 | 481 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
482 | 482 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
483 | 483 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -486,41 +486,41 @@ discard block |
||
486 | 486 | |
487 | 487 | <p> |
488 | 488 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
489 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
489 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
490 | 490 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
491 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
491 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
492 | 492 | value="1"/> |
493 | 493 | </label> |
494 | 494 | </p> |
495 | 495 | <p> |
496 | 496 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
497 | - <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
|
497 | + <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox" |
|
498 | 498 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
499 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
499 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?> |
|
500 | 500 | value="1"/> |
501 | 501 | </label> |
502 | 502 | </p> |
503 | 503 | <p> |
504 | 504 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
505 | - <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
|
505 | + <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox" |
|
506 | 506 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
507 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
507 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?> |
|
508 | 508 | value="1"/> |
509 | 509 | </label> |
510 | 510 | </p> |
511 | 511 | <p> |
512 | 512 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
513 | - <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
|
513 | + <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox" |
|
514 | 514 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
515 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
515 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?> |
|
516 | 516 | value="1"/> |
517 | 517 | </label> |
518 | 518 | </p> |
519 | 519 | <p> |
520 | 520 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
521 | - <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
|
521 | + <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox" |
|
522 | 522 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
523 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
523 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?> |
|
524 | 524 | value="1"/> |
525 | 525 | </label> |
526 | 526 | </p> |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | |
571 | 571 | } |
572 | 572 | |
573 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?> |
|
573 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> |
|
574 | 574 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val(); |
575 | 575 | |
576 | 576 | <?php } ?> |
@@ -191,10 +191,11 @@ discard block |
||
191 | 191 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
192 | 192 | $instance['title_tag'] = strip_tags($new_instance['title_tag']); |
193 | 193 | $instance['character_count'] = $new_instance['character_count']; |
194 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
195 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | - else |
|
197 | - $instance['add_location_filter'] = '0'; |
|
194 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
195 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | + } else { |
|
197 | + $instance['add_location_filter'] = '0'; |
|
198 | + } |
|
198 | 199 | |
199 | 200 | $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
200 | 201 | $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
@@ -325,8 +326,9 @@ discard block |
||
325 | 326 | |
326 | 327 | $all_postypes = geodir_get_posttypes(); |
327 | 328 | |
328 | - if (!in_array($post_type, $all_postypes)) |
|
329 | - $post_type = 'gd_place'; |
|
329 | + if (!in_array($post_type, $all_postypes)) { |
|
330 | + $post_type = 'gd_place'; |
|
331 | + } |
|
330 | 332 | |
331 | 333 | $category_taxonomy = geodir_get_taxonomies($post_type); |
332 | 334 | $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
@@ -341,8 +343,9 @@ discard block |
||
341 | 343 | } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
342 | 344 | <?php foreach ($categories as $category_obj) { |
343 | 345 | $selected = ''; |
344 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
345 | - echo $selected = 'selected="selected"'; |
|
346 | + if (is_array($category) && in_array($category_obj->term_id, $category)) { |
|
347 | + echo $selected = 'selected="selected"'; |
|
348 | + } |
|
346 | 349 | |
347 | 350 | ?> |
348 | 351 | |
@@ -356,7 +359,12 @@ discard block |
||
356 | 359 | |
357 | 360 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
358 | 361 | id="<?php echo $this->get_field_id('category_title'); ?>" |
359 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
362 | + value="<?php if ($category_title != '') { |
|
363 | + echo $category_title; |
|
364 | +} else { |
|
365 | + echo __('All', 'geodirectory'); |
|
366 | +} |
|
367 | +?>"/> |
|
360 | 368 | |
361 | 369 | </label> |
362 | 370 | </p> |
@@ -488,7 +496,10 @@ discard block |
||
488 | 496 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
489 | 497 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
490 | 498 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
491 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
499 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
500 | + echo 'checked="checked"'; |
|
501 | +} |
|
502 | +?> |
|
492 | 503 | value="1"/> |
493 | 504 | </label> |
494 | 505 | </p> |
@@ -496,7 +507,10 @@ discard block |
||
496 | 507 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
497 | 508 | <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
498 | 509 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
499 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
510 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
511 | + echo 'checked="checked"'; |
|
512 | +} |
|
513 | +?> |
|
500 | 514 | value="1"/> |
501 | 515 | </label> |
502 | 516 | </p> |
@@ -504,7 +518,10 @@ discard block |
||
504 | 518 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
505 | 519 | <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
506 | 520 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
507 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
521 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) { |
|
522 | + echo 'checked="checked"'; |
|
523 | +} |
|
524 | +?> |
|
508 | 525 | value="1"/> |
509 | 526 | </label> |
510 | 527 | </p> |
@@ -512,7 +529,10 @@ discard block |
||
512 | 529 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
513 | 530 | <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
514 | 531 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
515 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
532 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) { |
|
533 | + echo 'checked="checked"'; |
|
534 | +} |
|
535 | +?> |
|
516 | 536 | value="1"/> |
517 | 537 | </label> |
518 | 538 | </p> |
@@ -520,7 +540,10 @@ discard block |
||
520 | 540 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
521 | 541 | <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
522 | 542 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
523 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
543 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) { |
|
544 | + echo 'checked="checked"'; |
|
545 | +} |
|
546 | +?> |
|
524 | 547 | value="1"/> |
525 | 548 | </label> |
526 | 549 | </p> |