parent
d01f1eea3c
commit
1c364e79e4
|
@ -142,8 +142,17 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $this->settings as $key => $setting ) {
|
foreach ( $this->settings as $key => $setting ) {
|
||||||
|
if ( 'number' === $setting['type'] ) {
|
||||||
|
$instance[ $key ] = sanitize_text_field( $new_instance[ $key ] );
|
||||||
|
|
||||||
if ( isset( $new_instance[ $key ] ) ) {
|
if ( isset( $setting['min'] ) && '' !== $setting['min'] ) {
|
||||||
|
$instance[ $key ] = max( $instance[ $key ], $setting['min'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( $setting['max'] ) && '' !== $setting['max'] ) {
|
||||||
|
$instance[ $key ] = min( $instance[ $key ], $setting['max'] );
|
||||||
|
}
|
||||||
|
} elseif ( isset( $new_instance[ $key ] ) ) {
|
||||||
$instance[ $key ] = sanitize_text_field( $new_instance[ $key ] );
|
$instance[ $key ] = sanitize_text_field( $new_instance[ $key ] );
|
||||||
} elseif ( 'checkbox' === $setting['type'] ) {
|
} elseif ( 'checkbox' === $setting['type'] ) {
|
||||||
$instance[ $key ] = 0;
|
$instance[ $key ] = 0;
|
||||||
|
|
Loading…
Reference in New Issue