@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | // Page titles translatable CPT names |
| 12 | 12 | function geodir_kelo_title_translation( $args) { |
| 13 | - if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
|
| 14 | - $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
|
| 15 | - }elseif(function_exists('geodir_is_geodir_page')){ |
|
| 16 | - $args['title'] = __($args['title'],'geodirectory'); |
|
| 17 | - } |
|
| 13 | + if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
|
| 14 | + $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
|
| 15 | + }elseif(function_exists('geodir_is_geodir_page')){ |
|
| 16 | + $args['title'] = __($args['title'],'geodirectory'); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - return $args; |
|
| 19 | + return $args; |
|
| 20 | 20 | } |
| 21 | 21 | add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 ); |
| 22 | 22 | |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | * @return object Modified query object. |
| 32 | 32 | */ |
| 33 | 33 | function geodir_kleo_search_filter( $query ) { |
| 34 | - if ( !empty( $query->is_search ) && geodir_is_page('search') && is_search() ) { |
|
| 35 | - $query->set( 'post_type', 'any' ); |
|
| 36 | - } |
|
| 37 | - return $query; |
|
| 34 | + if ( !empty( $query->is_search ) && geodir_is_page('search') && is_search() ) { |
|
| 35 | + $query->set( 'post_type', 'any' ); |
|
| 36 | + } |
|
| 37 | + return $query; |
|
| 38 | 38 | } |
| 39 | 39 | if ( !is_admin() ) { |
| 40 | - add_filter( 'pre_get_posts', 'geodir_kleo_search_filter', 11 ); |
|
| 40 | + add_filter( 'pre_get_posts', 'geodir_kleo_search_filter', 11 ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | if( ! function_exists( 'kleo_title' ) ){ |
| 44 | - function kleo_title(){ return geodir_kleo_custom_the_title();} |
|
| 44 | + function kleo_title(){ return geodir_kleo_custom_the_title();} |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -53,109 +53,109 @@ discard block |
||
| 53 | 53 | function geodir_kleo_custom_the_title() |
| 54 | 54 | { |
| 55 | 55 | |
| 56 | - $output = ''; |
|
| 57 | - if (is_tag()) { |
|
| 58 | - $output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false); |
|
| 59 | - } |
|
| 60 | - elseif(is_tax()) { |
|
| 61 | - $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
|
| 62 | - $output = $term->name; |
|
| 63 | - } |
|
| 64 | - elseif ( is_category() ) { |
|
| 65 | - $output = __('Archive for category:', 'kleo_framework') . " " . single_cat_title('', false); |
|
| 66 | - } |
|
| 67 | - elseif (is_day()) |
|
| 68 | - { |
|
| 69 | - $output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y'); |
|
| 70 | - } |
|
| 71 | - elseif (is_month()) |
|
| 72 | - { |
|
| 73 | - $output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y'); |
|
| 74 | - } |
|
| 75 | - elseif (is_year()) |
|
| 76 | - { |
|
| 77 | - $output = __('Archive for year:','kleo_framework')." ".get_the_time('Y'); |
|
| 78 | - } |
|
| 79 | - elseif (is_author()) { |
|
| 80 | - $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
|
| 81 | - $output = __('Author Archive','kleo_framework')." "; |
|
| 82 | - |
|
| 83 | - if( isset( $curauth->nickname ) ) { |
|
| 84 | - $output .= __('for:','kleo_framework')." ".$curauth->nickname; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - elseif ( is_archive() ) { |
|
| 88 | - $output = post_type_archive_title( '', false ); |
|
| 89 | - } |
|
| 90 | - elseif (is_search()) |
|
| 91 | - { |
|
| 92 | - global $wp_query; |
|
| 93 | - if(!empty($wp_query->found_posts)) |
|
| 94 | - { |
|
| 95 | - if($wp_query->found_posts > 1) |
|
| 96 | - { |
|
| 97 | - $output = $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() ); |
|
| 98 | - } |
|
| 99 | - else |
|
| 100 | - { |
|
| 101 | - $output = $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() ); |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - else |
|
| 105 | - { |
|
| 106 | - if(!empty($_GET['s'])) |
|
| 107 | - { |
|
| 108 | - $output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() ); |
|
| 109 | - } |
|
| 110 | - else |
|
| 111 | - { |
|
| 112 | - $output = __('To search the site please enter a valid term','kleo_framework'); |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - } |
|
| 117 | - elseif ( is_front_page() && !is_home() ) { |
|
| 118 | - $output = get_the_title(get_option('page_on_front')); |
|
| 119 | - |
|
| 120 | - } elseif ( is_home() ) { |
|
| 121 | - if (get_option('page_for_posts')) { |
|
| 122 | - $output = get_the_title(get_option('page_for_posts')); |
|
| 123 | - } else { |
|
| 124 | - $output = __( 'Blog', 'kleo_framework' ); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - } elseif ( is_404() ) { |
|
| 128 | - $output = __('Error 404 - Page not found','kleo_framework'); |
|
| 129 | - } |
|
| 130 | - else { |
|
| 131 | - $output = get_the_title(); |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - if (isset($_GET['paged']) && !empty($_GET['paged'])) |
|
| 135 | - { |
|
| 136 | - $output .= " (".__('Page','kleo_framework')." ".$_GET['paged'].")"; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - |
|
| 140 | - $gd_page = ''; |
|
| 141 | - if(geodir_is_page('pt')){ |
|
| 142 | - $gd_page = 'pt'; |
|
| 143 | - $output = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : ''; |
|
| 144 | - } |
|
| 145 | - elseif(geodir_is_page('listing')){ |
|
| 146 | - $gd_page = 'listing'; |
|
| 147 | - $output = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : ''; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Filter page meta title to replace variables. |
|
| 154 | - * |
|
| 155 | - * @since 1.5.4 |
|
| 156 | - * @param string $title The page title including variables. |
|
| 157 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 158 | - */ |
|
| 159 | - return apply_filters('geodir_seo_meta_title', __($output, 'geodirectory'), $gd_page); |
|
| 56 | + $output = ''; |
|
| 57 | + if (is_tag()) { |
|
| 58 | + $output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false); |
|
| 59 | + } |
|
| 60 | + elseif(is_tax()) { |
|
| 61 | + $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
|
| 62 | + $output = $term->name; |
|
| 63 | + } |
|
| 64 | + elseif ( is_category() ) { |
|
| 65 | + $output = __('Archive for category:', 'kleo_framework') . " " . single_cat_title('', false); |
|
| 66 | + } |
|
| 67 | + elseif (is_day()) |
|
| 68 | + { |
|
| 69 | + $output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y'); |
|
| 70 | + } |
|
| 71 | + elseif (is_month()) |
|
| 72 | + { |
|
| 73 | + $output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y'); |
|
| 74 | + } |
|
| 75 | + elseif (is_year()) |
|
| 76 | + { |
|
| 77 | + $output = __('Archive for year:','kleo_framework')." ".get_the_time('Y'); |
|
| 78 | + } |
|
| 79 | + elseif (is_author()) { |
|
| 80 | + $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
|
| 81 | + $output = __('Author Archive','kleo_framework')." "; |
|
| 82 | + |
|
| 83 | + if( isset( $curauth->nickname ) ) { |
|
| 84 | + $output .= __('for:','kleo_framework')." ".$curauth->nickname; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + elseif ( is_archive() ) { |
|
| 88 | + $output = post_type_archive_title( '', false ); |
|
| 89 | + } |
|
| 90 | + elseif (is_search()) |
|
| 91 | + { |
|
| 92 | + global $wp_query; |
|
| 93 | + if(!empty($wp_query->found_posts)) |
|
| 94 | + { |
|
| 95 | + if($wp_query->found_posts > 1) |
|
| 96 | + { |
|
| 97 | + $output = $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() ); |
|
| 98 | + } |
|
| 99 | + else |
|
| 100 | + { |
|
| 101 | + $output = $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() ); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + else |
|
| 105 | + { |
|
| 106 | + if(!empty($_GET['s'])) |
|
| 107 | + { |
|
| 108 | + $output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() ); |
|
| 109 | + } |
|
| 110 | + else |
|
| 111 | + { |
|
| 112 | + $output = __('To search the site please enter a valid term','kleo_framework'); |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + } |
|
| 117 | + elseif ( is_front_page() && !is_home() ) { |
|
| 118 | + $output = get_the_title(get_option('page_on_front')); |
|
| 119 | + |
|
| 120 | + } elseif ( is_home() ) { |
|
| 121 | + if (get_option('page_for_posts')) { |
|
| 122 | + $output = get_the_title(get_option('page_for_posts')); |
|
| 123 | + } else { |
|
| 124 | + $output = __( 'Blog', 'kleo_framework' ); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + } elseif ( is_404() ) { |
|
| 128 | + $output = __('Error 404 - Page not found','kleo_framework'); |
|
| 129 | + } |
|
| 130 | + else { |
|
| 131 | + $output = get_the_title(); |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + if (isset($_GET['paged']) && !empty($_GET['paged'])) |
|
| 135 | + { |
|
| 136 | + $output .= " (".__('Page','kleo_framework')." ".$_GET['paged'].")"; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + |
|
| 140 | + $gd_page = ''; |
|
| 141 | + if(geodir_is_page('pt')){ |
|
| 142 | + $gd_page = 'pt'; |
|
| 143 | + $output = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : ''; |
|
| 144 | + } |
|
| 145 | + elseif(geodir_is_page('listing')){ |
|
| 146 | + $gd_page = 'listing'; |
|
| 147 | + $output = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : ''; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Filter page meta title to replace variables. |
|
| 154 | + * |
|
| 155 | + * @since 1.5.4 |
|
| 156 | + * @param string $title The page title including variables. |
|
| 157 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 158 | + */ |
|
| 159 | + return apply_filters('geodir_seo_meta_title', __($output, 'geodirectory'), $gd_page); |
|
| 160 | 160 | |
| 161 | 161 | } |
| 162 | 162 | \ No newline at end of file |
@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Page titles translatable CPT names |
| 12 | -function geodir_kelo_title_translation( $args) { |
|
| 13 | - if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
|
| 14 | - $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
|
| 15 | - }elseif(function_exists('geodir_is_geodir_page')){ |
|
| 16 | - $args['title'] = __($args['title'],'geodirectory'); |
|
| 12 | +function geodir_kelo_title_translation($args) { |
|
| 13 | + if (function_exists('geodir_is_geodir_page') && geodir_is_page('preview')) { |
|
| 14 | + $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])), 'geodirectory'); |
|
| 15 | + }elseif (function_exists('geodir_is_geodir_page')) { |
|
| 16 | + $args['title'] = __($args['title'], 'geodirectory'); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | return $args; |
| 20 | 20 | } |
| 21 | -add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 ); |
|
| 21 | +add_filter('kleo_title_args', 'geodir_kelo_title_translation', 10, 1); |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Fix search returns all the posts for Kleo theme. |
@@ -30,18 +30,18 @@ discard block |
||
| 30 | 30 | * @param object $query Current query object. |
| 31 | 31 | * @return object Modified query object. |
| 32 | 32 | */ |
| 33 | -function geodir_kleo_search_filter( $query ) { |
|
| 34 | - if ( !empty( $query->is_search ) && geodir_is_page('search') && is_search() ) { |
|
| 35 | - $query->set( 'post_type', 'any' ); |
|
| 33 | +function geodir_kleo_search_filter($query) { |
|
| 34 | + if (!empty($query->is_search) && geodir_is_page('search') && is_search()) { |
|
| 35 | + $query->set('post_type', 'any'); |
|
| 36 | 36 | } |
| 37 | 37 | return $query; |
| 38 | 38 | } |
| 39 | -if ( !is_admin() ) { |
|
| 40 | - add_filter( 'pre_get_posts', 'geodir_kleo_search_filter', 11 ); |
|
| 39 | +if (!is_admin()) { |
|
| 40 | + add_filter('pre_get_posts', 'geodir_kleo_search_filter', 11); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | -if( ! function_exists( 'kleo_title' ) ){ |
|
| 44 | - function kleo_title(){ return geodir_kleo_custom_the_title();} |
|
| 43 | +if (!function_exists('kleo_title')) { |
|
| 44 | + function kleo_title() { return geodir_kleo_custom_the_title(); } |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -55,77 +55,77 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $output = ''; |
| 57 | 57 | if (is_tag()) { |
| 58 | - $output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false); |
|
| 58 | + $output = __('Tag Archive for:', 'kleo_framework')." ".single_tag_title('', false); |
|
| 59 | 59 | } |
| 60 | - elseif(is_tax()) { |
|
| 60 | + elseif (is_tax()) { |
|
| 61 | 61 | $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
| 62 | 62 | $output = $term->name; |
| 63 | 63 | } |
| 64 | - elseif ( is_category() ) { |
|
| 65 | - $output = __('Archive for category:', 'kleo_framework') . " " . single_cat_title('', false); |
|
| 64 | + elseif (is_category()) { |
|
| 65 | + $output = __('Archive for category:', 'kleo_framework')." ".single_cat_title('', false); |
|
| 66 | 66 | } |
| 67 | 67 | elseif (is_day()) |
| 68 | 68 | { |
| 69 | - $output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y'); |
|
| 69 | + $output = __('Archive for date:', 'kleo_framework')." ".get_the_time('F jS, Y'); |
|
| 70 | 70 | } |
| 71 | 71 | elseif (is_month()) |
| 72 | 72 | { |
| 73 | - $output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y'); |
|
| 73 | + $output = __('Archive for month:', 'kleo_framework')." ".get_the_time('F, Y'); |
|
| 74 | 74 | } |
| 75 | 75 | elseif (is_year()) |
| 76 | 76 | { |
| 77 | - $output = __('Archive for year:','kleo_framework')." ".get_the_time('Y'); |
|
| 77 | + $output = __('Archive for year:', 'kleo_framework')." ".get_the_time('Y'); |
|
| 78 | 78 | } |
| 79 | - elseif (is_author()) { |
|
| 79 | + elseif (is_author()) { |
|
| 80 | 80 | $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
| 81 | - $output = __('Author Archive','kleo_framework')." "; |
|
| 81 | + $output = __('Author Archive', 'kleo_framework')." "; |
|
| 82 | 82 | |
| 83 | - if( isset( $curauth->nickname ) ) { |
|
| 84 | - $output .= __('for:','kleo_framework')." ".$curauth->nickname; |
|
| 83 | + if (isset($curauth->nickname)) { |
|
| 84 | + $output .= __('for:', 'kleo_framework')." ".$curauth->nickname; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | - elseif ( is_archive() ) { |
|
| 88 | - $output = post_type_archive_title( '', false ); |
|
| 87 | + elseif (is_archive()) { |
|
| 88 | + $output = post_type_archive_title('', false); |
|
| 89 | 89 | } |
| 90 | 90 | elseif (is_search()) |
| 91 | 91 | { |
| 92 | 92 | global $wp_query; |
| 93 | - if(!empty($wp_query->found_posts)) |
|
| 93 | + if (!empty($wp_query->found_posts)) |
|
| 94 | 94 | { |
| 95 | - if($wp_query->found_posts > 1) |
|
| 95 | + if ($wp_query->found_posts > 1) |
|
| 96 | 96 | { |
| 97 | - $output = $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() ); |
|
| 97 | + $output = $wp_query->found_posts." ".__('search results for:', 'kleo_framework')." ".esc_attr(get_search_query()); |
|
| 98 | 98 | } |
| 99 | 99 | else |
| 100 | 100 | { |
| 101 | - $output = $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() ); |
|
| 101 | + $output = $wp_query->found_posts." ".__('search result for:', 'kleo_framework')." ".esc_attr(get_search_query()); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | else |
| 105 | 105 | { |
| 106 | - if(!empty($_GET['s'])) |
|
| 106 | + if (!empty($_GET['s'])) |
|
| 107 | 107 | { |
| 108 | - $output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() ); |
|
| 108 | + $output = __('Search results for:', 'kleo_framework')." ".esc_attr(get_search_query()); |
|
| 109 | 109 | } |
| 110 | 110 | else |
| 111 | 111 | { |
| 112 | - $output = __('To search the site please enter a valid term','kleo_framework'); |
|
| 112 | + $output = __('To search the site please enter a valid term', 'kleo_framework'); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | } |
| 117 | - elseif ( is_front_page() && !is_home() ) { |
|
| 117 | + elseif (is_front_page() && !is_home()) { |
|
| 118 | 118 | $output = get_the_title(get_option('page_on_front')); |
| 119 | 119 | |
| 120 | - } elseif ( is_home() ) { |
|
| 120 | + } elseif (is_home()) { |
|
| 121 | 121 | if (get_option('page_for_posts')) { |
| 122 | 122 | $output = get_the_title(get_option('page_for_posts')); |
| 123 | 123 | } else { |
| 124 | - $output = __( 'Blog', 'kleo_framework' ); |
|
| 124 | + $output = __('Blog', 'kleo_framework'); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - } elseif ( is_404() ) { |
|
| 128 | - $output = __('Error 404 - Page not found','kleo_framework'); |
|
| 127 | + } elseif (is_404()) { |
|
| 128 | + $output = __('Error 404 - Page not found', 'kleo_framework'); |
|
| 129 | 129 | } |
| 130 | 130 | else { |
| 131 | 131 | $output = get_the_title(); |
@@ -133,16 +133,16 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | if (isset($_GET['paged']) && !empty($_GET['paged'])) |
| 135 | 135 | { |
| 136 | - $output .= " (".__('Page','kleo_framework')." ".$_GET['paged'].")"; |
|
| 136 | + $output .= " (".__('Page', 'kleo_framework')." ".$_GET['paged'].")"; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | $gd_page = ''; |
| 141 | - if(geodir_is_page('pt')){ |
|
| 141 | + if (geodir_is_page('pt')) { |
|
| 142 | 142 | $gd_page = 'pt'; |
| 143 | 143 | $output = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : ''; |
| 144 | 144 | } |
| 145 | - elseif(geodir_is_page('listing')){ |
|
| 145 | + elseif (geodir_is_page('listing')) { |
|
| 146 | 146 | $gd_page = 'listing'; |
| 147 | 147 | $output = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : ''; |
| 148 | 148 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | function geodir_kelo_title_translation( $args) { |
| 13 | 13 | if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
| 14 | 14 | $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
| 15 | - }elseif(function_exists('geodir_is_geodir_page')){ |
|
| 15 | + } elseif(function_exists('geodir_is_geodir_page')){ |
|
| 16 | 16 | $args['title'] = __($args['title'],'geodirectory'); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -56,38 +56,30 @@ discard block |
||
| 56 | 56 | $output = ''; |
| 57 | 57 | if (is_tag()) { |
| 58 | 58 | $output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false); |
| 59 | - } |
|
| 60 | - elseif(is_tax()) { |
|
| 59 | + } elseif(is_tax()) { |
|
| 61 | 60 | $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
| 62 | 61 | $output = $term->name; |
| 63 | - } |
|
| 64 | - elseif ( is_category() ) { |
|
| 62 | + } elseif ( is_category() ) { |
|
| 65 | 63 | $output = __('Archive for category:', 'kleo_framework') . " " . single_cat_title('', false); |
| 66 | - } |
|
| 67 | - elseif (is_day()) |
|
| 64 | + } elseif (is_day()) |
|
| 68 | 65 | { |
| 69 | 66 | $output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y'); |
| 70 | - } |
|
| 71 | - elseif (is_month()) |
|
| 67 | + } elseif (is_month()) |
|
| 72 | 68 | { |
| 73 | 69 | $output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y'); |
| 74 | - } |
|
| 75 | - elseif (is_year()) |
|
| 70 | + } elseif (is_year()) |
|
| 76 | 71 | { |
| 77 | 72 | $output = __('Archive for year:','kleo_framework')." ".get_the_time('Y'); |
| 78 | - } |
|
| 79 | - elseif (is_author()) { |
|
| 73 | + } elseif (is_author()) { |
|
| 80 | 74 | $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
| 81 | 75 | $output = __('Author Archive','kleo_framework')." "; |
| 82 | 76 | |
| 83 | 77 | if( isset( $curauth->nickname ) ) { |
| 84 | 78 | $output .= __('for:','kleo_framework')." ".$curauth->nickname; |
| 85 | 79 | } |
| 86 | - } |
|
| 87 | - elseif ( is_archive() ) { |
|
| 80 | + } elseif ( is_archive() ) { |
|
| 88 | 81 | $output = post_type_archive_title( '', false ); |
| 89 | - } |
|
| 90 | - elseif (is_search()) |
|
| 82 | + } elseif (is_search()) |
|
| 91 | 83 | { |
| 92 | 84 | global $wp_query; |
| 93 | 85 | if(!empty($wp_query->found_posts)) |
@@ -95,26 +87,22 @@ discard block |
||
| 95 | 87 | if($wp_query->found_posts > 1) |
| 96 | 88 | { |
| 97 | 89 | $output = $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() ); |
| 98 | - } |
|
| 99 | - else |
|
| 90 | + } else |
|
| 100 | 91 | { |
| 101 | 92 | $output = $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() ); |
| 102 | 93 | } |
| 103 | - } |
|
| 104 | - else |
|
| 94 | + } else |
|
| 105 | 95 | { |
| 106 | 96 | if(!empty($_GET['s'])) |
| 107 | 97 | { |
| 108 | 98 | $output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() ); |
| 109 | - } |
|
| 110 | - else |
|
| 99 | + } else |
|
| 111 | 100 | { |
| 112 | 101 | $output = __('To search the site please enter a valid term','kleo_framework'); |
| 113 | 102 | } |
| 114 | 103 | } |
| 115 | 104 | |
| 116 | - } |
|
| 117 | - elseif ( is_front_page() && !is_home() ) { |
|
| 105 | + } elseif ( is_front_page() && !is_home() ) { |
|
| 118 | 106 | $output = get_the_title(get_option('page_on_front')); |
| 119 | 107 | |
| 120 | 108 | } elseif ( is_home() ) { |
@@ -126,8 +114,7 @@ discard block |
||
| 126 | 114 | |
| 127 | 115 | } elseif ( is_404() ) { |
| 128 | 116 | $output = __('Error 404 - Page not found','kleo_framework'); |
| 129 | - } |
|
| 130 | - else { |
|
| 117 | + } else { |
|
| 131 | 118 | $output = get_the_title(); |
| 132 | 119 | } |
| 133 | 120 | |
@@ -141,8 +128,7 @@ discard block |
||
| 141 | 128 | if(geodir_is_page('pt')){ |
| 142 | 129 | $gd_page = 'pt'; |
| 143 | 130 | $output = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : ''; |
| 144 | - } |
|
| 145 | - elseif(geodir_is_page('listing')){ |
|
| 131 | + } elseif(geodir_is_page('listing')){ |
|
| 146 | 132 | $gd_page = 'listing'; |
| 147 | 133 | $output = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : ''; |
| 148 | 134 | } |
@@ -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,155 +1062,155 @@ 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 | - $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); |
|
| 1151 | - $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1152 | - $seperator = ' | '; |
|
| 1153 | - } |
|
| 1154 | - |
|
| 1155 | - if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
|
| 1156 | - $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);'); |
|
| 1157 | - $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1158 | - } |
|
| 1159 | - |
|
| 1160 | - $html .= '</span></div>'; |
|
| 1161 | - |
|
| 1162 | - |
|
| 1163 | - if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
| 1164 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1165 | - } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
|
| 1166 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1167 | - } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
| 1168 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1169 | - } |
|
| 1170 | - |
|
| 1171 | - /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
| 1172 | - |
|
| 1173 | - } else { |
|
| 1174 | - |
|
| 1175 | - if ($post->{$cf['htmlvar_name']}) { |
|
| 1176 | - |
|
| 1177 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1178 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1179 | - $field_icon_af = ''; |
|
| 1180 | - } elseif ($field_icon == '') { |
|
| 1181 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1182 | - } else { |
|
| 1183 | - $field_icon_af = $field_icon; |
|
| 1184 | - $field_icon = ''; |
|
| 1185 | - } |
|
| 1186 | - |
|
| 1187 | - |
|
| 1188 | - $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; |
|
| 1189 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1190 | - $html .= '</span><span class="geodir-email-address-output">'; |
|
| 1191 | - $email = $post->{$cf['htmlvar_name']} ; |
|
| 1192 | - if($e_split = explode('@',$email)){ |
|
| 1193 | - /** |
|
| 1194 | - * Filter email custom field name output. |
|
| 1195 | - * |
|
| 1196 | - * @since 1.5.3 |
|
| 1197 | - * |
|
| 1198 | - * @param string $email The email string being output. |
|
| 1199 | - * @param array $cf Custom field variables array. |
|
| 1200 | - */ |
|
| 1201 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1202 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1203 | - }else{ |
|
| 1204 | - $html .= $email; |
|
| 1205 | - } |
|
| 1206 | - $html .= '</span></div>'; |
|
| 1207 | - } |
|
| 1208 | - |
|
| 1209 | - } |
|
| 1210 | - |
|
| 1211 | - } |
|
| 1212 | - |
|
| 1213 | - 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 | + $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); |
|
| 1151 | + $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1152 | + $seperator = ' | '; |
|
| 1153 | + } |
|
| 1154 | + |
|
| 1155 | + if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
|
| 1156 | + $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);'); |
|
| 1157 | + $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1158 | + } |
|
| 1159 | + |
|
| 1160 | + $html .= '</span></div>'; |
|
| 1161 | + |
|
| 1162 | + |
|
| 1163 | + if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
| 1164 | + $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1165 | + } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
|
| 1166 | + $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1167 | + } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
| 1168 | + $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1169 | + } |
|
| 1170 | + |
|
| 1171 | + /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
| 1172 | + |
|
| 1173 | + } else { |
|
| 1174 | + |
|
| 1175 | + if ($post->{$cf['htmlvar_name']}) { |
|
| 1176 | + |
|
| 1177 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1178 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1179 | + $field_icon_af = ''; |
|
| 1180 | + } elseif ($field_icon == '') { |
|
| 1181 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1182 | + } else { |
|
| 1183 | + $field_icon_af = $field_icon; |
|
| 1184 | + $field_icon = ''; |
|
| 1185 | + } |
|
| 1186 | + |
|
| 1187 | + |
|
| 1188 | + $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; |
|
| 1189 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1190 | + $html .= '</span><span class="geodir-email-address-output">'; |
|
| 1191 | + $email = $post->{$cf['htmlvar_name']} ; |
|
| 1192 | + if($e_split = explode('@',$email)){ |
|
| 1193 | + /** |
|
| 1194 | + * Filter email custom field name output. |
|
| 1195 | + * |
|
| 1196 | + * @since 1.5.3 |
|
| 1197 | + * |
|
| 1198 | + * @param string $email The email string being output. |
|
| 1199 | + * @param array $cf Custom field variables array. |
|
| 1200 | + */ |
|
| 1201 | + $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1202 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1203 | + }else{ |
|
| 1204 | + $html .= $email; |
|
| 1205 | + } |
|
| 1206 | + $html .= '</span></div>'; |
|
| 1207 | + } |
|
| 1208 | + |
|
| 1209 | + } |
|
| 1210 | + |
|
| 1211 | + } |
|
| 1212 | + |
|
| 1213 | + return $html; |
|
| 1214 | 1214 | } |
| 1215 | 1215 | add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3); |
| 1216 | 1216 | |
@@ -1227,136 +1227,136 @@ discard block |
||
| 1227 | 1227 | */ |
| 1228 | 1228 | function geodir_cf_file($html,$location,$cf,$p=''){ |
| 1229 | 1229 | |
| 1230 | - // check we have the post value |
|
| 1231 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1232 | - else{ global $post;} |
|
| 1233 | - |
|
| 1234 | - if(!is_array($cf) && $cf!=''){ |
|
| 1235 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1236 | - if(!$cf){return NULL;} |
|
| 1237 | - } |
|
| 1238 | - |
|
| 1239 | - $html_var = $cf['htmlvar_name']; |
|
| 1240 | - |
|
| 1241 | - // Check if there is a location specific filter. |
|
| 1242 | - if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1243 | - /** |
|
| 1244 | - * Filter the file html by location. |
|
| 1245 | - * |
|
| 1246 | - * @param string $html The html to filter. |
|
| 1247 | - * @param array $cf The custom field array. |
|
| 1248 | - * @since 1.6.6 |
|
| 1249 | - */ |
|
| 1250 | - $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1251 | - } |
|
| 1252 | - |
|
| 1253 | - // Check if there is a custom field specific filter. |
|
| 1254 | - if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1255 | - /** |
|
| 1256 | - * Filter the file html by individual custom field. |
|
| 1257 | - * |
|
| 1258 | - * @param string $html The html to filter. |
|
| 1259 | - * @param string $location The location to output the html. |
|
| 1260 | - * @param array $cf The custom field array. |
|
| 1261 | - * @since 1.6.6 |
|
| 1262 | - */ |
|
| 1263 | - $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1264 | - } |
|
| 1265 | - |
|
| 1266 | - // Check if there is a custom field key specific filter. |
|
| 1267 | - if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1268 | - /** |
|
| 1269 | - * Filter the file html by field type key. |
|
| 1270 | - * |
|
| 1271 | - * @param string $html The html to filter. |
|
| 1272 | - * @param string $location The location to output the html. |
|
| 1273 | - * @param array $cf The custom field array. |
|
| 1274 | - * @since 1.6.6 |
|
| 1275 | - */ |
|
| 1276 | - $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1277 | - } |
|
| 1278 | - |
|
| 1279 | - // If not html then we run the standard output. |
|
| 1280 | - if(empty($html)){ |
|
| 1281 | - |
|
| 1282 | - if (!empty($post->{$cf['htmlvar_name']})): |
|
| 1283 | - |
|
| 1284 | - $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
| 1285 | - if (!empty($files)): |
|
| 1286 | - |
|
| 1287 | - $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
| 1288 | - $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'] : ''; |
|
| 1289 | - |
|
| 1290 | - $file_paths = ''; |
|
| 1291 | - foreach ($files as $file) { |
|
| 1292 | - if (!empty($file)) { |
|
| 1293 | - |
|
| 1294 | - // $filetype = wp_check_filetype($file); |
|
| 1295 | - |
|
| 1296 | - $image_name_arr = explode('/', $file); |
|
| 1297 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1298 | - $filename = end($image_name_arr); |
|
| 1299 | - $img_name_arr = explode('.', $filename); |
|
| 1300 | - |
|
| 1301 | - $arr_file_type = wp_check_filetype($filename); |
|
| 1302 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
| 1303 | - continue; |
|
| 1304 | - } |
|
| 1305 | - |
|
| 1306 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 1307 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1308 | - |
|
| 1309 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
| 1310 | - continue; // Invalid file type. |
|
| 1311 | - } |
|
| 1312 | - |
|
| 1313 | - //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
| 1314 | - $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
| 1315 | - $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
| 1316 | - |
|
| 1317 | - // If the uploaded file is image |
|
| 1318 | - if (in_array($uploaded_file_type, $image_file_types)) { |
|
| 1319 | - $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 1320 | - $file_paths .= '<a href="'.$file.'">'; |
|
| 1321 | - $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
| 1322 | - $file_paths .= '</a>'; |
|
| 1323 | - //$file_paths .= '<img src="'.$file.'" />'; |
|
| 1324 | - $file_paths .= '</div>'; |
|
| 1325 | - }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
| 1326 | - $ext_path = '_' . $html_var . '_'; |
|
| 1327 | - $filename = explode($ext_path, $filename); |
|
| 1328 | - $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
|
| 1329 | - $file_paths .= do_shortcode('[audio src="'.$file.'" ]'); |
|
| 1330 | - } else { |
|
| 1331 | - $ext_path = '_' . $html_var . '_'; |
|
| 1332 | - $filename = explode($ext_path, $filename); |
|
| 1333 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1334 | - } |
|
| 1335 | - } |
|
| 1336 | - } |
|
| 1337 | - |
|
| 1338 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1339 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1340 | - $field_icon_af = ''; |
|
| 1341 | - } elseif ($field_icon == '') { |
|
| 1342 | - $field_icon_af = ''; |
|
| 1343 | - } else { |
|
| 1344 | - $field_icon_af = $field_icon; |
|
| 1345 | - $field_icon = ''; |
|
| 1346 | - } |
|
| 1347 | - |
|
| 1348 | - $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; |
|
| 1349 | - $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 1350 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1351 | - $html .= '</span>'; |
|
| 1352 | - $html .= $file_paths . '</div></div>'; |
|
| 1353 | - |
|
| 1354 | - endif; |
|
| 1355 | - endif; |
|
| 1356 | - |
|
| 1357 | - } |
|
| 1358 | - |
|
| 1359 | - return $html; |
|
| 1230 | + // check we have the post value |
|
| 1231 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1232 | + else{ global $post;} |
|
| 1233 | + |
|
| 1234 | + if(!is_array($cf) && $cf!=''){ |
|
| 1235 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1236 | + if(!$cf){return NULL;} |
|
| 1237 | + } |
|
| 1238 | + |
|
| 1239 | + $html_var = $cf['htmlvar_name']; |
|
| 1240 | + |
|
| 1241 | + // Check if there is a location specific filter. |
|
| 1242 | + if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1243 | + /** |
|
| 1244 | + * Filter the file html by location. |
|
| 1245 | + * |
|
| 1246 | + * @param string $html The html to filter. |
|
| 1247 | + * @param array $cf The custom field array. |
|
| 1248 | + * @since 1.6.6 |
|
| 1249 | + */ |
|
| 1250 | + $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1251 | + } |
|
| 1252 | + |
|
| 1253 | + // Check if there is a custom field specific filter. |
|
| 1254 | + if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1255 | + /** |
|
| 1256 | + * Filter the file html by individual custom field. |
|
| 1257 | + * |
|
| 1258 | + * @param string $html The html to filter. |
|
| 1259 | + * @param string $location The location to output the html. |
|
| 1260 | + * @param array $cf The custom field array. |
|
| 1261 | + * @since 1.6.6 |
|
| 1262 | + */ |
|
| 1263 | + $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1264 | + } |
|
| 1265 | + |
|
| 1266 | + // Check if there is a custom field key specific filter. |
|
| 1267 | + if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1268 | + /** |
|
| 1269 | + * Filter the file html by field type key. |
|
| 1270 | + * |
|
| 1271 | + * @param string $html The html to filter. |
|
| 1272 | + * @param string $location The location to output the html. |
|
| 1273 | + * @param array $cf The custom field array. |
|
| 1274 | + * @since 1.6.6 |
|
| 1275 | + */ |
|
| 1276 | + $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1277 | + } |
|
| 1278 | + |
|
| 1279 | + // If not html then we run the standard output. |
|
| 1280 | + if(empty($html)){ |
|
| 1281 | + |
|
| 1282 | + if (!empty($post->{$cf['htmlvar_name']})): |
|
| 1283 | + |
|
| 1284 | + $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
| 1285 | + if (!empty($files)): |
|
| 1286 | + |
|
| 1287 | + $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
| 1288 | + $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'] : ''; |
|
| 1289 | + |
|
| 1290 | + $file_paths = ''; |
|
| 1291 | + foreach ($files as $file) { |
|
| 1292 | + if (!empty($file)) { |
|
| 1293 | + |
|
| 1294 | + // $filetype = wp_check_filetype($file); |
|
| 1295 | + |
|
| 1296 | + $image_name_arr = explode('/', $file); |
|
| 1297 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1298 | + $filename = end($image_name_arr); |
|
| 1299 | + $img_name_arr = explode('.', $filename); |
|
| 1300 | + |
|
| 1301 | + $arr_file_type = wp_check_filetype($filename); |
|
| 1302 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
| 1303 | + continue; |
|
| 1304 | + } |
|
| 1305 | + |
|
| 1306 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 1307 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1308 | + |
|
| 1309 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
| 1310 | + continue; // Invalid file type. |
|
| 1311 | + } |
|
| 1312 | + |
|
| 1313 | + //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
| 1314 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
| 1315 | + $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
| 1316 | + |
|
| 1317 | + // If the uploaded file is image |
|
| 1318 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
| 1319 | + $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 1320 | + $file_paths .= '<a href="'.$file.'">'; |
|
| 1321 | + $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
| 1322 | + $file_paths .= '</a>'; |
|
| 1323 | + //$file_paths .= '<img src="'.$file.'" />'; |
|
| 1324 | + $file_paths .= '</div>'; |
|
| 1325 | + }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
| 1326 | + $ext_path = '_' . $html_var . '_'; |
|
| 1327 | + $filename = explode($ext_path, $filename); |
|
| 1328 | + $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
|
| 1329 | + $file_paths .= do_shortcode('[audio src="'.$file.'" ]'); |
|
| 1330 | + } else { |
|
| 1331 | + $ext_path = '_' . $html_var . '_'; |
|
| 1332 | + $filename = explode($ext_path, $filename); |
|
| 1333 | + $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1334 | + } |
|
| 1335 | + } |
|
| 1336 | + } |
|
| 1337 | + |
|
| 1338 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1339 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1340 | + $field_icon_af = ''; |
|
| 1341 | + } elseif ($field_icon == '') { |
|
| 1342 | + $field_icon_af = ''; |
|
| 1343 | + } else { |
|
| 1344 | + $field_icon_af = $field_icon; |
|
| 1345 | + $field_icon = ''; |
|
| 1346 | + } |
|
| 1347 | + |
|
| 1348 | + $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; |
|
| 1349 | + $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 1350 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1351 | + $html .= '</span>'; |
|
| 1352 | + $html .= $file_paths . '</div></div>'; |
|
| 1353 | + |
|
| 1354 | + endif; |
|
| 1355 | + endif; |
|
| 1356 | + |
|
| 1357 | + } |
|
| 1358 | + |
|
| 1359 | + return $html; |
|
| 1360 | 1360 | } |
| 1361 | 1361 | add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3); |
| 1362 | 1362 | |
@@ -1374,80 +1374,80 @@ discard block |
||
| 1374 | 1374 | */ |
| 1375 | 1375 | function geodir_cf_textarea($html,$location,$cf,$p=''){ |
| 1376 | 1376 | |
| 1377 | - // check we have the post value |
|
| 1378 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1379 | - else{ global $post;} |
|
| 1380 | - |
|
| 1381 | - if(!is_array($cf) && $cf!=''){ |
|
| 1382 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1383 | - if(!$cf){return NULL;} |
|
| 1384 | - } |
|
| 1385 | - |
|
| 1386 | - $html_var = $cf['htmlvar_name']; |
|
| 1387 | - |
|
| 1388 | - // Check if there is a location specific filter. |
|
| 1389 | - if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1390 | - /** |
|
| 1391 | - * Filter the textarea html by location. |
|
| 1392 | - * |
|
| 1393 | - * @param string $html The html to filter. |
|
| 1394 | - * @param array $cf The custom field array. |
|
| 1395 | - * @since 1.6.6 |
|
| 1396 | - */ |
|
| 1397 | - $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1398 | - } |
|
| 1399 | - |
|
| 1400 | - // Check if there is a custom field specific filter. |
|
| 1401 | - if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1402 | - /** |
|
| 1403 | - * Filter the textarea html by individual custom field. |
|
| 1404 | - * |
|
| 1405 | - * @param string $html The html to filter. |
|
| 1406 | - * @param string $location The location to output the html. |
|
| 1407 | - * @param array $cf The custom field array. |
|
| 1408 | - * @since 1.6.6 |
|
| 1409 | - */ |
|
| 1410 | - $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1411 | - } |
|
| 1412 | - |
|
| 1413 | - // Check if there is a custom field key specific filter. |
|
| 1414 | - if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1415 | - /** |
|
| 1416 | - * Filter the textarea html by field type key. |
|
| 1417 | - * |
|
| 1418 | - * @param string $html The html to filter. |
|
| 1419 | - * @param string $location The location to output the html. |
|
| 1420 | - * @param array $cf The custom field array. |
|
| 1421 | - * @since 1.6.6 |
|
| 1422 | - */ |
|
| 1423 | - $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1424 | - } |
|
| 1425 | - |
|
| 1426 | - // If not html then we run the standard output. |
|
| 1427 | - if(empty($html)){ |
|
| 1428 | - |
|
| 1429 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1430 | - |
|
| 1431 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1432 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1433 | - $field_icon_af = ''; |
|
| 1434 | - } elseif ($field_icon == '') { |
|
| 1435 | - $field_icon_af = ''; |
|
| 1436 | - } else { |
|
| 1437 | - $field_icon_af = $field_icon; |
|
| 1438 | - $field_icon = ''; |
|
| 1439 | - } |
|
| 1440 | - |
|
| 1441 | - |
|
| 1442 | - $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; |
|
| 1443 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1444 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1445 | - |
|
| 1446 | - } |
|
| 1447 | - |
|
| 1448 | - } |
|
| 1449 | - |
|
| 1450 | - return $html; |
|
| 1377 | + // check we have the post value |
|
| 1378 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1379 | + else{ global $post;} |
|
| 1380 | + |
|
| 1381 | + if(!is_array($cf) && $cf!=''){ |
|
| 1382 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1383 | + if(!$cf){return NULL;} |
|
| 1384 | + } |
|
| 1385 | + |
|
| 1386 | + $html_var = $cf['htmlvar_name']; |
|
| 1387 | + |
|
| 1388 | + // Check if there is a location specific filter. |
|
| 1389 | + if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1390 | + /** |
|
| 1391 | + * Filter the textarea html by location. |
|
| 1392 | + * |
|
| 1393 | + * @param string $html The html to filter. |
|
| 1394 | + * @param array $cf The custom field array. |
|
| 1395 | + * @since 1.6.6 |
|
| 1396 | + */ |
|
| 1397 | + $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1398 | + } |
|
| 1399 | + |
|
| 1400 | + // Check if there is a custom field specific filter. |
|
| 1401 | + if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1402 | + /** |
|
| 1403 | + * Filter the textarea html by individual custom field. |
|
| 1404 | + * |
|
| 1405 | + * @param string $html The html to filter. |
|
| 1406 | + * @param string $location The location to output the html. |
|
| 1407 | + * @param array $cf The custom field array. |
|
| 1408 | + * @since 1.6.6 |
|
| 1409 | + */ |
|
| 1410 | + $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1411 | + } |
|
| 1412 | + |
|
| 1413 | + // Check if there is a custom field key specific filter. |
|
| 1414 | + if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1415 | + /** |
|
| 1416 | + * Filter the textarea html by field type key. |
|
| 1417 | + * |
|
| 1418 | + * @param string $html The html to filter. |
|
| 1419 | + * @param string $location The location to output the html. |
|
| 1420 | + * @param array $cf The custom field array. |
|
| 1421 | + * @since 1.6.6 |
|
| 1422 | + */ |
|
| 1423 | + $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1424 | + } |
|
| 1425 | + |
|
| 1426 | + // If not html then we run the standard output. |
|
| 1427 | + if(empty($html)){ |
|
| 1428 | + |
|
| 1429 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1430 | + |
|
| 1431 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1432 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1433 | + $field_icon_af = ''; |
|
| 1434 | + } elseif ($field_icon == '') { |
|
| 1435 | + $field_icon_af = ''; |
|
| 1436 | + } else { |
|
| 1437 | + $field_icon_af = $field_icon; |
|
| 1438 | + $field_icon = ''; |
|
| 1439 | + } |
|
| 1440 | + |
|
| 1441 | + |
|
| 1442 | + $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; |
|
| 1443 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1444 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1445 | + |
|
| 1446 | + } |
|
| 1447 | + |
|
| 1448 | + } |
|
| 1449 | + |
|
| 1450 | + return $html; |
|
| 1451 | 1451 | } |
| 1452 | 1452 | add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3); |
| 1453 | 1453 | |
@@ -1465,79 +1465,79 @@ discard block |
||
| 1465 | 1465 | */ |
| 1466 | 1466 | function geodir_cf_html($html,$location,$cf,$p=''){ |
| 1467 | 1467 | |
| 1468 | - // check we have the post value |
|
| 1469 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1470 | - else{ global $post;} |
|
| 1471 | - |
|
| 1472 | - if(!is_array($cf) && $cf!=''){ |
|
| 1473 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1474 | - if(!$cf){return NULL;} |
|
| 1475 | - } |
|
| 1476 | - |
|
| 1477 | - $html_var = $cf['htmlvar_name']; |
|
| 1478 | - |
|
| 1479 | - // Check if there is a location specific filter. |
|
| 1480 | - if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1481 | - /** |
|
| 1482 | - * Filter the html html by location. |
|
| 1483 | - * |
|
| 1484 | - * @param string $html The html to filter. |
|
| 1485 | - * @param array $cf The custom field array. |
|
| 1486 | - * @since 1.6.6 |
|
| 1487 | - */ |
|
| 1488 | - $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1489 | - } |
|
| 1490 | - |
|
| 1491 | - // Check if there is a custom field specific filter. |
|
| 1492 | - if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1493 | - /** |
|
| 1494 | - * Filter the html html by individual custom field. |
|
| 1495 | - * |
|
| 1496 | - * @param string $html The html to filter. |
|
| 1497 | - * @param string $location The location to output the html. |
|
| 1498 | - * @param array $cf The custom field array. |
|
| 1499 | - * @since 1.6.6 |
|
| 1500 | - */ |
|
| 1501 | - $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1502 | - } |
|
| 1503 | - |
|
| 1504 | - // Check if there is a custom field key specific filter. |
|
| 1505 | - if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1506 | - /** |
|
| 1507 | - * Filter the html html by field type key. |
|
| 1508 | - * |
|
| 1509 | - * @param string $html The html to filter. |
|
| 1510 | - * @param string $location The location to output the html. |
|
| 1511 | - * @param array $cf The custom field array. |
|
| 1512 | - * @since 1.6.6 |
|
| 1513 | - */ |
|
| 1514 | - $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1515 | - } |
|
| 1516 | - |
|
| 1517 | - // If not html then we run the standard output. |
|
| 1518 | - if(empty($html)){ |
|
| 1519 | - |
|
| 1520 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1521 | - |
|
| 1522 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1523 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1524 | - $field_icon_af = ''; |
|
| 1525 | - } elseif ($field_icon == '') { |
|
| 1526 | - $field_icon_af = ''; |
|
| 1527 | - } else { |
|
| 1528 | - $field_icon_af = $field_icon; |
|
| 1529 | - $field_icon = ''; |
|
| 1530 | - } |
|
| 1531 | - |
|
| 1532 | - $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; |
|
| 1533 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1534 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1535 | - |
|
| 1536 | - } |
|
| 1537 | - |
|
| 1538 | - } |
|
| 1539 | - |
|
| 1540 | - return $html; |
|
| 1468 | + // check we have the post value |
|
| 1469 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1470 | + else{ global $post;} |
|
| 1471 | + |
|
| 1472 | + if(!is_array($cf) && $cf!=''){ |
|
| 1473 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1474 | + if(!$cf){return NULL;} |
|
| 1475 | + } |
|
| 1476 | + |
|
| 1477 | + $html_var = $cf['htmlvar_name']; |
|
| 1478 | + |
|
| 1479 | + // Check if there is a location specific filter. |
|
| 1480 | + if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1481 | + /** |
|
| 1482 | + * Filter the html html by location. |
|
| 1483 | + * |
|
| 1484 | + * @param string $html The html to filter. |
|
| 1485 | + * @param array $cf The custom field array. |
|
| 1486 | + * @since 1.6.6 |
|
| 1487 | + */ |
|
| 1488 | + $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1489 | + } |
|
| 1490 | + |
|
| 1491 | + // Check if there is a custom field specific filter. |
|
| 1492 | + if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1493 | + /** |
|
| 1494 | + * Filter the html html by individual custom field. |
|
| 1495 | + * |
|
| 1496 | + * @param string $html The html to filter. |
|
| 1497 | + * @param string $location The location to output the html. |
|
| 1498 | + * @param array $cf The custom field array. |
|
| 1499 | + * @since 1.6.6 |
|
| 1500 | + */ |
|
| 1501 | + $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1502 | + } |
|
| 1503 | + |
|
| 1504 | + // Check if there is a custom field key specific filter. |
|
| 1505 | + if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1506 | + /** |
|
| 1507 | + * Filter the html html by field type key. |
|
| 1508 | + * |
|
| 1509 | + * @param string $html The html to filter. |
|
| 1510 | + * @param string $location The location to output the html. |
|
| 1511 | + * @param array $cf The custom field array. |
|
| 1512 | + * @since 1.6.6 |
|
| 1513 | + */ |
|
| 1514 | + $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1515 | + } |
|
| 1516 | + |
|
| 1517 | + // If not html then we run the standard output. |
|
| 1518 | + if(empty($html)){ |
|
| 1519 | + |
|
| 1520 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1521 | + |
|
| 1522 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1523 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1524 | + $field_icon_af = ''; |
|
| 1525 | + } elseif ($field_icon == '') { |
|
| 1526 | + $field_icon_af = ''; |
|
| 1527 | + } else { |
|
| 1528 | + $field_icon_af = $field_icon; |
|
| 1529 | + $field_icon = ''; |
|
| 1530 | + } |
|
| 1531 | + |
|
| 1532 | + $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; |
|
| 1533 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1534 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1535 | + |
|
| 1536 | + } |
|
| 1537 | + |
|
| 1538 | + } |
|
| 1539 | + |
|
| 1540 | + return $html; |
|
| 1541 | 1541 | } |
| 1542 | 1542 | add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3); |
| 1543 | 1543 | |
@@ -1555,113 +1555,113 @@ discard block |
||
| 1555 | 1555 | */ |
| 1556 | 1556 | function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
| 1557 | 1557 | |
| 1558 | - // check we have the post value |
|
| 1559 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1560 | - else{ global $post;} |
|
| 1561 | - |
|
| 1562 | - if(!is_array($cf) && $cf!=''){ |
|
| 1563 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1564 | - if(!$cf){return NULL;} |
|
| 1565 | - } |
|
| 1566 | - |
|
| 1567 | - $html_var = $cf['htmlvar_name']; |
|
| 1568 | - |
|
| 1569 | - // Check if there is a location specific filter. |
|
| 1570 | - if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1571 | - /** |
|
| 1572 | - * Filter the taxonomy html by location. |
|
| 1573 | - * |
|
| 1574 | - * @param string $html The html to filter. |
|
| 1575 | - * @param array $cf The custom field array. |
|
| 1576 | - * @since 1.6.6 |
|
| 1577 | - */ |
|
| 1578 | - $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1579 | - } |
|
| 1580 | - |
|
| 1581 | - // Check if there is a custom field specific filter. |
|
| 1582 | - if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1583 | - /** |
|
| 1584 | - * Filter the taxonomy html by individual custom field. |
|
| 1585 | - * |
|
| 1586 | - * @param string $html The html to filter. |
|
| 1587 | - * @param string $location The location to output the html. |
|
| 1588 | - * @param array $cf The custom field array. |
|
| 1589 | - * @since 1.6.6 |
|
| 1590 | - */ |
|
| 1591 | - $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1592 | - } |
|
| 1593 | - |
|
| 1594 | - // Check if there is a custom field key specific filter. |
|
| 1595 | - if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1596 | - /** |
|
| 1597 | - * Filter the taxonomy html by field type key. |
|
| 1598 | - * |
|
| 1599 | - * @param string $html The html to filter. |
|
| 1600 | - * @param string $location The location to output the html. |
|
| 1601 | - * @param array $cf The custom field array. |
|
| 1602 | - * @since 1.6.6 |
|
| 1603 | - */ |
|
| 1604 | - $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1605 | - } |
|
| 1606 | - |
|
| 1607 | - // If not html then we run the standard output. |
|
| 1608 | - if(empty($html)){ |
|
| 1609 | - |
|
| 1610 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1611 | - $post_taxonomy = $post->post_type . 'category'; |
|
| 1612 | - $field_value = $post->{$html_var}; |
|
| 1613 | - $links = array(); |
|
| 1614 | - $terms = array(); |
|
| 1615 | - $termsOrdered = array(); |
|
| 1616 | - if (!is_array($field_value)) { |
|
| 1617 | - $field_value = explode(",", trim($field_value, ",")); |
|
| 1618 | - } |
|
| 1619 | - |
|
| 1620 | - $field_value = array_unique($field_value); |
|
| 1621 | - |
|
| 1622 | - if (!empty($field_value)) { |
|
| 1623 | - foreach ($field_value as $term) { |
|
| 1624 | - $term = trim($term); |
|
| 1625 | - |
|
| 1626 | - if ($term != '') { |
|
| 1627 | - $term = get_term_by('id', $term, $html_var); |
|
| 1628 | - if (is_object($term)) { |
|
| 1629 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1630 | - $terms[] = $term; |
|
| 1631 | - } |
|
| 1632 | - } |
|
| 1633 | - } |
|
| 1634 | - if (!empty($links)) { |
|
| 1635 | - // order alphabetically |
|
| 1636 | - asort($links); |
|
| 1637 | - foreach (array_keys($links) as $key) { |
|
| 1638 | - $termsOrdered[$key] = $terms[$key]; |
|
| 1639 | - } |
|
| 1640 | - $terms = $termsOrdered; |
|
| 1641 | - } |
|
| 1642 | - } |
|
| 1643 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1644 | - |
|
| 1645 | - if ($html_value != '') { |
|
| 1646 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1647 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1648 | - $field_icon_af = ''; |
|
| 1649 | - } else if ($field_icon == '') { |
|
| 1650 | - $field_icon_af = ''; |
|
| 1651 | - } else { |
|
| 1652 | - $field_icon_af = $field_icon; |
|
| 1653 | - $field_icon = ''; |
|
| 1654 | - } |
|
| 1655 | - |
|
| 1656 | - $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; |
|
| 1657 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1658 | - $html .= '</span> ' . $html_value . '</div>'; |
|
| 1659 | - } |
|
| 1660 | - } |
|
| 1661 | - |
|
| 1662 | - } |
|
| 1663 | - |
|
| 1664 | - return $html; |
|
| 1558 | + // check we have the post value |
|
| 1559 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1560 | + else{ global $post;} |
|
| 1561 | + |
|
| 1562 | + if(!is_array($cf) && $cf!=''){ |
|
| 1563 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1564 | + if(!$cf){return NULL;} |
|
| 1565 | + } |
|
| 1566 | + |
|
| 1567 | + $html_var = $cf['htmlvar_name']; |
|
| 1568 | + |
|
| 1569 | + // Check if there is a location specific filter. |
|
| 1570 | + if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1571 | + /** |
|
| 1572 | + * Filter the taxonomy html by location. |
|
| 1573 | + * |
|
| 1574 | + * @param string $html The html to filter. |
|
| 1575 | + * @param array $cf The custom field array. |
|
| 1576 | + * @since 1.6.6 |
|
| 1577 | + */ |
|
| 1578 | + $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1579 | + } |
|
| 1580 | + |
|
| 1581 | + // Check if there is a custom field specific filter. |
|
| 1582 | + if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1583 | + /** |
|
| 1584 | + * Filter the taxonomy html by individual custom field. |
|
| 1585 | + * |
|
| 1586 | + * @param string $html The html to filter. |
|
| 1587 | + * @param string $location The location to output the html. |
|
| 1588 | + * @param array $cf The custom field array. |
|
| 1589 | + * @since 1.6.6 |
|
| 1590 | + */ |
|
| 1591 | + $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1592 | + } |
|
| 1593 | + |
|
| 1594 | + // Check if there is a custom field key specific filter. |
|
| 1595 | + if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1596 | + /** |
|
| 1597 | + * Filter the taxonomy html by field type key. |
|
| 1598 | + * |
|
| 1599 | + * @param string $html The html to filter. |
|
| 1600 | + * @param string $location The location to output the html. |
|
| 1601 | + * @param array $cf The custom field array. |
|
| 1602 | + * @since 1.6.6 |
|
| 1603 | + */ |
|
| 1604 | + $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1605 | + } |
|
| 1606 | + |
|
| 1607 | + // If not html then we run the standard output. |
|
| 1608 | + if(empty($html)){ |
|
| 1609 | + |
|
| 1610 | + if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1611 | + $post_taxonomy = $post->post_type . 'category'; |
|
| 1612 | + $field_value = $post->{$html_var}; |
|
| 1613 | + $links = array(); |
|
| 1614 | + $terms = array(); |
|
| 1615 | + $termsOrdered = array(); |
|
| 1616 | + if (!is_array($field_value)) { |
|
| 1617 | + $field_value = explode(",", trim($field_value, ",")); |
|
| 1618 | + } |
|
| 1619 | + |
|
| 1620 | + $field_value = array_unique($field_value); |
|
| 1621 | + |
|
| 1622 | + if (!empty($field_value)) { |
|
| 1623 | + foreach ($field_value as $term) { |
|
| 1624 | + $term = trim($term); |
|
| 1625 | + |
|
| 1626 | + if ($term != '') { |
|
| 1627 | + $term = get_term_by('id', $term, $html_var); |
|
| 1628 | + if (is_object($term)) { |
|
| 1629 | + $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1630 | + $terms[] = $term; |
|
| 1631 | + } |
|
| 1632 | + } |
|
| 1633 | + } |
|
| 1634 | + if (!empty($links)) { |
|
| 1635 | + // order alphabetically |
|
| 1636 | + asort($links); |
|
| 1637 | + foreach (array_keys($links) as $key) { |
|
| 1638 | + $termsOrdered[$key] = $terms[$key]; |
|
| 1639 | + } |
|
| 1640 | + $terms = $termsOrdered; |
|
| 1641 | + } |
|
| 1642 | + } |
|
| 1643 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1644 | + |
|
| 1645 | + if ($html_value != '') { |
|
| 1646 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1647 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1648 | + $field_icon_af = ''; |
|
| 1649 | + } else if ($field_icon == '') { |
|
| 1650 | + $field_icon_af = ''; |
|
| 1651 | + } else { |
|
| 1652 | + $field_icon_af = $field_icon; |
|
| 1653 | + $field_icon = ''; |
|
| 1654 | + } |
|
| 1655 | + |
|
| 1656 | + $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; |
|
| 1657 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1658 | + $html .= '</span> ' . $html_value . '</div>'; |
|
| 1659 | + } |
|
| 1660 | + } |
|
| 1661 | + |
|
| 1662 | + } |
|
| 1663 | + |
|
| 1664 | + return $html; |
|
| 1665 | 1665 | } |
| 1666 | 1666 | add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3); |
| 1667 | 1667 | |
@@ -1678,161 +1678,161 @@ discard block |
||
| 1678 | 1678 | */ |
| 1679 | 1679 | function geodir_cf_address($html,$location,$cf,$p=''){ |
| 1680 | 1680 | |
| 1681 | - // check we have the post value |
|
| 1682 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1683 | - else{ global $post;} |
|
| 1684 | - |
|
| 1685 | - if(!is_array($cf) && $cf!=''){ |
|
| 1686 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1687 | - if(!$cf){return NULL;} |
|
| 1688 | - } |
|
| 1689 | - |
|
| 1690 | - $html_var = $cf['htmlvar_name']; |
|
| 1691 | - |
|
| 1692 | - // Check if there is a location specific filter. |
|
| 1693 | - if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1694 | - /** |
|
| 1695 | - * Filter the address html by location. |
|
| 1696 | - * |
|
| 1697 | - * @param string $html The html to filter. |
|
| 1698 | - * @param array $cf The custom field array. |
|
| 1699 | - * @since 1.6.6 |
|
| 1700 | - */ |
|
| 1701 | - $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1702 | - } |
|
| 1703 | - |
|
| 1704 | - // Check if there is a custom field specific filter. |
|
| 1705 | - if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1706 | - /** |
|
| 1707 | - * Filter the address html by individual custom field. |
|
| 1708 | - * |
|
| 1709 | - * @param string $html The html to filter. |
|
| 1710 | - * @param string $location The location to output the html. |
|
| 1711 | - * @param array $cf The custom field array. |
|
| 1712 | - * @since 1.6.6 |
|
| 1713 | - */ |
|
| 1714 | - $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1715 | - } |
|
| 1716 | - |
|
| 1717 | - // Check if there is a custom field key specific filter. |
|
| 1718 | - if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1719 | - /** |
|
| 1720 | - * Filter the address html by field type key. |
|
| 1721 | - * |
|
| 1722 | - * @param string $html The html to filter. |
|
| 1723 | - * @param string $location The location to output the html. |
|
| 1724 | - * @param array $cf The custom field array. |
|
| 1725 | - * @since 1.6.6 |
|
| 1726 | - */ |
|
| 1727 | - $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1728 | - } |
|
| 1729 | - |
|
| 1730 | - // If not html then we run the standard output. |
|
| 1731 | - if(empty($html)){ |
|
| 1732 | - |
|
| 1733 | - global $preview; |
|
| 1734 | - $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1735 | - |
|
| 1736 | - if ($cf['extra_fields']) { |
|
| 1737 | - |
|
| 1738 | - $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1739 | - |
|
| 1740 | - $addition_fields = ''; |
|
| 1741 | - |
|
| 1742 | - if (!empty($extra_fields)) { |
|
| 1743 | - |
|
| 1744 | - $show_city_in_address = false; |
|
| 1745 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
| 1746 | - $show_city_in_address = true; |
|
| 1747 | - } |
|
| 1748 | - /** |
|
| 1749 | - * Filter "show city in address" value. |
|
| 1750 | - * |
|
| 1751 | - * @since 1.0.0 |
|
| 1752 | - */ |
|
| 1753 | - $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
| 1754 | - |
|
| 1755 | - |
|
| 1756 | - $show_region_in_address = false; |
|
| 1757 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
| 1758 | - $show_region_in_address = true; |
|
| 1759 | - } |
|
| 1760 | - /** |
|
| 1761 | - * Filter "show region in address" value. |
|
| 1762 | - * |
|
| 1763 | - * @since 1.6.6 |
|
| 1764 | - */ |
|
| 1765 | - $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
| 1766 | - |
|
| 1767 | - $show_country_in_address = false; |
|
| 1768 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
| 1769 | - $show_country_in_address = true; |
|
| 1770 | - } |
|
| 1771 | - /** |
|
| 1772 | - * Filter "show country in address" value. |
|
| 1773 | - * |
|
| 1774 | - * @since 1.6.6 |
|
| 1775 | - */ |
|
| 1776 | - $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
| 1777 | - |
|
| 1778 | - $show_zip_in_address = false; |
|
| 1779 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 1780 | - $show_zip_in_address = true; |
|
| 1781 | - } |
|
| 1782 | - /** |
|
| 1783 | - * Filter "show zip in address" value. |
|
| 1784 | - * |
|
| 1785 | - * @since 1.6.6 |
|
| 1786 | - */ |
|
| 1787 | - $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
| 1788 | - |
|
| 1789 | - |
|
| 1790 | - } |
|
| 1791 | - |
|
| 1792 | - } |
|
| 1793 | - |
|
| 1794 | - |
|
| 1795 | - if ($post->{$html_var}) { |
|
| 1796 | - |
|
| 1797 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1798 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1799 | - $field_icon_af = ''; |
|
| 1800 | - } elseif ( $field_icon == '' ) { |
|
| 1801 | - $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 1802 | - } else { |
|
| 1803 | - $field_icon_af = $field_icon; |
|
| 1804 | - $field_icon = ''; |
|
| 1805 | - } |
|
| 1681 | + // check we have the post value |
|
| 1682 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1683 | + else{ global $post;} |
|
| 1684 | + |
|
| 1685 | + if(!is_array($cf) && $cf!=''){ |
|
| 1686 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1687 | + if(!$cf){return NULL;} |
|
| 1688 | + } |
|
| 1689 | + |
|
| 1690 | + $html_var = $cf['htmlvar_name']; |
|
| 1691 | + |
|
| 1692 | + // Check if there is a location specific filter. |
|
| 1693 | + if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1694 | + /** |
|
| 1695 | + * Filter the address html by location. |
|
| 1696 | + * |
|
| 1697 | + * @param string $html The html to filter. |
|
| 1698 | + * @param array $cf The custom field array. |
|
| 1699 | + * @since 1.6.6 |
|
| 1700 | + */ |
|
| 1701 | + $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1702 | + } |
|
| 1703 | + |
|
| 1704 | + // Check if there is a custom field specific filter. |
|
| 1705 | + if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1706 | + /** |
|
| 1707 | + * Filter the address html by individual custom field. |
|
| 1708 | + * |
|
| 1709 | + * @param string $html The html to filter. |
|
| 1710 | + * @param string $location The location to output the html. |
|
| 1711 | + * @param array $cf The custom field array. |
|
| 1712 | + * @since 1.6.6 |
|
| 1713 | + */ |
|
| 1714 | + $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1715 | + } |
|
| 1716 | + |
|
| 1717 | + // Check if there is a custom field key specific filter. |
|
| 1718 | + if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1719 | + /** |
|
| 1720 | + * Filter the address html by field type key. |
|
| 1721 | + * |
|
| 1722 | + * @param string $html The html to filter. |
|
| 1723 | + * @param string $location The location to output the html. |
|
| 1724 | + * @param array $cf The custom field array. |
|
| 1725 | + * @since 1.6.6 |
|
| 1726 | + */ |
|
| 1727 | + $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1728 | + } |
|
| 1729 | + |
|
| 1730 | + // If not html then we run the standard output. |
|
| 1731 | + if(empty($html)){ |
|
| 1732 | + |
|
| 1733 | + global $preview; |
|
| 1734 | + $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1735 | + |
|
| 1736 | + if ($cf['extra_fields']) { |
|
| 1737 | + |
|
| 1738 | + $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1739 | + |
|
| 1740 | + $addition_fields = ''; |
|
| 1741 | + |
|
| 1742 | + if (!empty($extra_fields)) { |
|
| 1743 | + |
|
| 1744 | + $show_city_in_address = false; |
|
| 1745 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
| 1746 | + $show_city_in_address = true; |
|
| 1747 | + } |
|
| 1748 | + /** |
|
| 1749 | + * Filter "show city in address" value. |
|
| 1750 | + * |
|
| 1751 | + * @since 1.0.0 |
|
| 1752 | + */ |
|
| 1753 | + $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
| 1754 | + |
|
| 1755 | + |
|
| 1756 | + $show_region_in_address = false; |
|
| 1757 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
| 1758 | + $show_region_in_address = true; |
|
| 1759 | + } |
|
| 1760 | + /** |
|
| 1761 | + * Filter "show region in address" value. |
|
| 1762 | + * |
|
| 1763 | + * @since 1.6.6 |
|
| 1764 | + */ |
|
| 1765 | + $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
| 1766 | + |
|
| 1767 | + $show_country_in_address = false; |
|
| 1768 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
| 1769 | + $show_country_in_address = true; |
|
| 1770 | + } |
|
| 1771 | + /** |
|
| 1772 | + * Filter "show country in address" value. |
|
| 1773 | + * |
|
| 1774 | + * @since 1.6.6 |
|
| 1775 | + */ |
|
| 1776 | + $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
| 1777 | + |
|
| 1778 | + $show_zip_in_address = false; |
|
| 1779 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 1780 | + $show_zip_in_address = true; |
|
| 1781 | + } |
|
| 1782 | + /** |
|
| 1783 | + * Filter "show zip in address" value. |
|
| 1784 | + * |
|
| 1785 | + * @since 1.6.6 |
|
| 1786 | + */ |
|
| 1787 | + $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
| 1788 | + |
|
| 1789 | + |
|
| 1790 | + } |
|
| 1791 | + |
|
| 1792 | + } |
|
| 1793 | + |
|
| 1794 | + |
|
| 1795 | + if ($post->{$html_var}) { |
|
| 1796 | + |
|
| 1797 | + $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1798 | + if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1799 | + $field_icon_af = ''; |
|
| 1800 | + } elseif ( $field_icon == '' ) { |
|
| 1801 | + $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 1802 | + } else { |
|
| 1803 | + $field_icon_af = $field_icon; |
|
| 1804 | + $field_icon = ''; |
|
| 1805 | + } |
|
| 1806 | 1806 | |
| 1807 | 1807 | |
| 1808 | 1808 | |
| 1809 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1810 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1811 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
| 1812 | - $html .= '</span>'; |
|
| 1809 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1810 | + $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1811 | + $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
| 1812 | + $html .= '</span>'; |
|
| 1813 | 1813 | |
| 1814 | - if ( isset($post->post_address) ) { |
|
| 1815 | - $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 1816 | - } |
|
| 1817 | - if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1818 | - $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 1819 | - } |
|
| 1820 | - if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1821 | - $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 1822 | - } |
|
| 1823 | - if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1824 | - $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 1825 | - } |
|
| 1826 | - if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1827 | - $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>'; |
|
| 1828 | - } |
|
| 1829 | - $html .= '</div>'; |
|
| 1814 | + if ( isset($post->post_address) ) { |
|
| 1815 | + $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 1816 | + } |
|
| 1817 | + if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1818 | + $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 1819 | + } |
|
| 1820 | + if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1821 | + $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 1822 | + } |
|
| 1823 | + if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1824 | + $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 1825 | + } |
|
| 1826 | + if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1827 | + $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>'; |
|
| 1828 | + } |
|
| 1829 | + $html .= '</div>'; |
|
| 1830 | 1830 | |
| 1831 | - } |
|
| 1831 | + } |
|
| 1832 | 1832 | |
| 1833 | - } |
|
| 1833 | + } |
|
| 1834 | 1834 | |
| 1835 | 1835 | |
| 1836 | - return $html; |
|
| 1836 | + return $html; |
|
| 1837 | 1837 | } |
| 1838 | 1838 | add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3); |
| 1839 | 1839 | \ No newline at end of file |
@@ -19,21 +19,21 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @return string The html to output for the custom field. |
| 21 | 21 | */ |
| 22 | -function geodir_cf_checkbox($html,$location,$cf,$p=''){ |
|
| 22 | +function geodir_cf_checkbox($html, $location, $cf, $p = '') { |
|
| 23 | 23 | |
| 24 | 24 | // check we have the post value |
| 25 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 26 | - else{ global $post;} |
|
| 25 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 26 | + else { global $post; } |
|
| 27 | 27 | |
| 28 | - if(!is_array($cf) && $cf!=''){ |
|
| 28 | + if (!is_array($cf) && $cf != '') { |
|
| 29 | 29 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 30 | - if(!$cf){return NULL;} |
|
| 30 | + if (!$cf) {return NULL; } |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $html_var = $cf['htmlvar_name']; |
| 34 | 34 | |
| 35 | 35 | // Check if there is a location specific filter. |
| 36 | - if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){ |
|
| 36 | + if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) { |
|
| 37 | 37 | /** |
| 38 | 38 | * Filter the checkbox html by location. |
| 39 | 39 | * |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | * @param array $cf The custom field array. |
| 42 | 42 | * @since 1.6.6 |
| 43 | 43 | */ |
| 44 | - $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf); |
|
| 44 | + $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Check if there is a custom field specific filter. |
| 48 | - if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){ |
|
| 48 | + if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) { |
|
| 49 | 49 | /** |
| 50 | 50 | * Filter the checkbox html by individual custom field. |
| 51 | 51 | * |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | * @param array $cf The custom field array. |
| 55 | 55 | * @since 1.6.6 |
| 56 | 56 | */ |
| 57 | - $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf); |
|
| 57 | + $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Check if there is a custom field key specific filter. |
| 61 | - if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){ |
|
| 61 | + if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) { |
|
| 62 | 62 | /** |
| 63 | 63 | * Filter the checkbox html by field type key. |
| 64 | 64 | * |
@@ -67,18 +67,18 @@ discard block |
||
| 67 | 67 | * @param array $cf The custom field array. |
| 68 | 68 | * @since 1.6.6 |
| 69 | 69 | */ |
| 70 | - $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 70 | + $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // If not html then we run the standard output. |
| 74 | - if(empty($html)){ |
|
| 74 | + if (empty($html)) { |
|
| 75 | 75 | |
| 76 | - if ( (int) $post->{$html_var} == 1 ): |
|
| 76 | + if ((int) $post->{$html_var} == 1): |
|
| 77 | 77 | |
| 78 | - if ( $post->{$html_var} == '1' ): |
|
| 79 | - $html_val = __( 'Yes', 'geodirectory' ); |
|
| 78 | + if ($post->{$html_var} == '1'): |
|
| 79 | + $html_val = __('Yes', 'geodirectory'); |
|
| 80 | 80 | else: |
| 81 | - $html_val = __( 'No', 'geodirectory' ); |
|
| 81 | + $html_val = __('No', 'geodirectory'); |
|
| 82 | 82 | endif; |
| 83 | 83 | |
| 84 | 84 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | $field_icon = ''; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af; |
|
| 95 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ''; |
|
| 96 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 94 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af; |
|
| 95 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 96 | + $html .= '</span>'.$html_val.'</div>'; |
|
| 97 | 97 | endif; |
| 98 | 98 | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return $html; |
| 102 | 102 | } |
| 103 | -add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3); |
|
| 103 | +add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3); |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -113,21 +113,21 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return string The html to output for the custom field. |
| 115 | 115 | */ |
| 116 | -function geodir_cf_fieldset($html,$location,$cf,$p=''){ |
|
| 116 | +function geodir_cf_fieldset($html, $location, $cf, $p = '') { |
|
| 117 | 117 | |
| 118 | 118 | // check we have the post value |
| 119 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 120 | - else{ global $post;} |
|
| 119 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 120 | + else { global $post; } |
|
| 121 | 121 | |
| 122 | - if(!is_array($cf) && $cf!=''){ |
|
| 122 | + if (!is_array($cf) && $cf != '') { |
|
| 123 | 123 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 124 | - if(!$cf){return NULL;} |
|
| 124 | + if (!$cf) {return NULL; } |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $html_var = $cf['htmlvar_name']; |
| 128 | 128 | |
| 129 | 129 | // Check if there is a location specific filter. |
| 130 | - if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){ |
|
| 130 | + if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) { |
|
| 131 | 131 | /** |
| 132 | 132 | * Filter the fieldset html by location. |
| 133 | 133 | * |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | * @param array $cf The custom field array. |
| 136 | 136 | * @since 1.6.6 |
| 137 | 137 | */ |
| 138 | - $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf); |
|
| 138 | + $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // Check if there is a custom field specific filter. |
| 142 | - if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){ |
|
| 142 | + if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) { |
|
| 143 | 143 | /** |
| 144 | 144 | * Filter the fieldset html by individual custom field. |
| 145 | 145 | * |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | * @param array $cf The custom field array. |
| 149 | 149 | * @since 1.6.6 |
| 150 | 150 | */ |
| 151 | - $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf); |
|
| 151 | + $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Check if there is a custom field key specific filter. |
| 155 | - if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){ |
|
| 155 | + if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) { |
|
| 156 | 156 | /** |
| 157 | 157 | * Filter the fieldset html by field type key. |
| 158 | 158 | * |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | * @param array $cf The custom field array. |
| 162 | 162 | * @since 1.6.6 |
| 163 | 163 | */ |
| 164 | - $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 164 | + $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // If not html then we run the standard output. |
| 168 | - if(empty($html)){ |
|
| 168 | + if (empty($html)) { |
|
| 169 | 169 | |
| 170 | 170 | global $field_set_start; |
| 171 | 171 | $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | if ($field_set_start == 1) { |
| 174 | 174 | $html = ''; |
| 175 | 175 | } else { |
| 176 | - $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>'; |
|
| 176 | + $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>'; |
|
| 177 | 177 | //$field_set_start = 1; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | return $html; |
| 183 | 183 | } |
| 184 | -add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3); |
|
| 184 | +add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3); |
|
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -194,21 +194,21 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return string The html to output for the custom field. |
| 196 | 196 | */ |
| 197 | -function geodir_cf_url($html,$location,$cf,$p=''){ |
|
| 197 | +function geodir_cf_url($html, $location, $cf, $p = '') { |
|
| 198 | 198 | |
| 199 | 199 | // check we have the post value |
| 200 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 201 | - else{ global $post;} |
|
| 200 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 201 | + else { global $post; } |
|
| 202 | 202 | |
| 203 | - if(!is_array($cf) && $cf!=''){ |
|
| 203 | + if (!is_array($cf) && $cf != '') { |
|
| 204 | 204 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 205 | - if(!$cf){return NULL;} |
|
| 205 | + if (!$cf) {return NULL; } |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | $html_var = $cf['htmlvar_name']; |
| 209 | 209 | |
| 210 | 210 | // Check if there is a location specific filter. |
| 211 | - if(has_filter("geodir_custom_field_output_url_loc_{$location}")){ |
|
| 211 | + if (has_filter("geodir_custom_field_output_url_loc_{$location}")) { |
|
| 212 | 212 | /** |
| 213 | 213 | * Filter the url html by location. |
| 214 | 214 | * |
@@ -216,11 +216,11 @@ discard block |
||
| 216 | 216 | * @param array $cf The custom field array. |
| 217 | 217 | * @since 1.6.6 |
| 218 | 218 | */ |
| 219 | - $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf); |
|
| 219 | + $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // Check if there is a custom field specific filter. |
| 223 | - if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){ |
|
| 223 | + if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) { |
|
| 224 | 224 | /** |
| 225 | 225 | * Filter the url html by individual custom field. |
| 226 | 226 | * |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | * @param array $cf The custom field array. |
| 230 | 230 | * @since 1.6.6 |
| 231 | 231 | */ |
| 232 | - $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf); |
|
| 232 | + $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // Check if there is a custom field key specific filter. |
| 236 | - if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){ |
|
| 236 | + if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) { |
|
| 237 | 237 | /** |
| 238 | 238 | * Filter the url html by field type key. |
| 239 | 239 | * |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | * @param array $cf The custom field array. |
| 243 | 243 | * @since 1.6.6 |
| 244 | 244 | */ |
| 245 | - $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 245 | + $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // If not html then we run the standard output. |
| 249 | - if(empty($html)){ |
|
| 249 | + if (empty($html)) { |
|
| 250 | 250 | |
| 251 | 251 | if ($post->{$cf['htmlvar_name']}): |
| 252 | 252 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
| 275 | 275 | $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title']; |
| 276 | - if(!empty($cf['default_value'])){$title = $cf['default_value'];} |
|
| 276 | + if (!empty($cf['default_value'])) {$title = $cf['default_value']; } |
|
| 277 | 277 | $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
| 278 | 278 | |
| 279 | 279 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * @param string $website Website URL. |
| 290 | 290 | * @param int $post->ID Post ID. |
| 291 | 291 | */ |
| 292 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>'; |
|
| 292 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>'; |
|
| 293 | 293 | |
| 294 | 294 | endif; |
| 295 | 295 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | return $html; |
| 299 | 299 | } |
| 300 | -add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3); |
|
| 300 | +add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3); |
|
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -310,21 +310,21 @@ discard block |
||
| 310 | 310 | * |
| 311 | 311 | * @return string The html to output for the custom field. |
| 312 | 312 | */ |
| 313 | -function geodir_cf_phone($html,$location,$cf,$p=''){ |
|
| 313 | +function geodir_cf_phone($html, $location, $cf, $p = '') { |
|
| 314 | 314 | |
| 315 | 315 | // check we have the post value |
| 316 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 317 | - else{ global $post;} |
|
| 316 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 317 | + else { global $post; } |
|
| 318 | 318 | |
| 319 | - if(!is_array($cf) && $cf!=''){ |
|
| 319 | + if (!is_array($cf) && $cf != '') { |
|
| 320 | 320 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 321 | - if(!$cf){return NULL;} |
|
| 321 | + if (!$cf) {return NULL; } |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | $html_var = $cf['htmlvar_name']; |
| 325 | 325 | |
| 326 | 326 | // Check if there is a location specific filter. |
| 327 | - if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){ |
|
| 327 | + if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) { |
|
| 328 | 328 | /** |
| 329 | 329 | * Filter the phone html by location. |
| 330 | 330 | * |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | * @param array $cf The custom field array. |
| 333 | 333 | * @since 1.6.6 |
| 334 | 334 | */ |
| 335 | - $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf); |
|
| 335 | + $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | // Check if there is a custom field specific filter. |
| 339 | - if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){ |
|
| 339 | + if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) { |
|
| 340 | 340 | /** |
| 341 | 341 | * Filter the phone html by individual custom field. |
| 342 | 342 | * |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | * @param array $cf The custom field array. |
| 346 | 346 | * @since 1.6.6 |
| 347 | 347 | */ |
| 348 | - $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf); |
|
| 348 | + $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | // Check if there is a custom field key specific filter. |
| 352 | - if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){ |
|
| 352 | + if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) { |
|
| 353 | 353 | /** |
| 354 | 354 | * Filter the phone html by field type key. |
| 355 | 355 | * |
@@ -358,11 +358,11 @@ discard block |
||
| 358 | 358 | * @param array $cf The custom field array. |
| 359 | 359 | * @since 1.6.6 |
| 360 | 360 | */ |
| 361 | - $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 361 | + $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | // If not html then we run the standard output. |
| 365 | - if(empty($html)){ |
|
| 365 | + if (empty($html)) { |
|
| 366 | 366 | |
| 367 | 367 | if ($post->{$cf['htmlvar_name']}): |
| 368 | 368 | |
@@ -377,9 +377,9 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | |
| 380 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af . |
|
| 381 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 382 | - $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>'; |
|
| 380 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af. |
|
| 381 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ' '; |
|
| 382 | + $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>'; |
|
| 383 | 383 | |
| 384 | 384 | endif; |
| 385 | 385 | |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | return $html; |
| 389 | 389 | } |
| 390 | -add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3); |
|
| 390 | +add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3); |
|
| 391 | 391 | |
| 392 | 392 | |
| 393 | 393 | /** |
@@ -400,21 +400,21 @@ discard block |
||
| 400 | 400 | * |
| 401 | 401 | * @return string The html to output for the custom field. |
| 402 | 402 | */ |
| 403 | -function geodir_cf_time($html,$location,$cf,$p=''){ |
|
| 403 | +function geodir_cf_time($html, $location, $cf, $p = '') { |
|
| 404 | 404 | |
| 405 | 405 | // check we have the post value |
| 406 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 407 | - else{ global $post;} |
|
| 406 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 407 | + else { global $post; } |
|
| 408 | 408 | |
| 409 | - if(!is_array($cf) && $cf!=''){ |
|
| 409 | + if (!is_array($cf) && $cf != '') { |
|
| 410 | 410 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 411 | - if(!$cf){return NULL;} |
|
| 411 | + if (!$cf) {return NULL; } |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | $html_var = $cf['htmlvar_name']; |
| 415 | 415 | |
| 416 | 416 | // Check if there is a location specific filter. |
| 417 | - if(has_filter("geodir_custom_field_output_time_loc_{$location}")){ |
|
| 417 | + if (has_filter("geodir_custom_field_output_time_loc_{$location}")) { |
|
| 418 | 418 | /** |
| 419 | 419 | * Filter the time html by location. |
| 420 | 420 | * |
@@ -422,11 +422,11 @@ discard block |
||
| 422 | 422 | * @param array $cf The custom field array. |
| 423 | 423 | * @since 1.6.6 |
| 424 | 424 | */ |
| 425 | - $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf); |
|
| 425 | + $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | // Check if there is a custom field specific filter. |
| 429 | - if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){ |
|
| 429 | + if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) { |
|
| 430 | 430 | /** |
| 431 | 431 | * Filter the time html by individual custom field. |
| 432 | 432 | * |
@@ -435,11 +435,11 @@ discard block |
||
| 435 | 435 | * @param array $cf The custom field array. |
| 436 | 436 | * @since 1.6.6 |
| 437 | 437 | */ |
| 438 | - $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf); |
|
| 438 | + $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | // Check if there is a custom field key specific filter. |
| 442 | - if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){ |
|
| 442 | + if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) { |
|
| 443 | 443 | /** |
| 444 | 444 | * Filter the time html by field type key. |
| 445 | 445 | * |
@@ -448,11 +448,11 @@ discard block |
||
| 448 | 448 | * @param array $cf The custom field array. |
| 449 | 449 | * @since 1.6.6 |
| 450 | 450 | */ |
| 451 | - $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 451 | + $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | // If not html then we run the standard output. |
| 455 | - if(empty($html)){ |
|
| 455 | + if (empty($html)) { |
|
| 456 | 456 | |
| 457 | 457 | if ($post->{$cf['htmlvar_name']}): |
| 458 | 458 | |
@@ -472,9 +472,9 @@ discard block |
||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | |
| 475 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 476 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 477 | - $html .= '</span>' . $value . '</div>'; |
|
| 475 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af; |
|
| 476 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ' '; |
|
| 477 | + $html .= '</span>'.$value.'</div>'; |
|
| 478 | 478 | |
| 479 | 479 | endif; |
| 480 | 480 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | return $html; |
| 484 | 484 | } |
| 485 | -add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3); |
|
| 485 | +add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3); |
|
| 486 | 486 | |
| 487 | 487 | |
| 488 | 488 | /** |
@@ -495,21 +495,21 @@ discard block |
||
| 495 | 495 | * |
| 496 | 496 | * @return string The html to output for the custom field. |
| 497 | 497 | */ |
| 498 | -function geodir_cf_datepicker($html,$location,$cf,$p=''){ |
|
| 498 | +function geodir_cf_datepicker($html, $location, $cf, $p = '') { |
|
| 499 | 499 | global $preview; |
| 500 | 500 | // check we have the post value |
| 501 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 502 | - else{ global $post;} |
|
| 501 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 502 | + else { global $post; } |
|
| 503 | 503 | |
| 504 | - if(!is_array($cf) && $cf!=''){ |
|
| 504 | + if (!is_array($cf) && $cf != '') { |
|
| 505 | 505 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 506 | - if(!$cf){return NULL;} |
|
| 506 | + if (!$cf) {return NULL; } |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | $html_var = $cf['htmlvar_name']; |
| 510 | 510 | |
| 511 | 511 | // Check if there is a location specific filter. |
| 512 | - if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){ |
|
| 512 | + if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) { |
|
| 513 | 513 | /** |
| 514 | 514 | * Filter the datepicker html by location. |
| 515 | 515 | * |
@@ -517,11 +517,11 @@ discard block |
||
| 517 | 517 | * @param array $cf The custom field array. |
| 518 | 518 | * @since 1.6.6 |
| 519 | 519 | */ |
| 520 | - $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf); |
|
| 520 | + $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | // Check if there is a custom field specific filter. |
| 524 | - if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){ |
|
| 524 | + if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) { |
|
| 525 | 525 | /** |
| 526 | 526 | * Filter the datepicker html by individual custom field. |
| 527 | 527 | * |
@@ -530,11 +530,11 @@ discard block |
||
| 530 | 530 | * @param array $cf The custom field array. |
| 531 | 531 | * @since 1.6.6 |
| 532 | 532 | */ |
| 533 | - $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf); |
|
| 533 | + $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf); |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | // Check if there is a custom field key specific filter. |
| 537 | - if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){ |
|
| 537 | + if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) { |
|
| 538 | 538 | /** |
| 539 | 539 | * Filter the datepicker html by field type key. |
| 540 | 540 | * |
@@ -543,11 +543,11 @@ discard block |
||
| 543 | 543 | * @param array $cf The custom field array. |
| 544 | 544 | * @since 1.6.6 |
| 545 | 545 | */ |
| 546 | - $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 546 | + $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | // If not html then we run the standard output. |
| 550 | - if(empty($html)){ |
|
| 550 | + if (empty($html)) { |
|
| 551 | 551 | |
| 552 | 552 | if ($post->{$cf['htmlvar_name']}): |
| 553 | 553 | |
@@ -558,24 +558,24 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | // check if we need to change the format or not |
| 560 | 560 | $date_format_len = strlen(str_replace(' ', '', $date_format)); |
| 561 | - if($date_format_len>5){// if greater then 4 then it's the old style format. |
|
| 561 | + if ($date_format_len > 5) {// if greater then 4 then it's the old style format. |
|
| 562 | 562 | |
| 563 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 564 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 563 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format |
|
| 564 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format |
|
| 565 | 565 | |
| 566 | 566 | $date_format = str_replace($search, $replace, $date_format); |
| 567 | 567 | |
| 568 | - $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
| 569 | - }else{ |
|
| 568 | + $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
| 569 | + } else { |
|
| 570 | 570 | $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") { |
|
| 573 | + if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") { |
|
| 574 | 574 | $date_format_from = $preview ? $date_format : 'Y-m-d'; |
| 575 | 575 | $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
| 576 | 576 | //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
| 577 | 577 | //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
| 578 | - }else{ |
|
| 578 | + } else { |
|
| 579 | 579 | return ''; |
| 580 | 580 | } |
| 581 | 581 | |
@@ -592,9 +592,9 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | |
| 594 | 594 | |
| 595 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
| 596 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 597 | - $html .= '</span>' . $value . '</div>'; |
|
| 595 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af; |
|
| 596 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 597 | + $html .= '</span>'.$value.'</div>'; |
|
| 598 | 598 | |
| 599 | 599 | endif; |
| 600 | 600 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | return $html; |
| 604 | 604 | } |
| 605 | -add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3); |
|
| 605 | +add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3); |
|
| 606 | 606 | |
| 607 | 607 | |
| 608 | 608 | /** |
@@ -615,21 +615,21 @@ discard block |
||
| 615 | 615 | * |
| 616 | 616 | * @return string The html to output for the custom field. |
| 617 | 617 | */ |
| 618 | -function geodir_cf_text($html,$location,$cf,$p=''){ |
|
| 618 | +function geodir_cf_text($html, $location, $cf, $p = '') { |
|
| 619 | 619 | |
| 620 | 620 | // check we have the post value |
| 621 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 622 | - else{ global $post;} |
|
| 621 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 622 | + else { global $post; } |
|
| 623 | 623 | |
| 624 | - if(!is_array($cf) && $cf!=''){ |
|
| 624 | + if (!is_array($cf) && $cf != '') { |
|
| 625 | 625 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 626 | - if(!$cf){return NULL;} |
|
| 626 | + if (!$cf) {return NULL; } |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | $html_var = $cf['htmlvar_name']; |
| 630 | 630 | |
| 631 | 631 | // Check if there is a location specific filter. |
| 632 | - if(has_filter("geodir_custom_field_output_text_loc_{$location}")){ |
|
| 632 | + if (has_filter("geodir_custom_field_output_text_loc_{$location}")) { |
|
| 633 | 633 | /** |
| 634 | 634 | * Filter the text html by location. |
| 635 | 635 | * |
@@ -637,11 +637,11 @@ discard block |
||
| 637 | 637 | * @param array $cf The custom field array. |
| 638 | 638 | * @since 1.6.6 |
| 639 | 639 | */ |
| 640 | - $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf); |
|
| 640 | + $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | // Check if there is a custom field specific filter. |
| 644 | - if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){ |
|
| 644 | + if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) { |
|
| 645 | 645 | /** |
| 646 | 646 | * Filter the text html by individual custom field. |
| 647 | 647 | * |
@@ -650,11 +650,11 @@ discard block |
||
| 650 | 650 | * @param array $cf The custom field array. |
| 651 | 651 | * @since 1.6.6 |
| 652 | 652 | */ |
| 653 | - $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf); |
|
| 653 | + $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf); |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | // Check if there is a custom field key specific filter. |
| 657 | - if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){ |
|
| 657 | + if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) { |
|
| 658 | 658 | /** |
| 659 | 659 | * Filter the text html by field type key. |
| 660 | 660 | * |
@@ -663,15 +663,15 @@ discard block |
||
| 663 | 663 | * @param array $cf The custom field array. |
| 664 | 664 | * @since 1.6.6 |
| 665 | 665 | */ |
| 666 | - $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 666 | + $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | |
| 670 | 670 | |
| 671 | 671 | // If not html then we run the standard output. |
| 672 | - if(empty($html)){ |
|
| 672 | + if (empty($html)) { |
|
| 673 | 673 | |
| 674 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 674 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
| 675 | 675 | |
| 676 | 676 | $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
| 677 | 677 | |
@@ -686,16 +686,16 @@ discard block |
||
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | |
| 689 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af; |
|
| 690 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 689 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af; |
|
| 690 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 691 | 691 | $html .= '</span>'; |
| 692 | 692 | |
| 693 | 693 | $value = $post->{$cf['htmlvar_name']}; |
| 694 | - if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){ |
|
| 694 | + if (isset($cf['data_type']) && ($cf['data_type'] == 'INT' || $cf['data_type'] == 'FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']) { |
|
| 695 | 695 | $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields'])); |
| 696 | - if(isset($extra_fields['is_price']) && $extra_fields['is_price']){ |
|
| 697 | - if(!ceil($value) > 0){return '';}// dont output blank prices |
|
| 698 | - $value = geodir_currency_format_number($value,$cf); |
|
| 696 | + if (isset($extra_fields['is_price']) && $extra_fields['is_price']) { |
|
| 697 | + if (!ceil($value) > 0) {return ''; }// dont output blank prices |
|
| 698 | + $value = geodir_currency_format_number($value, $cf); |
|
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | |
| 710 | 710 | return $html; |
| 711 | 711 | } |
| 712 | -add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3); |
|
| 712 | +add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3); |
|
| 713 | 713 | |
| 714 | 714 | |
| 715 | 715 | /** |
@@ -722,21 +722,21 @@ discard block |
||
| 722 | 722 | * |
| 723 | 723 | * @return string The html to output for the custom field. |
| 724 | 724 | */ |
| 725 | -function geodir_cf_radio($html,$location,$cf,$p=''){ |
|
| 725 | +function geodir_cf_radio($html, $location, $cf, $p = '') { |
|
| 726 | 726 | |
| 727 | 727 | // check we have the post value |
| 728 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 729 | - else{ global $post;} |
|
| 728 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 729 | + else { global $post; } |
|
| 730 | 730 | |
| 731 | - if(!is_array($cf) && $cf!=''){ |
|
| 731 | + if (!is_array($cf) && $cf != '') { |
|
| 732 | 732 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 733 | - if(!$cf){return NULL;} |
|
| 733 | + if (!$cf) {return NULL; } |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | $html_var = $cf['htmlvar_name']; |
| 737 | 737 | |
| 738 | 738 | // Check if there is a location specific filter. |
| 739 | - if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){ |
|
| 739 | + if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) { |
|
| 740 | 740 | /** |
| 741 | 741 | * Filter the radio html by location. |
| 742 | 742 | * |
@@ -744,11 +744,11 @@ discard block |
||
| 744 | 744 | * @param array $cf The custom field array. |
| 745 | 745 | * @since 1.6.6 |
| 746 | 746 | */ |
| 747 | - $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf); |
|
| 747 | + $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf); |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | // Check if there is a custom field specific filter. |
| 751 | - if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){ |
|
| 751 | + if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) { |
|
| 752 | 752 | /** |
| 753 | 753 | * Filter the radio html by individual custom field. |
| 754 | 754 | * |
@@ -757,11 +757,11 @@ discard block |
||
| 757 | 757 | * @param array $cf The custom field array. |
| 758 | 758 | * @since 1.6.6 |
| 759 | 759 | */ |
| 760 | - $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf); |
|
| 760 | + $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf); |
|
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | // Check if there is a custom field key specific filter. |
| 764 | - if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){ |
|
| 764 | + if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) { |
|
| 765 | 765 | /** |
| 766 | 766 | * Filter the radio html by field type key. |
| 767 | 767 | * |
@@ -770,11 +770,11 @@ discard block |
||
| 770 | 770 | * @param array $cf The custom field array. |
| 771 | 771 | * @since 1.6.6 |
| 772 | 772 | */ |
| 773 | - $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 773 | + $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | // If not html then we run the standard output. |
| 777 | - if(empty($html)){ |
|
| 777 | + if (empty($html)) { |
|
| 778 | 778 | |
| 779 | 779 | $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : ''; |
| 780 | 780 | if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
@@ -808,16 +808,16 @@ discard block |
||
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | |
| 811 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
| 812 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 813 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 811 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af; |
|
| 812 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 813 | + $html .= '</span>'.$html_val.'</div>'; |
|
| 814 | 814 | endif; |
| 815 | 815 | |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | return $html; |
| 819 | 819 | } |
| 820 | -add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3); |
|
| 820 | +add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3); |
|
| 821 | 821 | |
| 822 | 822 | |
| 823 | 823 | /** |
@@ -831,21 +831,21 @@ discard block |
||
| 831 | 831 | * |
| 832 | 832 | * @return string The html to output for the custom field. |
| 833 | 833 | */ |
| 834 | -function geodir_cf_select($html,$location,$cf,$p=''){ |
|
| 834 | +function geodir_cf_select($html, $location, $cf, $p = '') { |
|
| 835 | 835 | |
| 836 | 836 | // check we have the post value |
| 837 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 838 | - else{ global $post;} |
|
| 837 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 838 | + else { global $post; } |
|
| 839 | 839 | |
| 840 | - if(!is_array($cf) && $cf!=''){ |
|
| 840 | + if (!is_array($cf) && $cf != '') { |
|
| 841 | 841 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 842 | - if(!$cf){return NULL;} |
|
| 842 | + if (!$cf) {return NULL; } |
|
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | $html_var = $cf['htmlvar_name']; |
| 846 | 846 | |
| 847 | 847 | // Check if there is a location specific filter. |
| 848 | - if(has_filter("geodir_custom_field_output_select_loc_{$location}")){ |
|
| 848 | + if (has_filter("geodir_custom_field_output_select_loc_{$location}")) { |
|
| 849 | 849 | /** |
| 850 | 850 | * Filter the select html by location. |
| 851 | 851 | * |
@@ -853,11 +853,11 @@ discard block |
||
| 853 | 853 | * @param array $cf The custom field array. |
| 854 | 854 | * @since 1.6.6 |
| 855 | 855 | */ |
| 856 | - $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf); |
|
| 856 | + $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf); |
|
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | // Check if there is a custom field specific filter. |
| 860 | - if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){ |
|
| 860 | + if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) { |
|
| 861 | 861 | /** |
| 862 | 862 | * Filter the select html by individual custom field. |
| 863 | 863 | * |
@@ -866,11 +866,11 @@ discard block |
||
| 866 | 866 | * @param array $cf The custom field array. |
| 867 | 867 | * @since 1.6.6 |
| 868 | 868 | */ |
| 869 | - $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf); |
|
| 869 | + $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf); |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | // Check if there is a custom field key specific filter. |
| 873 | - if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){ |
|
| 873 | + if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) { |
|
| 874 | 874 | /** |
| 875 | 875 | * Filter the select html by field type key. |
| 876 | 876 | * |
@@ -879,11 +879,11 @@ discard block |
||
| 879 | 879 | * @param array $cf The custom field array. |
| 880 | 880 | * @since 1.6.6 |
| 881 | 881 | */ |
| 882 | - $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 882 | + $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | // If not html then we run the standard output. |
| 886 | - if(empty($html)){ |
|
| 886 | + if (empty($html)) { |
|
| 887 | 887 | |
| 888 | 888 | if ($post->{$cf['htmlvar_name']}): |
| 889 | 889 | $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
@@ -911,16 +911,16 @@ discard block |
||
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | |
| 914 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 915 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 916 | - $html .= '</span>' . $field_value . '</div>'; |
|
| 914 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
| 915 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 916 | + $html .= '</span>'.$field_value.'</div>'; |
|
| 917 | 917 | endif; |
| 918 | 918 | |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | return $html; |
| 922 | 922 | } |
| 923 | -add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3); |
|
| 923 | +add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3); |
|
| 924 | 924 | |
| 925 | 925 | |
| 926 | 926 | /** |
@@ -933,21 +933,21 @@ discard block |
||
| 933 | 933 | * |
| 934 | 934 | * @return string The html to output for the custom field. |
| 935 | 935 | */ |
| 936 | -function geodir_cf_multiselect($html,$location,$cf,$p=''){ |
|
| 936 | +function geodir_cf_multiselect($html, $location, $cf, $p = '') { |
|
| 937 | 937 | |
| 938 | 938 | // check we have the post value |
| 939 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 940 | - else{ global $post;} |
|
| 939 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 940 | + else { global $post; } |
|
| 941 | 941 | |
| 942 | - if(!is_array($cf) && $cf!=''){ |
|
| 942 | + if (!is_array($cf) && $cf != '') { |
|
| 943 | 943 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 944 | - if(!$cf){return NULL;} |
|
| 944 | + if (!$cf) {return NULL; } |
|
| 945 | 945 | } |
| 946 | 946 | |
| 947 | 947 | $html_var = $cf['htmlvar_name']; |
| 948 | 948 | |
| 949 | 949 | // Check if there is a location specific filter. |
| 950 | - if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){ |
|
| 950 | + if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) { |
|
| 951 | 951 | /** |
| 952 | 952 | * Filter the multiselect html by location. |
| 953 | 953 | * |
@@ -955,11 +955,11 @@ discard block |
||
| 955 | 955 | * @param array $cf The custom field array. |
| 956 | 956 | * @since 1.6.6 |
| 957 | 957 | */ |
| 958 | - $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf); |
|
| 958 | + $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf); |
|
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | // Check if there is a custom field specific filter. |
| 962 | - if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){ |
|
| 962 | + if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) { |
|
| 963 | 963 | /** |
| 964 | 964 | * Filter the multiselect html by individual custom field. |
| 965 | 965 | * |
@@ -968,11 +968,11 @@ discard block |
||
| 968 | 968 | * @param array $cf The custom field array. |
| 969 | 969 | * @since 1.6.6 |
| 970 | 970 | */ |
| 971 | - $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf); |
|
| 971 | + $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf); |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | // Check if there is a custom field key specific filter. |
| 975 | - if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){ |
|
| 975 | + if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) { |
|
| 976 | 976 | /** |
| 977 | 977 | * Filter the multiselect html by field type key. |
| 978 | 978 | * |
@@ -981,11 +981,11 @@ discard block |
||
| 981 | 981 | * @param array $cf The custom field array. |
| 982 | 982 | * @since 1.6.6 |
| 983 | 983 | */ |
| 984 | - $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 984 | + $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 985 | 985 | } |
| 986 | 986 | |
| 987 | 987 | // If not html then we run the standard output. |
| 988 | - if(empty($html)){ |
|
| 988 | + if (empty($html)) { |
|
| 989 | 989 | |
| 990 | 990 | |
| 991 | 991 | if (!empty($post->{$cf['htmlvar_name']})): |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | |
| 1007 | 1007 | $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ",")); |
| 1008 | 1008 | |
| 1009 | - if(is_array($field_values)){ |
|
| 1009 | + if (is_array($field_values)) { |
|
| 1010 | 1010 | $field_values = array_map('trim', $field_values); |
| 1011 | 1011 | } |
| 1012 | 1012 | |
@@ -1024,15 +1024,15 @@ discard block |
||
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | |
| 1027 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1028 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1027 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1028 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1029 | 1029 | $html .= '</span>'; |
| 1030 | 1030 | |
| 1031 | 1031 | if (count($option_values) > 1) { |
| 1032 | 1032 | $html .= '<ul>'; |
| 1033 | 1033 | |
| 1034 | 1034 | foreach ($option_values as $val) { |
| 1035 | - $html .= '<li>' . $val . '</li>'; |
|
| 1035 | + $html .= '<li>'.$val.'</li>'; |
|
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | $html .= '</ul>'; |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | |
| 1048 | 1048 | return $html; |
| 1049 | 1049 | } |
| 1050 | -add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3); |
|
| 1050 | +add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3); |
|
| 1051 | 1051 | |
| 1052 | 1052 | |
| 1053 | 1053 | /** |
@@ -1060,21 +1060,21 @@ discard block |
||
| 1060 | 1060 | * |
| 1061 | 1061 | * @return string The html to output for the custom field. |
| 1062 | 1062 | */ |
| 1063 | -function geodir_cf_email($html,$location,$cf,$p=''){ |
|
| 1063 | +function geodir_cf_email($html, $location, $cf, $p = '') { |
|
| 1064 | 1064 | |
| 1065 | 1065 | // check we have the post value |
| 1066 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1067 | - else{ global $post;} |
|
| 1066 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1067 | + else { global $post; } |
|
| 1068 | 1068 | |
| 1069 | - if(!is_array($cf) && $cf!=''){ |
|
| 1069 | + if (!is_array($cf) && $cf != '') { |
|
| 1070 | 1070 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1071 | - if(!$cf){return NULL;} |
|
| 1071 | + if (!$cf) {return NULL; } |
|
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | $html_var = $cf['htmlvar_name']; |
| 1075 | 1075 | |
| 1076 | 1076 | // Check if there is a location specific filter. |
| 1077 | - if(has_filter("geodir_custom_field_output_email_loc_{$location}")){ |
|
| 1077 | + if (has_filter("geodir_custom_field_output_email_loc_{$location}")) { |
|
| 1078 | 1078 | /** |
| 1079 | 1079 | * Filter the email html by location. |
| 1080 | 1080 | * |
@@ -1082,11 +1082,11 @@ discard block |
||
| 1082 | 1082 | * @param array $cf The custom field array. |
| 1083 | 1083 | * @since 1.6.6 |
| 1084 | 1084 | */ |
| 1085 | - $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf); |
|
| 1085 | + $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | // Check if there is a custom field specific filter. |
| 1089 | - if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){ |
|
| 1089 | + if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) { |
|
| 1090 | 1090 | /** |
| 1091 | 1091 | * Filter the email html by individual custom field. |
| 1092 | 1092 | * |
@@ -1095,11 +1095,11 @@ discard block |
||
| 1095 | 1095 | * @param array $cf The custom field array. |
| 1096 | 1096 | * @since 1.6.6 |
| 1097 | 1097 | */ |
| 1098 | - $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf); |
|
| 1098 | + $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf); |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | // Check if there is a custom field key specific filter. |
| 1102 | - if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){ |
|
| 1102 | + if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) { |
|
| 1103 | 1103 | /** |
| 1104 | 1104 | * Filter the email html by field type key. |
| 1105 | 1105 | * |
@@ -1108,18 +1108,18 @@ discard block |
||
| 1108 | 1108 | * @param array $cf The custom field array. |
| 1109 | 1109 | * @since 1.6.6 |
| 1110 | 1110 | */ |
| 1111 | - $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1111 | + $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | // If not html then we run the standard output. |
| 1115 | - if(empty($html)){ |
|
| 1115 | + if (empty($html)) { |
|
| 1116 | 1116 | |
| 1117 | 1117 | global $preview; |
| 1118 | 1118 | if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
| 1119 | 1119 | return ''; // Remove Send Enquiry | Send To Friend from listings page |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | - $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type); |
|
| 1122 | + $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type); |
|
| 1123 | 1123 | |
| 1124 | 1124 | if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) { |
| 1125 | 1125 | global $send_to_friend; |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | if (!$preview) { |
| 1132 | 1132 | $b_send_inquiry = 'b_send_inquiry'; |
| 1133 | 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>'; |
|
| 1134 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>'; |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -1144,28 +1144,28 @@ discard block |
||
| 1144 | 1144 | $field_icon = ''; |
| 1145 | 1145 | } |
| 1146 | 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; |
|
| 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 | 1148 | $seperator = ''; |
| 1149 | 1149 | if ($post->{$cf['htmlvar_name']}) { |
| 1150 | 1150 | $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); |
| 1151 | - $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1151 | + $html .= '<a href="'.$b_send_inquiry_url.'" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>'; |
|
| 1152 | 1152 | $seperator = ' | '; |
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
| 1156 | 1156 | $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);'); |
| 1157 | - $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1157 | + $html .= $seperator.'<a href="'.$b_sendtofriend_url.'" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>'; |
|
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | $html .= '</span></div>'; |
| 1161 | 1161 | |
| 1162 | 1162 | |
| 1163 | 1163 | if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
| 1164 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1164 | + $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>'; |
|
| 1165 | 1165 | } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
| 1166 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1166 | + $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>'; |
|
| 1167 | 1167 | } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
| 1168 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1168 | + $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>'; |
|
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
@@ -1185,11 +1185,11 @@ discard block |
||
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | 1187 | |
| 1188 | - $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; |
|
| 1189 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1188 | + $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; |
|
| 1189 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1190 | 1190 | $html .= '</span><span class="geodir-email-address-output">'; |
| 1191 | 1191 | $email = $post->{$cf['htmlvar_name']} ; |
| 1192 | - if($e_split = explode('@',$email)){ |
|
| 1192 | + if ($e_split = explode('@', $email)) { |
|
| 1193 | 1193 | /** |
| 1194 | 1194 | * Filter email custom field name output. |
| 1195 | 1195 | * |
@@ -1198,10 +1198,10 @@ discard block |
||
| 1198 | 1198 | * @param string $email The email string being output. |
| 1199 | 1199 | * @param array $cf Custom field variables array. |
| 1200 | 1200 | */ |
| 1201 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1202 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1203 | - }else{ |
|
| 1204 | - $html .= $email; |
|
| 1201 | + $email_name = apply_filters('geodir_email_field_name_output', $email, $cf); |
|
| 1202 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1203 | + } else { |
|
| 1204 | + $html .= $email; |
|
| 1205 | 1205 | } |
| 1206 | 1206 | $html .= '</span></div>'; |
| 1207 | 1207 | } |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | |
| 1213 | 1213 | return $html; |
| 1214 | 1214 | } |
| 1215 | -add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3); |
|
| 1215 | +add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3); |
|
| 1216 | 1216 | |
| 1217 | 1217 | |
| 1218 | 1218 | /** |
@@ -1225,21 +1225,21 @@ discard block |
||
| 1225 | 1225 | * |
| 1226 | 1226 | * @return string The html to output for the custom field. |
| 1227 | 1227 | */ |
| 1228 | -function geodir_cf_file($html,$location,$cf,$p=''){ |
|
| 1228 | +function geodir_cf_file($html, $location, $cf, $p = '') { |
|
| 1229 | 1229 | |
| 1230 | 1230 | // check we have the post value |
| 1231 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1232 | - else{ global $post;} |
|
| 1231 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1232 | + else { global $post; } |
|
| 1233 | 1233 | |
| 1234 | - if(!is_array($cf) && $cf!=''){ |
|
| 1234 | + if (!is_array($cf) && $cf != '') { |
|
| 1235 | 1235 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1236 | - if(!$cf){return NULL;} |
|
| 1236 | + if (!$cf) {return NULL; } |
|
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | $html_var = $cf['htmlvar_name']; |
| 1240 | 1240 | |
| 1241 | 1241 | // Check if there is a location specific filter. |
| 1242 | - if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1242 | + if (has_filter("geodir_custom_field_output_file_loc_{$location}")) { |
|
| 1243 | 1243 | /** |
| 1244 | 1244 | * Filter the file html by location. |
| 1245 | 1245 | * |
@@ -1247,11 +1247,11 @@ discard block |
||
| 1247 | 1247 | * @param array $cf The custom field array. |
| 1248 | 1248 | * @since 1.6.6 |
| 1249 | 1249 | */ |
| 1250 | - $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1250 | + $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf); |
|
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | 1253 | // Check if there is a custom field specific filter. |
| 1254 | - if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1254 | + if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) { |
|
| 1255 | 1255 | /** |
| 1256 | 1256 | * Filter the file html by individual custom field. |
| 1257 | 1257 | * |
@@ -1260,11 +1260,11 @@ discard block |
||
| 1260 | 1260 | * @param array $cf The custom field array. |
| 1261 | 1261 | * @since 1.6.6 |
| 1262 | 1262 | */ |
| 1263 | - $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1263 | + $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf); |
|
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | // Check if there is a custom field key specific filter. |
| 1267 | - if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1267 | + if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) { |
|
| 1268 | 1268 | /** |
| 1269 | 1269 | * Filter the file html by field type key. |
| 1270 | 1270 | * |
@@ -1273,11 +1273,11 @@ discard block |
||
| 1273 | 1273 | * @param array $cf The custom field array. |
| 1274 | 1274 | * @since 1.6.6 |
| 1275 | 1275 | */ |
| 1276 | - $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1276 | + $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1277 | 1277 | } |
| 1278 | 1278 | |
| 1279 | 1279 | // If not html then we run the standard output. |
| 1280 | - if(empty($html)){ |
|
| 1280 | + if (empty($html)) { |
|
| 1281 | 1281 | |
| 1282 | 1282 | if (!empty($post->{$cf['htmlvar_name']})): |
| 1283 | 1283 | |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | if (!empty($files)): |
| 1286 | 1286 | |
| 1287 | 1287 | $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
| 1288 | - $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'] : ''; |
|
| 1288 | + $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'] : ''; |
|
| 1289 | 1289 | |
| 1290 | 1290 | $file_paths = ''; |
| 1291 | 1291 | foreach ($files as $file) { |
@@ -1323,14 +1323,14 @@ discard block |
||
| 1323 | 1323 | //$file_paths .= '<img src="'.$file.'" />'; |
| 1324 | 1324 | $file_paths .= '</div>'; |
| 1325 | 1325 | }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
| 1326 | - $ext_path = '_' . $html_var . '_'; |
|
| 1326 | + $ext_path = '_'.$html_var.'_'; |
|
| 1327 | 1327 | $filename = explode($ext_path, $filename); |
| 1328 | 1328 | $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
| 1329 | 1329 | $file_paths .= do_shortcode('[audio src="'.$file.'" ]'); |
| 1330 | 1330 | } else { |
| 1331 | - $ext_path = '_' . $html_var . '_'; |
|
| 1331 | + $ext_path = '_'.$html_var.'_'; |
|
| 1332 | 1332 | $filename = explode($ext_path, $filename); |
| 1333 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1333 | + $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>'; |
|
| 1334 | 1334 | } |
| 1335 | 1335 | } |
| 1336 | 1336 | } |
@@ -1345,11 +1345,11 @@ discard block |
||
| 1345 | 1345 | $field_icon = ''; |
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | - $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; |
|
| 1348 | + $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; |
|
| 1349 | 1349 | $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
| 1350 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1350 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1351 | 1351 | $html .= '</span>'; |
| 1352 | - $html .= $file_paths . '</div></div>'; |
|
| 1352 | + $html .= $file_paths.'</div></div>'; |
|
| 1353 | 1353 | |
| 1354 | 1354 | endif; |
| 1355 | 1355 | endif; |
@@ -1358,7 +1358,7 @@ discard block |
||
| 1358 | 1358 | |
| 1359 | 1359 | return $html; |
| 1360 | 1360 | } |
| 1361 | -add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3); |
|
| 1361 | +add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3); |
|
| 1362 | 1362 | |
| 1363 | 1363 | |
| 1364 | 1364 | |
@@ -1372,21 +1372,21 @@ discard block |
||
| 1372 | 1372 | * |
| 1373 | 1373 | * @return string The html to output for the custom field. |
| 1374 | 1374 | */ |
| 1375 | -function geodir_cf_textarea($html,$location,$cf,$p=''){ |
|
| 1375 | +function geodir_cf_textarea($html, $location, $cf, $p = '') { |
|
| 1376 | 1376 | |
| 1377 | 1377 | // check we have the post value |
| 1378 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1379 | - else{ global $post;} |
|
| 1378 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1379 | + else { global $post; } |
|
| 1380 | 1380 | |
| 1381 | - if(!is_array($cf) && $cf!=''){ |
|
| 1381 | + if (!is_array($cf) && $cf != '') { |
|
| 1382 | 1382 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1383 | - if(!$cf){return NULL;} |
|
| 1383 | + if (!$cf) {return NULL; } |
|
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | 1386 | $html_var = $cf['htmlvar_name']; |
| 1387 | 1387 | |
| 1388 | 1388 | // Check if there is a location specific filter. |
| 1389 | - if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1389 | + if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) { |
|
| 1390 | 1390 | /** |
| 1391 | 1391 | * Filter the textarea html by location. |
| 1392 | 1392 | * |
@@ -1394,11 +1394,11 @@ discard block |
||
| 1394 | 1394 | * @param array $cf The custom field array. |
| 1395 | 1395 | * @since 1.6.6 |
| 1396 | 1396 | */ |
| 1397 | - $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1397 | + $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf); |
|
| 1398 | 1398 | } |
| 1399 | 1399 | |
| 1400 | 1400 | // Check if there is a custom field specific filter. |
| 1401 | - if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1401 | + if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) { |
|
| 1402 | 1402 | /** |
| 1403 | 1403 | * Filter the textarea html by individual custom field. |
| 1404 | 1404 | * |
@@ -1407,11 +1407,11 @@ discard block |
||
| 1407 | 1407 | * @param array $cf The custom field array. |
| 1408 | 1408 | * @since 1.6.6 |
| 1409 | 1409 | */ |
| 1410 | - $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1410 | + $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf); |
|
| 1411 | 1411 | } |
| 1412 | 1412 | |
| 1413 | 1413 | // Check if there is a custom field key specific filter. |
| 1414 | - if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1414 | + if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) { |
|
| 1415 | 1415 | /** |
| 1416 | 1416 | * Filter the textarea html by field type key. |
| 1417 | 1417 | * |
@@ -1420,11 +1420,11 @@ discard block |
||
| 1420 | 1420 | * @param array $cf The custom field array. |
| 1421 | 1421 | * @since 1.6.6 |
| 1422 | 1422 | */ |
| 1423 | - $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1423 | + $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1424 | 1424 | } |
| 1425 | 1425 | |
| 1426 | 1426 | // If not html then we run the standard output. |
| 1427 | - if(empty($html)){ |
|
| 1427 | + if (empty($html)) { |
|
| 1428 | 1428 | |
| 1429 | 1429 | if (!empty($post->{$cf['htmlvar_name']})) { |
| 1430 | 1430 | |
@@ -1439,9 +1439,9 @@ discard block |
||
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | 1441 | |
| 1442 | - $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; |
|
| 1443 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1444 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1442 | + $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; |
|
| 1443 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1444 | + $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>'; |
|
| 1445 | 1445 | |
| 1446 | 1446 | } |
| 1447 | 1447 | |
@@ -1449,7 +1449,7 @@ discard block |
||
| 1449 | 1449 | |
| 1450 | 1450 | return $html; |
| 1451 | 1451 | } |
| 1452 | -add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3); |
|
| 1452 | +add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3); |
|
| 1453 | 1453 | |
| 1454 | 1454 | |
| 1455 | 1455 | |
@@ -1463,21 +1463,21 @@ discard block |
||
| 1463 | 1463 | * |
| 1464 | 1464 | * @return string The html to output for the custom field. |
| 1465 | 1465 | */ |
| 1466 | -function geodir_cf_html($html,$location,$cf,$p=''){ |
|
| 1466 | +function geodir_cf_html($html, $location, $cf, $p = '') { |
|
| 1467 | 1467 | |
| 1468 | 1468 | // check we have the post value |
| 1469 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1470 | - else{ global $post;} |
|
| 1469 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1470 | + else { global $post; } |
|
| 1471 | 1471 | |
| 1472 | - if(!is_array($cf) && $cf!=''){ |
|
| 1472 | + if (!is_array($cf) && $cf != '') { |
|
| 1473 | 1473 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1474 | - if(!$cf){return NULL;} |
|
| 1474 | + if (!$cf) {return NULL; } |
|
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | 1477 | $html_var = $cf['htmlvar_name']; |
| 1478 | 1478 | |
| 1479 | 1479 | // Check if there is a location specific filter. |
| 1480 | - if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1480 | + if (has_filter("geodir_custom_field_output_html_loc_{$location}")) { |
|
| 1481 | 1481 | /** |
| 1482 | 1482 | * Filter the html html by location. |
| 1483 | 1483 | * |
@@ -1485,11 +1485,11 @@ discard block |
||
| 1485 | 1485 | * @param array $cf The custom field array. |
| 1486 | 1486 | * @since 1.6.6 |
| 1487 | 1487 | */ |
| 1488 | - $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1488 | + $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf); |
|
| 1489 | 1489 | } |
| 1490 | 1490 | |
| 1491 | 1491 | // Check if there is a custom field specific filter. |
| 1492 | - if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1492 | + if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) { |
|
| 1493 | 1493 | /** |
| 1494 | 1494 | * Filter the html html by individual custom field. |
| 1495 | 1495 | * |
@@ -1498,11 +1498,11 @@ discard block |
||
| 1498 | 1498 | * @param array $cf The custom field array. |
| 1499 | 1499 | * @since 1.6.6 |
| 1500 | 1500 | */ |
| 1501 | - $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1501 | + $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf); |
|
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | // Check if there is a custom field key specific filter. |
| 1505 | - if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1505 | + if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) { |
|
| 1506 | 1506 | /** |
| 1507 | 1507 | * Filter the html html by field type key. |
| 1508 | 1508 | * |
@@ -1511,11 +1511,11 @@ discard block |
||
| 1511 | 1511 | * @param array $cf The custom field array. |
| 1512 | 1512 | * @since 1.6.6 |
| 1513 | 1513 | */ |
| 1514 | - $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1514 | + $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | // If not html then we run the standard output. |
| 1518 | - if(empty($html)){ |
|
| 1518 | + if (empty($html)) { |
|
| 1519 | 1519 | |
| 1520 | 1520 | if (!empty($post->{$cf['htmlvar_name']})) { |
| 1521 | 1521 | |
@@ -1529,9 +1529,9 @@ discard block |
||
| 1529 | 1529 | $field_icon = ''; |
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | - $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; |
|
| 1533 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1534 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1532 | + $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; |
|
| 1533 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1534 | + $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>'; |
|
| 1535 | 1535 | |
| 1536 | 1536 | } |
| 1537 | 1537 | |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | |
| 1540 | 1540 | return $html; |
| 1541 | 1541 | } |
| 1542 | -add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3); |
|
| 1542 | +add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3); |
|
| 1543 | 1543 | |
| 1544 | 1544 | |
| 1545 | 1545 | |
@@ -1553,21 +1553,21 @@ discard block |
||
| 1553 | 1553 | * |
| 1554 | 1554 | * @return string The html to output for the custom field. |
| 1555 | 1555 | */ |
| 1556 | -function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
|
| 1556 | +function geodir_cf_taxonomy($html, $location, $cf, $p = '') { |
|
| 1557 | 1557 | |
| 1558 | 1558 | // check we have the post value |
| 1559 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1560 | - else{ global $post;} |
|
| 1559 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1560 | + else { global $post; } |
|
| 1561 | 1561 | |
| 1562 | - if(!is_array($cf) && $cf!=''){ |
|
| 1562 | + if (!is_array($cf) && $cf != '') { |
|
| 1563 | 1563 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1564 | - if(!$cf){return NULL;} |
|
| 1564 | + if (!$cf) {return NULL; } |
|
| 1565 | 1565 | } |
| 1566 | 1566 | |
| 1567 | 1567 | $html_var = $cf['htmlvar_name']; |
| 1568 | 1568 | |
| 1569 | 1569 | // Check if there is a location specific filter. |
| 1570 | - if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1570 | + if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) { |
|
| 1571 | 1571 | /** |
| 1572 | 1572 | * Filter the taxonomy html by location. |
| 1573 | 1573 | * |
@@ -1575,11 +1575,11 @@ discard block |
||
| 1575 | 1575 | * @param array $cf The custom field array. |
| 1576 | 1576 | * @since 1.6.6 |
| 1577 | 1577 | */ |
| 1578 | - $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1578 | + $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf); |
|
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | // Check if there is a custom field specific filter. |
| 1582 | - if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1582 | + if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) { |
|
| 1583 | 1583 | /** |
| 1584 | 1584 | * Filter the taxonomy html by individual custom field. |
| 1585 | 1585 | * |
@@ -1588,11 +1588,11 @@ discard block |
||
| 1588 | 1588 | * @param array $cf The custom field array. |
| 1589 | 1589 | * @since 1.6.6 |
| 1590 | 1590 | */ |
| 1591 | - $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1591 | + $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf); |
|
| 1592 | 1592 | } |
| 1593 | 1593 | |
| 1594 | 1594 | // Check if there is a custom field key specific filter. |
| 1595 | - if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1595 | + if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) { |
|
| 1596 | 1596 | /** |
| 1597 | 1597 | * Filter the taxonomy html by field type key. |
| 1598 | 1598 | * |
@@ -1601,14 +1601,14 @@ discard block |
||
| 1601 | 1601 | * @param array $cf The custom field array. |
| 1602 | 1602 | * @since 1.6.6 |
| 1603 | 1603 | */ |
| 1604 | - $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1604 | + $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1605 | 1605 | } |
| 1606 | 1606 | |
| 1607 | 1607 | // If not html then we run the standard output. |
| 1608 | - if(empty($html)){ |
|
| 1608 | + if (empty($html)) { |
|
| 1609 | 1609 | |
| 1610 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1611 | - $post_taxonomy = $post->post_type . 'category'; |
|
| 1610 | + if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) { |
|
| 1611 | + $post_taxonomy = $post->post_type.'category'; |
|
| 1612 | 1612 | $field_value = $post->{$html_var}; |
| 1613 | 1613 | $links = array(); |
| 1614 | 1614 | $terms = array(); |
@@ -1626,7 +1626,7 @@ discard block |
||
| 1626 | 1626 | if ($term != '') { |
| 1627 | 1627 | $term = get_term_by('id', $term, $html_var); |
| 1628 | 1628 | if (is_object($term)) { |
| 1629 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1629 | + $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>"; |
|
| 1630 | 1630 | $terms[] = $term; |
| 1631 | 1631 | } |
| 1632 | 1632 | } |
@@ -1640,7 +1640,7 @@ discard block |
||
| 1640 | 1640 | $terms = $termsOrdered; |
| 1641 | 1641 | } |
| 1642 | 1642 | } |
| 1643 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1643 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : ''; |
|
| 1644 | 1644 | |
| 1645 | 1645 | if ($html_value != '') { |
| 1646 | 1646 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -1653,9 +1653,9 @@ discard block |
||
| 1653 | 1653 | $field_icon = ''; |
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | - $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; |
|
| 1657 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1658 | - $html .= '</span> ' . $html_value . '</div>'; |
|
| 1656 | + $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; |
|
| 1657 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1658 | + $html .= '</span> '.$html_value.'</div>'; |
|
| 1659 | 1659 | } |
| 1660 | 1660 | } |
| 1661 | 1661 | |
@@ -1663,7 +1663,7 @@ discard block |
||
| 1663 | 1663 | |
| 1664 | 1664 | return $html; |
| 1665 | 1665 | } |
| 1666 | -add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3); |
|
| 1666 | +add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3); |
|
| 1667 | 1667 | |
| 1668 | 1668 | |
| 1669 | 1669 | /** |
@@ -1676,21 +1676,21 @@ discard block |
||
| 1676 | 1676 | * |
| 1677 | 1677 | * @return string The html to output for the custom field. |
| 1678 | 1678 | */ |
| 1679 | -function geodir_cf_address($html,$location,$cf,$p=''){ |
|
| 1679 | +function geodir_cf_address($html, $location, $cf, $p = '') { |
|
| 1680 | 1680 | |
| 1681 | 1681 | // check we have the post value |
| 1682 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1683 | - else{ global $post;} |
|
| 1682 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1683 | + else { global $post; } |
|
| 1684 | 1684 | |
| 1685 | - if(!is_array($cf) && $cf!=''){ |
|
| 1685 | + if (!is_array($cf) && $cf != '') { |
|
| 1686 | 1686 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1687 | - if(!$cf){return NULL;} |
|
| 1687 | + if (!$cf) {return NULL; } |
|
| 1688 | 1688 | } |
| 1689 | 1689 | |
| 1690 | 1690 | $html_var = $cf['htmlvar_name']; |
| 1691 | 1691 | |
| 1692 | 1692 | // Check if there is a location specific filter. |
| 1693 | - if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1693 | + if (has_filter("geodir_custom_field_output_address_loc_{$location}")) { |
|
| 1694 | 1694 | /** |
| 1695 | 1695 | * Filter the address html by location. |
| 1696 | 1696 | * |
@@ -1698,11 +1698,11 @@ discard block |
||
| 1698 | 1698 | * @param array $cf The custom field array. |
| 1699 | 1699 | * @since 1.6.6 |
| 1700 | 1700 | */ |
| 1701 | - $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1701 | + $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf); |
|
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | 1704 | // Check if there is a custom field specific filter. |
| 1705 | - if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1705 | + if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) { |
|
| 1706 | 1706 | /** |
| 1707 | 1707 | * Filter the address html by individual custom field. |
| 1708 | 1708 | * |
@@ -1711,11 +1711,11 @@ discard block |
||
| 1711 | 1711 | * @param array $cf The custom field array. |
| 1712 | 1712 | * @since 1.6.6 |
| 1713 | 1713 | */ |
| 1714 | - $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1714 | + $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf); |
|
| 1715 | 1715 | } |
| 1716 | 1716 | |
| 1717 | 1717 | // Check if there is a custom field key specific filter. |
| 1718 | - if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1718 | + if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) { |
|
| 1719 | 1719 | /** |
| 1720 | 1720 | * Filter the address html by field type key. |
| 1721 | 1721 | * |
@@ -1724,14 +1724,14 @@ discard block |
||
| 1724 | 1724 | * @param array $cf The custom field array. |
| 1725 | 1725 | * @since 1.6.6 |
| 1726 | 1726 | */ |
| 1727 | - $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1727 | + $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1728 | 1728 | } |
| 1729 | 1729 | |
| 1730 | 1730 | // If not html then we run the standard output. |
| 1731 | - if(empty($html)){ |
|
| 1731 | + if (empty($html)) { |
|
| 1732 | 1732 | |
| 1733 | 1733 | global $preview; |
| 1734 | - $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1734 | + $html_var = $cf['htmlvar_name'].'_address'; |
|
| 1735 | 1735 | |
| 1736 | 1736 | if ($cf['extra_fields']) { |
| 1737 | 1737 | |
@@ -1794,10 +1794,10 @@ discard block |
||
| 1794 | 1794 | |
| 1795 | 1795 | if ($post->{$html_var}) { |
| 1796 | 1796 | |
| 1797 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1798 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1797 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1798 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1799 | 1799 | $field_icon_af = ''; |
| 1800 | - } elseif ( $field_icon == '' ) { |
|
| 1800 | + } elseif ($field_icon == '') { |
|
| 1801 | 1801 | $field_icon_af = '<i class="fa fa-home"></i>'; |
| 1802 | 1802 | } else { |
| 1803 | 1803 | $field_icon_af = $field_icon; |
@@ -1806,25 +1806,25 @@ discard block |
||
| 1806 | 1806 | |
| 1807 | 1807 | |
| 1808 | 1808 | |
| 1809 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1810 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1811 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
| 1809 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1810 | + $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1811 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ' '; |
|
| 1812 | 1812 | $html .= '</span>'; |
| 1813 | 1813 | |
| 1814 | - if ( isset($post->post_address) ) { |
|
| 1815 | - $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 1814 | + if (isset($post->post_address)) { |
|
| 1815 | + $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>'; |
|
| 1816 | 1816 | } |
| 1817 | - if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1818 | - $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 1817 | + if ($show_city_in_address && isset($post->post_city) && $post->post_city) { |
|
| 1818 | + $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>'; |
|
| 1819 | 1819 | } |
| 1820 | - if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1821 | - $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 1820 | + if ($show_region_in_address && isset($post->post_region) && $post->post_region) { |
|
| 1821 | + $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>'; |
|
| 1822 | 1822 | } |
| 1823 | - if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1824 | - $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 1823 | + if ($show_zip_in_address && isset($post->post_zip) && $post->post_zip) { |
|
| 1824 | + $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>'; |
|
| 1825 | 1825 | } |
| 1826 | - if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1827 | - $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>'; |
|
| 1826 | + if ($show_country_in_address && isset($post->post_country) && $post->post_country) { |
|
| 1827 | + $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>'; |
|
| 1828 | 1828 | } |
| 1829 | 1829 | $html .= '</div>'; |
| 1830 | 1830 | |
@@ -1835,4 +1835,4 @@ discard block |
||
| 1835 | 1835 | |
| 1836 | 1836 | return $html; |
| 1837 | 1837 | } |
| 1838 | -add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3); |
|
| 1839 | 1838 | \ No newline at end of file |
| 1839 | +add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3); |
|
| 1840 | 1840 | \ No newline at end of file |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | function geodir_cf_checkbox($html,$location,$cf,$p=''){ |
| 23 | 23 | |
| 24 | 24 | // check we have the post value |
| 25 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 26 | - else{ global $post;} |
|
| 25 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 27 | 26 | |
| 28 | 27 | if(!is_array($cf) && $cf!=''){ |
| 29 | 28 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -77,8 +76,10 @@ discard block |
||
| 77 | 76 | |
| 78 | 77 | if ( $post->{$html_var} == '1' ): |
| 79 | 78 | $html_val = __( 'Yes', 'geodirectory' ); |
| 80 | - else: |
|
| 79 | + else { |
|
| 80 | + : |
|
| 81 | 81 | $html_val = __( 'No', 'geodirectory' ); |
| 82 | + } |
|
| 82 | 83 | endif; |
| 83 | 84 | |
| 84 | 85 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -116,8 +117,7 @@ discard block |
||
| 116 | 117 | function geodir_cf_fieldset($html,$location,$cf,$p=''){ |
| 117 | 118 | |
| 118 | 119 | // check we have the post value |
| 119 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 120 | - else{ global $post;} |
|
| 120 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 121 | 121 | |
| 122 | 122 | if(!is_array($cf) && $cf!=''){ |
| 123 | 123 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -197,8 +197,7 @@ discard block |
||
| 197 | 197 | function geodir_cf_url($html,$location,$cf,$p=''){ |
| 198 | 198 | |
| 199 | 199 | // check we have the post value |
| 200 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 201 | - else{ global $post;} |
|
| 200 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 202 | 201 | |
| 203 | 202 | if(!is_array($cf) && $cf!=''){ |
| 204 | 203 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -313,8 +312,7 @@ discard block |
||
| 313 | 312 | function geodir_cf_phone($html,$location,$cf,$p=''){ |
| 314 | 313 | |
| 315 | 314 | // check we have the post value |
| 316 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 317 | - else{ global $post;} |
|
| 315 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 318 | 316 | |
| 319 | 317 | if(!is_array($cf) && $cf!=''){ |
| 320 | 318 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -403,8 +401,7 @@ discard block |
||
| 403 | 401 | function geodir_cf_time($html,$location,$cf,$p=''){ |
| 404 | 402 | |
| 405 | 403 | // check we have the post value |
| 406 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 407 | - else{ global $post;} |
|
| 404 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 408 | 405 | |
| 409 | 406 | if(!is_array($cf) && $cf!=''){ |
| 410 | 407 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -457,9 +454,10 @@ discard block |
||
| 457 | 454 | if ($post->{$cf['htmlvar_name']}): |
| 458 | 455 | |
| 459 | 456 | $value = ''; |
| 460 | - if ($post->{$cf['htmlvar_name']} != '') |
|
| 461 | - //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
| 457 | + if ($post->{$cf['htmlvar_name']} != '') { |
|
| 458 | + //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
| 462 | 459 | $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']})); |
| 460 | + } |
|
| 463 | 461 | |
| 464 | 462 | $field_icon = geodir_field_icon_proccess($cf); |
| 465 | 463 | if (strpos($field_icon, 'http') !== false) { |
@@ -498,8 +496,7 @@ discard block |
||
| 498 | 496 | function geodir_cf_datepicker($html,$location,$cf,$p=''){ |
| 499 | 497 | global $preview; |
| 500 | 498 | // check we have the post value |
| 501 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 502 | - else{ global $post;} |
|
| 499 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 503 | 500 | |
| 504 | 501 | if(!is_array($cf) && $cf!=''){ |
| 505 | 502 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -566,7 +563,7 @@ discard block |
||
| 566 | 563 | $date_format = str_replace($search, $replace, $date_format); |
| 567 | 564 | |
| 568 | 565 | $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
| 569 | - }else{ |
|
| 566 | + } else{ |
|
| 570 | 567 | $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
| 571 | 568 | } |
| 572 | 569 | |
@@ -575,7 +572,7 @@ discard block |
||
| 575 | 572 | $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
| 576 | 573 | //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
| 577 | 574 | //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
| 578 | - }else{ |
|
| 575 | + } else{ |
|
| 579 | 576 | return ''; |
| 580 | 577 | } |
| 581 | 578 | |
@@ -618,8 +615,7 @@ discard block |
||
| 618 | 615 | function geodir_cf_text($html,$location,$cf,$p=''){ |
| 619 | 616 | |
| 620 | 617 | // check we have the post value |
| 621 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 622 | - else{ global $post;} |
|
| 618 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 623 | 619 | |
| 624 | 620 | if(!is_array($cf) && $cf!=''){ |
| 625 | 621 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -725,8 +721,7 @@ discard block |
||
| 725 | 721 | function geodir_cf_radio($html,$location,$cf,$p=''){ |
| 726 | 722 | |
| 727 | 723 | // check we have the post value |
| 728 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 729 | - else{ global $post;} |
|
| 724 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 730 | 725 | |
| 731 | 726 | if(!is_array($cf) && $cf!=''){ |
| 732 | 727 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -834,8 +829,7 @@ discard block |
||
| 834 | 829 | function geodir_cf_select($html,$location,$cf,$p=''){ |
| 835 | 830 | |
| 836 | 831 | // check we have the post value |
| 837 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 838 | - else{ global $post;} |
|
| 832 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 839 | 833 | |
| 840 | 834 | if(!is_array($cf) && $cf!=''){ |
| 841 | 835 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -936,8 +930,7 @@ discard block |
||
| 936 | 930 | function geodir_cf_multiselect($html,$location,$cf,$p=''){ |
| 937 | 931 | |
| 938 | 932 | // check we have the post value |
| 939 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 940 | - else{ global $post;} |
|
| 933 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 941 | 934 | |
| 942 | 935 | if(!is_array($cf) && $cf!=''){ |
| 943 | 936 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1063,8 +1056,7 @@ discard block |
||
| 1063 | 1056 | function geodir_cf_email($html,$location,$cf,$p=''){ |
| 1064 | 1057 | |
| 1065 | 1058 | // check we have the post value |
| 1066 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1067 | - else{ global $post;} |
|
| 1059 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1068 | 1060 | |
| 1069 | 1061 | if(!is_array($cf) && $cf!=''){ |
| 1070 | 1062 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1200,7 +1192,7 @@ discard block |
||
| 1200 | 1192 | */ |
| 1201 | 1193 | $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
| 1202 | 1194 | $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
| 1203 | - }else{ |
|
| 1195 | + } else{ |
|
| 1204 | 1196 | $html .= $email; |
| 1205 | 1197 | } |
| 1206 | 1198 | $html .= '</span></div>'; |
@@ -1228,8 +1220,7 @@ discard block |
||
| 1228 | 1220 | function geodir_cf_file($html,$location,$cf,$p=''){ |
| 1229 | 1221 | |
| 1230 | 1222 | // check we have the post value |
| 1231 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1232 | - else{ global $post;} |
|
| 1223 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1233 | 1224 | |
| 1234 | 1225 | if(!is_array($cf) && $cf!=''){ |
| 1235 | 1226 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1322,7 +1313,7 @@ discard block |
||
| 1322 | 1313 | $file_paths .= '</a>'; |
| 1323 | 1314 | //$file_paths .= '<img src="'.$file.'" />'; |
| 1324 | 1315 | $file_paths .= '</div>'; |
| 1325 | - }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
| 1316 | + } elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
| 1326 | 1317 | $ext_path = '_' . $html_var . '_'; |
| 1327 | 1318 | $filename = explode($ext_path, $filename); |
| 1328 | 1319 | $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
@@ -1375,8 +1366,7 @@ discard block |
||
| 1375 | 1366 | function geodir_cf_textarea($html,$location,$cf,$p=''){ |
| 1376 | 1367 | |
| 1377 | 1368 | // check we have the post value |
| 1378 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1379 | - else{ global $post;} |
|
| 1369 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1380 | 1370 | |
| 1381 | 1371 | if(!is_array($cf) && $cf!=''){ |
| 1382 | 1372 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1466,8 +1456,7 @@ discard block |
||
| 1466 | 1456 | function geodir_cf_html($html,$location,$cf,$p=''){ |
| 1467 | 1457 | |
| 1468 | 1458 | // check we have the post value |
| 1469 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1470 | - else{ global $post;} |
|
| 1459 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1471 | 1460 | |
| 1472 | 1461 | if(!is_array($cf) && $cf!=''){ |
| 1473 | 1462 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1556,8 +1545,7 @@ discard block |
||
| 1556 | 1545 | function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
| 1557 | 1546 | |
| 1558 | 1547 | // check we have the post value |
| 1559 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1560 | - else{ global $post;} |
|
| 1548 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1561 | 1549 | |
| 1562 | 1550 | if(!is_array($cf) && $cf!=''){ |
| 1563 | 1551 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1679,8 +1667,7 @@ discard block |
||
| 1679 | 1667 | function geodir_cf_address($html,$location,$cf,$p=''){ |
| 1680 | 1668 | |
| 1681 | 1669 | // check we have the post value |
| 1682 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1683 | - else{ global $post;} |
|
| 1670 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1684 | 1671 | |
| 1685 | 1672 | if(!is_array($cf) && $cf!=''){ |
| 1686 | 1673 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |