Coding Standards: Remove a one-time `$message` variable in WordPress version requirement notices for bundled themes.

This makes the formatting of these messages more consistent.

Follow-up to [23816], [51154].

See #52627.
Built from https://develop.svn.wordpress.org/trunk@51155


git-svn-id: http://core.svn.wordpress.org/trunk@50764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-06-15 15:24:58 +00:00
parent e05ffb46a5
commit aed608b98c
7 changed files with 116 additions and 41 deletions

View File

@ -34,9 +34,14 @@ add_action( 'after_switch_theme', 'twentyfifteen_switch_theme' );
* @since Twenty Fifteen 1.0 * @since Twenty Fifteen 1.0
*/ */
function twentyfifteen_upgrade_notice() { function twentyfifteen_upgrade_notice() {
printf(
'<div class="error"><p>%s</p></div>',
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
$message = sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ); __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ),
printf( '<div class="error"><p>%s</p></div>', $message ); $GLOBALS['wp_version']
)
);
} }
/** /**
@ -46,8 +51,11 @@ function twentyfifteen_upgrade_notice() {
*/ */
function twentyfifteen_customize() { function twentyfifteen_customize() {
wp_die( wp_die(
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ), __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ),
$GLOBALS['wp_version']
),
'', '',
array( array(
'back_link' => true, 'back_link' => true,
@ -63,8 +71,13 @@ add_action( 'load-customize.php', 'twentyfifteen_customize' );
*/ */
function twentyfifteen_preview() { function twentyfifteen_preview() {
if ( isset( $_GET['preview'] ) ) { if ( isset( $_GET['preview'] ) ) {
wp_die(
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
wp_die( sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ) ); __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ),
$GLOBALS['wp_version']
)
);
} }
} }
add_action( 'template_redirect', 'twentyfifteen_preview' ); add_action( 'template_redirect', 'twentyfifteen_preview' );

View File

@ -34,9 +34,14 @@ add_action( 'after_switch_theme', 'twentyfourteen_switch_theme' );
* @since Twenty Fourteen 1.0 * @since Twenty Fourteen 1.0
*/ */
function twentyfourteen_upgrade_notice() { function twentyfourteen_upgrade_notice() {
printf(
'<div class="error"><p>%s</p></div>',
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
$message = sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ); __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ),
printf( '<div class="error"><p>%s</p></div>', $message ); $GLOBALS['wp_version']
)
);
} }
/** /**
@ -46,8 +51,11 @@ function twentyfourteen_upgrade_notice() {
*/ */
function twentyfourteen_customize() { function twentyfourteen_customize() {
wp_die( wp_die(
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ), __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ),
$GLOBALS['wp_version']
),
'', '',
array( array(
'back_link' => true, 'back_link' => true,
@ -63,8 +71,13 @@ add_action( 'load-customize.php', 'twentyfourteen_customize' );
*/ */
function twentyfourteen_preview() { function twentyfourteen_preview() {
if ( isset( $_GET['preview'] ) ) { if ( isset( $_GET['preview'] ) ) {
wp_die(
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
wp_die( sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ) ); __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ),
$GLOBALS['wp_version']
)
);
} }
} }
add_action( 'template_redirect', 'twentyfourteen_preview' ); add_action( 'template_redirect', 'twentyfourteen_preview' );

View File

@ -36,9 +36,14 @@ add_action( 'after_switch_theme', 'twentynineteen_switch_theme' );
* @global string $wp_version WordPress version. * @global string $wp_version WordPress version.
*/ */
function twentynineteen_upgrade_notice() { function twentynineteen_upgrade_notice() {
printf(
'<div class="error"><p>%s</p></div>',
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
$message = sprintf( __( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ), $GLOBALS['wp_version'] ); __( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ),
printf( '<div class="error"><p>%s</p></div>', $message ); $GLOBALS['wp_version']
)
);
} }
/** /**
@ -72,8 +77,13 @@ add_action( 'load-customize.php', 'twentynineteen_customize' );
*/ */
function twentynineteen_preview() { function twentynineteen_preview() {
if ( isset( $_GET['preview'] ) ) { if ( isset( $_GET['preview'] ) ) {
wp_die(
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
wp_die( sprintf( __( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ), $GLOBALS['wp_version'] ) ); __( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ),
$GLOBALS['wp_version']
)
);
} }
} }
add_action( 'template_redirect', 'twentynineteen_preview' ); add_action( 'template_redirect', 'twentynineteen_preview' );

View File

