Deprecate wp_convert_bytes_to_hr() in favor of size_format(). props F J Kaiser. fixes #19067.

git-svn-id: http://core.svn.wordpress.org/trunk@23439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2013-02-16 03:07:56 +00:00
parent 8252213fde
commit bc2ff9d342
3 changed files with 16 additions and 17 deletions

View File

@ -776,7 +776,7 @@ function wp_dropdown_roles( $selected = false ) {
*/ */
function wp_import_upload_form( $action ) { function wp_import_upload_form( $action ) {
$bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
$size = wp_convert_bytes_to_hr( $bytes ); $size = size_format( $bytes );
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
if ( ! empty( $upload_dir['error'] ) ) : if ( ! empty( $upload_dir['error'] ) ) :
?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p> ?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>

View File

@ -3364,3 +3364,18 @@ function gd_edit_image_support($mime_type) {
} }
return false; return false;
} }
/**
* Converts an integer byte value to a shorthand byte value.
*
* @since 2.3.0
* @deprecated 3.6.0
* @deprecated Use size_format()
*
* @param int $bytes An integer byte value.
* @return string A shorthand byte value.
*/
function wp_convert_bytes_to_hr( $bytes ) {
_deprecated_function( __FUNCTION__, '3.6', 'size_format()' );
return size_format( $bytes );
}

View File

@ -1129,22 +1129,6 @@ function wp_convert_hr_to_bytes( $size ) {
return $bytes; return $bytes;
} }
/**
* Converts an integer byte value to a shorthand byte value.
*
* @since 2.3.0
*
* @param int $bytes An integer byte value.
* @return string A shorthand byte value.
*/
function wp_convert_bytes_to_hr( $bytes ) {
$units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
$log = log( $bytes, 1024 );
$power = (int) $log;
$size = pow( 1024, $log - $power );
return $size . $units[$power];
}
/** /**
* Determine the maximum upload size allowed in php.ini. * Determine the maximum upload size allowed in php.ini.
* *