Changeset 9887 for sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php
- Timestamp:
- 05/19/2020 08:14:31 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php
r9725 r9887 48 48 <button id="upload_button" class="button" type="submit" value="' . esc_attr__( 'Upload', 'wporg-themes' ) . '">' . esc_html__( 'Upload', 'wporg-themes' ) . '</button> 49 49 <p> 50 <small>' . sprintf( __( 'Maximum allowed file size: %s', 'wporg-themes' ), esc_html( wporg_themes_get_max_allowed_file_size() ) ) . '</small>50 <small>' . sprintf( __( 'Maximum allowed file size: %s', 'wporg-themes' ), esc_html( size_format( wp_max_upload_size() ) ) ) . '</small> 51 51 </p> 52 52 </form>'; 53 53 54 54 return $notice . $form; 55 }56 57 /**58 * Returns a human readable version of the max allowed upload size.59 *60 * @return string The allowed file size.61 */62 function wporg_themes_get_max_allowed_file_size() {63 $upload_size_unit = wp_max_upload_size();64 $byte_sizes = array( 'KB', 'MB', 'GB' );65 66 for ( $unit = - 1; $upload_size_unit > 1024 && $unit < count( $byte_sizes ) - 1; $unit++ ) {67 $upload_size_unit /= 1024;68 }69 if ( $unit < 0 ) {70 $upload_size_unit = $unit = 0;71 } else {72 $upload_size_unit = (int) $upload_size_unit;73 }74 return $upload_size_unit . $byte_sizes[ $unit ];75 55 } 76 56
Note: See TracChangeset
for help on using the changeset viewer.