PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 3.2.25
MxChat – AI Chatbot & Content Generation for WordPress v3.2.25
3.2.25 3.2.24 3.2.23 3.2.22 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 All 156 releases
← All changes | admin/class-ajax-handler.php +47 -4 3.2.22 → 3.2.25 View file →
@@ -439,8 +439,22 @@
439 439 update_option('mxchat_video_embed_enabled', $vce_value);
440 440 wp_send_json_success(['message' => esc_html__('Setting saved', 'mxchat')]);
441 441 return;
442 442
443 + // Page-cache purge on settings save (plan b76ed6, Support Ticket 468).
444 + // STANDALONE option, same pattern. Default ON — the purge already ships
445 + // (3.2.9), so this is an opt-OUT for large sites. Switching it off also
446 + // drops a deferred purge the debounce may have scheduled seconds ago,
447 + // so "off" takes effect at once rather than after one more purge.
448 + case 'mxchat_cache_purge_enabled':
449 + $cpe_value = ($value === 'on' || $value === '1') ? 'on' : 'off';
450 + update_option('mxchat_cache_purge_enabled', $cpe_value);
451 + if ($cpe_value === 'off' && class_exists('MxChat_Cache_Purge')) {
452 + wp_clear_scheduled_hook(MxChat_Cache_Purge::DEFERRED_EVENT);
453 + }
454 + wp_send_json_success(['message' => esc_html__('Setting saved', 'mxchat')]);
455 + return;
456 +
443 457 // Clamped to the same 20-95 the field advertises. An out-of-range or
444 458 // non-numeric POST is corrected rather than refused, and the corrected
445 459 // value is echoed back so the field can reconcile — a silently stored
446 460 // 0 here would put a video on every answer, which is the bug.
@@ -1063,8 +1077,15 @@
1063 1077 $new_value = ($value === 'document') ? 'document' : 'vector';
1064 1078 if ($new_value === 'document' && strtolower(trim((string) ($current_options['mxchat_pinecone_host'] ?? ''), '/')) !== strtolower((string) ($current_options['mxchat_pinecone_docs_verified_host'] ?? ''))) {
1065 1079 wp_send_json_error(['message' => esc_html__('Check the document index host first (Check index or Create index for me).', 'mxchat')]);
1066 1080 }
1081 + // 3e83e4: same gate as the form save — no switch onto a half-copied index.
1082 + if ($new_value === 'document' && (($current_options['mxchat_pinecone_index_type'] ?? 'vector') !== 'document') && class_exists('MxChat_Pinecone_Documents')) {
1083 + $running = MxChat_Pinecone_Documents::migration_blocks_switch((string) ($current_options['mxchat_pinecone_host'] ?? ''));
1084 + if ($running !== null) {
1085 + wp_send_json_error(['message' => MxChat_Pinecone_Documents::switch_blocked_message($running)]);
1086 + }
1087 + }
1067 1088 break;
1068 1089 case 'mxchat_pinecone_vector_host':
1069 1090 $new_value = trim(str_replace(['https://', 'http://'], '', sanitize_text_field($value)), '/');
1070 1091 break;
@@ -1520,9 +1541,10 @@
1520 1541 }
1521 1542
1522 1543 $product_id = 'MxChatPRO';
1523 1544 $domain = parse_url(home_url(), PHP_URL_HOST); // Get the current domain
1524 -
1545 + $was_active = (get_option('mxchat_license_status', 'inactive') === 'active');
1546 +
1525 1547 // Call WooCommerce Software API for activation (not just validation)
1526 1548 $response = wp_remote_get(
1527 1549 add_query_arg(
1528 1550 array(
@@ -1568,9 +1590,16 @@
1568 1590 update_option('mxchat_license_status', 'active');
1569 1591 update_option('mxchat_pro_email', $customer_email);
1570 1592 update_option('mxchat_activation_key', $license_key);
1571 1593 delete_option('mxchat_license_error');
1572 -
1594 +
1595 + // A fresh activation starts the licence domain check (c93ede) from a
1596 + // clean slate: no grace streak carried over, first daily check at a
1597 + // random time within the day.
1598 + if (class_exists('MxChat_License_Check')) {
1599 + MxChat_License_Check::reset(true);
1600 + }
1601 +
1573 1602 // Also track on your website (this is your existing domain tracking)
1574 1603 $this->track_domain_on_website($license_key, $customer_email, $domain);
1575 1604
1576 1605 wp_send_json_success(array('message' => esc_html__('License activated successfully', 'mxchat')));
@@ -1577,9 +1606,17 @@
1577 1606 } else {
1578 1607 $error_message = isset($data->error) ? $data->error : esc_html__('Activation failed', 'mxchat');
1579 1608 update_option('mxchat_license_status', 'inactive');
1580 1609 update_option('mxchat_license_error', $error_message);
1581 -
1610 +
1611 + // c93ede: a refusal by the licence owner (domain switched off, new sites
1612 + // blocked) or a revoked key is an explicit "off" from mxchat.ai. Remember
1613 + // who controls it so Pro & Extensions says so, and keep checking so the
1614 + // owner's switch-on restores Pro without another click here.
1615 + if (class_exists('MxChat_License_Check')) {
1616 + MxChat_License_Check::note_activation_refusal(isset($data->code) ? (string) $data->code : '', (string) $error_message, $was_active);
1617 + }
1618 +
1582 1619 //error_log('MxChat Activation failed: ' . $error_message);
1583 1620 wp_send_json_error($error_message);
1584 1621 }
1585 1622 }
@@ -1664,9 +1701,15 @@
1664 1701 delete_option('mxchat_license_status');
1665 1702 delete_option('mxchat_pro_email');
1666 1703 delete_option('mxchat_activation_key');
1667 1704 delete_option('mxchat_license_error');
1668 -
1705 +
1706 + // Nothing left to check: drop the licence domain check's state and its
1707 + // scheduled event (c93ede).
1708 + if (class_exists('MxChat_License_Check')) {
1709 + MxChat_License_Check::reset(false);
1710 + }
1711 +
1669 1712 //error_log('MxChat deactivate: Local data cleared');
1670 1713
1671 1714 // Notify your website's API to properly deactivate
1672 1715 $response = wp_remote_post('https://mxchat.ai/mxchat-api/deactivate-license', array(