wp/wp-signup.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-signup.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-signup.php	Tue Dec 15 13:49:49 2020 +0100
@@ -1,15 +1,15 @@
 <?php
 
 /** Sets up the WordPress Environment. */
-require( dirname( __FILE__ ) . '/wp-load.php' );
+require __DIR__ . '/wp-load.php';
 
 add_action( 'wp_head', 'wp_no_robots' );
 
-require( dirname( __FILE__ ) . '/wp-blog-header.php' );
+require __DIR__ . '/wp-blog-header.php';
 
 nocache_headers();
 
-if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ) ) ) {
+if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ), true ) ) {
 	wp_redirect( network_home_url() );
 	die();
 }
@@ -39,7 +39,7 @@
 	die();
 }
 
-// Fix for page title
+// Fix for page title.
 $wp_query->is_404 = false;
 
 /**
@@ -86,7 +86,7 @@
 do_action( 'before_signup_form' );
 ?>
 <div id="signup-content" class="widecolumn">
-<div class="mu_register wp-signup-container">
+<div class="mu_register wp-signup-container" role="main">
 <?php
 /**
  * Generates and displays the Signup and Create Site forms
@@ -131,11 +131,15 @@
 			$site = __( 'domain' ) . '.' . $site_domain . $current_network->path;
 		}
 
-		/* translators: %s: site address */
-		echo '<p>(<strong>' . sprintf( __( 'Your address will be %s.' ), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>';
+		printf(
+			'<p>(<strong>%s</strong>) %s</p>',
+			/* translators: %s: Site address. */
+			sprintf( __( 'Your address will be %s.' ), $site ),
+			__( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' )
+		);
 	}
 
-	// Blog Title
+	// Site Title.
 	?>
 	<label for="blog_title"><?php _e( 'Site Title:' ); ?></label>
 	<?php
@@ -165,7 +169,7 @@
 			}
 
 			// Use US English if the default isn't available.
