diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/includes/network.php --- a/wp/wp-admin/includes/network.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/includes/network.php Tue Dec 15 13:49:49 2020 +0100 @@ -34,7 +34,7 @@ */ function allow_subdomain_install() { $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); - if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) { + if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) { return false; } @@ -52,13 +52,15 @@ */ function allow_subdirectory_install() { global $wpdb; - /** - * Filters whether to enable the subdirectory installation feature in Multisite. - * - * @since 3.0.0 - * - * @param bool $allow Whether to enable the subdirectory installation feature in Multisite. Default is false. - */ + + /** + * Filters whether to enable the subdirectory installation feature in Multisite. + * + * @since 3.0.0 + * + * @param bool $allow Whether to enable the subdirectory installation feature in Multisite. + * Default false. + */ if ( apply_filters( 'allow_subdirectory_install', false ) ) { return true; } @@ -82,11 +84,13 @@ * @return string Base domain. */ function get_clean_basedomain() { - if ( $existing_domain = network_domain_check() ) { + $existing_domain = network_domain_check(); + if ( $existing_domain ) { return $existing_domain; } $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); - if ( $slash = strpos( $domain, '/' ) ) { + $slash = strpos( $domain, '/' ); + if ( $slash ) { $domain = substr( $domain, 0, $slash ); } return $domain; @@ -95,8 +99,9 @@ /** * Prints step 1 for Network installation process. * - * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network - * should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo. + * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. + * Navigating to Tools > Network should not be a sudden "Welcome to a new install process! + * Fill this out and click here." See also contextual help todo. * * @since 3.0.0 * @@ -108,41 +113,41 @@ global $is_apache; if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { - echo '
' . __( 'ERROR:' ) . ' ' . sprintf( + echo '
' . __( 'Error:' ) . ' ' . sprintf(
/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
__( 'The constant %s cannot be defined when creating a network.' ),
'DO_NOT_UPGRADE_GLOBAL_TABLES
'
) . '
' . __( 'Warning:' ) . ' ' . sprintf( - /* translators: %s: Plugins screen URL */ + echo '
' . __( 'Warning:' ) . ' ' . sprintf( + /* translators: %s: URL to Plugins screen. */ __( 'Please deactivate your plugins before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '
' . __( 'Once the network is created, you may reactivate your plugins.' ) . '
'; echo '' . __( 'ERROR:' ) . ' ' . __( 'You cannot install a network of sites with your server address.' ) . '
' . __( 'Error:' ) . ' ' . __( 'You cannot install a network of sites with your server address.' ) . '
' . sprintf(
- /* translators: %s: port number */
+ /* translators: %s: Port number. */
__( 'You cannot use port numbers such as %s.' ),
'' . $has_ports . '
'
) . '
' . __( 'ERROR: The network could not be created.' ) . '
'; + echo '' . __( 'Error: The network could not be created.' ) . '
'; foreach ( $errors->get_error_messages() as $error ) { echo "$error
"; } @@ -160,14 +165,14 @@ $error_codes = $errors->get_error_codes(); } - if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) { + if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) { $site_name = $_POST['sitename']; } else { - /* translators: %s: Default network name */ + /* translators: %s: Default network title. */ $site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) ); } - if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) { + if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) { $admin_email = $_POST['email']; } else { $admin_email = get_option( 'admin_email' ); @@ -179,34 +184,35 @@ if ( isset( $_POST['subdomain_install'] ) ) { $subdomain_install = (bool) $_POST['subdomain_install']; - } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // assume nothing + } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // Assume nothing. $subdomain_install = true; } elseif ( ! allow_subdirectory_install() ) { $subdomain_install = true; } else { $subdomain_install = false; - if ( $got_mod_rewrite = got_mod_rewrite() ) { // dangerous assumptions + $got_mod_rewrite = got_mod_rewrite(); + if ( $got_mod_rewrite ) { // Dangerous assumptions. echo '' . __( 'Note:' ) . ' ';
- /* translators: %s: mod_rewrite */
printf(
+ /* translators: %s: mod_rewrite */
__( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ),
'mod_rewrite
'
);
echo '
' . __( 'Warning:' ) . ' ';
- /* translators: %s: mod_rewrite */
printf(
+ /* translators: %s: mod_rewrite */
__( 'It looks like the Apache %s module is not installed.' ),
'mod_rewrite
'
);
echo '
';
- /* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite */
printf(
+ /* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */
__( 'If %1$s is disabled, ask your administrator to enable that module, or look at the Apache documentation or elsewhere for help setting it up.' ),
'mod_rewrite
',
'https://httpd.apache.org/docs/mod/mod_rewrite.html',
@@ -222,14 +228,14 @@
- +
site1.%1$s and site2.%1$s ', 'subdomain examples' ),
$hostname
);
@@ -241,7 +247,7 @@
|
%1$s/site1 and %1$s/site2 ', 'subdirectory examples' ),
$hostname
);
@@ -253,19 +259,19 @@
' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . ' '; } - $is_www = ( 0 === strpos( $hostname, 'www.' ) ); + $is_www = ( 0 === strpos( $hostname, 'www.' ) ); if ( $is_www ) : ?>
' . substr( $hostname, 4 ) . '',
' |
' . $hostname . ''
);
@@ -290,7 +296,7 @@
|