Inventory_Presser_Addon_Updater::get_cached_version_info( string $cache_key = '' )

Gets the plugin’s cached version information from the database.


Parameters Parameters

$cache_key

(string) (Optional)

Default value: ''


Top ↑

Return Return

(boolean|string)


Top ↑

Source Source

File: includes/class-addon-updater.php

		public function get_cached_version_info( $cache_key = '' ) {
	
			if( empty( $cache_key ) ) {
				$cache_key = $this->cache_key;
			}
	
			$cache = get_option( $cache_key );
	
			if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
				return false; // Cache is expired
			}
	
			// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
			$cache['value'] = json_decode( $cache['value'] );
			if ( ! empty( $cache['value']->icons ) ) {
				$cache['value']->icons = (array) $cache['value']->icons;
			}
	
			return $cache['value'];
	
		}