PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 3.1.3
MxChat – AI Chatbot & Content Generation for WordPress v3.1.3
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 +13 -81 3.2.53.1.3 View file →
@@ -2,9 +2,9 @@
2 2 /**
3 3 * Plugin Name: MxChat
4 4 * Plugin URI: https://mxchat.ai/
5 5 * Description: AI chatbot for WordPress with OpenAI, Claude, xAI, DeepSeek, live agent, PDF uploads, WooCommerce, and training on website data.
6 - * Version: 3.2.5
6 + * Version: 3.1.3
7 7 * Author: MxChat
8 8 * Author URI: https://mxchat.ai
9 9 * License: GPLv2 or later
10 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -15,13 +15,16 @@
15 15 if (!defined('ABSPATH')) {
16 16 exit; // Exit if accessed directly.
17 17 }
18 18
19 -
19 +// Set to true during development to append a timestamp to the version for cache busting.
20 +// Set to false before releasing to production.
20 21 if (!defined('MXCHAT_DEV_MODE')) {
21 22 define('MXCHAT_DEV_MODE', false);
22 23 }
23 24
25 +// Define plugin version constant for asset versioning
26 +// Reads version from plugin header automatically
24 27 if (!defined('MXCHAT_VERSION')) {
25 28 $plugin_data = get_file_data(__FILE__, array('Version' => 'Version'), 'plugin');
26 29 $version = $plugin_data['Version'];
27 30 if (MXCHAT_DEV_MODE) {
@@ -262,9 +265,8 @@
262 265 'includes/class-mxchat-meta-box.php',
263 266 'includes/class-mxchat-chunker.php',
264 267 'includes/class-mxchat-word-handler.php',
265 268 'includes/class-mxchat-content-generator.php',
266 - 'includes/class-rest-api.php',
267 269 'admin/class-ajax-handler.php',
268 270 'admin/class-pinecone-manager.php',
269 271 'admin/class-knowledge-manager.php'
270 272 );
@@ -276,16 +278,8 @@
276 278 } else {
277 279 //error_log('MxChat: Missing class file - ' . $file);
278 280 }
279 281 }
280 -
281 - // Admin pages that aren't classes (procedural include).
282 - if (is_admin()) {
283 - $admin_api_page = plugin_dir_path(__FILE__) . 'includes/admin-api-page.php';
284 - if (file_exists($admin_api_page)) {
285 - require_once $admin_api_page;
286 - }
287 - }
288 282 }
289 283
290 284 /**
291 285 * Lazy-load the PDF parser library only when needed.
@@ -617,33 +611,8 @@
617 611 update_option('mxchat_content_type_migration_version', '2.5.6');
618 612 }
619 613
620 614 /**
621 - * 3.2.4: Backfill the active embedding model option for installs that already
622 - * have KB content but no stamped model. The mismatch warning compares this
623 - * against the user's currently selected model — no per-row column needed.
624 - */
625 -function mxchat_backfill_active_embedding_model() {
626 - global $wpdb;
627 -
628 - if (get_option('mxchat_active_embedding_model', '') !== '') {
629 - return;
630 - }
631 -
632 - $kb_table = $wpdb->prefix . 'mxchat_system_prompt_content';
633 - if ($wpdb->get_var("SHOW TABLES LIKE '{$kb_table}'") !== $kb_table) {
634 - return;
635 - }
636 -
637 - $kb_count = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$kb_table}");
638 - if ($kb_count > 0) {
639 - $options = get_option('mxchat_options', array());
640 - $current_model = $options['embedding_model'] ?? 'text-embedding-ada-002';
641 - update_option('mxchat_active_embedding_model', $current_model, false);
642 - }
643 -}
644 -
645 -/**
646 615 * 2.5.2: Create queue processing tables for reliable background processing
647 616 */
648 617 function mxchat_create_queue_tables() {
649 618 global $wpdb;
@@ -775,9 +744,9 @@
775 744 if (in_array($current_model, $deprecated_claude_models, true)) {
776 745 $options['model'] = 'claude-opus-4-6';
777 746 $migrated = true;
778 747 $migration_message = sprintf(
779 - 'Your chatbot model has been automatically updated from %s to Claude Opus 4.6 due to Anthropic deprecating older Claude models.',
748 + __('Your chatbot model has been automatically updated from %s to Claude Opus 4.6 due to Anthropic deprecating older Claude models.', 'mxchat'),
780 749 $current_model
781 750 );
782 751 }
783 752
@@ -784,9 +753,9 @@
784 753 // Migrate deprecated Claude Haiku 3.5 to Claude Haiku 4.5
785 754 if ($current_model === 'claude-3-5-haiku-20241022') {
786 755 $options['model'] = 'claude-haiku-4-5-20251001';
787 756 $migrated = true;
788 - $migration_message = 'Your chatbot model has been automatically updated from Claude Haiku 3.5 to Claude Haiku 4.5 due to Anthropic deprecating the older model.';
757 + $migration_message = __('Your chatbot model has been automatically updated from Claude Haiku 3.5 to Claude Haiku 4.5 due to Anthropic deprecating the older model.', 'mxchat');
789 758 }
790 759
791 760 // Migrate deprecated GPT-4 series and GPT-3.5 Turbo to GPT-5.1 Chat Latest
792 761 if (in_array($current_model, array('gpt-4o', 'gpt-4.1-2025-04-14', 'gpt-4-turbo', 'gpt-4', 'gpt-3.5-turbo'), true)) {
@@ -792,9 +761,9 @@
792 761 if (in_array($current_model, array('gpt-4o', 'gpt-4.1-2025-04-14', 'gpt-4-turbo', 'gpt-4', 'gpt-3.5-turbo'), true)) {
793 762 $options['model'] = 'gpt-5.1-chat-latest';
794 763 $migrated = true;
795 764 $migration_message = sprintf(
796 - 'Your chatbot model has been automatically updated from %s to GPT-5.1 Chat Latest due to OpenAI deprecating older models.',
765 + __('Your chatbot model has been automatically updated from %s to GPT-5.1 Chat Latest due to OpenAI deprecating older models.', 'mxchat'),
797 766 $current_model
798 767 );
799 768 }
800 769
@@ -802,9 +771,9 @@
802 771 if (in_array($current_model, array('gpt-4o-mini', 'gpt-4.1-mini'), true)) {
803 772 $options['model'] = 'gpt-5-mini';
804 773 $migrated = true;
805 774 $migration_message = sprintf(
806 - 'Your chatbot model has been automatically updated from %s to GPT-5 Mini due to OpenAI deprecating GPT-4 series models.',
775 + __('Your chatbot model has been automatically updated from %s to GPT-5 Mini due to OpenAI deprecating GPT-4 series models.', 'mxchat'),
807 776 $current_model
808 777 );
809 778 }
810 779
@@ -871,26 +840,13 @@
871 840 enabled_bots LONGTEXT DEFAULT NULL,
872 841 PRIMARY KEY (id)
873 842 ) $charset_collate;";
874 843
875 - // Individual Intent Phrases Table - each phrase gets its own embedding vector
876 - $intent_phrases_table = $wpdb->prefix . 'mxchat_intent_phrases';
877 - $sql_intent_phrases_table = "CREATE TABLE $intent_phrases_table (
878 - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
879 - intent_id BIGINT(20) UNSIGNED NOT NULL,
880 - phrase TEXT NOT NULL,
881 - embedding_vector LONGTEXT NOT NULL,
882 - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
883 - PRIMARY KEY (id),
884 - KEY intent_id (intent_id)
885 - ) $charset_collate;";
886 -
887 844 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
888 845
889 846 // Create other tables
890 847 dbDelta($sql_system_prompt);
891 848 dbDelta($sql_intents_table);
892 - dbDelta($sql_intent_phrases_table);
893 849
894 850 // Create URL click tracking table
895 851 mxchat_create_url_clicks_table();
896 852
@@ -946,11 +902,8 @@
946 902
947 903 // Run migration for existing installations
948 904 mxchat_migrate_pinecone_roles_add_bot_id();
949 905
950 - // 3.2.4: Backfill active embedding model option (replaces 3.2.3 column-based tracking)
951 - mxchat_backfill_active_embedding_model();
952 -
953 906 // Setup cron jobs
954 907 mxchat_setup_cron_jobs();
955 908
956 909 // Update version
@@ -985,14 +938,13 @@
985 938 // Clear fallback flags if cron scheduling succeeded
986 939 delete_option('mxchat_use_fallback_rate_limits');
987 940 }
988 941
989 - // Schedule transcript cleanup if configured (bucket dropdown OR custom retention-days > 0)
942 + // Schedule transcript cleanup if configured
990 943 $transcript_options = get_option('mxchat_transcripts_options', array());
991 944 $cleanup_interval = isset($transcript_options['mxchat_auto_delete_transcripts']) ? $transcript_options['mxchat_auto_delete_transcripts'] : 'never';
992 - $custom_retention = isset($transcript_options['mxchat_retention_days']) ? (int) $transcript_options['mxchat_retention_days'] : 0;
993 -
994 - if ($cleanup_interval !== 'never' || $custom_retention > 0) {
945 +
946 + if ($cleanup_interval !== 'never') {
995 947 // Check if not already scheduled
996 948 if (!wp_next_scheduled('mxchat_cleanup_old_transcripts')) {
997 949 // Schedule to run daily at 3 AM
998 950 $next_run = strtotime('tomorrow 3:00 AM');
@@ -1120,20 +1072,8 @@
1120 1072 if (version_compare($current_version, '3.1.2', '<')) {
1121 1073 mxchat_migrate_transcripts_charset();
1122 1074 }
1123 1075
1124 - // 3.1.7: Clean up stale shared session email/name entries
1125 - if (version_compare($current_version, '3.1.7', '<')) {
1126 - delete_option('mxchat_email_null');
1127 - delete_option('mxchat_name_null');
1128 - }
1129 -
1130 - // 3.2.4: Backfill active embedding model option for the warning UI
1131 - // (replaces the per-row column tracking from 3.2.3, which was reverted)
1132 - if (version_compare($current_version, '3.2.4', '<')) {
1133 - mxchat_backfill_active_embedding_model();
1134 - }
1135 -
1136 1076 // Run full activation to ensure everything is up to date
1137 1077 mxchat_activate();
1138 1078
1139 1079 // Run migration functions
@@ -1304,9 +1244,9 @@
1304 1244 // Check if we're upgrading TO 3.0.1 and haven't handled this yet
1305 1245 if (version_compare($current_version, $target_version, '<') && !$update_handled) {
1306 1246 // Check if Pro is activated - only show to Pro users
1307 1247 $license_status = get_option('mxchat_license_status', 'inactive');
1308 - $is_pro = ($license_status === 'active');
1248 + $is_pro = ($license_status === 'active' || $license_status === esc_html__('active', 'mxchat'));
1309 1249
1310 1250 if ($is_pro) {
1311 1251 // Set flag to show the theme migration notification banner
1312 1252 update_option('mxchat_show_theme_migration_notice', true);
@@ -1356,16 +1296,8 @@
1356 1296 // Initialize content generator globally — it registers wp_head hook
1357 1297 // for frontend CSS injection, plus wp_ajax_ hooks for admin.
1358 1298 if (class_exists('MxChat_Content_Generator')) {
1359 1299 new MxChat_Content_Generator();
1360 - }
1361 -
1362 - // Initialize REST API globally — endpoints must be registered on
1363 - // every request (admin and frontend) so they're reachable via /wp-json/.
1364 - // Endpoints are auth-gated and locked until the site owner generates
1365 - // a token in MxChat → API Access.
1366 - if (class_exists('MxChat_Rest_Api')) {
1367 - new MxChat_Rest_Api();
1368 1300 }
1369 1301
1370 1302 // Initialize public classes
1371 1303 if (class_exists('MxChat_Public')) {