1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-04 12:17:42 +02:00

Gelato: Number Class new method convertToBytes() added.

This commit is contained in:
Awilum
2014-01-29 20:55:17 +02:00
parent 551ce3be6b
commit e74111fb7d

View File

@@ -58,14 +58,14 @@ class Number
* @return int * @return int
*/ */
public static function convertToBytes( $num ) { public static function convertToBytes( $num ) {
$size = strtolower( $size ); $num = strtolower( $num );
$bytes = (int) $size; $bytes = (int) $num;
if ( strpos( $size, 'k' ) !== false ) if ( strpos( $num, 'k' ) !== false )
$bytes = intval( $size ) * 1024; $bytes = intval( $num ) * 1024;
elseif ( strpos( $size, 'm' ) !== false ) elseif ( strpos( $num, 'm' ) !== false )
$bytes = intval($size) * 1024 * 1024; $bytes = intval($num) * 1024 * 1024;
elseif ( strpos( $size, 'g' ) !== false ) elseif ( strpos( $num, 'g' ) !== false )
$bytes = intval( $size ) * 1024 * 1024 * 1024; $bytes = intval( $num ) * 1024 * 1024 * 1024;
return $bytes; return $bytes;
} }