ActionScheduler_Compatibility::convert_hr_to_bytes()
Converts a shorthand byte value to an integer byte value.
Wrapper for wp_convert_hr_to_bytes(), moved to load.php in WordPress 4.6 from media.php
Метод класса: ActionScheduler_Compatibility{}
Хуков нет.
Возвращает
int
. An integer byte value.
Использование
$result = ActionScheduler_Compatibility::convert_hr_to_bytes( $value );
- $value(строка) (обязательный)
- A (PHP ini) byte value, either shorthand or ordinary.
Код ActionScheduler_Compatibility::convert_hr_to_bytes() ActionScheduler Compatibility::convert hr to bytes WC 9.2.3
public static function convert_hr_to_bytes( $value ) { if ( function_exists( 'wp_convert_hr_to_bytes' ) ) { return wp_convert_hr_to_bytes( $value ); } $value = strtolower( trim( $value ) ); $bytes = (int) $value; if ( false !== strpos( $value, 'g' ) ) { $bytes *= GB_IN_BYTES; } elseif ( false !== strpos( $value, 'm' ) ) { $bytes *= MB_IN_BYTES; } elseif ( false !== strpos( $value, 'k' ) ) { $bytes *= KB_IN_BYTES; } // Deal with large (float) values which run into the maximum integer size. return min( $bytes, PHP_INT_MAX ); }