-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
mojito-sinpe.php
117 lines (102 loc) · 2.61 KB
/
mojito-sinpe.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/**
* Mojito Sinpe
*
* @package Mojito_Sinpe
* @author Mojito Team
* @link https://mojitowp.com/
*
* @wordpress-plugin
* Plugin Name: Mojito Sinpe
* Plugin URI: https://mojitowp.com/
* Description: Sinpe Móvil as Woocommerce gateway
* Version: 1.1.0
* Requires at least: 5.2
* Requires PHP: 7.4
* Author: Mojito Team
* Author URI: https://mojitowp.com/
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: mojito-sinpe
* Domain Path: /languages
* WC requires at least: 8.2.0
* WC tested up to: 8.9.1
*/
namespace Mojito_Sinpe;
/**
* If this file is called directly, abort.
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Version.
*/
define( 'MOJITO_SINPE_VERSION', '1.1.0' );
/**
* Define plugin constants.
*/
define( 'MOJITO_SINPE_DIR', plugin_dir_path( __FILE__ ) );
/**
* Plugin activation
*/
register_activation_hook(
__FILE__,
function () {
require_once MOJITO_SINPE_DIR . 'includes/class-mojito-sinpe-activator.php';
Mojito_Sinpe_Activator::activate();
}
);
/**
* Plugin deactivation.
*/
register_deactivation_hook(
__FILE__,
function () {
require_once MOJITO_SINPE_DIR . 'includes/class-mojito-sinpe-deactivator.php';
Mojito_Sinpe_Deactivator::deactivate();
}
);
/**
* The core plugin class that is used to define internationalization and public-facing site hooks.
*/
require_once MOJITO_SINPE_DIR . 'vendor/autoload.php';
require MOJITO_SINPE_DIR . 'includes/class-mojito-sinpe.php';
/**
* Begins execution.
*
* @since 1.0.0
*/
function mojito_sinpe_run() {
global $mojito_sinpe;
if ( ! isset( $mojito_sinpe ) ) {
$mojito_sinpe = new Mojito_Sinpe();
$mojito_sinpe->run();
}
}
/**
* Is multisite?
*/
$load = true;
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
if ( function_exists( 'is_plugin_active' ) && ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
$load = false;
require_once MOJITO_SINPE_DIR . 'admin/partials/mojito-sinpe-require-plugins-woocommerce.php';
}
} else {
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) {
$load = false;
require_once MOJITO_SINPE_DIR . 'admin/partials/mojito-sinpe-require-plugins-woocommerce.php';
}
}
if ( $load ) {
/**
* Compatibility with WooCommerce declarations
*/
add_action('before_woocommerce_init', function(){
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
});
mojito_sinpe_run();
}