/
dependencies.php
36 lines (32 loc) · 1.07 KB
/
dependencies.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
<?php
use WC_Better_Shipping_Calculator_for_Brazil\Helpers as h;
defined( 'WPINC' ) || exit( 1 );
return [
// Check the PHP version
'php' => [
'check' => function () {
$req_version = h::config_get( 'REQUIRED_PHP_VERSION', false );
$serv_version = \preg_replace( '/[^0-9\.]/', '', PHP_VERSION );
return $req_version && $serv_version ? \version_compare( $serv_version, $req_version, '>=' ) : true;
},
'message' => function () {
$req_version = h::config_get( 'REQUIRED_PHP_VERSION', false );
return sprintf(
/* translators: %s is replaced with <strong>PHP</strong> */
__( "Update your %s version to $req_version or later.", 'wc-better-shipping-calculator-for-brazil' ),
'<strong>PHP</strong>'
);
},
],
// Check if WooCommerce is activated
'woocommerce' => [
'check' => function () {
return \function_exists( 'WC' );
},
'message' => sprintf(
// translators: %s is replaced with a required plugin name
__( 'Install and activate the %s plugin.', 'wc-better-shipping-calculator-for-brazil' ),
'<strong>WooCommerce</strong>'
),
],
];