@@ -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,153 +1062,153 @@ 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 | Send To Friend 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' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) { |
|
| 1125 | - global $send_to_friend; |
|
| 1126 | - $send_to_friend = true; |
|
| 1127 | - $b_send_inquiry = ''; |
|
| 1128 | - $b_sendtofriend = ''; |
|
| 1129 | - |
|
| 1130 | - $html = ''; |
|
| 1131 | - if (!$preview) { |
|
| 1132 | - $b_send_inquiry = 'b_send_inquiry'; |
|
| 1133 | - $b_sendtofriend = 'b_sendtofriend'; |
|
| 1134 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 1135 | - } |
|
| 1136 | - |
|
| 1137 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1138 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1139 | - $field_icon_af = ''; |
|
| 1140 | - } elseif ($field_icon == '') { |
|
| 1141 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1142 | - } else { |
|
| 1143 | - $field_icon_af = $field_icon; |
|
| 1144 | - $field_icon = ''; |
|
| 1145 | - } |
|
| 1146 | - |
|
| 1147 | - $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1148 | - $seperator = ''; |
|
| 1149 | - if ($post->{$cf['htmlvar_name']}) { |
|
| 1150 | - $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1151 | - $seperator = ' | '; |
|
| 1152 | - } |
|
| 1153 | - |
|
| 1154 | - if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
|
| 1155 | - $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1156 | - } |
|
| 1157 | - |
|
| 1158 | - $html .= '</span></div>'; |
|
| 1159 | - |
|
| 1160 | - |
|
| 1161 | - if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
| 1162 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1163 | - } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
|
| 1164 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1165 | - } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
| 1166 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1167 | - } |
|
| 1168 | - |
|
| 1169 | - /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
| 1170 | - |
|
| 1171 | - } else { |
|
| 1172 | - |
|
| 1173 | - if ($post->{$cf['htmlvar_name']}) { |
|
| 1174 | - |
|
| 1175 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1176 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1177 | - $field_icon_af = ''; |
|
| 1178 | - } elseif ($field_icon == '') { |
|
| 1179 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1180 | - } else { |
|
| 1181 | - $field_icon_af = $field_icon; |
|
| 1182 | - $field_icon = ''; |
|
| 1183 | - } |
|
| 1184 | - |
|
| 1185 | - |
|
| 1186 | - $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; |
|
| 1187 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1188 | - $html .= '</span><span class="geodir-email-address-output">'; |
|
| 1189 | - $email = $post->{$cf['htmlvar_name']} ; |
|
| 1190 | - if($e_split = explode('@',$email)){ |
|
| 1191 | - /** |
|
| 1192 | - * Filter email custom field name output. |
|
| 1193 | - * |
|
| 1194 | - * @since 1.5.3 |
|
| 1195 | - * |
|
| 1196 | - * @param string $email The email string being output. |
|
| 1197 | - * @param array $cf Custom field variables array. |
|
| 1198 | - */ |
|
| 1199 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1200 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1201 | - }else{ |
|
| 1202 | - $html .= $email; |
|
| 1203 | - } |
|
| 1204 | - $html .= '</span></div>'; |
|
| 1205 | - } |
|
| 1206 | - |
|
| 1207 | - } |
|
| 1208 | - |
|
| 1209 | - } |
|
| 1210 | - |
|
| 1211 | - 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 | Send To Friend 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' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) { |
|
| 1125 | + global $send_to_friend; |
|
| 1126 | + $send_to_friend = true; |
|
| 1127 | + $b_send_inquiry = ''; |
|
| 1128 | + $b_sendtofriend = ''; |
|
| 1129 | + |
|
| 1130 | + $html = ''; |
|
| 1131 | + if (!$preview) { |
|
| 1132 | + $b_send_inquiry = 'b_send_inquiry'; |
|
| 1133 | + $b_sendtofriend = 'b_sendtofriend'; |
|
| 1134 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 1135 | + } |
|
| 1136 | + |
|
| 1137 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1138 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1139 | + $field_icon_af = ''; |
|
| 1140 | + } elseif ($field_icon == '') { |
|
| 1141 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1142 | + } else { |
|
| 1143 | + $field_icon_af = $field_icon; |
|
| 1144 | + $field_icon = ''; |
|
| 1145 | + } |
|
| 1146 | + |
|
| 1147 | + $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1148 | + $seperator = ''; |
|
| 1149 | + if ($post->{$cf['htmlvar_name']}) { |
|
| 1150 | + $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1151 | + $seperator = ' | '; |
|
| 1152 | + } |
|
| 1153 | + |
|
| 1154 | + if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
|
| 1155 | + $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1156 | + } |
|
| 1157 | + |
|
| 1158 | + $html .= '</span></div>'; |
|
| 1159 | + |
|
| 1160 | + |
|
| 1161 | + if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
| 1162 | + $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1163 | + } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
|
| 1164 | + $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1165 | + } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
| 1166 | + $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1167 | + } |
|
| 1168 | + |
|
| 1169 | + /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
| 1170 | + |
|
| 1171 | + } else { |
|
| 1172 | + |
|
| 1173 | + if ($post->{$cf['htmlvar_name']}) { |
|
| 1174 | + |
|
| 1175 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1176 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1177 | + $field_icon_af = ''; |
|
| 1178 | + } elseif ($field_icon == '') { |
|
| 1179 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1180 | + } else { |
|
| 1181 | + $field_icon_af = $field_icon; |
|
| 1182 | + $field_icon = ''; |
|
| 1183 | + } |
|
| 1184 | + |
|
| 1185 | + |
|
| 1186 | + $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; |
|
| 1187 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1188 | + $html .= '</span><span class="geodir-email-address-output">'; |
|
| 1189 | + $email = $post->{$cf['htmlvar_name']} ; |
|
| 1190 | + if($e_split = explode('@',$email)){ |
|
| 1191 | + /** |
|
| 1192 | + * Filter email custom field name output. |
|
| 1193 | + * |
|
| 1194 | + * @since 1.5.3 |
|
| 1195 | + * |
|
| 1196 | + * @param string $email The email string being output. |
|
| 1197 | + * @param array $cf Custom field variables array. |
|
| 1198 | + */ |
|
| 1199 | + $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1200 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1201 | + }else{ |
|
| 1202 | + $html .= $email; |
|
| 1203 | + } |
|
| 1204 | + $html .= '</span></div>'; |
|
| 1205 | + } |
|
| 1206 | + |
|
| 1207 | + } |
|
| 1208 | + |
|
| 1209 | + } |
|
| 1210 | + |
|
| 1211 | + return $html; |
|
| 1212 | 1212 | } |
| 1213 | 1213 | add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3); |
| 1214 | 1214 | |
@@ -1225,130 +1225,130 @@ discard block |
||
| 1225 | 1225 | */ |
| 1226 | 1226 | function geodir_cf_file($html,$location,$cf,$p=''){ |
| 1227 | 1227 | |
| 1228 | - // check we have the post value |
|
| 1229 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1230 | - else{ global $post;} |
|
| 1231 | - |
|
| 1232 | - if(!is_array($cf) && $cf!=''){ |
|
| 1233 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1234 | - if(!$cf){return NULL;} |
|
| 1235 | - } |
|
| 1236 | - |
|
| 1237 | - $html_var = $cf['htmlvar_name']; |
|
| 1238 | - |
|
| 1239 | - // Check if there is a location specific filter. |
|
| 1240 | - if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1241 | - /** |
|
| 1242 | - * Filter the file html by location. |
|
| 1243 | - * |
|
| 1244 | - * @param string $html The html to filter. |
|
| 1245 | - * @param array $cf The custom field array. |
|
| 1246 | - * @since 1.6.6 |
|
| 1247 | - */ |
|
| 1248 | - $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1249 | - } |
|
| 1250 | - |
|
| 1251 | - // Check if there is a custom field specific filter. |
|
| 1252 | - if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1253 | - /** |
|
| 1254 | - * Filter the file html by individual custom field. |
|
| 1255 | - * |
|
| 1256 | - * @param string $html The html to filter. |
|
| 1257 | - * @param string $location The location to output the html. |
|
| 1258 | - * @param array $cf The custom field array. |
|
| 1259 | - * @since 1.6.6 |
|
| 1260 | - */ |
|
| 1261 | - $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1262 | - } |
|
| 1263 | - |
|
| 1264 | - // Check if there is a custom field key specific filter. |
|
| 1265 | - if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1266 | - /** |
|
| 1267 | - * Filter the file html by field type key. |
|
| 1268 | - * |
|
| 1269 | - * @param string $html The html to filter. |
|
| 1270 | - * @param string $location The location to output the html. |
|
| 1271 | - * @param array $cf The custom field array. |
|
| 1272 | - * @since 1.6.6 |
|
| 1273 | - */ |
|
| 1274 | - $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1275 | - } |
|
| 1276 | - |
|
| 1277 | - // If not html then we run the standard output. |
|
| 1278 | - if(empty($html)){ |
|
| 1279 | - |
|
| 1280 | - if (!empty($post->{$cf['htmlvar_name']})): |
|
| 1281 | - |
|
| 1282 | - $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
| 1283 | - if (!empty($files)): |
|
| 1284 | - |
|
| 1285 | - $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
| 1286 | - $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'] : ''; |
|
| 1287 | - |
|
| 1288 | - $file_paths = ''; |
|
| 1289 | - foreach ($files as $file) { |
|
| 1290 | - if (!empty($file)) { |
|
| 1291 | - |
|
| 1292 | - // $filetype = wp_check_filetype($file); |
|
| 1293 | - |
|
| 1294 | - $image_name_arr = explode('/', $file); |
|
| 1295 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1296 | - $filename = end($image_name_arr); |
|
| 1297 | - $img_name_arr = explode('.', $filename); |
|
| 1298 | - |
|
| 1299 | - $arr_file_type = wp_check_filetype($filename); |
|
| 1300 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
| 1301 | - continue; |
|
| 1302 | - } |
|
| 1303 | - |
|
| 1304 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 1305 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1306 | - |
|
| 1307 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
| 1308 | - continue; // Invalid file type. |
|
| 1309 | - } |
|
| 1310 | - |
|
| 1311 | - //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
| 1312 | - $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
| 1313 | - |
|
| 1314 | - // If the uploaded file is image |
|
| 1315 | - if (in_array($uploaded_file_type, $image_file_types)) { |
|
| 1316 | - $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 1317 | - $file_paths .= '<a href="'.$file.'">'; |
|
| 1318 | - $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
| 1319 | - $file_paths .= '</a>'; |
|
| 1320 | - //$file_paths .= '<img src="'.$file.'" />'; |
|
| 1321 | - $file_paths .= '</div>'; |
|
| 1322 | - } else { |
|
| 1323 | - $ext_path = '_' . $html_var . '_'; |
|
| 1324 | - $filename = explode($ext_path, $filename); |
|
| 1325 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1326 | - } |
|
| 1327 | - } |
|
| 1328 | - } |
|
| 1329 | - |
|
| 1330 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1331 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1332 | - $field_icon_af = ''; |
|
| 1333 | - } elseif ($field_icon == '') { |
|
| 1334 | - $field_icon_af = ''; |
|
| 1335 | - } else { |
|
| 1336 | - $field_icon_af = $field_icon; |
|
| 1337 | - $field_icon = ''; |
|
| 1338 | - } |
|
| 1339 | - |
|
| 1340 | - $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 .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 1342 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1343 | - $html .= '</span>'; |
|
| 1344 | - $html .= $file_paths . '</div></div>'; |
|
| 1345 | - |
|
| 1346 | - endif; |
|
| 1347 | - endif; |
|
| 1348 | - |
|
| 1349 | - } |
|
| 1350 | - |
|
| 1351 | - return $html; |
|
| 1228 | + // check we have the post value |
|
| 1229 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1230 | + else{ global $post;} |
|
| 1231 | + |
|
| 1232 | + if(!is_array($cf) && $cf!=''){ |
|
| 1233 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1234 | + if(!$cf){return NULL;} |
|
| 1235 | + } |
|
| 1236 | + |
|
| 1237 | + $html_var = $cf['htmlvar_name']; |
|
| 1238 | + |
|
| 1239 | + // Check if there is a location specific filter. |
|
| 1240 | + if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1241 | + /** |
|
| 1242 | + * Filter the file html by location. |
|
| 1243 | + * |
|
| 1244 | + * @param string $html The html to filter. |
|
| 1245 | + * @param array $cf The custom field array. |
|
| 1246 | + * @since 1.6.6 |
|
| 1247 | + */ |
|
| 1248 | + $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1249 | + } |
|
| 1250 | + |
|
| 1251 | + // Check if there is a custom field specific filter. |
|
| 1252 | + if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1253 | + /** |
|
| 1254 | + * Filter the file html by individual custom field. |
|
| 1255 | + * |
|
| 1256 | + * @param string $html The html to filter. |
|
| 1257 | + * @param string $location The location to output the html. |
|
| 1258 | + * @param array $cf The custom field array. |
|
| 1259 | + * @since 1.6.6 |
|
| 1260 | + */ |
|
| 1261 | + $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1262 | + } |
|
| 1263 | + |
|
| 1264 | + // Check if there is a custom field key specific filter. |
|
| 1265 | + if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1266 | + /** |
|
| 1267 | + * Filter the file html by field type key. |
|
| 1268 | + * |
|
| 1269 | + * @param string $html The html to filter. |
|
| 1270 | + * @param string $location The location to output the html. |
|
| 1271 | + * @param array $cf The custom field array. |
|
| 1272 | + * @since 1.6.6 |
|
| 1273 | + */ |
|
| 1274 | + $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1275 | + } |
|
| 1276 | + |
|
| 1277 | + // If not html then we run the standard output. |
|
| 1278 | + if(empty($html)){ |
|
| 1279 | + |
|
| 1280 | + if (!empty($post->{$cf['htmlvar_name']})): |
|
| 1281 | + |
|
| 1282 | + $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
| 1283 | + if (!empty($files)): |
|
| 1284 | + |
|
| 1285 | + $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
| 1286 | + $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'] : ''; |
|
| 1287 | + |
|
| 1288 | + $file_paths = ''; |
|
| 1289 | + foreach ($files as $file) { |
|
| 1290 | + if (!empty($file)) { |
|
| 1291 | + |
|
| 1292 | + // $filetype = wp_check_filetype($file); |
|
| 1293 | + |
|
| 1294 | + $image_name_arr = explode('/', $file); |
|
| 1295 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1296 | + $filename = end($image_name_arr); |
|
| 1297 | + $img_name_arr = explode('.', $filename); |
|
| 1298 | + |
|
| 1299 | + $arr_file_type = wp_check_filetype($filename); |
|
| 1300 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
| 1301 | + continue; |
|
| 1302 | + } |
|
| 1303 | + |
|
| 1304 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 1305 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1306 | + |
|
| 1307 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
| 1308 | + continue; // Invalid file type. |
|
| 1309 | + } |
|
| 1310 | + |
|
| 1311 | + //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
| 1312 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
| 1313 | + |
|
| 1314 | + // If the uploaded file is image |
|
| 1315 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
| 1316 | + $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 1317 | + $file_paths .= '<a href="'.$file.'">'; |
|
| 1318 | + $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
| 1319 | + $file_paths .= '</a>'; |
|
| 1320 | + //$file_paths .= '<img src="'.$file.'" />'; |
|
| 1321 | + $file_paths .= '</div>'; |
|
| 1322 | + } else { |
|
| 1323 | + $ext_path = '_' . $html_var . '_'; |
|
| 1324 | + $filename = explode($ext_path, $filename); |
|
| 1325 | + $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1326 | + } |
|
| 1327 | + } |
|
| 1328 | + } |
|
| 1329 | + |
|
| 1330 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1331 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1332 | + $field_icon_af = ''; |
|
| 1333 | + } elseif ($field_icon == '') { |
|
| 1334 | + $field_icon_af = ''; |
|
| 1335 | + } else { |
|
| 1336 | + $field_icon_af = $field_icon; |
|
| 1337 | + $field_icon = ''; |
|
| 1338 | + } |
|
| 1339 | + |
|
| 1340 | + $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 .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 1342 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1343 | + $html .= '</span>'; |
|
| 1344 | + $html .= $file_paths . '</div></div>'; |
|
| 1345 | + |
|
| 1346 | + endif; |
|
| 1347 | + endif; |
|
| 1348 | + |
|
| 1349 | + } |
|
| 1350 | + |
|
| 1351 | + return $html; |
|
| 1352 | 1352 | } |
| 1353 | 1353 | add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3); |
| 1354 | 1354 | |
@@ -1366,80 +1366,80 @@ discard block |
||
| 1366 | 1366 | */ |
| 1367 | 1367 | function geodir_cf_textarea($html,$location,$cf,$p=''){ |
| 1368 | 1368 | |
| 1369 | - // check we have the post value |
|
| 1370 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1371 | - else{ global $post;} |
|
| 1372 | - |
|
| 1373 | - if(!is_array($cf) && $cf!=''){ |
|
| 1374 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1375 | - if(!$cf){return NULL;} |
|
| 1376 | - } |
|
| 1377 | - |
|
| 1378 | - $html_var = $cf['htmlvar_name']; |
|
| 1379 | - |
|
| 1380 | - // Check if there is a location specific filter. |
|
| 1381 | - if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1382 | - /** |
|
| 1383 | - * Filter the textarea html by location. |
|
| 1384 | - * |
|
| 1385 | - * @param string $html The html to filter. |
|
| 1386 | - * @param array $cf The custom field array. |
|
| 1387 | - * @since 1.6.6 |
|
| 1388 | - */ |
|
| 1389 | - $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1390 | - } |
|
| 1391 | - |
|
| 1392 | - // Check if there is a custom field specific filter. |
|
| 1393 | - if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1394 | - /** |
|
| 1395 | - * Filter the textarea html by individual custom field. |
|
| 1396 | - * |
|
| 1397 | - * @param string $html The html to filter. |
|
| 1398 | - * @param string $location The location to output the html. |
|
| 1399 | - * @param array $cf The custom field array. |
|
| 1400 | - * @since 1.6.6 |
|
| 1401 | - */ |
|
| 1402 | - $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1403 | - } |
|
| 1404 | - |
|
| 1405 | - // Check if there is a custom field key specific filter. |
|
| 1406 | - if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1407 | - /** |
|
| 1408 | - * Filter the textarea html by field type key. |
|
| 1409 | - * |
|
| 1410 | - * @param string $html The html to filter. |
|
| 1411 | - * @param string $location The location to output the html. |
|
| 1412 | - * @param array $cf The custom field array. |
|
| 1413 | - * @since 1.6.6 |
|
| 1414 | - */ |
|
| 1415 | - $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1416 | - } |
|
| 1417 | - |
|
| 1418 | - // If not html then we run the standard output. |
|
| 1419 | - if(empty($html)){ |
|
| 1420 | - |
|
| 1421 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1422 | - |
|
| 1423 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1424 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1425 | - $field_icon_af = ''; |
|
| 1426 | - } elseif ($field_icon == '') { |
|
| 1427 | - $field_icon_af = ''; |
|
| 1428 | - } else { |
|
| 1429 | - $field_icon_af = $field_icon; |
|
| 1430 | - $field_icon = ''; |
|
| 1431 | - } |
|
| 1432 | - |
|
| 1433 | - |
|
| 1434 | - $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; |
|
| 1435 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1436 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1437 | - |
|
| 1438 | - } |
|
| 1439 | - |
|
| 1440 | - } |
|
| 1441 | - |
|
| 1442 | - return $html; |
|
| 1369 | + // check we have the post value |
|
| 1370 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1371 | + else{ global $post;} |
|
| 1372 | + |
|
| 1373 | + if(!is_array($cf) && $cf!=''){ |
|
| 1374 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1375 | + if(!$cf){return NULL;} |
|
| 1376 | + } |
|
| 1377 | + |
|
| 1378 | + $html_var = $cf['htmlvar_name']; |
|
| 1379 | + |
|
| 1380 | + // Check if there is a location specific filter. |
|
| 1381 | + if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1382 | + /** |
|
| 1383 | + * Filter the textarea html by location. |
|
| 1384 | + * |
|
| 1385 | + * @param string $html The html to filter. |
|
| 1386 | + * @param array $cf The custom field array. |
|
| 1387 | + * @since 1.6.6 |
|
| 1388 | + */ |
|
| 1389 | + $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1390 | + } |
|
| 1391 | + |
|
| 1392 | + // Check if there is a custom field specific filter. |
|
| 1393 | + if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1394 | + /** |
|
| 1395 | + * Filter the textarea html by individual custom field. |
|
| 1396 | + * |
|
| 1397 | + * @param string $html The html to filter. |
|
| 1398 | + * @param string $location The location to output the html. |
|
| 1399 | + * @param array $cf The custom field array. |
|
| 1400 | + * @since 1.6.6 |
|
| 1401 | + */ |
|
| 1402 | + $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1403 | + } |
|
| 1404 | + |
|
| 1405 | + // Check if there is a custom field key specific filter. |
|
| 1406 | + if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1407 | + /** |
|
| 1408 | + * Filter the textarea html by field type key. |
|
| 1409 | + * |
|
| 1410 | + * @param string $html The html to filter. |
|
| 1411 | + * @param string $location The location to output the html. |
|
| 1412 | + * @param array $cf The custom field array. |
|
| 1413 | + * @since 1.6.6 |
|
| 1414 | + */ |
|
| 1415 | + $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1416 | + } |
|
| 1417 | + |
|
| 1418 | + // If not html then we run the standard output. |
|
| 1419 | + if(empty($html)){ |
|
| 1420 | + |
|
| 1421 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1422 | + |
|
| 1423 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1424 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1425 | + $field_icon_af = ''; |
|
| 1426 | + } elseif ($field_icon == '') { |
|
| 1427 | + $field_icon_af = ''; |
|
| 1428 | + } else { |
|
| 1429 | + $field_icon_af = $field_icon; |
|
| 1430 | + $field_icon = ''; |
|
| 1431 | + } |
|
| 1432 | + |
|
| 1433 | + |
|
| 1434 | + $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; |
|
| 1435 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1436 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1437 | + |
|
| 1438 | + } |
|
| 1439 | + |
|
| 1440 | + } |
|
| 1441 | + |
|
| 1442 | + return $html; |
|
| 1443 | 1443 | } |
| 1444 | 1444 | add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3); |
| 1445 | 1445 | |
@@ -1457,79 +1457,79 @@ discard block |
||
| 1457 | 1457 | */ |
| 1458 | 1458 | function geodir_cf_html($html,$location,$cf,$p=''){ |
| 1459 | 1459 | |
| 1460 | - // check we have the post value |
|
| 1461 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1462 | - else{ global $post;} |
|
| 1463 | - |
|
| 1464 | - if(!is_array($cf) && $cf!=''){ |
|
| 1465 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1466 | - if(!$cf){return NULL;} |
|
| 1467 | - } |
|
| 1468 | - |
|
| 1469 | - $html_var = $cf['htmlvar_name']; |
|
| 1470 | - |
|
| 1471 | - // Check if there is a location specific filter. |
|
| 1472 | - if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1473 | - /** |
|
| 1474 | - * Filter the html html by location. |
|
| 1475 | - * |
|
| 1476 | - * @param string $html The html to filter. |
|
| 1477 | - * @param array $cf The custom field array. |
|
| 1478 | - * @since 1.6.6 |
|
| 1479 | - */ |
|
| 1480 | - $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1481 | - } |
|
| 1482 | - |
|
| 1483 | - // Check if there is a custom field specific filter. |
|
| 1484 | - if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1485 | - /** |
|
| 1486 | - * Filter the html html by individual custom field. |
|
| 1487 | - * |
|
| 1488 | - * @param string $html The html to filter. |
|
| 1489 | - * @param string $location The location to output the html. |
|
| 1490 | - * @param array $cf The custom field array. |
|
| 1491 | - * @since 1.6.6 |
|
| 1492 | - */ |
|
| 1493 | - $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1494 | - } |
|
| 1495 | - |
|
| 1496 | - // Check if there is a custom field key specific filter. |
|
| 1497 | - if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1498 | - /** |
|
| 1499 | - * Filter the html html by field type key. |
|
| 1500 | - * |
|
| 1501 | - * @param string $html The html to filter. |
|
| 1502 | - * @param string $location The location to output the html. |
|
| 1503 | - * @param array $cf The custom field array. |
|
| 1504 | - * @since 1.6.6 |
|
| 1505 | - */ |
|
| 1506 | - $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1507 | - } |
|
| 1508 | - |
|
| 1509 | - // If not html then we run the standard output. |
|
| 1510 | - if(empty($html)){ |
|
| 1511 | - |
|
| 1512 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1513 | - |
|
| 1514 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1515 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1516 | - $field_icon_af = ''; |
|
| 1517 | - } elseif ($field_icon == '') { |
|
| 1518 | - $field_icon_af = ''; |
|
| 1519 | - } else { |
|
| 1520 | - $field_icon_af = $field_icon; |
|
| 1521 | - $field_icon = ''; |
|
| 1522 | - } |
|
| 1523 | - |
|
| 1524 | - $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; |
|
| 1525 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1526 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1527 | - |
|
| 1528 | - } |
|
| 1529 | - |
|
| 1530 | - } |
|
| 1531 | - |
|
| 1532 | - return $html; |
|
| 1460 | + // check we have the post value |
|
| 1461 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1462 | + else{ global $post;} |
|
| 1463 | + |
|
| 1464 | + if(!is_array($cf) && $cf!=''){ |
|
| 1465 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1466 | + if(!$cf){return NULL;} |
|
| 1467 | + } |
|
| 1468 | + |
|
| 1469 | + $html_var = $cf['htmlvar_name']; |
|
| 1470 | + |
|
| 1471 | + // Check if there is a location specific filter. |
|
| 1472 | + if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1473 | + /** |
|
| 1474 | + * Filter the html html by location. |
|
| 1475 | + * |
|
| 1476 | + * @param string $html The html to filter. |
|
| 1477 | + * @param array $cf The custom field array. |
|
| 1478 | + * @since 1.6.6 |
|
| 1479 | + */ |
|
| 1480 | + $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1481 | + } |
|
| 1482 | + |
|
| 1483 | + // Check if there is a custom field specific filter. |
|
| 1484 | + if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1485 | + /** |
|
| 1486 | + * Filter the html html by individual custom field. |
|
| 1487 | + * |
|
| 1488 | + * @param string $html The html to filter. |
|
| 1489 | + * @param string $location The location to output the html. |
|
| 1490 | + * @param array $cf The custom field array. |
|
| 1491 | + * @since 1.6.6 |
|
| 1492 | + */ |
|
| 1493 | + $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1494 | + } |
|
| 1495 | + |
|
| 1496 | + // Check if there is a custom field key specific filter. |
|
| 1497 | + if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1498 | + /** |
|
| 1499 | + * Filter the html html by field type key. |
|
| 1500 | + * |
|
| 1501 | + * @param string $html The html to filter. |
|
| 1502 | + * @param string $location The location to output the html. |
|
| 1503 | + * @param array $cf The custom field array. |
|
| 1504 | + * @since 1.6.6 |
|
| 1505 | + */ |
|
| 1506 | + $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1507 | + } |
|
| 1508 | + |
|
| 1509 | + // If not html then we run the standard output. |
|
| 1510 | + if(empty($html)){ |
|
| 1511 | + |
|
| 1512 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1513 | + |
|
| 1514 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1515 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1516 | + $field_icon_af = ''; |
|
| 1517 | + } elseif ($field_icon == '') { |
|
| 1518 | + $field_icon_af = ''; |
|
| 1519 | + } else { |
|
| 1520 | + $field_icon_af = $field_icon; |
|
| 1521 | + $field_icon = ''; |
|
| 1522 | + } |
|
| 1523 | + |
|
| 1524 | + $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; |
|
| 1525 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1526 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1527 | + |
|
| 1528 | + } |
|
| 1529 | + |
|
| 1530 | + } |
|
| 1531 | + |
|
| 1532 | + return $html; |
|
| 1533 | 1533 | } |
| 1534 | 1534 | add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3); |
| 1535 | 1535 | |
@@ -1547,113 +1547,113 @@ discard block |
||
| 1547 | 1547 | */ |
| 1548 | 1548 | function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
| 1549 | 1549 | |
| 1550 | - // check we have the post value |
|
| 1551 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1552 | - else{ global $post;} |
|
| 1553 | - |
|
| 1554 | - if(!is_array($cf) && $cf!=''){ |
|
| 1555 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1556 | - if(!$cf){return NULL;} |
|
| 1557 | - } |
|
| 1558 | - |
|
| 1559 | - $html_var = $cf['htmlvar_name']; |
|
| 1560 | - |
|
| 1561 | - // Check if there is a location specific filter. |
|
| 1562 | - if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1563 | - /** |
|
| 1564 | - * Filter the taxonomy html by location. |
|
| 1565 | - * |
|
| 1566 | - * @param string $html The html to filter. |
|
| 1567 | - * @param array $cf The custom field array. |
|
| 1568 | - * @since 1.6.6 |
|
| 1569 | - */ |
|
| 1570 | - $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1571 | - } |
|
| 1572 | - |
|
| 1573 | - // Check if there is a custom field specific filter. |
|
| 1574 | - if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1575 | - /** |
|
| 1576 | - * Filter the taxonomy html by individual custom field. |
|
| 1577 | - * |
|
| 1578 | - * @param string $html The html to filter. |
|
| 1579 | - * @param string $location The location to output the html. |
|
| 1580 | - * @param array $cf The custom field array. |
|
| 1581 | - * @since 1.6.6 |
|
| 1582 | - */ |
|
| 1583 | - $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1584 | - } |
|
| 1585 | - |
|
| 1586 | - // Check if there is a custom field key specific filter. |
|
| 1587 | - if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1588 | - /** |
|
| 1589 | - * Filter the taxonomy html by field type key. |
|
| 1590 | - * |
|
| 1591 | - * @param string $html The html to filter. |
|
| 1592 | - * @param string $location The location to output the html. |
|
| 1593 | - * @param array $cf The custom field array. |
|
| 1594 | - * @since 1.6.6 |
|
| 1595 | - */ |
|
| 1596 | - $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1597 | - } |
|
| 1598 | - |
|
| 1599 | - // If not html then we run the standard output. |
|
| 1600 | - if(empty($html)){ |
|
| 1601 | - |
|
| 1602 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1603 | - $post_taxonomy = $post->post_type . 'category'; |
|
| 1604 | - $field_value = $post->{$html_var}; |
|
| 1605 | - $links = array(); |
|
| 1606 | - $terms = array(); |
|
| 1607 | - $termsOrdered = array(); |
|
| 1608 | - if (!is_array($field_value)) { |
|
| 1609 | - $field_value = explode(",", trim($field_value, ",")); |
|
| 1610 | - } |
|
| 1611 | - |
|
| 1612 | - $field_value = array_unique($field_value); |
|
| 1613 | - |
|
| 1614 | - if (!empty($field_value)) { |
|
| 1615 | - foreach ($field_value as $term) { |
|
| 1616 | - $term = trim($term); |
|
| 1617 | - |
|
| 1618 | - if ($term != '') { |
|
| 1619 | - $term = get_term_by('id', $term, $html_var); |
|
| 1620 | - if (is_object($term)) { |
|
| 1621 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1622 | - $terms[] = $term; |
|
| 1623 | - } |
|
| 1624 | - } |
|
| 1625 | - } |
|
| 1626 | - if (!empty($links)) { |
|
| 1627 | - // order alphabetically |
|
| 1628 | - asort($links); |
|
| 1629 | - foreach (array_keys($links) as $key) { |
|
| 1630 | - $termsOrdered[$key] = $terms[$key]; |
|
| 1631 | - } |
|
| 1632 | - $terms = $termsOrdered; |
|
| 1633 | - } |
|
| 1634 | - } |
|
| 1635 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1636 | - |
|
| 1637 | - if ($html_value != '') { |
|
| 1638 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1639 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1640 | - $field_icon_af = ''; |
|
| 1641 | - } else if ($field_icon == '') { |
|
| 1642 | - $field_icon_af = ''; |
|
| 1643 | - } else { |
|
| 1644 | - $field_icon_af = $field_icon; |
|
| 1645 | - $field_icon = ''; |
|
| 1646 | - } |
|
| 1647 | - |
|
| 1648 | - $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; |
|
| 1649 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1650 | - $html .= '</span> ' . $html_value . '</div>'; |
|
| 1651 | - } |
|
| 1652 | - } |
|
| 1653 | - |
|
| 1654 | - } |
|
| 1655 | - |
|
| 1656 | - return $html; |
|
| 1550 | + // check we have the post value |
|
| 1551 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1552 | + else{ global $post;} |
|
| 1553 | + |
|
| 1554 | + if(!is_array($cf) && $cf!=''){ |
|
| 1555 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1556 | + if(!$cf){return NULL;} |
|
| 1557 | + } |
|
| 1558 | + |
|
| 1559 | + $html_var = $cf['htmlvar_name']; |
|
| 1560 | + |
|
| 1561 | + // Check if there is a location specific filter. |
|
| 1562 | + if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1563 | + /** |
|
| 1564 | + * Filter the taxonomy html by location. |
|
| 1565 | + * |
|
| 1566 | + * @param string $html The html to filter. |
|
| 1567 | + * @param array $cf The custom field array. |
|
| 1568 | + * @since 1.6.6 |
|
| 1569 | + */ |
|
| 1570 | + $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1571 | + } |
|
| 1572 | + |
|
| 1573 | + // Check if there is a custom field specific filter. |
|
| 1574 | + if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1575 | + /** |
|
| 1576 | + * Filter the taxonomy html by individual custom field. |
|
| 1577 | + * |
|
| 1578 | + * @param string $html The html to filter. |
|
| 1579 | + * @param string $location The location to output the html. |
|
| 1580 | + * @param array $cf The custom field array. |
|
| 1581 | + * @since 1.6.6 |
|
| 1582 | + */ |
|
| 1583 | + $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1584 | + } |
|
| 1585 | + |
|
| 1586 | + // Check if there is a custom field key specific filter. |
|
| 1587 | + if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1588 | + /** |
|
| 1589 | + * Filter the taxonomy html by field type key. |
|
| 1590 | + * |
|
| 1591 | + * @param string $html The html to filter. |
|
| 1592 | + * @param string $location The location to output the html. |
|
| 1593 | + * @param array $cf The custom field array. |
|
| 1594 | + * @since 1.6.6 |
|
| 1595 | + */ |
|
| 1596 | + $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1597 | + } |
|
| 1598 | + |
|
| 1599 | + // If not html then we run the standard output. |
|
| 1600 | + if(empty($html)){ |
|
| 1601 | + |
|
| 1602 | + if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1603 | + $post_taxonomy = $post->post_type . 'category'; |
|
| 1604 | + $field_value = $post->{$html_var}; |
|
| 1605 | + $links = array(); |
|
| 1606 | + $terms = array(); |
|
| 1607 | + $termsOrdered = array(); |
|
| 1608 | + if (!is_array($field_value)) { |
|
| 1609 | + $field_value = explode(",", trim($field_value, ",")); |
|
| 1610 | + } |
|
| 1611 | + |
|
| 1612 | + $field_value = array_unique($field_value); |
|
| 1613 | + |
|
| 1614 | + if (!empty($field_value)) { |
|
| 1615 | + foreach ($field_value as $term) { |
|
| 1616 | + $term = trim($term); |
|
| 1617 | + |
|
| 1618 | + if ($term != '') { |
|
| 1619 | + $term = get_term_by('id', $term, $html_var); |
|
| 1620 | + if (is_object($term)) { |
|
| 1621 | + $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1622 | + $terms[] = $term; |
|
| 1623 | + } |
|
| 1624 | + } |
|
| 1625 | + } |
|
| 1626 | + if (!empty($links)) { |
|
| 1627 | + // order alphabetically |
|
| 1628 | + asort($links); |
|
| 1629 | + foreach (array_keys($links) as $key) { |
|
| 1630 | + $termsOrdered[$key] = $terms[$key]; |
|
| 1631 | + } |
|
| 1632 | + $terms = $termsOrdered; |
|
| 1633 | + } |
|
| 1634 | + } |
|
| 1635 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1636 | + |
|
| 1637 | + if ($html_value != '') { |
|
| 1638 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1639 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1640 | + $field_icon_af = ''; |
|
| 1641 | + } else if ($field_icon == '') { |
|
| 1642 | + $field_icon_af = ''; |
|
| 1643 | + } else { |
|
| 1644 | + $field_icon_af = $field_icon; |
|
| 1645 | + $field_icon = ''; |
|
| 1646 | + } |
|
| 1647 | + |
|
| 1648 | + $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; |
|
| 1649 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1650 | + $html .= '</span> ' . $html_value . '</div>'; |
|
| 1651 | + } |
|
| 1652 | + } |
|
| 1653 | + |
|
| 1654 | + } |
|
| 1655 | + |
|
| 1656 | + return $html; |
|
| 1657 | 1657 | } |
| 1658 | 1658 | add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3); |
| 1659 | 1659 | |
@@ -1670,161 +1670,161 @@ discard block |
||
| 1670 | 1670 | */ |
| 1671 | 1671 | function geodir_cf_address($html,$location,$cf,$p=''){ |
| 1672 | 1672 | |
| 1673 | - // check we have the post value |
|
| 1674 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1675 | - else{ global $post;} |
|
| 1676 | - |
|
| 1677 | - if(!is_array($cf) && $cf!=''){ |
|
| 1678 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1679 | - if(!$cf){return NULL;} |
|
| 1680 | - } |
|
| 1681 | - |
|
| 1682 | - $html_var = $cf['htmlvar_name']; |
|
| 1683 | - |
|
| 1684 | - // Check if there is a location specific filter. |
|
| 1685 | - if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1686 | - /** |
|
| 1687 | - * Filter the address html by location. |
|
| 1688 | - * |
|
| 1689 | - * @param string $html The html to filter. |
|
| 1690 | - * @param array $cf The custom field array. |
|
| 1691 | - * @since 1.6.6 |
|
| 1692 | - */ |
|
| 1693 | - $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1694 | - } |
|
| 1695 | - |
|
| 1696 | - // Check if there is a custom field specific filter. |
|
| 1697 | - if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1698 | - /** |
|
| 1699 | - * Filter the address html by individual custom field. |
|
| 1700 | - * |
|
| 1701 | - * @param string $html The html to filter. |
|
| 1702 | - * @param string $location The location to output the html. |
|
| 1703 | - * @param array $cf The custom field array. |
|
| 1704 | - * @since 1.6.6 |
|
| 1705 | - */ |
|
| 1706 | - $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1707 | - } |
|
| 1708 | - |
|
| 1709 | - // Check if there is a custom field key specific filter. |
|
| 1710 | - if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1711 | - /** |
|
| 1712 | - * Filter the address html by field type key. |
|
| 1713 | - * |
|
| 1714 | - * @param string $html The html to filter. |
|
| 1715 | - * @param string $location The location to output the html. |
|
| 1716 | - * @param array $cf The custom field array. |
|
| 1717 | - * @since 1.6.6 |
|
| 1718 | - */ |
|
| 1719 | - $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1720 | - } |
|
| 1721 | - |
|
| 1722 | - // If not html then we run the standard output. |
|
| 1723 | - if(empty($html)){ |
|
| 1724 | - |
|
| 1725 | - global $preview; |
|
| 1726 | - $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1727 | - |
|
| 1728 | - if ($cf['extra_fields']) { |
|
| 1729 | - |
|
| 1730 | - $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1731 | - |
|
| 1732 | - $addition_fields = ''; |
|
| 1733 | - |
|
| 1734 | - if (!empty($extra_fields)) { |
|
| 1735 | - |
|
| 1736 | - $show_city_in_address = false; |
|
| 1737 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
| 1738 | - $show_city_in_address = true; |
|
| 1739 | - } |
|
| 1740 | - /** |
|
| 1741 | - * Filter "show city in address" value. |
|
| 1742 | - * |
|
| 1743 | - * @since 1.0.0 |
|
| 1744 | - */ |
|
| 1745 | - $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
| 1746 | - |
|
| 1747 | - |
|
| 1748 | - $show_region_in_address = false; |
|
| 1749 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
| 1750 | - $show_region_in_address = true; |
|
| 1751 | - } |
|
| 1752 | - /** |
|
| 1753 | - * Filter "show region in address" value. |
|
| 1754 | - * |
|
| 1755 | - * @since 1.6.6 |
|
| 1756 | - */ |
|
| 1757 | - $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
| 1758 | - |
|
| 1759 | - $show_country_in_address = false; |
|
| 1760 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
| 1761 | - $show_country_in_address = true; |
|
| 1762 | - } |
|
| 1763 | - /** |
|
| 1764 | - * Filter "show country in address" value. |
|
| 1765 | - * |
|
| 1766 | - * @since 1.6.6 |
|
| 1767 | - */ |
|
| 1768 | - $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
| 1769 | - |
|
| 1770 | - $show_zip_in_address = false; |
|
| 1771 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 1772 | - $show_zip_in_address = true; |
|
| 1773 | - } |
|
| 1774 | - /** |
|
| 1775 | - * Filter "show zip in address" value. |
|
| 1776 | - * |
|
| 1777 | - * @since 1.6.6 |
|
| 1778 | - */ |
|
| 1779 | - $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
| 1780 | - |
|
| 1781 | - |
|
| 1782 | - } |
|
| 1783 | - |
|
| 1784 | - } |
|
| 1785 | - |
|
| 1786 | - |
|
| 1787 | - if ($post->{$html_var}) { |
|
| 1788 | - |
|
| 1789 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1790 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1791 | - $field_icon_af = ''; |
|
| 1792 | - } elseif ( $field_icon == '' ) { |
|
| 1793 | - $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 1794 | - } else { |
|
| 1795 | - $field_icon_af = $field_icon; |
|
| 1796 | - $field_icon = ''; |
|
| 1797 | - } |
|
| 1673 | + // check we have the post value |
|
| 1674 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1675 | + else{ global $post;} |
|
| 1676 | + |
|
| 1677 | + if(!is_array($cf) && $cf!=''){ |
|
| 1678 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1679 | + if(!$cf){return NULL;} |
|
| 1680 | + } |
|
| 1681 | + |
|
| 1682 | + $html_var = $cf['htmlvar_name']; |
|
| 1683 | + |
|
| 1684 | + // Check if there is a location specific filter. |
|
| 1685 | + if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1686 | + /** |
|
| 1687 | + * Filter the address html by location. |
|
| 1688 | + * |
|
| 1689 | + * @param string $html The html to filter. |
|
| 1690 | + * @param array $cf The custom field array. |
|
| 1691 | + * @since 1.6.6 |
|
| 1692 | + */ |
|
| 1693 | + $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1694 | + } |
|
| 1695 | + |
|
| 1696 | + // Check if there is a custom field specific filter. |
|
| 1697 | + if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1698 | + /** |
|
| 1699 | + * Filter the address html by individual custom field. |
|
| 1700 | + * |
|
| 1701 | + * @param string $html The html to filter. |
|
| 1702 | + * @param string $location The location to output the html. |
|
| 1703 | + * @param array $cf The custom field array. |
|
| 1704 | + * @since 1.6.6 |
|
| 1705 | + */ |
|
| 1706 | + $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1707 | + } |
|
| 1708 | + |
|
| 1709 | + // Check if there is a custom field key specific filter. |
|
| 1710 | + if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1711 | + /** |
|
| 1712 | + * Filter the address html by field type key. |
|
| 1713 | + * |
|
| 1714 | + * @param string $html The html to filter. |
|
| 1715 | + * @param string $location The location to output the html. |
|
| 1716 | + * @param array $cf The custom field array. |
|
| 1717 | + * @since 1.6.6 |
|
| 1718 | + */ |
|
| 1719 | + $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1720 | + } |
|
| 1721 | + |
|
| 1722 | + // If not html then we run the standard output. |
|
| 1723 | + if(empty($html)){ |
|
| 1724 | + |
|
| 1725 | + global $preview; |
|
| 1726 | + $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1727 | + |
|
| 1728 | + if ($cf['extra_fields']) { |
|
| 1729 | + |
|
| 1730 | + $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1731 | + |
|
| 1732 | + $addition_fields = ''; |
|
| 1733 | + |
|
| 1734 | + if (!empty($extra_fields)) { |
|
| 1735 | + |
|
| 1736 | + $show_city_in_address = false; |
|
| 1737 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
| 1738 | + $show_city_in_address = true; |
|
| 1739 | + } |
|
| 1740 | + /** |
|
| 1741 | + * Filter "show city in address" value. |
|
| 1742 | + * |
|
| 1743 | + * @since 1.0.0 |
|
| 1744 | + */ |
|
| 1745 | + $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
| 1746 | + |
|
| 1747 | + |
|
| 1748 | + $show_region_in_address = false; |
|
| 1749 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
| 1750 | + $show_region_in_address = true; |
|
| 1751 | + } |
|
| 1752 | + /** |
|
| 1753 | + * Filter "show region in address" value. |
|
| 1754 | + * |
|
| 1755 | + * @since 1.6.6 |
|
| 1756 | + */ |
|
| 1757 | + $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
| 1758 | + |
|
| 1759 | + $show_country_in_address = false; |
|
| 1760 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
| 1761 | + $show_country_in_address = true; |
|
| 1762 | + } |
|
| 1763 | + /** |
|
| 1764 | + * Filter "show country in address" value. |
|
| 1765 | + * |
|
| 1766 | + * @since 1.6.6 |
|
| 1767 | + */ |
|
| 1768 | + $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
| 1769 | + |
|
| 1770 | + $show_zip_in_address = false; |
|
| 1771 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 1772 | + $show_zip_in_address = true; |
|
| 1773 | + } |
|
| 1774 | + /** |
|
| 1775 | + * Filter "show zip in address" value. |
|
| 1776 | + * |
|
| 1777 | + * @since 1.6.6 |
|
| 1778 | + */ |
|
| 1779 | + $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
| 1780 | + |
|
| 1781 | + |
|
| 1782 | + } |
|
| 1783 | + |
|
| 1784 | + } |
|
| 1785 | + |
|
| 1786 | + |
|
| 1787 | + if ($post->{$html_var}) { |
|
| 1788 | + |
|
| 1789 | + $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1790 | + if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1791 | + $field_icon_af = ''; |
|
| 1792 | + } elseif ( $field_icon == '' ) { |
|
| 1793 | + $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 1794 | + } else { |
|
| 1795 | + $field_icon_af = $field_icon; |
|
| 1796 | + $field_icon = ''; |
|
| 1797 | + } |
|
| 1798 | 1798 | |
| 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' ) . ': ' : ' '; |
|
| 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 | - if ( isset($post->post_address) ) { |
|
| 1807 | - $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 1808 | - } |
|
| 1809 | - if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1810 | - $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 1811 | - } |
|
| 1812 | - if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1813 | - $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 1814 | - } |
|
| 1815 | - if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1816 | - $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 1817 | - } |
|
| 1818 | - if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1819 | - $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>'; |
|
| 1820 | - } |
|
| 1821 | - $html .= '</div>'; |
|
| 1806 | + if ( isset($post->post_address) ) { |
|
| 1807 | + $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 1808 | + } |
|
| 1809 | + if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1810 | + $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 1811 | + } |
|
| 1812 | + if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1813 | + $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 1814 | + } |
|
| 1815 | + if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1816 | + $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 1817 | + } |
|
| 1818 | + if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1819 | + $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>'; |
|
| 1820 | + } |
|
| 1821 | + $html .= '</div>'; |
|
| 1822 | 1822 | |
| 1823 | - } |
|
| 1823 | + } |
|
| 1824 | 1824 | |
| 1825 | - } |
|
| 1825 | + } |
|
| 1826 | 1826 | |
| 1827 | 1827 | |
| 1828 | - return $html; |
|
| 1828 | + return $html; |
|
| 1829 | 1829 | } |
| 1830 | 1830 | add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3); |
| 1831 | 1831 | \ No newline at end of file |