WordPress.org

Make WordPress Core

Ticket #34376: 34376.4.patch

File 34376.4.patch, 5.0 KB (added by afercia, 4 years ago)
  • src/wp-admin/css/forms.css

     
    970970}
    971971
    972972.request-filesystem-credentials-dialog .notification-dialog {
    973         top: 15%;
     973        top: 10%;
    974974        max-height: 85%;
    975975}
    976976
     
    10281028        margin-right: 10px;
    10291029}
    10301030
     1031.request-filesystem-credentials-dialog #auth-keys-desc {
     1032        margin-bottom: 0;
     1033}
     1034
    10311035#request-filesystem-credentials-dialog .button:not(:last-child) {
    10321036        margin-right: 10px;
    10331037}
  • src/wp-admin/includes/file.php

     
    11661166        $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );
    11671167
    11681168?>
    1169 <script type="text/javascript">
    1170 <!--
    1171 jQuery(function($){
    1172         jQuery("#ssh").click(function () {
    1173                 jQuery("#ssh_keys").show();
    1174         });
    1175         jQuery("#ftp, #ftps").click(function () {
    1176                 jQuery("#ssh_keys").hide();
    1177         });
    1178         jQuery('#request-filesystem-credentials-form input[value=""]:first').focus();
    1179 });
    1180 -->
    1181 </script>
    11821169<form action="<?php echo esc_url( $form_post ) ?>" method="post">
    11831170<div id="request-filesystem-credentials-form" class="request-filesystem-credentials-form">
    11841171<?php
     
    12251212                <em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em>
    12261213        </label>
    12271214</div>
    1228 <?php if ( isset($types['ssh']) ) : ?>
    12291215<fieldset>
     1216<legend><?php _e( 'Connection Type' ); ?></legend>
     1217<?php
     1218        $disabled = disabled( ( defined( 'FTP_SSL' ) && FTP_SSL ) || ( defined( 'FTP_SSH' ) && FTP_SSH ), true, false );
     1219        foreach ( $types as $name => $text ) : ?>
     1220        <label for="<?php echo esc_attr( $name ) ?>">
     1221                <input type="radio" name="connection_type" id="<?php echo esc_attr( $name ) ?>" value="<?php echo esc_attr( $name ) ?>"<?php checked( $name, $connection_type ); echo $disabled; ?> />
     1222                <?php echo $text; ?>
     1223        </label>
     1224<?php
     1225        endforeach;
     1226?>
     1227</fieldset>
     1228<?php
     1229if ( isset( $types['ssh'] ) ) {
     1230        $hidden_class = '';
     1231        if ( 'ssh' != $connection_type || empty( $connection_type ) ) {
     1232                $hidden_class = ' class="hidden"';
     1233        }
     1234?>
     1235<fieldset id="ssh-keys"<?php echo $hidden_class; ?>">
    12301236<legend><?php _e( 'Authentication Keys' ); ?></legend>
    12311237<label for="public_key">
    12321238        <span class="field-title"><?php _e('Public Key:') ?></span>
     
    12361242        <span class="field-title"><?php _e('Private Key:') ?></span>
    12371243        <input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> />
    12381244</label>
     1245<p id="auth-keys-desc"><?php _e( 'Enter the location on the server where the public and private keys are located. If a passphrase is needed, enter that in the password field above.' ) ?></p>
    12391246</fieldset>
    1240 <span id="auth-keys-desc"><?php _e('Enter the location on the server where the public and private keys are located. If a passphrase is needed, enter that in the password field above.') ?></span>
    1241 <?php endif; ?>
    1242 <fieldset>
    1243 <legend><?php _e( 'Connection Type' ); ?></legend>
    12441247<?php
    1245         $disabled = disabled( (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false );
    1246         foreach ( $types as $name => $text ) : ?>
    1247         <label for="<?php echo esc_attr($name) ?>">
    1248                 <input type="radio" name="connection_type" id="<?php echo esc_attr($name) ?>" value="<?php echo esc_attr($name) ?>"<?php checked($name, $connection_type); echo $disabled; ?> />
    1249                 <?php echo $text ?>
    1250         </label>
    1251         <?php endforeach; ?>
    1252 </fieldset>
    1253 <?php
     1248}
     1249
    12541250foreach ( (array) $extra_fields as $field ) {
    12551251        if ( isset( $_POST[ $field ] ) )
    12561252                echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />';
  • src/wp-admin/js/updates.js

     
    471471
    472472
    473473        $( document ).ready( function() {
     474                // Set initial focus on the first empty form field.
     475                $( '#request-filesystem-credentials-form input[value=""]:first' ).focus();
     476
    474477                /*
    475478                 * Check whether a user needs to submit filesystem credentials based on whether
    476479                 * the form was output on the page server-side.
     
    503506                        wp.updates.requestForCredentialsModalCancel();
    504507                });
    505508
    506                 // Hide SSH fields when not selected
    507                 $( '#request-filesystem-credentials-dialog input[name="connection_type"]' ).on( 'change', function() {
    508                         $( this ).parents( 'form' ).find( '#private_key, #public_key' ).parents( 'label' ).toggle( ( 'ssh' == $( this ).val() ) );
    509                 }).change();
     509                // Hide SSH fields when not selected.
     510                $( '#request-filesystem-credentials-form input[name="connection_type"]' ).on( 'change', function() {
     511                        $( '#ssh-keys' ).toggleClass( 'hidden', ( 'ssh' !== $( this ).val() ) );
     512                });
    510513
    511514                // Click handler for plugin updates in List Table view.
    512515                $( '.plugin-update-tr' ).on( 'click', '.update-link', function( e ) {