plugin updates
This commit is contained in:
@@ -359,6 +359,7 @@ class WPSEO_Admin_Bar_Menu implements WPSEO_WordPress_Integration {
|
||||
$settings_url = '';
|
||||
$counter = '';
|
||||
$notification_popup = '';
|
||||
$notification_count = 0;
|
||||
|
||||
$post = $this->get_singular_post();
|
||||
if ( $post ) {
|
||||
@@ -377,7 +378,10 @@ class WPSEO_Admin_Bar_Menu implements WPSEO_WordPress_Integration {
|
||||
}
|
||||
|
||||
if ( empty( $score ) && ! is_network_admin() && $can_manage_options ) {
|
||||
$counter = $this->get_notification_counter();
|
||||
$notification_center = Yoast_Notification_Center::get();
|
||||
$notification_count = $notification_center->get_notification_count();
|
||||
|
||||
$counter = $this->get_notification_counter( $notification_count );
|
||||
$notification_popup = $this->get_notification_popup();
|
||||
}
|
||||
|
||||
@@ -389,7 +393,7 @@ class WPSEO_Admin_Bar_Menu implements WPSEO_WordPress_Integration {
|
||||
];
|
||||
$wp_admin_bar->add_menu( $admin_bar_menu_args );
|
||||
|
||||
if ( ! empty( $counter ) ) {
|
||||
if ( $notification_count > 0 ) {
|
||||
$admin_bar_menu_args = [
|
||||
'parent' => self::MENU_IDENTIFIER,
|
||||
'id' => 'wpseo-notifications',
|
||||
@@ -849,20 +853,20 @@ class WPSEO_Admin_Bar_Menu implements WPSEO_WordPress_Integration {
|
||||
/**
|
||||
* Gets the notification counter if in a valid context.
|
||||
*
|
||||
* @param int $notification_count Number of notifications.
|
||||
*
|
||||
* @return string Notification counter markup, or empty string if not available.
|
||||
*/
|
||||
protected function get_notification_counter() {
|
||||
$notification_center = Yoast_Notification_Center::get();
|
||||
$notification_count = $notification_center->get_notification_count();
|
||||
|
||||
if ( ! $notification_count ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function get_notification_counter( $notification_count ) {
|
||||
/* translators: Hidden accessibility text; %s: number of notifications. */
|
||||
$counter_screen_reader_text = sprintf( _n( '%s notification', '%s notifications', $notification_count, 'wordpress-seo' ), number_format_i18n( $notification_count ) );
|
||||
|
||||
return sprintf( ' <div class="wp-core-ui wp-ui-notification yoast-issue-counter"><span class="yoast-issues-count" aria-hidden="true">%d</span><span class="screen-reader-text">%s</span></div>', $notification_count, $counter_screen_reader_text );
|
||||
return sprintf(
|
||||
' <div class="wp-core-ui wp-ui-notification yoast-issue-counter%s"><span class="yoast-issues-count" aria-hidden="true">%d</span><span class="screen-reader-text">%s</span></div>',
|
||||
( $notification_count ) ? '' : ' wpseo-no-adminbar-notifications',
|
||||
$notification_count,
|
||||
$counter_screen_reader_text
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user