forked from swoelffel/woocommerce-paybox-gateway
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwoocommerce_paybox_gateway.php
65 lines (58 loc) · 2 KB
/
woocommerce_paybox_gateway.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
<?php
/**
* Plugin Name: WooCommerce Paybox Payment Gateway
* Plugin URI: http://www.openboutique.fr/
* Description: Gateway e-commerce pour Paybox.
* Version: 0.4.7
* Author: SWO(Castelis), JLA(Castelis)
* Author URI: http://www.openboutique.fr/
* License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* Text Domain: openboutique_paybox_gateway
*
* @package WordPress
* @author SWO(Castelis)
* @since 0.1.0
*/
if(!defined('ABSPATH'))
exit;
function activate_paybox_gateway()
{
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if( !is_plugin_active('woocommerce/woocommerce.php') )
{
_e('Le plugin WooCommerce doit être activé pour l\'activation de l\'extension', WC_Paybox::TEXT_DOMAIN);
exit;
}
if( !class_exists('WC_Payment_Gateway') )
{
_e('Une erreur est survenue concernant WooCommerce : Les méthodes de paiement semblent introuvables', WC_Paybox::TEXT_DOMAIN);
exit;
}
}
register_activation_hook(__FILE__, 'activate_paybox_gateway');
add_action('plugins_loaded', 'woocommerce_paybox_init', 0);
function woocommerce_paybox_init()
{
if( class_exists('WC_Payment_Gateway') )
{
include_once( plugin_dir_path( __FILE__ ).'woocommerce_paybox_gateway.class.php' );
include_once( plugin_dir_path( __FILE__ ).'shortcode_woocommerce_paybox_gateway.php' );
} else
exit;
DEFINE('PLUGIN_DIR', plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__)));
DEFINE('OB_VERSION', '0.4.7');
DEFINE('THANKS_SHORTCODE', 'woocommerce_paybox_gateway_thanks');
// Chargement des traductions
load_plugin_textdomain(WC_Paybox::TEXT_DOMAIN, false, dirname(plugin_basename(__FILE__)).'/languages/');
add_shortcode( THANKS_SHORTCODE, 'WC_Shortcode_Paybox_Thankyou::get' );
add_filter('woocommerce_payment_gateways', 'add_paybox_commerce_gateway');
}
/*
* Ajout de la "gateway" Paybox à woocommerce
*/
function add_paybox_commerce_gateway($methods)
{
$methods[] = 'WC_Paybox';
return $methods;
}
?>