Ticket #5221: 5221.patch
File 5221.patch, 2.9 KB (added by , 5 years ago) |
---|
-
trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
201 201 printf( 202 202 /* translators: Maximum allowed file size. */ 203 203 esc_html__( 'Maximum allowed file size: %s', 'wporg-plugins' ), 204 esc_html( s elf::get_max_allowed_file_size() )204 esc_html( size_format( wp_max_upload_size() ) ) 205 205 ); 206 206 ?> 207 207 </small> … … 250 250 return ob_get_clean(); 251 251 } 252 252 253 /**254 * Returns a human readable version of the max allowed upload size.255 *256 * @return string The allowed file size.257 */258 public static function get_max_allowed_file_size() {259 $upload_size_unit = wp_max_upload_size();260 $byte_sizes = array( 'KB', 'MB', 'GB' );261 262 for ( $unit = - 1; $upload_size_unit > 1024 && $unit < count( $byte_sizes ) - 1; $unit ++ ) {263 $upload_size_unit /= 1024;264 }265 266 if ( $unit < 0 ) {267 $upload_size_unit = $unit = 0;268 } else {269 $upload_size_unit = (int) $upload_size_unit;270 }271 272 return $upload_size_unit . $byte_sizes[ $unit ];273 }274 253 } -
trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php
47 47 <input type="file" id="zip_file" name="zip_file" size="25"/> 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 … … 55 55 } 56 56 57 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 }76 77 /**78 58 * Runs basic checks and hands off to the upload processor. 79 59 * 80 60 * @return string Failure or success message.