Skip to content

Commit

Permalink
Merge pull request #66 from Codeinwp/fix_license_load
Browse files Browse the repository at this point in the history
fix: not loading licenser when SDK comes from theme [#65
  • Loading branch information
selul authored Jul 16, 2019
2 parents 259e2af + cd50434 commit 419d8e6
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion load.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@
global $themeisle_sdk_max_version;
global $themeisle_sdk_max_path;

// If this is the latest SDK and it comes from a theme, we should load licenser separately.
$themeisle_sdk_relative_licenser_path = '/src/Modules/Licenser.php';

global $themeisle_sdk_abs_licenser_path;
if ( ! file_exists( $themeisle_sdk_path . $themeisle_sdk_relative_licenser_path ) && file_exists( $themeisle_sdk_max_path . $themeisle_sdk_relative_licenser_path ) ) {
$themeisle_sdk_abs_licenser_path = $themeisle_sdk_max_path . $themeisle_sdk_relative_licenser_path;
add_filter( 'themeisle_sdk_required_files', 'themeisle_sdk_load_licenser_if_present' );
}
if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_path ) == 0 &&
apply_filters( 'themeisle_sdk_should_overwrite_path', false, $themeisle_sdk_path, $themeisle_sdk_max_path ) ) {
apply_filters( 'themeisle_sdk_should_overwrite_path', false, $themeisle_sdk_path, $themeisle_sdk_max_path ) ) {
$themeisle_sdk_max_path = $themeisle_sdk_path;
}

Expand All @@ -30,6 +38,21 @@
$themeisle_sdk_max_path = $themeisle_sdk_path;
}

// load the latest sdk version from the active Themeisle products.
if ( ! function_exists( 'themeisle_sdk_load_licenser_if_present' ) ) :
/**
* Always load the licenser, if present.
*
* @param array $to_load Previously files to load.
*/
function themeisle_sdk_load_licenser_if_present( $to_load ) {
global $themeisle_sdk_abs_licenser_path;
$to_load[] = $themeisle_sdk_abs_licenser_path;

return $to_load;
}
endif;

// load the latest sdk version from the active Themeisle products.
if ( ! function_exists( 'themeisle_sdk_load_latest' ) ) :
/**
Expand Down

0 comments on commit 419d8e6

Please sign in to comment.