$term, 'taxonomy' ) ) { return ''; } $analysis_seo = new WPSEO_Metabox_Analysis_SEO(); $analysis_readability = new WPSEO_Metabox_Analysis_Readability(); if ( $analysis_seo->is_enabled() ) { return $this->get_score( WPSEO_Taxonomy_Meta::get_term_meta( $term->term_id, $term->taxonomy, 'linkdex' ) ); } if ( $analysis_readability->is_enabled() ) { return $this->get_score( WPSEO_Taxonomy_Meta::get_term_meta( $term->term_id, $term->taxonomy, 'content_score' ) ); } return ''; } /** * Takes the SEO score and makes the score icon for the admin bar for it. * * @param int $score The 0-100 rating of the score. Can be either SEO score or content score. * * @return string Score markup. */ protected function get_score( $score ) { $score_class = WPSEO_Utils::translate_score( $score ); $translated_score = WPSEO_Utils::translate_score( $score, false ); /* translators: %s expands to the SEO score. */ $screen_reader_text = sprintf( __( 'SEO score: %s', 'wordpress-seo' ), $translated_score ); $score_adminbar_element = '
' . $screen_reader_text . '
'; return $score_adminbar_element; } /** * Gets the URL to the main admin settings page. * * @return string Admin settings page URL. */ protected function get_settings_page_url() { return self_admin_url( 'admin.php?page=' . WPSEO_Admin::PAGE_IDENTIFIER ); } /** * Gets the notification counter if in a valid context. * * @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 ''; } /* translators: %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' ); } }