PHP Class Yoast_Update_Manager

Show file Open project: yoast/license-manager Class Usage Examples

Protected Properties

Property Type Description
$error_message string
$license_manager Yoast_License_Manager
$product Yoast_Product
$update_response object

Public Methods

Method Description
__construct ( Yoast_Product $product, Yoast_License_Manager $license_manager ) Constructor
show_update_error ( ) If the update check returned a WP_Error, show it to the user

Protected Methods

Method Description
get_remote_data ( ) : object Gets the remote product data (from the EDD API)

Private Methods

Method Description
call_remote_api ( ) : false | object Calls the API and, if successfull, returns the object delivered by the API.
get_cached_remote_data ( ) : boolean | mixed Gets the remote product data from a 3-hour transient
maybe_delete_transients ( ) Deletes the various transients If we're on the update-core.php?force-check=1 page

Method Details

__construct() public method

Constructor
public __construct ( Yoast_Product $product, Yoast_License_Manager $license_manager )
$product Yoast_Product The product.
$license_manager Yoast_License_Manager The License Manager.

get_remote_data() protected method

- If it was previously fetched in the current requests, this gets it from the instance property - Next, it tries the 3-hour transient - Next, it calls the remote API and stores the result
protected get_remote_data ( ) : object
return object

show_update_error() public method

If the update check returned a WP_Error, show it to the user
public show_update_error ( )

Property Details

$error_message protected property

protected string $error_message
return string

$license_manager protected property

protected Yoast_License_Manager $license_manager
return Yoast_License_Manager

$product protected property

protected Yoast_Product $product
return Yoast_Product

$update_response protected property

protected object $update_response
return object