Optimize the keys/salts textarea. fixes #15092.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-12-06 15:26:30 +00:00
parent fde64e232f
commit 25729cb3c5
1 changed files with 5 additions and 8 deletions

View File

@ -366,26 +366,23 @@ define( 'BLOG_ID_CURRENT_SITE', 1 );</textarea>
unset( $keys_salts[ $c ] );
}
if ( ! empty( $keys_salts ) ) {
$keys_salts_str = '';
$from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
if ( is_wp_error( $from_api ) ) {
foreach ( $keys_salts as $c => $v ) {
$keys_salts[ $c ] = wp_generate_password( 64, true, true );
$keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );";
}
} else {
$from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) );
foreach ( $keys_salts as $c => $v ) {
$keys_salts[ $c ] = substr( array_shift( $from_api ), 28, 64 );
$keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
}
}
$num_keys_salts = count( $keys_salts );
?>
<p><?php
echo _n( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.', 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.', $num_keys_salts ); ?> <?php _e( 'To make your installation more secure, you should also add:' ) ?></p>
<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php
foreach ( $keys_salts as $c => $v ) {
echo "\ndefine( '$c', '" . esc_textarea( $v ) . "' );";
}
?></textarea>
<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
<?php
}
?>