In `size_format()` and `wp_convert_bytes_to_hr()`, replace `kB` with `KB` for consistency with other units.

Props Presskopp, dashaluna.
Fixes #37037.

git-svn-id: https://develop.svn.wordpress.org/trunk@37702 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
SergeyBiryukov 2016-06-14 21:40:02 +00:00
parent 2e81613be8
commit aea4c0d86a
3 changed files with 5 additions and 5 deletions

View File

@ -3329,7 +3329,7 @@ function gd_edit_image_support($mime_type) {
function wp_convert_bytes_to_hr( $bytes ) {
_deprecated_function( __FUNCTION__, '3.6', 'size_format()' );
$units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
$units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
$log = log( $bytes, KB_IN_BYTES );
$power = (int) $log;
$size = pow( KB_IN_BYTES, $log - $power );

View File

@ -237,7 +237,7 @@ function number_format_i18n( $number, $decimals = 0 ) {
/**
* Convert number of bytes largest unit bytes will fit into.
*
* It is easier to read 1 kB than 1024 bytes and 1 MB than 1048576 bytes. Converts
* It is easier to read 1 KB than 1024 bytes and 1 MB than 1048576 bytes. Converts
* number of bytes to human readable number by taking the number of that unit
* that the bytes will go into it. Supports TB value.
*
@ -259,7 +259,7 @@ function size_format( $bytes, $decimals = 0 ) {
'TB' => TB_IN_BYTES,
'GB' => GB_IN_BYTES,
'MB' => MB_IN_BYTES,
'kB' => KB_IN_BYTES,
'KB' => KB_IN_BYTES,
'B' => 1,
);

View File

@ -273,12 +273,12 @@ https://w.org</a>'
$this->assertEquals( '1TB', wp_convert_bytes_to_hr( $tb ) );
$this->assertEquals( '1GB', wp_convert_bytes_to_hr( $gb ) );
$this->assertEquals( '1MB', wp_convert_bytes_to_hr( $mb ) );
$this->assertEquals( '1kB', wp_convert_bytes_to_hr( $kb ) );
$this->assertEquals( '1KB', wp_convert_bytes_to_hr( $kb ) );
$this->assertEquals( '1 TB', size_format( $tb ) );
$this->assertEquals( '1 GB', size_format( $gb ) );
$this->assertEquals( '1 MB', size_format( $mb ) );
$this->assertEquals( '1 kB', size_format( $kb ) );
$this->assertEquals( '1 KB', size_format( $kb ) );
// now some values around
$hr = wp_convert_bytes_to_hr( $tb + $tb / 2 + $mb );