Changeset 22073
- Timestamp:
- 09/27/2012 08:59:57 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 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 * -
trunk/wp-includes/media.php
r22053 r22073 1232 1232 1233 1233 /** 1234 * {@internal Missing Short Description}} 1235 * 1236 * @since 2.3.0 1237 * 1238 * @param unknown_type $size 1239 * @return unknown 1240 */ 1241 function wp_convert_hr_to_bytes( $size ) { 1242 $size = strtolower( $size ); 1243 $bytes = (int) $size; 1244 if ( strpos( $size, 'k' ) !== false ) 1245 $bytes = intval( $size ) * 1024; 1246 elseif ( strpos( $size, 'm' ) !== false ) 1247 $bytes = intval($size) * 1024 * 1024; 1248 elseif ( strpos( $size, 'g' ) !== false ) 1249 $bytes = intval( $size ) * 1024 * 1024 * 1024; 1250 return $bytes; 1251 } 1252 1253 /** 1254 * {@internal Missing Short Description}} 1255 * 1256 * @since 2.3.0 1257 * 1258 * @param unknown_type $bytes 1259 * @return unknown 1260 */ 1261 function wp_convert_bytes_to_hr( $bytes ) { 1262 $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' ); 1263 $log = log( $bytes, 1024 ); 1264 $power = (int) $log; 1265 $size = pow( 1024, $log - $power ); 1266 return $size . $units[$power]; 1267 } 1268 1269 /** 1270 * {@internal Missing Short Description}} 1271 * 1272 * @since 2.5.0 1273 * 1274 * @return unknown 1275 */ 1276 function wp_max_upload_size() { 1277 $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); 1278 $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); 1279 $bytes = apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes ); 1280 return $bytes; 1281 } 1282 1283 /** 1234 1284 * Prints default plupload arguments. 1235 1285 * … … 1281 1331 } 1282 1332 add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' ); 1283 1284 1333 1285 1334 /**
Note: See TracChangeset
for help on using the changeset viewer.