Ticket #17725: 17725.2.diff
| File 17725.2.diff, 1.1 KB (added by , 14 years ago) |
|---|
-
wp-admin/includes/template.php
779 779 } 780 780 781 781 /** 782 * {@internal Missing Short Description}} 782 * Convert a human readable (hr) memory setting value as in 783 * php.ini into the number of bytes (Shorthand Notation). 783 784 * 784 785 * @since 2.3.0 785 786 * 786 * @param unknown_type $size787 * @return unknown787 * @param string $size memory setting value 788 * @return float bytes 788 789 */ 789 790 function wp_convert_hr_to_bytes( $size ) { 790 $size = strtolower($size); 791 $bytes = (int) $size; 792 if ( strpos($size, 'k') !== false ) 793 $bytes = intval($size) * 1024; 794 elseif ( strpos($size, 'm') !== false ) 795 $bytes = intval($size) * 1024 * 1024; 796 elseif ( strpos($size, 'g') !== false ) 797 $bytes = intval($size) * 1024 * 1024 * 1024; 798 return $bytes; 791 $bytes = (float) $size; 792 $last = strtolower( substr( $size, -1 ) ); 793 $pos = strpos( ' kmg', $last , 1); 794 if ( $pos ) $bytes *= pow( 1024, $pos); 795 return round( $bytes ); 799 796 } 800 797 801 798 /**