WordPress.org

Make WordPress Core

Ticket #49483: upload_filetypes-textarea-49483-2.diff

File upload_filetypes-textarea-49483-2.diff, 1.7 KB (added by shamalisulakhe, 19 months ago)

Revised patch with logic for lowercase conversion and remove periods(.)

  • src/wp-admin/network/settings.php

    diff --git a/src/wp-admin/network/settings.php b/src/wp-admin/network/settings.php
    index 2a26b48ab5..64e5e4fac4 100644
    a b if ( isset( $_GET['updated'] ) ) { 
    380380                        <tr>
    381381                                <th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types' ); ?></label></th>
    382382                                <td>
    383                                         <input name="upload_filetypes" type="text" id="upload_filetypes" aria-describedby="upload-filetypes-desc" class="large-text" value="<?php echo esc_attr( get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) ); ?>" size="45" />
     383                                        <textarea name="upload_filetypes" id="upload_filetypes" aria-describedby="upload-filetypes-desc" cols="45" rows="5"><?php echo esc_attr( get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) ); ?></textarea>
    384384                                        <p class="description" id="upload-filetypes-desc">
    385                                                 <?php _e( 'Allowed file types. Separate types by spaces.' ); ?>
     385                                                <?php _e( 'Allowed file types. Separate types by spaces or new lines.' ); ?>
    386386                                        </p>
    387387                                </td>
    388388                        </tr>
  • src/wp-includes/ms-functions.php

    diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
    index 0b4e453c3b..52cba9f940 100644
    a b function get_most_recent_post_of_user( $user_id ) { 
    18451845 * @return array
    18461846 */
    18471847function check_upload_mimes( $mimes ) {
    1848         $site_exts  = explode( ' ', get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
     1848        $site_exts  = preg_split( '/[\s]+/', get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
     1849        $site_exts  = str_replace( '.', '', strtolower( $site_exts ) );
    18491850        $site_mimes = array();
    18501851        foreach ( $site_exts as $ext ) {
    18511852                foreach ( $mimes as $ext_pattern => $mime ) {