diff --git a/core/cfdefs/cfdef_standard.php b/core/cfdefs/cfdef_standard.php index 4b4274c80a..a9234a683e 100644 --- a/core/cfdefs/cfdef_standard.php +++ b/core/cfdefs/cfdef_standard.php @@ -107,7 +107,7 @@ '#function_value_to_database' => null, '#function_database_to_value' => null, '#function_print_input' => 'cfdef_input_textbox', - '#function_print_value' => null, + '#function_print_value' => 'cfdef_print_email_value', '#function_string_value' => 'cfdef_prepare_email_value', '#function_string_value_for_email' => 'cfdef_prepare_email_value_for_email', ); @@ -261,12 +261,23 @@ function cfdef_prepare_list_value_for_email( $p_value ) { } /** - * Format email address for email - * @param string $p_value Value. - * @return string + * Print the value of the email custom field. + * @param string $p_value The database value + * @return void + */ +function cfdef_print_email_value( $p_value ) { + if( !is_blank( $p_value ) ) { + echo '' . string_display_line( $p_value ) . ''; + } +} + +/** + * Format email address for text email + * @param string $p_value The database value. + * @return string The plain text value */ function cfdef_prepare_email_value_for_email( $p_value ) { - return 'mailto:' . $p_value; + return is_null( $p_value ) ? '' : $p_value; } /** @@ -321,12 +332,12 @@ function cfdef_prepare_list_value( $p_value ) { } /** - * Prepare email value - * @param string $p_value Email address. - * @return string + * Get the value for the email custom field. + * @param string $p_value The database value + * @return string The email value. */ function cfdef_prepare_email_value( $p_value ) { - return '' . string_display_line( $p_value ) . ''; + return $p_value; } /** diff --git a/core/custom_field_api.php b/core/custom_field_api.php index aac9cbd09c..8999217d5a 100644 --- a/core/custom_field_api.php +++ b/core/custom_field_api.php @@ -1449,17 +1449,17 @@ function string_custom_field_value( array $p_def, $p_field_id, $p_bug_id ) { * @access public */ function print_custom_field_value( array $p_def, $p_field_id, $p_bug_id ) { - $t_custom_field_value = custom_field_get_value( $p_field_id, $p_bug_id ); - if( $t_custom_field_value === null ) { - return; - } - global $g_custom_field_type_definition; if( isset( $g_custom_field_type_definition[$p_def['type']]['#function_print_value'] ) ) { + $t_custom_field_value = custom_field_get_value( $p_field_id, $p_bug_id ); + if( $t_custom_field_value === null ) { + return; + } + return call_user_func( $g_custom_field_type_definition[$p_def['type']]['#function_print_value'], $t_custom_field_value ); } - echo string_display_line_links( $t_custom_field_value ); + echo string_display_line_links( string_custom_field_value( $p_def, $p_field_id, $p_bug_id ) ); } /** diff --git a/plugins/MantisCoreFormatting/MantisCoreFormatting.php b/plugins/MantisCoreFormatting/MantisCoreFormatting.php index 9c2dbc9517..b13b8b8553 100644 --- a/plugins/MantisCoreFormatting/MantisCoreFormatting.php +++ b/plugins/MantisCoreFormatting/MantisCoreFormatting.php @@ -190,8 +190,12 @@ function formatted( $p_event, $p_string, $p_multiline = true ) { $t_string = mention_format_text( $t_string, /* html */ true ); # Process Markdown - if( ON == $s_markdown && $p_multiline ) { - $t_string = MantisMarkdown::convert_text( $t_string ); + if( ON == $s_markdown ) { + if( $p_multiline ) { + $t_string = MantisMarkdown::convert_text( $t_string ); + } else { + $t_string = MantisMarkdown::convert_line( $t_string ); + } } return $t_string;