-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmollie-for-paymattic.php
58 lines (48 loc) · 1.7 KB
/
mollie-for-paymattic.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
<?php
/**
* @package mollie-for-paymattic
*/
/*
Plugin Name: Mollie for paymattic
Plugin URI: https://paymattic.com/
Description: A custom payment gateway for paymattic.
Version: 1.0.0
Author: WPManageNinja LLC
Author URI: https://paymattic.com/
License: GPLv2 or later
Text Domain: mollie-for-paymattic
*/
if (!defined('ABSPATH')) {
exit;
}
defined('ABSPATH') or die;
define('MOLLIE_FOR_PAYMATTIC', true);
define('MOLLIE_FOR_PAYMATTIC_DIR', __DIR__);
define('MOLLIE_FOR_PAYMATTIC_VERSION', '1.0');
add_action('wppayform_loaded', function () {
$paymattic_pro__path = WPPAYFORMPRO_DIR_PATH . 'wp-payment-form-pro.php';
$has_pro = defined('WPPAYFORMHASPRO');
$currentVersion = '';
if ($has_pro) {
$currentVersion = defined('WPPAYFORM_VERSION') ? WPPAYFORM_VERSION : 'NO';
} else {
$plugin = get_plugin_data($paymattic_pro__path);
$currentVersion = $plugin['Version'];
}
// here we also need to check the paymattic version
// as custom payment gateway is not available before 4.3.2
if (defined('WPPAYFORMHASPRO') && version_compare($currentVersion, '4.3.2', '>=')) {
if (!class_exists('MollieForPaymattic\MollieProcessor')) {
require_once MOLLIE_FOR_PAYMATTIC_DIR . '/API/MollieProcessor.php';
(new MollieForPaymattic\API\MollieProcessor())->init();
};
} else {
add_action('admin_notices', function () {
if (current_user_can('activate_plugins')) {
echo '<div class="notice notice-error"><p>';
echo __('Please install Paymattic and Paymattic Pro to use mollie-for-paymattic!', 'mollie-for-paymattic');
echo '</p></div>';
}
});
}
});