Skip to content

Commit 909abbd

Browse files
fix sanitization
1 parent 42dc869 commit 909abbd

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

includes/classes/class-field-shortcodes.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public function text_field( $atts ) {
4343
$atts,
4444
'text'
4545
);
46-
46+
47+
$atts['name'] = sanitize_text_field( esc_attr( esc_html__($atts['name']) ) );
48+
4749
// translators: %s: input field name to be entered by the user
4850
$name = sanitize_text_field( sprintf( esc_attr__( 'Enter %s', 'pff-paystack' ), $atts['name'] ) );
4951
$required = $atts['required'] === 'required' ? 'required' : '';
@@ -78,6 +80,8 @@ public function textarea_field( $atts ) {
7880
'textarea'
7981
);
8082

83+
$atts['name'] = sanitize_text_field( esc_attr( esc_html__($atts['name']) ) );
84+
8185
// translators: %s: textarea field to be entered by the user
8286
$name = sanitize_text_field( sprintf( esc_attr__( 'Enter %s', 'pff-paystack' ), $atts['name'] ) );
8387
$required = $atts['required'] === 'required' ? 'required' : '';
@@ -156,7 +160,9 @@ public function input_field( $atts ) {
156160
$atts,
157161
'input'
158162
);
159-
163+
164+
$atts['name'] = sanitize_text_field( esc_attr( esc_html__($atts['name']) ) );
165+
160166
$name = sanitize_text_field( $atts['name'] );
161167
$required = $atts['required'] === 'required' ? 'required' : '';
162168
$fileInputId = uniqid( 'file-input-' );
@@ -195,7 +201,9 @@ public function datepicker_field( $atts ) {
195201
$atts,
196202
'datepicker'
197203
);
198-
204+
205+
$atts['name'] = sanitize_text_field( esc_attr( esc_html__($atts['name']) ) );
206+
199207
// translators: %s: datepicker field to be selected by the user
200208
$name = sanitize_text_field( sprintf( esc_attr__( 'Enter %s', 'pff-paystack' ), $atts['name'] ) );
201209
$required = $atts['required'] === 'required' ? 'required' : '';
@@ -230,6 +238,7 @@ public function select_field( $atts ) {
230238
$atts,
231239
'select'
232240
);
241+
$atts['name'] = sanitize_text_field( esc_attr( esc_html__($atts['name']) ) );
233242

234243
$name = sanitize_text_field( $atts['name'] );
235244
$options = array_map( 'sanitize_text_field', explode( ',', $atts['options'] ) );
@@ -271,7 +280,9 @@ public function radio_field( $atts ) {
271280
$atts,
272281
'radio'
273282
);
274-
283+
284+
$atts['name'] = sanitize_text_field( esc_attr( esc_html__($atts['name']) ) );
285+
275286
$name = sanitize_text_field( $atts['name'] );
276287
$options = array_map( 'sanitize_text_field', explode( ',', $atts['options'] ) );
277288
$required = $atts['required'] === 'required' ? 'required' : '';

0 commit comments

Comments
 (0)