wp/wp-admin/includes/network.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    31  *
    31  *
    32  * @since 3.0.0
    32  * @since 3.0.0
    33  * @return bool Whether subdomain installation is allowed
    33  * @return bool Whether subdomain installation is allowed
    34  */
    34  */
    35 function allow_subdomain_install() {
    35 function allow_subdomain_install() {
    36 	$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
    36 	$home   = get_option( 'home' );
    37 	if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
    37 	$domain = parse_url( $home, PHP_URL_HOST );
       
    38 	if ( parse_url( $home, PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
    38 		return false;
    39 		return false;
    39 	}
    40 	}
    40 
    41 
    41 	return true;
    42 	return true;
    42 }
    43 }
   111  */
   112  */
   112 function network_step1( $errors = false ) {
   113 function network_step1( $errors = false ) {
   113 	global $is_apache;
   114 	global $is_apache;
   114 
   115 
   115 	if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
   116 	if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
   116 		echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . sprintf(
   117 		$cannot_define_constant_message  = '<strong>' . __( 'Error:' ) . '</strong> ';
       
   118 		$cannot_define_constant_message .= sprintf(
   117 			/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
   119 			/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
   118 			__( 'The constant %s cannot be defined when creating a network.' ),
   120 			__( 'The constant %s cannot be defined when creating a network.' ),
   119 			'<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>'
   121 			'<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>'
   120 		) . '</p></div>';
   122 		);
       
   123 
       
   124 		wp_admin_notice(
       
   125 			$cannot_define_constant_message,
       
   126 			array(
       
   127 				'additional_classes' => array( 'error' ),
       
   128 			)
       
   129 		);
       
   130 
   121 		echo '</div>';
   131 		echo '</div>';
   122 		require_once ABSPATH . 'wp-admin/admin-footer.php';
   132 		require_once ABSPATH . 'wp-admin/admin-footer.php';
   123 		die();
   133 		die();
   124 	}
   134 	}
   125 
   135 
   126 	$active_plugins = get_option( 'active_plugins' );
   136 	$active_plugins = get_option( 'active_plugins' );
   127 	if ( ! empty( $active_plugins ) ) {
   137 	if ( ! empty( $active_plugins ) ) {
   128 		echo '<div class="notice notice-warning"><p><strong>' . __( 'Warning:' ) . '</strong> ' . sprintf(
   138 		wp_admin_notice(
   129 			/* translators: %s: URL to Plugins screen. */
   139 			'<strong>' . __( 'Warning:' ) . '</strong> ' . sprintf(
   130 			__( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ),
   140 				/* translators: %s: URL to Plugins screen. */
   131 			admin_url( 'plugins.php?plugin_status=active' )
   141 				__( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ),
   132 		) . '</p></div>';
   142 				admin_url( 'plugins.php?plugin_status=active' )
       
   143 			),
       
   144 			array( 'type' => 'warning' )
       
   145 		);
   133 		echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
   146 		echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
   134 		echo '</div>';
   147 		echo '</div>';
   135 		require_once ABSPATH . 'wp-admin/admin-footer.php';
   148 		require_once ABSPATH . 'wp-admin/admin-footer.php';
   136 		die();
   149 		die();
   137 	}
   150 	}
   138 
   151 
   139 	$hostname  = get_clean_basedomain();
   152 	// Strip standard port from hostname.
   140 	$has_ports = strstr( $hostname, ':' );
   153 	$hostname = preg_replace( '/(?::80|:443)$/', '', get_clean_basedomain() );
   141 	if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
       
   142 		echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
       
   143 		echo '<p>' . sprintf(
       
   144 			/* translators: %s: Port number. */
       
   145 			__( 'You cannot use port numbers such as %s.' ),
       
   146 			'<code>' . $has_ports . '</code>'
       
   147 		) . '</p>';
       
   148 		echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>';
       
   149 		echo '</div>';
       
   150 		require_once ABSPATH . 'wp-admin/admin-footer.php';
       
   151 		die();
       
   152 	}
       
   153 
   154 
   154 	echo '<form method="post">';
   155 	echo '<form method="post">';
   155 
   156 
   156 	wp_nonce_field( 'install-network-1' );
   157 	wp_nonce_field( 'install-network-1' );
   157 
   158 
   158 	$error_codes = array();
   159 	$error_codes = array();
   159 	if ( is_wp_error( $errors ) ) {
   160 	if ( is_wp_error( $errors ) ) {
   160 		echo '<div class="error"><p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>';
   161 		$network_created_error_message = '<p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>';
   161 		foreach ( $errors->get_error_messages() as $error ) {
   162 		foreach ( $errors->get_error_messages() as $error ) {
   162 			echo "<p>$error</p>";
   163 			$network_created_error_message .= "<p>$error</p>";
   163 		}
   164 		}
   164 		echo '</div>';
   165 		wp_admin_notice(
       
   166 			$network_created_error_message,
       
   167 			array(
       
   168 				'additional_classes' => array( 'error' ),
       
   169 				'paragraph_wrap'     => false,
       
   170 			)
       
   171 		);
   165 		$error_codes = $errors->get_error_codes();
   172 		$error_codes = $errors->get_error_codes();
   166 	}
   173 	}
   167 
   174 
   168 	if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) {
   175 	if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) {
   169 		$site_name = $_POST['sitename'];
   176 		$site_name = $_POST['sitename'];
   190 		$subdomain_install = true;
   197 		$subdomain_install = true;
   191 	} else {
   198 	} else {
   192 		$subdomain_install = false;
   199 		$subdomain_install = false;
   193 		$got_mod_rewrite   = got_mod_rewrite();
   200 		$got_mod_rewrite   = got_mod_rewrite();
   194 		if ( $got_mod_rewrite ) { // Dangerous assumptions.
   201 		if ( $got_mod_rewrite ) { // Dangerous assumptions.
   195 			echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ';
   202 			$message_class = 'updated';
   196 			printf(
   203 			$message       = '<p><strong>' . __( 'Warning:' ) . '</strong> ';
       
   204 			$message      .= '<p>' . sprintf(
   197 				/* translators: %s: mod_rewrite */
   205 				/* translators: %s: mod_rewrite */
   198 				__( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ),
   206 				__( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ),
   199 				'<code>mod_rewrite</code>'
   207 				'<code>mod_rewrite</code>'
   200 			);
   208 			) . '</p>';
   201 			echo '</p>';
       
   202 		} elseif ( $is_apache ) {
   209 		} elseif ( $is_apache ) {
   203 			echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ';
   210 			$message_class = 'error';
   204 			printf(
   211 			$message       = '<p><strong>' . __( 'Warning:' ) . '</strong> ';
       
   212 			$message      .= sprintf(
   205 				/* translators: %s: mod_rewrite */
   213 				/* translators: %s: mod_rewrite */
   206 				__( 'It looks like the Apache %s module is not installed.' ),
   214 				__( 'It looks like the Apache %s module is not installed.' ),
   207 				'<code>mod_rewrite</code>'
   215 				'<code>mod_rewrite</code>'
   208 			);
   216 			) . '</p>';
   209 			echo '</p>';
       
   210 		}
   217 		}
   211 
   218 
   212 		if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache).
   219 		if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache).
   213 			echo '<p>';
   220 			$message .= '<p>' . sprintf(
   214 			printf(
       
   215 				/* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */
   221 				/* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */
   216 				__( 'If %1$s is disabled, ask your administrator to enable that module, or look at the <a href="%2$s">Apache documentation</a> or <a href="%3$s">elsewhere</a> for help setting it up.' ),
   222 				__( 'If %1$s is disabled, ask your administrator to enable that module, or look at the <a href="%2$s">Apache documentation</a> or <a href="%3$s">elsewhere</a> for help setting it up.' ),
   217 				'<code>mod_rewrite</code>',
   223 				'<code>mod_rewrite</code>',
   218 				'https://httpd.apache.org/docs/mod/mod_rewrite.html',
   224 				'https://httpd.apache.org/docs/mod/mod_rewrite.html',
   219 				'https://www.google.com/search?q=apache+mod_rewrite'
   225 				'https://www.google.com/search?q=apache+mod_rewrite'
       
   226 			) . '</p>';
       
   227 
       
   228 			wp_admin_notice(
       
   229 				$message,
       
   230 				array(
       
   231 					'additional_classes' => array( $message_class, 'inline' ),
       
   232 					'paragraph_wrap'     => false,
       
   233 				)
   220 			);
   234 			);
   221 			echo '</p></div>';
       
   222 		}
   235 		}
   223 	}
   236 	}
   224 
   237 
   225 	if ( allow_subdomain_install() && allow_subdirectory_install() ) :
   238 	if ( allow_subdomain_install() && allow_subdirectory_install() ) :
   226 		?>
   239 		?>
   258 
   271 
   259 		<?php
   272 		<?php
   260 	endif;
   273 	endif;
   261 
   274 
   262 	if ( WP_CONTENT_DIR !== ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) {
   275 	if ( WP_CONTENT_DIR !== ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) {
   263 		echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
   276 		$subdirectory_warning_message  = '<strong>' . __( 'Warning:' ) . '</strong> ';
   264 	}
   277 		$subdirectory_warning_message .= __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' );
   265 
   278 		wp_admin_notice(
   266 	$is_www = ( 0 === strpos( $hostname, 'www.' ) );
   279 			$subdirectory_warning_message,
       
   280 			array(
       
   281 				'additional_classes' => array( 'error', 'inline' ),
       
   282 			)
       
   283 		);
       
   284 	}
       
   285 
       
   286 	$is_www = str_starts_with( $hostname, 'www.' );
   267 	if ( $is_www ) :
   287 	if ( $is_www ) :
   268 		?>
   288 		?>
   269 		<h3><?php esc_html_e( 'Server Address' ); ?></h3>
   289 		<h3><?php esc_html_e( 'Server Address' ); ?></h3>
   270 		<p>
   290 		<p>
   271 		<?php
   291 		<?php
   392 	$hostname          = get_clean_basedomain();
   412 	$hostname          = get_clean_basedomain();
   393 	$slashed_home      = trailingslashit( get_option( 'home' ) );
   413 	$slashed_home      = trailingslashit( get_option( 'home' ) );
   394 	$base              = parse_url( $slashed_home, PHP_URL_PATH );
   414 	$base              = parse_url( $slashed_home, PHP_URL_PATH );
   395 	$document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
   415 	$document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
   396 	$abspath_fix       = str_replace( '\\', '/', ABSPATH );
   416 	$abspath_fix       = str_replace( '\\', '/', ABSPATH );
   397 	$home_path         = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
   417 	$home_path         = str_starts_with( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
   398 	$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
   418 	$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
   399 	$rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
   419 	$rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
   400 
   420 
   401 	$location_of_wp_config = $abspath_fix;
   421 	$location_of_wp_config = $abspath_fix;
   402 	if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
   422 	if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
   404 	}
   424 	}
   405 	$location_of_wp_config = trailingslashit( $location_of_wp_config );
   425 	$location_of_wp_config = trailingslashit( $location_of_wp_config );
   406 
   426 
   407 	// Wildcard DNS message.
   427 	// Wildcard DNS message.
   408 	if ( is_wp_error( $errors ) ) {
   428 	if ( is_wp_error( $errors ) ) {
   409 		echo '<div class="error">' . $errors->get_error_message() . '</div>';
   429 		wp_admin_notice(
       
   430 			$errors->get_error_message(),
       
   431 			array(
       
   432 				'additional_classes' => array( 'error' ),
       
   433 			)
       
   434 		);
   410 	}
   435 	}
   411 
   436 
   412 	if ( $_POST ) {
   437 	if ( $_POST ) {
   413 		if ( allow_subdomain_install() ) {
   438 		if ( allow_subdomain_install() ) {
   414 			$subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
   439 			$subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
   421 			?>
   446 			?>
   422 	<p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
   447 	<p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
   423 			<?php
   448 			<?php
   424 		} else {
   449 		} else {
   425 			$subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
   450 			$subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
       
   451 
       
   452 			wp_admin_notice(
       
   453 				'<strong>' . __( 'Warning:' ) . '</strong> ' . __( 'An existing WordPress network was detected.' ),
       
   454 				array(
       
   455 					'additional_classes' => array( 'error' ),
       
   456 				)
       
   457 			);
   426 			?>
   458 			?>
   427 	<div class="error"><p><strong><?php _e( 'Warning:' ); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
       
   428 	<p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p>
   459 	<p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p>
   429 			<?php
   460 			<?php
   430 		}
   461 		}
   431 	}
   462 	}
   432 
   463 
   436 
   467 
   437 	if ( $_POST || ! is_multisite() ) {
   468 	if ( $_POST || ! is_multisite() ) {
   438 		?>
   469 		?>
   439 		<h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
   470 		<h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
   440 		<p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
   471 		<p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
   441 		<div class="notice notice-warning inline"><p>
       
   442 		<?php
   472 		<?php
       
   473 		$notice_message = '<strong>' . __( 'Caution:' ) . '</strong> ';
       
   474 		$notice_args    = array(
       
   475 			'type'               => 'warning',
       
   476 			'additional_classes' => array( 'inline' ),
       
   477 		);
       
   478 
   443 		if ( file_exists( $home_path . '.htaccess' ) ) {
   479 		if ( file_exists( $home_path . '.htaccess' ) ) {
   444 			echo '<strong>' . __( 'Caution:' ) . '</strong> ';
   480 			$notice_message .= sprintf(
   445 			printf(
       
   446 				/* translators: 1: wp-config.php, 2: .htaccess */
   481 				/* translators: 1: wp-config.php, 2: .htaccess */
   447 				__( 'You should back up your existing %1$s and %2$s files.' ),
   482 				__( 'You should back up your existing %1$s and %2$s files.' ),
   448 				'<code>wp-config.php</code>',
   483 				'<code>wp-config.php</code>',
   449 				'<code>.htaccess</code>'
   484 				'<code>.htaccess</code>'
   450 			);
   485 			);
   451 		} elseif ( file_exists( $home_path . 'web.config' ) ) {
   486 		} elseif ( file_exists( $home_path . 'web.config' ) ) {
   452 			echo '<strong>' . __( 'Caution:' ) . '</strong> ';
   487 			$notice_message .= sprintf(
   453 			printf(
       
   454 				/* translators: 1: wp-config.php, 2: web.config */
   488 				/* translators: 1: wp-config.php, 2: web.config */
   455 				__( 'You should back up your existing %1$s and %2$s files.' ),
   489 				__( 'You should back up your existing %1$s and %2$s files.' ),
   456 				'<code>wp-config.php</code>',
   490 				'<code>wp-config.php</code>',
   457 				'<code>web.config</code>'
   491 				'<code>web.config</code>'
   458 			);
   492 			);
   459 		} else {
   493 		} else {
   460 			echo '<strong>' . __( 'Caution:' ) . '</strong> ';
   494 			$notice_message .= sprintf(
   461 			printf(
       
   462 				/* translators: %s: wp-config.php */
   495 				/* translators: %s: wp-config.php */
   463 				__( 'You should back up your existing %s file.' ),
   496 				__( 'You should back up your existing %s file.' ),
   464 				'<code>wp-config.php</code>'
   497 				'<code>wp-config.php</code>'
   465 			);
   498 			);
   466 		}
   499 		}
   467 		?>
   500 
   468 		</p></div>
   501 		wp_admin_notice( $notice_message, $notice_args );
   469 		<?php
       
   470 	}
   502 	}
   471 	?>
   503 	?>
   472 	<ol>
   504 	<ol>
   473 		<li><p>
   505 		<li><p id="network-wpconfig-rules-description">
   474 		<?php
   506 		<?php
   475 		printf(
   507 		printf(
   476 			/* translators: 1: wp-config.php, 2: Location of wp-config file, 3: Translated version of "That's all, stop editing! Happy publishing." */
   508 			/* translators: 1: wp-config.php, 2: Location of wp-config file, 3: Translated version of "That's all, stop editing! Happy publishing." */
   477 			__( 'Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:' ),
   509 			__( 'Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:' ),
   478 			'<code>wp-config.php</code>',
   510 			'<code>wp-config.php</code>',
   484 			 */
   516 			 */
   485 			'<code>/* ' . __( 'That&#8217;s all, stop editing! Happy publishing.' ) . ' */</code>'
   517 			'<code>/* ' . __( 'That&#8217;s all, stop editing! Happy publishing.' ) . ' */</code>'
   486 		);
   518 		);
   487 		?>
   519 		?>
   488 		</p>
   520 		</p>
   489 		<textarea class="code" readonly="readonly" cols="100" rows="7">
   521 		<p class="configuration-rules-label"><label for="network-wpconfig-rules">
       
   522 			<?php
       
   523 			printf(
       
   524 				/* translators: %s: File name (wp-config.php, .htaccess or web.config). */
       
   525 				__( 'Network configuration rules for %s' ),
       
   526 				'<code>wp-config.php</code>'
       
   527 			);
       
   528 			?>
       
   529 		</label></p>
       
   530 		<textarea id="network-wpconfig-rules" class="code" readonly="readonly" cols="100" rows="7" aria-describedby="network-wpconfig-rules-description">
   490 define( 'MULTISITE', true );
   531 define( 'MULTISITE', true );
   491 define( 'SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?> );
   532 define( 'SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?> );
   492 define( 'DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>' );
   533 define( 'DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>' );
   493 define( 'PATH_CURRENT_SITE', '<?php echo $base; ?>' );
   534 define( 'PATH_CURRENT_SITE', '<?php echo $base; ?>' );
   494 define( 'SITE_ID_CURRENT_SITE', 1 );
   535 define( 'SITE_ID_CURRENT_SITE', 1 );
   524 					$keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
   565 					$keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
   525 				}
   566 				}
   526 			}
   567 			}
   527 			$num_keys_salts = count( $keys_salts );
   568 			$num_keys_salts = count( $keys_salts );
   528 			?>
   569 			?>
   529 		<p>
   570 		<p id="network-wpconfig-authentication-description">
   530 			<?php
   571 			<?php
   531 			if ( 1 === $num_keys_salts ) {
   572 			if ( 1 === $num_keys_salts ) {
   532 				printf(
   573 				printf(
   533 					/* translators: %s: wp-config.php */
   574 					/* translators: %s: wp-config.php */
   534 					__( 'This unique authentication key is also missing from your %s file.' ),
   575 					__( 'This unique authentication key is also missing from your %s file.' ),
   542 				);
   583 				);
   543 			}
   584 			}
   544 			?>
   585 			?>
   545 			<?php _e( 'To make your installation more secure, you should also add:' ); ?>
   586 			<?php _e( 'To make your installation more secure, you should also add:' ); ?>
   546 		</p>
   587 		</p>
   547 		<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
   588 		<p class="configuration-rules-label"><label for="network-wpconfig-authentication"><?php _e( 'Network configuration authentication keys' ); ?></label></p>
       
   589 		<textarea id="network-wpconfig-authentication" class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>" aria-describedby="network-wpconfig-authentication-description"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
   548 			<?php
   590 			<?php
   549 		}
   591 		}
   550 		?>
   592 		?>
   551 		</li>
   593 		</li>
   552 	<?php
   594 	<?php
   601         </rewrite>
   643         </rewrite>
   602     </system.webServer>
   644     </system.webServer>
   603 </configuration>
   645 </configuration>
   604 ';
   646 ';
   605 
   647 
   606 			echo '<li><p>';
   648 			echo '<li><p id="network-webconfig-rules-description">';
   607 			printf(
   649 			printf(
   608 				/* translators: 1: File name (.htaccess or web.config), 2: File path. */
   650 				/* translators: 1: File name (.htaccess or web.config), 2: File path. */
   609 				__( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
   651 				__( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
   610 				'<code>web.config</code>',
   652 				'<code>web.config</code>',
   611 				'<code>' . $home_path . '</code>'
   653 				'<code>' . $home_path . '</code>'
   613 		echo '</p>';
   655 		echo '</p>';
   614 		if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) {
   656 		if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) {
   615 			echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
   657 			echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
   616 		}
   658 		}
   617 		?>
   659 		?>
   618 		<textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?></textarea>
   660 			<p class="configuration-rules-label"><label for="network-webconfig-rules">
       
   661 				<?php
       
   662 				printf(
       
   663 					/* translators: %s: File name (wp-config.php, .htaccess or web.config). */
       
   664 					__( 'Network configuration rules for %s' ),
       
   665 					'<code>web.config</code>'
       
   666 				);
       
   667 				?>
       
   668 			</label></p>
       
   669 			<textarea id="network-webconfig-rules" class="code" readonly="readonly" cols="100" rows="20" aria-describedby="network-webconfig-rules-description"><?php echo esc_textarea( $web_config_file ); ?></textarea>
   619 		</li>
   670 		</li>
   620 	</ol>
   671 	</ol>
   621 
   672 
   622 		<?php
   673 		<?php
   623 	elseif ( $is_nginx ) : // End iis7_supports_permalinks(). Link to Nginx documentation instead:
   674 	elseif ( $is_nginx ) : // End iis7_supports_permalinks(). Link to Nginx documentation instead:
   624 
   675 
   625 		echo '<li><p>';
   676 		echo '<li><p>';
   626 		printf(
   677 		printf(
   627 			/* translators: %s: Documentation URL. */
   678 			/* translators: %s: Documentation URL. */
   628 			__( 'It seems your network is running with Nginx web server. <a href="%s">Learn more about further configuration</a>.' ),
   679 			__( 'It seems your network is running with Nginx web server. <a href="%s">Learn more about further configuration</a>.' ),
   629 			__( 'https://wordpress.org/support/article/nginx/' )
   680 			__( 'https://developer.wordpress.org/advanced-administration/server/web-server/nginx/' )
   630 		);
   681 		);
   631 		echo '</p></li>';
   682 		echo '</p></li>';
   632 
   683 
   633 	else : // End $is_nginx. Construct an .htaccess file instead:
   684 	else : // End $is_nginx. Construct an .htaccess file instead:
   634 
   685 
   654 RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L]
   705 RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L]
   655 RewriteRule . index.php [L]
   706 RewriteRule . index.php [L]
   656 
   707 
   657 EOF;
   708 EOF;
   658 
   709 
   659 		echo '<li><p>';
   710 		echo '<li><p id="network-htaccess-rules-description">';
   660 		printf(
   711 		printf(
   661 			/* translators: 1: File name (.htaccess or web.config), 2: File path. */
   712 			/* translators: 1: File name (.htaccess or web.config), 2: File path. */
   662 			__( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
   713 			__( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
   663 			'<code>.htaccess</code>',
   714 			'<code>.htaccess</code>',
   664 			'<code>' . $home_path . '</code>'
   715 			'<code>' . $home_path . '</code>'
   666 		echo '</p>';
   717 		echo '</p>';
   667 		if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) {
   718 		if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) {
   668 			echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
   719 			echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
   669 		}
   720 		}
   670 		?>
   721 		?>
   671 		<textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>"><?php echo esc_textarea( $htaccess_file ); ?></textarea>
   722 			<p class="configuration-rules-label"><label for="network-htaccess-rules">
       
   723 				<?php
       
   724 				printf(
       
   725 					/* translators: %s: File name (wp-config.php, .htaccess or web.config). */
       
   726 					__( 'Network configuration rules for %s' ),
       
   727 					'<code>.htaccess</code>'
       
   728 				);
       
   729 				?>
       
   730 			</label></p>
       
   731 			<textarea id="network-htaccess-rules" class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>" aria-describedby="network-htaccess-rules-description"><?php echo esc_textarea( $htaccess_file ); ?></textarea>
   672 		</li>
   732 		</li>
   673 	</ol>
   733 	</ol>
   674 
   734 
   675 		<?php
   735 		<?php
   676 	endif; // End IIS/Nginx/Apache code branches.
   736 	endif; // End IIS/Nginx/Apache code branches.