Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/wpforms-.../src/Forms/Fields/PaymentC...
File: Field.php
* @param int $field_id Field ID.
[500] Fix | Delete
* @param array $field_submit Array of selected choice IDs.
[501] Fix | Delete
* @param array $form_data Form data and settings.
[502] Fix | Delete
*/
[503] Fix | Delete
public function format( $field_id, $field_submit, $form_data ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh, Generic.Metrics.NestingLevel.MaxExceeded
[504] Fix | Delete
[505] Fix | Delete
$field_submit = array_values( (array) $field_submit );
[506] Fix | Delete
$field = $form_data['fields'][ $field_id ];
[507] Fix | Delete
$name = sanitize_text_field( $field['label'] );
[508] Fix | Delete
$amount = 0;
[509] Fix | Delete
$images = [];
[510] Fix | Delete
$choice_values = [];
[511] Fix | Delete
$choice_labels = [];
[512] Fix | Delete
$choice_keys = [];
[513] Fix | Delete
[514] Fix | Delete
if ( ! empty( $field_submit ) ) {
[515] Fix | Delete
foreach ( $field_submit as $choice_checked ) {
[516] Fix | Delete
foreach ( $field['choices'] as $choice_id => $choice ) {
[517] Fix | Delete
// Exit early.
[518] Fix | Delete
if ( (int) $choice_checked !== (int) $choice_id ) {
[519] Fix | Delete
continue;
[520] Fix | Delete
}
[521] Fix | Delete
[522] Fix | Delete
$value = (float) wpforms_sanitize_amount( $choice['value'] );
[523] Fix | Delete
[524] Fix | Delete
// Increase total amount.
[525] Fix | Delete
$amount += $value;
[526] Fix | Delete
[527] Fix | Delete
$value = wpforms_format_amount( $value, true );
[528] Fix | Delete
$choice_label = '';
[529] Fix | Delete
[530] Fix | Delete
if ( ! empty( $choice['label'] ) ) {
[531] Fix | Delete
$choice_label = sanitize_text_field( $choice['label'] );
[532] Fix | Delete
$value = $choice_label . ' - ' . $value;
[533] Fix | Delete
}
[534] Fix | Delete
[535] Fix | Delete
$choice_labels[] = $choice_label;
[536] Fix | Delete
$choice_values[] = $value;
[537] Fix | Delete
$choice_keys[] = $choice_id;
[538] Fix | Delete
}
[539] Fix | Delete
}
[540] Fix | Delete
[541] Fix | Delete
if ( ! empty( $choice_keys ) && ! empty( $field['choices_images'] ) ) {
[542] Fix | Delete
foreach ( $choice_keys as $choice_key ) {
[543] Fix | Delete
$images[] = ! empty( $field['choices'][ $choice_key ]['image'] ) ? esc_url_raw( $field['choices'][ $choice_key ]['image'] ) : '';
[544] Fix | Delete
}
[545] Fix | Delete
}
[546] Fix | Delete
}
[547] Fix | Delete
[548] Fix | Delete
wpforms()->get( 'process' )->fields[ $field_id ] = [
[549] Fix | Delete
'name' => $name,
[550] Fix | Delete
'value' => implode( "\r\n", $choice_values ),
[551] Fix | Delete
'value_choice' => implode( "\r\n", $choice_labels ),
[552] Fix | Delete
'value_raw' => implode( ',', array_map( 'absint', $field_submit ) ),
[553] Fix | Delete
'amount' => wpforms_format_amount( $amount ),
[554] Fix | Delete
'amount_raw' => $amount,
[555] Fix | Delete
'currency' => wpforms_get_currency(),
[556] Fix | Delete
'images' => $images,
[557] Fix | Delete
'id' => absint( $field_id ),
[558] Fix | Delete
'type' => sanitize_key( $this->type ),
[559] Fix | Delete
];
[560] Fix | Delete
}
[561] Fix | Delete
}
[562] Fix | Delete
[563] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function