-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsign2pay.php
More file actions
90 lines (70 loc) · 3.15 KB
/
sign2pay.php
File metadata and controls
90 lines (70 loc) · 3.15 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/*
* Plugin Name: WooCommerce Payment Gateway - Sign2Pay
* Plugin URI: https://www.sign2pay.com/
* Description: Process Mobile Direct Debit Payments in 18 European Countries
* Version: 1.0.2
* Author: sign2pay
* Author URI: https://www.sign2pay.com
* Requires at least: 4.0
* @package WordPress
* @author sign2pay
*/
/*
* Title : Sign2Pay extension for Woo-Commerece
* Author : Sign2Pay
* Url : http://sign2pay.com
* License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
function woocommerce_updater_notice() {
$plugin = plugin_basename( __FILE__ );
$plugin_data = get_plugin_data( __FILE__, false );
if (! class_exists( 'WooCommerce' ) ){
if( is_plugin_active($plugin) ) {
deactivate_plugins( $plugin );
wp_die( "<strong>".$plugin_data['Name']."</strong> requires <strong>WooCommerce 2.1</strong> or higher to be installed and active. Please activate WooCommerce and try again.<br /><br />Back to the WordPress <a href='".get_admin_url(null, 'plugins.php')."'>Plugins page</a>." );
}
}else if ( version_compare( WOOCOMMERCE_VERSION, '2.1', '<' ) ) {
if( is_plugin_active($plugin) ) {
deactivate_plugins( $plugin );
wp_die( "<strong>".$plugin_data['Name']."</strong> requires <strong>WooCommerce 2.1</strong> or higher, and has been deactivated! Please upgrade WooCommerce and try again.<br /><br />Back to the WordPress <a href='".get_admin_url(null, 'plugins.php')."'>Plugins page</a>." );
}
}
}
add_action( 'admin_init', 'woocommerce_updater_notice' );
function currency_admin_notice() {
$plugin = plugin_basename( __FILE__ );
$plugin_data = get_plugin_data( __FILE__, false );
if (class_exists( 'WooCommerce' ) ){
if(get_woocommerce_currency() != "EUR"){
if( is_plugin_active($plugin) ) {
deactivate_plugins( $plugin );
wp_die( "<strong>".$plugin_data['Name']."</strong> currently processes EURO payments only but your shop is set to ".get_woocommerce_currency().". <br /><br />Back to the WordPress <a href='".get_admin_url(null, 'plugins.php')."'>Plugins page</a>." );
}
}
}
}
add_action( 'plugins_loaded', 'currency_admin_notice' );
if ( ! function_exists( 'woothemes_queue_update' ) ) {
require_once( 'includes/woo-includes/woo-functions.php' );
}
// add a 'Settings' link to the plugin action links
add_filter( 'plugin_action_links_'. plugin_basename(__FILE__), 'add_plugin_setup_link');
function add_plugin_setup_link( $actions ) {
$manage_url = admin_url( 'admin.php' );
$manage_url = add_query_arg( array( 'page' => 'wc-settings', 'tab' => 'checkout', 'section' => "WC_Gateway_Sign2Pay"), $manage_url ); // WC 2.0+
$links[] = '<a href="'. $manage_url .'">Settings</a>';
return (array_merge($links, $actions));
}
define( 'SIGN2PAY__VERSION', '1.0.0' );
define( 'SIGN2PAY__TEXTDOMAIN', 'sign2pay' );
function init_sign2pay_gateway()
{
if (class_exists('WC_Payment_Gateway'))
{
include_once('class.sign2payextension.php');
}
}
add_action('plugins_loaded', 'init_sign2pay_gateway', 0);