Function Reference: geodir_cf_email

Summary

Get the html output for the custom field: email

Parameters

$html
(string) (required) The html to be filtered.

Default: None
$location
(string) (required) The location to output the html.

Default: None
$cf
(array) (required) The custom field array details.

Default: None

Return Values

(string)
  • The html to output for the custom field.

Change Log

Since: 1.6.6

Filters

‘geodir_custom_field_output_email_loc_{$location}’ [Line: 1085]

‘geodir_custom_field_output_email_var_{$html_var}’ [Line: 1098]

‘geodir_custom_field_output_email_key_{$cf[field_type_key]}’ [Line: 1111]

‘b_send_inquiry_url’ [Line: 1146]

Source File

geodir_cf_email() is located in geodirectory-functions/custom_fields_output_functions.php [Line: 1063]

Source Code

function geodir_cf_email($html,$location,$cf,$p=''){

    // check we have the post value
    if(is_int($p)){$post = geodir_get_post_info($p);}
    else{ global $post;}

    if(!is_array($cf) && $cf!=''){
        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
        if(!$cf){return NULL;}
    }

    $html_var = $cf['htmlvar_name'];

    // Check if there is a location specific filter.
    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
        /**
         * Filter the email html by location.
         *
         * @param string $html The html to filter.
         * @param array $cf The custom field array.
         * @since 1.6.6
         */
        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
    }

    // Check if there is a custom field specific filter.
    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
        /**
         * Filter the email html by individual custom field.
         *
         * @param string $html The html to filter.
         * @param string $location The location to output the html.
         * @param array $cf The custom field array.
         * @since 1.6.6
         */
        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
    }

    // Check if there is a custom field key specific filter.
    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
        /**
         * Filter the email html by field type key.
         *
         * @param string $html The html to filter.
         * @param string $location The location to output the html.
         * @param array $cf The custom field array.
         * @since 1.6.6
         */
        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
    }

    // If not html then we run the standard output.
    if(empty($html)){

        global $preview;
        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
            return ''; // Remove Send Enquiry from listings page
        }

        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);

        if ($cf['htmlvar_name'] == 'geodir_email' && $post->{$cf['htmlvar_name']}) {
            $b_send_inquiry = '';

            $html = '';
            if (!$preview) {
                $b_send_inquiry = 'b_send_inquiry';
                $html = '
'; } $field_icon = geodir_field_icon_proccess($cf); if (strpos($field_icon, 'http') !== false) { $field_icon_af = ''; } elseif ($field_icon == '') { $field_icon_af = ''; } else { $field_icon_af = $field_icon; $field_icon = ''; } $html .= '
' . $field_icon_af; $seperator = ''; if ($post->{$cf['htmlvar_name']}) { $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); $html .= '' . SEND_INQUIRY . ''; } $html .= '
'; if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { $html .= '

' . SEND_INQUIRY_SUCCESS . '

'; } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { $html .= '

' . WRONG_CAPTCH_MSG . '

'; } /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ } else { if ($post->{$cf['htmlvar_name']}) { $field_icon = geodir_field_icon_proccess($cf); if (strpos($field_icon, 'http') !== false) { $field_icon_af = ''; } elseif ($field_icon == '') { $field_icon_af = ''; } else { $field_icon_af = $field_icon; $field_icon = ''; } $html = '
' . $field_icon_af; $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; $html .= ''; $email = $post->{$cf['htmlvar_name']} ; if($e_split = explode('@',$email)){ /** * Filter email custom field name output. * * @since 1.5.3 * * @param string $email The email string being output. * @param array $cf Custom field variables array. */ $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); if($location=='mapbubble'){ $html .= "$email_name"; }else{ $html .= ""; } }else{ $html .= $email; } $html .= '
'; } } } return $html; }