check_api_key_notice(); $this->check_budget_notice(); $this->check_subreddit_notice(); } /** * Show a notice if the OpenRouter API key is not configured. * * @return void */ private function check_api_key_notice(): void { $api_key = get_option( 'prautoblogger_openrouter_api_key', '' ); if ( '' !== $api_key ) { return; } printf( '

%s %s

', esc_html__( 'PRAutoBlogger: OpenRouter API key is not configured. Content generation is disabled.', 'prautoblogger' ), esc_url( admin_url( 'admin.php?page=prautoblogger-settings' ) ), esc_html__( 'Configure now', 'prautoblogger' ) ); } /** * Show a warning if monthly budget is approaching or exceeded. * * @return void */ private function check_budget_notice(): void { $cost_reporter = new PRAutoBlogger_Cost_Reporter(); $utilization = $cost_reporter->get_budget_utilization(); if ( $utilization >= 100.0 ) { printf( '

%s

', esc_html__( 'PRAutoBlogger: Monthly API budget EXCEEDED. Content generation is paused until next month or budget increase.', 'prautoblogger' ) ); } elseif ( $utilization >= 80.0 ) { printf( '

%s

', esc_html( sprintf( /* translators: %s: budget utilization percentage */ __( 'PRAutoBlogger: Monthly API budget is at %.0f%%. Consider increasing the budget or reducing daily article count.', 'prautoblogger' ), $utilization ) ) ); } } /** * Show a notice if no subreddits are configured. * * @return void */ private function check_subreddit_notice(): void { $subreddits = json_decode( get_option( 'prautoblogger_target_subreddits', '[]' ), true ); if ( ! empty( $subreddits ) ) { return; } // Only show on our settings page. $screen = get_current_screen(); if ( ! $screen || 'toplevel_page_prautoblogger-settings' !== $screen->id ) { return; } printf( '

%s

', esc_html__( 'PRAutoBlogger: No subreddits configured. Add target subreddits in Source Configuration to start collecting data.', 'prautoblogger' ) ); } }