record = $record; } /** * Registers hooks. * * @return void */ public function register(): void { add_action( 'wp_dashboard_setup', array( $this, 'add_widget' ) ); } /** * Adds the widget. * * @return void */ public function add_widget(): void { if ( ! current_user_can( self::CAPABILITY ) ) { return; } wp_add_dashboard_widget( self::ID, __( 'AI Blackout', 'ai-blackout' ), array( $this, 'render' ) ); } /** * Renders the widget. * * @return void */ public function render(): void { $status = $this->record->get_live_status(); echo '
'; printf( '

%2$s

', esc_attr( $status ), esc_html( Result::label_for( $status ) ) ); echo ''; printf( '

%s

', esc_html__( 'This blocks crawlers that identify themselves honestly. It cannot stop one that disguises itself as an ordinary browser.', 'ai-blackout' ) ); printf( '

%s

', esc_url( $this->get_status_url() ), esc_html__( 'See full protection status', 'ai-blackout' ) ); echo '
'; } /** * Returns the URL of the Status screen. * * @return string Admin URL. */ private function get_status_url(): string { return admin_url( 'admin.php?page=' . MainScreen::SLUG ); } }