114 <body class="<?php echo implode( ' ', $body_classes ); ?>"> |
114 <body class="<?php echo implode( ' ', $body_classes ); ?>"> |
115 <p id="logo"><?php _e( 'WordPress' ); ?></p> |
115 <p id="logo"><?php _e( 'WordPress' ); ?></p> |
116 <?php |
116 <?php |
117 } // End function setup_config_display_header(); |
117 } // End function setup_config_display_header(); |
118 |
118 |
|
119 /** |
|
120 * @global string $wp_local_package Locale code of the package. |
|
121 * @global WP_Locale $wp_locale WordPress date and time locale object. |
|
122 */ |
119 $language = ''; |
123 $language = ''; |
120 if ( ! empty( $_REQUEST['language'] ) ) { |
124 if ( ! empty( $_REQUEST['language'] ) ) { |
121 $language = preg_replace( '/[^a-zA-Z0-9_]/', '', $_REQUEST['language'] ); |
125 $language = preg_replace( '/[^a-zA-Z0-9_]/', '', $_REQUEST['language'] ); |
122 } elseif ( isset( $GLOBALS['wp_local_package'] ) ) { |
126 } elseif ( isset( $GLOBALS['wp_local_package'] ) ) { |
123 $language = $GLOBALS['wp_local_package']; |
127 $language = $GLOBALS['wp_local_package']; |
155 } |
159 } |
156 if ( ! empty( $loaded_language ) ) { |
160 if ( ! empty( $loaded_language ) ) { |
157 $step_1 .= '&language=' . $loaded_language; |
161 $step_1 .= '&language=' . $loaded_language; |
158 } |
162 } |
159 ?> |
163 ?> |
160 <h1 class="screen-reader-text"><?php _e( 'Before getting started' ); ?></h1> |
164 <h1 class="screen-reader-text"> |
|
165 <?php |
|
166 /* translators: Hidden accessibility text. */ |
|
167 _e( 'Before getting started' ); |
|
168 ?> |
|
169 </h1> |
161 <p><?php _e( 'Welcome to WordPress. Before getting started, you will need to know the following items.' ); ?></p> |
170 <p><?php _e( 'Welcome to WordPress. Before getting started, you will need to know the following items.' ); ?></p> |
162 <ol> |
171 <ol> |
163 <li><?php _e( 'Database name' ); ?></li> |
172 <li><?php _e( 'Database name' ); ?></li> |
164 <li><?php _e( 'Database username' ); ?></li> |
173 <li><?php _e( 'Database username' ); ?></li> |
165 <li><?php _e( 'Database password' ); ?></li> |
174 <li><?php _e( 'Database password' ); ?></li> |
205 |
214 |
206 setup_config_display_header(); |
215 setup_config_display_header(); |
207 |
216 |
208 $autofocus = wp_is_mobile() ? '' : ' autofocus'; |
217 $autofocus = wp_is_mobile() ? '' : ' autofocus'; |
209 ?> |
218 ?> |
210 <h1 class="screen-reader-text"><?php _e( 'Set up your database connection' ); ?></h1> |
219 <h1 class="screen-reader-text"> |
|
220 <?php |
|
221 /* translators: Hidden accessibility text. */ |
|
222 _e( 'Set up your database connection' ); |
|
223 ?> |
|
224 </h1> |
211 <form method="post" action="setup-config.php?step=2"> |
225 <form method="post" action="setup-config.php?step=2"> |
212 <p><?php _e( 'Below you should enter your database connection details. If you are not sure about these, contact your host.' ); ?></p> |
226 <p><?php _e( 'Below you should enter your database connection details. If you are not sure about these, contact your host.' ); ?></p> |
213 <table class="form-table" role="presentation"> |
227 <table class="form-table" role="presentation"> |
214 <tr> |
228 <tr> |
215 <th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th> |
229 <th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th> |
216 <td><input name="dbname" id="dbname" type="text" aria-describedby="dbname-desc" size="25" value="wordpress"<?php echo $autofocus; ?>/></td> |
230 <td><input name="dbname" id="dbname" type="text" aria-describedby="dbname-desc" size="25" placeholder="wordpress"<?php echo $autofocus; ?>/> |
217 <td id="dbname-desc"><?php _e( 'The name of the database you want to use with WordPress.' ); ?></td> |
231 <p id="dbname-desc"><?php _e( 'The name of the database you want to use with WordPress.' ); ?></p></td> |
218 </tr> |
232 </tr> |
219 <tr> |
233 <tr> |
220 <th scope="row"><label for="uname"><?php _e( 'Username' ); ?></label></th> |
234 <th scope="row"><label for="uname"><?php _e( 'Username' ); ?></label></th> |
221 <td><input name="uname" id="uname" type="text" aria-describedby="uname-desc" size="25" value="<?php echo htmlspecialchars( _x( 'username', 'example username' ), ENT_QUOTES ); ?>" /></td> |
235 <td><input name="uname" id="uname" type="text" aria-describedby="uname-desc" size="25" placeholder="<?php echo htmlspecialchars( _x( 'username', 'example username' ), ENT_QUOTES ); ?>" /> |
222 <td id="uname-desc"><?php _e( 'Your database username.' ); ?></td> |
236 <p id="uname-desc"><?php _e( 'Your database username.' ); ?></p></td> |
223 </tr> |
237 </tr> |
224 <tr> |
238 <tr> |
225 <th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th> |
239 <th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th> |
226 <td><input name="pwd" id="pwd" type="text" aria-describedby="pwd-desc" size="25" value="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" autocomplete="off" /></td> |
240 <td> |
227 <td id="pwd-desc"><?php _e( 'Your database password.' ); ?></td> |
241 <div class="wp-pwd"> |
|
242 <input name="pwd" id="pwd" type="password" class="regular-text" data-reveal="1" aria-describedby="pwd-desc" size="25" placeholder="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" autocomplete="off" spellcheck="false" /> |
|
243 <button type="button" class="button pwd-toggle hide-if-no-js" data-toggle="0" data-start-masked="1" aria-label="<?php esc_attr_e( 'Show password' ); ?>"> |
|
244 <span class="dashicons dashicons-visibility"></span> |
|
245 <span class="text"><?php _e( 'Show' ); ?></span> |
|
246 </button> |
|
247 </div> |
|
248 <p id="pwd-desc"><?php _e( 'Your database password.' ); ?></p> |
|
249 </td> |
228 </tr> |
250 </tr> |
229 <tr> |
251 <tr> |
230 <th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th> |
252 <th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th> |
231 <td><input name="dbhost" id="dbhost" type="text" aria-describedby="dbhost-desc" size="25" value="localhost" /></td> |
253 <td><input name="dbhost" id="dbhost" type="text" aria-describedby="dbhost-desc" size="25" value="localhost" /> |
232 <td id="dbhost-desc"> |
254 <p id="dbhost-desc"> |
233 <?php |
255 <?php |
234 /* translators: %s: localhost */ |
256 /* translators: %s: localhost */ |
235 printf( __( 'You should be able to get this info from your web host, if %s does not work.' ), '<code>localhost</code>' ); |
257 printf( __( 'You should be able to get this info from your web host, if %s does not work.' ), '<code>localhost</code>' ); |
236 ?> |
258 ?> |
237 </td> |
259 </p></td> |
238 </tr> |
260 </tr> |
239 <tr> |
261 <tr> |
240 <th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th> |
262 <th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th> |
241 <td><input name="prefix" id="prefix" type="text" aria-describedby="prefix-desc" value="wp_" size="25" /></td> |
263 <td><input name="prefix" id="prefix" type="text" aria-describedby="prefix-desc" value="wp_" size="25" /> |
242 <td id="prefix-desc"><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td> |
264 <p id="prefix-desc"><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></p></td> |
243 </tr> |
265 </tr> |
244 </table> |
266 </table> |
245 <?php |
267 <?php |
246 if ( isset( $_GET['noapi'] ) ) { |
268 if ( isset( $_GET['noapi'] ) ) { |
247 ?> |
269 ?> |
248 <input name="noapi" type="hidden" value="1" /><?php } ?> |
270 <input name="noapi" type="hidden" value="1" /><?php } ?> |
249 <input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" /> |
271 <input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" /> |
250 <p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p> |
272 <p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p> |
251 </form> |
273 </form> |
252 <?php |
274 <?php |
|
275 wp_print_scripts( 'password-toggle' ); |
253 break; |
276 break; |
254 |
277 |
255 case 2: |
278 case 2: |
256 load_default_textdomain( $language ); |
279 load_default_textdomain( $language ); |
257 $GLOBALS['wp_locale'] = new WP_Locale(); |
280 $GLOBALS['wp_locale'] = new WP_Locale(); |
276 } |
299 } |
277 |
300 |
278 $tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try Again' ) . '</a>'; |
301 $tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try Again' ) . '</a>'; |
279 |
302 |
280 if ( empty( $prefix ) ) { |
303 if ( empty( $prefix ) ) { |
281 wp_die( __( '<strong>Error</strong>: "Table Prefix" must not be empty.' ) . $tryagain_link ); |
304 wp_die( __( '<strong>Error:</strong> "Table Prefix" must not be empty.' ) . $tryagain_link ); |
282 } |
305 } |
283 |
306 |
284 // Validate $prefix: it can only contain letters, numbers and underscores. |
307 // Validate $prefix: it can only contain letters, numbers and underscores. |
285 if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) { |
308 if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) { |
286 wp_die( __( '<strong>Error</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' ) . $tryagain_link ); |
309 wp_die( __( '<strong>Error:</strong> "Table Prefix" can only contain numbers, letters, and underscores.' ) . $tryagain_link ); |
287 } |
310 } |
288 |
311 |
289 // Test the DB connection. |
312 // Test the DB connection. |
290 /**#@+ |
313 /**#@+ |
291 * |
314 * |
309 |
332 |
310 if ( ! empty( $wpdb->error ) ) { |
333 if ( ! empty( $wpdb->error ) ) { |
311 wp_die( $wpdb->error->get_error_message() . $tryagain_link ); |
334 wp_die( $wpdb->error->get_error_message() . $tryagain_link ); |
312 } |
335 } |
313 |
336 |
314 $errors = $wpdb->hide_errors(); |
337 $errors = $wpdb->suppress_errors(); |
315 $wpdb->query( "SELECT $prefix" ); |
338 $wpdb->query( "SELECT $prefix" ); |
316 $wpdb->show_errors( $errors ); |
339 $wpdb->suppress_errors( $errors ); |
|
340 |
317 if ( ! $wpdb->last_error ) { |
341 if ( ! $wpdb->last_error ) { |
318 // MySQL was able to parse the prefix as a value, which we don't want. Bail. |
342 // MySQL was able to parse the prefix as a value, which we don't want. Bail. |
319 wp_die( __( '<strong>Error</strong>: "Table Prefix" is invalid.' ) ); |
343 wp_die( __( '<strong>Error:</strong> "Table Prefix" is invalid.' ) ); |
320 } |
344 } |
321 |
345 |
322 // Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password(). |
346 // Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password(). |
323 try { |
347 try { |
324 $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|'; |
348 $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|'; |
409 foreach ( $config_file as $line ) { |
433 foreach ( $config_file as $line ) { |
410 $config_text .= htmlentities( $line, ENT_COMPAT, 'UTF-8' ); |
434 $config_text .= htmlentities( $line, ENT_COMPAT, 'UTF-8' ); |
411 } |
435 } |
412 ?> |
436 ?> |
413 </p> |
437 </p> |
414 <textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php echo $config_text; ?></textarea> |
438 <p class="configuration-rules-label"><label for="wp-config"> |
|
439 <?php |
|
440 /* translators: %s: wp-config.php */ |
|
441 printf( __( 'Configuration rules for %s:' ), '<code>wp-config.php</code>' ); |
|
442 ?> |
|
443 </label></p> |
|
444 <textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly" aria-describedby="wp-config-description"><?php echo $config_text; ?></textarea> |
415 <p><?php _e( 'After you’ve done that, click “Run the installation”.' ); ?></p> |
445 <p><?php _e( 'After you’ve done that, click “Run the installation”.' ); ?></p> |
416 <p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the installation' ); ?></a></p> |
446 <p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the installation' ); ?></a></p> |
417 <script> |
447 <script> |
418 (function(){ |
448 (function(){ |
419 if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) { |
449 if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) { |
452 if ( ! empty( $wp_config_perms ) && ! is_writable( $path_to_wp_config ) ) { |
482 if ( ! empty( $wp_config_perms ) && ! is_writable( $path_to_wp_config ) ) { |
453 $error_message = sprintf( |
483 $error_message = sprintf( |
454 /* translators: 1: wp-config.php, 2: Documentation URL. */ |
484 /* translators: 1: wp-config.php, 2: Documentation URL. */ |
455 __( 'You need to make the file %1$s writable before you can save your changes. See <a href="%2$s">Changing File Permissions</a> for more information.' ), |
485 __( 'You need to make the file %1$s writable before you can save your changes. See <a href="%2$s">Changing File Permissions</a> for more information.' ), |
456 '<code>wp-config.php</code>', |
486 '<code>wp-config.php</code>', |
457 __( 'https://wordpress.org/support/article/changing-file-permissions/' ) |
487 __( 'https://developer.wordpress.org/advanced-administration/server/file-permissions/' ) |
458 ); |
488 ); |
459 } else { |
489 } else { |
460 $error_message = sprintf( |
490 $error_message = sprintf( |
461 /* translators: %s: wp-config.php */ |
491 /* translators: %s: wp-config.php */ |
462 __( 'Unable to write to %s file.' ), |
492 __( 'Unable to write to %s file.' ), |
468 chmod( $path_to_wp_config, 0666 ); |
498 chmod( $path_to_wp_config, 0666 ); |
469 setup_config_display_header(); |
499 setup_config_display_header(); |
470 |
500 |
471 if ( false !== $handle ) : |
501 if ( false !== $handle ) : |
472 ?> |
502 ?> |
473 <h1 class="screen-reader-text"><?php _e( 'Successful database connection' ); ?></h1> |
503 <h1 class="screen-reader-text"> |
|
504 <?php |
|
505 /* translators: Hidden accessibility text. */ |
|
506 _e( 'Successful database connection' ); |
|
507 ?> |
|
508 </h1> |
474 <p><?php _e( 'All right, sparky! You’ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to…' ); ?></p> |
509 <p><?php _e( 'All right, sparky! You’ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to…' ); ?></p> |
475 |
510 |
476 <p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the installation' ); ?></a></p> |
511 <p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the installation' ); ?></a></p> |
477 <?php |
512 <?php |
478 else : |
513 else : |