| @@ -21,8 +21,9 @@ | ||
| 21 | 21 | use ThinkRank\Admin\Elementor_Metabox; |
| 22 | 22 | use ThinkRank\Admin\Oxygen_Metabox; |
| 23 | 23 | use ThinkRank\Admin\Divi_Metabox; |
| 24 | 24 | use ThinkRank\Admin\Bricks_Metabox; |
| 25 | +use ThinkRank\Admin\Beaver_Metabox; | |
| 25 | 26 | use ThinkRank\Admin\Bulk_Action_Manager; |
| 26 | 27 | use ThinkRank\Admin\Post_List_Filters; |
| 27 | 28 | |
| 28 | 29 | // Prevent direct access |
| @@ -88,8 +89,15 @@ | ||
| 88 | 89 | */ |
| 89 | 90 | private Bricks_Metabox $bricks_metabox; |
| 90 | 91 | |
| 91 | 92 | /** |
| 93 | + * Beaver Builder metabox integration | |
| 94 | + * | |
| 95 | + * @var Beaver_Metabox | |
| 96 | + */ | |
| 97 | + private Beaver_Metabox $beaver_metabox; | |
| 98 | + | |
| 99 | + /** | |
| 92 | 100 | * Post list columns instance |
| 93 | 101 | * |
| 94 | 102 | * @var Post_List_Columns |
| 95 | 103 | */ |
| @@ -143,8 +151,9 @@ | ||
| 143 | 151 | $this->elementor_metabox = new Elementor_Metabox($this->metabox_manager); |
| 144 | 152 | $this->oxygen_metabox = new Oxygen_Metabox($this->metabox_manager); |
| 145 | 153 | $this->divi_metabox = new Divi_Metabox($this->metabox_manager); |
| 146 | 154 | $this->bricks_metabox = new Bricks_Metabox($this->metabox_manager); |
| 155 | + $this->beaver_metabox = new Beaver_Metabox($this->metabox_manager); | |
| 147 | 156 | $this->post_list_columns = new Post_List_Columns(); |
| 148 | 157 | $this->focus_keyword_ajax = new Focus_Keyword_Ajax(); |
| 149 | 158 | $this->seo_quick_edit_ajax = new Seo_Quick_Edit_Ajax(); |
| 150 | 159 | $this->bulk_action_manager = new Bulk_Action_Manager(); |
| @@ -184,8 +193,12 @@ | ||
| 184 | 193 | // Initialize Bricks builder integration (hooks gate on Bricks' own |
| 185 | 194 | // builder detector, so they no-op without Bricks) |
| 186 | 195 | $this->bricks_metabox->init(); |
| 187 | 196 | |
| 197 | + // Initialize Beaver Builder integration (hooks gate on Beaver Builder's | |
| 198 | + // own builder detector, so they no-op without Beaver Builder) | |
| 199 | + $this->beaver_metabox->init(); | |
| 200 | + | |
| 188 | 201 | // Initialize post list columns |
| 189 | 202 | $this->post_list_columns->init(); |
| 190 | 203 | |
| 191 | 204 | // Initialize focus keyword AJAX handler |
| @@ -439,13 +452,10 @@ | ||
| 439 | 452 | 'sectionCaps' => Capability_Manager::section_map(), |
| 440 | 453 | 'canManageRoles' => Capability_Manager::current_user_can(Capability_Manager::MANAGE_ROLES), |
| 441 | 454 | // Pro detection flag |
| 442 | 455 | 'isPro' => Plan_Config::is_pro(), |
| 443 | - // Data update frequency (Pro: daily, Free: every 3 days) | |
| 444 | - 'dataUpdateFrequency' => Plan_Config::is_pro() ? 'daily' : '3days', | |
| 445 | - // NB: no per-feature capability maps here. Email Reporting reads | |
| 446 | - // its capabilities from GET /thinkrank/v1/email-report/config; | |
| 447 | - // 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. | |
| 448 | 458 | // MCP (Model Context Protocol) connection details for the MCP page. |
| 449 | 459 | 'mcp' => $this->get_mcp_globals(), |
| 450 | 460 | // Google OAuth: JS only ever gets a nonce-signed admin-post URL. |
| 451 | 461 | // The consent URL, client ID, and scopes are assembled by the proxy, |
| @@ -792,19 +802,14 @@ | ||
| 792 | 802 | wp_die(); |
| 793 | 803 | } |
| 794 | 804 | |
| 795 | 805 | /** |
| 796 | - * Check if API key is configured | |
| 806 | + * Check if the selected AI provider is configured | |
| 797 | 807 | * |
| 798 | - * @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 | |
| 799 | 809 | */ |
| 800 | 810 | private function has_api_key_configured(): bool { |
| 801 | - $settings = \ThinkRank\Core\Settings::instance(); | |
| 802 | - | |
| 803 | - return !empty($settings->get('openai_api_key')) | |
| 804 | - || !empty($settings->get('claude_api_key')) | |
| 805 | - || !empty($settings->get('gemini_api_key')) | |
| 806 | - || !empty($settings->get('openrouter_api_key')); | |
| 811 | + return \ThinkRank\Core\Settings::instance()->has_ai_provider_configured(); | |
| 807 | 812 | } |
| 808 | 813 | |
| 809 | 814 | /** |
| 810 | 815 | * Get menu icon |
| @@ -867,22 +872,17 @@ | ||
| 867 | 872 | ]; |
| 868 | 873 | } |
| 869 | 874 | |
| 870 | 875 | /** |
| 871 | - * Whether any AI provider API key is configured | |
| 876 | + * Whether the selected AI provider is configured | |
| 872 | 877 | * |
| 873 | - * Mirrors the check used by ThinkRank\AI\Manager. | |
| 878 | + * Same answer as ThinkRank\AI\Manager — both read | |
| 879 | + * Settings::has_ai_provider_configured(). | |
| 874 | 880 | * |
| 875 | 881 | * @return bool |
| 876 | 882 | */ |
| 877 | 883 | private function is_ai_configured(): bool { |
| 878 | - foreach (['openai_api_key', 'claude_api_key', 'gemini_api_key', 'openrouter_api_key'] as $key) { | |
| 879 | - if (!empty($this->settings->get($key, ''))) { | |
| 880 | - return true; | |
| 881 | - } | |
| 882 | - } | |
| 883 | - | |
| 884 | - return false; | |
| 884 | + return $this->settings->has_ai_provider_configured(); | |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | /** |
| 888 | 888 | * Get internationalization strings |