/
functions-llms-helper.php
61 lines (52 loc) · 1.2 KB
/
functions-llms-helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Helper functions
*
* @package LifterLMS_Helper/Functions
*
* @since 2.2.0
* @version 3.0.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Retrieve the LLMS_Helper_Options singleton
*
* @since 3.0.0
*
* @return LLMS_Helper_Options
*/
function llms_helper_options() {
return LLMS_Helper_Options::instance();
}
/**
* Retrieve an array of addons that are available via currently active License Keys
*
* @since 3.0.0
*
* @param bool $installable_only If true, only includes installable addons, if false, includes non-installable addons (like bundles).
* @return array
*/
function llms_helper_get_available_add_ons( $installable_only = true ) {
$ids = array();
foreach ( llms_helper_options()->get_license_keys() as $key ) {
if ( 1 == $key['status'] ) {
$ids = array_merge( $ids, $key['addons'] );
}
if ( false === $installable_only ) {
$ids[] = $key['product_id'];
}
}
return array_unique( $ids );
}
/**
* Deletes transient data related to plugin and theme updates
*
* @since 3.2.1
*
* @return void
*/
function llms_helper_flush_cache() {
delete_transient( 'llms_products_api_result' );
delete_site_transient( 'update_plugins' );
delete_site_transient( 'update_themes' );
}