wp/wp-admin/network/themes.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
--- a/wp/wp-admin/network/themes.php	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/network/themes.php	Fri Sep 05 18:40:08 2025 +0200
@@ -39,7 +39,7 @@
 		case 'enable':
 			check_admin_referer( 'enable-theme_' . $_GET['theme'] );
 			WP_Theme::network_enable_theme( $_GET['theme'] );
-			if ( false === strpos( $referer, '/network/themes.php' ) ) {
+			if ( ! str_contains( $referer, '/network/themes.php' ) ) {
 				wp_redirect( network_admin_url( 'themes.php?enabled=1' ) );
 			} else {
 				wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) );
@@ -135,11 +135,25 @@
 				<div class="wrap">
 				<?php if ( 1 === $themes_to_delete ) : ?>
 					<h1><?php _e( 'Delete Theme' ); ?></h1>
-					<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div>
+					<?php
+					wp_admin_notice(
+						'<strong>' . __( 'Caution:' ) . '</strong> ' . __( 'This theme may be active on other sites in the network.' ),
+						array(
+							'additional_classes' => array( 'error' ),
+						)
+					);
+					?>
 					<p><?php _e( 'You are about to remove the following theme:' ); ?></p>
 				<?php else : ?>
 					<h1><?php _e( 'Delete Themes' ); ?></h1>
-					<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div>
+					<?php
+					wp_admin_notice(
+						'<strong>' . __( 'Caution:' ) . '</strong> ' . __( 'These themes may be active on other sites in the network.' ),
+						array(
+							'additional_classes' => array( 'error' ),
+						)
+					);
+					?>
 					<p><?php _e( 'You are about to remove the following themes:' ); ?></p>
 				<?php endif; ?>
 					<ul class="ul-disc">
@@ -316,14 +330,14 @@
 		)
 	);
 
-	$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>';
+	$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>';
 }
 
 get_current_screen()->set_help_sidebar(
 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 	'<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Themes_Screen">Documentation on Network Themes</a>' ) . '</p>' .
 	$help_sidebar_autoupdates .
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
+	'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
 );
 
 get_current_screen()->set_screen_reader_content(
@@ -349,7 +363,7 @@
 <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
 
 <?php if ( current_user_can( 'install_themes' ) ) : ?>
-	<a href="theme-install.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a>
+	<a href="theme-install.php" class="page-title-action"><?php echo esc_html__( 'Add New Theme' ); ?></a>
 <?php endif; ?>
 
 <?php
@@ -367,61 +381,86 @@
 <hr class="wp-header-end">
 
 <?php
+$message = '';
+$type    = 'success';
+
 if ( isset( $_GET['enabled'] ) ) {
 	$enabled = absint( $_GET['enabled'] );
 	if ( 1 === $enabled ) {
 		$message = __( 'Theme enabled.' );
 	} else {
-		/* translators: %s: Number of themes. */
-		$message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
+		$message = sprintf(
+			/* translators: %s: Number of themes. */
+			_n( '%s theme enabled.', '%s themes enabled.', $enabled ),
+			number_format_i18n( $enabled )
+		);
 	}
-	echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
 } elseif ( isset( $_GET['disabled'] ) ) {
 	$disabled = absint( $_GET['disabled'] );
 	if ( 1 === $disabled ) {
 		$message = __( 'Theme disabled.' );
 	} else {
-		/* translators: %s: Number of themes. */
-		$message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
+		$message = sprintf(
+			/* translators: %s: Number of themes. */
+			_n( '%s theme disabled.', '%s themes disabled.', $disabled ),
+			number_format_i18n( $disabled )
+		);
 	}
-	echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
 } elseif ( isset( $_GET['deleted'] ) ) {
 	$deleted = absint( $_GET['deleted'] );
 	if ( 1 === $deleted ) {
 		$message = __( 'Theme deleted.' );
 	} else {
-		/* translators: %s: Number of themes. */
-		$message = _n( '%s theme deleted.', '%s themes deleted.', $deleted );
+		$message = sprintf(
+			/* translators: %s: Number of themes. */
+			_n( '%s theme deleted.', '%s themes deleted.', $deleted ),
+			number_format_i18n( $deleted )
+		);
 	}
-	echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
 } elseif ( isset( $_GET['enabled-auto-update'] ) ) {
 	$enabled = absint( $_GET['enabled-auto-update'] );
 	if ( 1 === $enabled ) {
 		$message = __( 'Theme will be auto-updated.' );
 	} else {
-		/* translators: %s: Number of themes. */
-		$message = _n( '%s theme will be auto-updated.', '%s themes will be auto-updated.', $enabled );
+		$message = sprintf(
+			/* translators: %s: Number of themes. */
+			_n( '%s theme will be auto-updated.', '%s themes will be auto-updated.', $enabled ),
+			number_format_i18n( $enabled )
+		);
 	}
-	echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
 } elseif ( isset( $_GET['disabled-auto-update'] ) ) {
 	$disabled = absint( $_GET['disabled-auto-update'] );
 	if ( 1 === $disabled ) {
 		$message = __( 'Theme will no longer be auto-updated.' );
 	} else {
-		/* translators: %s: Number of themes. */
-		$message = _n( '%s theme will no longer be auto-updated.', '%s themes will no longer be auto-updated.', $disabled );
+		$message = sprintf(
+			/* translators: %s: Number of themes. */
+			_n( '%s theme will no longer be auto-updated.', '%s themes will no longer be auto-updated.', $disabled ),
+			number_format_i18n( $disabled )
+		);
 	}
-	echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
 } elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) {
-	echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
+	$message = __( 'No theme selected.' );
+	$type    = 'error';
 } elseif ( isset( $_GET['error'] ) && 'main' === $_GET['error'] ) {
-	echo '<div class="error notice is-dismissible"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
+	$message = __( 'You cannot delete a theme while it is active on the main site.' );
+	$type    = 'error';
 }
 
+if ( '' !== $message ) {
+	wp_admin_notice(
+		$message,
+		array(
+			'type'        => $type,
+			'dismissible' => true,
+			'id'          => 'message',
+		)
+	);
+}
 ?>
 
 <form method="get">
-<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
+<?php $wp_list_table->search_box( __( 'Search installed themes' ), 'theme' ); ?>
 </form>
 
 <?php