nction_exists( '\\as_unschedule_action' ) ||
! function_exists( '\\as_schedule_single_action' )
) {
wcpdf_log_error( 'Action Scheduler functions not available. Cannot schedule or clear the extensions license cache.', 'critical' );
return $license_info;
}
if ( \as_next_scheduled_action( 'wpo_wcpdf_schedule_extensions_license_cache_clearing' ) ) {
\as_unschedule_action( 'wpo_wcpdf_schedule_extensions_license_cache_clearing' );
}
\as_schedule_single_action( strtotime( "+1 week" ), 'wpo_wcpdf_schedule_extensions_license_cache_clearing' );
return $license_info;
}
/**
* Clear extensions license cache
*
* @return void
*/
public function clear_extensions_license_cache() {
delete_option( 'wpo_wcpdf_extensions_license_cache' );
}
/**
* Get extensions license data
*
* @param string $type can be 'cached' or 'live'
* @return array
*/
public function get_extensions_license_data( string $type = 'cached' ): array {
$option_key = 'wpo_wcpdf_extensions_license_cache';
// default to fetching cached data
$data = get_option( $option_key, array() );
// if type is 'live' or cached data is empty, fetch live data
if ( 'live' === $type || empty( $data ) ) {
$data = $this->get_extension_license_infos( true );
if ( 'cached' === $type ) {
update_option( $option_key, $data );
}
}
return $data;
}
/**
* Check if are any extensions installed
*
* @return bool
*/
public function are_any_extensions_installed() {
$installed = false;
foreach ( $this->extensions as $extension ) {
if ( $this->extension_is_enabled( $extension ) ) {
$installed = true;
break;
}
}
return $installed;
}
}
endif; // class_exists
Shop | Riaz Ul Quran | Islamic Books
-
-11%

-
-
-
-36%

-
-
-
-
-
-
-
-