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



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

Valeur par défaut : false


Fichier : wp-admin/includes/network.php

function network_step1( $errors = false ) {
	global $is_apache;

	if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
		echo '<divclass="error"><p><strong>' . __( 'Error:' ) . 'strong> ' . sprintf(
			/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
			__( 'The constant %s cannot be defined when creating a network.' ),
		) . 'p>div>';
		echo 'div>';
		require_once ABSPATH . 'wp-admin/admin-footer.php';

	$active_plugins = get_option( 'active_plugins' );
	if ( ! empty( $active_plugins ) ) {
		echo '<divclass="notice notice-warning"><p><strong>' . __( 'Warning:' ) . 'strong> ' . sprintf(
			/* translators: %s: URL to Plugins screen. */
			__( 'Please <ahref="%s">deactivate your pluginsa> before enabling the Network feature.' ),
			admin_url( 'plugins.php?plugin_status=active' )
		) . 'p>div>';
		echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . 'p>';
		echo 'div>';
		require_once ABSPATH . 'wp-admin/admin-footer.php';

	$hostname  = get_clean_basedomain();
	$has_ports = strstr( $hostname, ':' );
	if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
		echo '<divclass="error"><p><strong>' . __( 'Error:' ) . 'strong> ' . __( 'You cannot install a network of sites with your server address.' ) . 'p>div>';
		echo '<p>' . sprintf(
			/* translators: %s: Port number. */
			__( 'You cannot use port numbers such as %s.' ),
			'<code>' . $has_ports . 'code>'
		) . 'p>';
		echo '<ahref="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . 'a>';
		echo 'div>';
		require_once ABSPATH . 'wp-admin/admin-footer.php';

	echo '<formmethod="post">';

	wp_nonce_field( 'install-network-1' );

	$error_codes = array();
	if ( is_wp_error( $errors ) ) {
		echo '<divclass="error"><p><strong>' . __( 'Error: The network could not be created.' ) . 'strong>p>';
		foreach ( $errors->get_error_messages() as $error ) {
			echo "<p>$errorp>";
		echo 'div>';
		$error_codes = $errors->get_error_codes();

	if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) {
		$site_name = $_POST['sitename'];
	} else {
		/* translators: %s: Default network title. */
		$site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) );

	if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) {
		$admin_email = $_POST['email'];
	} else {
		$admin_email = get_option( 'admin_email' );
	<p>_e('Welcome to the Network installation process!');?>p><p>_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>if(isset($_POST['subdomain_install'])){$subdomain_install=(bool)$_POST['subdomain_install'];}elseif(apache_mod_loaded('mod_rewrite')){// Assume nothing.$subdomain_install=true;}elseif(!allow_subdirectory_install()){$subdomain_install=true;}else{$subdomain_install=false;$got_mod_rewrite=got_mod_rewrite();if($got_mod_rewrite){// Dangerous assumptions.echo'

'.__('Note:').' ';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:').' ';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).echo'

';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','','');echo'

<h3>esc_html_e('Addresses of Sites in your Network');?>h3><p>_e('Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories.');?><strong>_e('You cannot change this later.');?>strong>p><p>_e('You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.');?>p>// @todo Link to an MS readme? ?><tableclass="form-table"role="presentation"><tr><th><label><inputtype="radio"name="subdomain_install"value="1"checked($subdomain_install);?>/>_e('Sub-domains');?>label>th><td>printf(/* translators: 1: Host name. */_x('like site1.%1$s and site2.%1$s','subdomain examples'),$hostname);?>td>tr><tr><th><label><inputtype="radio"name="subdomain_install"value="0"checked(!$subdomain_install);?>/>_e('Sub-directories');?>label>th><td>printf(/* translators: 1: Host name. */_x('like %1$s/site1 and %1$s/site2','subdirectory examples'),$hostname);?>td>tr>table>endif;if(WP_CONTENT_DIR!==ABSPATH.'wp-content'&&(allow_subdirectory_install()||!allow_subdomain_install())){echo'

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

