-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathPlugin.php
More file actions
95 lines (64 loc) · 1.73 KB
/
Plugin.php
File metadata and controls
95 lines (64 loc) · 1.73 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
91
92
93
94
95
<?php
namespace SkyVerge\WooCommerce\GatewayTestPlugin;
use SkyVerge\WooCommerce\PluginFramework\v6_0_2 as Framework;
defined( 'ABSPATH' ) or exit;
class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
/** @var Plugin single instance of this plugin */
protected static $instance;
/** string version number */
const VERSION = '1.0.0';
/** string the plugin ID */
const PLUGIN_ID = 'gateway_test_plugin';
/**
* Constructs the class.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
self::PLUGIN_ID,
self::VERSION,
[
'text_domain' => 'sv-wc-gateway-test-plugin',
'gateways' => [
'test_gateway' => '\SkyVerge\WooCommerce\GatewayTestPlugin\Gateway',
]
]
);
add_filter( 'wc_payment_gateway_gateway_test_plugin_activate_apple_pay', '__return_true' );
// make this plugin's gateway the one set up for Apple Pay
add_filter( 'pre_option_sv_wc_apple_pay_payment_gateway', function () {
return $this->get_gateway()->get_id();
} );
}
public function get_documentation_url() {
return 'https://example.com';
}
public function get_settings_url( $plugin_id = null ) {
return admin_url( 'admin.php?page=wc-settings' );
}
public function get_plugin_name() {
return 'Framework Gateway Test Plugin';
}
protected function get_file() {
return __DIR__;
}
/** Helper methods ******************************************************/
/**
* Gets the main plugin instance.
*
* Ensures only one instance is/can be loaded.
*
* @see sv_wc_gateway_test_plugin()
*
* @since 1.0.0
*
* @return Plugin
*/
public static function instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
}