WordPress.org

Make WordPress Core

Ticket #34376: 34376.2.patch

File 34376.2.patch, 3.7 KB (added by Mte90, 4 years ago)

compatible with 4.6, js removed from file.php and moved on updates.js

  • src/wp-admin/includes/file.php

     
    11631163        $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );
    11641164
    11651165?>
    1166 <script type="text/javascript">
    1167 <!--
    1168 jQuery(function($){
    1169         jQuery("#ssh").click(function () {
    1170                 jQuery("#ssh_keys").show();
    1171         });
    1172         jQuery("#ftp, #ftps").click(function () {
    1173                 jQuery("#ssh_keys").hide();
    1174         });
    1175         jQuery('#request-filesystem-credentials-form input[value=""]:first').focus();
    1176 });
    1177 -->
    1178 </script>
    11791166<form action="<?php echo esc_url( $form_post ) ?>" method="post">
    11801167<div id="request-filesystem-credentials-form" class="request-filesystem-credentials-form">
    11811168<?php
     
    12051192        }
    12061193        _e('If you do not remember your credentials, you should contact your web host.');
    12071194?></p>
     1195<fieldset>
     1196<legend><?php _e( 'Connection Type' ); ?></legend>
     1197<?php
     1198        $disabled = disabled( (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false );
     1199        foreach ( $types as $name => $text ) : ?>
     1200        <label for="<?php echo esc_attr($name) ?>">
     1201                <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; ?> />
     1202                <?php echo $text ?>
     1203        </label>
     1204        <?php endforeach; ?>
     1205</fieldset>
    12081206<label for="hostname">
    12091207        <span class="field-title"><?php _e( 'Hostname' ) ?></span>
    12101208        <input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e( 'example: www.wordpress.org' ) ?>" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php disabled( defined('FTP_HOST') ); ?> />
     
    12231221        </label>
    12241222</div>
    12251223<?php if ( isset($types['ssh']) ) : ?>
    1226 <fieldset>
     1224<fieldset id="ssh_keys" style="<?php if ( 'ssh' != $connection_type || empty( $connection_type ) ) echo 'display:none' ?>">
    12271225<legend><?php _e( 'Authentication Keys' ); ?></legend>
    12281226<label for="public_key">
    12291227        <span class="field-title"><?php _e('Public Key:') ?></span>
     
    12361234</fieldset>
    12371235<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>
    12381236<?php endif; ?>
    1239 <fieldset>
    1240 <legend><?php _e( 'Connection Type' ); ?></legend>
    12411237<?php
    1242         $disabled = disabled( (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false );
    1243         foreach ( $types as $name => $text ) : ?>
    1244         <label for="<?php echo esc_attr($name) ?>">
    1245                 <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; ?> />
    1246                 <?php echo $text ?>
    1247         </label>
    1248         <?php endforeach; ?>
    1249 </fieldset>
    1250 <?php
    12511238foreach ( (array) $extra_fields as $field ) {
    12521239        if ( isset( $_POST[ $field ] ) )
    12531240                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                jQuery("#ssh").click(function () {
     475                        jQuery("#ssh_keys").show();
     476                });
     477                jQuery("#ftp, #ftps").click(function () {
     478                        jQuery("#ssh_keys").hide();
     479                });
     480                jQuery('#request-filesystem-credentials-form input[value=""]:first').focus();
    474481                /*
    475482                 * Check whether a user needs to submit filesystem credentials based on whether
    476483                 * the form was output on the page server-side.