Changeset 22073 for trunk/wp-admin/includes/template.php
- Timestamp:
- 09/27/2012 08:59:57 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r22019 r22073 773 773 774 774 /** 775 * {@internal Missing Short Description}}776 *777 * @since 2.3.0778 *779 * @param unknown_type $size780 * @return unknown781 */782 function wp_convert_hr_to_bytes( $size ) {783 $size = strtolower($size);784 $bytes = (int) $size;785 if ( strpos($size, 'k') !== false )786 $bytes = intval($size) * 1024;787 elseif ( strpos($size, 'm') !== false )788 $bytes = intval($size) * 1024 * 1024;789 elseif ( strpos($size, 'g') !== false )790 $bytes = intval($size) * 1024 * 1024 * 1024;791 return $bytes;792 }793 794 /**795 * {@internal Missing Short Description}}796 *797 * @since 2.3.0798 *799 * @param unknown_type $bytes800 * @return unknown801 */802 function wp_convert_bytes_to_hr( $bytes ) {803 $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );804 $log = log( $bytes, 1024 );805 $power = (int) $log;806 $size = pow(1024, $log - $power);807 return $size . $units[$power];808 }809 810 /**811 * {@internal Missing Short Description}}812 *813 * @since 2.5.0814 *815 * @return unknown816 */817 function wp_max_upload_size() {818 $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );819 $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );820 $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes );821 return $bytes;822 }823 824 /**825 775 * Outputs the form used by the importers to accept the data to be imported 826 776 *
Note: See TracChangeset
for help on using the changeset viewer.