diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 95951ed29..8f2023830 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -43,8 +43,7 @@ var userSettings = { pagenow = 'id; ?>', typenow = 'post_type) ) echo $current_screen->post_type; ?>', adminpage = '', - thousandsSeparator = 'number_format['thousands_sep'] ); ?>', - decimalPoint = 'number_format['decimal_point'] ); ?>'; + thousandsSeparator = 'number_format['thousands_sep'] ); ?>'; //]]> number_format['decimals'] : intval( $decimals ); - - $num = number_format( $number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); - - // let the user translate digits from latin to localized language - return apply_filters( 'number_format_i18n', $num ); + $number = (int)$number; + if ( !is_null( $decimals ) ) _deprecated_argument( __FUNCTION__, '3.0' ); + $formatted = number_format( $number, 0, null, $wp_locale->number_format['thousands_sep'] ); + return apply_filters( 'number_format_i18n', $formatted ); } /** @@ -163,7 +160,7 @@ function number_format_i18n( $number, $decimals = null ) { * @since 2.3.0 * * @param int|string $bytes Number of bytes. Note max integer size for integers. - * @param int $decimals Precision of number of decimal places. + * @param int $decimals Precision of number of decimal places. Deprecated. * @return bool|string False on failure. Number string on success. */ function size_format( $bytes, $decimals = null ) { @@ -175,10 +172,10 @@ function size_format( $bytes, $decimals = null ) { 'kB' => 1024, // pow( 1024, 1) 'B ' => 1, // pow( 1024, 0) ); - + if ( !is_null( $decimals ) ) _deprecated_argument( __FUNCTION__, '3.0' ); foreach ( $quant as $unit => $mag ) if ( doubleval($bytes) >= $mag ) - return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit; + return number_format_i18n( round( $bytes / $mag ) ) . ' ' . $unit; return false; } diff --git a/wp-includes/load.php b/wp-includes/load.php index e46b9de60..b765a896e 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -219,7 +219,7 @@ function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_st $mtime = explode( ' ', $mtime ); $timeend = $mtime[1] + $mtime[0]; $timetotal = $timeend - $timestart; - $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision ); + $r = number_format( $timetotal, $precision ); if ( $display ) echo $r; return $r; diff --git a/wp-includes/locale.php b/wp-includes/locale.php index 630e30d3c..882e9395d 100644 --- a/wp-includes/locale.php +++ b/wp-includes/locale.php @@ -178,14 +178,6 @@ class WP_Locale { // Numbers formatting // See http://php.net/number_format - /* translators: $decimals argument for http://php.net/number_format, default is 0 */ - $trans = __('number_format_decimals'); - $this->number_format['decimals'] = ('number_format_decimals' == $trans) ? 0 : $trans; - - /* translators: $dec_point argument for http://php.net/number_format, default is . */ - $trans = __('number_format_decimal_point'); - $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans; - /* translators: $thousands_sep argument for http://php.net/number_format, default is , */ $trans = __('number_format_thousands_sep'); $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;