-			if ( ! in_array( $lang, $languages ) ) {
+			if ( ! in_array( $lang, $languages, true ) ) {
 				$lang = '';
 			}
 
@@ -185,7 +189,7 @@
 
 		$blog_public_on_checked  = '';
 		$blog_public_off_checked = '';
-	if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) {
+	if ( isset( $_POST['blog_public'] ) && '0' === $_POST['blog_public'] ) {
 		$blog_public_off_checked = 'checked="checked"';
 	} else {
 		$blog_public_on_checked = 'checked="checked"';
@@ -194,7 +198,7 @@
 
 	<div id="privacy">
 		<p class="privacy-intro">
-			<label for="blog_public_on"><?php _e( 'Privacy:' ); ?></label>
+			<?php _e( 'Privacy:' ); ?>
 			<?php _e( 'Allow search engines to index this site.' ); ?>
 			<br style="clear:both" />
 			<label class="checkbox" for="blog_public_on">
@@ -249,7 +253,7 @@
 		$errors = new WP_Error();
 	}
 
-	// User name
+	// Username.
 	echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
 	$errmsg = $errors->get_error_message( 'user_name' );
 	if ( $errmsg ) {
@@ -334,7 +338,7 @@
 	$blog_title = $filtered_results['blog_title'];
 	$errors     = $filtered_results['errors'];
 
-	/* translators: %s: Network's site name. */
+	/* translators: %s: Network title. */
 	echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>';
 
 	if ( $errors->has_errors() ) {
@@ -434,7 +438,7 @@
 
 		$languages = signup_get_available_languages();
 
-		if ( in_array( $_POST['WPLANG'], $languages ) ) {
+		if ( in_array( $_POST['WPLANG'], $languages, true ) ) {
 			$language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
 
 			if ( $language ) {
@@ -453,7 +457,7 @@
 	 *
 	 * @param array $blog_meta_defaults An array of default blog meta variables.
 	 */
-	$meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults );
+	$meta_defaults = apply_filters_deprecated( 'signup_create_blog_meta', array( $blog_meta_defaults ), '3.0.0', 'add_signup_meta' );
 
 	/**
 	 * Filters the new default site meta variables.
@@ -514,14 +518,14 @@
 	?>
 	<h2>
 	<?php
-		/* translators: %s: site name */
+		/* translators: %s: Site title. */
 		printf( __( 'The site %s is yours.' ), $site );
 	?>
 	</h2>
 	<p>
 		<?php
 		printf(
-			/* translators: 1: link to new site, 2: login URL, 3: username */
+			/* translators: 1: Link to new site, 2: Login URL, 3: Username. */
 			__( '%1$s is your new site. <a href="%2$s">Log in</a> as &#8220;%3$s&#8221; using your existing password.' ),
 			sprintf(
 				'<a href="%s">%s</a>',
@@ -588,7 +592,7 @@
 
 	<h2>
 	<?php
-		/* translators: %s: name of the network */
+		/* translators: %s: Name of the network. */
 		printf( __( 'Get your own %s account in seconds' ), get_network()->site_name );
 	?>
 	</h2>
@@ -637,7 +641,7 @@
 		return false;
 	}
 
-	if ( 'blog' == $_POST['signup_for'] ) {
+	if ( 'blog' === $_POST['signup_for'] ) {
 		signup_blog( $user_name, $user_email );
 		return false;
 	}
@@ -661,14 +665,14 @@
 	?>
 	<h2>
 	<?php
-	/* translators: %s: username */
+	/* translators: %s: Username. */
 	printf( __( '%s is your new username' ), $user_name )
 	?>
 	</h2>
 	<p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ); ?></p>
 	<p>
 	<?php
-	/* translators: %s: email address */
+	/* translators: %s: Email address. */
 	printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' );
 	?>
 	</p>
@@ -785,7 +789,7 @@
 
 		$languages = signup_get_available_languages();
 
-		if ( in_array( $_POST['WPLANG'], $languages ) ) {
+		if ( in_array( $_POST['WPLANG'], $languages, true ) ) {
 			$language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
 
 			if ( $language ) {
@@ -807,18 +811,18 @@
  *
  * @since MU (3.0.0)
  *
- * @param string $domain The domain URL
- * @param string $path The site root path
- * @param string $blog_title The new site title
- * @param string $user_name The user's username
- * @param string $user_email The user's email address
- * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup()
+ * @param string $domain     The domain URL.
+ * @param string $path       The site root path.
+ * @param string $blog_title The new site title.
+ * @param string $user_name  The user's username.
+ * @param string $user_email The user's email address.
+ * @param array  $meta       Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup().
  */
 function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
 	?>
 	<h2>
 	<?php
-	/* translators: %s: site address */
+	/* translators: %s: Site address. */
 	printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" )
 	?>
 	</h2>
@@ -826,7 +830,7 @@
 	<p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ); ?></p>
 	<p>
 	<?php
-	/* translators: %s: email address */
+	/* translators: %s: Email address. */
 	printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' );
 	?>
 	</p>
@@ -839,7 +843,7 @@
 			<li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ); ?></p></li>
 			<li>
 			<?php
-				/* translators: %s: email address */
+				/* translators: %s: Email address. */
 				printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email );
 			?>
 			</li>
@@ -883,7 +887,7 @@
 	return array_intersect_assoc( $languages, get_available_languages() );
 }
 
-// Main
+// Main.
 $active_signup = get_site_option( 'registration', 'none' );
 
 /**
@@ -918,7 +922,7 @@
 
 	echo ' ';
 
-	/* translators: %s: network settings URL */
+	/* translators: %s: URL to Network Settings screen. */
 	printf( __( 'To change or disable registration go to your <a href="%s">Options page</a>.' ), esc_url( network_admin_url( 'settings.php' ) ) );
 	echo '</div>';
 }
@@ -930,7 +934,7 @@
 	_e( 'Registration has been disabled.' );
 } elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) {
 	$login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
-	/* translators: %s: login URL */
+	/* translators: %s: Login URL. */
 	printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
 } else {
 	$stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
@@ -979,13 +983,13 @@
 
 				if ( 'blog' === $active_signup || 'all' === $active_signup ) {
 					printf(
-						/* translators: %s: site address */
+						/* translators: %s: Site address. */
 						'<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',
 						'<strong>' . $newblog . '</strong>'
 					);
 				} else {
 					printf(
-						/* translators: %s: site address */
+						/* translators: %s: Site address. */
 						'<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>',
 						'<strong>' . $newblog . '</strong>'
 					);