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 +40 -4 3.2.23 → 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.
@@ -1527,9 +1541,10 @@
1527 1541 }
1528 1542
1529 1543 $product_id = 'MxChatPRO';
1530 1544 $domain = parse_url(home_url(), PHP_URL_HOST); // Get the current domain
1531 -
1545 + $was_active = (get_option('mxchat_license_status', 'inactive') === 'active');
1546 +
1532 1547 // Call WooCommerce Software API for activation (not just validation)
1533 1548 $response = wp_remote_get(
1534 1549 add_query_arg(
1535 1550 array(
@@ -1575,9 +1590,16 @@
1575 1590 update_option('mxchat_license_status', 'active');
1576 1591 update_option('mxchat_pro_email', $customer_email);
1577 1592 update_option('mxchat_activation_key', $license_key);
1578 1593 delete_option('mxchat_license_error');
1579 -
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 +
1580 1602 // Also track on your website (this is your existing domain tracking)
1581 1603 $this->track_domain_on_website($license_key, $customer_email, $domain);
1582 1604
1583 1605 wp_send_json_success(array('message' => esc_html__('License activated successfully', 'mxchat')));
@@ -1584,9 +1606,17 @@
1584 1606 } else {
1585 1607 $error_message = isset($data->error) ? $data->error : esc_html__('Activation failed', 'mxchat');
1586 1608 update_option('mxchat_license_status', 'inactive');
1587 1609 update_option('mxchat_license_error', $error_message);
1588 -
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 +
1589 1619 //error_log('MxChat Activation failed: ' . $error_message);
1590 1620 wp_send_json_error($error_message);
1591 1621 }
1592 1622 }
@@ -1671,9 +1701,15 @@
1671 1701 delete_option('mxchat_license_status');
1672 1702 delete_option('mxchat_pro_email');
1673 1703 delete_option('mxchat_activation_key');
1674 1704 delete_option('mxchat_license_error');
1675 -
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 +
1676 1712 //error_log('MxChat deactivate: Local data cleared');
1677 1713
1678 1714 // Notify your website's API to properly deactivate
1679 1715 $response = wp_remote_post('https://mxchat.ai/mxchat-api/deactivate-license', array(