I18N: Restore the "Error:" prefix for error messages.

Partially reverts [48059] as there's no full consensus on the removal of the text prefix. Further actions should be taken to improve consistency and accessibility of the admin notices. Keeps some improvements to the translatable strings from [48059].

Fixes #47656.


git-svn-id: https://develop.svn.wordpress.org/trunk@48115 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia 2020-06-21 13:58:46 +00:00
parent e8176a19e2
commit 98d22d5d3d
25 changed files with 78 additions and 78 deletions

View File

@ -24,7 +24,7 @@
clipboard_msg: "Copy/Cut/Paste is not available in Mozilla and Firefox.", clipboard_msg: "Copy/Cut/Paste is not available in Mozilla and Firefox.",
clipboard_no_support: "Currently not supported by your browser, use keyboard shortcuts instead.", clipboard_no_support: "Currently not supported by your browser, use keyboard shortcuts instead.",
popup_blocked: "Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.", popup_blocked: "Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
invalid_data: "Invalid values entered, these are marked in red.", invalid_data: "Error: Invalid values entered, these are marked in red.",
invalid_data_number: "{#field} must be a number", invalid_data_number: "{#field} must be a number",
invalid_data_min: "{#field} must be a number greater than {#min}", invalid_data_min: "{#field} must be a number greater than {#min}",
invalid_data_size: "{#field} must be a number or percentage", invalid_data_size: "{#field} must be a number or percentage",

View File

@ -61,7 +61,7 @@ $parent_file = 'tools.php';
<h1><?php echo esc_html( $title ); ?></h1> <h1><?php echo esc_html( $title ); ?></h1>
<?php if ( ! empty( $_GET['invalid'] ) ) : ?> <?php if ( ! empty( $_GET['invalid'] ) ) : ?>
<div class="error"> <div class="error">
<p> <p><strong><?php _e( 'Error:' ); ?></strong>
<?php <?php
/* translators: %s: Importer slug. */ /* translators: %s: Importer slug. */
printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' ); printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' );

View File

