WordPress.org

Make WordPress Core

Changeset 46225


Ignore:
Timestamp:
09/21/2019 12:48:29 PM (8 weeks ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r46214 r46225  
    59275927        if ( $video ) {
    59285928            $size = filesize( $video );
    5929             if ( 8 < $size / pow( 1024, 2 ) ) { // Check whether the size is larger than 8MB.
     5929            if ( $size > 8 * MB_IN_BYTES ) {
    59305930                $validity->add(
    59315931                    'size_too_large',
  • trunk/src/wp-includes/deprecated.php

    r46129 r46225  
    33473347    $log   = log( $bytes, KB_IN_BYTES );
    33483348    $power = (int) $log;
    3349     $size  = pow( KB_IN_BYTES, $log - $power );
     3349    $size  = KB_IN_BYTES ** ( $log - $power );
    33503350
    33513351    if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
Note: See TracChangeset for help on using the changeset viewer.