-
Notifications
You must be signed in to change notification settings - Fork 1
/
integration-alegra-woo.php
66 lines (56 loc) · 1.71 KB
/
integration-alegra-woo.php
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
<?php
/**
* Plugin Name: Integration Alegra Woocommerce
* Description: Integración del sistama contable y de facturación Alegra para Woocoommerce
* Version: 0.0.12
* Author: Saul Morales Pacheco
* Author URI: https://saulmoralespa.com
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
* WC tested up to: 8.6
* WC requires at least: 4.0
* Requires Plugins: woocommerce
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if(!defined('INTEGRATION_ALEGRA_WC_SMP_VERSION')){
define('INTEGRATION_ALEGRA_WC_SMP_VERSION', '0.0.12');
}
add_action( 'plugins_loaded', 'integration_alegra_wc_smp_init');
function integration_alegra_wc_smp_init(): void
{
if(!integration_alegra_wc_smp_requirements()) return;
integration_alegra_wc_smp()->run_alegra();
}
function integration_alegra_wc_smp_notices($notice): void
{
?>
<div class="error notice">
<p><?php echo esc_html( $notice ); ?></p>
</div>
<?php
}
function integration_alegra_wc_smp_requirements(): bool
{
if ( !version_compare(PHP_VERSION, '8.0.0', '>=') ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
add_action(
'admin_notices',
function() {
integration_alegra_wc_smp_notices( 'Integration Alegra Woocommerce: Requiere la versión de php >= 8.0');
}
);
}
return false;
}
return true;
}
function integration_alegra_wc_smp(){
static $plugin;
if (!isset($plugin)){
require_once('includes/class-integration-alegra-wc-plugin.php');
$plugin = new Integration_Alegra_WC_Plugin(__FILE__, INTEGRATION_ALEGRA_WC_SMP_VERSION);
}
return $plugin;
}