PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 2.1.8
MxChat – AI Chatbot & Content Generation for WordPress v2.1.8
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.8, at includes/class-mxchat-addons.php

305 lines 14.4 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' => __('See exactly how your chatbot thinks. Visualize intent matches and similarity scores to optimize accuracy and understand AI decision-making. Essential for fine-tuning your responses.', 'mxchat'),
24 'key_benefits' => array(
25 __('Reveal top 10 knowledge matches', 'mxchat'),
26 __('Optimize response accuracy', 'mxchat'),
27 __('Debug AI decision patterns', 'mxchat')
28 ),
29 'license' => 'free',
30 'accent' => '#fa73e6',
31 'url' => 'https://quickdeploywp.com/plugin/mxchat-intent-tester/',
32 'plugin_file' => 'mxchat-intent-tester/mxchat-intent-tester.php',
33 'config_page' => 'mxchat-intent-tester'
34 ),
35 'mxchat-pinecone' => array(
36 'title' => __('Pinecone DB Manager', 'mxchat'),
37 'description' => __('Supercharge your chatbot with enterprise-grade vector storage. Manage vectorized content directly in WordPress with better speed, scalability, and performance.', 'mxchat'),
38 'key_benefits' => array(
39 __('Lightning-fast response times', 'mxchat'),
40 __('Handle massive knowledge bases', 'mxchat'),
41 __('Simple dashboard management', 'mxchat')
42 ),
43 'license' => 'free',
44 'accent' => '#fa73e6',
45 'url' => 'https://quickdeploywp.com/plugin/mxchat-pinecone/',
46 'plugin_file' => 'mxchat-pinecone/pinecone-manager.php',
47 'config_page' => 'mxchat-pinecone'
48 ),
49 'mxchat-admin-assistant' => array(
50 'title' => __('MxChat Admin Assistant', 'mxchat'),
51 'description' => __('Your AI powerhouse inside WordPress. Chat with multiple AI models, generate images, research the web, and boost productivity—all without leaving your dashboard.', 'mxchat'),
52 'key_benefits' => array(
53 __('ChatGPT-like admin interface', 'mxchat'),
54 __('Generate images & research web', 'mxchat'),
55 __('Searchable chat history', 'mxchat')
56 ),
57 'license' => 'MxChat PRO',
58 'accent' => '#fa73e6',
59 'url' => 'https://quickdeploywp.com/plugin/mxchat-admin-assistant/',
60 'plugin_file' => 'mxchat-admin-chat/mxchat-admin-chat.php',
61 'config_page' => 'mxchat-admin-chat'
62 ),
63 'mxchat-forms' => array(
64 'title' => __('MxChat Forms', 'mxchat'),
65 'description' => __('Convert conversations into data collection. Create smart forms that trigger during chats, collect user information, and turn casual visitors into qualified leads.', 'mxchat'),
66 'key_benefits' => array(
67 __('No-code form builder', 'mxchat'),
68 __('Intent-triggered activation', 'mxchat'),
69 __('Export lead data easily', 'mxchat')
70 ),
71 'license' => 'MxChat PRO',
72 'accent' => '#fa73e6',
73 'url' => 'https://quickdeploywp.com/plugin/mxchat-forms/',
74 'plugin_file' => 'mxchat-forms/mxchat-forms.php',
75 'config_page' => 'mxchat-forms'
76 ),
77 'mxchat-smart-recommender' => array(
78 'title' => __('MxChat Smart Recommender', 'mxchat'),
79 'description' => __('Turn your chatbot into a sales machine. Build personalized recommendation flows that understand user preferences and suggest perfect products or services.', 'mxchat'),
80 'key_benefits' => array(
81 __('Increase conversion rates', 'mxchat'),
82 __('Custom recommendation flows', 'mxchat'),
83 __('No coding required', 'mxchat')
84 ),
85 'license' => 'MxChat PRO',
86 'accent' => '#fa73e6',
87 'url' => 'https://quickdeploywp.com/plugin/mxchat-smart-recommender/',
88 'plugin_file' => 'mxchat-smart-recommender/mxchat-smart-recommender.php',
89 'config_page' => 'mxchat-smart-recommender'
90 ),
91 'mxchat-woo' => array(
92 'title' => __('MxChat WooCommerce', 'mxchat'),
93 'description' => __('Boost sales with AI-powered shopping assistance. Help customers find products, manage carts, and complete purchases—all through natural conversation.', 'mxchat'),
94 'key_benefits' => array(
95 __('Smart product recommendations', 'mxchat'),
96 __('Cart & checkout assistance', 'mxchat'),
97 __('Order history access', 'mxchat')
98 ),
99 'license' => 'MxChat PRO',
100 'accent' => '#fa73e6',
101 'url' => 'https://quickdeploywp.com/plugin/mxchat-woo/',
102 'plugin_file' => 'mxchat-woo/mxchat-woo.php',
103 'config_page' => 'mxchat-woo'
104 ),
105 'mxchat-theme' => array(
106 'title' => __('MxChat Theme Customizer', 'mxchat'),
107 'description' => __('Make your chatbot uniquely yours. Customize colors, styles, and appearance with live previews—zero coding required. Perfect for matching your brand identity.', 'mxchat'),
108 'key_benefits' => array(
109 __('Live preview customizer', 'mxchat'),
110 __('Point-and-click simplicity', 'mxchat'),
111 __('Brand-perfect styling', 'mxchat')
112 ),
113 'license' => 'MxChat PRO',
114 'accent' => '#fa73e6',
115 'url' => 'https://quickdeploywp.com/plugin/mxchat-theme/',
116 'plugin_file' => 'mxchat-theme/mxchat-theme.php',
117 'config_page' => 'mxchat-theme-settings'
118 ),
119 'mxchat-perplexity' => array(
120 'title' => __('MxChat Perplexity', 'mxchat'),
121 'description' => __('Give your chatbot real-time knowledge. Add powerful web search capabilities so your bot can answer questions about current events and time-sensitive information.', 'mxchat'),
122 'key_benefits' => array(
123 __('Real-time web search', 'mxchat'),
124 __('Intent-triggered research', 'mxchat'),
125 __('Up-to-date information', 'mxchat')
126 ),
127 'license' => 'MxChat PRO',
128 'accent' => '#fa73e6',
129 'url' => 'https://quickdeploywp.com/plugin/mxchat-perplexity/',
130 'plugin_file' => 'mxchat-perplexity/mxchat-perplexity.php',
131 'config_page' => 'mxchat-perplexity'
132 ),
133 'mxchat-moderation' => array(
134 'title' => __('MxChat Moderation', 'mxchat'),
135 'description' => __('Keep your chat clean and professional. Block unwanted users, filter inappropriate content, and ensure your chatbot represents your brand properly.', 'mxchat'),
136 'key_benefits' => array(
137 __('IP & email-based blocking', 'mxchat'),
138 __('Content filtering', 'mxchat'),
139 __('Spam protection', 'mxchat')
140 ),
141 'license' => 'MxChat PRO',
142 'accent' => '#fa73e6',
143 'url' => 'https://quickdeploywp.com/plugin/mxchat-moderation/',
144 'plugin_file' => 'mxchat-moderation/mx-chat-moderation.php',
145 'config_page' => 'mx-chat-moderation'
146 ),
147 );
148 }
149
150 /**
151 * Register the stylesheets for the admin area.
152 */
153 public function enqueue_styles() {
154 $plugin_version = '2.1.8';
155
156 wp_enqueue_style(
157 'mxchat-addons',
158 plugin_dir_url(__FILE__) . '../css/admin-add-ons.css',
159 array(),
160 $plugin_version,
161 'all'
162 );
163 }
164
165 /**
166 * Check if an addon is installed and active
167 *
168 * @param string $plugin_file The plugin's main file path
169 * @return array Status information
170 */
171 private function get_addon_status($plugin_file) {
172 if (!function_exists('get_plugins')) {
173 require_once ABSPATH . 'wp-admin/includes/plugin.php';
174 }
175
176 $all_plugins = get_plugins();
177 $active_plugins = get_option('active_plugins', array());
178
179 // Find the addon by iterating through configs
180 $config_page = '';
181 foreach ($this->addons_config as $slug => $addon) {
182 if ($addon['plugin_file'] === $plugin_file) {
183 $config_page = $addon['config_page'];
184 break;
185 }
186 }
187
188 if (isset($all_plugins[$plugin_file])) {
189 if (in_array($plugin_file, $active_plugins)) {
190 return array(
191 'status' => 'active',
192 'action_url' => admin_url('admin.php?page=' . $config_page),
193 'action_text' => __('Configure', 'mxchat')
194 );
195 } else {
196 return array(
197 'status' => 'inactive',
198 'action_url' => wp_nonce_url(
199 admin_url('plugins.php?action=activate&plugin=' . $plugin_file),
200 'activate-plugin_' . $plugin_file
201 ),
202 'action_text' => __('Activate', 'mxchat')
203 );
204 }
205 }
206
207 return array(
208 'status' => 'not-installed',
209 'action_url' => '',
210 'action_text' => __('Get Extension', 'mxchat')
211 );
212 }
213
214 /**
215 * Render the Add Ons page content.
216 */
217 public function render_page() {
218 $this->enqueue_styles();
219 $sorted_addons = array();
220
221 // Put free add-ons first, then pro add-ons
222 foreach ($this->addons_config as $slug => $addon) {
223 if ($addon['license'] === 'free') {
224 $sorted_addons[$slug] = $addon;
225 }
226 }
227
228 foreach ($this->addons_config as $slug => $addon) {
229 if ($addon['license'] !== 'free') {
230 $sorted_addons[$slug] = $addon;
231 }
232 }
233
234 ?>
235 <div class="wrap mxchat-addons-wrapper">
236 <div class="mxchat-addons-hero">
237 <h1 class="mxchat-main-title">
238 <span class="mxchat-gradient-text">Power Up</span> Your Chatbot
239 </h1>
240 <p class="mxchat-hero-subtitle">
241 <?php esc_html_e('Supercharge your WordPress AI chatbot with these powerful extensions. Start with our free add-ons or upgrade for premium features.', 'mxchat'); ?>
242 </p>
243 </div>
244
245 <div class="mxchat-addons-section">
246 <div class="mxchat-addons-grid">
247 <?php foreach ($sorted_addons as $slug => $addon): ?>
248 <?php $this->render_addon_card($slug, $addon); ?>
249 <?php endforeach; ?>
250 </div>
251 </div>
252
253 <div class="mxchat-cta-section">
254 <h2><?php esc_html_e('Ready to take your chatbot to the next level?', 'mxchat'); ?></h2>
255 <p><?php esc_html_e('Get MxChat PRO today and access all premium extensions at one low price.', 'mxchat'); ?></p>
256 <a href="https://mxchat.ai/" class="mxchat-cta-button" target="_blank"><?php esc_html_e('Learn More', 'mxchat'); ?></a>
257 </div>
258 </div>
259 <?php
260 }
261
262 /**
263 * Render individual add-on card
264 *
265 * @param string $slug The addon slug
266 * @param array $addon The addon configuration array
267 */
268 private function render_addon_card($slug, $addon) {
269 $status_info = $this->get_addon_status($addon['plugin_file']);
270 $button_url = $status_info['status'] === 'not-installed' ? $addon['url'] : $status_info['action_url'];
271 $button_target = $status_info['status'] === 'not-installed' ? '_blank' : '_self';
272 ?>
273 <div class="mxchat-addon-card" style="--card-accent: <?php echo esc_attr($addon['accent']); ?>">
274 <div class="mxchat-addon-badge"><?php echo esc_html(ucfirst($addon['license'])); ?></div>
275 <div class="mxchat-addon-content">
276 <h3 class="mxchat-addon-title"><?php echo esc_html($addon['title']); ?></h3>
277 <p class="mxchat-addon-description"><?php echo esc_html($addon['description']); ?></p>
278
279 <?php if (!empty($addon['key_benefits'])): ?>
280 <div class="mxchat-benefits-list">
281 <?php foreach ($addon['key_benefits'] as $benefit): ?>
282 <div class="mxchat-benefit-item">
283 <span class="mxchat-benefit-icon"></span>
284 <?php echo esc_html($benefit); ?>
285 </div>
286 <?php endforeach; ?>
287 </div>
288 <?php endif; ?>
289
290 <div class="mxchat-addon-footer">
291 <div class="mxchat-status-indicator <?php echo esc_attr($status_info['status']); ?>">
292 <?php echo esc_html(ucfirst(str_replace('-', ' ', $status_info['status']))); ?>
293 </div>
294 <a href="<?php echo esc_url($button_url); ?>"
295 class="mxchat-action-button"
296 target="<?php echo esc_attr($button_target); ?>"
297 data-action="<?php echo esc_attr($status_info['status']); ?>">
298 <?php echo esc_html($status_info['action_text']); ?>
299 </a>
300 </div>
301 </div>
302 </div>
303 <?php
304 }
305 }