-
Notifications
You must be signed in to change notification settings - Fork 4
/
everypay-woocommerce-addon.php
76 lines (56 loc) · 2.25 KB
/
everypay-woocommerce-addon.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
72
73
74
75
76
<?php
/**
* Plugin Name: EveryPay Payment Gateway for WooCommerce
* Plugin URI: https://wordpress.org/plugins/everypay-woocommerce-addon/
* Description: This plugin adds a payment option in WooCommerce for customers to pay with their Credit Cards Via Everypay.
* Version: 2
* Author: Everypay S.A.
* Author URI: https://everypay.gr
* License: GPL2
*/
if (!defined('ABSPATH'))
exit;
function everypay_woocommerce_missing_notice() {
echo '<div class="error"><p><strong>' . sprintf( esc_html__( 'Everypay requires WooCommerce to be installed and active. You can download %s here.'), '<a href="https://woocommerce.com/" target="_blank">WooCommerce</a>' ) . '</strong><p/></div>';
}
function everypay_init()
{
if ( ! class_exists( 'WooCommerce' ) || ! class_exists('WC_Payment_Gateway')) {
add_action( 'admin_notices', 'everypay_woocommerce_missing_notice' );
return;
}
class WC_Everypay {
public function __construct() {
$this->init();
add_filter('woocommerce_payment_gateways', array($this, 'add_everypay_gateway'));
}
/**
* Add Everypay to payment methods
* @param array $methods
*/
public function add_everypay_gateway($methods)
{
$methods[] = 'WC_Everypay_Gateway';
return $methods;
}
public function init() {
define('EVERYPAY_IMAGES_URL', plugins_url('images/', __FILE__));
define('EVERYPAY_JS_URL', plugins_url('assets/js/', __FILE__));
define('EVERYPAY_CSS_URL', plugins_url('assets/css/', __FILE__));
require_once plugin_dir_path(__FILE__) . "includes/class-wc-everypay-global-checks.php";
require_once plugin_dir_path(__FILE__) . "includes/class-wc-everypay-api.php";
require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-everypay-gateway.php';
}
}
new WC_Everypay();
}
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if(!is_plugin_active( 'theme-translation-for-polylang/polylang-theme-translation.php' ) ) {
function pll__($string){
return __($string, 'woocommerce');
}
function pll_e($string){
echo __($string, 'woocommerce');
}
}
add_action('plugins_loaded', 'everypay_init');