network_step2() – Prints step 2 for Network installation process.

You appear to be a bot. Output may be restricted

Description

Prints step 2 for Network installation process.

Usage

network_step2( $errors );

Parameters

$errors
( false|WP_Error ) optional – Optional. Error object. Default false.

Returns

void

Source

File name: wordpress/wp-admin/includes/network.php


Lines:

1 to 100 of 324
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         = str_starts_with( $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 '<div class="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><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
			<?php
    } else {
      $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
      ?>
	<div class="error"><p><strong><?php _e( 'Warning:' ); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
	<p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p>
			<?php
    }
  }

  $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><?php esc_html_e( 'Enabling the Network' ); ?></h3>
		<p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
		<div class="notice notice-warning inline"><p>
		<?php
    if ( file_exists( $home_path . '.htaccess' ) ) {
      echo '<strong>' . __( 'Caution:' ) . '</strong> ';
      printf(
        /* translators: 1: wp-config.php, 2: .htaccess */
        __( 'You should back up your existing %1$s and %2$s files.' ),
        '<code>wp-config.php</code>',
        '<code>.htaccess</code>'
      );
    } elseif ( file_exists( $home_path . 'web.config' ) ) {
      echo '<strong>' . __( 'Caution:' ) . '</strong> ';
      printf(
        /* translators: 1: wp-config.php, 2: web.config */
        __( 'You should back up your existing %1$s and %2$s files.' ),
        '<code>wp-config.php</code>',
        '<code>web.config</code>'
      );
    } else {
      echo '<strong>' . __( 'Caution:' ) . '</strong> ';
      printf(
        /* translators: %s: wp-config.php */
        __( 'You should back up your existing %s file.' ),
        '<code>wp-config.php</code>'
      );
    }
    ?>
		</p></div>
		<?php
  }
  ?>
	<ol>
		<li><p id="network-wpconfig-rules-description">
		<?php
    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 <strong>above</strong> the line reading %3$s:' ),
      '<code>wp-config.php</code>',
      '<code>' . $location_of_wp_config . '</code>',
      /*
			 * 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/<locale code>/branches/<wp version>/dist/wp-config-sample.php
			 */
      '<code>/* ' . __( 'That&#8217;s all, stop editing! Happy publishing.' ) . ' */</code>'
    );
    ?>
		</p>
		<p class="configuration-rules-label"><label for="network-wpconfig-rules">

 View on GitHub View on Trac