mirror of
https://github.com/10h30/woo-viet.git
synced 2026-06-05 15:09:49 +09:00
Sanitize admin settings
This commit is contained in:
@@ -36,7 +36,7 @@ class WooViet_Admin_Page {
|
|||||||
*/
|
*/
|
||||||
public function save_settings() {
|
public function save_settings() {
|
||||||
if ( wp_verify_nonce( $_REQUEST['wooviet_nonce'], 'wooviet_save_settings' ) ) {
|
if ( wp_verify_nonce( $_REQUEST['wooviet_nonce'], 'wooviet_save_settings' ) ) {
|
||||||
update_option( 'woo-viet', $_REQUEST['settings'] );
|
update_option( 'woo-viet', $this->sanitize_settings( $_REQUEST['settings'] ) );
|
||||||
|
|
||||||
$this->message =
|
$this->message =
|
||||||
'<div class="updated notice"><p><strong>' .
|
'<div class="updated notice"><p><strong>' .
|
||||||
@@ -327,4 +327,25 @@ class WooViet_Admin_Page {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* Sanitize admin settings.
|
||||||
|
*
|
||||||
|
* @author htdat
|
||||||
|
* @since 1.5.3
|
||||||
|
*
|
||||||
|
* @param array $settings User input settings.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function sanitize_settings( array $settings ): array {
|
||||||
|
$sanitized_settings = array();
|
||||||
|
|
||||||
|
foreach ( $settings as $feature => $feature_options ) {
|
||||||
|
foreach ( $feature_options as $option => $value ) {
|
||||||
|
$sanitized_settings[ $feature ][ $option ] = esc_html( sanitize_text_field( $value ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sanitized_settings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ Xem phiên bản tiếng Việt tại đây https://vi.wordpress.org/plugins/woo
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 1.5.3 - 2024.01.13
|
||||||
|
|
||||||
|
* Update - Sanitize admin settings to avoid XSS. Thanks Dhabaleshwar Das.
|
||||||
|
|
||||||
### 1.5.2 - 2021.10.03
|
### 1.5.2 - 2021.10.03
|
||||||
|
|
||||||
* Update - tested with WP 5.8.1 and WC 5.7.1. #86
|
* Update - tested with WP 5.8.1 and WC 5.7.1. #86
|
||||||
|
|||||||
+2
-2
@@ -7,10 +7,10 @@
|
|||||||
* Author URI: https://profiles.wordpress.org/htdat
|
* Author URI: https://profiles.wordpress.org/htdat
|
||||||
* Text Domain: woo-viet
|
* Text Domain: woo-viet
|
||||||
* Domain Path: /languages
|
* Domain Path: /languages
|
||||||
* Version: 1.5.2
|
* Version: 1.5.3
|
||||||
*
|
*
|
||||||
* WC requires at least: 3.0
|
* WC requires at least: 3.0
|
||||||
* WC tested up to: 5.7.1
|
* WC tested up to: 8.4.0
|
||||||
*
|
*
|
||||||
* License: GPLv2+
|
* License: GPLv2+
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user