PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 1.5.1
MxChat – AI Chatbot & Content Generation for WordPress v1.5.1
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
← All changes | mxchat-basic.php +10 -66 2.0.61.5.1 View file →
@@ -1,15 +1,13 @@
1 1 <?php
2 2 /**
3 3 * Plugin Name: MxChat
4 - * Description: AI chatbot for WordPress with OpenAI, Claude, xAI, DeepSeek, live agent, PDF uploads, WooCommerce, and training on website data.
5 - * Version: 2.0.6
4 + * Description: AI chatbot for WordPress with OpenAI, Claude, xAI, live agent transfer, PDF uploads, WooCommerce, and training on website data.
5 + * Version: 1.5.1
6 6 * Author: MxChat
7 7 * Author URI: https://mxchat.ai
8 8 * License: GPLv2 or later
9 9 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
10 - * Text Domain: mxchat
11 - * Domain Path: /languages
12 10 */
13 11
14 12 if (!defined('ABSPATH')) {
15 13 exit; // Exit if accessed directly.
@@ -14,14 +12,8 @@
14 12 if (!defined('ABSPATH')) {
15 13 exit; // Exit if accessed directly.
16 14 }
17 15
18 -
19 -function mxchat_load_textdomain() {
20 - load_plugin_textdomain('mxchat', false, dirname(plugin_basename(__FILE__)) . '/languages');
21 -}
22 -add_action('plugins_loaded', 'mxchat_load_textdomain');
23 -
24 16 // Include classes
25 17 require_once plugin_dir_path(__FILE__) . 'includes/class-mxchat-integrator.php';
26 18 require_once plugin_dir_path(__FILE__) . 'includes/class-mxchat-admin.php';
27 19 require_once plugin_dir_path(__FILE__) . 'includes/class-mxchat-public.php';
@@ -26,10 +18,10 @@
26 18 require_once plugin_dir_path(__FILE__) . 'includes/class-mxchat-admin.php';
27 19 require_once plugin_dir_path(__FILE__) . 'includes/class-mxchat-public.php';
28 20 require_once plugin_dir_path(__FILE__) . 'includes/class-mxchat-utils.php';
29 21 require_once plugin_dir_path(__FILE__) . 'includes/class-mxchat-user.php';
22 +require_once plugin_dir_path(__FILE__) . 'includes/class-mxchat-woocommerce.php';
30 23 require_once plugin_dir_path(__FILE__) . 'includes/pdf-parser/alt_autoload.php';
31 -require_once plugin_dir_path(__FILE__) . 'includes/class-mxchat-word-handler.php';
32 24
33 25 function mxchat_activate() {
34 26 global $wpdb;
35 27 $charset_collate = $wpdb->get_charset_collate();
@@ -41,9 +33,8 @@
41 33 user_id MEDIUMINT(9) DEFAULT 0,
42 34 session_id VARCHAR(255) NOT NULL,
43 35 role VARCHAR(255) NOT NULL,
44 36 message TEXT NOT NULL,
45 - user_email VARCHAR(255) DEFAULT NULL,
46 37 timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
47 38 PRIMARY KEY (id)
48 39 ) $charset_collate;";
49 40
@@ -77,24 +68,21 @@
77 68 dbDelta($sql_chat_transcripts);
78 69 dbDelta($sql_system_prompt);
79 70 dbDelta($sql_intents_table);
80 71
81 - // Ensure additional columns in `mxchat_chat_transcripts`
82 - mxchat_add_missing_columns($chat_transcripts_table, 'user_identifier', 'VARCHAR(255)');
83 - mxchat_add_missing_columns($chat_transcripts_table, 'user_email', 'VARCHAR(255) DEFAULT NULL');
84 -
85 - // Ensure additional columns in `mxchat_system_prompt_content`
72 + // Ensure additional columns in `mxchat_system_prompt_content` and `mxchat_chat_transcripts`
86 73 mxchat_add_missing_columns($system_prompt_table, 'embedding_vector', 'LONGTEXT');
87 74 mxchat_add_missing_columns($system_prompt_table, 'source_url', 'VARCHAR(255) DEFAULT NULL');
75 + mxchat_add_missing_columns($chat_transcripts_table, 'user_identifier', 'VARCHAR(255)');
76 + mxchat_add_missing_columns($chat_transcripts_table, 'user_email', 'VARCHAR(255)');
88 77
89 78 // Set default thresholds for existing intents
90 79 $wpdb->query("UPDATE {$intents_table} SET similarity_threshold = 0.85 WHERE similarity_threshold IS NULL");
91 80
92 81 // Update plugin version in the database
93 - update_option('mxchat_plugin_version', '2.0.6');
82 + update_option('mxchat_plugin_version', '1.5.1');
94 83 }
95 84
96 -
97 85 function mxchat_add_missing_columns($table, $column_name, $column_type) {
98 86 global $wpdb;
99 87 $column_exists = $wpdb->get_results($wpdb->prepare("SHOW COLUMNS FROM $table LIKE %s", $column_name));
100 88 if (empty($column_exists)) {
@@ -103,50 +91,16 @@
103 91 }
104 92
105 93 function mxchat_check_for_update() {
106 94 $current_version = get_option('mxchat_plugin_version');
107 - $plugin_version = '2.0.6'; // Update with your latest version
95 + $plugin_version = '1.5.1';
108 96
109 97 if ($current_version !== $plugin_version) {
110 - mxchat_activate(); // Run the activation script to apply schema changes
111 - mxchat_migrate_live_agent_status(); // Add migration for live agent status
112 - update_option('mxchat_plugin_version', $plugin_version); // Update the version
98 + mxchat_activate(); // Run the activation script which includes database migrations
99 + update_option('mxchat_plugin_version', $plugin_version); // Update to the latest version
113 100 }
114 101 }
115 102
116 -function mxchat_migrate_live_agent_status() {
117 - $options = get_option('mxchat_options', []);
118 -
119 - // Check if live_agent_status exists
120 - if (isset($options['live_agent_status'])) {
121 - $current_status = $options['live_agent_status'];
122 - $needs_update = false;
123 -
124 - // Convert to new format if needed
125 - if ($current_status === 'online') {
126 - $options['live_agent_status'] = 'on';
127 - $needs_update = true;
128 - } else if ($current_status === 'offline') {
129 - $options['live_agent_status'] = 'off';
130 - $needs_update = true;
131 - } else if (!in_array($current_status, ['on', 'off'])) {
132 - // Default to off for any unexpected values
133 - $options['live_agent_status'] = 'off';
134 - $needs_update = true;
135 - }
136 -
137 - // Only update if needed
138 - if ($needs_update) {
139 - update_option('mxchat_options', $options);
140 - }
141 - } else {
142 - // If status doesn't exist, set default to off
143 - $options['live_agent_status'] = 'off';
144 - update_option('mxchat_options', $options);
145 - }
146 -}
147 -
148 -
149 103 // Run the update check function on every request
150 104 add_action('plugins_loaded', 'mxchat_check_for_update');
151 105
152 106 // Register activation hook
@@ -151,22 +105,12 @@
151 105
152 106 // Register activation hook
153 107 register_activation_hook(__FILE__, 'mxchat_activate');
154 108
155 -
156 -add_filter('cron_schedules', function($schedules) {
157 - $schedules['one_minute'] = array(
158 - 'interval' => 60,
159 - 'display' => 'Every Minute'
160 - );
161 - return $schedules;
162 -});
163 -
164 109 add_action('init', function() {
165 110 add_action('mxchat_process_pdf_pages', array('MxChat_Admin', 'process_pdf_pages_cron'), 10, 5);
166 111 add_action('mxchat_process_sitemap_urls', array('MxChat_Admin', 'process_sitemap_urls_cron'), 10, 5);
167 112 });
168 -
169 113
170 114 // Instantiate classes
171 115 if (is_admin()) {
172 116 $mxchat_admin = new MxChat_Admin();