Make WordPress Core

Ticket #20855: 20855.7.diff

File 20855.7.diff, 4.9 KB (added by SergeyBiryukov, 11 years ago)
  • wp-admin/custom-background.php

     
    254254<?php endif; ?>
    255255<tr valign="top">
    256256<th scope="row"><?php _e('Select Image'); ?></th>
    257 <td><form enctype="multipart/form-data" id="upload-form" method="post" action="">
     257<td><form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="">
    258258        <p>
    259259                <label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
    260260                <input type="file" id="upload" name="import" />
  • wp-admin/custom-header.php

     
    525525                        printf( __( 'Suggested height is <strong>%1$d pixels</strong>.' ) . ' ', get_theme_support( 'custom-header', 'height' ) );
    526526        }
    527527        ?></p>
    528         <form enctype="multipart/form-data" id="upload-form" method="post" action="<?php echo esc_attr( add_query_arg( 'step', 2 ) ) ?>">
     528        <form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_attr( add_query_arg( 'step', 2 ) ) ?>">
    529529        <p>
    530530                <label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
    531531                <input type="file" id="upload" name="import" />
  • wp-admin/includes/plugin-install.php

     
    142142 */
    143143function install_plugins_upload( $page = 1 ) {
    144144?>
    145         <h4><?php _e('Install a plugin in .zip format') ?></h4>
    146         <p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.') ?></p>
    147         <form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('update.php?action=upload-plugin') ?>">
    148                 <?php wp_nonce_field( 'plugin-upload') ?>
     145        <h4><?php _e('Install a plugin in .zip format'); ?></h4>
     146        <p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.'); ?></p>
     147        <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-plugin'); ?>">
     148                <?php wp_nonce_field( 'plugin-upload'); ?>
    149149                <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
    150150                <input type="file" id="pluginzip" name="pluginzip" />
    151                 <input type="submit" class="button" value="<?php esc_attr_e('Install Now') ?>" />
     151                <?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
    152152        </form>
    153153<?php
    154154}
  • wp-admin/includes/theme-install.php

     
    134134
    135135function install_themes_upload($page = 1) {
    136136?>
    137 <h4><?php _e('Install a theme in .zip format') ?></h4>
    138 <p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.') ?></p>
    139 <form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('update.php?action=upload-theme') ?>">
    140         <?php wp_nonce_field( 'theme-upload') ?>
     137<h4><?php _e('Install a theme in .zip format'); ?></h4>
     138<p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.'); ?></p>
     139<form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-theme'); ?>">
     140        <?php wp_nonce_field( 'theme-upload'); ?>
    141141        <input type="file" name="themezip" />
    142142        <?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
    143143</form>
  • wp-admin/js/common.js

     
    161161
    162162$(document).ready( function() {
    163163        var lastClicked = false, checks, first, last, checked, menu = $('#adminmenu'),
    164                 pageInput = $('input.current-page'), currentPage = pageInput.val();
     164                pageInput = $('input.current-page'), currentPage = pageInput.val(),
     165                uploadButton = $('.wp-upload-form input[type="submit"]'),
     166                fileInput = uploadButton.closest('form').find('input[type="file"]');
    165167
    166168        // when the menu is folded, make the fly-out submenu header clickable
    167169        menu.on('click.wp-submenu-head', '.wp-submenu-head', function(e){
     
    369371        $(document).on('click.wp-accessibility-blur', 'a', function() {
    370372                $(this).blur();
    371373        });
     374
     375        toggleUploadButton = function() {
     376                uploadButton.prop( 'disabled', '' === fileInput.val() );
     377        };
     378        toggleUploadButton();
     379        fileInput.change( toggleUploadButton );
    372380});
    373381
    374382// internal use