addons_config = array( 'mxchat-pinecone' => array( 'title' => __('Pinecone DB Manager', 'mxchat'), 'description' => __('Seamlessly manage your vectorized content in Pinecone\'s vector database directly from your WordPress dashboard. This integration provides an efficient alternative to the default WordPress database storage.', 'mxchat'), 'license' => 'free', 'accent' => '#fa73e6', 'url' => 'https://quickdeploywp.com/plugin/mxchat-pinecone/', 'plugin_file' => 'mxchat-pinecone/pinecone-manager.php', 'config_page' => 'mxchat-pinecone' ), ); } /** * Register the stylesheets for the admin area. */ public function enqueue_styles() { $plugin_version = '2.0.0'; wp_enqueue_style( 'mxchat-addons', plugin_dir_url(__FILE__) . '../css/admin-add-ons.css', array(), $plugin_version, 'all' ); } /** * Check if an addon is installed and active * * @param string $plugin_file The plugin's main file path * @return array Status information */ private function get_addon_status($plugin_file) { if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); // Find the addon by iterating through configs $config_page = ''; foreach ($this->addons_config as $slug => $addon) { if ($addon['plugin_file'] === $plugin_file) { $config_page = $addon['config_page']; break; } } if (isset($all_plugins[$plugin_file])) { if (in_array($plugin_file, $active_plugins)) { return array( 'status' => 'active', 'action_url' => admin_url('admin.php?page=' . $config_page), 'action_text' => __('Configure', 'mxchat') ); } else { return array( 'status' => 'inactive', 'action_url' => wp_nonce_url( admin_url('plugins.php?action=activate&plugin=' . $plugin_file), 'activate-plugin_' . $plugin_file ), 'action_text' => __('Activate', 'mxchat') ); } } return array( 'status' => 'not-installed', 'action_url' => '', 'action_text' => __('Get Extension', 'mxchat') ); } /** * Render the Add Ons page content. */ public function render_page() { $this->enqueue_styles(); ?>