Imprime l'étape 2 du processus d'installation du réseau.

Paramètres

$errors

(false|WP_Error)(Facultatif) Objet d'erreur.

Valeur par défaut : false

Source

Fichier : wp-admin/includes/network.php

function network_step2( $errors = false ) {
	global $wpdb, $is_nginx;

	$hostname          = get_clean_basedomain();
	$slashed_home      = trailingslashit( get_option( 'home' ) );
	$base              = parse_url( $slashed_home, PHP_URL_PATH );
	$document_root_fix = str_replace( '\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
	$abspath_fix       = str_replace( '\', '/', ABSPATH );
	$home_path         = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
	$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
	$rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';

	$location_of_wp_config = $abspath_fix;
	if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
		$location_of_wp_config = dirname( $abspath_fix );
	}
	$location_of_wp_config = trailingslashit( $location_of_wp_config );

	// Wildcard DNS message.
	if ( is_wp_error( $errors ) ) {
		echo '<divclass="error">' . $errors->get_error_message() . 'div>';
	}

	if ( $_POST ) {
		if ( allow_subdomain_install() ) {
			$subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
		} else {
			$subdomain_install = false;
		}
	} else {
		if ( is_multisite() ) {
			$subdomain_install = is_subdomain_install();
			?>
	<p>_e('The original configuration steps are shown here for reference.');?>p>}else{$subdomain_install=(bool)$wpdb->get_var("SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'");?><divclass="error"><p><strong>_e('Warning:');?>strong>_e('An existing WordPress network was detected.');?>p>div><p>_e('Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.');?>p>}}$subdir_match=$subdomain_install?'':'([_0-9a-zA-Z-]+/)?';$subdir_replacement_01=$subdomain_install?'':'$1';$subdir_replacement_12=$subdomain_install?'$1':'$2';if($_POST||!is_multisite()){?><h3>esc_html_e('Enabling the Network');?>h3><p>_e('Complete the following steps to enable the features for creating a network of sites.');?>p><divclass="notice notice-warning inline"><p>if(file_exists($home_path.'.htaccess')){echo''.__('Caution:').' ';printf(/* translators: 1: wp-config.php, 2: .htaccess */__('We recommend you back up your existing %1$s and %2$s files.'),'wp-config.php','.htaccess');}elseif(file_exists($home_path.'web.config')){echo''.__('Caution:').' ';printf(/* translators: 1: wp-config.php, 2: web.config */__('We recommend you back up your existing %1$s and %2$s files.'),'wp-config.php','web.config');}else{echo''.__('Caution:').' ';printf(/* translators: %s: wp-config.php */__('We recommend you back up your existing %s file.'),'wp-config.php');}?>p>div>}?><ol><li><p>printf(/* translators: 1: wp-config.php, 2: Location of wp-config file, 3: Translated version of "That's all, stop editing! Happy publishing." */__('Add the following to your %1$s file in %2$s above the line reading %3$s:'),'wp-config.php',''.$location_of_wp_config.'',/*
			 * translators: This string should only be translated if wp-config-sample.php is localized.
			 * You can check the localized release package or
			 * https://i18n.svn.wordpress.org//branches//dist/wp-config-sample.php
			 */'/* '.__('That’s all, stop editing! Happy publishing.').' */');?>p><textareaclass="code"readonly="readonly"cols="100"rows="7">
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', echo$subdomain_install?'true':'false';?>);
define('DOMAIN_CURRENT_SITE', 'echo$hostname;?>');
define('PATH_CURRENT_SITE', 'echo$base;?>');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
textarea>$keys_salts=array('AUTH_KEY'=>'','SECURE_AUTH_KEY'=>'','LOGGED_IN_KEY'=>'','NONCE_KEY'=>'','AUTH_SALT'=>'','SECURE_AUTH_SALT'=>'','LOGGED_IN_SALT'=>'','NONCE_SALT'=>'',);foreach($keys_saltsas$c=>$v){if(defined($c)){unset($keys_salts[$c]);}}if(!empty($keys_salts)){$keys_salts_str='';$from_api=wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/');if(is_wp_error($from_api)){foreach($keys_saltsas$c=>$v){$keys_salts_str.="ndefine( '$c', '".wp_generate_password(64,true,true)."' );";}}else{$from_api=explode("n",wp_remote_retrieve_body($from_api));foreach($keys_saltsas$c=>$v){$keys_salts_str.="ndefine( '$c', '".substr(array_shift($from_api),28,64)."' );";}}$num_keys_salts=count($keys_salts);?><p>if(1===$num_keys_salts){printf(/* translators: %s: wp-config.php */__('This unique authentication key is also missing from your %s file.'),'wp-config.php');}else{printf(/* translators: %s: wp-config.php */__('These unique authentication keys are also missing from your %s file.'),'wp-config.php');}?>_e('To make your installation more secure, you should also add:');?>p><textareaclass="code"readonly="readonly"cols="100"rows="echo$num_keys_salts;?>">echoesc_textarea($keys_salts_str);?>textarea>}?>li>if(iis7_supports_permalinks()):// IIS doesn't support RewriteBase, all your RewriteBase are belong to us.$iis_subdir_match=ltrim($base,'/').$subdir_match;$iis_rewrite_base=ltrim($base,'/').$rewrite_base;$iis_subdir_replacement=$subdomain_install?'':'{R:1}';$web_config_file='

    
        
            
                
                    
                    
                ';if(is_multisite()&&get_site_option('ms_files_rewriting')){$web_config_file.='
                
                    
                    
                ';}$web_config_file.='
                
                    
                    
                
                
                    
                    
                        
                        
                    
                    
                
                
                    
                    
                
                
                    
                    
                
                
                    
                    
                
            
        
    

';echo'
  • ';printf(/* translators: 1: File name (.htaccess or web.config), 2: File path. */__('Add the following to your %1$s file in %2$s, replacing other WordPress rules:'),'web.config',''.$home_path.'');echo'

    ';if(!$subdomain_install&&WP_CONTENT_DIR!==ABSPATH.'wp-content'){echo'

    '.__('Warning:').' '.__('Subdirectory networks may not be fully compatible with custom wp-content directories.').'

    '
    ;}?><textareaclass="code"readonly="readonly"cols="100"rows="20">echoesc_textarea($web_config_file);?>textarea>li>ol>elseif($is_nginx):// End iis7_supports_permalinks(). Link to Nginx documentation instead:echo'
  • ';printf(/* translators: %s: Documentation URL. */__('It seems your network is running with Nginx web server. Learn more about further configuration.'),__('https://wordpress.org/support/article/nginx/'));echo'

  • '
    ;else:// End $is_nginx. Construct an .htaccess file instead:$ms_files_rewriting='';if(is_multisite()&&get_site_option('ms_files_rewriting')){$ms_files_rewriting="n# uploaded filesnRewriteRule ^";$ms_files_rewriting.=$subdir_match."files/(.+) {$rewrite_base}".WPINC."/ms-files.php?file={$subdir_replacement_12} [L]"."n";}$htaccess_file=<<<EOF RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase {$base} RewriteRule ^index.php$ - [L] {$ms_files_rewriting} # add a trailing slash to /wp-admin RewriteRule ^{$subdir_match}wp-admin$ {$subdir_replacement_01}wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L] RewriteRule ^{$subdir_match}(.*.php)$ {$rewrite_base}$subdir_replacement_12 [L] RewriteRule . index.php [L] EOF;echo'
  • ';printf(/* translators: 1: File name (.htaccess or web.config), 2: File path. */__('Add the following to your %1$s file in %2$s, replacing other WordPress rules:'),'.htaccess',''.$home_path.'');echo'

    ';if(!$subdomain_install&&WP_CONTENT_DIR!==ABSPATH.'wp-content'){echo'

    '.__('Warning:').' '.__('Subdirectory networks may not be fully compatible with custom wp-content directories.').'

    '
    ;}?><textareaclass="code"readonly="readonly"cols="100"rows="echosubstr_count($htaccess_file,"n")+1;?>">echoesc_textarea($htaccess_file);?>textarea>li>ol>endif;// End IIS/Nginx/Apache code branches.if(!is_multisite()){?><p>_e('Once you complete these steps, your network is enabled and configured. You will have to log in again.');?><ahref="echoesc_url(wp_login_url());?>">_e('Log In');?>a>p>}}
  • Related

    Utilise

    Utilisations Description
    wp-admin/includes/network.php : get_clean_basedomain()

    Récupérer le domaine de base du réseau.

    wp-admin/includes/network.php : allow_subdomain_install()

    Autoriser l'installation de sous-domaines

    wp-admin/includes/network.php : allow_subdirectory_install()

    Autoriser l'installation de sous-répertoires.

    wp-admin/includes/file.php : get_home_path()

    Obtient le chemin absolu du système de fichiers vers la racine de l'installation de WordPress.

    wp-includes/l10n.php : _e()

    Affichage du texte traduit.

    wp-includes/l10n.php : esc_html_e()

    Affiche le texte traduit qui a été échappé pour une utilisation sûre dans la sortie HTML.

    wp-includes/l10n.php : __()

    Récupère la traduction de $text.

    wp-includes/formatting.php : esc_textarea()

    Échappement pour les valeurs de textarea.

    wp-includes/formatting.php : esc_url()

    Vérifie et nettoie une URL.

    wp-includes/formatting.php : trailingslashit()

    Ajoute une barre oblique de fin de ligne.

    wp-includes/pluggable.php : wp_generate_password()

    Génère un mot de passe aléatoire tiré du jeu de caractères défini.

    wp-includes/general-template.php : wp_login_url()

    Récupère l'URL de connexion.

    wp-includes/load.php : is_multisite()

    Si Multisite est activé.

    wp-includes/functions.php : iis7_supports_permalinks()

    Vérifie si IIS 7+ supporte les jolis permaliens.

    wp-includes/http.php : wp_remote_get()

    Effectue une requête HTTP en utilisant la méthode GET et renvoie sa réponse.

    wp-includes/http.php : wp_remote_retrieve_body()

    Récupérer uniquement le corps de la réponse brute.

    wp-includes/option.php : get_site_option()

    Récupérer une valeur d'option pour le réseau actuel en fonction du nom de l'option.

    wp-includes/option.php : get_option()

    Récupère une valeur d'option en fonction d'un nom d'option.

    wp-includes/ms-load.php : is_subdomain_install()

    Indique si une configuration de sous-domaine est activée.

    wp-includes/wp-db.php : wpdb::get_var()

    Récupère une variable de la base de données.

    wp-includes/load.php : is_wp_error()

    Vérifie si la variable donnée est une erreur WordPress.

    Changelog

    Version Description
    3.0.0 Introduit.