| @@ -452,13 +452,10 @@ | ||
| 452 | 452 | 'sectionCaps' => Capability_Manager::section_map(), |
| 453 | 453 | 'canManageRoles' => Capability_Manager::current_user_can(Capability_Manager::MANAGE_ROLES), |
| 454 | 454 | // Pro detection flag |
| 455 | 455 | 'isPro' => Plan_Config::is_pro(), |
| 456 | - // Data update frequency (Pro: daily, Free: every 3 days) | |
| 457 | - 'dataUpdateFrequency' => Plan_Config::is_pro() ? 'daily' : '3days', | |
| 458 | - // NB: no per-feature capability maps here. Email Reporting reads | |
| 459 | - // its capabilities from GET /thinkrank/v1/email-report/config; | |
| 460 | - // localizing a second copy only invited the two to drift. | |
| 456 | + // NB: no per-feature capability maps here; each screen reads its | |
| 457 | + // own state over REST, so a localized copy cannot drift from it. | |
| 461 | 458 | // MCP (Model Context Protocol) connection details for the MCP page. |
| 462 | 459 | 'mcp' => $this->get_mcp_globals(), |
| 463 | 460 | // Google OAuth: JS only ever gets a nonce-signed admin-post URL. |
| 464 | 461 | // The consent URL, client ID, and scopes are assembled by the proxy, |
| @@ -805,19 +802,14 @@ | ||
| 805 | 802 | wp_die(); |
| 806 | 803 | } |
| 807 | 804 | |
| 808 | 805 | /** |
| 809 | - * Check if API key is configured | |
| 806 | + * Check if the selected AI provider is configured | |
| 810 | 807 | * |
| 811 | - * @return bool True if at least one API key is configured | |
| 808 | + * @return bool True when the chosen provider has what it needs to run | |
| 812 | 809 | */ |
| 813 | 810 | private function has_api_key_configured(): bool { |
| 814 | - $settings = \ThinkRank\Core\Settings::instance(); | |
| 815 | - | |
| 816 | - return !empty($settings->get('openai_api_key')) | |
| 817 | - || !empty($settings->get('claude_api_key')) | |
| 818 | - || !empty($settings->get('gemini_api_key')) | |
| 819 | - || !empty($settings->get('openrouter_api_key')); | |
| 811 | + return \ThinkRank\Core\Settings::instance()->has_ai_provider_configured(); | |
| 820 | 812 | } |
| 821 | 813 | |
| 822 | 814 | /** |
| 823 | 815 | * Get menu icon |
| @@ -880,22 +872,17 @@ | ||
| 880 | 872 | ]; |
| 881 | 873 | } |
| 882 | 874 | |
| 883 | 875 | /** |
| 884 | - * Whether any AI provider API key is configured | |
| 876 | + * Whether the selected AI provider is configured | |
| 885 | 877 | * |
| 886 | - * Mirrors the check used by ThinkRank\AI\Manager. | |
| 878 | + * Same answer as ThinkRank\AI\Manager — both read | |
| 879 | + * Settings::has_ai_provider_configured(). | |
| 887 | 880 | * |
| 888 | 881 | * @return bool |
| 889 | 882 | */ |
| 890 | 883 | private function is_ai_configured(): bool { |
| 891 | - foreach (['openai_api_key', 'claude_api_key', 'gemini_api_key', 'openrouter_api_key'] as $key) { | |
| 892 | - if (!empty($this->settings->get($key, ''))) { | |
| 893 | - return true; | |
| 894 | - } | |
| 895 | - } | |
| 896 | - | |
| 897 | - return false; | |
| 884 | + return $this->settings->has_ai_provider_configured(); | |
| 898 | 885 | } |
| 899 | 886 | |
| 900 | 887 | /** |
| 901 | 888 | * Get internationalization strings |