Skip to content

Commit e6873cd

Browse files
authored
release(minor): cli and new api
* adds license activation/deactivation handlers for wp cli * adds compatibility with the newest license API
2 parents ec99550 + 37821fc commit e6873cd

File tree

4 files changed

+267
-75
lines changed

4 files changed

+267
-75
lines changed

src/Loader.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,28 @@ public static function init() {
7575
}
7676
}
7777

78+
/**
79+
* Get cache token used in API requests.
80+
*
81+
* @return string Cache token.
82+
*/
83+
public static function get_cache_token() {
84+
$cache_token = get_transient( 'themeisle_sdk_cache_token' );
85+
if ( false === $cache_token ) {
86+
$cache_token = wp_generate_password( 6, false );
87+
set_transient( $cache_token, WEEK_IN_SECONDS );
88+
}
89+
90+
return $cache_token;
91+
}
92+
93+
/**
94+
* Clear cache token.
95+
*/
96+
public static function clear_cache_token() {
97+
delete_transient( 'themeisle_sdk_cache_token' );
98+
}
99+
78100
/**
79101
* Register product into SDK.
80102
*

0 commit comments

Comments
 (0)