updated plugin Easy Digital Downloads version 3.1.1.2

This commit is contained in:
2023-03-17 22:34:04 +00:00
committed by Gitium
parent e8a66564bd
commit 19e086d1c4
647 changed files with 20986 additions and 27305 deletions

View File

@ -51,17 +51,20 @@ function edd_sanitize_amount( $amount = 0 ) {
$amount = str_replace( $decimal_sep, '.', $amount );
// Amount contains comma as thousands separator
} elseif( ( $thousands_sep === ',' ) && ( false !== $found_thousands ) ) {
} elseif ( ( $thousands_sep === ',' ) && ( false !== $found_thousands ) ) {
$amount = str_replace( $thousands_sep, '', $amount );
}
// Check if negative (before stripping characters below)
// Remove anything that's not a number, period, or negative sign.
$amount = preg_replace( '/[^0-9\.\-]/', '', $amount );
// Check if negative.
$negative_exponent = ( $amount < 0 )
? -1
: 1;
// Only numbers and period
$amount = preg_replace( '/[^0-9\.]/', '', $amount );
// Cast the amount to an absolute value.
$amount = '' === $amount ? 0 : abs( (float) $amount );
/**
* Filter number of decimals to use for sanitized amount
@ -73,11 +76,6 @@ function edd_sanitize_amount( $amount = 0 ) {
*/
$decimals = apply_filters( 'edd_sanitize_amount_decimals', 2, $amount );
// Check for empty strings before we multiply.
if ( '' === $amount ) {
$amount = 0;
}
// Flip back to negative
$sanitized = $amount * $negative_exponent;