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.../public_h.../wp-conte.../plugins/wpforms-.../includes/fields
File: class-base.php
$container = [
[3500] Fix | Delete
'id' => "wpforms-{$form_id}-field_{$field_id}-quantity",
[3501] Fix | Delete
'class' => [ 'wpforms-payment-quantity' ],
[3502] Fix | Delete
'attr' => [
[3503] Fix | Delete
'name' => "wpforms[quantities][{$field_id}]",
[3504] Fix | Delete
],
[3505] Fix | Delete
'data' => [],
[3506] Fix | Delete
];
[3507] Fix | Delete
$is_modern = ! empty( $field['style'] ) && $field['style'] === 'modern';
[3508] Fix | Delete
[3509] Fix | Delete
// Add a class for Choices.js initialization.
[3510] Fix | Delete
if ( $is_modern ) {
[3511] Fix | Delete
$container['class'][] = 'choicesjs-select';
[3512] Fix | Delete
$container['data']['size-class'] = 'wpforms-payment-quantity';
[3513] Fix | Delete
$container['data']['search-enabled'] = $this->is_quantity_choicesjs_search_enabled( $field );
[3514] Fix | Delete
$container['data']['remove-items-enabled'] = false;
[3515] Fix | Delete
}
[3516] Fix | Delete
[3517] Fix | Delete
// Add required attribute.
[3518] Fix | Delete
if ( ! empty( $field['required'] ) ) {
[3519] Fix | Delete
$container['attr']['required'] = 'required';
[3520] Fix | Delete
}
[3521] Fix | Delete
[3522] Fix | Delete
// Preselect default if no other choices were marked as default.
[3523] Fix | Delete
printf(
[3524] Fix | Delete
'<select %s>',
[3525] Fix | Delete
wpforms_html_attributes( $container['id'], $container['class'], $container['data'], $container['attr'] ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[3526] Fix | Delete
);
[3527] Fix | Delete
[3528] Fix | Delete
// Reset Max quantity in case minimum is higher.
[3529] Fix | Delete
$field['max_quantity'] = max( (int) $field['min_quantity'], (int) $field['max_quantity'] );
[3530] Fix | Delete
[3531] Fix | Delete
$default = $field['properties']['quantity'] ?? $field['min_quantity'];
[3532] Fix | Delete
[3533] Fix | Delete
for ( $option = $field['min_quantity']; $option <= $field['max_quantity']; $option++ ) {
[3534] Fix | Delete
printf(
[3535] Fix | Delete
'<option value="%1$s" %2$s >%3$s</option>', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[3536] Fix | Delete
esc_attr( $option ),
[3537] Fix | Delete
selected( $option, $default, false ),
[3538] Fix | Delete
esc_html( $option )
[3539] Fix | Delete
);
[3540] Fix | Delete
}
[3541] Fix | Delete
[3542] Fix | Delete
echo '</select>';
[3543] Fix | Delete
}
[3544] Fix | Delete
[3545] Fix | Delete
/**
[3546] Fix | Delete
* Add class to the builder field preview.
[3547] Fix | Delete
*
[3548] Fix | Delete
* @since 1.8.7
[3549] Fix | Delete
*
[3550] Fix | Delete
* @param string $css Class names.
[3551] Fix | Delete
* @param array $field Field properties.
[3552] Fix | Delete
*
[3553] Fix | Delete
* @return string
[3554] Fix | Delete
*/
[3555] Fix | Delete
public function preview_field_class( $css, $field ) {
[3556] Fix | Delete
[3557] Fix | Delete
if ( $field['type'] !== $this->type ) {
[3558] Fix | Delete
return $css;
[3559] Fix | Delete
}
[3560] Fix | Delete
[3561] Fix | Delete
if ( $this->is_payment_quantities_enabled( $field ) ) {
[3562] Fix | Delete
$css .= ' payment-quantity-enabled';
[3563] Fix | Delete
}
[3564] Fix | Delete
[3565] Fix | Delete
return $css;
[3566] Fix | Delete
}
[3567] Fix | Delete
[3568] Fix | Delete
/**
[3569] Fix | Delete
* Determine if payment quantities enabled.
[3570] Fix | Delete
*
[3571] Fix | Delete
* @since 1.8.7
[3572] Fix | Delete
*
[3573] Fix | Delete
* @param array $field_settings Field settings.
[3574] Fix | Delete
*
[3575] Fix | Delete
* @return bool
[3576] Fix | Delete
*/
[3577] Fix | Delete
protected function is_payment_quantities_enabled( $field_settings ) {
[3578] Fix | Delete
[3579] Fix | Delete
if ( empty( $field_settings['enable_quantity'] ) ) {
[3580] Fix | Delete
return false;
[3581] Fix | Delete
}
[3582] Fix | Delete
[3583] Fix | Delete
// Quantity available only for `single` format of the Single payment field.
[3584] Fix | Delete
if ( $field_settings['type'] === 'payment-single' && $field_settings['format'] !== 'single' ) {
[3585] Fix | Delete
return false;
[3586] Fix | Delete
}
[3587] Fix | Delete
[3588] Fix | Delete
// Otherwise return true.
[3589] Fix | Delete
return true;
[3590] Fix | Delete
}
[3591] Fix | Delete
[3592] Fix | Delete
/**
[3593] Fix | Delete
* Get field payment submitted quantity.
[3594] Fix | Delete
*
[3595] Fix | Delete
* @since 1.8.7
[3596] Fix | Delete
*
[3597] Fix | Delete
* @param array $field Field data.
[3598] Fix | Delete
* @param array $form_data Form data and settings.
[3599] Fix | Delete
*
[3600] Fix | Delete
* @return int
[3601] Fix | Delete
*/
[3602] Fix | Delete
protected function get_submitted_field_quantity( $field, $form_data ) {
[3603] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.Missing
[3604] Fix | Delete
$has_submitted_quantity = isset( $_POST['wpforms']['quantities'][ $field['id'] ] );
[3605] Fix | Delete
$submitted_quantity = $has_submitted_quantity ? (int) $_POST['wpforms']['quantities'][ $field['id'] ] : 0;
[3606] Fix | Delete
// phpcs:enable WordPress.Security.NonceVerification.Missing
[3607] Fix | Delete
[3608] Fix | Delete
if ( ! $has_submitted_quantity && isset( $form_data['quantities'][ $field['id'] ] ) ) {
[3609] Fix | Delete
$submitted_quantity = (int) $form_data['quantities'][ $field['id'] ];
[3610] Fix | Delete
}
[3611] Fix | Delete
[3612] Fix | Delete
$min_quantity = (int) $field['min_quantity'];
[3613] Fix | Delete
// Verify submitted quantity value.
[3614] Fix | Delete
if ( $submitted_quantity >= $min_quantity && $submitted_quantity <= (int) $field['max_quantity'] ) {
[3615] Fix | Delete
return $submitted_quantity;
[3616] Fix | Delete
}
[3617] Fix | Delete
[3618] Fix | Delete
// Otherwise return a minimum quantity.
[3619] Fix | Delete
return $min_quantity;
[3620] Fix | Delete
}
[3621] Fix | Delete
}
[3622] Fix | Delete
[3623] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function