PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 2.1.6
MxChat – AI Chatbot & Content Generation for WordPress v2.1.6
3.2.21 3.2.20 3.2.19 3.2.18 3.2.17 3.2.16 3.2.15 3.2.14 3.2.12 3.2.13 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 2.0.3 2.0.4 2.0.5 2.0.6 All 152 releases
mxchat-basic / includes / class-mxchat-addons.php

class-mxchat-addons.php in MxChat – AI Chatbot & Content Generation for WordPress 2.1.6, at includes/class-mxchat-addons.php

220 lines 11.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The admin-specific functionality for the Add Ons page.
4 *
5 * @package MxChat
6 * @subpackage MxChat/admin
7 */
8 class MxChat_Addons {
9 /**
10 * Store add-on configuration data
11 *
12 * @var array
13 */
14 private $addons_config;
15
16 /**
17 * Initialize the class and set its properties.
18 */
19 public function __construct() {
20 $this->addons_config = array(
21 'mxchat-intent-tester' => array(
22 'title' => __('MxChat Similarity Tester', 'mxchat'),
23 'description' => __('MxChat Similarity Tester is one of the most important add-ons for understanding how your chatbot works. This essential tool shows similarity scores for intents and displays the top 10 matches from your knowledge database, revealing exactly what content would be fed to your chatbot. Perfect for optimizing response accuracy and gaining insight into your AI\'s decision-making process.', 'mxchat'),
24 'license' => 'free',
25 'accent' => '#fa73e6',
26 'url' => 'https://quickdeploywp.com/plugin/mxchat-intent-tester/',
27 'plugin_file' => 'mxchat-intent-tester/mxchat-intent-tester.php',
28 'config_page' => 'mxchat-intent-tester'
29 ),
30 'mxchat-pinecone' => array(
31 'title' => __('Pinecone DB Manager', 'mxchat'),
32 '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'),
33 'license' => 'free',
34 'accent' => '#fa73e6',
35 'url' => 'https://quickdeploywp.com/plugin/mxchat-pinecone/',
36 'plugin_file' => 'mxchat-pinecone/pinecone-manager.php',
37 'config_page' => 'mxchat-pinecone'
38 ),
39 'mxchat-admin-assistant' => array(
40 'title' => __('MxChat Admin Assistant', 'mxchat'),
41 'description' => __('Transform your WordPress admin panel with an AI powerhouse that\'s always ready to help. This premium add-on brings ChatGPT-like capabilities directly into your dashboard with multiple AI models, chat history, web research via Perplexity, stunning image generation, and more—all without leaving WordPress. Boost your productivity and creativity with the ultimate admin AI assistant.', 'mxchat'),
42 'license' => 'MxChat PRO',
43 'accent' => '#fa73e6',
44 'url' => 'https://quickdeploywp.com/plugin/mxchat-admin-assistant/',
45 'plugin_file' => 'mxchat-admin-chat/mxchat-admin-chat.php',
46 'config_page' => 'mxchat-admin-chat'
47 ),
48 'mxchat-forms' => array(
49 'title' => __('MxChat Forms', 'mxchat'),
50 'description' => __('Create and manage smart forms that automatically trigger during chat conversations. Build custom forms with multiple field types, collect submissions, and export data—all seamlessly integrated with MxChat\'s intent system. No coding required, just intuitive form building for enhanced chat interactions.', 'mxchat'),
51 'license' => 'MxChat PRO',
52 'accent' => '#fa73e6',
53 'url' => 'https://quickdeploywp.com/plugin/mxchat-forms/',
54 'plugin_file' => 'mxchat-forms/mxchat-forms.php',
55 'config_page' => 'mxchat-forms'
56 ),
57
58 'mxchat-woo' => array(
59 'title' => __('MxChat WooCommerce', 'mxchat'),
60 'description' => __('Enhance your WooCommerce store with AI-powered chat interactions. This add-on enables intelligent product recommendations, order history retrieval, cart management, and seamless checkout assistance—fully integrated with MxChat\'s intent system.', 'mxchat'),
61 'license' => 'MxChat PRO',
62 'accent' => '#fa73e6',
63 'url' => 'https://quickdeploywp.com/plugin/mxchat-woo/',
64 'plugin_file' => 'mxchat-woo/mxchat-woo.php',
65 'config_page' => 'mxchat-woo'
66 ),
67 'mxchat-theme' => array(
68 'title' => __('MxChat Theme Customizer', 'mxchat'),
69 'description' => __('MxChat Theme Customizer is a powerful add-on for MxChat Pro that makes it effortless to personalize your chatbot\'s appearance. With an intuitive color picker, you can instantly adjust background colors, and interface elements—all with real-time previews. No coding required, just simple, live customization to match your brand\'s look.', 'mxchat'),
70 'license' => 'MxChat PRO',
71 'accent' => '#fa73e6',
72 'url' => 'https://quickdeploywp.com/plugin/mxchat-theme/',
73 'plugin_file' => 'mxchat-theme/mxchat-theme.php',
74 'config_page' => 'mxchat-theme-settings'
75 ),
76 'mxchat-perplexity' => array(
77 'title' => __('MxChat Perplexity', 'mxchat'),
78 'description' => __('Enhance your chatbot with powerful web search capabilities through Perplexity AI. This add-on adds a search toggle button to your chat interface, allowing users to instantly access up-to-date information from the web. It also integrates seamlessly with the intent recognition system to trigger web searches automatically for specific queries. Perfect for providing current information without leaving the chat!', 'mxchat'),
79 'license' => 'MxChat PRO',
80 'accent' => '#fa73e6',
81 'url' => 'https://quickdeploywp.com/plugin/mxchat-perplexity/',
82 'plugin_file' => 'mxchat-perplexity/mxchat-perplexity.php',
83 'config_page' => 'mxchat-perplexity'
84 ),
85 'mxchat-moderation' => array(
86 'title' => __('MxChat Moderation', 'mxchat'),
87 'description' => __('MxChat Moderation is the ultimate add-on for MxChat, giving you full control over who interacts with your chatbot. Effortlessly block spammers, trolls, or unwanted users using IP and email-based bans—keeping your chat clean, safe, and enjoyable. Say goodbye to disruptive users and hello to a smoother, more secure chatbot experience!', 'mxchat'),
88 'license' => 'MxChat PRO',
89 'accent' => '#fa73e6',
90 'url' => 'https://quickdeploywp.com/plugin/mxchat-moderation/',
91 'plugin_file' => 'mxchat-moderation/mx-chat-moderation.php',
92 'config_page' => 'mx-chat-moderation'
93 ),
94
95 );
96 }
97
98 /**
99 * Register the stylesheets for the admin area.
100 */
101 public function enqueue_styles() {
102 $plugin_version = '2.1.6';
103
104 wp_enqueue_style(
105 'mxchat-addons',
106 plugin_dir_url(__FILE__) . '../css/admin-add-ons.css',
107 array(),
108 $plugin_version,
109 'all'
110 );
111 }
112
113 /**
114 * Check if an addon is installed and active
115 *
116 * @param string $plugin_file The plugin's main file path
117 * @return array Status information
118 */
119 private function get_addon_status($plugin_file) {
120 if (!function_exists('get_plugins')) {
121 require_once ABSPATH . 'wp-admin/includes/plugin.php';
122 }
123
124 $all_plugins = get_plugins();
125 $active_plugins = get_option('active_plugins', array());
126
127 // Find the addon by iterating through configs
128 $config_page = '';
129 foreach ($this->addons_config as $slug => $addon) {
130 if ($addon['plugin_file'] === $plugin_file) {
131 $config_page = $addon['config_page'];
132 break;
133 }
134 }
135
136 if (isset($all_plugins[$plugin_file])) {
137 if (in_array($plugin_file, $active_plugins)) {
138 return array(
139 'status' => 'active',
140 'action_url' => admin_url('admin.php?page=' . $config_page),
141 'action_text' => __('Configure', 'mxchat')
142 );
143 } else {
144 return array(
145 'status' => 'inactive',
146 'action_url' => wp_nonce_url(
147 admin_url('plugins.php?action=activate&plugin=' . $plugin_file),
148 'activate-plugin_' . $plugin_file
149 ),
150 'action_text' => __('Activate', 'mxchat')
151 );
152 }
153 }
154
155 return array(
156 'status' => 'not-installed',
157 'action_url' => '',
158 'action_text' => __('Get Extension', 'mxchat')
159 );
160 }
161
162 /**
163 * Render the Add Ons page content.
164 */
165 public function render_page() {
166 $this->enqueue_styles();
167 ?>
168 <div class="wrap mxchat-addons-wrapper">
169 <div class="mxchat-addons-hero">
170 <h1 class="mxchat-main-title">
171 <span class="mxchat-gradient-text">Power Up</span> Your Chatbot
172 </h1>
173 <p class="mxchat-hero-subtitle">
174 <?php esc_html_e('Enhance your chatbot with premium & free extensions available through QuickDeployWP, an official distribution platform made by MxChat.', 'mxchat'); ?>
175 </p>
176 </div>
177 <div class="mxchat-addons-grid">
178 <?php
179 foreach ($this->addons_config as $slug => $addon) {
180 $this->render_addon_card($slug, $addon);
181 }
182 ?>
183 </div>
184 </div>
185 <?php
186 }
187
188 /**
189 * Render individual add-on card
190 *
191 * @param string $slug The addon slug
192 * @param array $addon The addon configuration array
193 */
194 private function render_addon_card($slug, $addon) {
195 $status_info = $this->get_addon_status($addon['plugin_file']);
196 $button_url = $status_info['status'] === 'not-installed' ? $addon['url'] : $status_info['action_url'];
197 $button_target = $status_info['status'] === 'not-installed' ? '_blank' : '_self';
198 ?>
199 <div class="mxchat-addon-card" style="--card-accent: <?php echo esc_attr($addon['accent']); ?>">
200 <div class="mxchat-addon-badge"><?php echo esc_html(ucfirst($addon['license'])); ?></div>
201 <div class="mxchat-addon-content">
202 <h3 class="mxchat-addon-title"><?php echo esc_html($addon['title']); ?></h3>
203 <p class="mxchat-addon-description"><?php echo esc_html($addon['description']); ?></p>
204 <div class="mxchat-addon-footer">
205 <div class="mxchat-status-indicator <?php echo esc_attr($status_info['status']); ?>">
206 <?php echo esc_html(ucfirst(str_replace('-', ' ', $status_info['status']))); ?>
207 </div>
208 <a href="<?php echo esc_url($button_url); ?>"
209 class="mxchat-action-button"
210 target="<?php echo esc_attr($button_target); ?>"
211 data-action="<?php echo esc_attr($status_info['status']); ?>">
212 <?php echo esc_html($status_info['action_text']); ?>
213 </a>
214 </div>
215 </div>
216 </div>
217 <?php
218 }
219 }
220