| @@ -49,14 +49,17 @@ | ||
| 49 | 49 | 'dashboard_widget', |
| 50 | 50 | 'rollback', |
| 51 | 51 | 'uninstall_feedback', |
| 52 | 52 | 'licenser', |
| 53 | - 'endpoint', | |
| 54 | - 'notification', | |
| 55 | 53 | 'logger', |
| 56 | 54 | 'translate', |
| 57 | 55 | 'review', |
| 58 | - | |
| 56 | + 'recommendation', | |
| 57 | + 'notification', | |
| 58 | + 'promotions', | |
| 59 | + 'welcome', | |
| 60 | + 'compatibilities', | |
| 61 | + 'about_us', | |
| 59 | 62 | ]; |
| 60 | 63 | |
| 61 | 64 | /** |
| 62 | 65 | * Initialize the sdk logic. |
| @@ -74,8 +77,30 @@ | ||
| 74 | 77 | } |
| 75 | 78 | } |
| 76 | 79 | |
| 77 | 80 | /** |
| 81 | + * Get cache token used in API requests. | |
| 82 | + * | |
| 83 | + * @return string Cache token. | |
| 84 | + */ | |
| 85 | + public static function get_cache_token() { | |
| 86 | + $cache_token = get_transient( 'themeisle_sdk_cache_token' ); | |
| 87 | + if ( false === $cache_token ) { | |
| 88 | + $cache_token = wp_generate_password( 6, false ); | |
| 89 | + set_transient( $cache_token, WEEK_IN_SECONDS ); | |
| 90 | + } | |
| 91 | + | |
| 92 | + return $cache_token; | |
| 93 | + } | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * Clear cache token. | |
| 97 | + */ | |
| 98 | + public static function clear_cache_token() { | |
| 99 | + delete_transient( 'themeisle_sdk_cache_token' ); | |
| 100 | + } | |
| 101 | + | |
| 102 | + /** | |
| 78 | 103 | * Register product into SDK. |
| 79 | 104 | * |
| 80 | 105 | * @param string $base_file The product base file. |
| 81 | 106 | * |
| @@ -82,9 +107,9 @@ | ||
| 82 | 107 | * @return Loader The singleton object. |
| 83 | 108 | */ |
| 84 | 109 | public static function add_product( $base_file ) { |
| 85 | 110 | |
| 86 | - if ( ! is_readable( $base_file ) ) { | |
| 111 | + if ( ! is_file( $base_file ) ) { | |
| 87 | 112 | return self::$instance; |
| 88 | 113 | } |
| 89 | 114 | $product = new Product( $base_file ); |
| 90 | 115 | |
| @@ -112,6 +137,14 @@ | ||
| 112 | 137 | public static function get_products() { |
| 113 | 138 | return self::$products; |
| 114 | 139 | } |
| 115 | 140 | |
| 141 | + /** | |
| 142 | + * Get the version of the SDK. | |
| 143 | + * | |
| 144 | + * @return string The version. | |
| 145 | + */ | |
| 146 | + public static function get_version() { | |
| 147 | + return self::$version; | |
| 148 | + } | |
| 116 | 149 | |
| 117 | 150 | } |