From 4a1ba28140efb53366445b62c26a9aa89725be42 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sat, 27 Apr 2024 11:44:08 +0800 Subject: [PATCH] configured for wp.org --- app/Gateways/AbstractGateway.php | 5 +++++ app/Gateways/PaymentAddon.php | 6 ++++-- app/Loader.php | 1 + app/Models/TransactionsLite.php | 4 ++-- app/Models/TransactionsPro.php | 4 ++-- readme.txt | 8 ++++---- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/Gateways/AbstractGateway.php b/app/Gateways/AbstractGateway.php index 03d1157..2e2e5b8 100644 --- a/app/Gateways/AbstractGateway.php +++ b/app/Gateways/AbstractGateway.php @@ -134,7 +134,9 @@ public function get_form_editor_field_settings(): array private function get_field_works_or_expect_msg(bool $works = true): string { $msg = $works + /* translators: %s: field title */ ? esc_html__('The %s process will appear on the front-end and the form can be sent when the user completes the payment.', 'gf-cryptopay') // phpcs:ignore + /* translators: %s: field title */ : esc_html__('Please add a total field to your form for %s works.', 'gf-cryptopay'); return sprintf($msg, $this->get_form_editor_field_title()); @@ -362,6 +364,7 @@ public function add_entry_id_to_tx($entry, $form): mixed } $model = Helpers::run('getModelByAddon', 'gravityforms'); + // In Gravity Forms process already have nonce process $txHash = sanitize_text_field($_POST[$this->field_input_id] ?? ''); $model->updateOrderIdByTxHash($txHash, intval($entry['id'])); @@ -433,6 +436,7 @@ public function get_field_content($value, $forceFrontendLabel, $form): string if ($this->is_admin_side()) { return sprintf( + /* translators: %s: field label */ "%s{FIELD}", $adminButtons, "input_{$this->id}", @@ -475,6 +479,7 @@ public function get_field_content($value, $forceFrontendLabel, $form): string // @phpcs:ignore public function validate($value, $form): void { + // In Gravity Forms process already have nonce process $txHash = sanitize_text_field($_POST[$this->field_input_id] ?? ''); if (empty($txHash)) { diff --git a/app/Gateways/PaymentAddon.php b/app/Gateways/PaymentAddon.php index b0099b2..988326e 100644 --- a/app/Gateways/PaymentAddon.php +++ b/app/Gateways/PaymentAddon.php @@ -155,6 +155,8 @@ public function authorize($feed, $data, $form, $entry): array 'error_message' => esc_html__('The payment field is not found!', 'gf-cryptopay') ]; } + + // In Gravity Forms process already have nonce process $txId = $ourField ? sanitize_text_field($_POST[$ourField->field_input_id] ?? '') : ''; $tx = Helpers::run('getModelByAddon', 'gravityforms')->findOneBy(['hash' => $txId]); @@ -214,7 +216,7 @@ public function get_menu_icon(): string throw new \Exception( \sprintf( 'Could not read WordPress admin menu icon from file: %s.', - $file + esc_html($file) ) ); } @@ -225,7 +227,7 @@ public function get_menu_icon(): string throw new \Exception( \sprintf( 'Could not read WordPress admin menu icon from file: %s.', - $file + esc_html($file) ) ); } diff --git a/app/Loader.php b/app/Loader.php index 69696d8..9520640 100644 --- a/app/Loader.php +++ b/app/Loader.php @@ -47,6 +47,7 @@ public function registerTransactionListPages(): void $formId = $tx->params?->formId ?? $tx->params?->formIdOld; return Helpers::run('view', 'components/link', [ 'url' => sprintf(admin_url('admin.php?page=gf_entries&view=entry&id=%d&lid=%d&order=ASC&filter&paged=1&pos=0&field_id&operator'), $formId, $tx->orderId), // @phpcs:ignore + /* translators: %d: transaction id */ 'text' => sprintf(esc_html__('View entry #%d', 'gf-cryptopay'), $tx->orderId) ]); } diff --git a/app/Models/TransactionsLite.php b/app/Models/TransactionsLite.php index bdd56f6..e0df14c 100644 --- a/app/Models/TransactionsLite.php +++ b/app/Models/TransactionsLite.php @@ -44,10 +44,10 @@ public function cleanFormIdsInTxs(string $formId): void { $this->update( [ - 'params' => json_encode(['formIdOld' => $formId]), + 'params' => wp_json_encode(['formIdOld' => $formId]), ], [ - 'params' => json_encode(['formId' => $formId]), + 'params' => wp_json_encode(['formId' => $formId]), ] ); } diff --git a/app/Models/TransactionsPro.php b/app/Models/TransactionsPro.php index a638b52..313c5e9 100644 --- a/app/Models/TransactionsPro.php +++ b/app/Models/TransactionsPro.php @@ -44,10 +44,10 @@ public function cleanFormIdsInTxs(string $formId): void { $this->update( [ - 'params' => json_encode(['formIdOld' => $formId]), + 'params' => wp_json_encode(['formIdOld' => $formId]), ], [ - 'params' => json_encode(['formId' => $formId]), + 'params' => wp_json_encode(['formId' => $formId]), ] ); } diff --git a/readme.txt b/readme.txt index 3a593a6..7be62f0 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,6 @@ -=== Cryptocurrency Payment Gateway Plugin for Gravity Forms by CryptoPay === +=== Cryptocurrency Payment Gateway for Gravity Forms by CryptoPay === Contributors: BeycanPress -Tags: Bitcoin, Ethereum, Binance Smart Chain, Blockchain, Networks, Cryptocurrency, Payments, Gateway, WordPress, Gravity Forms +Tags: Bitcoin, Ethereum, Cryptocurrency, Payments, Gravity Forms Requires at least: 5.0 Tested up to: 6.5.0 Requires PHP: 8.1 @@ -9,11 +9,11 @@ Version: 1.0.0 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html -Cryptocurrency Payment Gateway Plugin for Gravity Forms, Cryptocurrency payments for WordPress, Bitcoin payments, Crypto payments, USDT, BTC, ETH, SOL +Cryptocurrency Payment Gateway for Gravity Forms, Cryptocurrency payments for WordPress, Bitcoin payments, Crypto payments, USDT, BTC, ETH, SOL == Description == -### Cryptocurrency Payment Gateway Plugin for Gravity Forms by CryptoPay +### Cryptocurrency Payment Gateway for Gravity Forms by CryptoPay First of all, we would like to point out that this plugin is not a standalone plugin. This plugin is a **cryptocurrency payment gateway for Gravity Forms**. In other words, users who want to sell courses with cryptocurrency payments can use WordPress and Gravity Forms. However, this plugin is a plugin for CryptoPay and a cryptocurrency payment gateway for Gravity Forms. So it's actually CryptoPay, which is the main plugin that handles cryptocurrency payments for WordPress. Therefore, users must have both plugins.