-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcryptopay-gateway-for-wpforms.php
71 lines (59 loc) · 2.26 KB
/
cryptopay-gateway-for-wpforms.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
declare(strict_types=1);
defined('ABSPATH') || exit;
// @phpcs:disable PSR1.Files.SideEffects
// @phpcs:disable PSR12.Files.FileHeader
// @phpcs:disable Generic.Files.InlineHTML
// @phpcs:disable Generic.Files.LineLength
/**
* Plugin Name: CryptoPay Gateway for WPForms
* Version: 1.0.1
* Plugin URI: https://beycanpress.com/cryptopay/
* Description: Adds Cryptocurrency payment gateway (CryptoPay) for WPForms.
* Author: BeycanPress LLC
* Author URI: https://beycanpress.com
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: wpforms-cryptopay
* Tags: Bitcoin, Ethereum, Crypto, Payment, WPForms
* Requires at least: 5.0
* Tested up to: 6.7.1
* Requires PHP: 8.1
*/
// Autoload
require_once __DIR__ . '/vendor/autoload.php';
define('WPFORMS_CRYPTOPAY_FILE', __FILE__);
define('WPFORMS_CRYPTOPAY_VERSION', '1.0.1');
define('WPFORMS_CRYPTOPAY_KEY', basename(__DIR__));
define('WPFORMS_CRYPTOPAY_URL', plugin_dir_url(__FILE__));
define('WPFORMS_CRYPTOPAY_DIR', plugin_dir_path(__FILE__));
define('WPFORMS_CRYPTOPAY_SLUG', plugin_basename(__FILE__));
define('WPFORMS_CRYPTOPAY_SVG_ICON', file_get_contents(WPFORMS_CRYPTOPAY_DIR . 'assets/images/icon.svg'));
use BeycanPress\CryptoPay\Integrator\Helpers;
/**
* @return void
*/
function wpformsCryptoPayRegisterModels(): void
{
Helpers::registerModel(BeycanPress\CryptoPay\WPForms\Models\TransactionsPro::class);
Helpers::registerLiteModel(BeycanPress\CryptoPay\WPForms\Models\TransactionsLite::class);
}
wpformsCryptoPayRegisterModels();
add_action('init', function (): void {
load_plugin_textdomain('wpforms-cryptopay', false, basename(__DIR__) . '/languages');
});
add_action('plugins_loaded', function (): void {
wpformsCryptoPayRegisterModels();
if (!defined('WPFORMS_VERSION')) {
Helpers::requirePluginMessage('WPForms', admin_url('plugin-install.php?s=wpforms&tab=search&type=term'));
} elseif (Helpers::bothExists()) {
new BeycanPress\CryptoPay\WPForms\Loader();
add_filter('wpforms_integrations_available', function (array $integrations): array {
return array_merge($integrations, [
'CryptoPay',
]);
});
} else {
Helpers::requireCryptoPayMessage('WPForms');
}
});