80 * |
82 * |
81 * @since 3.0.0 |
83 * @since 3.0.0 |
82 * @return string Base domain. |
84 * @return string Base domain. |
83 */ |
85 */ |
84 function get_clean_basedomain() { |
86 function get_clean_basedomain() { |
85 if ( $existing_domain = network_domain_check() ) { |
87 $existing_domain = network_domain_check(); |
|
88 if ( $existing_domain ) { |
86 return $existing_domain; |
89 return $existing_domain; |
87 } |
90 } |
88 $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); |
91 $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); |
89 if ( $slash = strpos( $domain, '/' ) ) { |
92 $slash = strpos( $domain, '/' ); |
|
93 if ( $slash ) { |
90 $domain = substr( $domain, 0, $slash ); |
94 $domain = substr( $domain, 0, $slash ); |
91 } |
95 } |
92 return $domain; |
96 return $domain; |
93 } |
97 } |
94 |
98 |
95 /** |
99 /** |
96 * Prints step 1 for Network installation process. |
100 * Prints step 1 for Network installation process. |
97 * |
101 * |
98 * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network |
102 * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. |
99 * should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo. |
103 * Navigating to Tools > Network should not be a sudden "Welcome to a new install process! |
|
104 * Fill this out and click here." See also contextual help todo. |
100 * |
105 * |
101 * @since 3.0.0 |
106 * @since 3.0.0 |
102 * |
107 * |
103 * @global bool $is_apache |
108 * @global bool $is_apache |
104 * |
109 * |
106 */ |
111 */ |
107 function network_step1( $errors = false ) { |
112 function network_step1( $errors = false ) { |
108 global $is_apache; |
113 global $is_apache; |
109 |
114 |
110 if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { |
115 if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { |
111 echo '<div class="error"><p><strong>' . __( 'ERROR:' ) . '</strong> ' . sprintf( |
116 echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . sprintf( |
112 /* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */ |
117 /* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */ |
113 __( 'The constant %s cannot be defined when creating a network.' ), |
118 __( 'The constant %s cannot be defined when creating a network.' ), |
114 '<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>' |
119 '<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>' |
115 ) . '</p></div>'; |
120 ) . '</p></div>'; |
116 echo '</div>'; |
121 echo '</div>'; |
117 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
122 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
118 die(); |
123 die(); |
119 } |
124 } |
120 |
125 |
121 $active_plugins = get_option( 'active_plugins' ); |
126 $active_plugins = get_option( 'active_plugins' ); |
122 if ( ! empty( $active_plugins ) ) { |
127 if ( ! empty( $active_plugins ) ) { |
123 echo '<div class="updated"><p><strong>' . __( 'Warning:' ) . '</strong> ' . sprintf( |
128 echo '<div class="notice notice-warning"><p><strong>' . __( 'Warning:' ) . '</strong> ' . sprintf( |
124 /* translators: %s: Plugins screen URL */ |
129 /* translators: %s: URL to Plugins screen. */ |
125 __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), |
130 __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), |
126 admin_url( 'plugins.php?plugin_status=active' ) |
131 admin_url( 'plugins.php?plugin_status=active' ) |
127 ) . '</p></div>'; |
132 ) . '</p></div>'; |
128 echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>'; |
133 echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>'; |
129 echo '</div>'; |
134 echo '</div>'; |
130 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
135 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
131 die(); |
136 die(); |
132 } |
137 } |
133 |
138 |
134 $hostname = get_clean_basedomain(); |
139 $hostname = get_clean_basedomain(); |
135 $has_ports = strstr( $hostname, ':' ); |
140 $has_ports = strstr( $hostname, ':' ); |
136 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { |
141 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) { |
137 echo '<div class="error"><p><strong>' . __( 'ERROR:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; |
142 echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; |
138 echo '<p>' . sprintf( |
143 echo '<p>' . sprintf( |
139 /* translators: %s: port number */ |
144 /* translators: %s: Port number. */ |
140 __( 'You cannot use port numbers such as %s.' ), |
145 __( 'You cannot use port numbers such as %s.' ), |
141 '<code>' . $has_ports . '</code>' |
146 '<code>' . $has_ports . '</code>' |
142 ) . '</p>'; |
147 ) . '</p>'; |
143 echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>'; |
148 echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>'; |
144 echo '</div>'; |
149 echo '</div>'; |
145 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
150 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
146 die(); |
151 die(); |
147 } |
152 } |
148 |
153 |
149 echo '<form method="post">'; |
154 echo '<form method="post">'; |
150 |
155 |
151 wp_nonce_field( 'install-network-1' ); |
156 wp_nonce_field( 'install-network-1' ); |
152 |
157 |
153 $error_codes = array(); |
158 $error_codes = array(); |
154 if ( is_wp_error( $errors ) ) { |
159 if ( is_wp_error( $errors ) ) { |
155 echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>'; |
160 echo '<div class="error"><p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>'; |
156 foreach ( $errors->get_error_messages() as $error ) { |
161 foreach ( $errors->get_error_messages() as $error ) { |
157 echo "<p>$error</p>"; |
162 echo "<p>$error</p>"; |
158 } |
163 } |
159 echo '</div>'; |
164 echo '</div>'; |
160 $error_codes = $errors->get_error_codes(); |
165 $error_codes = $errors->get_error_codes(); |
161 } |
166 } |
162 |
167 |
163 if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) { |
168 if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) { |
164 $site_name = $_POST['sitename']; |
169 $site_name = $_POST['sitename']; |
165 } else { |
170 } else { |
166 /* translators: %s: Default network name */ |
171 /* translators: %s: Default network title. */ |
167 $site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) ); |
172 $site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) ); |
168 } |
173 } |
169 |
174 |
170 if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) { |
175 if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) { |
171 $admin_email = $_POST['email']; |
176 $admin_email = $_POST['email']; |
172 } else { |
177 } else { |
173 $admin_email = get_option( 'admin_email' ); |
178 $admin_email = get_option( 'admin_email' ); |
174 } |
179 } |
175 ?> |
180 ?> |
177 <p><?php _e( 'Fill in the information below and you’ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p> |
182 <p><?php _e( 'Fill in the information below and you’ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p> |
178 <?php |
183 <?php |
179 |
184 |
180 if ( isset( $_POST['subdomain_install'] ) ) { |
185 if ( isset( $_POST['subdomain_install'] ) ) { |
181 $subdomain_install = (bool) $_POST['subdomain_install']; |
186 $subdomain_install = (bool) $_POST['subdomain_install']; |
182 } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // assume nothing |
187 } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // Assume nothing. |
183 $subdomain_install = true; |
188 $subdomain_install = true; |
184 } elseif ( ! allow_subdirectory_install() ) { |
189 } elseif ( ! allow_subdirectory_install() ) { |
185 $subdomain_install = true; |
190 $subdomain_install = true; |
186 } else { |
191 } else { |
187 $subdomain_install = false; |
192 $subdomain_install = false; |
188 if ( $got_mod_rewrite = got_mod_rewrite() ) { // dangerous assumptions |
193 $got_mod_rewrite = got_mod_rewrite(); |
|
194 if ( $got_mod_rewrite ) { // Dangerous assumptions. |
189 echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> '; |
195 echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> '; |
190 /* translators: %s: mod_rewrite */ |
|
191 printf( |
196 printf( |
|
197 /* translators: %s: mod_rewrite */ |
192 __( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ), |
198 __( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ), |
193 '<code>mod_rewrite</code>' |
199 '<code>mod_rewrite</code>' |
194 ); |
200 ); |
195 echo '</p>'; |
201 echo '</p>'; |
196 } elseif ( $is_apache ) { |
202 } elseif ( $is_apache ) { |
197 echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> '; |
203 echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> '; |
198 /* translators: %s: mod_rewrite */ |
|
199 printf( |
204 printf( |
|
205 /* translators: %s: mod_rewrite */ |
200 __( 'It looks like the Apache %s module is not installed.' ), |
206 __( 'It looks like the Apache %s module is not installed.' ), |
201 '<code>mod_rewrite</code>' |
207 '<code>mod_rewrite</code>' |
202 ); |
208 ); |
203 echo '</p>'; |
209 echo '</p>'; |
204 } |
210 } |
205 |
211 |
206 if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache) |
212 if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache). |
207 echo '<p>'; |
213 echo '<p>'; |
208 /* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite */ |
|
209 printf( |
214 printf( |
|
215 /* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */ |
210 __( '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.' ), |
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.' ), |
211 '<code>mod_rewrite</code>', |
217 '<code>mod_rewrite</code>', |
212 'https://httpd.apache.org/docs/mod/mod_rewrite.html', |
218 'https://httpd.apache.org/docs/mod/mod_rewrite.html', |
213 'https://www.google.com/search?q=apache+mod_rewrite' |
219 'https://www.google.com/search?q=apache+mod_rewrite' |
214 ); |
220 ); |
251 </table> |
257 </table> |
252 |
258 |
253 <?php |
259 <?php |
254 endif; |
260 endif; |
255 |
261 |
256 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) { |
262 if ( WP_CONTENT_DIR !== ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) { |
257 echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; |
263 echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; |
258 } |
264 } |
259 |
265 |
260 $is_www = ( 0 === strpos( $hostname, 'www.' ) ); |
266 $is_www = ( 0 === strpos( $hostname, 'www.' ) ); |
261 if ( $is_www ) : |
267 if ( $is_www ) : |
262 ?> |
268 ?> |
263 <h3><?php esc_html_e( 'Server Address' ); ?></h3> |
269 <h3><?php esc_html_e( 'Server Address' ); ?></h3> |
264 <p> |
270 <p> |
265 <?php |
271 <?php |
266 printf( |
272 printf( |
267 /* translators: 1: site url, 2: host name, 3: www */ |
273 /* translators: 1: Site URL, 2: Host name, 3: www. */ |
268 __( 'We recommend you change your siteurl to %1$s before enabling the network feature. It will still be possible to visit your site using the %3$s prefix with an address like %2$s but any links will not have the %3$s prefix.' ), |
274 __( 'We recommend you change your site domain to %1$s before enabling the network feature. It will still be possible to visit your site using the %3$s prefix with an address like %2$s but any links will not have the %3$s prefix.' ), |
269 '<code>' . substr( $hostname, 4 ) . '</code>', |
275 '<code>' . substr( $hostname, 4 ) . '</code>', |
270 '<code>' . $hostname . '</code>', |
276 '<code>' . $hostname . '</code>', |
271 '<code>www</code>' |
277 '<code>www</code>' |
272 ); |
278 ); |
273 ?> |
279 ?> |
460 ?> |
467 ?> |
461 </p></div> |
468 </p></div> |
462 <?php |
469 <?php |
463 } |
470 } |
464 ?> |
471 ?> |
465 <ol> |
472 <ol> |
466 <li><p> |
473 <li><p> |
467 <?php |
474 <?php |
468 printf( |
475 printf( |
469 /* translators: 1: wp-config.php, 2: location of wp-config file, 3: translated version of "That's all, stop editing! Happy publishing." */ |
476 /* translators: 1: wp-config.php, 2: Location of wp-config file, 3: Translated version of "That's all, stop editing! Happy publishing." */ |
470 __( 'Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:' ), |
477 __( 'Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:' ), |
471 '<code>wp-config.php</code>', |
478 '<code>wp-config.php</code>', |
472 '<code>' . $location_of_wp_config . '</code>', |
479 '<code>' . $location_of_wp_config . '</code>', |
473 /* |
480 /* |
474 * translators: This string should only be translated if wp-config-sample.php is localized. |
481 * translators: This string should only be translated if wp-config-sample.php is localized. |
475 * You can check the localized release package or |
482 * You can check the localized release package or |
476 * https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php |
483 * https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php |
477 */ |
484 */ |
478 '<code>/* ' . __( 'That’s all, stop editing! Happy publishing.' ) . ' */</code>' |
485 '<code>/* ' . __( 'That’s all, stop editing! Happy publishing.' ) . ' */</code>' |
479 ); |
486 ); |
480 ?> |
487 ?> |
481 </p> |
488 </p> |
482 <textarea class="code" readonly="readonly" cols="100" rows="7"> |
489 <textarea class="code" readonly="readonly" cols="100" rows="7"> |
483 define('MULTISITE', true); |
490 define('MULTISITE', true); |
484 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>); |
491 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>); |
485 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>'); |
492 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>'); |
486 define('PATH_CURRENT_SITE', '<?php echo $base; ?>'); |
493 define('PATH_CURRENT_SITE', '<?php echo $base; ?>'); |
487 define('SITE_ID_CURRENT_SITE', 1); |
494 define('SITE_ID_CURRENT_SITE', 1); |
488 define('BLOG_ID_CURRENT_SITE', 1); |
495 define('BLOG_ID_CURRENT_SITE', 1); |
489 </textarea> |
496 </textarea> |
490 <?php |
497 <?php |
491 $keys_salts = array( |
498 $keys_salts = array( |
492 'AUTH_KEY' => '', |
499 'AUTH_KEY' => '', |
493 'SECURE_AUTH_KEY' => '', |
500 'SECURE_AUTH_KEY' => '', |
494 'LOGGED_IN_KEY' => '', |
501 'LOGGED_IN_KEY' => '', |
495 'NONCE_KEY' => '', |
502 'NONCE_KEY' => '', |
496 'AUTH_SALT' => '', |
503 'AUTH_SALT' => '', |
497 'SECURE_AUTH_SALT' => '', |
504 'SECURE_AUTH_SALT' => '', |
498 'LOGGED_IN_SALT' => '', |
505 'LOGGED_IN_SALT' => '', |
499 'NONCE_SALT' => '', |
506 'NONCE_SALT' => '', |
500 ); |
507 ); |
501 foreach ( $keys_salts as $c => $v ) { |
508 foreach ( $keys_salts as $c => $v ) { |
502 if ( defined( $c ) ) { |
509 if ( defined( $c ) ) { |
503 unset( $keys_salts[ $c ] ); |
510 unset( $keys_salts[ $c ] ); |
504 } |
|
505 } |
|
506 |
|
507 if ( ! empty( $keys_salts ) ) { |
|
508 $keys_salts_str = ''; |
|
509 $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); |
|
510 if ( is_wp_error( $from_api ) ) { |
|
511 foreach ( $keys_salts as $c => $v ) { |
|
512 $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; |
|
513 } |
511 } |
514 } else { |
512 } |
515 $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); |
513 |
516 foreach ( $keys_salts as $c => $v ) { |
514 if ( ! empty( $keys_salts ) ) { |
517 $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; |
515 $keys_salts_str = ''; |
|
516 $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); |
|
517 if ( is_wp_error( $from_api ) ) { |
|
518 foreach ( $keys_salts as $c => $v ) { |
|
519 $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; |
|
520 } |
|
521 } else { |
|
522 $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); |
|
523 foreach ( $keys_salts as $c => $v ) { |
|
524 $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; |
|
525 } |
518 } |
526 } |
519 } |
527 $num_keys_salts = count( $keys_salts ); |
520 $num_keys_salts = count( $keys_salts ); |
528 ?> |
521 ?> |
529 <p> |
522 <p> |
530 <?php |
523 <?php |
531 if ( 1 === $num_keys_salts ) { |
524 if ( 1 == $num_keys_salts ) { |
532 printf( |
525 printf( |
533 /* translators: %s: wp-config.php */ |
526 /* translators: %s: wp-config.php */ |
534 __( 'This unique authentication key is also missing from your %s file.' ), |
527 __( 'This unique authentication key is also missing from your %s file.' ), |
535 '<code>wp-config.php</code>' |
528 '<code>wp-config.php</code>' |
536 ); |
529 ); |
537 } else { |
530 } else { |
538 printf( |
531 printf( |
539 /* translators: %s: wp-config.php */ |
532 /* translators: %s: wp-config.php */ |
540 __( 'These unique authentication keys are also missing from your %s file.' ), |
533 __( 'These unique authentication keys are also missing from your %s file.' ), |
541 '<code>wp-config.php</code>' |
534 '<code>wp-config.php</code>' |
542 ); |
535 ); |
543 } |
536 } |
544 ?> |
537 ?> |
545 <?php _e( 'To make your installation more secure, you should also add:' ); ?> |
538 <?php _e( 'To make your installation more secure, you should also add:' ); ?> |
546 </p> |
539 </p> |
547 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea> |
540 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea> |
548 <?php |
541 <?php |
549 } |
542 } |
550 ?> |
543 ?> |
551 </li> |
544 </li> |
|
545 <?php |
552 <?php |
546 if ( iis7_supports_permalinks() ) : |
553 if ( iis7_supports_permalinks() ) : |
547 // IIS doesn't support RewriteBase, all your RewriteBase are belong to us |
554 // IIS doesn't support RewriteBase, all your RewriteBase are belong to us. |
548 $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match; |
555 $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match; |
549 $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base; |
556 $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base; |
550 $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}'; |
557 $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}'; |
551 |
558 |
552 $web_config_file = '<?xml version="1.0" encoding="UTF-8"?> |
559 $web_config_file = '<?xml version="1.0" encoding="UTF-8"?> |
596 </configuration> |
603 </configuration> |
597 '; |
604 '; |
598 |
605 |
599 echo '<li><p>'; |
606 echo '<li><p>'; |
600 printf( |
607 printf( |
601 /* translators: 1: a filename like .htaccess, 2: a file path */ |
608 /* translators: 1: File name (.htaccess or web.config), 2: File path. */ |
602 __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), |
609 __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), |
603 '<code>web.config</code>', |
610 '<code>web.config</code>', |
604 '<code>' . $home_path . '</code>' |
611 '<code>' . $home_path . '</code>' |
605 ); |
612 ); |
606 echo '</p>'; |
613 echo '</p>'; |
607 if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) { |
614 if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { |
608 echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
615 echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
609 } |
616 } |
610 ?> |
617 ?> |
611 <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?> |
618 <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?></textarea> |
612 </textarea></li> |
619 </li> |
613 </ol> |
620 </ol> |
614 |
621 |
615 <?php |
622 <?php |
616 else : // end iis7_supports_permalinks(). construct an htaccess file instead: |
623 elseif ( $is_nginx ) : // End iis7_supports_permalinks(). Link to Nginx documentation instead: |
|
624 |
|
625 echo '<li><p>'; |
|
626 printf( |
|
627 /* translators: %s: Documentation URL. */ |
|
628 __( '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/' ) |
|
630 ); |
|
631 echo '</p></li>'; |
|
632 |
|
633 else : // End $is_nginx. Construct an .htaccess file instead: |
617 |
634 |
618 $ms_files_rewriting = ''; |
635 $ms_files_rewriting = ''; |
619 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { |
636 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { |
620 $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; |
637 $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; |
621 $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; |
638 $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; |
638 |
655 |
639 EOF; |
656 EOF; |
640 |
657 |
641 echo '<li><p>'; |
658 echo '<li><p>'; |
642 printf( |
659 printf( |
643 /* translators: 1: a filename like .htaccess, 2: a file path */ |
660 /* translators: 1: File name (.htaccess or web.config), 2: File path. */ |
644 __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), |
661 __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), |
645 '<code>.htaccess</code>', |
662 '<code>.htaccess</code>', |
646 '<code>' . $home_path . '</code>' |
663 '<code>' . $home_path . '</code>' |
647 ); |
664 ); |
648 echo '</p>'; |
665 echo '</p>'; |
649 if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) { |
666 if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { |
650 echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
667 echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
651 } |
668 } |
652 ?> |
669 ?> |
653 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>"> |
670 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>"><?php echo esc_textarea( $htaccess_file ); ?></textarea> |
654 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li> |
671 </li> |
655 </ol> |
672 </ol> |
656 |
673 |
657 <?php |
674 <?php |
658 endif; // end IIS/Apache code branches. |
675 endif; // End IIS/Nginx/Apache code branches. |
659 |
676 |
660 if ( ! is_multisite() ) { |
677 if ( ! is_multisite() ) { |
661 ?> |
678 ?> |
662 <p><?php _e( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.' ); ?> <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log In' ); ?></a></p> |
679 <p><?php _e( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.' ); ?> <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log In' ); ?></a></p> |
663 <?php |
680 <?php |