Skip to content

Commit

Permalink
Handle line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kennym committed May 21, 2020
1 parent af01f43 commit 9548fca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion includes/class-cf7-api-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,11 @@ function get_record( $submission , $qs_cf7_data_map , $type = "params", $templat
}else{
$value = isset($submited_data[$form_key]) ? $submited_data[$form_key] : "";

//flattan radio
// handle line breaks (suggested by Felix Schäfer)
$value = preg_replace('/\r|\n/', '\\n', $value);
$value = str_replace('\\n\\n', '\n', $value);

// flatten radio
if( is_array( $value ) ){
$value = reset( $value );
}
Expand Down

1 comment on commit 9548fca

@denobula
Copy link

@denobula denobula commented on 9548fca Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this makes no sense to me, there are receiving systems that do need the linebreak in "Windows" style (\r\n).
Second of course a double linebreak could be removed, but I would never "hide" this functionality like done here.
This is deciding in the name of the user - maybe a double linebreak is exactly what the user wanted.

Please sign in to comment.