From d35c90ca6474bdaa535f2cfcb14683b2c7b0223f Mon Sep 17 00:00:00 2001
From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com>
Date: Thu, 22 Aug 2024 09:03:07 +0800
Subject: [PATCH] fixed
---
app/Loader.php | 3 +--
assets/js/main.js | 6 ++++--
cryptopay-gateway-for-gravity-forms.php | 5 ++++-
readme.md | 1 +
readme.txt | 1 +
5 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/app/Loader.php b/app/Loader.php
index dc96e3e..2ddb2c6 100644
--- a/app/Loader.php
+++ b/app/Loader.php
@@ -20,7 +20,6 @@ public function __construct()
{
$this->registerTransactionListPages();
Helpers::registerIntegration('gravityforms');
- add_action('gform_loaded', [$this, 'register'], 5);
Hook::addFilter('edit_config_data_gravityforms', [$this, 'disableReminderEmail']);
Hook::addFilter('payment_redirect_urls_gravityforms', [$this, 'paymentRedirectUrls']);
add_action('gform_field_standard_settings', [ $this, 'fieldStandardSettings' ], 10, 2);
@@ -116,7 +115,7 @@ public function paymentRedirectUrls(object $data): array
/**
* @return void
*/
- public function register(): void
+ public static function register(): void
{
\GFForms::include_payment_addon_framework();
\GFAddOn::register(Gateways\PaymentAddon::class);
diff --git a/assets/js/main.js b/assets/js/main.js
index 78b23d5..961acba 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -43,8 +43,10 @@
}
}
- $('#gform_' + formId).on('change', checkFormEmpty);
- $('#gform_' + formId).on('keyup', checkFormEmpty);
+ const $form = $('#gform_' + formId);
+ $form.on('change', checkFormEmpty);
+ $form.on('keyup', checkFormEmpty);
+ $form.trigger('change');
const paymentCompleted = async (ctx, formId) => {
ctx.disablePopup = true;
diff --git a/cryptopay-gateway-for-gravity-forms.php b/cryptopay-gateway-for-gravity-forms.php
index 19c4233..eaf467f 100644
--- a/cryptopay-gateway-for-gravity-forms.php
+++ b/cryptopay-gateway-for-gravity-forms.php
@@ -36,6 +36,7 @@
define('GF_CRYPTOPAY_SLUG', plugin_basename(__FILE__));
use BeycanPress\CryptoPay\Integrator\Helpers;
+use BeycanPress\CryptoPay\GravityForms\Loader;
/**
* @return void
@@ -50,13 +51,15 @@ function gfCryptoPayRegisterModels(): void
load_plugin_textdomain('gf-cryptopay', false, basename(__DIR__) . '/languages');
+add_action('gform_loaded', [Loader::class, 'register'], 5);
+
add_action('plugins_loaded', function (): void {
gfCryptoPayRegisterModels();
if (!defined('GF_MIN_WP_VERSION')) {
Helpers::requirePluginMessage('Gravity Forms', 'https://www.gravityforms.com/', false);
} elseif (Helpers::bothExists()) {
- new BeycanPress\CryptoPay\GravityForms\Loader();
+ new Loader();
} else {
Helpers::requireCryptoPayMessage('Gravity Forms');
}
diff --git a/readme.md b/readme.md
index 0e469c7..497fc9f 100644
--- a/readme.md
+++ b/readme.md
@@ -28,6 +28,7 @@ After adding the CryptoPay field in the form creation step, you are ready to rec
Result:
+
diff --git a/readme.txt b/readme.txt
index 0353e42..15943e0 100644
--- a/readme.txt
+++ b/readme.txt
@@ -41,6 +41,7 @@ After adding the CryptoPay field in the form creation step, you are ready to rec
Result:
+