<h3>esc_html_e('Server Address');?>h3><p>printf(/* translators: 1: Site URL, 2: Host name, 3: www. */__('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.'),''.substr($hostname,4).'',''.$hostname.'','www');?>p><tableclass="form-table"role="presentation"><tr><thscope='row'>esc_html_e('Server Address');?>th><td>printf(/* translators: %s: Host name. */__('The internet address of your network will be %s.'),''.$hostname.'');?>td>tr>table>endif;?><h3>esc_html_e('Network Details');?>h3><tableclass="form-table"role="presentation">if('localhost'===$hostname):?><tr><thscope="row">esc_html_e('Sub-directory Installation');?>th><td>printf(/* translators: 1: localhost, 2: localhost.localdomain */__('Because you are using %1$s, the sites in your WordPress network must use sub-directories. Consider using %2$s if you wish to use sub-domains.'),'localhost','localhost.localdomain');// Uh oh:if(!allow_subdirectory_install()){echo' '.__('Warning:').' '.__('The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.').'';}?>td>tr>elseif(!allow_subdomain_install()):?><tr><thscope="row">esc_html_e('Sub-directory Installation');?>th><td>_e('Because your installation is in a directory, the sites in your WordPress network must use sub-directories.');// Uh oh:if(!allow_subdirectory_install()){echo' '.__('Warning:').' '.__('The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.').'';}?>td>tr>elseif(!allow_subdirectory_install()):?><tr><thscope="row">esc_html_e('Sub-domain Installation');?>th><td>_e('Because your installation is not new, the sites in your WordPress network must use sub-domains.');echo' '.__('The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.').'';?>td>tr>endif;?>if(!$is_www):?><tr><thscope='row'>esc_html_e('Server Address');?>th><td>printf(/* translators: %s: Host name. */__('The internet address of your network will be %s.'),''.$hostname.'');?>td>tr>endif;?><tr><thscope='row'><labelfor="sitename">esc_html_e('Network Title');?>label>th><td><inputname='sitename'id='sitename'type='text'size='45'value='echoesc_attr($site_name);?>'/><pclass="description">_e('What would you like to call your network?');?>p>td>tr><tr><thscope='row'><labelfor="email">esc_html_e('Network Admin Email');?>label>th><td><inputname='email'id='email'type='text'size='45'value='echoesc_attr($admin_email);?>'/><pclass="description">_e('Your email address.');?>p>td>tr>table>submit_button(__('Install'),'primary','submit');?>form>}



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

Récupère le domaine de base du réseau.

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

Autoriser l'installation de sous-répertoires.

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

Autoriser l'installation de sous-domaines

wp-admin/includes/misc.php : got_mod_rewrite()

Renvoie si le serveur exécute Apache avec le module mod_rewrite chargé.

wp-admin/includes/template.php : submit_button()

Renvoie un bouton de soumission, avec le texte fourni et la ou les classes appropriées.

wp-includes/l10n.php : __()

Récupère la traduction de $text.

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 : _x()

Récupérer la chaîne traduite avec le contexte gettext.

wp-includes/formatting.php : esc_url()

Vérifie et nettoie une URL.

wp-includes/formatting.php : esc_attr()

Échappement pour les attributs HTML.

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

Produit l'attribut HTML checked.

wp-includes/functions.php : apache_mod_loaded()

Le module spécifié existe-t-il dans la configuration d'Apache ?

wp-includes/functions.php : wp_nonce_field()

Récupère ou affiche le champ caché nonce pour les formulaires.

wp-includes/link-template.php : admin_url()

Récupère l'URL de la zone d'administration pour le site actuel.

wp-includes/option.php : get_option()

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

wp-includes/load.php : is_wp_error()

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


Version Description
3.0.0 Introduit.