Skip to content

Commit

Permalink
configuration for wp.org
Browse files Browse the repository at this point in the history
  • Loading branch information
BeycanDeveloper committed Apr 27, 2024
1 parent 14f62a6 commit 3b66f11
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
24 changes: 21 additions & 3 deletions app/Gateways/AbstractGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function tagHandler(\WPCF7_FormTag $tag): string
$itemCurrency = get_post_meta($form->id(), "cf7_cp_item_currency", true);

if (!$activate) {
/* translators: %s: plugin name */
return sprintf(esc_html__('%s is not activated.', 'cf7-cryptopay'), $this->name);
}

Expand All @@ -103,7 +104,7 @@ public function tagHandler(\WPCF7_FormTag $tag): string
if (Session::has('cf7_transaction_hash')) {
$transaction = $this->getModel()->findOneBy([
'hash' => Session::get('cf7_transaction_hash'),
'params' => json_encode($params),
'params' => wp_json_encode($params),
]);
if ($transaction) {
return $this->alreadyPaid($transaction);
Expand Down Expand Up @@ -154,6 +155,10 @@ private function alreadyPaid(object $transaction): string
*/
public function save(\WPCF7_ContactForm $form): void
{
if (!isset($_POST['cf7_cp_nonce']) || !wp_verify_nonce($_POST['cf7_cp_nonce'], 'cf7_cp_nonce')) {
return;
}

$activate = isset($_POST['cf7_cp_activate']) ? 1 : 0;
$itemId = isset($_POST['cf7_cp_item_id']) ? absint($_POST['cf7_cp_item_id']) : 0;
$itemPrice = isset($_POST['cf7_cp_item_price']) ? absint($_POST['cf7_cp_item_price']) : 0;
Expand Down Expand Up @@ -186,6 +191,8 @@ public function addPanel(array $panels): array
*/
public function panelContent(): void
{
/* phpcs:disable WordPress.Security.NonceVerification.Recommended */

if (class_exists(Constants::class)) {
$currencies = Constants::getCountryCurrencies();
} else {
Expand All @@ -205,11 +212,14 @@ public function panelContent(): void
$options .= '<option value="' . $code . '" ' . esc_attr($selectedCurrency) . '>' . $name . '</option>';
}

wp_nonce_field('cf7_cp_nonce', 'cf7_cp_nonce', false, true);

echo '<h2>' . esc_html($this->name) . '</h2>';
echo '<p>' . esc_html__('Add cryptocurrency payment gateway to your form.', 'cf7-cryptopay') . '</p>';
echo '<p>' . sprintf(
/* translators: %s: tag name */
esc_html__(
'You need add "%s" tag to form for start %s and need delete submit button.',
'You need add "%1$s" tag to form for start %2$s and need delete submit button.',
'cf7-cryptopay'
),
'<strong>[' . esc_html($this->key) . ']</strong>',
Expand All @@ -219,7 +229,13 @@ public function panelContent(): void
<table>
<tr>
<td width="195px">
<label>' . sprintf(esc_html__('Activate %s', 'cf7-cryptopay'), $this->name) . ': </label>
<label>'
. sprintf(
/* translators: %s: plugin name */
esc_html__('Activate %s', 'cf7-cryptopay'),
esc_html($this->name)
)
. ': </label>
</td>
<td width="250px">
<input name="cf7_cp_activate" value="1" type="checkbox" ' . esc_attr($activationStatus) . '>
Expand Down Expand Up @@ -270,6 +286,8 @@ public function panelContent(): void
</tr>
</table>
';

/* phpcs:enable WordPress.Security.NonceVerification.Recommended */
}

/**
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Version: 1.0.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Cryptocurrency Payment Gateway Plugin for Contact Form 7, Cryptocurrency payments for WordPress, Bitcoin payments, Crypto payments, USDT, BTC, ETH, SOL
Cryptocurrency Payment Gateway Plugin for Contact Form 7 Bitcoin payments, Crypto payments, Cryptocurrency Payments, Ethereum, USDT, BTC, ETH, SOL

== Description ==

Expand Down

0 comments on commit 3b66f11

Please sign in to comment.