wp/wp-admin/ms-delete-site.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-admin/ms-delete-site.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/ms-delete-site.php	Tue Dec 15 13:49:49 2020 +0100
@@ -7,7 +7,7 @@
  * @since 3.0.0
  */
 
-require_once( dirname( __FILE__ ) . '/admin.php' );
+require_once __DIR__ . '/admin.php';
 
 if ( ! is_multisite() ) {
 	wp_die( __( 'Multisite support is not enabled.' ) );
@@ -17,10 +17,16 @@
 	wp_die( __( 'Sorry, you are not allowed to delete this site.' ) );
 }
 
-if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) {
+if ( isset( $_GET['h'] ) && '' !== $_GET['h'] && false !== get_option( 'delete_blog_hash' ) ) {
 	if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
 		wpmu_delete_blog( get_current_blog_id() );
-		wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), get_network()->site_name ) );
+		wp_die(
+			sprintf(
+				/* translators: %s: Network title. */
+				__( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ),
+				get_network()->site_name
+			)
+		);
 	} else {
 		wp_die( __( 'Sorry, the link you clicked is stale. Please select another option.' ) );
 	}
@@ -31,12 +37,12 @@
 
 $title       = __( 'Delete Site' );
 $parent_file = 'tools.php';
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
+require_once ABSPATH . 'wp-admin/admin-header.php';
 
 echo '<div class="wrap">';
 echo '<h1>' . esc_html( $title ) . '</h1>';
 
-if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) {
+if ( isset( $_POST['action'] ) && 'deleteblog' === $_POST['action'] && isset( $_POST['confirmdelete'] ) && '1' === $_POST['confirmdelete'] ) {
 	check_admin_referer( 'delete-blog' );
 
 	$hash = wp_generate_password( 20, false );
@@ -46,7 +52,7 @@
 
 	$switched_locale = switch_to_locale( get_locale() );
 
-	/* translators: Do not translate USERNAME, URL_DELETE, SITE_NAME: those are placeholders. */
+	/* translators: Do not translate USERNAME, URL_DELETE, SITENAME, SITEURL: those are placeholders. */
 	$content = __(
 		"Howdy ###USERNAME###,
 
@@ -62,8 +68,8 @@
 are gone forever.)
 
 Thanks for using the site,
-Webmaster
-###SITE_NAME###"
+All at ###SITENAME###
+###SITEURL###"
 	);
 	/**
 	 * Filters the email content sent when a site in a Multisite network is deleted.
@@ -76,9 +82,18 @@
 
 	$content = str_replace( '###USERNAME###', $user->user_login, $content );
 	$content = str_replace( '###URL_DELETE###', $url_delete, $content );
-	$content = str_replace( '###SITE_NAME###', get_network()->site_name, $content );
+	$content = str_replace( '###SITENAME###', get_network()->site_name, $content );
+	$content = str_replace( '###SITEURL###', network_home_url(), $content );
 
-	wp_mail( get_option( 'admin_email' ), '[ ' . wp_specialchars_decode( get_option( 'blogname' ) ) . ' ] ' . __( 'Delete My Site' ), $content );
+	wp_mail(
+		get_option( 'admin_email' ),
+		sprintf(
+			/* translators: %s: Site title. */
+			__( '[%s] Delete My Site' ),
+			wp_specialchars_decode( get_option( 'blogname' ) )
+		),
+		$content
+	);
 
 	if ( $switched_locale ) {
 		restore_previous_locale();
@@ -90,7 +105,15 @@
 	<?php
 } else {
 	?>
-	<p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.' ), get_network()->site_name ); ?></p>
+	<p>
+	<?php
+		printf(
+			/* translators: %s: Network title. */
+			__( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.' ),
+			get_network()->site_name
+		);
+	?>
+	</p>
 	<p><?php _e( 'Remember, once deleted your site cannot be restored.' ); ?></p>
 
 	<form method="post" name="deletedirect">
@@ -99,8 +122,8 @@
 		<p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong>
 		<?php
 			printf(
-				/* translators: %s: site address */
-				__( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ),
+				/* translators: %s: Site address. */
+				__( "I'm sure I want to permanently delete my site, and I am aware I can never get it back or use %s again." ),
 				$blog->domain . $blog->path
 			);
 		?>
@@ -111,4 +134,4 @@
 }
 echo '</div>';
 
-include( ABSPATH . 'wp-admin/admin-footer.php' );
+require_once ABSPATH . 'wp-admin/admin-footer.php';