diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 8f2023830..95951ed29 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -43,7 +43,8 @@ var userSettings = { pagenow = 'id; ?>', typenow = 'post_type) ) echo $current_screen->post_type; ?>', adminpage = '', - thousandsSeparator = 'number_format['thousands_sep'] ); ?>'; + thousandsSeparator = 'number_format['thousands_sep'] ); ?>', + decimalPoint = 'number_format['decimal_point'] ); ?>'; //]]> number_format['thousands_sep'] ); + $formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); return apply_filters( 'number_format_i18n', $formatted ); } @@ -163,7 +162,7 @@ function number_format_i18n( $number, $decimals = null ) { * @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 ) { +function size_format( $bytes, $decimals = 0 ) { $quant = array( // ========================= Origin ==== 'TB' => 1099511627776, // pow( 1024, 4) @@ -172,10 +171,9 @@ 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( round( $bytes / $mag ) ) . ' ' . $unit; + return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit; return false; } diff --git a/wp-includes/load.php b/wp-includes/load.php index b765a896e..e46b9de60 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 = number_format( $timetotal, $precision ); + $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision ); if ( $display ) echo $r; return $r; diff --git a/wp-includes/locale.php b/wp-includes/locale.php index 882e9395d..4972b8b7d 100644 --- a/wp-includes/locale.php +++ b/wp-includes/locale.php @@ -181,6 +181,10 @@ class WP_Locale { /* 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; + + /* 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; // Import global locale vars set during inclusion of $locale.php. foreach ( (array) $this->locale_vars as $var ) {