mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Code Modernization: Use the ** operator instead of the pow() function in wp_convert_bytes_to_hr() for better performance.
Use the `MB_IN_BYTES` constant instead of the `pow()` function in `WP_Customize_Manager::_validate_header_video()` for better readability. Props ayeshrajans, jrf. Fixes #48083. git-svn-id: https://develop.svn.wordpress.org/trunk@46225 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3346,7 +3346,7 @@ function wp_convert_bytes_to_hr( $bytes ) {
|
||||
$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 );
|
||||
$size = KB_IN_BYTES ** ( $log - $power );
|
||||
|
||||
if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
|
||||
$unit = $units[ $power ];
|
||||
|
||||
Reference in New Issue
Block a user