WordPress.org

Make WordPress Core

Ticket #49483: upload_filetypes-textarea-49483.diff

File upload_filetypes-textarea-49483.diff, 1.6 KB (added by shamalisulakhe, 13 months ago)

Revised patch with logic to allow new lines in the textarea for upload_filetypes

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

    diff --git a/src/wp-admin/network/settings.php b/src/wp-admin/network/settings.php
    index 2a26b48ab5..4615940ecf 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">
    385385                                                <?php _e( 'Allowed file types. Separate types by spaces.' ); ?>
    386386                                        </p>
  • src/wp-includes/ms-functions.php

    diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
    index 0b4e453c3b..2e3ac2959f 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' ) );
    18491849        $site_mimes = array();
    18501850        foreach ( $site_exts as $ext ) {
    18511851                foreach ( $mimes as $ext_pattern => $mime ) {