Plugin Directory

Changeset 3476008


Ignore:
Timestamp:
03/06/2026 12:39:19 AM (3 weeks ago)
Author:
ipodguy79
Message:

2.0.5 small tweak for missing block registration

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

Legend:

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

    r3474032 r3476008  
    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.4
     7 * Version:     2.0.5
    88 * Author:      CaphLabs
    99 * Author URI:  https://profiles.wordpress.org/ipodguy79/
  • advanced-emt-payment-gateway/trunk/assets/build/emt-block-v2.js

    r3474032 r3476008  
    9292        }
    9393
     94        const contentElement = el( 'div', {}, ...contentParts );
     95
    9496        registerPaymentMethod( {
    9597            name: 'advanced_emt',
    9698            label: labelContent,
    9799            ariaLabel: title,
    98             content: el( 'div', {}, ...contentParts ),
    99             edit: null,
     100            content: contentElement,
     101            edit: contentElement,
    100102            canMakePayment: () => true,
    101             supports: [ 'products' ],
     103            supports: {
     104                features: [ 'products' ],
     105            },
    102106        } );
    103107    } );
  • advanced-emt-payment-gateway/trunk/blocks/class-advanced-emt-blocks.php

    r3474032 r3476008  
    5858
    5959    public function get_payment_method_data() {
    60         $gateway = WC()->payment_gateways->payment_gateways()['advanced_emt'] ?? null;
    61         if (!$gateway) return [];
     60        // Checkout block editor previews can execute this before gateways are fully initialized.
     61        // Return empty data instead of throwing fatal errors in that context.
     62        if ( ! function_exists( 'WC' ) || ! WC() ) {
     63            return [];
     64        }
     65
     66        $payment_gateways = WC()->payment_gateways();
     67        if ( ! $payment_gateways || ! method_exists( $payment_gateways, 'payment_gateways' ) ) {
     68            return [];
     69        }
     70
     71        $registered_gateways = $payment_gateways->payment_gateways();
     72        $gateway = $registered_gateways['advanced_emt'] ?? null;
     73        if ( ! $gateway ) {
     74            return [];
     75        }
    6276
    6377        $settings = get_option('woocommerce_' . $this->name . '_settings', []);
     
    6882        $discount_notice = trim( wp_strip_all_tags( $discount_notice ) );
    6983        if ( strlen( $discount_notice ) > 200 ) {
    70             $discount_notice = mb_substr( $discount_notice, 0, 197 ) . '...';
     84            $discount_notice = function_exists( 'mb_substr' )
     85                ? mb_substr( $discount_notice, 0, 197 ) . '...'
     86                : substr( $discount_notice, 0, 197 ) . '...';
    7187        }
    7288
  • advanced-emt-payment-gateway/trunk/readme.txt

    r3474032 r3476008  
    77WC requires at least: 6.0
    88WC tested up to: 8.6
    9 Stable tag: 2.0.4
     9Stable tag: 2.0.5
    1010License: GPL2 or later
    1111License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    247247
    248248== Changelog ==
     249
     250= 2.0.5 =
     251- Fixed Checkout Block editor preview crash caused by invalid EMT payment-method registration config.
     252- Fixed EMT gateway not appearing in Checkout Blocks when content/edit types failed Woo Blocks validation.
     253- Hardened Blocks payment data loading for editor contexts where WooCommerce gateways are not fully initialized.
     254- Added safe string truncation fallback when mbstring is unavailable.
    249255
    250256= 2.0.4 =
  • advanced-emt-payment-gateway/trunk/resources/index.js

    r3278447 r3476008  
    22const { __ } = window.wp.i18n;
    33const { createElement } = window.wp.element;
     4
     5const contentElement =
     6  createElement(
     7    'div',
     8    {},
     9    createElement('p', {}, __('Pay via EMT. You will receive instructions after placing the order.', 'advanced-emt-payment-gateway'))
     10  );
    411
    512registerPaymentMethod({
     
    714  label: __('Email Money Transfer', 'advanced-emt-payment-gateway'),
    815  ariaLabel: __('Email Money Transfer', 'advanced-emt-payment-gateway'),
    9   content: () =>
    10     createElement(
    11       'div',
    12       {},
    13       createElement('p', {}, __('Pay via EMT. You will receive instructions after placing the order.', 'advanced-emt-payment-gateway'))
    14     ),
    15   edit: () => null,
     16  content: contentElement,
     17  edit: contentElement,
    1618  canMakePayment: () => true,
    1719  supports: {
Note: See TracChangeset for help on using the changeset viewer.