@ -36,9 +36,14 @@ add_action( 'after_switch_theme', 'twentyseventeen_switch_theme' );
* @global string $wp_version WordPress version. * @global string $wp_version WordPress version.
*/ */
function twentyseventeen_upgrade_notice() { function twentyseventeen_upgrade_notice() {
printf(
'<div class="error"><p>%s</p></div>',
sprintf(
/* translators: %s: The current WordPress version. */ /* translators: %s: The current WordPress version. */
$message = sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ); __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ),
printf( '<div class="error"><p>%s</p></div>', $message ); $GLOBALS['wp_version']
)
);
} }
/** /**
@ -50,8 +55,11 @@ function twentyseventeen_upgrade_notice() {
*/ */
function twentyseventeen_customize() { function twentyseventeen_customize() {
wp_die( wp_die(
sprintf(
/* translators: %s: The current WordPress version. */ /* translators: %s: The current WordPress version. */
sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ), __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ),
$GLOBALS['wp_version']
),
'', '',
array( array(
'back_link' => true, 'back_link' => true,
@ -69,8 +77,13 @@ add_action( 'load-customize.php', 'twentyseventeen_customize' );
*/ */
function twentyseventeen_preview() { function twentyseventeen_preview() {
if ( isset( $_GET['preview'] ) ) { if ( isset( $_GET['preview'] ) ) {
wp_die(
sprintf(
/* translators: %s: The current WordPress version. */ /* translators: %s: The current WordPress version. */
wp_die( sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ) ); __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ),
$GLOBALS['wp_version']
)
);
} }
} }
add_action( 'template_redirect', 'twentyseventeen_preview' ); add_action( 'template_redirect', 'twentyseventeen_preview' );

View File

@ -38,9 +38,14 @@ add_action( 'after_switch_theme', 'twentysixteen_switch_theme' );
* @global string $wp_version WordPress version. * @global string $wp_version WordPress version.
*/ */
function twentysixteen_upgrade_notice() { function twentysixteen_upgrade_notice() {
printf(
'<div class="error"><p>%s</p></div>',
sprintf(
/* translators: %s: The current WordPress version. */ /* translators: %s: The current WordPress version. */
$message = sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ); __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ),
printf( '<div class="error"><p>%s</p></div>', $message ); $GLOBALS['wp_version']
)
);
} }
/** /**
@ -52,8 +57,11 @@ function twentysixteen_upgrade_notice() {
*/ */
function twentysixteen_customize() { function twentysixteen_customize() {
wp_die( wp_die(
sprintf(
/* translators: %s: The current WordPress version. */ /* translators: %s: The current WordPress version. */
sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ), __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ),
$GLOBALS['wp_version']
),
'', '',
array( array(
'back_link' => true, 'back_link' => true,
@ -71,8 +79,13 @@ add_action( 'load-customize.php', 'twentysixteen_customize' );
*/ */
function twentysixteen_preview() { function twentysixteen_preview() {
if ( isset( $_GET['preview'] ) ) { if ( isset( $_GET['preview'] ) ) {
wp_die(
sprintf(
/* translators: %s: The current WordPress version. */ /* translators: %s: The current WordPress version. */
wp_die( sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ) ); __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ),
$GLOBALS['wp_version']
)
);
} }
} }
add_action( 'template_redirect', 'twentysixteen_preview' ); add_action( 'template_redirect', 'twentysixteen_preview' );

View File

@ -34,9 +34,14 @@ add_action( 'after_switch_theme', 'twentythirteen_switch_theme' );
* @since Twenty Thirteen 1.0 * @since Twenty Thirteen 1.0
*/ */
function twentythirteen_upgrade_notice() { function twentythirteen_upgrade_notice() {
printf(
'<div class="error"><p>%s</p></div>',
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
$message = sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] ); __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ),
printf( '<div class="error"><p>%s</p></div>', $message ); $GLOBALS['wp_version']
)
);
} }
/** /**
@ -46,8 +51,11 @@ function twentythirteen_upgrade_notice() {
*/ */
function twentythirteen_customize() { function twentythirteen_customize() {
wp_die( wp_die(
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] ), __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ),
$GLOBALS['wp_version']
),
'', '',
array( array(
'back_link' => true, 'back_link' => true,
@ -63,8 +71,13 @@ add_action( 'load-customize.php', 'twentythirteen_customize' );
*/ */
function twentythirteen_preview() { function twentythirteen_preview() {
if ( isset( $_GET['preview'] ) ) { if ( isset( $_GET['preview'] ) ) {
wp_die(
sprintf(
/* translators: %s: WordPress version. */ /* translators: %s: WordPress version. */
wp_die( sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] ) ); __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ),
$GLOBALS['wp_version']
)
);
} }
} }
add_action( 'template_redirect', 'twentythirteen_preview' ); add_action( 'template_redirect', 'twentythirteen_preview' );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.8-beta1-51154'; $wp_version = '5.8-beta1-51155';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.