Make WordPress Core


Ignore:
Timestamp:
05/19/2016 10:58:55 PM (9 years ago)
Author:
afercia
Message:

Refine the FTP credentials form interaction.

Properly toggle SSH2 Authentication Keys fieldset visibility.
JavaScript and CSS clean-up.

Props Mte90.
Fixes #34376.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r37421 r37467  
    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">
     
    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">
     
    12371243    <input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> />
    12381244</label>
    1239 </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>
    1244 <?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; ?>
     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>
    12521246</fieldset>
    12531247<?php
     1248}
     1249
    12541250foreach ( (array) $extra_fields as $field ) {
    12551251    if ( isset( $_POST[ $field ] ) )
Note: See TracChangeset for help on using the changeset viewer.