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' ) . '

'; echo '
'; - include( ABSPATH . 'wp-admin/admin-footer.php' ); + require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); } $active_plugins = get_option( 'active_plugins' ); if ( ! empty( $active_plugins ) ) { - echo '

' . __( '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' ) ) . '

'; echo '

' . __( 'Once the network is created, you may reactivate your plugins.' ) . '

'; echo '
'; - include( ABSPATH . 'wp-admin/admin-footer.php' ); + require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); } $hostname = get_clean_basedomain(); $has_ports = strstr( $hostname, ':' ); - if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { - echo '

' . __( 'ERROR:' ) . ' ' . __( 'You cannot install a network of sites with your server address.' ) . '

'; + if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) { + echo '

' . __( 'Error:' ) . ' ' . __( 'You cannot install a network of sites with your server address.' ) . '

'; echo '

' . sprintf( - /* translators: %s: port number */ + /* translators: %s: Port number. */ __( 'You cannot use port numbers such as %s.' ), '' . $has_ports . '' ) . '

'; echo '' . __( 'Return to Dashboard' ) . ''; echo ''; - include( ABSPATH . 'wp-admin/admin-footer.php' ); + require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); } @@ -152,7 +157,7 @@ $error_codes = array(); if ( is_wp_error( $errors ) ) { - echo '

' . __( '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 '

'; } elseif ( $is_apache ) { echo '

' . __( 'Warning:' ) . ' '; - /* translators: %s: mod_rewrite */ printf( + /* translators: %s: mod_rewrite */ __( 'It looks like the Apache %s module is not installed.' ), 'mod_rewrite' ); echo '

'; } - if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache) + if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache). 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 @@

- +