Improve float sanitization
This commit is contained in:
parent
22b7952cd4
commit
e38ffa05f1
@ -1359,16 +1359,16 @@ function fictioneer_sanitize_positive_float( $value, $default = 0.0 ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes the word count modifier
|
||||
* Sanitize callback with positive float or default 1.0
|
||||
*
|
||||
* @since 5.9.4
|
||||
* @since 5.10.1
|
||||
*
|
||||
* @param mixed $value The value to be sanitized.
|
||||
*
|
||||
* @return float The sanitized float.
|
||||
* @return float The sanitized positive float.
|
||||
*/
|
||||
|
||||
function fictioneer_sanitize_word_count_modifier( $value ) {
|
||||
function fictioneer_sanitize_float_field( $value ) {
|
||||
// Ensure $value is numeric in the first place
|
||||
if ( ! is_numeric( $value ) ) {
|
||||
return 1.0;
|
||||
|
@ -783,7 +783,7 @@ define( 'FICTIONEER_OPTIONS', array(
|
||||
'fictioneer_word_count_multiplier' => array(
|
||||
'name' => 'fictioneer_word_count_multiplier',
|
||||
'group' => 'fictioneer-settings-general-group',
|
||||
'sanitize_callback' => 'fictioneer_sanitize_word_count_modifier',
|
||||
'sanitize_callback' => 'fictioneer_sanitize_float_field',
|
||||
'label' => __( 'Multiplier for displayed word counts.', 'fictioneer' ),
|
||||
'default' => 1.0
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user