Skip to content

Commit

Permalink
No longer use the removed 'filter' option in the settings fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Oct 11, 2023
1 parent 627ef2e commit 5fa1e5c
Showing 1 changed file with 37 additions and 10 deletions.
47 changes: 37 additions & 10 deletions src/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,52 +161,79 @@ public function get_settings_fields() {
// Number Days Valid.
$fields[] = [
'section' => 'general',
'filter' => FILTER_SANITIZE_NUMBER_INT,
'group' => 'pk-cert',
'meta_key' => '_pronamic_gateway_number_days_valid',
'title' => __( 'Number Days Valid', 'pronamic_ideal' ),
'type' => 'text',
'default' => 1825,
'tooltip' => __( 'Number of days the generated certificate will be valid for, e.g. 1825 days for the maximum duration of 5 years.', 'pronamic_ideal' ),
'input' => function( $name ) {
if ( ! \array_key_exists( $name, $_POST ) ) {

Check failure on line 171 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Processing form data without nonce verification.
return '';
}

return \filter_var( \sanitize_text_field( \wp_unslash( $_POST[ $name ] ) ), \FILTER_SANITIZE_NUMBER_INT );

Check failure on line 175 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Processing form data without nonce verification.
}

Check failure on line 176 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Each array item in a multi-line array declaration must end in a comma
];

// Secret Key Password.
$fields[] = [
'section' => 'general',
'group' => 'pk-cert',
'meta_key' => '_pronamic_gateway_ideal_private_key_password',
'title' => __( 'Secret Key Password', 'pronamic_ideal' ),
'title' => __( 'Secret Key Password', 'pronamic-ideal' ),
'type' => 'text',
'filter' => \FILTER_UNSAFE_RAW,
'classes' => [ 'regular-text', 'code' ],
'default' => wp_generate_password(),
'tooltip' => __( 'A random password which will be used for the generation of the secret key and certificate.', 'pronamic_ideal' ),
'tooltip' => __( 'A random password which will be used for the generation of the secret key and certificate.', 'pronamic-ideal' ),
'input' => function( $name ) {
if ( ! \array_key_exists( $name, $_POST ) ) {

Check failure on line 190 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Processing form data without nonce verification.
return '';
}

// phpcs:ignore Detected usage of a non-sanitized input variable -- Password can contain whitespace, HTML tags and percent-encoded characters.
return $_POST[ $name ];

Check warning on line 195 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Detected usage of a non-sanitized input variable: $_POST[$name]

Check failure on line 195 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Processing form data without nonce verification.
}

Check failure on line 196 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Each array item in a multi-line array declaration must end in a comma
];

// Secret Key.
$fields[] = [
'section' => 'general',
'group' => 'pk-cert',
'meta_key' => '_pronamic_gateway_ideal_private_key',
'title' => __( 'Secret Key', 'pronamic_ideal' ),
'title' => __( 'Secret Key', 'pronamic-ideal' ),
'type' => 'textarea',
'filter' => \FILTER_UNSAFE_RAW,
'callback' => [ $this, 'field_private_key' ],
'classes' => [ 'code' ],
'tooltip' => __( 'The secret key is used for secure communication with the payment provider. If left empty, the secret key will be generated using the given secret key password.', 'pronamic_ideal' ),
'tooltip' => __( 'The secret key is used for secure communication with the payment provider. If left empty, the secret key will be generated using the given secret key password.', 'pronamic-ideal' ),
'input' => function( $name ) {
if ( ! \array_key_exists( $name, $_POST ) ) {

Check failure on line 210 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Processing form data without nonce verification.
return '';
}

// phpcs:ignore Detected usage of a non-sanitized input variable -- Private key can contain whitespace, HTML tags and percent-encoded characters.
return $_POST[ $name ];

Check warning on line 215 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Detected usage of a non-sanitized input variable: $_POST[$name]

Check failure on line 215 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Processing form data without nonce verification.
}

Check failure on line 216 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Each array item in a multi-line array declaration must end in a comma
];

// Certificate.
$fields[] = [
'section' => 'general',
'group' => 'pk-cert',
'meta_key' => '_pronamic_gateway_ideal_private_certificate',
'title' => __( 'Certificate', 'pronamic_ideal' ),
'title' => __( 'Certificate', 'pronamic-ideal' ),
'type' => 'textarea',
'filter' => \FILTER_UNSAFE_RAW,
'callback' => [ $this, 'field_certificate' ],
'classes' => [ 'code' ],
'tooltip' => __( 'The certificate is used for secure communication with the payment provider. If left empty, the certificate will be generated using the secret key and given organization details.', 'pronamic_ideal' ),
'tooltip' => __( 'The certificate is used for secure communication with the payment provider. If left empty, the certificate will be generated using the secret key and given organization details.', 'pronamic-ideal' ),
'input' => function( $name ) {
if ( ! \array_key_exists( $name, $_POST ) ) {

Check failure on line 230 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Processing form data without nonce verification.
return '';
}

// phpcs:ignore Detected usage of a non-sanitized input variable -- Certificate can contain whitespace, HTML tags and percent-encoded characters.
return $_POST[ $name ];

Check warning on line 235 in src/Integration.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

Detected usage of a non-sanitized input variable: $_POST[$name]
}
];

// Return.
Expand Down

0 comments on commit 5fa1e5c

Please sign in to comment.