-
Notifications
You must be signed in to change notification settings - Fork 12
/
class-wc-pd-core-compatibility.php
49 lines (44 loc) · 1.2 KB
/
class-wc-pd-core-compatibility.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
<?php
/**
* WC_PD_Core_Compatibility class
*
* @author SomewhereWarm <sw@somewherewarm.net>
* @package WooCommerce Product Dependencies
* @since 1.1.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Functions for WC core back-compatibility.
*
* @class WC_PD_Core_Compatibility
*/
class WC_PD_Core_Compatibility {
/**
* Helper method to get the version of the currently installed WooCommerce.
*
* @return string
*/
private static function get_wc_version() {
return defined( 'WC_VERSION' ) && WC_VERSION ? WC_VERSION : null;
}
/**
* Returns true if the installed version of WooCommerce is 8.2 or greater.
*
* @return boolean
*/
public static function is_wc_version_gte_8_2() {
return self::get_wc_version() && version_compare( self::get_wc_version(), '8.2', '>=' );
}
/**
* Returns true if the installed version of WooCommerce is greater than $version.
*
* @param string $version the version to compare
* @return boolean true if the installed version of WooCommerce is > $version
*/
public static function is_wc_version_gt( $version ) {
return self::get_wc_version() && version_compare( self::get_wc_version(), $version, '>' );
}
}