-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwoosms-sms-module-for-woocommerce.php
More file actions
97 lines (79 loc) 路 2.61 KB
/
Copy pathwoosms-sms-module-for-woocommerce.php
File metadata and controls
97 lines (79 loc) 路 2.61 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
96
97
<?php declare(strict_types=1);
/**
* Plugin Name: BulkGate SMS Plugin for WooCommerce
* Plugin URI: https://www.bulkgate.com/en/integrations/sms-plugin-for-woocommerce/
* Description: Notify your customers about order status via SMS notifications.
* Version: 3.0.7
* Author: BulkGate
* Author URI: https://www.bulkgate.com/
* Requires at least: 5.7
* PHP version 7.4
*
* @category BulkGate plugin for WooCommerce
* @package BulkGate
* @author Luk谩拧 Pij谩k <pijak@bulkgate.com>
* @license GNU General Public License v3.0
* @link https://www.bulkgate.com/
*/
use BulkGate\{Plugin\Event\Dispatcher, WooSms\Event\OrderForm, WooSms\DI\Factory, WooSms\Event\AssetDispatcher, WooSms\Event\Cron, WooSms\Event\Hook, Plugin\Settings\Settings, WooSms\Event\Redirect, WooSms\Template\Init};
if (!defined('ABSPATH')) {
exit;
}
define('BULKGATE_PLUGIN_DIR', basename(__DIR__));
require_once ABSPATH . 'wp-admin/includes/plugin.php';
/**
* Check if WooCommerce is installed
*/
if (is_plugin_active('woocommerce/woocommerce.php')) {
require_once __DIR__ . '/vendor/autoload.php';
!file_exists(__DIR__ . '/debug.php') ?: include_once __DIR__ . '/debug.php';
function BulkgateContainerSetup(): void
{
Factory::setup(fn () => [
'db' => $GLOBALS['wpdb'],
'debug' => defined('BulkGateDebug') ? BulkGateDebug : WP_DEBUG,
'gate_url' => defined('BulkGateDebugUrl') ? BulkGateDebugUrl : 'https://portal.bulkgate.com',
'language' => substr(get_locale(), 0, 2) ?: 'en',
'country' => function_exists('wc_get_base_location') ? wc_get_base_location()['country'] ?? null : null,
'name' => html_entity_decode(get_option('blogname', 'BulkGate Plugin Store'), ENT_QUOTES),
'url' => get_site_url(),
'plugin_data' => get_plugin_data(__FILE__),
'api_version' => '1.0',
'dispatcher' => Dispatcher::Asset,
'logger_limit' => 100,
'platform_version' => get_bloginfo('version'),
]);
}
/**
* Init BulkGate DI container
*/
add_action('init', 'BulkgateContainerSetup');
/**
* Init plugin
*/
Hook::init();
Cron::init();
Redirect::init();
AssetDispatcher::init();
OrderForm::init(get_locale());
/**
* Load Back office for BulkGate SMS plugin
*/
is_admin() && Init::init();
/**
* Register install scripts
*/
register_activation_hook(__FILE__, function (): void {
BulkgateContainerSetup();
Factory::get()->getByClass(Settings::class)->install();
});
/**
* Register uninstall scripts
*/
register_deactivation_hook(__FILE__, fn () => Factory::get()->getByClass(Settings::class)->uninstall());
} else {
/**
* WooCommerce is not installed
*/
deactivate_plugins(plugin_basename(__FILE__));
}