Accessibility: Improve the Comments and Privacy count text.
- standardizes the Comment count string to `%s Comment in moderation', '%s Comments in moderation` so it can be bulk-updated - adds the string as visually hidden text in the admin menu - introduces an `updateInModerationText` JS simple function, responsible to correctly update all the related text using the data from the AJAX response - adds a visually hidden text "1 Privacy Policy update" to the Privacy menu items count - adds/improves translators comments Changes that apply to all the count bubbles (Updates, plugins, etc.) - makes the bubbles and their text slightly bigger - improves the active menu item bubble contrast by changing the background color to red (option 2 in the screenshot attached in a previous comment) Props adamsoucie, afercia. Fixes #33030. Built from https://develop.svn.wordpress.org/trunk@44924 git-svn-id: http://core.svn.wordpress.org/trunk@44755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -42,6 +42,7 @@ if ( ! is_multisite() ) {
|
||||
} else {
|
||||
$cap = 'update_languages';
|
||||
}
|
||||
/* translators: %s: number of pending updates */
|
||||
$submenu['index.php'][10] = array( sprintf( __( 'Updates %s' ), "<span class='update-plugins count-{$update_data['counts']['total']}'><span class='update-count'>" . number_format_i18n( $update_data['counts']['total'] ) . '</span></span>' ), $cap, 'update-core.php' );
|
||||
unset( $cap );
|
||||
}
|
||||
@@ -74,10 +75,15 @@ $menu[15] = array( __( 'Links' ), 'manage_links', 'lin
|
||||
|
||||
// Avoid the comment count query for users who cannot edit_posts.
|
||||
if ( current_user_can( 'edit_posts' ) ) {
|
||||
$awaiting_mod = wp_count_comments();
|
||||
$awaiting_mod = $awaiting_mod->moderated;
|
||||
$menu[25] = array(
|
||||
sprintf( __( 'Comments %s' ), '<span class="awaiting-mod count-' . absint( $awaiting_mod ) . '"><span class="pending-count">' . number_format_i18n( $awaiting_mod ) . '</span></span>' ),
|
||||
$awaiting_mod = wp_count_comments();
|
||||
$awaiting_mod = $awaiting_mod->moderated;
|
||||
$awaiting_mod_i18n = number_format_i18n( $awaiting_mod );
|
||||
/* translators: %s: number of comments in moderation */
|
||||
$awaiting_mod_text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ), $awaiting_mod_i18n );
|
||||
|
||||
$menu[25] = array(
|
||||
/* translators: %s: number of comments in moderation */
|
||||
sprintf( __( 'Comments %s' ), '<span class="awaiting-mod count-' . absint( $awaiting_mod ) . '"><span class="pending-count" aria-hidden="true">' . $awaiting_mod_i18n . '</span><span class="comments-in-moderation-text screen-reader-text">' . $awaiting_mod_text . '</span></span>' ),
|
||||
'edit_posts',
|
||||
'edit-comments.php',
|
||||
'',
|
||||
@@ -214,6 +220,7 @@ if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) {
|
||||
$count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n( $update_data['counts']['plugins'] ) . '</span></span>';
|
||||
}
|
||||
|
||||
/* translators: %s: number of pending plugin updates */
|
||||
$menu[65] = array( sprintf( __( 'Plugins %s' ), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
|
||||
|
||||
$submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins', 'plugins.php' );
|
||||
@@ -264,11 +271,14 @@ if ( ! is_multisite() && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE )
|
||||
}
|
||||
|
||||
$change_notice = '';
|
||||
if ( current_user_can( 'manage_privacy_options' ) && WP_Privacy_Policy_Content::text_change_check() ) {
|
||||
$change_notice = ' <span class="update-plugins 1"><span class="plugin-count">' . number_format_i18n( 1 ) . '</span></span>';
|
||||
if ( current_user_can( 'manage_privacy_options' ) && ! WP_Privacy_Policy_Content::text_change_check() ) {
|
||||
$change_notice_number = number_format_i18n( 1 );
|
||||
/* translators: %s: number of Privacy Policy update is always 1 */
|
||||
$change_notice_text = sprintf( __( '%s Privacy Policy update' ), $change_notice_number );
|
||||
$change_notice = '<span class="update-plugins 1"><span class="plugin-count" aria-hidden="true">' . $change_notice_number . '</span><span class="screen-reader-text">' . $change_notice_text . '</span></span>';
|
||||
}
|
||||
|
||||
// translators: %s is the update notification bubble, if updates are available.
|
||||
/* translators: %s: update notification bubble, if updates are available */
|
||||
$menu[80] = array( sprintf( __( 'Settings %s' ), $change_notice ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
|
||||
$submenu['options-general.php'][10] = array( _x( 'General', 'settings screen' ), 'manage_options', 'options-general.php' );
|
||||
$submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' );
|
||||
@@ -276,7 +286,7 @@ $menu[80] = array( sprintf( __( 'Settings %s' ), $
|
||||
$submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' );
|
||||
$submenu['options-general.php'][30] = array( __( 'Media' ), 'manage_options', 'options-media.php' );
|
||||
$submenu['options-general.php'][40] = array( __( 'Permalinks' ), 'manage_options', 'options-permalink.php' );
|
||||
// translators: %s is the update notification bubble, if updates are available.
|
||||
/* translators: %s: update notification bubble, if updates are available */
|
||||
$submenu['options-general.php'][45] = array( sprintf( __( 'Privacy %s' ), $change_notice ), 'manage_privacy_options', 'privacy.php' );
|
||||
|
||||
$_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
|
||||
|
||||
Reference in New Issue
Block a user