-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpwl-dte-for-bsale.php
More file actions
executable file
·76 lines (68 loc) · 2.52 KB
/
Copy pathpwl-dte-for-bsale.php
File metadata and controls
executable file
·76 lines (68 loc) · 2.52 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
<?php
/**
* Plugin Name: PWL DTE for Bsale
* Plugin URI: https://pluginwordpresslatam.cl/producto/bsale-dte/
* Source Code: https://github.com/PluginLATAM/PWL-dte-for-bsale-lite
* Description: Connect WooCommerce with Bsale for Chilean electronic invoicing (DTE).
* Version: 2.1.0
* Requires at least: 6.0
* Requires PHP: 8.0
* Requires Plugins: woocommerce
* Author: PluginLATAM
* Author URI: https://pluginwordpresslatam.cl/
* Text Domain: pwl-dte-for-bsale
* Domain Path: /languages
* License: GPL-3.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*/
defined('ABSPATH') || exit;
if (in_array('pwl-dte-for-bsale-pro/pwl-dte-for-bsale-pro.php', (array) get_option('active_plugins', []), true)) {
return;
}
define('PWL_DTE_VERSION', '2.1.0');
define('PWL_DTE_EDITION', 'lite'); // injected by build.js
define('PWL_DTE_FILE', __FILE__);
define('PWL_DTE_DIR', plugin_dir_path(__FILE__));
define('PWL_DTE_URL', plugin_dir_url(__FILE__));
define('PWL_DTE_PRO_URL', 'https://pluginwordpresslatam.cl/producto/bsale-dte/');
// ── Conflict check: if both editions are active, user must resolve manually ──
if (PWL_DTE_EDITION === 'pro') {
$pwl_dte_lite_active = in_array(
'pwl-dte-for-bsale/pwl-dte-for-bsale.php',
(array) get_option('active_plugins', []),
true,
);
if ($pwl_dte_lite_active) {
add_action('admin_notices', static function () {
echo '<div class="notice notice-error"><p>'
. esc_html__('PWL DTE for Bsale Pro cannot run while PWL DTE for Bsale Lite is active. Please deactivate Lite manually and keep only one edition active.', 'pwl-dte-for-bsale')
. '</p></div>';
});
return;
}
}
require_once PWL_DTE_DIR . 'vendor/autoload.php';
register_activation_hook(__FILE__, ['PwlDte\Core\Activator', 'activate']);
register_deactivation_hook(__FILE__, ['PwlDte\Core\Deactivator', 'deactivate']);
/*
* WooCommerce may load after this file (plugin order is often alphabetical).
* Checking class_exists( 'WooCommerce' ) here is unreliable; wait until plugins_loaded.
*/
add_action(
'plugins_loaded',
static function (): void {
if (!class_exists('WooCommerce')) {
add_action(
'admin_notices',
static function (): void {
echo '<div class="notice notice-error"><p><strong>PWL DTE for Bsale</strong> '
. esc_html__('requires WooCommerce to be installed and active.', 'pwl-dte-for-bsale')
. '</p></div>';
}
);
return;
}
PwlDte\Core\Plugin::run();
},
0
);