| @@ -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.11 | |
| 6 | + * Version: 3.2.6 | |
| 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 |
| @@ -46,84 +46,8 @@ | ||
| 46 | 46 | } |
| 47 | 47 | add_action('init', 'mxchat_load_textdomain'); |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * One-time migration: gemini-3-pro-preview was shut down by Google on March 9, 2026. | |
| 51 | - * Existing installs with the dead ID get auto-remapped to gemini-3.1-pro-preview | |
| 52 | - * (Google's official migration target) the first time admin_init fires after update. | |
| 53 | - */ | |
| 54 | -add_action('admin_init', function () { | |
| 55 | - if (get_option('mxchat_gemini_3_remap_done')) { | |
| 56 | - return; | |
| 57 | - } | |
| 58 | - $opts = get_option('mxchat_options'); | |
| 59 | - if (is_array($opts) && isset($opts['model']) && $opts['model'] === 'gemini-3-pro-preview') { | |
| 60 | - $opts['model'] = 'gemini-3.1-pro-preview'; | |
| 61 | - update_option('mxchat_options', $opts); | |
| 62 | - } | |
| 63 | - if (is_array($opts) && isset($opts['content_model']) && $opts['content_model'] === 'gemini-3-pro-preview') { | |
| 64 | - $opts['content_model'] = 'gemini-3.1-pro-preview'; | |
| 65 | - update_option('mxchat_options', $opts); | |
| 66 | - } | |
| 67 | - update_option('mxchat_gemini_3_remap_done', 1); | |
| 68 | -}); | |
| 69 | - | |
| 70 | -/** | |
| 71 | - * One-time migration: the Grok 2 family was retired by xAI (grok-2, grok-2-1212, | |
| 72 | - * grok-2-latest, grok-2-vision-1212 all return 400 "Model not found"). Existing | |
| 73 | - * installs with the dead ID get auto-remapped to grok-4-1-fast-non-reasoning | |
| 74 | - * (modern, fast, broadly available) the first time admin_init fires after update. | |
| 75 | - */ | |
| 76 | -add_action('admin_init', function () { | |
| 77 | - if (get_option('mxchat_grok_2_remap_done')) { | |
| 78 | - return; | |
| 79 | - } | |
| 80 | - $opts = get_option('mxchat_options'); | |
| 81 | - if (is_array($opts) && isset($opts['model']) && $opts['model'] === 'grok-2') { | |
| 82 | - $opts['model'] = 'grok-4-1-fast-non-reasoning'; | |
| 83 | - update_option('mxchat_options', $opts); | |
| 84 | - } | |
| 85 | - if (is_array($opts) && isset($opts['content_model']) && $opts['content_model'] === 'grok-2') { | |
| 86 | - $opts['content_model'] = 'grok-4-1-fast-non-reasoning'; | |
| 87 | - update_option('mxchat_options', $opts); | |
| 88 | - } | |
| 89 | - update_option('mxchat_grok_2_remap_done', 1); | |
| 90 | -}); | |
| 91 | - | |
| 92 | -/** | |
| 93 | - * One-time migration: Anthropic retired the Claude 4 (2025-05-14) snapshots on | |
| 94 | - * June 15, 2026 — claude-opus-4-20250514 and claude-sonnet-4-20250514 now return | |
| 95 | - * an API error. Existing installs with a dead ID get auto-remapped to the current | |
| 96 | - * equivalents Anthropic recommends (Opus 4.8 / Sonnet 4.6) the first time admin_init | |
| 97 | - * fires after update. Mirrors the gemini-3-pro-preview / grok-2 rescues above. | |
| 98 | - */ | |
| 99 | -add_action('admin_init', function () { | |
| 100 | - if (get_option('mxchat_claude_4_retire_remap_done')) { | |
| 101 | - return; | |
| 102 | - } | |
| 103 | - $map = array( | |
| 104 | - 'claude-opus-4-20250514' => 'claude-opus-4-8', | |
| 105 | - 'claude-sonnet-4-20250514' => 'claude-sonnet-4-6', | |
| 106 | - ); | |
| 107 | - $opts = get_option('mxchat_options'); | |
| 108 | - if (is_array($opts)) { | |
| 109 | - $changed = false; | |
| 110 | - if (isset($opts['model']) && isset($map[$opts['model']])) { | |
| 111 | - $opts['model'] = $map[$opts['model']]; | |
| 112 | - $changed = true; | |
| 113 | - } | |
| 114 | - if (isset($opts['content_model']) && isset($map[$opts['content_model']])) { | |
| 115 | - $opts['content_model'] = $map[$opts['content_model']]; | |
| 116 | - $changed = true; | |
| 117 | - } | |
| 118 | - if ($changed) { | |
| 119 | - update_option('mxchat_options', $opts); | |
| 120 | - } | |
| 121 | - } | |
| 122 | - update_option('mxchat_claude_4_retire_remap_done', 1); | |
| 123 | -}); | |
| 124 | - | |
| 125 | -/** | |
| 126 | 50 | * Exclude MxChat assets from caching plugin optimizations |
| 127 | 51 | * |
| 128 | 52 | * This prevents issues with WP Rocket, LiteSpeed Cache, Autoptimize, WP Super Cache, |
| 129 | 53 | * W3 Total Cache, SG Optimizer, and similar plugins that may break the chatbot by |
| @@ -382,10 +306,8 @@ | ||
| 382 | 306 | |
| 383 | 307 | // Include classes with error handling |
| 384 | 308 | function mxchat_include_classes() { |
| 385 | 309 | $class_files = array( |
| 386 | - 'includes/class-mxchat-model-catalog.php', | |
| 387 | - 'includes/class-mxchat-tool-registry.php', | |
| 388 | 310 | 'includes/class-mxchat-integrator.php', |
| 389 | 311 | 'includes/class-mxchat-admin.php', |
| 390 | 312 | 'includes/class-mxchat-public.php', |
| 391 | 313 | 'includes/class-mxchat-utils.php', |
| @@ -393,9 +315,8 @@ | ||
| 393 | 315 | 'includes/class-mxchat-meta-box.php', |
| 394 | 316 | 'includes/class-mxchat-chunker.php', |
| 395 | 317 | 'includes/class-mxchat-word-handler.php', |
| 396 | 318 | 'includes/class-mxchat-content-generator.php', |
| 397 | - 'includes/class-mxchat-cache-purge.php', | |
| 398 | 319 | 'includes/class-rest-api.php', |
| 399 | 320 | 'admin/class-ajax-handler.php', |
| 400 | 321 | 'admin/class-pinecone-manager.php', |
| 401 | 322 | 'admin/class-knowledge-manager.php' |
| @@ -409,13 +330,8 @@ | ||
| 409 | 330 | //error_log('MxChat: Missing class file - ' . $file); |
| 410 | 331 | } |
| 411 | 332 | } |
| 412 | 333 | |
| 413 | - // Register the native function-calling admin-post save handler (a41dee). | |
| 414 | - if (class_exists('MxChat_Tool_Registry')) { | |
| 415 | - MxChat_Tool_Registry::init(); | |
| 416 | - } | |
| 417 | - | |
| 418 | 334 | // Admin pages that aren't classes (procedural include). |
| 419 | 335 | if (is_admin()) { |
| 420 | 336 | $admin_api_page = plugin_dir_path(__FILE__) . 'includes/admin-api-page.php'; |
| 421 | 337 | if (file_exists($admin_api_page)) { |
| @@ -420,18 +336,8 @@ | ||
| 420 | 336 | $admin_api_page = plugin_dir_path(__FILE__) . 'includes/admin-api-page.php'; |
| 421 | 337 | if (file_exists($admin_api_page)) { |
| 422 | 338 | require_once $admin_api_page; |
| 423 | 339 | } |
| 424 | - // f7c7d4 renamed this file admin-dashboard-page.php → admin-onboarding-page.php. | |
| 425 | - // The require MUST live here (admin bootstrap) and not just inside | |
| 426 | - // mxchat_add_plugin_page() on the admin_menu hook — admin_menu does NOT | |
| 427 | - // fire on admin-ajax.php requests, so the wizard's AJAX handlers | |
| 428 | - // (plan-905439: mxchat_onboarding_kb_status / save_step / mark_step / | |
| 429 | - // auto_graduate + the f7c7d4 dismiss handler) would never register. | |
| 430 | - $admin_onboarding_page = plugin_dir_path(__FILE__) . 'includes/admin-onboarding-page.php'; | |
| 431 | - if (file_exists($admin_onboarding_page)) { | |
| 432 | - require_once $admin_onboarding_page; | |
| 433 | - } | |
| 434 | 340 | } |
| 435 | 341 | } |
| 436 | 342 | |
| 437 | 343 | /** |
| @@ -1532,15 +1438,8 @@ | ||
| 1532 | 1438 | // Initialize content generator globally — it registers wp_head hook |
| 1533 | 1439 | // for frontend CSS injection, plus wp_ajax_ hooks for admin. |
| 1534 | 1440 | if (class_exists('MxChat_Content_Generator')) { |
| 1535 | 1441 | new MxChat_Content_Generator(); |
| 1536 | - } | |
| 1537 | - | |
| 1538 | - // Initialize cache purge globally — settings writes can happen on any | |
| 1539 | - // request type (admin screens, admin-ajax autosave, wp-cli), and the | |
| 1540 | - // deferred-purge cron event fires on front-end requests. | |
| 1541 | - if (class_exists('MxChat_Cache_Purge')) { | |
| 1542 | - MxChat_Cache_Purge::init(); | |
| 1543 | 1442 | } |
| 1544 | 1443 | |
| 1545 | 1444 | // Initialize REST API globally — endpoints must be registered on |
| 1546 | 1445 | // every request (admin and frontend) so they're reachable via /wp-json/. |