@ -1272,7 +1272,7 @@ function wp_ajax_replyto_comment( $action ) {
if ( empty( $post->post_status ) ) { if ( empty( $post->post_status ) ) {
wp_die( 1 ); wp_die( 1 );
} elseif ( in_array( $post->post_status, array( 'draft', 'pending', 'trash' ), true ) ) { } elseif ( in_array( $post->post_status, array( 'draft', 'pending', 'trash' ), true ) ) {
wp_die( __( 'You can&#8217;t reply to a comment on a draft post.' ) ); wp_die( __( 'Error: You can&#8217;t reply to a comment on a draft post.' ) );
} }
$user = wp_get_current_user(); $user = wp_get_current_user();
@ -1302,7 +1302,7 @@ function wp_ajax_replyto_comment( $action ) {
} }
if ( '' === $comment_content ) { if ( '' === $comment_content ) {
wp_die( __( 'Please type your comment text.' ) ); wp_die( __( 'Error: Please type your comment text.' ) );
} }
$comment_parent = 0; $comment_parent = 0;
@ -1404,7 +1404,7 @@ function wp_ajax_edit_comment() {
} }
if ( '' === $_POST['content'] ) { if ( '' === $_POST['content'] ) {
wp_die( __( 'Please type your comment text.' ) ); wp_die( __( 'Error: Please type your comment text.' ) );
} }
if ( isset( $_POST['status'] ) ) { if ( isset( $_POST['status'] ) ) {

View File

@ -2100,7 +2100,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
$connection_type = isset( $credentials['connection_type'] ) ? $credentials['connection_type'] : ''; $connection_type = isset( $credentials['connection_type'] ) ? $credentials['connection_type'] : '';
if ( $error ) { if ( $error ) {
$error_string = __( 'There was an error connecting to the server. Please verify the settings are correct.' ); $error_string = __( '<strong>Error</strong>: Could not connect to the server. Please verify the settings are correct.' );
if ( is_wp_error( $error ) ) { if ( is_wp_error( $error ) ) {
$error_string = esc_html( $error->get_error_message() ); $error_string = esc_html( $error->get_error_message() );
} }

View File

@ -113,7 +113,7 @@ function network_step1( $errors = false ) {
global $is_apache; global $is_apache;
if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
echo '<div class="error"><p>' . sprintf( echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . sprintf(
/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */ /* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
__( 'The constant %s cannot be defined when creating a network.' ), __( 'The constant %s cannot be defined when creating a network.' ),
'<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>' '<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>'
@ -139,7 +139,7 @@ function network_step1( $errors = false ) {
$hostname = get_clean_basedomain(); $hostname = get_clean_basedomain();
$has_ports = strstr( $hostname, ':' ); $has_ports = strstr( $hostname, ':' );
if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) { if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
echo '<div class="error"><p><strong>' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
echo '<p>' . sprintf( echo '<p>' . sprintf(
/* translators: %s: Port number. */ /* translators: %s: Port number. */
__( 'You cannot use port numbers such as %s.' ), __( 'You cannot use port numbers such as %s.' ),
@ -157,7 +157,7 @@ function network_step1( $errors = false ) {
$error_codes = array(); $error_codes = array();
if ( is_wp_error( $errors ) ) { if ( is_wp_error( $errors ) ) {
echo '<div class="error"><p><strong>' . __( 'The network could not be created.' ) . '</strong></p>'; echo '<div class="error"><p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>';
foreach ( $errors->get_error_messages() as $error ) { foreach ( $errors->get_error_messages() as $error ) {
echo "<p>$error</p>"; echo "<p>$error</p>";
} }

View File

@ -801,7 +801,7 @@ function install_plugin_information() {
if ( ! $compatible_php ) { if ( ! $compatible_php ) {
echo '<div class="notice notice-error notice-alt"><p>'; echo '<div class="notice notice-error notice-alt"><p>';
_e( 'This plugin <strong>requires a newer version of PHP</strong>.' ); _e( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>.' );
if ( current_user_can( 'update_php' ) ) { if ( current_user_can( 'update_php' ) ) {
printf( printf(
/* translators: %s: URL to Update PHP page. */ /* translators: %s: URL to Update PHP page. */
@ -822,7 +822,7 @@ function install_plugin_information() {
echo '</p></div>'; echo '</p></div>';
} elseif ( ! $compatible_wp ) { } elseif ( ! $compatible_wp ) {
echo '<div class="notice notice-error notice-alt"><p>'; echo '<div class="notice notice-error notice-alt"><p>';
_e( 'This plugin <strong>requires a newer version of WordPress</strong>.' ); _e( '<strong>Error:</strong> This plugin <strong>requires a newer version of WordPress</strong>.' );
if ( current_user_can( 'update_core' ) ) { if ( current_user_can( 'update_core' ) ) {
printf( printf(
/* translators: %s: URL to WordPress Updates screen. */ /* translators: %s: URL to WordPress Updates screen. */

View File

@ -1153,7 +1153,7 @@ function validate_plugin_requirements( $plugin ) {
'plugin_wp_php_incompatible', 'plugin_wp_php_incompatible',
sprintf( sprintf(
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
_x( 'Current WordPress and PHP versions do not meet minimum requirements for %s.', 'plugin' ), _x( '<strong>Error:</strong> Current WordPress and PHP versions do not meet minimum requirements for %s.', 'plugin' ),
$plugin_headers['Name'] $plugin_headers['Name']
) )
); );
@ -1162,7 +1162,7 @@ function validate_plugin_requirements( $plugin ) {
'plugin_php_incompatible', 'plugin_php_incompatible',
sprintf( sprintf(
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
_x( 'Current PHP version does not meet minimum requirements for %s.', 'plugin' ), _x( '<strong>Error:</strong> Current PHP version does not meet minimum requirements for %s.', 'plugin' ),
$plugin_headers['Name'] $plugin_headers['Name']
) )
); );
@ -1171,7 +1171,7 @@ function validate_plugin_requirements( $plugin ) {
'plugin_wp_incompatible', 'plugin_wp_incompatible',
sprintf( sprintf(
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
_x( 'Current WordPress version does not meet minimum requirements for %s.', 'plugin' ), _x( '<strong>Error:</strong> Current WordPress version does not meet minimum requirements for %s.', 'plugin' ),
$plugin_headers['Name'] $plugin_headers['Name']
) )
); );

View File

@ -143,12 +143,12 @@ function edit_user( $user_id = 0 ) {
/* checking that username has been typed */ /* checking that username has been typed */
if ( '' === $user->user_login ) { if ( '' === $user->user_login ) {
$errors->add( 'user_login', __( 'Please enter a username.' ) ); $errors->add( 'user_login', __( '<strong>Error</strong>: Please enter a username.' ) );
} }
/* checking that nickname has been typed */ /* checking that nickname has been typed */
if ( $update && empty( $user->nickname ) ) { if ( $update && empty( $user->nickname ) ) {
$errors->add( 'nickname', __( 'Please enter a nickname.' ) ); $errors->add( 'nickname', __( '<strong>Error</strong>: Please enter a nickname.' ) );
} }
/** /**
@ -164,17 +164,17 @@ function edit_user( $user_id = 0 ) {
// Check for blank password when adding a user. // Check for blank password when adding a user.
if ( ! $update && empty( $pass1 ) ) { if ( ! $update && empty( $pass1 ) ) {
$errors->add( 'pass', __( 'Please enter a password.' ), array( 'form-field' => 'pass1' ) ); $errors->add( 'pass', __( '<strong>Error</strong>: Please enter a password.' ), array( 'form-field' => 'pass1' ) );
} }
// Check for "\" in password. // Check for "\" in password.
if ( false !== strpos( wp_unslash( $pass1 ), '\\' ) ) { if ( false !== strpos( wp_unslash( $pass1 ), '\\' ) ) {
$errors->add( 'pass', __( 'Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); $errors->add( 'pass', __( '<strong>Error</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) );
} }
// Checking the password has been typed twice the same. // Checking the password has been typed twice the same.
if ( ( $update || ! empty( $pass1 ) ) && $pass1 != $pass2 ) { if ( ( $update || ! empty( $pass1 ) ) && $pass1 != $pass2 ) {
$errors->add( 'pass', __( 'Passwords don&#8217;t match. Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) ); $errors->add( 'pass', __( '<strong>Error</strong>: Passwords don&#8217;t match. Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) );
} }
if ( ! empty( $pass1 ) ) { if ( ! empty( $pass1 ) ) {
@ -182,29 +182,29 @@ function edit_user( $user_id = 0 ) {
} }
if ( ! $update && isset( $_POST['user_login'] ) && ! validate_username( $_POST['user_login'] ) ) { if ( ! $update && isset( $_POST['user_login'] ) && ! validate_username( $_POST['user_login'] ) ) {
$errors->add( 'user_login', __( 'This username is invalid because it uses illegal characters. Please enter a valid username.' ) ); $errors->add( 'user_login', __( '<strong>Error</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
} }
if ( ! $update && username_exists( $user->user_login ) ) { if ( ! $update && username_exists( $user->user_login ) ) {
$errors->add( 'user_login', __( 'This username is already registered. Please choose another one.' ) ); $errors->add( 'user_login', __( '<strong>Error</strong>: This username is already registered. Please choose another one.' ) );
} }
/** This filter is documented in wp-includes/user.php */ /** This filter is documented in wp-includes/user.php */
$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
if ( in_array( strtolower( $user->user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) { if ( in_array( strtolower( $user->user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) {
$errors->add( 'invalid_username', __( 'Sorry, that username is not allowed.' ) ); $errors->add( 'invalid_username', __( '<strong>Error</strong>: Sorry, that username is not allowed.' ) );
} }
/* checking email address */ /* checking email address */
if ( empty( $user->user_email ) ) { if ( empty( $user->user_email ) ) {
$errors->add( 'empty_email', __( 'Please enter an email address.' ), array( 'form-field' => 'email' ) ); $errors->add( 'empty_email', __( '<strong>Error</strong>: Please enter an email address.' ), array( 'form-field' => 'email' ) );
} elseif ( ! is_email( $user->user_email ) ) { } elseif ( ! is_email( $user->user_email ) ) {
$errors->add( 'invalid_email', __( 'The email address isn&#8217;t correct.' ), array( 'form-field' => 'email' ) ); $errors->add( 'invalid_email', __( '<strong>Error</strong>: The email address isn&#8217;t correct.' ), array( 'form-field' => 'email' ) );
} else { } else {
$owner_id = email_exists( $user->user_email ); $owner_id = email_exists( $user->user_email );
if ( $owner_id && ( ! $update || ( $owner_id != $user->ID ) ) ) { if ( $owner_id && ( ! $update || ( $owner_id != $user->ID ) ) ) {
$errors->add( 'email_exists', __( 'This email is already registered. Please choose another one.' ), array( 'form-field' => 'email' ) ); $errors->add( 'email_exists', __( '<strong>Error</strong>: This email is already registered. Please choose another one.' ), array( 'form-field' => 'email' ) );
} }
} }

View File

@ -221,7 +221,7 @@ if ( 'update' === $action ) { // We are saving settings sent from a settings pag
wp_die( wp_die(
sprintf( sprintf(
/* translators: %s: The options page name. */ /* translators: %s: The options page name. */
__( 'Options page %s not found in the options whitelist.' ), __( '<strong>Error</strong>: Options page %s not found in the options whitelist.' ),
'<code>' . esc_html( $option_page ) . '</code>' '<code>' . esc_html( $option_page ) . '</code>'
) )
); );

View File

@ -280,12 +280,12 @@ switch ( $step ) {
$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try Again' ) . '</a>'; $tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try Again' ) . '</a>';
if ( empty( $prefix ) ) { if ( empty( $prefix ) ) {
wp_die( __( '"Table Prefix" must not be empty.' ) . $tryagain_link ); wp_die( __( '<strong>Error</strong>: "Table Prefix" must not be empty.' ) . $tryagain_link );
} }
// Validate $prefix: it can only contain letters, numbers and underscores. // Validate $prefix: it can only contain letters, numbers and underscores.
if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) { if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) {
wp_die( __( '"Table Prefix" can only contain numbers, letters, and underscores.' ) . $tryagain_link ); wp_die( __( '<strong>Error</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' ) . $tryagain_link );
} }
// Test the DB connection. // Test the DB connection.
@ -318,7 +318,7 @@ switch ( $step ) {
$wpdb->show_errors( $errors ); $wpdb->show_errors( $errors );
if ( ! $wpdb->last_error ) { if ( ! $wpdb->last_error ) {
// MySQL was able to parse the prefix as a value, which we don't want. Bail. // MySQL was able to parse the prefix as a value, which we don't want. Bail.
wp_die( __( '"Table Prefix" is invalid.' ) ); wp_die( __( '<strong>Error</strong>: "Table Prefix" is invalid.' ) );
} }
// Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password(). // Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password().

View File

@ -300,7 +300,7 @@ if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) {
$ct = wp_get_theme(); $ct = wp_get_theme();
if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
echo '<div class="error"><p>' . $ct->errors()->get_error_message() . '</p></div>'; echo '<div class="error"><p>' . __( 'Error:' ) . ' ' . $ct->errors()->get_error_message() . '</p></div>';
} }
/* /*

View File

@ -274,7 +274,7 @@ switch ( $wp_list_table->current_action() ) {
<h1><?php _e( 'Delete Users' ); ?></h1> <h1><?php _e( 'Delete Users' ); ?></h1>
<?php if ( isset( $_REQUEST['error'] ) ) : ?> <?php if ( isset( $_REQUEST['error'] ) ) : ?>
<div class="error"> <div class="error">
<p><?php _e( 'Please select an option.' ); ?></p> <p><strong><?php _e( 'Error:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
</div> </div>
<?php endif; ?> <?php endif; ?>

View File

@ -255,7 +255,7 @@ final class WP_Theme implements ArrayAccess {
) )
); );
if ( ! file_exists( $this->theme_root ) ) { // Don't cache this one. if ( ! file_exists( $this->theme_root ) ) { // Don't cache this one.
$this->errors->add( 'theme_root_missing', __( 'The themes directory is either empty or doesn&#8217;t exist. Please check your installation.' ) ); $this->errors->add( 'theme_root_missing', __( 'Error: The themes directory is either empty or doesn&#8217;t exist. Please check your installation.' ) );
} }
return; return;
} elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) { } elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) {

View File

@ -1243,19 +1243,19 @@ function wp_check_comment_data_max_lengths( $comment_data ) {
$max_lengths = wp_get_comment_fields_max_lengths(); $max_lengths = wp_get_comment_fields_max_lengths();
if ( isset( $comment_data['comment_author'] ) && mb_strlen( $comment_data['comment_author'], '8bit' ) > $max_lengths['comment_author'] ) { if ( isset( $comment_data['comment_author'] ) && mb_strlen( $comment_data['comment_author'], '8bit' ) > $max_lengths['comment_author'] ) {
return new WP_Error( 'comment_author_column_length', __( 'Your name is too long.' ), 200 ); return new WP_Error( 'comment_author_column_length', __( '<strong>Error</strong>: Your name is too long.' ), 200 );
} }
if ( isset( $comment_data['comment_author_email'] ) && strlen( $comment_data['comment_author_email'] ) > $max_lengths['comment_author_email'] ) { if ( isset( $comment_data['comment_author_email'] ) && strlen( $comment_data['comment_author_email'] ) > $max_lengths['comment_author_email'] ) {
return new WP_Error( 'comment_author_email_column_length', __( 'Your email address is too long.' ), 200 ); return new WP_Error( 'comment_author_email_column_length', __( '<strong>Error</strong>: Your email address is too long.' ), 200 );
} }
if ( isset( $comment_data['comment_author_url'] ) && strlen( $comment_data['comment_author_url'] ) > $max_lengths['comment_author_url'] ) { if ( isset( $comment_data['comment_author_url'] ) && strlen( $comment_data['comment_author_url'] ) > $max_lengths['comment_author_url'] ) {
return new WP_Error( 'comment_author_url_column_length', __( 'Your URL is too long.' ), 200 ); return new WP_Error( 'comment_author_url_column_length', __( '<strong>Error</strong>: Your URL is too long.' ), 200 );
} }
if ( isset( $comment_data['comment_content'] ) && mb_strlen( $comment_data['comment_content'], '8bit' ) > $max_lengths['comment_content'] ) { if ( isset( $comment_data['comment_content'] ) && mb_strlen( $comment_data['comment_content'], '8bit' ) > $max_lengths['comment_content'] ) {
return new WP_Error( 'comment_content_column_length', __( 'Your comment is too long.' ), 200 ); return new WP_Error( 'comment_content_column_length', __( '<strong>Error</strong>: Your comment is too long.' ), 200 );
} }
return true; return true;
@ -3398,9 +3398,9 @@ function wp_handle_comment_submission( $comment_data ) {
if ( get_option( 'require_name_email' ) && ! $user->exists() ) { if ( get_option( 'require_name_email' ) && ! $user->exists() ) {
if ( '' == $comment_author_email || '' == $comment_author ) { if ( '' == $comment_author_email || '' == $comment_author ) {
return new WP_Error( 'require_name_email', __( 'Please fill the required fields (name, email).' ), 200 ); return new WP_Error( 'require_name_email', __( '<strong>Error</strong>: Please fill the required fields (name, email).' ), 200 );
} elseif ( ! is_email( $comment_author_email ) ) { } elseif ( ! is_email( $comment_author_email ) ) {
return new WP_Error( 'require_valid_email', __( 'Please enter a valid email address.' ), 200 ); return new WP_Error( 'require_valid_email', __( '<strong>Error</strong>: Please enter a valid email address.' ), 200 );
} }
} }
@ -3425,7 +3425,7 @@ function wp_handle_comment_submission( $comment_data ) {
*/ */
$allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata ); $allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata );
if ( '' === $comment_content && ! $allow_empty_comment ) { if ( '' === $comment_content && ! $allow_empty_comment ) {
return new WP_Error( 'require_valid_comment', __( 'Please type your comment text.' ), 200 ); return new WP_Error( 'require_valid_comment', __( '<strong>Error</strong>: Please type your comment text.' ), 200 );
} }
$check_max_lengths = wp_check_comment_data_max_lengths( $commentdata ); $check_max_lengths = wp_check_comment_data_max_lengths( $commentdata );
@ -3439,7 +3439,7 @@ function wp_handle_comment_submission( $comment_data ) {
} }
if ( ! $comment_id ) { if ( ! $comment_id ) {
return new WP_Error( 'comment_save_error', __( 'The comment could not be saved. Please try again later.' ), 500 ); return new WP_Error( 'comment_save_error', __( '<strong>Error</strong>: The comment could not be saved. Please try again later.' ), 500 );
} }
return get_comment( $comment_id ); return get_comment( $comment_id );

View File

@ -1550,7 +1550,7 @@ function do_feed() {
} }
if ( ! has_action( "do_feed_{$feed}" ) ) { if ( ! has_action( "do_feed_{$feed}" ) ) {
wp_die( __( 'This is not a valid feed template.' ), '', array( 'response' => 404 ) ); wp_die( __( 'Error: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
} }
/** /**

View File

@ -548,7 +548,7 @@ function wp_set_wpdb_vars() {
wp_die( wp_die(
sprintf( sprintf(
/* translators: 1: $table_prefix, 2: wp-config.php */ /* translators: 1: $table_prefix, 2: wp-config.php */
__( '%1$s in %2$s can only contain numbers, letters, and underscores.' ), __( '<strong>Error</strong>: %1$s in %2$s can only contain numbers, letters, and underscores.' ),
'<code>$table_prefix</code>', '<code>$table_prefix</code>',
'<code>wp-config.php</code>' '<code>wp-config.php</code>'
) )

View File

@ -401,7 +401,7 @@ function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
// Check if the domain has been used already. We should return an error message. // Check if the domain has been used already. We should return an error message.
if ( domain_exists($domain, $path, $site_id) ) if ( domain_exists($domain, $path, $site_id) )
return __( 'Site URL you&#8217;ve entered is already taken.' ); return __( '<strong>Error</strong>: Site URL you&#8217;ve entered is already taken.' );
/* /*
* Need to back up wpdb table names, and create a new wp_blogs entry for new blog. * Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
@ -410,7 +410,7 @@ function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
*/ */
if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
return __( 'There was a problem creating site entry.' ); return __( '<strong>Error</strong>: There was a problem creating site entry.' );
switch_to_blog($blog_id); switch_to_blog($blog_id);
install_blog($blog_id); install_blog($blog_id);

View File

@ -547,7 +547,7 @@ if ( ! function_exists( 'wp_authenticate' ) ) :
if ( null == $user ) { if ( null == $user ) {
// TODO: What should the error message be? (Or would these even happen?) // TODO: What should the error message be? (Or would these even happen?)
// Only needed if all authentication handlers fail to return anything. // Only needed if all authentication handlers fail to return anything.
$user = new WP_Error( 'authentication_failed', __( 'Invalid username, email address or incorrect password.' ) ); $user = new WP_Error( 'authentication_failed', __( '<strong>Error</strong>: Invalid username, email address or incorrect password.' ) );
} }
$ignore_codes = array( 'empty_username', 'empty_password' ); $ignore_codes = array( 'empty_username', 'empty_password' );

View File

@ -929,7 +929,7 @@ function validate_theme_requirements( $stylesheet ) {
'theme_wp_php_incompatible', 'theme_wp_php_incompatible',
sprintf( sprintf(
/* translators: %s: Theme name. */ /* translators: %s: Theme name. */
_x( 'Current WordPress and PHP versions do not meet minimum requirements for %s.', 'theme' ), _x( '<strong>Error:</strong> Current WordPress and PHP versions do not meet minimum requirements for %s.', 'theme' ),
$theme->display( 'Name' ) $theme->display( 'Name' )
) )
); );
@ -938,7 +938,7 @@ function validate_theme_requirements( $stylesheet ) {
'theme_php_incompatible', 'theme_php_incompatible',
sprintf( sprintf(
/* translators: %s: Theme name. */ /* translators: %s: Theme name. */
_x( 'Current PHP version does not meet minimum requirements for %s.', 'theme' ), _x( '<strong>Error:</strong> Current PHP version does not meet minimum requirements for %s.', 'theme' ),
$theme->display( 'Name' ) $theme->display( 'Name' )
) )
); );
@ -947,7 +947,7 @@ function validate_theme_requirements( $stylesheet ) {
'theme_wp_incompatible', 'theme_wp_incompatible',
sprintf( sprintf(
/* translators: %s: Theme name. */ /* translators: %s: Theme name. */
_x( 'Current WordPress version does not meet minimum requirements for %s.', 'theme' ), _x( '<strong>Error:</strong> Current WordPress version does not meet minimum requirements for %s.', 'theme' ),
$theme->display( 'Name' ) $theme->display( 'Name' )
) )
); );

View File

@ -134,11 +134,11 @@ function wp_authenticate_username_password( $user, $username, $password ) {
$error = new WP_Error(); $error = new WP_Error();
if ( empty( $username ) ) { if ( empty( $username ) ) {
$error->add( 'empty_username', __( 'The username field is empty.' ) ); $error->add( 'empty_username', __( '<strong>Error</strong>: The username field is empty.' ) );
} }
if ( empty( $password ) ) { if ( empty( $password ) ) {
$error->add( 'empty_password', __( 'The password field is empty.' ) ); $error->add( 'empty_password', __( '<strong>Error</strong>: The password field is empty.' ) );
} }
return $error; return $error;
@ -172,7 +172,7 @@ function wp_authenticate_username_password( $user, $username, $password ) {
'incorrect_password', 'incorrect_password',
sprintf( sprintf(
/* translators: %s: User name. */ /* translators: %s: User name. */
__( 'The password you entered for the username %s is incorrect.' ), __( '<strong>Error</strong>: The password you entered for the username %s is incorrect.' ),
'<strong>' . $username . '</strong>' '<strong>' . $username . '</strong>'
) . ) .
' <a href="' . wp_lostpassword_url() . '">' . ' <a href="' . wp_lostpassword_url() . '">' .
@ -209,11 +209,11 @@ function wp_authenticate_email_password( $user, $email, $password ) {
if ( empty( $email ) ) { if ( empty( $email ) ) {
// Uses 'empty_username' for back-compat with wp_signon(). // Uses 'empty_username' for back-compat with wp_signon().
$error->add( 'empty_username', __( 'The email field is empty.' ) ); $error->add( 'empty_username', __( '<strong>Error</strong>: The email field is empty.' ) );
} }
if ( empty( $password ) ) { if ( empty( $password ) ) {
$error->add( 'empty_password', __( 'The password field is empty.' ) ); $error->add( 'empty_password', __( '<strong>Error</strong>: The password field is empty.' ) );
} }
return $error; return $error;
@ -244,7 +244,7 @@ function wp_authenticate_email_password( $user, $email, $password ) {
'incorrect_password', 'incorrect_password',
sprintf( sprintf(
/* translators: %s: Email address. */ /* translators: %s: Email address. */
__( 'The password you entered for the email address %s is incorrect.' ), __( '<strong>Error</strong>: The password you entered for the email address %s is incorrect.' ),
'<strong>' . $email . '</strong>' '<strong>' . $email . '</strong>'
) . ) .
' <a href="' . wp_lostpassword_url() . '">' . ' <a href="' . wp_lostpassword_url() . '">' .
@ -319,7 +319,7 @@ function wp_authenticate_spam_check( $user ) {
$spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user ); $spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user );
if ( $spammed ) { if ( $spammed ) {
return new WP_Error( 'spammer_account', __( 'Your account has been marked as a spammer.' ) ); return new WP_Error( 'spammer_account', __( '<strong>Error</strong>: Your account has been marked as a spammer.' ) );
} }
} }
return $user; return $user;
@ -2283,7 +2283,7 @@ function get_password_reset_key( $user ) {
global $wp_hasher; global $wp_hasher;
if ( ! ( $user instanceof WP_User ) ) { if ( ! ( $user instanceof WP_User ) ) {
return new WP_Error( 'invalidcombo', __( 'There is no account with that username or email address.' ) ); return new WP_Error( 'invalidcombo', __( '<strong>Error</strong>: There is no account with that username or email address.' ) );
} }
/** /**
@ -2512,29 +2512,29 @@ function register_new_user( $user_login, $user_email ) {
// Check the username. // Check the username.
if ( '' === $sanitized_user_login ) { if ( '' === $sanitized_user_login ) {
$errors->add( 'empty_username', __( 'Please enter a username.' ) ); $errors->add( 'empty_username', __( '<strong>Error</strong>: Please enter a username.' ) );
} elseif ( ! validate_username( $user_login ) ) { } elseif ( ! validate_username( $user_login ) ) {
$errors->add( 'invalid_username', __( 'This username is invalid because it uses illegal characters. Please enter a valid username.' ) ); $errors->add( 'invalid_username', __( '<strong>Error</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
$sanitized_user_login = ''; $sanitized_user_login = '';
} elseif ( username_exists( $sanitized_user_login ) ) { } elseif ( username_exists( $sanitized_user_login ) ) {
$errors->add( 'username_exists', __( 'This username is already registered. Please choose another one.' ) ); $errors->add( 'username_exists', __( '<strong>Error</strong>: This username is already registered. Please choose another one.' ) );
} else { } else {
/** This filter is documented in wp-includes/user.php */ /** This filter is documented in wp-includes/user.php */
$illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() ); $illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() );
if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) { if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) {
$errors->add( 'invalid_username', __( 'Sorry, that username is not allowed.' ) ); $errors->add( 'invalid_username', __( '<strong>Error</strong>: Sorry, that username is not allowed.' ) );
} }
} }
// Check the email address. // Check the email address.
if ( '' === $user_email ) { if ( '' === $user_email ) {
$errors->add( 'empty_email', __( 'Please type your email address.' ) ); $errors->add( 'empty_email', __( '<strong>Error</strong>: Please type your email address.' ) );
} elseif ( ! is_email( $user_email ) ) { } elseif ( ! is_email( $user_email ) ) {
$errors->add( 'invalid_email', __( 'The email address isn&#8217;t correct.' ) ); $errors->add( 'invalid_email', __( '<strong>Error</strong>: The email address isn&#8217;t correct.' ) );
$user_email = ''; $user_email = '';
} elseif ( email_exists( $user_email ) ) { } elseif ( email_exists( $user_email ) ) {
$errors->add( 'email_exists', __( 'This email is already registered. Please choose another one.' ) ); $errors->add( 'email_exists', __( '<strong>Error</strong>: This email is already registered. Please choose another one.' ) );
} }
/** /**
@ -2579,7 +2579,7 @@ function register_new_user( $user_login, $user_email ) {
'registerfail', 'registerfail',
sprintf( sprintf(
/* translators: %s: Admin email address. */ /* translators: %s: Admin email address. */
__( 'Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">site admin</a>!' ), __( '<strong>Error</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">site admin</a>!' ),
get_option( 'admin_email' ) get_option( 'admin_email' )
) )
); );
@ -2815,7 +2815,7 @@ function send_confirmation_on_profile_email() {
if ( ! is_email( $_POST['email'] ) ) { if ( ! is_email( $_POST['email'] ) ) {
$errors->add( $errors->add(
'user_email', 'user_email',
__( 'The email address isn&#8217;t correct.' ), __( '<strong>Error</strong>: The email address isn&#8217;t correct.' ),
array( array(
'form-field' => 'email', 'form-field' => 'email',
) )
@ -2827,7 +2827,7 @@ function send_confirmation_on_profile_email() {
if ( email_exists( $_POST['email'] ) ) { if ( email_exists( $_POST['email'] ) ) {
$errors->add( $errors->add(
'user_email', 'user_email',
__( 'The email address is already used.' ), __( '<strong>Error</strong>: The email address is already used.' ),
array( array(
'form-field' => 'email', 'form-field' => 'email',
) )

View File

@ -3530,7 +3530,7 @@ class wpdb {
// Make sure the server has the required MySQL version. // Make sure the server has the required MySQL version.
if ( version_compare( $this->db_version(), $required_mysql_version, '<' ) ) { if ( version_compare( $this->db_version(), $required_mysql_version, '<' ) ) {
/* translators: 1: WordPress version number, 2: Minimum required MySQL version number. */ /* translators: 1: WordPress version number, 2: Minimum required MySQL version number. */
return new WP_Error( 'database_version', sprintf( __( 'WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ) ); return new WP_Error( 'database_version', sprintf( __( '<strong>Error</strong>: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ) );
} }
} }

View File

@ -358,11 +358,11 @@ function retrieve_password() {
$user_data = false; $user_data = false;
if ( empty( $_POST['user_login'] ) || ! is_string( $_POST['user_login'] ) ) { if ( empty( $_POST['user_login'] ) || ! is_string( $_POST['user_login'] ) ) {
$errors->add( 'empty_username', __( 'Please enter a username or email address.' ) ); $errors->add( 'empty_username', __( '<strong>Error</strong>: Please enter a username or email address.' ) );
} elseif ( strpos( $_POST['user_login'], '@' ) ) { } elseif ( strpos( $_POST['user_login'], '@' ) ) {
$user_data = get_user_by( 'email', trim( wp_unslash( $_POST['user_login'] ) ) ); $user_data = get_user_by( 'email', trim( wp_unslash( $_POST['user_login'] ) ) );
if ( empty( $user_data ) ) { if ( empty( $user_data ) ) {
$errors->add( 'invalid_email', __( 'There is no account with that username or email address.' ) ); $errors->add( 'invalid_email', __( '<strong>Error</strong>: There is no account with that username or email address.' ) );
} }
} else { } else {
$login = trim( wp_unslash( $_POST['user_login'] ) ); $login = trim( wp_unslash( $_POST['user_login'] ) );
@ -404,7 +404,7 @@ function retrieve_password() {
} }
if ( ! $user_data ) { if ( ! $user_data ) {
$errors->add( 'invalidcombo', __( 'There is no account with that username or email address.' ) ); $errors->add( 'invalidcombo', __( '<strong>Error</strong>: There is no account with that username or email address.' ) );
return $errors; return $errors;
} }
@ -471,7 +471,7 @@ function retrieve_password() {
'retrieve_password_email_failure', 'retrieve_password_email_failure',
sprintf( sprintf(
/* translators: %s: Documentation URL. */ /* translators: %s: Documentation URL. */
__( 'The email could not be sent. Your site may not be correctly configured to send emails. <a href="%s">Get support for resetting your password</a>.' ), __( '<strong>Error</strong>: The email could not be sent. Your site may not be correctly configured to send emails. <a href="%s">Get support for resetting your password</a>.' ),
esc_url( __( 'https://wordpress.org/support/article/resetting-your-password/' ) ) esc_url( __( 'https://wordpress.org/support/article/resetting-your-password/' ) )
) )
); );
@ -1214,7 +1214,7 @@ switch ( $action ) {
'test_cookie', 'test_cookie',
sprintf( sprintf(
/* translators: 1: Browser cookie documentation URL, 2: Support forums URL. */ /* translators: 1: Browser cookie documentation URL, 2: Support forums URL. */
__( 'Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ), __( '<strong>Error</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ),
__( 'https://wordpress.org/support/article/cookies/' ), __( 'https://wordpress.org/support/article/cookies/' ),
__( 'https://wordpress.org/support/forums/' ) __( 'https://wordpress.org/support/forums/' )
) )
@ -1225,7 +1225,7 @@ switch ( $action ) {
'test_cookie', 'test_cookie',
sprintf( sprintf(
/* translators: %s: Browser cookie documentation URL. */ /* translators: %s: Browser cookie documentation URL. */
__( 'Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ), __( '<strong>Error</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ),
__( 'https://wordpress.org/support/article/cookies/#enable-cookies-in-your-browser' ) __( 'https://wordpress.org/support/article/cookies/#enable-cookies-in-your-browser' )
) )
); );

View File

@ -30,7 +30,7 @@ if ( defined( 'WP_TESTS_CONFIG_FILE_PATH' ) ) {
global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer, $wp_theme_directories; global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer, $wp_theme_directories;
if ( ! is_readable( $config_file_path ) ) { if ( ! is_readable( $config_file_path ) ) {
echo "wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.\n"; echo "Error: wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.\n";
exit( 1 ); exit( 1 );
} }
@ -39,7 +39,7 @@ require_once __DIR__ . '/functions.php';
if ( version_compare( tests_get_phpunit_version(), '5.4', '<' ) || version_compare( tests_get_phpunit_version(), '8.0', '>=' ) ) { if ( version_compare( tests_get_phpunit_version(), '5.4', '<' ) || version_compare( tests_get_phpunit_version(), '8.0', '>=' ) ) {
printf( printf(
"Looks like you're using PHPUnit %s. WordPress requires at least PHPUnit 5.4 and is currently only compatible with PHPUnit up to 7.x.\n", "Error: Looks like you're using PHPUnit %s. WordPress requires at least PHPUnit 5.4 and is currently only compatible with PHPUnit up to 7.x.\n",
tests_get_phpunit_version() tests_get_phpunit_version()
); );
echo "Please use the latest PHPUnit version from the 7.x branch.\n"; echo "Please use the latest PHPUnit version from the 7.x branch.\n";
@ -47,7 +47,7 @@ if ( version_compare( tests_get_phpunit_version(), '5.4', '<' ) || version_compa
} }
if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) { if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) {
echo "The /build/ directory is missing! Please run `npm run build` prior to running PHPUnit.\n"; echo "Error: The /build/ directory is missing! Please run `npm run build` prior to running PHPUnit.\n";
exit( 1 ); exit( 1 );
} }

View File

@ -54,7 +54,7 @@ class TracTickets {
// phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
public static function forcingKnownBugs() { public static function forcingKnownBugs() {
echo PHP_EOL . "\x1b[0m\x1b[37;41m\x1b[2K"; echo PHP_EOL . "\x1b[0m\x1b[37;41m\x1b[2K";
echo "Trac was inaccessible, so known bugs weren't able to be skipped." . PHP_EOL; echo "Error: Trac was inaccessible, so known bugs weren't able to be skipped." . PHP_EOL;
echo "\x1b[0m\x1b[2K"; echo "\x1b[0m\x1b[2K";
} }
} }

View File

@ -187,7 +187,7 @@ class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase {
$_POST['comment_post_ID'] = self::$draft_post->ID; $_POST['comment_post_ID'] = self::$draft_post->ID;
// Make the request. // Make the request.
$this->setExpectedException( 'WPAjaxDieStopException', 'You can&#8217;t reply to a comment on a draft post.' ); $this->setExpectedException( 'WPAjaxDieStopException', 'Error: You can&#8217;t reply to a comment on a draft post.' );
$this->_handleAjax( 'replyto-comment' ); $this->_handleAjax( 'replyto-comment' );
} }