PHP Class EDD_SL_Plugin_Updater, Give

Author: Pippin Williamson
Datei anzeigen Open project: wordimpress/give Class Usage Examples

Public Methods

Method Description
__construct ( string $_api_url, string $_plugin_file, array $_api_data = null ) : void Class constructor.
check_update ( array $_transient_data ) : array Check for Updates at the defined API endpoint and modify the update array.
http_request_args ( array $args, string $url ) : object Disable SSL verification in order to prevent download update failures
init ( ) : void Set up WordPress filters to hook into WP's update process.
plugins_api_filter ( mixed $_data, string $_action = '', object $_args = null ) : object Updates information on the "View version x.x details" page with custom data.
show_changelog ( )
show_update_notification ( string $file, array $plugin ) show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!

Private Methods

Method Description
api_request ( string $_action, array $_data ) : false | object Calls the API and, if successfull, returns the object delivered by the API.

Method Details

__construct() public method

Class constructor.
public __construct ( string $_api_url, string $_plugin_file, array $_api_data = null ) : void
$_api_url string The URL pointing to the custom API endpoint.
$_plugin_file string Path to the plugin file.
$_api_data array Optional data to send with API calls.
return void

check_update() public method

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.
public check_update ( array $_transient_data ) : array
$_transient_data array Update array build by WordPress.
return array Modified update array with custom plugin data.

http_request_args() public method

Disable SSL verification in order to prevent download update failures
public http_request_args ( array $args, string $url ) : object
$args array
$url string
return object $array

init() public method

Set up WordPress filters to hook into WP's update process.
public init ( ) : void
return void

plugins_api_filter() public method

Updates information on the "View version x.x details" page with custom data.
public plugins_api_filter ( mixed $_data, string $_action = '', object $_args = null ) : object
$_data mixed
$_action string
$_args object
return object $_data

show_changelog() public method

public show_changelog ( )

show_update_notification() public method

show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
public show_update_notification ( string $file, array $plugin )
$file string
$plugin array