is_dashboard_page() ) { return; } add_action( 'admin_enqueue_scripts', array( $this, 'calculate_unprocessed' ), 9 ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ), 10 ); add_action( 'admin_footer', array( $this, 'modal_box' ), 20 ); add_action( 'wpseo_internal_linking', array( $this, 'add_link_index_interface' ) ); } /** * Calculates the number of unprocessed items per post type. * * @return void */ public function calculate_unprocessed() { $this->public_post_types = apply_filters( 'wpseo_link_count_post_types', WPSEO_Post_Type::get_accessible_post_types() ); if ( is_array( $this->public_post_types ) && $this->public_post_types !== array() ) { $this->unprocessed = WPSEO_Link_Query::get_unprocessed_count( $this->public_post_types ); } } /** * Add the indexing interface for links to the dashboard. */ public function add_link_index_interface() { $html = ''; $html .= '
' . sprintf( /* translators: 1: link to yoast.com post about internal linking suggestion. 4: is Yoast.com 3: is anchor closing. */ __( 'The links in all your public texts need to be counted. This will provide insights of which texts need more links to them. If you want to know more about the why and how of internal linking, check out %1$sthe article about internal linking on %2$s%3$s.', 'wordpress-seo' ), '', 'Yoast.com', '' ) . '
'; if ( $this->unprocessed === 0 ) { $html .= '' . $this->message_already_indexed() . '
'; } if ( $this->unprocessed > 0 ) { $html .= ''; $html .= sprintf( '%2$s', 175, esc_attr__( 'Count links in your texts', 'wordpress-seo' ) ); $html .= '
'; } $html .= '%s
', esc_html__( 'All your texts are already counted, there is no need to count them again.', 'wordpress-seo' ) ); } if ( $this->unprocessed > 0 ) { $progress = sprintf( /* translators: 1: expands to a containing the number of items recalculated. 2: expands to a containing the total number of items. */ __( 'Text %1$s of %2$s processed.', 'wordpress-seo' ), '0', sprintf( '%d', $this->unprocessed ) ); $inner_text = ''; $inner_text .= sprintf( '%s
', $progress ); } $blocks[] = sprintf( '%s
%s