Plugin_Updater implements Registerable
Handles plugin update checks for our EDD plugins.
Tags
Interfaces, Classes and Traits
- Registerable
- An object that can be registered with WordPress via the Plugin API, i.e. add_action() and add_filter().
Table of Contents
- $cache_key : string
- $license_api : License_API
- $plugin : Licensed_Plugin
- __construct() : mixed
- check_update() : array<string|int, mixed>
- Check for Updates at the defined API endpoint and modify the update array.
- get_plugin_details() : object
- Updates information on the "View version x.x details" page with custom data.
- register() : void
- Register this object with WordPress.
- update_available_notice() : mixed
- format_version_info_for_plugin_details_modal() : mixed
- format_version_info_for_plugin_update() : object
- Remove unrequired properties from EDD version info when storing in the 'update_plugins' transient.
- get_cache_key() : mixed
- get_cached_version_info() : mixed
- get_latest_version() : mixed
- is_beta_testing() : mixed
- maybe_disable_automatic_update() : mixed
- set_cached_version_info() : mixed
Properties
$cache_key
private
string
$cache_key
= null
Internal key used for caching
$license_api
private
License_API
$license_api
The licensing API to fetch plugin updates from.
$plugin
private
Licensed_Plugin
$plugin
The plugin we're managing updates for.
Methods
__construct()
public
__construct(Licensed_Plugin $plugin, License_API $license_api) : mixed
Parameters
- $plugin : Licensed_Plugin
- $license_api : License_API
Return values
mixed —check_update()
Check for Updates at the defined API endpoint and modify the update array.
public
check_update(array<string|int, mixed> $transient_data) : array<string|int, mixed>
This function dives into the update API just when WordPress creates its update array, then adds a custom API call and injects the custom plugin data retrieved from the API. It is reassembled from parts of the native WordPress plugin update code. See wp-includes/update.php line 121 for the original wp_update_plugins() function.
Parameters
- $transient_data : array<string|int, mixed>
-
Plugin update object built by WordPress.
Return values
array<string|int, mixed> —Modified update array with custom plugin data.
get_plugin_details()
Updates information on the "View version x.x details" page with custom data.
public
get_plugin_details(mixed $data[, string $action = '' ][, object $args = null ]) : object
Parameters
- $data : mixed
- $action : string = ''
- $args : object = null
Return values
object —$data
register()
Register this object with WordPress.
public
register() : void
Return values
void —update_available_notice()
public
update_available_notice(mixed $plugin_data, mixed $response) : mixed
Parameters
- $plugin_data : mixed
- $response : mixed
Return values
mixed —format_version_info_for_plugin_details_modal()
private
format_version_info_for_plugin_details_modal(mixed $version_info) : mixed
Parameters
- $version_info : mixed
Return values
mixed —format_version_info_for_plugin_update()
Remove unrequired properties from EDD version info when storing in the 'update_plugins' transient.
private
format_version_info_for_plugin_update(object $version_info) : object
Parameters
- $version_info : object
-
The version info from EDD
Return values
object —The updated version info
get_cache_key()
private
get_cache_key() : mixed
Return values
mixed —get_cached_version_info()
private
get_cached_version_info() : mixed
Return values
mixed —get_latest_version()
private
get_latest_version() : mixed
Return values
mixed —is_beta_testing()
private
is_beta_testing() : mixed
Return values
mixed —maybe_disable_automatic_update()
private
maybe_disable_automatic_update(mixed $version_info) : mixed
Parameters
- $version_info : mixed
Return values
mixed —set_cached_version_info()
private
set_cached_version_info(mixed $version_info) : mixed
Parameters
- $version_info : mixed