Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master-2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
vboctor committed Jun 4, 2017
2 parents 835d21b + 9c79b02 commit 930e16e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 17 deletions.
29 changes: 20 additions & 9 deletions core/cfdefs/cfdef_standard.php
Expand Up @@ -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',
);
Expand Down Expand Up @@ -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 '<a href="mailto:' . string_attribute( $p_value ) . '">' . string_display_line( $p_value ) . '</a>';
}
}

/**
* 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;
}

/**
Expand Down Expand Up @@ -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 '<a href="mailto:' . string_attribute( $p_value ) . '">' . string_display_line( $p_value ) . '</a>';
return $p_value;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions core/custom_field_api.php
Expand Up @@ -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 ) );
}

/**
Expand Down
8 changes: 6 additions & 2 deletions plugins/MantisCoreFormatting/MantisCoreFormatting.php
Expand Up @@ -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;
Expand Down

0 comments on commit 930e16e

Please sign in to comment.