prepare_items(); $stats = $this->get_network_stats(); ?>

stat_box( $stats['total_indexed'], __( 'Total Indexed', 'robotstxt-mediaaudit' ), '' ); $this->stat_box( $stats['total_matches'], __( 'External Matches', 'robotstxt-mediaaudit' ), '' ); $this->stat_box( $stats['total_alert'], __( 'Active Alerts', 'robotstxt-mediaaudit' ), '' ); $this->stat_box( $stats['total_sites'], __( 'Sites', 'robotstxt-mediaaudit' ), '' ); ?>
display(); ?>
'; echo '' . esc_html( number_format_i18n( $value ) ) . ''; echo '' . esc_html( $label ) . ''; if ( '' !== $sub ) { echo '' . esc_html( $sub ) . ''; } echo ''; } /** * Returns aggregate stats from the network mirror table. * * @return array{total_indexed: int, total_matches: int, total_alert: int, total_sites: int} */ private function get_network_stats(): array { global $wpdb; $table = NetworkDatabase::table_name(); // phpcs:disable WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.InterpolatedNotPrepared $total_indexed = (int) $wpdb->get_var( "SELECT COUNT(*) FROM `{$table}`" ); $total_matches = (int) $wpdb->get_var( "SELECT COUNT(*) FROM `{$table}` WHERE external_status = 'matches'" ); $total_alert = (int) $wpdb->get_var( "SELECT COUNT(*) FROM `{$table}` WHERE has_alert = 1 AND is_dismissed = 0" ); $total_sites = (int) $wpdb->get_var( "SELECT COUNT(DISTINCT site_id) FROM `{$table}`" ); // phpcs:enable WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.InterpolatedNotPrepared return array( 'total_indexed' => $total_indexed, 'total_matches' => $total_matches, 'total_alert' => $total_alert, 'total_sites' => $total_sites, ); } }