wp/wp-admin/network/site-new.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    27 	)
    27 	)
    28 );
    28 );
    29 
    29 
    30 get_current_screen()->set_help_sidebar(
    30 get_current_screen()->set_help_sidebar(
    31 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    31 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    32 	'<p>' . __( '<a href="https://wordpress.org/support/article/network-admin-sites-screen/">Documentation on Site Management</a>' ) . '</p>' .
    32 	'<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/multisite/admin/#network-admin-sites-screen">Documentation on Site Management</a>' ) . '</p>' .
    33 	'<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>' ) . '</p>'
    33 	'<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support forums</a>' ) . '</p>'
    34 );
    34 );
    35 
    35 
    36 if ( isset( $_REQUEST['action'] ) && 'add-site' === $_REQUEST['action'] ) {
    36 if ( isset( $_REQUEST['action'] ) && 'add-site' === $_REQUEST['action'] ) {
    37 	check_admin_referer( 'add-blog', '_wpnonce_add-blog' );
    37 	check_admin_referer( 'add-blog', '_wpnonce_add-blog' );
    38 
    38 
    79 			$language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) );
    79 			$language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) );
    80 			if ( $language ) {
    80 			if ( $language ) {
    81 				$meta['WPLANG'] = $language;
    81 				$meta['WPLANG'] = $language;
    82 			}
    82 			}
    83 		}
    83 		}
       
    84 	}
       
    85 
       
    86 	if ( empty( $title ) ) {
       
    87 		wp_die( __( 'Missing site title.' ) );
    84 	}
    88 	}
    85 
    89 
    86 	if ( empty( $domain ) ) {
    90 	if ( empty( $domain ) ) {
    87 		wp_die( __( 'Missing or invalid site address.' ) );
    91 		wp_die( __( 'Missing or invalid site address.' ) );
    88 	}
    92 	}
   186 
   190 
   187 <div class="wrap">
   191 <div class="wrap">
   188 <h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1>
   192 <h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1>
   189 <?php
   193 <?php
   190 if ( ! empty( $messages ) ) {
   194 if ( ! empty( $messages ) ) {
       
   195 	$notice_args = array(
       
   196 		'type'        => 'success',
       
   197 		'dismissible' => true,
       
   198 		'id'          => 'message',
       
   199 	);
       
   200 
   191 	foreach ( $messages as $msg ) {
   201 	foreach ( $messages as $msg ) {
   192 		echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
   202 		wp_admin_notice( $msg, $notice_args );
   193 	}
   203 	}
   194 }
   204 }
   195 ?>
   205 ?>
   196 <p>
   206 <p><?php echo wp_required_field_message(); ?></p>
   197 <?php
       
   198 printf(
       
   199 	/* translators: %s: Asterisk symbol (*). */
       
   200 	__( 'Required fields are marked %s' ),
       
   201 	'<span class="required">*</span>'
       
   202 );
       
   203 ?>
       
   204 </p>
       
   205 <form method="post" action="<?php echo esc_url( network_admin_url( 'site-new.php?action=add-site' ) ); ?>" novalidate="novalidate">
   207 <form method="post" action="<?php echo esc_url( network_admin_url( 'site-new.php?action=add-site' ) ); ?>" novalidate="novalidate">
   206 <?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ); ?>
   208 <?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ); ?>
   207 	<table class="form-table" role="presentation">
   209 	<table class="form-table" role="presentation">
   208 		<tr class="form-field form-required">
   210 		<tr class="form-field form-required">
   209 			<th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ); ?> <span class="required">*</span></label></th>
   211 			<th scope="row">
       
   212 				<label for="site-address">
       
   213 					<?php
       
   214 					_e( 'Site Address (URL)' );
       
   215 					echo ' ' . wp_required_field_indicator();
       
   216 					?>
       
   217 				</label>
       
   218 			</th>
   210 			<td>
   219 			<td>
   211 			<?php if ( is_subdomain_install() ) { ?>
   220 			<?php if ( is_subdomain_install() ) { ?>
   212 				<input name="blog[domain]" type="text" class="regular-text ltr" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" required /><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', get_network()->domain ); ?></span>
   221 				<input name="blog[domain]" type="text" class="regular-text ltr" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" required /><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', get_network()->domain ); ?></span>
   213 				<?php
   222 				<?php
   214 			} else {
   223 			} else {
   220 			echo '<p class="description" id="site-address-desc">' . __( 'Only lowercase letters (a-z), numbers, and hyphens are allowed.' ) . '</p>';
   229 			echo '<p class="description" id="site-address-desc">' . __( 'Only lowercase letters (a-z), numbers, and hyphens are allowed.' ) . '</p>';
   221 			?>
   230 			?>
   222 			</td>
   231 			</td>
   223 		</tr>
   232 		</tr>
   224 		<tr class="form-field form-required">
   233 		<tr class="form-field form-required">
   225 			<th scope="row"><label for="site-title"><?php _e( 'Site Title' ); ?> <span class="required">*</span></label></th>
   234 			<th scope="row">
       
   235 				<label for="site-title">
       
   236 					<?php
       
   237 					_e( 'Site Title' );
       
   238 					echo ' ' . wp_required_field_indicator();
       
   239 					?>
       
   240 				</label>
       
   241 			</th>
   226 			<td><input name="blog[title]" type="text" class="regular-text" id="site-title" required /></td>
   242 			<td><input name="blog[title]" type="text" class="regular-text" id="site-title" required /></td>
   227 		</tr>
   243 		</tr>
   228 		<?php
   244 		<?php
   229 		$languages    = get_available_languages();
   245 		$languages    = get_available_languages();
   230 		$translations = wp_get_available_translations();
   246 		$translations = wp_get_available_translations();
   255 					?>
   271 					?>
   256 				</td>
   272 				</td>
   257 			</tr>
   273 			</tr>
   258 		<?php endif; // Languages. ?>
   274 		<?php endif; // Languages. ?>
   259 		<tr class="form-field form-required">
   275 		<tr class="form-field form-required">
   260 			<th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ); ?> <span class="required">*</span></label></th>
   276 			<th scope="row">
       
   277 				<label for="admin-email">
       
   278 					<?php
       
   279 					_e( 'Admin Email' );
       
   280 					echo ' ' . wp_required_field_indicator();
       
   281 					?>
       
   282 				</label>
       
   283 			</th>
   261 			<td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" aria-describedby="site-admin-email" required /></td>
   284 			<td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" aria-describedby="site-admin-email" required /></td>
   262 		</tr>
   285 		</tr>
   263 		<tr class="form-field">
   286 		<tr class="form-field">
   264 			<td colspan="2" class="td-full"><p id="site-admin-email"><?php _e( 'A new user will be created if the above email address is not in the database.' ); ?><br /><?php _e( 'The username and a link to set the password will be mailed to this email address.' ); ?></p></td>
   287 			<td colspan="2" class="td-full"><p id="site-admin-email"><?php _e( 'A new user will be created if the above email address is not in the database.' ); ?><br /><?php _e( 'The username and a link to set the password will be mailed to this email address.' ); ?></p></td>
   265 		</tr>
   288 		</tr>