| @@ -9,26 +9,63 @@ | ||
| 9 | 9 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 10 | 10 | * @since 1.1.0 |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + return; | |
| 15 | +} | |
| 13 | 16 | // Current SDK version and path. |
| 14 | -$themeisle_sdk_version = '2.1.2'; | |
| 17 | +$themeisle_sdk_version = '3.2.14'; | |
| 15 | 18 | $themeisle_sdk_path = dirname( __FILE__ ); |
| 16 | 19 | |
| 17 | 20 | global $themeisle_sdk_max_version; |
| 18 | 21 | global $themeisle_sdk_max_path; |
| 19 | 22 | |
| 20 | -if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_version ) >= 0 ) { | |
| 23 | +// If this is the latest SDK and it comes from a theme, we should load licenser separately. | |
| 24 | +$themeisle_sdk_relative_licenser_path = '/src/Modules/Licenser.php'; | |
| 25 | + | |
| 26 | +global $themeisle_sdk_abs_licenser_path; | |
| 27 | +if ( ! is_file( $themeisle_sdk_path . $themeisle_sdk_relative_licenser_path ) && is_file( $themeisle_sdk_max_path . $themeisle_sdk_relative_licenser_path ) ) { | |
| 28 | + $themeisle_sdk_abs_licenser_path = $themeisle_sdk_max_path . $themeisle_sdk_relative_licenser_path; | |
| 29 | + add_filter( 'themeisle_sdk_required_files', 'themeisle_sdk_load_licenser_if_present' ); | |
| 30 | +} | |
| 31 | +if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_path ) == 0 && | |
| 32 | + apply_filters( 'themeisle_sdk_should_overwrite_path', false, $themeisle_sdk_path, $themeisle_sdk_max_path ) ) { | |
| 33 | + $themeisle_sdk_max_path = $themeisle_sdk_path; | |
| 34 | +} | |
| 35 | + | |
| 36 | +if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_version ) > 0 ) { | |
| 21 | 37 | $themeisle_sdk_max_version = $themeisle_sdk_version; |
| 22 | 38 | $themeisle_sdk_max_path = $themeisle_sdk_path; |
| 23 | 39 | } |
| 24 | 40 | |
| 25 | -// load the latest sdk version from the active Themeisle products | |
| 41 | +// load the latest sdk version from the active Themeisle products. | |
| 42 | +if ( ! function_exists( 'themeisle_sdk_load_licenser_if_present' ) ) : | |
| 43 | + /** | |
| 44 | + * Always load the licenser, if present. | |
| 45 | + * | |
| 46 | + * @param array $to_load Previously files to load. | |
| 47 | + */ | |
| 48 | + function themeisle_sdk_load_licenser_if_present( $to_load ) { | |
| 49 | + global $themeisle_sdk_abs_licenser_path; | |
| 50 | + $to_load[] = $themeisle_sdk_abs_licenser_path; | |
| 51 | + | |
| 52 | + return $to_load; | |
| 53 | + } | |
| 54 | +endif; | |
| 55 | + | |
| 56 | +// load the latest sdk version from the active Themeisle products. | |
| 26 | 57 | if ( ! function_exists( 'themeisle_sdk_load_latest' ) ) : |
| 27 | 58 | /** |
| 28 | 59 | * Always load the latest sdk version. |
| 29 | 60 | */ |
| 30 | 61 | function themeisle_sdk_load_latest() { |
| 62 | + /** | |
| 63 | + * Don't load the library if we are on < 5.4. | |
| 64 | + */ | |
| 65 | + if ( version_compare( PHP_VERSION, '5.4.32', '<' ) ) { | |
| 66 | + return; | |
| 67 | + } | |
| 31 | 68 | global $themeisle_sdk_max_path; |
| 32 | 69 | require_once $themeisle_sdk_max_path . '/start.php'; |
| 33 | 70 | } |
| 34 | 71 | endif; |