n_count = $notification_center->get_notification_count(); if ( ! $notification_count ) { return ''; } /* 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( '
%s
', $notification_count, $counter_screen_reader_text ); } /** * Gets the notification popup if in a valid context. * * @return string Notification popup markup, or empty string if not available. */ protected function get_notification_popup() { $notification_center = Yoast_Notification_Center::get(); $new_notifications = $notification_center->get_new_notifications(); $new_notifications_count = count( $new_notifications ); if ( ! $new_notifications_count ) { return ''; } $notification = sprintf( _n( 'There is a new notification.', 'There are new notifications.', $new_notifications_count, 'wordpress-seo' ), $new_notifications_count ); return '
' . $notification . '
'; } /** * Checks whether the current user can manage options in the current context. * * @return bool True if capabilities are sufficient, false otherwise. */ protected function can_manage_options() { return ( is_network_admin() && current_user_can( 'wpseo_manage_network_options' ) ) || ( ! is_network_admin() && WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ); } /** * Add submenu items to a menu item. * * @param array $submenu_items Submenu items array. * @param WP_Admin_Bar $wp_admin_bar Admin bar object. * @param string $parent_id Parent menu item ID. * * @return void */ protected function add_submenu_items( array $submenu_items, WP_Admin_Bar $wp_admin_bar, $parent_id ) { foreach ( $submenu_items as $menu_item ) { $menu_args = [ 'parent' => $parent_id, 'id' => $menu_item['id'], 'title' => $menu_item['title'], 'href' => $menu_item['href'], 'meta' => [ 'target' => '_blank' ], ]; $wp_admin_bar->add_menu( $menu_args ); } } }