Plugin Directory

Changeset 3476070


Ignore:
Timestamp:
03/06/2026 05:26:28 AM (3 weeks ago)
Author:
ipodguy79
Message:

the bugs i missed, attentive me

Location:
advanced-emt-payment-gateway/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • advanced-emt-payment-gateway/trunk/advanced-emt-payment-gateway.php

    r3476008 r3476070  
    55 * Plugin URI:  https://wordpress.org/plugins/advanced-emt-payment-gateway/
    66 * Description: Accept Interac e-Transfer / Email Money Transfer (EMT) in WooCommerce with dynamic secret answers, order notes, and customizable instructions. Supports Block and Classic checkout.
    7  * Version:     2.0.5
     7 * Version:     2.1.0
    88 * Author:      CaphLabs
    99 * Author URI:  https://profiles.wordpress.org/ipodguy79/
     
    2222if ( !defined( 'ABSPATH' ) ) {
    2323    exit;
     24}
     25
     26if ( ! function_exists( 'advanced_emt_free_resolve_pro_conflict_early' ) ) {
     27    /**
     28     * During activation, the other version may already be loaded in-memory.
     29     * Deactivate it first and short-circuit this request to avoid function redeclare fatals.
     30     *
     31     * @return bool True when the pro plugin was active at request start.
     32     */
     33    function advanced_emt_free_resolve_pro_conflict_early() {
     34        $pro_plugin_rel_path = 'advanced-emt-payment-gateway-pro/advanced-emt-payment-gateway-pro.php';
     35
     36        if ( ! function_exists( 'is_plugin_active' ) || ! function_exists( 'deactivate_plugins' ) || ! function_exists( 'is_plugin_active_for_network' ) ) {
     37            require_once ABSPATH . 'wp-admin/includes/plugin.php';
     38        }
     39
     40        $was_active = function_exists( 'is_plugin_active' ) && is_plugin_active( $pro_plugin_rel_path );
     41        $was_network_active = is_multisite() && function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( $pro_plugin_rel_path );
     42        // Activation sandbox can load active plugins before option state is updated.
     43        $pro_loaded_in_memory = function_exists( 'advanced_emt_get_blocks_data_payload' );
     44
     45        if ( ( $was_active || $was_network_active || $pro_loaded_in_memory ) && function_exists( 'deactivate_plugins' ) ) {
     46            deactivate_plugins( $pro_plugin_rel_path, true, $was_network_active );
     47        }
     48
     49        return ( $was_active || $was_network_active || $pro_loaded_in_memory );
     50    }
     51}
     52
     53if ( advanced_emt_free_resolve_pro_conflict_early() ) {
     54    // The pro plugin was already loaded in this request, so avoid duplicate symbol declarations.
     55    return;
    2456}
    2557
     
    76108// After opt-in/connect (or skip), go back to Plugins like other Freemius plugins do.
    77109if ( function_exists( 'aemt_fs' ) ) {
     110    // Freemius standard behavior: deactivate the other version on activation.
     111    aemt_fs()->add_filter( 'deactivate_on_activation', '__return_true' );
     112
    78113    aemt_fs()->add_filter( 'after_connect_url', function ( $url ) {
    79114        return ( is_network_admin() ? network_admin_url( 'plugins.php' ) : admin_url( 'plugins.php' ) );
     
    248283
    249284// ✅ EMT Default Instructions
    250 function advanced_emt_get_default_instructions() {
    251     return "Send an EMT to your@email.com
     285if ( ! function_exists( 'advanced_emt_get_default_instructions' ) ) {
     286    function advanced_emt_get_default_instructions() {
     287        return "Send an EMT to your@email.com
    252288
    253289Secret Question: Your Order Number [order]
     
    255291
    256292Thank you!";
     293    }
    257294}
    258295
  • advanced-emt-payment-gateway/trunk/readme.txt

    r3476008 r3476070  
    77WC requires at least: 6.0
    88WC tested up to: 8.6
    9 Stable tag: 2.0.5
     9Stable tag: 2.1.0
    1010License: GPL2 or later
    1111License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    247247
    248248== Changelog ==
     249
     250= 2.1.0 =
     251- Added activation-safe Free/Pro conflict handling so activating one version disables the other without fatal collisions.
     252- Added early bootstrap guards to prevent same-request redeclare failures during WordPress plugin activation sandbox.
     253- Guarded shared helper declaration (`advanced_emt_get_default_instructions`) to avoid duplicate declaration fatals.
     254- Fixed Checkout Block editor integration by using valid React element registration (`content` and `edit`) in EMT Blocks.
     255- Hardened Blocks payment-method data retrieval to safely handle early editor loads when gateways are not initialized.
    249256
    250257= 2.0.5 =
Note: See TracChangeset for help on using the changeset viewer.