[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Network installation administration panel. 4 * 5 * A multi-step process allowing the user to enable a network of WordPress sites. 6 * 7 * @since 3.0.0 8 * 9 * @package WordPress 10 * @subpackage Administration 11 */ 12 13 define( 'WP_INSTALLING_NETWORK', true ); 14 15 /** WordPress Administration Bootstrap */ 16 require_once __DIR__ . '/admin.php'; 17 18 if ( ! current_user_can( 'setup_network' ) ) { 19 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); 20 } 21 22 if ( is_multisite() ) { 23 if ( ! is_network_admin() ) { 24 wp_redirect( network_admin_url( 'setup.php' ) ); 25 exit; 26 } 27 28 if ( ! defined( 'MULTISITE' ) ) { 29 wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) ); 30 } 31 } 32 33 require_once __DIR__ . '/includes/network.php'; 34 35 // We need to create references to ms global tables to enable Network. 36 foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) { 37 $wpdb->$table = $prefixed_table; 38 } 39 40 if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) { 41 wp_die( 42 printf( 43 /* translators: 1: WP_ALLOW_MULTISITE, 2: wp-config.php */ 44 __( 'You must define the %1$s constant as true in your %2$s file to allow creation of a Network.' ), 45 '<code>WP_ALLOW_MULTISITE</code>', 46 '<code>wp-config.php</code>' 47 ) 48 ); 49 } 50 51 if ( is_network_admin() ) { 52 // Used in the HTML title tag. 53 $title = __( 'Network Setup' ); 54 $parent_file = 'settings.php'; 55 } else { 56 // Used in the HTML title tag. 57 $title = __( 'Create a Network of WordPress Sites' ); 58 $parent_file = 'tools.php'; 59 } 60 61 $network_help = '<p>' . __( 'This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.' ) . '</p>' . 62 '<p>' . __( 'Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your installation. Fill out the network details, and click Install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).' ) . '</p>' . 63 '<p>' . __( 'The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.' ) . '</p>' . 64 '<p>' . __( 'Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).' ) . '</p>' . 65 '<p>' . __( 'Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.' ) . '</p>' . 66 '<p>' . __( 'The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with “/blog/” from the main site. This disabling will be addressed in a future version.' ) . '</p>' . 67 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 68 '<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/multisite/create-network/">Documentation on Creating a Network</a>' ) . '</p>' . 69 '<p>' . __( '<a href="https://wordpress.org/documentation/article/tools-network-screen/">Documentation on the Network Screen</a>' ) . '</p>'; 70 71 get_current_screen()->add_help_tab( 72 array( 73 'id' => 'network', 74 'title' => __( 'Network' ), 75 'content' => $network_help, 76 ) 77 ); 78 79 get_current_screen()->set_help_sidebar( 80 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 81 '<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/multisite/create-network/">Documentation on Creating a Network</a>' ) . '</p>' . 82 '<p>' . __( '<a href="https://wordpress.org/documentation/article/tools-network-screen/">Documentation on the Network Screen</a>' ) . '</p>' . 83 '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' 84 ); 85 86 require_once ABSPATH . 'wp-admin/admin-header.php'; 87 ?> 88 <div class="wrap"> 89 <h1><?php echo esc_html( $title ); ?></h1> 90 91 <?php 92 if ( $_POST ) { 93 94 check_admin_referer( 'install-network-1' ); 95 96 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 97 // Create network tables. 98 install_network(); 99 $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH ); 100 $subdomain_install = allow_subdomain_install() ? ! empty( $_POST['subdomain_install'] ) : false; 101 if ( ! network_domain_check() ) { 102 $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install ); 103 if ( is_wp_error( $result ) ) { 104 if ( 1 === count( $result->get_error_codes() ) && 'no_wildcard_dns' === $result->get_error_code() ) { 105 network_step2( $result ); 106 } else { 107 network_step1( $result ); 108 } 109 } else { 110 network_step2(); 111 } 112 } else { 113 network_step2(); 114 } 115 } elseif ( is_multisite() || network_domain_check() ) { 116 network_step2(); 117 } else { 118 network_step1(); 119 } 120 ?> 121 </div> 122 123 <?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |