| @@ -13,16 +13,24 @@ | ||
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | 14 | return; |
| 15 | 15 | } |
| 16 | 16 | // Current SDK version and path. |
| 17 | -$themeisle_sdk_version = '3.0.4'; | |
| 17 | +$themeisle_sdk_version = '3.1.8'; | |
| 18 | 18 | $themeisle_sdk_path = dirname( __FILE__ ); |
| 19 | 19 | |
| 20 | 20 | global $themeisle_sdk_max_version; |
| 21 | 21 | global $themeisle_sdk_max_path; |
| 22 | 22 | |
| 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 | +} | |
| 23 | 31 | if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_path ) == 0 && |
| 24 | - apply_filters( 'themeisle_sdk_should_overwrite_path', false, $themeisle_sdk_path, $themeisle_sdk_max_path ) ) { | |
| 32 | + apply_filters( 'themeisle_sdk_should_overwrite_path', false, $themeisle_sdk_path, $themeisle_sdk_max_path ) ) { | |
| 25 | 33 | $themeisle_sdk_max_path = $themeisle_sdk_path; |
| 26 | 34 | } |
| 27 | 35 | |
| 28 | 36 | if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_version ) > 0 ) { |
| @@ -28,8 +36,23 @@ | ||
| 28 | 36 | if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_version ) > 0 ) { |
| 29 | 37 | $themeisle_sdk_max_version = $themeisle_sdk_version; |
| 30 | 38 | $themeisle_sdk_max_path = $themeisle_sdk_path; |
| 31 | 39 | } |
| 40 | + | |
| 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; | |
| 32 | 55 | |
| 33 | 56 | // load the latest sdk version from the active Themeisle products. |
| 34 | 57 | if ( ! function_exists( 'themeisle_sdk_load_latest' ) ) : |
| 35 | 58 | /** |