-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbangladesh-payment-gateways-woocommerce.php
More file actions
62 lines (47 loc) · 1.57 KB
/
Copy pathbangladesh-payment-gateways-woocommerce.php
File metadata and controls
62 lines (47 loc) · 1.57 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
<?php
/**
* Plugin Name: BPGW - Bangladeshi Payment Gateways Plugin for WooCommerce
* Plugin URI: https://bpgw.rifatxtra.com/
* Description: Bangladeshi payment gateways Plugin (bKash, SSLCommerz or others) for WooCommerce.
* Version: 1.0.1
* Author: Md. Rashedul Islam
* Author URI: https://rifatxtra.com/
* Text Domain: bpgw
*/
//if accessed directly, exit
defined('ABSPATH') || exit;
//define constants
define('BPGW_VERSION', '1.0.1');
define('BPGW_FILE', __FILE__);
define('BPGW_PATH', plugin_dir_path(__FILE__));
define('BPGW_URL', plugin_dir_url(__FILE__));
//autoload classes
spl_autoload_register(function (string $class): void {
if (strpos($class, 'BPGW\\') !== 0) {
return;
}
$relative = str_replace('BPGW\\', '', $class);
$file = BPGW_PATH . 'app/' . str_replace('\\', '/', $relative) . '.php';
if (file_exists($file)) {
require_once $file;
}
});
//clear scheduled reconciliation on deactivation
register_deactivation_hook(__FILE__, function (): void {
$timestamp = wp_next_scheduled('bpgw_reconcile_pending');
if ($timestamp) {
wp_unschedule_event($timestamp, 'bpgw_reconcile_pending');
}
});
//bootstrap the plugin
add_action('plugins_loaded', function (): void {
if (!class_exists('WooCommerce')) {
add_action('admin_notices', function (): void {
echo '<div class="notice notice-error"><p>';
echo '<strong>BPGW:</strong> WooCommerce must be active.';
echo '</p></div>';
});
return;
}
\BPGW\Core\Plugin::boot();
});