Uma área de pesquisa sobre o WordPress para devs e autores do tema



network_step2 ›

Desde3.0.0
Obsoleton/a
network_step2 ( $errors = false )
Parâmetros:
  • (WP_Error) $errors
    Required: No
    Padrão: false
Definido em:
Codex:

Prints step 2 for Network installation process.



Fonte

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

	$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 '<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="updated inline"><p>
		<?php
		if ( file_exists( $home_path . '.htaccess' ) ) {
			echo '<strong>' . __( 'Caution:' ) . '</strong> ';
			printf(
				/* translators: 1: wp-config.php 2: .htaccess */
				__( 'We recommend you 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 */
				__( 'We recommend you 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: 1: wp-config.php */
				__( 'We recommend you back up your existing %s file.' ),
				'<code>wp-config.php</code>'
			);
		}
		?>
		</p></div>
<?php
	}
?>
		<ol>
			<li><p>
			<?php
			printf(
				/* translators: 1: wp-config.php 2: location of wp-config file, 3: translated version of "That's all, stop editing! Happy blogging." */
				__( '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 blogging.' ) . ' */</code>'
			);
			?>
			</p>
				<textarea class="code" readonly="readonly" cols="100" rows="7">
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>);
define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>');
define('PATH_CURRENT_SITE', '<?php echo $base; ?>');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
</textarea>
<?php
	$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_salts as $c => $v ) {
	if ( defined( $c ) ) {
		unset( $keys_salts[ $c ] );
	}
}