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. Built from https://develop.svn.wordpress.org/trunk@46225 git-svn-id: http://core.svn.wordpress.org/trunk@46037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f4757083f1
commit
b36c4692d4
|
@ -5926,7 +5926,7 @@ final class WP_Customize_Manager {
|
|||
$video = get_attached_file( absint( $value ) );
|
||||
if ( $video ) {
|
||||
$size = filesize( $video );
|
||||
if ( 8 < $size / pow( 1024, 2 ) ) { // Check whether the size is larger than 8MB.
|
||||
if ( $size > 8 * MB_IN_BYTES ) {
|
||||
$validity->add(
|
||||
'size_too_large',
|
||||
__( 'This video file is too large to use as a header video. Try a shorter video or optimize the compression settings and re-upload a file that is less than 8MB. Or, upload your video to YouTube and link it with the option below.' )
|
||||
|
|
|
@ -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 ];
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-46224';
|
||||
$wp_version = '5.3-alpha-46225';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue