-
Notifications
You must be signed in to change notification settings - Fork 1
/
cryptopay-gateway-for-gravity-forms.php
66 lines (53 loc) · 1.96 KB
/
cryptopay-gateway-for-gravity-forms.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
<?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 Gravity Forms
* Version: 1.0.0
* Plugin URI: https://beycanpress.com/cryptopay/
* Description: Adds Cryptocurrency payment gateway (CryptoPay) for Gravity Forms.
* Author: BeycanPress LLC
* Author URI: https://beycanpress.com
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: gf-cryptopay
* Tags: Bitcoin, Ethereum, Cryptocurrency, Payments, Gravity Forms
* Requires at least: 5.0
* Tested up to: 6.6
* Requires PHP: 8.1
*/
// Autoload
require_once __DIR__ . '/vendor/autoload.php';
define('GF_CRYPTOPAY_FILE', __FILE__);
define('GF_CRYPTOPAY_VERSION', '1.0.0');
define('GF_CRYPTOPAY_KEY', basename(__DIR__));
define('GF_CRYPTOPAY_URL', plugin_dir_url(__FILE__));
define('GF_CRYPTOPAY_DIR', plugin_dir_path(__FILE__));
define('GF_CRYPTOPAY_SLUG', plugin_basename(__FILE__));
use BeycanPress\CryptoPay\Integrator\Helpers;
use BeycanPress\CryptoPay\GravityForms\Loader;
/**
* @return void
*/
function gfCryptoPayRegisterModels(): void
{
Helpers::registerModel(BeycanPress\CryptoPay\GravityForms\Models\TransactionsPro::class);
Helpers::registerLiteModel(BeycanPress\CryptoPay\GravityForms\Models\TransactionsLite::class);
}
gfCryptoPayRegisterModels();
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 Loader();
} else {
Helpers::requireCryptoPayMessage('Gravity Forms');
}
});