WordPress.org

Make WordPress Core

Changeset 16746


Ignore:
Timestamp:
12/06/10 15:26:30 (3 years ago)
Author:
nacin
Message:

Optimize the keys/salts textarea. fixes #15092.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network.php

    r16672 r16746  
    366366            unset( $keys_salts[ $c ] ); 
    367367    } 
    368     if ( ! empty( $keys_salts ) ) { 
     368    if ( ! empty( $keys_salts ) ) {  
     369        $keys_salts_str = ''; 
    369370        $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); 
    370371        if ( is_wp_error( $from_api ) ) { 
    371372            foreach ( $keys_salts as $c => $v ) { 
    372                 $keys_salts[ $c ] = wp_generate_password( 64, true, true ); 
     373                $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; 
    373374            } 
    374375        } else { 
    375376            $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); 
    376377            foreach ( $keys_salts as $c => $v ) { 
    377                 $keys_salts[ $c ] = substr( array_shift( $from_api ), 28, 64 ); 
     378                $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; 
    378379            } 
    379380        } 
     
    382383    <p><?php 
    383384        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> 
    384     <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php 
    385     foreach ( $keys_salts as $c => $v ) { 
    386         echo "\ndefine( '$c', '" . esc_textarea( $v ) . "' );"; 
    387     } 
    388 ?></textarea> 
     385    <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea> 
    389386<?php 
    390387    } 
Note: See TracChangeset for help on using the changeset viewer.