Boostrap: Move wp_convert_hr_to_bytes()
to wp-includes/load.php.
`wp_convert_hr_to_bytes()` was previously defined in wp-includes/media.php because it's only used by `wp_max_upload_size()` in the same file. Moving this function to load.php allows us to improve core's memory limit handling. See #32075. git-svn-id: https://develop.svn.wordpress.org/trunk@38012 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a64bf12b1b
commit
df78fb4ef3
@ -974,3 +974,24 @@ function is_ssl() {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a shorthand byte value to an integer byte value.
|
||||
*
|
||||
* @since 2.3.0
|
||||
* @since 4.6.0 Moved from media.php to load.php
|
||||
*
|
||||
* @param string $size A shorthand byte value.
|
||||
* @return int An integer byte value.
|
||||
*/
|
||||
function wp_convert_hr_to_bytes( $size ) {
|
||||
$size = strtolower( $size );
|
||||
$bytes = (int) $size;
|
||||
if ( strpos( $size, 'k' ) !== false )
|
||||
$bytes = intval( $size ) * KB_IN_BYTES;
|
||||
elseif ( strpos( $size, 'm' ) !== false )
|
||||
$bytes = intval($size) * MB_IN_BYTES;
|
||||
elseif ( strpos( $size, 'g' ) !== false )
|
||||
$bytes = intval( $size ) * GB_IN_BYTES;
|
||||
return $bytes;
|
||||
}
|
||||
|
@ -2776,26 +2776,6 @@ function wp_expand_dimensions( $example_width, $example_height, $max_width, $max
|
||||
return wp_constrain_dimensions( $example_width * 1000000, $example_height * 1000000, $max_width, $max_height );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a shorthand byte value to an integer byte value.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @param string $size A shorthand byte value.
|
||||
* @return int An integer byte value.
|
||||
*/
|
||||
function wp_convert_hr_to_bytes( $size ) {
|
||||
$size = strtolower( $size );
|
||||
$bytes = (int) $size;
|
||||
if ( strpos( $size, 'k' ) !== false )
|
||||
$bytes = intval( $size ) * KB_IN_BYTES;
|
||||
elseif ( strpos( $size, 'm' ) !== false )
|
||||
$bytes = intval($size) * MB_IN_BYTES;
|
||||
elseif ( strpos( $size, 'g' ) !== false )
|
||||
$bytes = intval( $size ) * GB_IN_BYTES;
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the maximum upload size allowed in php.ini.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user